Add --metadataDecorator option

This commit is contained in:
Ron Buckton
2021-04-05 17:28:48 -07:00
parent 11097c622c
commit 116c09948e
112 changed files with 3642 additions and 528 deletions
+409 -142
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -872,6 +872,21 @@ namespace ts {
description: Diagnostics.Include_modules_imported_with_json_extension
},
{
name: "metadataDecorator",
type: "string",
category: Diagnostics.Advanced_Options,
description: Diagnostics.Specify_the_name_of_the_metadata_decorator_function_to_use_when_emitDecoratorMetadata_is_set
},
{
name: "metadataDecoratorImportSource",
type: "string",
affectsEmit: true,
affectsModuleResolution: true,
category: Diagnostics.Advanced_Options,
description: Diagnostics.Specify_the_module_specifier_to_be_used_to_import_the_metadata_decorator_provided_by_metadataDecorator
},
{
name: "out",
type: "string",
+34 -5
View File
@@ -1360,6 +1360,19 @@
"category": "Error",
"code": 1432
},
"Unable to resolve signature of implicit decorator '{0}' when called as an expression.": {
"category": "Error",
"code": 1433
},
"Unable to resolve signature of implicit decorator '{0}' from module '{1}' when called as an expression.": {
"category": "Error",
"code": 1434
},
"Unable to import implicit decorator '{0}' from module '{1}' as this file is not a module.": {
"category": "Error",
"code": 1435
},
"The types of '{0}' are incompatible between these types.": {
"category": "Error",
@@ -3308,6 +3321,18 @@
"category": "Error",
"code": 2808
},
"Namespace '{0}' from module '{1}' has no exported member '{2}'.": {
"category": "Error",
"code": 2809
},
"'{0}' from module '{1}' has no exported member named '{2}'. Did you mean '{3}'?": {
"category": "Error",
"code": 2810
},
"Cannot find namespace '{0}'. Did you mean '{1}?": {
"category": "Error",
"code": 2811
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
@@ -3814,7 +3839,7 @@
"category": "Error",
"code": 5066
},
"Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name.": {
"Invalid value for '{0}'. '{1}' is not a valid identifier or qualified-name.": {
"category": "Error",
"code": 5067
},
@@ -4821,6 +4846,14 @@
"category": "Error",
"code": 6238
},
"Specify the name of the metadata decorator function to use when '--emitDecoratorMetadata' is set": {
"category": "Message",
"code": 6239
},
"Specify the module specifier to be used to import the metadata decorator provided by '--metadataDecorator'.": {
"category": "Message",
"code": 6240
},
"Projects to reference": {
"category": "Message",
@@ -6438,10 +6471,6 @@
"category": "Message",
"code": 18034
},
"Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name.": {
"category": "Error",
"code": 18035
},
"Class decorators can't be used with static private identifier. Consider removing the experimental decorator.": {
"category": "Error",
"code": 18036
+2 -2
View File
@@ -234,7 +234,7 @@ namespace ts {
// ES2017 Helpers
function createAwaiterHelper(hasLexicalThis: boolean, hasLexicalArguments: boolean, promiseConstructor: EntityName | Expression | undefined, body: Block) {
function createAwaiterHelper(hasLexicalThis: boolean, hasLexicalArguments: boolean, promiseConstructor: EntityNameOrEntityNameExpression | undefined, body: Block) {
context.requestEmitHelper(awaiterHelper);
const generatorFunc = factory.createFunctionExpression(
@@ -256,7 +256,7 @@ namespace ts {
[
hasLexicalThis ? factory.createThis() : factory.createVoidZero(),
hasLexicalArguments ? factory.createIdentifier("arguments") : factory.createVoidZero(),
promiseConstructor ? createExpressionFromEntityName(factory, promiseConstructor) : factory.createVoidZero(),
promiseConstructor ? isEntityName(promiseConstructor) ? createExpressionFromEntityName(factory, promiseConstructor) : promiseConstructor : factory.createVoidZero(),
generatorFunc
]
);
+20
View File
@@ -259,4 +259,24 @@ namespace ts {
getOrCreateEmitNode(node).flags |= EmitFlags.IgnoreSourceNewlines;
return node;
}
/**
* For a synthetic import, specifies the synthesized import reference so that the import can be resolved during subsequent transformations.
*
* @param node Imported identifier
* @param importReference The `ImportSpecifier` to use for the reference, or `undefined`.
*/
/* @internal */
export function setGeneratedImportReference<T extends Identifier>(node: T, importReference: ImportSpecifier | undefined) {
getOrCreateEmitNode(node).generatedImportReference = importReference;
return node;
}
/**
* For a synthetic import, gets any associated synthesized import reference.
*/
/* @internal */
export function getGeneratedImportReference(node: Identifier) {
return node.emitNode?.generatedImportReference;
}
}
+12
View File
@@ -427,6 +427,7 @@ namespace ts {
createUnparsedSyntheticReference,
createInputFiles,
createSyntheticExpression,
createSyntheticCallExpression,
createSyntaxList,
createNotEmittedStatement,
createPartiallyEmittedExpression,
@@ -5104,6 +5105,17 @@ namespace ts {
return node;
}
// @api
function createSyntheticCallExpression(thisArg: LeftHandSideExpression | SyntheticExpression | undefined, expression: Expression | SyntheticExpression, typeArguments: readonly TypeNode[] | undefined, argumentList: readonly Expression[], containingMessageChain?: () => DiagnosticMessageChain | undefined): SyntheticCallExpression {
const node = createBaseNode<SyntheticCallExpression>(SyntaxKind.SyntheticCallExpression);
node.thisArg = thisArg;
node.expression = expression;
node.typeArguments = typeArguments;
node.arguments = argumentList;
node.containingMessageChain = containingMessageChain;
return node;
}
// @api
function createSyntaxList(children: Node[]) {
const node = createBaseNode<SyntaxList>(SyntaxKind.SyntaxList);
+5 -1
View File
@@ -444,6 +444,10 @@ namespace ts {
return node.kind === SyntaxKind.CommaListExpression;
}
export function isSyntheticCallExpression(node: Node): node is SyntheticCallExpression {
return node.kind === SyntaxKind.SyntheticCallExpression;
}
// Misc
export function isTemplateSpan(node: Node): node is TemplateSpan {
@@ -629,7 +633,7 @@ namespace ts {
}
/* @internal */
export function isSyntheticReference(node: Node): node is SyntheticReferenceExpression {
export function isSyntheticReferenceExpression(node: Node): node is SyntheticReferenceExpression {
return node.kind === SyntaxKind.SyntheticReferenceExpression;
}
+18 -7
View File
@@ -157,16 +157,27 @@ namespace ts {
}
}
export function createExpressionFromEntityName(factory: NodeFactory, node: EntityName | Expression): Expression {
export function createExpressionFromEntityName(factory: NodeFactory, node: EntityName, emulateParseTree = true): EntityNameExpression {
if (isQualifiedName(node)) {
const left = createExpressionFromEntityName(factory, node.left);
// TODO(rbuckton): Does this need to be parented?
const right = setParent(setTextRange(factory.cloneNode(node.right), node.right), node.right.parent);
return setTextRange(factory.createPropertyAccessExpression(left, right), node);
const left = createExpressionFromEntityName(factory, node.left, emulateParseTree);
const right = factory.cloneNode(node.right);
if (emulateParseTree) {
setTextRange(right, node.right);
setParent(right, node.right.parent);
}
const expression = factory.createPropertyAccessExpression(left, right);
if (emulateParseTree) {
setTextRange(expression, node);
}
return expression as PropertyAccessEntityNameExpression;
}
else {
// TODO(rbuckton): Does this need to be parented?
return setParent(setTextRange(factory.cloneNode(node), node), node.parent);
const name = factory.cloneNode(node);
if (emulateParseTree) {
setTextRange(name, node);
setParent(name, node.parent);
}
return name;
}
}
+36 -4
View File
@@ -2290,6 +2290,14 @@ namespace ts {
// synthesize `import "base/jsx-runtime"` declaration
(imports ||= []).push(createSyntheticImport(jsxImport, file));
}
if (file.transformFlags & TransformFlags.ContainsTypeScriptClassSyntax &&
options.emitDecoratorMetadata &&
options.metadataDecorator) {
const metadataDecoratorImport = options.metadataDecoratorImportSource;
if (metadataDecoratorImport) {
(imports ||= []).push(createSyntheticImport(metadataDecoratorImport, file));
}
}
}
for (const node of file.statements) {
@@ -3244,6 +3252,30 @@ namespace ts {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
}
if (options.metadataDecorator) {
if (!options.experimentalDecorators) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "metadataDecorator", "experimentalDecorators");
}
if (!options.emitDecoratorMetadata) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "metadataDecorator", "emitDecoratorMetadata");
}
if (!parseIsolatedEntityName(options.metadataDecorator, languageVersion)) {
createOptionValueDiagnostic("metadataDecorator", Diagnostics.Invalid_value_for_0_1_is_not_a_valid_identifier_or_qualified_name, "metadataDecorator", options.metadataDecorator);
}
}
if (options.metadataDecoratorImportSource) {
if (!options.experimentalDecorators) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "metadataDecorator", "experimentalDecorators");
}
if (!options.emitDecoratorMetadata) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "metadataDecorator", "emitDecoratorMetadata");
}
if (!options.metadataDecorator) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "metadataDecoratorImportSource", "metadataDecorator");
}
}
if (options.jsxFactory) {
if (options.reactNamespace) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory");
@@ -3252,7 +3284,7 @@ namespace ts {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "jsxFactory", inverseJsxOptionMap.get("" + options.jsx));
}
if (!parseIsolatedEntityName(options.jsxFactory, languageVersion)) {
createOptionValueDiagnostic("jsxFactory", Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory);
createOptionValueDiagnostic("jsxFactory", Diagnostics.Invalid_value_for_0_1_is_not_a_valid_identifier_or_qualified_name, "jsxFactory", options.jsxFactory);
}
}
else if (options.reactNamespace && !isIdentifierText(options.reactNamespace, languageVersion)) {
@@ -3267,7 +3299,7 @@ namespace ts {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_when_option_jsx_is_1, "jsxFragmentFactory", inverseJsxOptionMap.get("" + options.jsx));
}
if (!parseIsolatedEntityName(options.jsxFragmentFactory, languageVersion)) {
createOptionValueDiagnostic("jsxFragmentFactory", Diagnostics.Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFragmentFactory);
createOptionValueDiagnostic("jsxFragmentFactory", Diagnostics.Invalid_value_for_0_1_is_not_a_valid_identifier_or_qualified_name, "jsxFragmentFactory", options.jsxFragmentFactory);
}
}
@@ -3553,8 +3585,8 @@ namespace ts {
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
}
function createOptionValueDiagnostic(option1: string, message: DiagnosticMessage, arg0: string) {
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
function createOptionValueDiagnostic(option1: string, message: DiagnosticMessage, arg0: string, arg1?: string) {
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0, arg1);
}
function createDiagnosticForReference(sourceFile: JsonSourceFile | undefined, index: number, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number) {
+7 -7
View File
@@ -23,14 +23,14 @@ namespace ts {
switch (node.kind) {
case SyntaxKind.CallExpression: {
const updated = visitNonOptionalCallExpression(node as CallExpression, /*captureThisArg*/ false);
Debug.assertNotNode(updated, isSyntheticReference);
Debug.assertNotNode(updated, isSyntheticReferenceExpression);
return updated;
}
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
if (isOptionalChain(node)) {
const updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false);
Debug.assertNotNode(updated, isSyntheticReference);
Debug.assertNotNode(updated, isSyntheticReferenceExpression);
return updated;
}
return visitEachChild(node, visitor, context);
@@ -59,7 +59,7 @@ namespace ts {
function visitNonOptionalParenthesizedExpression(node: ParenthesizedExpression, captureThisArg: boolean, isDelete: boolean): Expression {
const expression = visitNonOptionalExpression(node.expression, captureThisArg, isDelete);
if (isSyntheticReference(expression)) {
if (isSyntheticReferenceExpression(expression)) {
// `(a.b)` -> { expression `((_a = a).b)`, thisArg: `_a` }
// `(a[b])` -> { expression `((_a = a)[b])`, thisArg: `_a` }
return factory.createSyntheticReferenceExpression(factory.updateParenthesizedExpression(node, expression.expression), expression.thisArg);
@@ -74,7 +74,7 @@ namespace ts {
}
let expression: Expression = visitNode(node.expression, visitor, isExpression);
Debug.assertNotNode(expression, isSyntheticReference);
Debug.assertNotNode(expression, isSyntheticReferenceExpression);
let thisArg: Expression | undefined;
if (captureThisArg) {
@@ -102,7 +102,7 @@ namespace ts {
// capture thisArg for calls of parenthesized optional chains like `(foo?.bar)()`
const expression = visitNonOptionalParenthesizedExpression(node.expression, /*captureThisArg*/ true, /*isDelete*/ false);
const args = visitNodes(node.arguments, visitor, isExpression);
if (isSyntheticReference(expression)) {
if (isSyntheticReferenceExpression(expression)) {
return setTextRange(factory.createFunctionCallCall(expression.expression, expression.thisArg, args), node);
}
return factory.updateCallExpression(node, expression, /*typeArguments*/ undefined, args);
@@ -123,8 +123,8 @@ namespace ts {
function visitOptionalExpression(node: OptionalChain, captureThisArg: boolean, isDelete: boolean): Expression {
const { expression, chain } = flattenChain(node);
const left = visitNonOptionalExpression(expression, isCallChain(chain[0]), /*isDelete*/ false);
const leftThisArg = isSyntheticReference(left) ? left.thisArg : undefined;
let leftExpression = isSyntheticReference(left) ? left.expression : left;
const leftThisArg = isSyntheticReferenceExpression(left) ? left.thisArg : undefined;
let leftExpression = isSyntheticReferenceExpression(left) ? left.expression : left;
let capturedLeft: Expression = leftExpression;
if (!isSimpleCopiableExpression(leftExpression)) {
capturedLeft = factory.createTempVariable(hoistVariableDeclaration);
+2 -2
View File
@@ -57,7 +57,7 @@ namespace ts {
}
const generatedName = factory.createUniqueName(`_${name}`, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel | GeneratedIdentifierFlags.AllowNameSubstitution);
const specifier = factory.createImportSpecifier(factory.createIdentifier(name), generatedName);
generatedName.generatedImportReference = specifier;
setGeneratedImportReference(generatedName, specifier);
specifierSourceImports.set(name, specifier);
return generatedName;
}
@@ -525,7 +525,7 @@ namespace ts {
return factory.createStringLiteral(idText(name));
}
else {
return createExpressionFromEntityName(factory, name);
return name;
}
}
}
+115 -35
View File
@@ -67,6 +67,9 @@ namespace ts {
let currentNameScope: ClassDeclaration | undefined;
let currentScopeFirstDeclarationsOfName: UnderscoreEscapedMap<Node> | undefined;
let currentClassHasParameterProperties: boolean | undefined;
let currentMetadataDecoratorImportSpecifier: ImportSpecifier | undefined;
const getMetadataDecoratorEntityNameExpression = memoize(getMetadataDecoratorEntityNameExpressionWorker);
/**
* Keeps track of whether expression substitution has been enabled for specific edge cases.
@@ -120,6 +123,7 @@ namespace ts {
addEmitHelpers(visited, context.readEmitHelpers());
currentSourceFile = undefined!;
currentMetadataDecoratorImportSpecifier = undefined;
return visited;
}
@@ -560,9 +564,39 @@ namespace ts {
!(isExternalModule(node) && moduleKind >= ModuleKind.ES2015) &&
!isJsonSourceFile(node);
return factory.updateSourceFile(
node,
visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict));
let statements = visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict);
if (compilerOptions.metadataDecoratorImportSource && currentMetadataDecoratorImportSpecifier) {
if (isExternalModule(node) || compilerOptions.isolatedModules) {
const importStatement = factory.createImportDeclaration(
/*decorators*/ undefined,
/*modifiers*/ undefined,
factory.createImportClause(
/*typeOnly*/ false,
/*name*/ undefined,
factory.createNamedImports([currentMetadataDecoratorImportSpecifier])
),
factory.createStringLiteral(compilerOptions.metadataDecoratorImportSource));
setParentRecursive(importStatement, /*incremental*/ false);
statements = setTextRange(factory.createNodeArray(insertStatementAfterCustomPrologue(statements.slice(), importStatement)), statements);
}
else if (isExternalOrCommonJsModule(node)) {
// Add `require` statement
const requireStatement = factory.createVariableStatement(/*modifiers*/ undefined, factory.createVariableDeclarationList([
factory.createVariableDeclaration(
factory.createObjectBindingPattern([
factory.createBindingElement(/*dotdotdot*/ undefined, currentMetadataDecoratorImportSpecifier.propertyName, currentMetadataDecoratorImportSpecifier.name)
]),
/*exclaimationToken*/ undefined,
/*type*/ undefined,
factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, [factory.createStringLiteral(compilerOptions.metadataDecoratorImportSource)])
)
], NodeFlags.Const));
setParentRecursive(requireStatement, /*incremental*/ false);
statements = setTextRange(factory.createNodeArray(insertStatementAfterCustomPrologue(statements.slice(), requireStatement)), statements);
}
}
return factory.updateSourceFile(node, statements);
}
/**
@@ -1309,16 +1343,59 @@ namespace ts {
}
}
function replaceFirstIdentifier(name: EntityNameExpression, newFirst: Identifier): EntityNameExpression {
return isPropertyAccessEntityNameExpression(name) ?
factory.updatePropertyAccessExpression(name, replaceFirstIdentifier(name.expression, newFirst), name.name) as PropertyAccessEntityNameExpression :
newFirst;
}
function getMetadataDecoratorEntityNameExpressionWorker() {
if (compilerOptions.metadataDecorator) {
const entityName = parseIsolatedEntityName(compilerOptions.metadataDecorator, getEmitScriptTarget(compilerOptions));
return entityName && serializeEntityNameAsExpression(entityName, /*emulateParseTree*/ false);
}
}
function getMetadataDecoratorExpression() {
const entityNameExpression = getMetadataDecoratorEntityNameExpression();
if (entityNameExpression) {
if (compilerOptions.metadataDecoratorImportSource) {
if (!currentMetadataDecoratorImportSpecifier) {
const first = getFirstIdentifier(entityNameExpression);
const generatedName = factory.createUniqueName(idText(first), GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel);
currentMetadataDecoratorImportSpecifier = factory.createImportSpecifier(first, generatedName);
setGeneratedImportReference(generatedName, currentMetadataDecoratorImportSpecifier);
}
return replaceFirstIdentifier(entityNameExpression, currentMetadataDecoratorImportSpecifier.name);
}
return entityNameExpression;
}
}
function createMetadataDecorator(metadataKey: string, metadataValue: Expression) {
const decoratorExpression = getMetadataDecoratorExpression();
if (decoratorExpression) {
return setSourceMapRange(factory.createCallExpression(
decoratorExpression,
/*typeArguments*/ undefined,
[
factory.createStringLiteral(metadataKey),
metadataValue
]), getSourceMapRange(metadataValue));
}
return emitHelpers().createMetadataHelper(metadataKey, metadataValue);
}
function addOldTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) {
if (compilerOptions.emitDecoratorMetadata) {
if (shouldAddTypeMetadata(node)) {
decoratorExpressions.push(emitHelpers().createMetadataHelper("design:type", serializeTypeOfNode(node)));
decoratorExpressions.push(createMetadataDecorator("design:type", serializeTypeOfNode(node)));
}
if (shouldAddParamTypesMetadata(node)) {
decoratorExpressions.push(emitHelpers().createMetadataHelper("design:paramtypes", serializeParameterTypesOfNode(node, container)));
decoratorExpressions.push(createMetadataDecorator("design:paramtypes", serializeParameterTypesOfNode(node, container)));
}
if (shouldAddReturnTypeMetadata(node)) {
decoratorExpressions.push(emitHelpers().createMetadataHelper("design:returntype", serializeReturnTypeOfNode(node)));
decoratorExpressions.push(createMetadataDecorator("design:returntype", serializeReturnTypeOfNode(node)));
}
}
}
@@ -1336,7 +1413,7 @@ namespace ts {
(properties || (properties = [])).push(factory.createPropertyAssignment("returnType", factory.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, factory.createToken(SyntaxKind.EqualsGreaterThanToken), serializeReturnTypeOfNode(node))));
}
if (properties) {
decoratorExpressions.push(emitHelpers().createMetadataHelper("design:typeinfo", factory.createObjectLiteralExpression(properties, /*multiLine*/ true)));
decoratorExpressions.push(createMetadataDecorator("design:typeinfo", factory.createObjectLiteralExpression(properties, /*multiLine*/ true)));
}
}
}
@@ -1505,73 +1582,73 @@ namespace ts {
case SyntaxKind.VoidKeyword:
case SyntaxKind.UndefinedKeyword:
case SyntaxKind.NeverKeyword:
return factory.createVoidZero();
return setSourceMapRange(factory.createVoidZero(), node);
case SyntaxKind.ParenthesizedType:
return serializeTypeNode((<ParenthesizedTypeNode>node).type);
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructorType:
return factory.createIdentifier("Function");
return setSourceMapRange(factory.createIdentifier("Function"), node);
case SyntaxKind.ArrayType:
case SyntaxKind.TupleType:
return factory.createIdentifier("Array");
return setSourceMapRange(factory.createIdentifier("Array"), node);
case SyntaxKind.TypePredicate:
case SyntaxKind.BooleanKeyword:
return factory.createIdentifier("Boolean");
return setSourceMapRange(factory.createIdentifier("Boolean"), node);
case SyntaxKind.StringKeyword:
return factory.createIdentifier("String");
return setSourceMapRange(factory.createIdentifier("String"), node);
case SyntaxKind.ObjectKeyword:
return factory.createIdentifier("Object");
return setSourceMapRange(factory.createIdentifier("Object"), node);
case SyntaxKind.LiteralType:
switch ((<LiteralTypeNode>node).literal.kind) {
case SyntaxKind.StringLiteral:
case SyntaxKind.NoSubstitutionTemplateLiteral:
return factory.createIdentifier("String");
return setSourceMapRange(factory.createIdentifier("String"), node);
case SyntaxKind.PrefixUnaryExpression:
case SyntaxKind.NumericLiteral:
return factory.createIdentifier("Number");
return setSourceMapRange(factory.createIdentifier("Number"), node);
case SyntaxKind.BigIntLiteral:
return getGlobalBigIntNameWithFallback();
return setSourceMapRange(getGlobalBigIntNameWithFallback(), node);
case SyntaxKind.TrueKeyword:
case SyntaxKind.FalseKeyword:
return factory.createIdentifier("Boolean");
return setSourceMapRange(factory.createIdentifier("Boolean"), node);
case SyntaxKind.NullKeyword:
return factory.createVoidZero();
return setSourceMapRange(factory.createVoidZero(), node);
default:
return Debug.failBadSyntaxKind((<LiteralTypeNode>node).literal);
}
case SyntaxKind.NumberKeyword:
return factory.createIdentifier("Number");
return setSourceMapRange(factory.createIdentifier("Number"), node);
case SyntaxKind.BigIntKeyword:
return getGlobalBigIntNameWithFallback();
return setSourceMapRange(getGlobalBigIntNameWithFallback(), node);
case SyntaxKind.SymbolKeyword:
return languageVersion < ScriptTarget.ES2015
? getGlobalSymbolNameWithFallback()
: factory.createIdentifier("Symbol");
? setSourceMapRange(getGlobalSymbolNameWithFallback(), node)
: setSourceMapRange(factory.createIdentifier("Symbol"), node);
case SyntaxKind.TypeReference:
return serializeTypeReferenceNode(<TypeReferenceNode>node);
return setSourceMapRange(serializeTypeReferenceNode(<TypeReferenceNode>node), node);
case SyntaxKind.IntersectionType:
case SyntaxKind.UnionType:
return serializeTypeList((<UnionOrIntersectionTypeNode>node).types);
return setSourceMapRange(serializeTypeList((<UnionOrIntersectionTypeNode>node).types), node);
case SyntaxKind.ConditionalType:
return serializeTypeList([(<ConditionalTypeNode>node).trueType, (<ConditionalTypeNode>node).falseType]);
return setSourceMapRange(serializeTypeList([(<ConditionalTypeNode>node).trueType, (<ConditionalTypeNode>node).falseType]), node);
case SyntaxKind.TypeOperator:
if ((<TypeOperatorNode>node).operator === SyntaxKind.ReadonlyKeyword) {
@@ -1605,7 +1682,7 @@ namespace ts {
return Debug.failBadSyntaxKind(node);
}
return factory.createIdentifier("Object");
return setSourceMapRange(factory.createIdentifier("Object"), node);
}
function serializeTypeList(types: readonly TypeNode[]): SerializedTypeNode {
@@ -1635,7 +1712,7 @@ namespace ts {
if (!isIdentifier(serializedUnion) ||
!isIdentifier(serializedIndividual) ||
serializedUnion.escapedText !== serializedIndividual.escapedText) {
return factory.createIdentifier("Object");
return (factory.createIdentifier("Object"));
}
}
else {
@@ -1660,7 +1737,7 @@ namespace ts {
case TypeReferenceSerializationKind.Unknown:
// From conditional type type reference that cannot be resolved is Similar to any or unknown
if (findAncestor(node, n => n.parent && isConditionalTypeNode(n.parent) && (n.parent.trueType === n || n.parent.falseType === n))) {
return factory.createIdentifier("Object");
return (factory.createIdentifier("Object"));
}
const serialized = serializeEntityNameAsExpressionFallback(node.typeName);
@@ -1751,18 +1828,21 @@ namespace ts {
*
* @param node The entity name to serialize.
*/
function serializeEntityNameAsExpression(node: EntityName): SerializedEntityNameAsExpression {
function serializeEntityNameAsExpression(node: EntityName, emulateParseTree = true): EntityNameExpression {
switch (node.kind) {
case SyntaxKind.Identifier:
// Create a clone of the name with a new parent, and treat it as if it were
// a source tree node for the purposes of the checker.
const name = setParent(setTextRange(parseNodeFactory.cloneNode(node), node), node.parent);
name.original = undefined;
setParent(name, getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node.
const name = parseNodeFactory.cloneNode(node);
if (emulateParseTree) {
setTextRange(name, node);
setParent(name, getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node.
name.original = undefined;
}
return name;
case SyntaxKind.QualifiedName:
return serializeQualifiedNameAsExpression(node);
return serializeQualifiedNameAsExpression(node, emulateParseTree);
}
}
@@ -1773,8 +1853,8 @@ namespace ts {
* @param useFallback A value indicating whether to use logical operators to test for the
* qualified name at runtime.
*/
function serializeQualifiedNameAsExpression(node: QualifiedName): SerializedEntityNameAsExpression {
return factory.createPropertyAccessExpression(serializeEntityNameAsExpression(node.left), node.right);
function serializeQualifiedNameAsExpression(node: QualifiedName, emulateParseTree: boolean): PropertyAccessEntityNameExpression {
return factory.createPropertyAccessExpression(serializeEntityNameAsExpression(node.left, emulateParseTree), node.right) as PropertyAccessEntityNameExpression;
}
/**
+16 -1
View File
@@ -269,6 +269,7 @@ namespace ts {
NonNullExpression,
MetaProperty,
SyntheticExpression,
SyntheticCallExpression,
// Misc
TemplateSpan,
@@ -1098,7 +1099,6 @@ namespace ts {
readonly originalKeywordKind?: SyntaxKind; // Original syntaxKind which get set so that we can report an error later
/*@internal*/ readonly autoGenerateFlags?: GeneratedIdentifierFlags; // Specifies whether to auto-generate the text for an identifier.
/*@internal*/ readonly autoGenerateId?: number; // Ensures unique generated identifiers get unique names, but clones get the same name.
/*@internal*/ generatedImportReference?: ImportSpecifier; // Reference to the generated import specifier this identifier refers to
isInJSDocNamespace?: boolean; // if the node is a member in a JSDoc namespace
/*@internal*/ typeArguments?: NodeArray<TypeNode | TypeParameterDeclaration>; // Only defined on synthesized nodes. Though not syntactically valid, used in emitting diagnostics, quickinfo, and signature help.
/*@internal*/ jsdocDotPos?: number; // Identifier occurs in JSDoc-style generic: Id.<T>
@@ -2305,6 +2305,15 @@ namespace ts {
// see: https://tc39.github.io/ecma262/#prod-SuperProperty
export type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression;
export interface SyntheticCallExpression extends LeftHandSideExpression {
readonly kind: SyntaxKind.SyntheticCallExpression;
readonly thisArg?: LeftHandSideExpression | SyntheticExpression;
readonly expression: Expression;
readonly typeArguments?: readonly TypeNode[];
readonly arguments: readonly Expression[];
/* @internal */ containingMessageChain?: () => DiagnosticMessageChain | undefined;
}
export interface CallExpression extends LeftHandSideExpression, Declaration {
readonly kind: SyntaxKind.CallExpression;
readonly expression: LeftHandSideExpression;
@@ -2420,6 +2429,7 @@ namespace ts {
| TaggedTemplateExpression
| Decorator
| JsxOpeningLikeElement
| SyntheticCallExpression
;
export interface AsExpression extends Expression {
@@ -5889,6 +5899,8 @@ namespace ts {
downlevelIteration?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
metadataDecorator?: string;
metadataDecoratorImportSource?: string;
experimentalDecorators?: boolean;
forceConsistentCasingInFileNames?: boolean;
/*@internal*/generateCpuProfile?: string;
@@ -6590,6 +6602,8 @@ namespace ts {
externalHelpers?: boolean;
helpers?: EmitHelper[]; // Emit helpers for the node
startsOnNewLine?: boolean; // If the node should begin on a new line
generatedImportReference?: ImportSpecifier; // For a synthetic import, specifies the synthesized import reference so that
// the import can be resolved during subsequent transformations.
}
export const enum EmitFlags {
@@ -7341,6 +7355,7 @@ namespace ts {
// Synthetic Nodes
//
/* @internal */ createSyntheticExpression(type: Type, isSpread?: boolean, tupleNameSource?: ParameterDeclaration | NamedTupleMember): SyntheticExpression;
/* @internal */ createSyntheticCallExpression(thisArg: LeftHandSideExpression | SyntheticExpression | undefined, expression: Expression | SyntheticExpression, typeArguments: readonly TypeNode[] | undefined, argumentList: readonly Expression[], containingMessageChain?: () => DiagnosticMessageChain | undefined): SyntheticCallExpression;
/* @internal */ createSyntaxList(children: Node[]): SyntaxList;
//
+90 -4
View File
@@ -927,7 +927,16 @@ namespace ts {
// Computed property names will just be emitted as "[<expr>]", where <expr> is the source
// text of the expression in the computed property.
export function declarationNameToString(name: DeclarationName | QualifiedName | undefined) {
return !name || getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name);
if (name) {
if (getFullWidth(name) !== 0) {
return getTextOfNode(name);
}
if (nodeIsSynthesized(name)) {
if (isIdentifier(name)) return idText(name);
if (isQualifiedName(name)) return entityNameToString(name);
}
}
return "(Missing)";
}
export function getNameFromIndexInfo(info: IndexInfo): string | undefined {
@@ -997,6 +1006,10 @@ namespace ts {
return createFileDiagnosticFromMessageChain(sourceFile, span.start, span.length, messageChain, relatedInformation);
}
export function isDiagnosticMessageChain(message: DiagnosticMessage | DiagnosticMessageChain): message is DiagnosticMessageChain {
return !("message" in message); // eslint-disable-line no-in-operator
}
function assertDiagnosticLocation(file: SourceFile | undefined, start: number, length: number) {
Debug.assertGreaterThanOrEqual(start, 0);
Debug.assertGreaterThanOrEqual(length, 0);
@@ -1772,9 +1785,39 @@ namespace ts {
}
}
export interface DecoratablePropertyDeclaration extends PropertyDeclaration {
readonly parent: ClassDeclaration;
}
export interface DecoratableGetAccessorDeclaration extends GetAccessorDeclaration {
readonly parent: ClassDeclaration;
}
export interface DecoratableSetAccessorDeclaration extends SetAccessorDeclaration {
readonly parent: ClassDeclaration;
}
export interface DecoratableMethodDeclaration extends MethodDeclaration {
readonly parent: ClassDeclaration;
readonly body: Block;
}
export interface DecoratableParameterDeclaration extends ParameterDeclaration {
readonly parent: ConstructorDeclaration | DecoratableMethodDeclaration | DecoratableGetAccessorDeclaration | DecoratableSetAccessorDeclaration;
}
export type DecoratableClassElement =
| DecoratablePropertyDeclaration
| DecoratableGetAccessorDeclaration
| DecoratableSetAccessorDeclaration
| DecoratableMethodDeclaration
;
export type DecoratableDeclaration =
| ClassDeclaration
| DecoratableClassElement
| DecoratableParameterDeclaration
;
export function nodeCanBeDecorated(node: ClassDeclaration): true;
export function nodeCanBeDecorated(node: ClassElement, parent: Node): boolean;
export function nodeCanBeDecorated(node: Node, parent: Node, grandparent: Node): boolean;
export function nodeCanBeDecorated(node: ClassElement, parent: Node): node is DecoratableClassElement;
export function nodeCanBeDecorated(node: Node, parent: Node, grandparent: Node): node is DecoratableDeclaration;
export function nodeCanBeDecorated(node: Node, parent?: Node, grandparent?: Node): boolean {
// private names cannot be used with decorators yet
if (isNamedDeclaration(node) && isPrivateIdentifier(node.name)) {
@@ -5889,6 +5932,12 @@ namespace ts {
};
}
/**
* Creates a new outer `DiagnosticMessageChain` that optionally points back to a more specific set of diagnostics.
* @param details The inner `DiagnosticMessageChain` to surround.
* @param message The message for the new `DiagnosticMessageChain`.
* @param args Format arguments for the message.
*/
export function chainDiagnosticMessages(details: DiagnosticMessageChain | DiagnosticMessageChain[] | undefined, message: DiagnosticMessage, ...args: (string | number | undefined)[]): DiagnosticMessageChain;
export function chainDiagnosticMessages(details: DiagnosticMessageChain | DiagnosticMessageChain[] | undefined, message: DiagnosticMessage): DiagnosticMessageChain {
let text = getLocaleSpecificMessage(message);
@@ -5905,13 +5954,26 @@ namespace ts {
};
}
export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): void {
/**
* Sets `tailChain` as the innermost `DiagnosticMessageChain` of `headChain`, returning the outermost chain.
*
* @param headChain The outermost `DiagnosticMessageChain` into which to insert `tailChain`.
* @param tailChain A `DiagnosticMessageChain` to insert into `headChain`.
*/
export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain | undefined): DiagnosticMessageChain;
export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain | undefined, tailChain: DiagnosticMessageChain): DiagnosticMessageChain;
export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain | undefined, tailChain: DiagnosticMessageChain | undefined): DiagnosticMessageChain | undefined;
export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain | undefined, tailChain: DiagnosticMessageChain | undefined): DiagnosticMessageChain | undefined {
if (!headChain) return tailChain;
if (!tailChain) return headChain;
let lastChain = headChain;
while (lastChain.next) {
lastChain = lastChain.next[0];
}
lastChain.next = [tailChain];
return headChain;
}
function getDiagnosticFilePath(diagnostic: Diagnostic): string | undefined {
@@ -6105,6 +6167,10 @@ namespace ts {
return base ? `${base}/${options.jsx === JsxEmit.ReactJSXDev ? "jsx-dev-runtime" : "jsx-runtime"}` : undefined;
}
export function getMetadataDecoratorImportSource(compilerOptions: CompilerOptions): string | undefined {
return compilerOptions.metadataDecoratorImportSource;
}
export function hasZeroOrOneAsteriskCharacter(str: string): boolean {
let seenAsterisk = false;
for (let i = 0; i < str.length; i++) {
@@ -7096,6 +7162,26 @@ namespace ts {
}
}
/**
* **WARNING:** This is an inherently unsafe operation and should be used with care.
*
* Sets the text range of `rootNode` and each of its children recursively to `{pos: -1, end: -1}`.
*
* Only sets the text ranges of children whose parent is `undefined` or points to the parent (reused
* subtrees are not reset).
*/
/* @internal */
export function setSyntheticPositionsRecursive<T extends Node>(rootNode: T): T {
setTextRangePosEnd(rootNode, -1, -1);
forEachChildRecursively(rootNode, (child, parent) => {
if (child.parent !== undefined && child.parent !== parent) {
return "skip";
}
setTextRangePosEnd(child, -1, -1);
});
return rootNode;
}
function isPackedElement(node: Expression) {
return !isOmittedExpression(node);
}
+2
View File
@@ -1502,6 +1502,7 @@ namespace ts {
case SyntaxKind.NonNullExpression:
case SyntaxKind.MetaProperty:
case SyntaxKind.ImportKeyword: // technically this is only an Expression if it's in a CallExpression
case SyntaxKind.SyntheticCallExpression:
return true;
default:
return false;
@@ -1561,6 +1562,7 @@ namespace ts {
case SyntaxKind.OmittedExpression:
case SyntaxKind.CommaListExpression:
case SyntaxKind.PartiallyEmittedExpression:
case SyntaxKind.SyntheticExpression:
return true;
default:
return isUnaryExpressionKind(kind);
+135 -124
View File
@@ -333,123 +333,124 @@ declare namespace ts {
NonNullExpression = 226,
MetaProperty = 227,
SyntheticExpression = 228,
TemplateSpan = 229,
SemicolonClassElement = 230,
Block = 231,
EmptyStatement = 232,
VariableStatement = 233,
ExpressionStatement = 234,
IfStatement = 235,
DoStatement = 236,
WhileStatement = 237,
ForStatement = 238,
ForInStatement = 239,
ForOfStatement = 240,
ContinueStatement = 241,
BreakStatement = 242,
ReturnStatement = 243,
WithStatement = 244,
SwitchStatement = 245,
LabeledStatement = 246,
ThrowStatement = 247,
TryStatement = 248,
DebuggerStatement = 249,
VariableDeclaration = 250,
VariableDeclarationList = 251,
FunctionDeclaration = 252,
ClassDeclaration = 253,
InterfaceDeclaration = 254,
TypeAliasDeclaration = 255,
EnumDeclaration = 256,
ModuleDeclaration = 257,
ModuleBlock = 258,
CaseBlock = 259,
NamespaceExportDeclaration = 260,
ImportEqualsDeclaration = 261,
ImportDeclaration = 262,
ImportClause = 263,
NamespaceImport = 264,
NamedImports = 265,
ImportSpecifier = 266,
ExportAssignment = 267,
ExportDeclaration = 268,
NamedExports = 269,
NamespaceExport = 270,
ExportSpecifier = 271,
MissingDeclaration = 272,
ExternalModuleReference = 273,
JsxElement = 274,
JsxSelfClosingElement = 275,
JsxOpeningElement = 276,
JsxClosingElement = 277,
JsxFragment = 278,
JsxOpeningFragment = 279,
JsxClosingFragment = 280,
JsxAttribute = 281,
JsxAttributes = 282,
JsxSpreadAttribute = 283,
JsxExpression = 284,
CaseClause = 285,
DefaultClause = 286,
HeritageClause = 287,
CatchClause = 288,
PropertyAssignment = 289,
ShorthandPropertyAssignment = 290,
SpreadAssignment = 291,
EnumMember = 292,
UnparsedPrologue = 293,
UnparsedPrepend = 294,
UnparsedText = 295,
UnparsedInternalText = 296,
UnparsedSyntheticReference = 297,
SourceFile = 298,
Bundle = 299,
UnparsedSource = 300,
InputFiles = 301,
JSDocTypeExpression = 302,
JSDocNameReference = 303,
JSDocAllType = 304,
JSDocUnknownType = 305,
JSDocNullableType = 306,
JSDocNonNullableType = 307,
JSDocOptionalType = 308,
JSDocFunctionType = 309,
JSDocVariadicType = 310,
JSDocNamepathType = 311,
JSDocComment = 312,
JSDocText = 313,
JSDocTypeLiteral = 314,
JSDocSignature = 315,
JSDocLink = 316,
JSDocTag = 317,
JSDocAugmentsTag = 318,
JSDocImplementsTag = 319,
JSDocAuthorTag = 320,
JSDocDeprecatedTag = 321,
JSDocClassTag = 322,
JSDocPublicTag = 323,
JSDocPrivateTag = 324,
JSDocProtectedTag = 325,
JSDocReadonlyTag = 326,
JSDocOverrideTag = 327,
JSDocCallbackTag = 328,
JSDocEnumTag = 329,
JSDocParameterTag = 330,
JSDocReturnTag = 331,
JSDocThisTag = 332,
JSDocTypeTag = 333,
JSDocTemplateTag = 334,
JSDocTypedefTag = 335,
JSDocSeeTag = 336,
JSDocPropertyTag = 337,
SyntaxList = 338,
NotEmittedStatement = 339,
PartiallyEmittedExpression = 340,
CommaListExpression = 341,
MergeDeclarationMarker = 342,
EndOfDeclarationMarker = 343,
SyntheticReferenceExpression = 344,
Count = 345,
SyntheticCallExpression = 229,
TemplateSpan = 230,
SemicolonClassElement = 231,
Block = 232,
EmptyStatement = 233,
VariableStatement = 234,
ExpressionStatement = 235,
IfStatement = 236,
DoStatement = 237,
WhileStatement = 238,
ForStatement = 239,
ForInStatement = 240,
ForOfStatement = 241,
ContinueStatement = 242,
BreakStatement = 243,
ReturnStatement = 244,
WithStatement = 245,
SwitchStatement = 246,
LabeledStatement = 247,
ThrowStatement = 248,
TryStatement = 249,
DebuggerStatement = 250,
VariableDeclaration = 251,
VariableDeclarationList = 252,
FunctionDeclaration = 253,
ClassDeclaration = 254,
InterfaceDeclaration = 255,
TypeAliasDeclaration = 256,
EnumDeclaration = 257,
ModuleDeclaration = 258,
ModuleBlock = 259,
CaseBlock = 260,
NamespaceExportDeclaration = 261,
ImportEqualsDeclaration = 262,
ImportDeclaration = 263,
ImportClause = 264,
NamespaceImport = 265,
NamedImports = 266,
ImportSpecifier = 267,
ExportAssignment = 268,
ExportDeclaration = 269,
NamedExports = 270,
NamespaceExport = 271,
ExportSpecifier = 272,
MissingDeclaration = 273,
ExternalModuleReference = 274,
JsxElement = 275,
JsxSelfClosingElement = 276,
JsxOpeningElement = 277,
JsxClosingElement = 278,
JsxFragment = 279,
JsxOpeningFragment = 280,
JsxClosingFragment = 281,
JsxAttribute = 282,
JsxAttributes = 283,
JsxSpreadAttribute = 284,
JsxExpression = 285,
CaseClause = 286,
DefaultClause = 287,
HeritageClause = 288,
CatchClause = 289,
PropertyAssignment = 290,
ShorthandPropertyAssignment = 291,
SpreadAssignment = 292,
EnumMember = 293,
UnparsedPrologue = 294,
UnparsedPrepend = 295,
UnparsedText = 296,
UnparsedInternalText = 297,
UnparsedSyntheticReference = 298,
SourceFile = 299,
Bundle = 300,
UnparsedSource = 301,
InputFiles = 302,
JSDocTypeExpression = 303,
JSDocNameReference = 304,
JSDocAllType = 305,
JSDocUnknownType = 306,
JSDocNullableType = 307,
JSDocNonNullableType = 308,
JSDocOptionalType = 309,
JSDocFunctionType = 310,
JSDocVariadicType = 311,
JSDocNamepathType = 312,
JSDocComment = 313,
JSDocText = 314,
JSDocTypeLiteral = 315,
JSDocSignature = 316,
JSDocLink = 317,
JSDocTag = 318,
JSDocAugmentsTag = 319,
JSDocImplementsTag = 320,
JSDocAuthorTag = 321,
JSDocDeprecatedTag = 322,
JSDocClassTag = 323,
JSDocPublicTag = 324,
JSDocPrivateTag = 325,
JSDocProtectedTag = 326,
JSDocReadonlyTag = 327,
JSDocOverrideTag = 328,
JSDocCallbackTag = 329,
JSDocEnumTag = 330,
JSDocParameterTag = 331,
JSDocReturnTag = 332,
JSDocThisTag = 333,
JSDocTypeTag = 334,
JSDocTemplateTag = 335,
JSDocTypedefTag = 336,
JSDocSeeTag = 337,
JSDocPropertyTag = 338,
SyntaxList = 339,
NotEmittedStatement = 340,
PartiallyEmittedExpression = 341,
CommaListExpression = 342,
MergeDeclarationMarker = 343,
EndOfDeclarationMarker = 344,
SyntheticReferenceExpression = 345,
Count = 346,
FirstAssignment = 62,
LastAssignment = 77,
FirstCompoundAssignment = 63,
@@ -474,13 +475,13 @@ declare namespace ts {
LastTemplateToken = 17,
FirstBinaryOperator = 29,
LastBinaryOperator = 77,
FirstStatement = 233,
LastStatement = 249,
FirstStatement = 234,
LastStatement = 250,
FirstNode = 158,
FirstJSDocNode = 302,
LastJSDocNode = 337,
FirstJSDocTagNode = 317,
LastJSDocTagNode = 337,
FirstJSDocNode = 303,
LastJSDocNode = 338,
FirstJSDocTagNode = 318,
LastJSDocTagNode = 338,
}
export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
@@ -1251,6 +1252,13 @@ declare namespace ts {
readonly expression: SuperExpression;
}
export type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression;
export interface SyntheticCallExpression extends LeftHandSideExpression {
readonly kind: SyntaxKind.SyntheticCallExpression;
readonly thisArg?: LeftHandSideExpression | SyntheticExpression;
readonly expression: Expression;
readonly typeArguments?: readonly TypeNode[];
readonly arguments: readonly Expression[];
}
export interface CallExpression extends LeftHandSideExpression, Declaration {
readonly kind: SyntaxKind.CallExpression;
readonly expression: LeftHandSideExpression;
@@ -1285,7 +1293,7 @@ declare namespace ts {
readonly typeArguments?: NodeArray<TypeNode>;
readonly template: TemplateLiteral;
}
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement;
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement | SyntheticCallExpression;
export interface AsExpression extends Expression {
readonly kind: SyntaxKind.AsExpression;
readonly expression: Expression;
@@ -2830,6 +2838,8 @@ declare namespace ts {
downlevelIteration?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
metadataDecorator?: string;
metadataDecoratorImportSource?: string;
experimentalDecorators?: boolean;
forceConsistentCasingInFileNames?: boolean;
importHelpers?: boolean;
@@ -4484,6 +4494,7 @@ declare namespace ts {
function isSyntheticExpression(node: Node): node is SyntheticExpression;
function isPartiallyEmittedExpression(node: Node): node is PartiallyEmittedExpression;
function isCommaListExpression(node: Node): node is CommaListExpression;
function isSyntheticCallExpression(node: Node): node is SyntheticCallExpression;
function isTemplateSpan(node: Node): node is TemplateSpan;
function isSemicolonClassElement(node: Node): node is SemicolonClassElement;
function isBlock(node: Node): node is Block;
+135 -124
View File
@@ -333,123 +333,124 @@ declare namespace ts {
NonNullExpression = 226,
MetaProperty = 227,
SyntheticExpression = 228,
TemplateSpan = 229,
SemicolonClassElement = 230,
Block = 231,
EmptyStatement = 232,
VariableStatement = 233,
ExpressionStatement = 234,
IfStatement = 235,
DoStatement = 236,
WhileStatement = 237,
ForStatement = 238,
ForInStatement = 239,
ForOfStatement = 240,
ContinueStatement = 241,
BreakStatement = 242,
ReturnStatement = 243,
WithStatement = 244,
SwitchStatement = 245,
LabeledStatement = 246,
ThrowStatement = 247,
TryStatement = 248,
DebuggerStatement = 249,
VariableDeclaration = 250,
VariableDeclarationList = 251,
FunctionDeclaration = 252,
ClassDeclaration = 253,
InterfaceDeclaration = 254,
TypeAliasDeclaration = 255,
EnumDeclaration = 256,
ModuleDeclaration = 257,
ModuleBlock = 258,
CaseBlock = 259,
NamespaceExportDeclaration = 260,
ImportEqualsDeclaration = 261,
ImportDeclaration = 262,
ImportClause = 263,
NamespaceImport = 264,
NamedImports = 265,
ImportSpecifier = 266,
ExportAssignment = 267,
ExportDeclaration = 268,
NamedExports = 269,
NamespaceExport = 270,
ExportSpecifier = 271,
MissingDeclaration = 272,
ExternalModuleReference = 273,
JsxElement = 274,
JsxSelfClosingElement = 275,
JsxOpeningElement = 276,
JsxClosingElement = 277,
JsxFragment = 278,
JsxOpeningFragment = 279,
JsxClosingFragment = 280,
JsxAttribute = 281,
JsxAttributes = 282,
JsxSpreadAttribute = 283,
JsxExpression = 284,
CaseClause = 285,
DefaultClause = 286,
HeritageClause = 287,
CatchClause = 288,
PropertyAssignment = 289,
ShorthandPropertyAssignment = 290,
SpreadAssignment = 291,
EnumMember = 292,
UnparsedPrologue = 293,
UnparsedPrepend = 294,
UnparsedText = 295,
UnparsedInternalText = 296,
UnparsedSyntheticReference = 297,
SourceFile = 298,
Bundle = 299,
UnparsedSource = 300,
InputFiles = 301,
JSDocTypeExpression = 302,
JSDocNameReference = 303,
JSDocAllType = 304,
JSDocUnknownType = 305,
JSDocNullableType = 306,
JSDocNonNullableType = 307,
JSDocOptionalType = 308,
JSDocFunctionType = 309,
JSDocVariadicType = 310,
JSDocNamepathType = 311,
JSDocComment = 312,
JSDocText = 313,
JSDocTypeLiteral = 314,
JSDocSignature = 315,
JSDocLink = 316,
JSDocTag = 317,
JSDocAugmentsTag = 318,
JSDocImplementsTag = 319,
JSDocAuthorTag = 320,
JSDocDeprecatedTag = 321,
JSDocClassTag = 322,
JSDocPublicTag = 323,
JSDocPrivateTag = 324,
JSDocProtectedTag = 325,
JSDocReadonlyTag = 326,
JSDocOverrideTag = 327,
JSDocCallbackTag = 328,
JSDocEnumTag = 329,
JSDocParameterTag = 330,
JSDocReturnTag = 331,
JSDocThisTag = 332,
JSDocTypeTag = 333,
JSDocTemplateTag = 334,
JSDocTypedefTag = 335,
JSDocSeeTag = 336,
JSDocPropertyTag = 337,
SyntaxList = 338,
NotEmittedStatement = 339,
PartiallyEmittedExpression = 340,
CommaListExpression = 341,
MergeDeclarationMarker = 342,
EndOfDeclarationMarker = 343,
SyntheticReferenceExpression = 344,
Count = 345,
SyntheticCallExpression = 229,
TemplateSpan = 230,
SemicolonClassElement = 231,
Block = 232,
EmptyStatement = 233,
VariableStatement = 234,
ExpressionStatement = 235,
IfStatement = 236,
DoStatement = 237,
WhileStatement = 238,
ForStatement = 239,
ForInStatement = 240,
ForOfStatement = 241,
ContinueStatement = 242,
BreakStatement = 243,
ReturnStatement = 244,
WithStatement = 245,
SwitchStatement = 246,
LabeledStatement = 247,
ThrowStatement = 248,
TryStatement = 249,
DebuggerStatement = 250,
VariableDeclaration = 251,
VariableDeclarationList = 252,
FunctionDeclaration = 253,
ClassDeclaration = 254,
InterfaceDeclaration = 255,
TypeAliasDeclaration = 256,
EnumDeclaration = 257,
ModuleDeclaration = 258,
ModuleBlock = 259,
CaseBlock = 260,
NamespaceExportDeclaration = 261,
ImportEqualsDeclaration = 262,
ImportDeclaration = 263,
ImportClause = 264,
NamespaceImport = 265,
NamedImports = 266,
ImportSpecifier = 267,
ExportAssignment = 268,
ExportDeclaration = 269,
NamedExports = 270,
NamespaceExport = 271,
ExportSpecifier = 272,
MissingDeclaration = 273,
ExternalModuleReference = 274,
JsxElement = 275,
JsxSelfClosingElement = 276,
JsxOpeningElement = 277,
JsxClosingElement = 278,
JsxFragment = 279,
JsxOpeningFragment = 280,
JsxClosingFragment = 281,
JsxAttribute = 282,
JsxAttributes = 283,
JsxSpreadAttribute = 284,
JsxExpression = 285,
CaseClause = 286,
DefaultClause = 287,
HeritageClause = 288,
CatchClause = 289,
PropertyAssignment = 290,
ShorthandPropertyAssignment = 291,
SpreadAssignment = 292,
EnumMember = 293,
UnparsedPrologue = 294,
UnparsedPrepend = 295,
UnparsedText = 296,
UnparsedInternalText = 297,
UnparsedSyntheticReference = 298,
SourceFile = 299,
Bundle = 300,
UnparsedSource = 301,
InputFiles = 302,
JSDocTypeExpression = 303,
JSDocNameReference = 304,
JSDocAllType = 305,
JSDocUnknownType = 306,
JSDocNullableType = 307,
JSDocNonNullableType = 308,
JSDocOptionalType = 309,
JSDocFunctionType = 310,
JSDocVariadicType = 311,
JSDocNamepathType = 312,
JSDocComment = 313,
JSDocText = 314,
JSDocTypeLiteral = 315,
JSDocSignature = 316,
JSDocLink = 317,
JSDocTag = 318,
JSDocAugmentsTag = 319,
JSDocImplementsTag = 320,
JSDocAuthorTag = 321,
JSDocDeprecatedTag = 322,
JSDocClassTag = 323,
JSDocPublicTag = 324,
JSDocPrivateTag = 325,
JSDocProtectedTag = 326,
JSDocReadonlyTag = 327,
JSDocOverrideTag = 328,
JSDocCallbackTag = 329,
JSDocEnumTag = 330,
JSDocParameterTag = 331,
JSDocReturnTag = 332,
JSDocThisTag = 333,
JSDocTypeTag = 334,
JSDocTemplateTag = 335,
JSDocTypedefTag = 336,
JSDocSeeTag = 337,
JSDocPropertyTag = 338,
SyntaxList = 339,
NotEmittedStatement = 340,
PartiallyEmittedExpression = 341,
CommaListExpression = 342,
MergeDeclarationMarker = 343,
EndOfDeclarationMarker = 344,
SyntheticReferenceExpression = 345,
Count = 346,
FirstAssignment = 62,
LastAssignment = 77,
FirstCompoundAssignment = 63,
@@ -474,13 +475,13 @@ declare namespace ts {
LastTemplateToken = 17,
FirstBinaryOperator = 29,
LastBinaryOperator = 77,
FirstStatement = 233,
LastStatement = 249,
FirstStatement = 234,
LastStatement = 250,
FirstNode = 158,
FirstJSDocNode = 302,
LastJSDocNode = 337,
FirstJSDocTagNode = 317,
LastJSDocTagNode = 337,
FirstJSDocNode = 303,
LastJSDocNode = 338,
FirstJSDocTagNode = 318,
LastJSDocTagNode = 338,
}
export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
@@ -1251,6 +1252,13 @@ declare namespace ts {
readonly expression: SuperExpression;
}
export type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression;
export interface SyntheticCallExpression extends LeftHandSideExpression {
readonly kind: SyntaxKind.SyntheticCallExpression;
readonly thisArg?: LeftHandSideExpression | SyntheticExpression;
readonly expression: Expression;
readonly typeArguments?: readonly TypeNode[];
readonly arguments: readonly Expression[];
}
export interface CallExpression extends LeftHandSideExpression, Declaration {
readonly kind: SyntaxKind.CallExpression;
readonly expression: LeftHandSideExpression;
@@ -1285,7 +1293,7 @@ declare namespace ts {
readonly typeArguments?: NodeArray<TypeNode>;
readonly template: TemplateLiteral;
}
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement;
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement | SyntheticCallExpression;
export interface AsExpression extends Expression {
readonly kind: SyntaxKind.AsExpression;
readonly expression: Expression;
@@ -2830,6 +2838,8 @@ declare namespace ts {
downlevelIteration?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
metadataDecorator?: string;
metadataDecoratorImportSource?: string;
experimentalDecorators?: boolean;
forceConsistentCasingInFileNames?: boolean;
importHelpers?: boolean;
@@ -4484,6 +4494,7 @@ declare namespace ts {
function isSyntheticExpression(node: Node): node is SyntheticExpression;
function isPartiallyEmittedExpression(node: Node): node is PartiallyEmittedExpression;
function isCommaListExpression(node: Node): node is CommaListExpression;
function isSyntheticCallExpression(node: Node): node is SyntheticCallExpression;
function isTemplateSpan(node: Node): node is TemplateSpan;
function isSemicolonClassElement(node: Node): node is SemicolonClassElement;
function isBlock(node: Node): node is Block;
@@ -1,10 +1,10 @@
tests/cases/compiler/bluebirdStaticThis.ts(5,22): error TS2420: Class 'Promise<R>' incorrectly implements interface 'Thenable<R>'.
Property 'then' is missing in type 'Promise<R>' but required in type 'Thenable<R>'.
tests/cases/compiler/bluebirdStaticThis.ts(22,51): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Resolver'.
tests/cases/compiler/bluebirdStaticThis.ts(57,109): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
tests/cases/compiler/bluebirdStaticThis.ts(58,91): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
tests/cases/compiler/bluebirdStaticThis.ts(59,91): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
tests/cases/compiler/bluebirdStaticThis.ts(22,51): error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Resolver'.
tests/cases/compiler/bluebirdStaticThis.ts(57,109): error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Inspection'.
tests/cases/compiler/bluebirdStaticThis.ts(58,91): error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Inspection'.
tests/cases/compiler/bluebirdStaticThis.ts(59,91): error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Inspection'.
tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Inspection'.
==== tests/cases/compiler/bluebirdStaticThis.ts (6 errors) ====
@@ -35,7 +35,7 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace '"tes
static defer<R>(dit: typeof Promise): Promise.Resolver<R>;
~~~~~~~~
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Resolver'.
!!! error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Resolver'.
static cast<R>(dit: typeof Promise, value: Promise.Thenable<R>): Promise<R>;
static cast<R>(dit: typeof Promise, value: R): Promise<R>;
@@ -72,16 +72,16 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace '"tes
static settle<R>(dit: typeof Promise, values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<Promise.Inspection<R>[]>;
~~~~~~~~~~
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
!!! error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Inspection'.
static settle<R>(dit: typeof Promise, values: Promise.Thenable<R[]>): Promise<Promise.Inspection<R>[]>;
~~~~~~~~~~
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
!!! error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Inspection'.
static settle<R>(dit: typeof Promise, values: Promise.Thenable<R>[]): Promise<Promise.Inspection<R>[]>;
~~~~~~~~~~
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
!!! error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Inspection'.
static settle<R>(dit: typeof Promise, values: R[]): Promise<Promise.Inspection<R>[]>;
~~~~~~~~~~
!!! error TS2694: Namespace '"tests/cases/compiler/bluebirdStaticThis".Promise' has no exported member 'Inspection'.
!!! error TS2809: Namespace 'Promise' from module 'tests/cases/compiler/bluebirdStaticThis' has no exported member 'Inspection'.
static any<R>(dit: typeof Promise, values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<R>;
static any<R>(dit: typeof Promise, values: Promise.Thenable<R[]>): Promise<R>;
@@ -0,0 +1,54 @@
//// [tests/cases/conformance/decorators/decoratorMetadata/customMetadataDecorator.globalIdentifier.1.ts] ////
//// [global.d.ts]
declare const metadata: any;
declare const dec: any;
//// [main.ts]
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
//// [main.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
let C = class C {
constructor(x) { }
method(x) { return ""; }
get accessor() { return ""; }
};
__decorate([
dec,
metadata("design:type", Number)
], C.prototype, "x", void 0);
__decorate([
dec,
__param(0, dec),
metadata("design:type", Function),
metadata("design:paramtypes", [Number]),
metadata("design:returntype", String)
], C.prototype, "method", null);
__decorate([
dec,
metadata("design:type", String),
metadata("design:paramtypes", [])
], C.prototype, "accessor", null);
C = __decorate([
dec,
metadata("design:paramtypes", [Number])
], C);
@@ -0,0 +1,48 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'. Did you mean 'metadat'?
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'. Did you mean 'metadat'?
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'. Did you mean 'metadat'?
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'. Did you mean 'metadat'?
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'. Did you mean 'metadat'?
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare const metadat: any;
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:1:15: 'metadat' is declared here.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:1:15: 'metadat' is declared here.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:1:15: 'metadat' is declared here.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:1:15: 'metadat' is declared here.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:1:15: 'metadat' is declared here.
get accessor(): string { return ""; }
}
@@ -0,0 +1,42 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Cannot find name 'metadata'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Cannot find name 'metadata'.
get accessor(): string { return ""; }
}
@@ -0,0 +1,54 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare const metadata: number;
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
!!! related TS2734 tests/cases/conformance/decorators/decoratorMetadata/main.ts:1:1: Are you missing a semicolon?
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
get accessor(): string { return ""; }
}
@@ -0,0 +1,43 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Expected 0 arguments, but got 1.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Expected 0 arguments, but got 3.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare function metadata(): void;
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 1.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 3.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 3.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 3.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 3.
get accessor(): string { return ""; }
}
@@ -0,0 +1,49 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Unable to resolve signature of class decorator when called as an expression.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Unable to resolve signature of property decorator when called as an expression.
The return type of a property decorator function must be either 'void' or 'any'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Unable to resolve signature of method decorator when called as an expression.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Unable to resolve signature of parameter decorator when called as an expression.
The return type of a parameter decorator function must be either 'void' or 'any'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Unable to resolve signature of method decorator when called as an expression.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare function metadata(target: Function): true;
declare function metadata(target: object, key: string, desc?: PropertyDescriptor): true;
declare function metadata(target: object, key: string, parameterIndex: number): true;
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of class decorator when called as an expression.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1433: The return type of a property decorator function must be either 'void' or 'any'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of method decorator when called as an expression.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of parameter decorator when called as an expression.
!!! error TS1433: The return type of a parameter decorator function must be either 'void' or 'any'.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of method decorator when called as an expression.
get accessor(): string { return ""; }
}
@@ -0,0 +1,64 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
Argument of type 'typeof C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare function metadata(target: number): void;
declare function metadata(target: number, key: string, desc?: PropertyDescriptor): void;
declare function metadata(target: number, key: string, parameterIndex: number): void;
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (4 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: Argument of type 'typeof C' is not assignable to parameter of type 'number'.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: No overload matches this call.
!!! error TS1433: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1433: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: No overload matches this call.
!!! error TS1433: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1433: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
method(@dec x: number): string { return ""; }
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'metadata' when called as an expression.
!!! error TS1433: No overload matches this call.
!!! error TS1433: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1433: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
get accessor(): string { return ""; }
}
@@ -0,0 +1,56 @@
//// [tests/cases/conformance/decorators/decoratorMetadata/customMetadataDecorator.globalNamespace.1.ts] ////
//// [global.d.ts]
declare namespace Reflect {
const metadata: any;
}
declare const dec: any;
//// [main.ts]
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
//// [main.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
let C = class C {
constructor(x) { }
method(x) { return ""; }
get accessor() { return ""; }
};
__decorate([
dec,
Reflect.metadata("design:type", Number)
], C.prototype, "x", void 0);
__decorate([
dec,
__param(0, dec),
Reflect.metadata("design:type", Function),
Reflect.metadata("design:paramtypes", [Number]),
Reflect.metadata("design:returntype", String)
], C.prototype, "method", null);
__decorate([
dec,
Reflect.metadata("design:type", String),
Reflect.metadata("design:paramtypes", [])
], C.prototype, "accessor", null);
C = __decorate([
dec,
Reflect.metadata("design:paramtypes", [Number])
], C);
@@ -0,0 +1,50 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare namespace Reflect {
const metadat: any;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: 'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:2:11: 'metadat' is declared here.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: 'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:2:11: 'metadat' is declared here.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: 'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:2:11: 'metadat' is declared here.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: 'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:2:11: 'metadat' is declared here.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: 'Reflect' has no exported member named 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:2:11: 'metadat' is declared here.
get accessor(): string { return ""; }
}
@@ -0,0 +1,45 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare namespace Reflect {
const _: any;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
get accessor(): string { return ""; }
}
@@ -0,0 +1,56 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare namespace Reflect {
const metadata: number;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
!!! related TS2734 tests/cases/conformance/decorators/decoratorMetadata/main.ts:1:1: Are you missing a semicolon?
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: This expression is not callable.
!!! error TS1433: Type 'Number' has no call signatures.
get accessor(): string { return ""; }
}
@@ -0,0 +1,45 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Expected 0 arguments, but got 1.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Expected 0 arguments, but got 3.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare namespace Reflect {
function metadata(): void;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 1.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 3.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 3.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 3.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Expected 0 arguments, but got 3.
get accessor(): string { return ""; }
}
@@ -0,0 +1,51 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Unable to resolve signature of class decorator when called as an expression.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Unable to resolve signature of property decorator when called as an expression.
The return type of a property decorator function must be either 'void' or 'any'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Unable to resolve signature of method decorator when called as an expression.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Unable to resolve signature of parameter decorator when called as an expression.
The return type of a parameter decorator function must be either 'void' or 'any'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Unable to resolve signature of method decorator when called as an expression.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare namespace Reflect {
function metadata(target: Function): true;
function metadata(target: object, key: string, desc?: PropertyDescriptor): true;
function metadata(target: object, key: string, parameterIndex: number): true;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of class decorator when called as an expression.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1433: The return type of a property decorator function must be either 'void' or 'any'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of method decorator when called as an expression.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of parameter decorator when called as an expression.
!!! error TS1433: The return type of a parameter decorator function must be either 'void' or 'any'.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Unable to resolve signature of method decorator when called as an expression.
get accessor(): string { return ""; }
}
@@ -0,0 +1,66 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Argument of type 'typeof C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare namespace Reflect {
function metadata(target: number): void;
function metadata(target: number, key: string, desc?: PropertyDescriptor): void;
function metadata(target: number, key: string, parameterIndex: number): void;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (4 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Argument of type 'typeof C' is not assignable to parameter of type 'number'.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: No overload matches this call.
!!! error TS1433: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1433: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: No overload matches this call.
!!! error TS1433: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1433: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
method(@dec x: number): string { return ""; }
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: No overload matches this call.
!!! error TS1433: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1433: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1433: Argument of type 'C' is not assignable to parameter of type 'number'.
get accessor(): string { return ""; }
}
@@ -0,0 +1,42 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
Namespace 'Reflect' has no exported member 'metadata'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
class C {
@dec x!: number;
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
@dec
~~~~
!!! error TS1433: Unable to resolve signature of implicit decorator 'Reflect.metadata' when called as an expression.
!!! error TS1433: Namespace 'Reflect' has no exported member 'metadata'.
get accessor(): string { return ""; }
}
@@ -0,0 +1,58 @@
//// [tests/cases/conformance/decorators/decoratorMetadata/customMetadataDecorator.importedIdentifier.1.ts] ////
//// [global.d.ts]
declare module "foo" {
const metadata: any;
}
declare const dec: any;
//// [main.ts]
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
//// [main.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
import { metadata as metadata } from "foo";
let C = class C {
constructor(x) { }
method(x) { return ""; }
get accessor() { return ""; }
};
__decorate([
dec,
metadata("design:type", Number)
], C.prototype, "x", void 0);
__decorate([
dec,
__param(0, dec),
metadata("design:type", Function),
metadata("design:paramtypes", [Number]),
metadata("design:returntype", String)
], C.prototype, "method", null);
__decorate([
dec,
metadata("design:type", String),
metadata("design:paramtypes", [])
], C.prototype, "accessor", null);
C = __decorate([
dec,
metadata("design:paramtypes", [Number])
], C);
@@ -0,0 +1,59 @@
//// [tests/cases/conformance/decorators/decoratorMetadata/customMetadataDecorator.importedIdentifier.10.ts] ////
//// [global.d.ts]
declare module "foo" {
const metadata: any;
}
declare const dec: any;
//// [main.ts]
declare const metadata: any;
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
//// [main.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
import { metadata as metadata_1 } from "foo";
let C = class C {
constructor(x) { }
method(x) { return ""; }
get accessor() { return ""; }
};
__decorate([
dec,
metadata_1("design:type", Number)
], C.prototype, "x", void 0);
__decorate([
dec,
__param(0, dec),
metadata_1("design:type", Function),
metadata_1("design:paramtypes", [Number]),
metadata_1("design:returntype", String)
], C.prototype, "method", null);
__decorate([
dec,
metadata_1("design:type", String),
metadata_1("design:paramtypes", [])
], C.prototype, "accessor", null);
C = __decorate([
dec,
metadata_1("design:paramtypes", [Number])
], C);
@@ -0,0 +1,24 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS2343: This syntax requires an imported helper named 'metadata' which does not exist in 'foo'. Consider upgrading your version of 'foo'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
const metadat: any;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (1 errors) ====
@dec
~~~~
!!! error TS2343: This syntax requires an imported helper named 'metadata' which does not exist in 'foo'. Consider upgrading your version of 'foo'.
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,24 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS2343: This syntax requires an imported helper named 'metadata' which does not exist in 'foo'. Consider upgrading your version of 'foo'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
const _: any;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (1 errors) ====
@dec
~~~~
!!! error TS2343: This syntax requires an imported helper named 'metadata' which does not exist in 'foo'. Consider upgrading your version of 'foo'.
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,57 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
const metadata: number;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
!!! related TS2734 tests/cases/conformance/decorators/decoratorMetadata/main.ts:1:1: Are you missing a semicolon?
class C {
@dec x!: number;
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
constructor(x: number) {}
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,46 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 1.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 3.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
function metadata(): void;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 1.
class C {
@dec x!: number;
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 3.
constructor(x: number) {}
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 3.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 3.
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 3.
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,52 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Unable to resolve signature of class decorator when called as an expression.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Unable to resolve signature of property decorator when called as an expression.
The return type of a property decorator function must be either 'void' or 'any'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Unable to resolve signature of method decorator when called as an expression.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Unable to resolve signature of parameter decorator when called as an expression.
The return type of a parameter decorator function must be either 'void' or 'any'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Unable to resolve signature of method decorator when called as an expression.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
function metadata(target: Function): true;
function metadata(target: object, key: string, desc?: PropertyDescriptor): true;
function metadata(target: object, key: string, parameterIndex: number): true;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of class decorator when called as an expression.
class C {
@dec x!: number;
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1434: The return type of a property decorator function must be either 'void' or 'any'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of method decorator when called as an expression.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of parameter decorator when called as an expression.
!!! error TS1434: The return type of a parameter decorator function must be either 'void' or 'any'.
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of method decorator when called as an expression.
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,21 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS2354: This syntax requires an imported helper but module 'foo' cannot be found.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (1 errors) ====
@dec
~~~~
!!! error TS2354: This syntax requires an imported helper but module 'foo' cannot be found.
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,36 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
const metadata: any;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
class C {
@dec x!: number;
~~~~
!!! error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
constructor(x: number) {}
@dec
~~~~
!!! error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
@dec
~~~~
!!! error TS1435: Unable to import implicit decorator 'metadata' from module 'foo' as this file is not a module.
get accessor(): string { return ""; }
}
@@ -0,0 +1,67 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
Argument of type 'typeof C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
function metadata(target: number): void;
function metadata(target: number, key: string, desc?: PropertyDescriptor): void;
function metadata(target: number, key: string, parameterIndex: number): void;
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (4 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: Argument of type 'typeof C' is not assignable to parameter of type 'number'.
class C {
@dec x!: number;
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: No overload matches this call.
!!! error TS1434: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1434: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: No overload matches this call.
!!! error TS1434: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1434: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
method(@dec x: number): string { return ""; }
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'metadata' from module 'foo' when called as an expression.
!!! error TS1434: No overload matches this call.
!!! error TS1434: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1434: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,60 @@
//// [tests/cases/conformance/decorators/decoratorMetadata/customMetadataDecorator.importedNamespace.1.ts] ////
//// [global.d.ts]
declare module "foo" {
namespace Reflect {
const metadata: any;
}
}
declare const dec: any;
//// [main.ts]
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
//// [main.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
import { Reflect as Reflect_1 } from "foo";
let C = class C {
constructor(x) { }
method(x) { return ""; }
get accessor() { return ""; }
};
__decorate([
dec,
Reflect_1.metadata("design:type", Number)
], C.prototype, "x", void 0);
__decorate([
dec,
__param(0, dec),
Reflect_1.metadata("design:type", Function),
Reflect_1.metadata("design:paramtypes", [Number]),
Reflect_1.metadata("design:returntype", String)
], C.prototype, "method", null);
__decorate([
dec,
Reflect_1.metadata("design:type", String),
Reflect_1.metadata("design:paramtypes", [])
], C.prototype, "accessor", null);
C = __decorate([
dec,
Reflect_1.metadata("design:paramtypes", [Number])
], C);
@@ -0,0 +1,29 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
'Reflect' from module 'foo' has no exported member named 'metadata'. Did you mean 'metadat'?
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
namespace Reflect {
const metadat: any;
}
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (1 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: 'Reflect' from module 'foo' has no exported member named 'metadata'. Did you mean 'metadat'?
!!! related TS2728 tests/cases/conformance/decorators/decoratorMetadata/global.d.ts:3:15: 'metadat' is declared here.
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,28 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Namespace 'Reflect' from module 'foo' has no exported member 'metadata'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
namespace Reflect {
const _: any;
}
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (1 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Namespace 'Reflect' from module 'foo' has no exported member 'metadata'.
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,59 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
This expression is not callable.
Type 'Number' has no call signatures.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
namespace Reflect {
const metadata: number;
}
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
!!! related TS2734 tests/cases/conformance/decorators/decoratorMetadata/main.ts:1:1: Are you missing a semicolon?
class C {
@dec x!: number;
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
constructor(x: number) {}
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: This expression is not callable.
!!! error TS1434: Type 'Number' has no call signatures.
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,48 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 1.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 3.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Expected 0 arguments, but got 3.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
namespace Reflect {
function metadata(): void;
}
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 1.
class C {
@dec x!: number;
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 3.
constructor(x: number) {}
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 3.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 3.
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Expected 0 arguments, but got 3.
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,54 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Unable to resolve signature of class decorator when called as an expression.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Unable to resolve signature of property decorator when called as an expression.
The return type of a property decorator function must be either 'void' or 'any'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Unable to resolve signature of method decorator when called as an expression.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Unable to resolve signature of parameter decorator when called as an expression.
The return type of a parameter decorator function must be either 'void' or 'any'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Unable to resolve signature of method decorator when called as an expression.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
namespace Reflect {
function metadata(target: Function): true;
function metadata(target: object, key: string, desc?: PropertyDescriptor): true;
function metadata(target: object, key: string, parameterIndex: number): true;
}
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of class decorator when called as an expression.
class C {
@dec x!: number;
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1434: The return type of a property decorator function must be either 'void' or 'any'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of method decorator when called as an expression.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of parameter decorator when called as an expression.
!!! error TS1434: The return type of a parameter decorator function must be either 'void' or 'any'.
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Unable to resolve signature of method decorator when called as an expression.
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,69 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
Argument of type 'typeof C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
No overload matches this call.
Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
Argument of type 'C' is not assignable to parameter of type 'number'.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
namespace Reflect {
function metadata(target: number): void;
function metadata(target: number, key: string, desc?: PropertyDescriptor): void;
function metadata(target: number, key: string, parameterIndex: number): void;
}
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (4 errors) ====
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: Argument of type 'typeof C' is not assignable to parameter of type 'number'.
class C {
@dec x!: number;
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: No overload matches this call.
!!! error TS1434: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1434: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
constructor(x: number) {}
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: No overload matches this call.
!!! error TS1434: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1434: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
method(@dec x: number): string { return ""; }
@dec
~~~~
!!! error TS1434: Unable to resolve signature of implicit decorator 'Reflect.metadata' from module 'foo' when called as an expression.
!!! error TS1434: No overload matches this call.
!!! error TS1434: Overload 1 of 3, '(target: number, key: string, desc?: PropertyDescriptor): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
!!! error TS1434: Overload 2 of 3, '(target: number, key: string, parameterIndex: number): void', gave the following error.
!!! error TS1434: Argument of type 'C' is not assignable to parameter of type 'number'.
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,38 @@
tests/cases/conformance/decorators/decoratorMetadata/main.ts(1,1): error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(3,5): error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(7,5): error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(8,12): error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
tests/cases/conformance/decorators/decoratorMetadata/main.ts(10,5): error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
==== tests/cases/conformance/decorators/decoratorMetadata/global.d.ts (0 errors) ====
declare module "foo" {
namespace Reflect {
const metadata: any;
}
}
declare const dec: any;
==== tests/cases/conformance/decorators/decoratorMetadata/main.ts (5 errors) ====
@dec
~~~~
!!! error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
class C {
@dec x!: number;
~~~~
!!! error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
constructor(x: number) {}
@dec
~~~~
!!! error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
method(@dec x: number): string { return ""; }
~~~~
!!! error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
@dec
~~~~
!!! error TS1435: Unable to import implicit decorator 'Reflect.metadata' from module 'foo' as this file is not a module.
get accessor(): string { return ""; }
}
@@ -1,9 +1,9 @@
tests/cases/conformance/decorators/decoratorMetadata-jsdoc.ts(5,9): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/decorators/decoratorMetadata-jsdoc.ts(7,9): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/decorators/decoratorMetadata-jsdoc.ts(9,9): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/decorators/decoratorMetadata/decoratorMetadata-jsdoc.ts(5,9): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/decorators/decoratorMetadata/decoratorMetadata-jsdoc.ts(7,9): error TS8020: JSDoc types can only be used inside documentation comments.
tests/cases/conformance/decorators/decoratorMetadata/decoratorMetadata-jsdoc.ts(9,9): error TS8020: JSDoc types can only be used inside documentation comments.
==== tests/cases/conformance/decorators/decoratorMetadata-jsdoc.ts (3 errors) ====
==== tests/cases/conformance/decorators/decoratorMetadata/decoratorMetadata-jsdoc.ts (3 errors) ====
declare var decorator: any;
class X {
@@ -1,4 +1,4 @@
=== tests/cases/conformance/decorators/decoratorMetadata-jsdoc.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/decoratorMetadata-jsdoc.ts ===
declare var decorator: any;
>decorator : Symbol(decorator, Decl(decoratorMetadata-jsdoc.ts, 0, 11))
@@ -1,4 +1,4 @@
=== tests/cases/conformance/decorators/decoratorMetadata-jsdoc.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/decoratorMetadata-jsdoc.ts ===
declare var decorator: any;
>decorator : any
@@ -1,4 +1,4 @@
//// [tests/cases/conformance/decorators/decoratorMetadata.ts] ////
//// [tests/cases/conformance/decorators/decoratorMetadata/decoratorMetadata.ts] ////
//// [service.ts]
export default class Service {
@@ -1,8 +1,8 @@
=== tests/cases/conformance/decorators/service.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/service.ts ===
export default class Service {
>Service : Symbol(Service, Decl(service.ts, 0, 0))
}
=== tests/cases/conformance/decorators/component.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/component.ts ===
import Service from "./service";
>Service : Symbol(Service, Decl(component.ts, 0, 6))
@@ -1,8 +1,8 @@
=== tests/cases/conformance/decorators/service.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/service.ts ===
export default class Service {
>Service : Service
}
=== tests/cases/conformance/decorators/component.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/component.ts ===
import Service from "./service";
>Service : typeof Service
@@ -1,4 +1,4 @@
//// [tests/cases/conformance/decorators/decoratorMetadataWithTypeOnlyImport.ts] ////
//// [tests/cases/conformance/decorators/decoratorMetadata/decoratorMetadataWithTypeOnlyImport.ts] ////
//// [service.ts]
export class Service {
@@ -1,8 +1,8 @@
=== tests/cases/conformance/decorators/service.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/service.ts ===
export class Service {
>Service : Symbol(Service, Decl(service.ts, 0, 0))
}
=== tests/cases/conformance/decorators/component.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/component.ts ===
import type { Service } from "./service";
>Service : Symbol(Service, Decl(component.ts, 0, 13))
@@ -1,8 +1,8 @@
=== tests/cases/conformance/decorators/service.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/service.ts ===
export class Service {
>Service : Service
}
=== tests/cases/conformance/decorators/component.ts ===
=== tests/cases/conformance/decorators/decoratorMetadata/component.ts ===
import type { Service } from "./service";
>Service : Service
@@ -1,5 +1,5 @@
tests/cases/compiler/extendArray.ts(7,19): error TS2304: Cannot find name '_element'.
tests/cases/compiler/extendArray.ts(7,32): error TS2304: Cannot find name '_element'.
tests/cases/compiler/extendArray.ts(7,19): error TS2552: Cannot find name '_element'. Did you mean 'Element'?
tests/cases/compiler/extendArray.ts(7,32): error TS2552: Cannot find name '_element'. Did you mean 'Element'?
==== tests/cases/compiler/extendArray.ts (2 errors) ====
@@ -11,9 +11,11 @@ tests/cases/compiler/extendArray.ts(7,32): error TS2304: Cannot find name '_elem
interface Array {
collect(fn:(e:_element) => _element[]) : any[];
~~~~~~~~
!!! error TS2304: Cannot find name '_element'.
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:5249:13: 'Element' is declared here.
~~~~~~~~
!!! error TS2304: Cannot find name '_element'.
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:5249:13: 'Element' is declared here.
}
}
@@ -1,4 +1,4 @@
tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2503: Cannot find namespace 'b'.
tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2811: Cannot find namespace 'b'. Did you mean 'B?
==== tests/cases/compiler/importedModuleAddToGlobal.ts (1 errors) ====
@@ -18,5 +18,6 @@ tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2503: Cannot f
import a = A;
function hello(): b.B { return null; }
~
!!! error TS2503: Cannot find namespace 'b'.
!!! error TS2811: Cannot find namespace 'b'. Did you mean 'B?
!!! related TS2728 tests/cases/compiler/importedModuleAddToGlobal.ts:8:8: 'B' is declared here.
}
@@ -1,4 +1,4 @@
tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.ts(11,10): error TS2694: Namespace '"tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'.
tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.ts(11,10): error TS2809: Namespace 'c' from module 'tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError' has no exported member 'b'.
==== tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError.ts (1 errors) ====
@@ -14,4 +14,4 @@ tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessE
var x: c.b;
~
!!! error TS2694: Namespace '"tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'.
!!! error TS2809: Namespace 'c' from module 'tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExportAccessError' has no exported member 'b'.
@@ -1,4 +1,4 @@
tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.ts(16,17): error TS2694: Namespace '"tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'.
tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.ts(16,17): error TS2809: Namespace 'c' from module 'tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError' has no exported member 'b'.
==== tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.ts (1 errors) ====
@@ -19,4 +19,4 @@ tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExp
export var z: c.b.I;
~
!!! error TS2694: Namespace '"tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError".c' has no exported member 'b'.
!!! error TS2809: Namespace 'c' from module 'tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError' has no exported member 'b'.
@@ -1,6 +1,6 @@
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(2,18): error TS2300: Duplicate identifier 'Point'.
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(3,16): error TS2300: Duplicate identifier 'Point'.
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2503: Cannot find namespace 'm'.
tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2811: Cannot find namespace 'm'. Did you mean 'M?
==== tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts (3 errors) ====
@@ -21,7 +21,8 @@ tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedMo
var m = M2;
var p: m.Point; // Error
~
!!! error TS2503: Cannot find namespace 'm'.
!!! error TS2811: Cannot find namespace 'm'. Did you mean 'M?
!!! related TS2728 tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts:1:8: 'M' is declared here.
@@ -1,4 +1,4 @@
/a.js(3,15): error TS2304: Cannot find name 'sting'.
/a.js(3,15): error TS2552: Cannot find name 'sting'. Did you mean 'String'?
==== /a.js (1 errors) ====
@@ -6,7 +6,8 @@
* @typedef MyType
* @property {sting} [x]
~~~~~
!!! error TS2304: Cannot find name 'sting'.
!!! error TS2552: Cannot find name 'sting'. Did you mean 'String'?
!!! related TS2728 /.ts/lib.es5.d.ts:527:13: 'String' is declared here.
*/
/** @param {MyType} p */
@@ -1,7 +1,7 @@
error TS18035: Invalid value for 'jsxFragmentFactory'. '234' is not a valid identifier or qualified-name.
error TS5067: Invalid value for 'jsxFragmentFactory'. '234' is not a valid identifier or qualified-name.
!!! error TS18035: Invalid value for 'jsxFragmentFactory'. '234' is not a valid identifier or qualified-name.
!!! error TS5067: Invalid value for 'jsxFragmentFactory'. '234' is not a valid identifier or qualified-name.
==== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx (0 errors) ====
declare var h: any;
@@ -1,11 +1,11 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(1,8): error TS2503: Cannot find namespace 'TypeModule1'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(1,8): error TS2811: Cannot find namespace 'TypeModule1'. Did you mean 'TypeModule2?
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(1,20): error TS1003: Identifier expected.
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts (2 errors) ====
var x: TypeModule1.
~~~~~~~~~~~
!!! error TS2503: Cannot find namespace 'TypeModule1'.
!!! error TS2811: Cannot find namespace 'TypeModule1'. Did you mean 'TypeModule2?
!!! error TS1003: Identifier expected.
module TypeModule2 {
@@ -1,5 +1,5 @@
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric1.ts(2,23): error TS2304: Cannot find name 'IPromise'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric1.ts(2,45): error TS2304: Cannot find name 'IPromise'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric1.ts(2,23): error TS2552: Cannot find name 'IPromise'. Did you mean 'Promise'?
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric1.ts(2,45): error TS2552: Cannot find name 'IPromise'. Did you mean 'Promise'?
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric1.ts(2,54): error TS1005: '>' expected.
@@ -7,8 +7,8 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGener
interface IQService {
all(promises: IPromise < any > []): IPromise<
~~~~~~~~
!!! error TS2304: Cannot find name 'IPromise'.
!!! error TS2552: Cannot find name 'IPromise'. Did you mean 'Promise'?
~~~~~~~~
!!! error TS2304: Cannot find name 'IPromise'.
!!! error TS2552: Cannot find name 'IPromise'. Did you mean 'Promise'?
!!! error TS1005: '>' expected.
@@ -10,8 +10,8 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGener
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(4,37): error TS2693: 'any' only refers to a type, but is being used as a value here.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(4,41): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(4,43): error TS2693: 'any' only refers to a type, but is being used as a value here.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(8,23): error TS2304: Cannot find name 'IPromise'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(8,45): error TS2304: Cannot find name 'IPromise'.
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(8,23): error TS2552: Cannot find name 'IPromise'. Did you mean 'Promise'?
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(8,45): error TS2552: Cannot find name 'IPromise'. Did you mean 'Promise'?
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(8,54): error TS1005: '>' expected.
@@ -49,8 +49,8 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGener
interface IQService {
all(promises: IPromise < any > []): IPromise<
~~~~~~~~
!!! error TS2304: Cannot find name 'IPromise'.
!!! error TS2552: Cannot find name 'IPromise'. Did you mean 'Promise'?
~~~~~~~~
!!! error TS2304: Cannot find name 'IPromise'.
!!! error TS2552: Cannot find name 'IPromise'. Did you mean 'Promise'?
!!! error TS1005: '>' expected.
@@ -5,8 +5,8 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(38,5): error TS1329: 'noAr
tests/cases/compiler/potentiallyUncalledDecorators.ts(41,1): error TS1238: Unable to resolve signature of class decorator when called as an expression.
Type 'OmniDecorator' is not assignable to type 'typeof B'.
Type 'OmniDecorator' provides no match for the signature 'new (): B'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(43,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'.
Unable to resolve signature of property decorator when called as an expression.
tests/cases/compiler/potentiallyUncalledDecorators.ts(43,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
The return type of a property decorator function must be either 'void' or 'any'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(44,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(47,1): error TS1238: Unable to resolve signature of class decorator when called as an expression.
@@ -17,22 +17,22 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(50,5): error TS1329: 'oneO
tests/cases/compiler/potentiallyUncalledDecorators.ts(53,1): error TS1238: Unable to resolve signature of class decorator when called as an expression.
Type 'OmniDecorator' is not assignable to type 'typeof D'.
Type 'OmniDecorator' provides no match for the signature 'new (): D'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(55,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'.
Unable to resolve signature of property decorator when called as an expression.
tests/cases/compiler/potentiallyUncalledDecorators.ts(55,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
The return type of a property decorator function must be either 'void' or 'any'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(56,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(59,1): error TS1238: Unable to resolve signature of class decorator when called as an expression.
Type 'OmniDecorator' is not assignable to type 'typeof E'.
Type 'OmniDecorator' provides no match for the signature 'new (): E'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(61,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'.
Unable to resolve signature of property decorator when called as an expression.
tests/cases/compiler/potentiallyUncalledDecorators.ts(61,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
The return type of a property decorator function must be either 'void' or 'any'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(62,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(65,1): error TS1238: Unable to resolve signature of class decorator when called as an expression.
Type 'OmniDecorator' is not assignable to type 'typeof F'.
Type 'OmniDecorator' provides no match for the signature 'new (): F'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(67,5): error TS1236: The return type of a property decorator function must be either 'void' or 'any'.
Unable to resolve signature of property decorator when called as an expression.
tests/cases/compiler/potentiallyUncalledDecorators.ts(67,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
The return type of a property decorator function must be either 'void' or 'any'.
tests/cases/compiler/potentiallyUncalledDecorators.ts(68,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
@@ -94,8 +94,8 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(68,5): error TS1241: Unabl
class B {
@allRest foo: any;
~~~~~~~~
!!! error TS1236: The return type of a property decorator function must be either 'void' or 'any'.
!!! error TS1236: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: The return type of a property decorator function must be either 'void' or 'any'.
@allRest bar() { }
~~~~~~~~
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
@@ -124,8 +124,8 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(68,5): error TS1241: Unabl
class D {
@twoOptional foo: any;
~~~~~~~~~~~~
!!! error TS1236: The return type of a property decorator function must be either 'void' or 'any'.
!!! error TS1236: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: The return type of a property decorator function must be either 'void' or 'any'.
@twoOptional bar() { }
~~~~~~~~~~~~
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
@@ -140,8 +140,8 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(68,5): error TS1241: Unabl
class E {
@threeOptional foo: any;
~~~~~~~~~~~~~~
!!! error TS1236: The return type of a property decorator function must be either 'void' or 'any'.
!!! error TS1236: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: The return type of a property decorator function must be either 'void' or 'any'.
@threeOptional bar() { }
~~~~~~~~~~~~~~
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
@@ -156,8 +156,8 @@ tests/cases/compiler/potentiallyUncalledDecorators.ts(68,5): error TS1241: Unabl
class F {
@oneOptionalWithRest foo: any;
~~~~~~~~~~~~~~~~~~~~
!!! error TS1236: The return type of a property decorator function must be either 'void' or 'any'.
!!! error TS1236: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: The return type of a property decorator function must be either 'void' or 'any'.
@oneOptionalWithRest bar() { }
~~~~~~~~~~~~~~~~~~~~
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
@@ -1,5 +1,5 @@
tests/cases/compiler/primaryExpressionMods.ts(7,8): error TS2709: Cannot use namespace 'M' as a type.
tests/cases/compiler/primaryExpressionMods.ts(11,8): error TS2503: Cannot find namespace 'm'.
tests/cases/compiler/primaryExpressionMods.ts(11,8): error TS2811: Cannot find namespace 'm'. Did you mean 'M?
==== tests/cases/compiler/primaryExpressionMods.ts (2 errors) ====
@@ -17,5 +17,6 @@ tests/cases/compiler/primaryExpressionMods.ts(11,8): error TS2503: Cannot find n
var x2 = m.a; // Same as M.a
var q: m.P; // Error
~
!!! error TS2503: Cannot find namespace 'm'.
!!! error TS2811: Cannot find namespace 'm'. Did you mean 'M?
!!! related TS2728 tests/cases/compiler/primaryExpressionMods.ts:1:8: 'M' is declared here.
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"metadataDecorator": "someString"
}
}
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"metadataDecoratorImportSource": "someString"
}
}
@@ -38,6 +38,11 @@ Output::
1 namespace main.file4 { import DynamicMenu = Common.SomeComponent.DynamicMenu; export function foo(a: DynamicMenu.z) { } }
   ~
a/b/output/AnotherDependency/file1.d.ts:1:59
1 declare namespace Common.SomeComponent.DynamicMenu { enum Z { Full = 0, Min = 1, Average = 2, } }
   ~
'Z' is declared here.
[12:00:34 AM] Found 1 error. Watching for file changes.
@@ -38,6 +38,11 @@ Output::
1 namespace main.file4 { import DynamicMenu = Common.SomeComponent.DynamicMenu; export function foo(a: DynamicMenu.z) { } }
   ~
a/b/output/AnotherDependency/file1.d.ts:1:59
1 declare namespace Common.SomeComponent.DynamicMenu { enum Z { Full = 0, Min = 1, Average = 2, } }
   ~
'Z' is declared here.
[12:00:36 AM] Found 1 error. Watching for file changes.
@@ -0,0 +1,23 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @filename: global.d.ts
declare const metadata: any;
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,24 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @filename: global.d.ts
declare const metadat: any;
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,23 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @filename: global.d.ts
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,24 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @filename: global.d.ts
declare const metadata: number;
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,24 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @filename: global.d.ts
declare function metadata(): void;
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,26 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @filename: global.d.ts
declare function metadata(target: Function): true;
declare function metadata(target: object, key: string, desc?: PropertyDescriptor): true;
declare function metadata(target: object, key: string, parameterIndex: number): true;
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,26 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @filename: global.d.ts
declare function metadata(target: number): void;
declare function metadata(target: number, key: string, desc?: PropertyDescriptor): void;
declare function metadata(target: number, key: string, parameterIndex: number): void;
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,25 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: Reflect.metadata
// @filename: global.d.ts
declare namespace Reflect {
const metadata: any;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,26 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: Reflect.metadata
// @filename: global.d.ts
declare namespace Reflect {
const metadat: any;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,26 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: Reflect.metadata
// @filename: global.d.ts
declare namespace Reflect {
const _: any;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,26 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: Reflect.metadata
// @filename: global.d.ts
declare namespace Reflect {
const metadata: number;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,26 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: Reflect.metadata
// @filename: global.d.ts
declare namespace Reflect {
function metadata(): void;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,28 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: Reflect.metadata
// @filename: global.d.ts
declare namespace Reflect {
function metadata(target: Function): true;
function metadata(target: object, key: string, desc?: PropertyDescriptor): true;
function metadata(target: object, key: string, parameterIndex: number): true;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,28 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: Reflect.metadata
// @filename: global.d.ts
declare namespace Reflect {
function metadata(target: number): void;
function metadata(target: number, key: string, desc?: PropertyDescriptor): void;
function metadata(target: number, key: string, parameterIndex: number): void;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,23 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: Reflect.metadata
// @filename: global.d.ts
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
@@ -0,0 +1,27 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @metadataDecoratorImportSource: foo
// @filename: global.d.ts
declare module "foo" {
const metadata: any;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,28 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @metadataDecoratorImportSource: foo
// @filename: global.d.ts
declare module "foo" {
const metadata: any;
}
declare const dec: any;
// @filename: main.ts
declare const metadata: any;
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,28 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @metadataDecoratorImportSource: foo
// @filename: global.d.ts
declare module "foo" {
const metadat: any;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,28 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @metadataDecoratorImportSource: foo
// @filename: global.d.ts
declare module "foo" {
const _: any;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,28 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @metadataDecoratorImportSource: foo
// @filename: global.d.ts
declare module "foo" {
const metadata: number;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,28 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @metadataDecoratorImportSource: foo
// @filename: global.d.ts
declare module "foo" {
function metadata(): void;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,30 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @metadataDecoratorImportSource: foo
// @filename: global.d.ts
declare module "foo" {
function metadata(target: Function): true;
function metadata(target: object, key: string, desc?: PropertyDescriptor): true;
function metadata(target: object, key: string, parameterIndex: number): true;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,25 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @metadataDecoratorImportSource: foo
// @filename: global.d.ts
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}
export {};
@@ -0,0 +1,27 @@
// @target: es2019
// @module: esnext
// @moduleResolution: node
// @noTypesAndSymbols: true
// @noEmit: true
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @metadataDecorator: metadata
// @metadataDecoratorImportSource: foo
// @filename: global.d.ts
declare module "foo" {
const metadata: any;
}
declare const dec: any;
// @filename: main.ts
@dec
class C {
@dec x!: number;
constructor(x: number) {}
@dec
method(@dec x: number): string { return ""; }
@dec
get accessor(): string { return ""; }
}

Some files were not shown because too many files have changed in this diff Show More