Skip to content

Commit 35dd379

Browse files
135912: Add support for numeric arguments in decorators
1 parent b043a27 commit 35dd379

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

scripts/generate-decorator-registries.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
isEnumDeclaration,
2626
isExpressionWithTypeArguments,
2727
isIdentifier,
28+
isNumericLiteral,
2829
isPropertyAccessExpression,
2930
isStringLiteral,
3031
ScriptTarget,
@@ -289,6 +290,9 @@ const parseDecoratorArguments = (
289290
args.push(true);
290291
} else if (arg.kind === SyntaxKind.FalseKeyword) {
291292
args.push(false);
293+
// e.g. @decorator(123)
294+
} else if (isNumericLiteral(arg)) {
295+
args.push(Number(arg.text));
292296
}
293297
});
294298
return { args: args, imports: argImports };

0 commit comments

Comments
 (0)