Skip to content

Commit

Permalink
return multi param
Browse files Browse the repository at this point in the history
  • Loading branch information
amerharb committed Nov 30, 2023
1 parent 5bcf41e commit 1d79eae
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions webapp/src/utils/readTypedMessages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ts from 'typescript';

export default function readTypedMessages(fileName: string) {
export default function readTypedMessages(fileName: string): MessageData[] {
const host = ts.createIncrementalCompilerHost(
{},
{
Expand Down Expand Up @@ -88,9 +88,8 @@ function inspectMessages(node: ts.CallExpression): MessageData[] {
defaultMessage: argNode.text,
id: id,
params:
callNode.typeArguments?.map((typeArg) => {
const typeNode = typeArg as ts.TypeLiteralNode;
const memberNode = typeNode.members[0] as ts.PropertySignature;
(callNode.typeArguments?.[0] as ts.TypeLiteralNode)?.members.map((member) => {
const memberNode = member as ts.PropertySignature;
const typeIdNode = memberNode.name as ts.Identifier;
if (memberNode.type?.kind == ts.SyntaxKind.UnionType) {
const unionNode = memberNode.type as ts.UnionTypeNode;
Expand Down

0 comments on commit 1d79eae

Please sign in to comment.