mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into dynamicNames
This commit is contained in:
+25
-10
@@ -4210,13 +4210,13 @@ namespace ts {
|
||||
if (parentType === unknownType) {
|
||||
return unknownType;
|
||||
}
|
||||
// If no type was specified or inferred for parent, or if the specified or inferred type is any,
|
||||
// infer from the initializer of the binding element if one is present. Otherwise, go with the
|
||||
// undefined or any type of the parent.
|
||||
if (!parentType || isTypeAny(parentType)) {
|
||||
if (declaration.initializer) {
|
||||
return checkDeclarationInitializer(declaration);
|
||||
}
|
||||
// If no type was specified or inferred for parent,
|
||||
// infer from the initializer of the binding element if one is present.
|
||||
// Otherwise, go with the undefined type of the parent.
|
||||
if (!parentType) {
|
||||
return declaration.initializer ? checkDeclarationInitializer(declaration) : parentType;
|
||||
}
|
||||
if (isTypeAny(parentType)) {
|
||||
return parentType;
|
||||
}
|
||||
|
||||
@@ -4242,9 +4242,6 @@ namespace ts {
|
||||
// computed properties with non-literal names are treated as 'any'
|
||||
return anyType;
|
||||
}
|
||||
if (declaration.initializer) {
|
||||
getContextualType(declaration.initializer);
|
||||
}
|
||||
|
||||
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
|
||||
// or otherwise the type of the string index signature.
|
||||
@@ -16921,6 +16918,12 @@ namespace ts {
|
||||
return resolveUntypedCall(node);
|
||||
}
|
||||
|
||||
if (isPotentiallyUncalledDecorator(node, callSignatures)) {
|
||||
const nodeStr = getTextOfNode(node.expression, /*includeTrivia*/ false);
|
||||
error(node, Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr);
|
||||
return resolveErrorCall(node);
|
||||
}
|
||||
|
||||
const headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
|
||||
if (!callSignatures.length) {
|
||||
let errorInfo: DiagnosticMessageChain;
|
||||
@@ -16933,6 +16936,18 @@ namespace ts {
|
||||
return resolveCall(node, callSignatures, candidatesOutArray, headMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sometimes, we have a decorator that could accept zero arguments,
|
||||
* but is receiving too many arguments as part of the decorator invocation.
|
||||
* In those cases, a user may have meant to *call* the expression before using it as a decorator.
|
||||
*/
|
||||
function isPotentiallyUncalledDecorator(decorator: Decorator, signatures: Signature[]) {
|
||||
return signatures.length && every(signatures, signature =>
|
||||
signature.minArgumentCount === 0 &&
|
||||
!signature.hasRestParameter &&
|
||||
signature.parameters.length < getEffectiveArgumentCount(decorator, /*args*/ undefined, signature));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is similar to getResolvedSignature but is exclusively for trying to resolve JSX stateless-function component.
|
||||
* The main reason we have to use this function instead of getResolvedSignature because, the caller of this function will already check the type of openingLikeElement's tagName
|
||||
|
||||
@@ -907,50 +907,54 @@
|
||||
"category": "Error",
|
||||
"code": 1328
|
||||
},
|
||||
"'unique symbol' types are not allowed in a union type.": {
|
||||
"'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?": {
|
||||
"category": "Error",
|
||||
"code": 1329
|
||||
},
|
||||
"'unique symbol' types are not allowed in an intersection type.": {
|
||||
"'unique symbol' types are not allowed in a union type.": {
|
||||
"category": "Error",
|
||||
"code": 1330
|
||||
},
|
||||
"'unique symbol' types are not allowed in an array type.": {
|
||||
"'unique symbol' types are not allowed in an intersection type.": {
|
||||
"category": "Error",
|
||||
"code": 1331
|
||||
},
|
||||
"'unique symbol' types are not allowed in a tuple type.": {
|
||||
"'unique symbol' types are not allowed in an array type.": {
|
||||
"category": "Error",
|
||||
"code": 1332
|
||||
},
|
||||
"'unique symbol' types are not allowed in a mapped type.": {
|
||||
"'unique symbol' types are not allowed in a tuple type.": {
|
||||
"category": "Error",
|
||||
"code": 1333
|
||||
},
|
||||
"A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.": {
|
||||
"'unique symbol' types are not allowed in a mapped type.": {
|
||||
"category": "Error",
|
||||
"code": 1334
|
||||
},
|
||||
"A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.": {
|
||||
"A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.": {
|
||||
"category": "Error",
|
||||
"code": 1335
|
||||
},
|
||||
"A variable whose type is a 'unique symbol' type must be 'const'.": {
|
||||
"A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.": {
|
||||
"category": "Error",
|
||||
"code": 1336
|
||||
},
|
||||
"'unique symbol' types may not be used on a variable declaration with a binding name.": {
|
||||
"A variable whose type is a 'unique symbol' type must be 'const'.": {
|
||||
"category": "Error",
|
||||
"code": 1337
|
||||
},
|
||||
"'unique symbol' types are only allowed on variables in a variable statement.": {
|
||||
"'unique symbol' types may not be used on a variable declaration with a binding name.": {
|
||||
"category": "Error",
|
||||
"code": 1338
|
||||
},
|
||||
"'unique symbol' types are not allowed here.": {
|
||||
"'unique symbol' types are only allowed on variables in a variable statement.": {
|
||||
"category": "Error",
|
||||
"code": 1339
|
||||
},
|
||||
"'unique symbol' types are not allowed here.": {
|
||||
"category": "Error",
|
||||
"code": 1340
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
|
||||
Executable → Regular
@@ -1,10 +1,34 @@
|
||||
/// <reference path="../harness.ts" />
|
||||
|
||||
describe("Public APIs", () => {
|
||||
it("for the language service and compiler should be acknowledged when they change", () => {
|
||||
Harness.Baseline.runBaseline("api/typescript.d.ts", () => Harness.IO.readFile("built/local/typescript.d.ts"));
|
||||
function verifyApi(fileName: string) {
|
||||
const builtFile = `built/local/${fileName}`;
|
||||
const api = `api/${fileName}`;
|
||||
let fileContent: string;
|
||||
before(() => {
|
||||
fileContent = Harness.IO.readFile(builtFile);
|
||||
});
|
||||
|
||||
it("should be acknowledged when they change", () => {
|
||||
Harness.Baseline.runBaseline(api, () => fileContent);
|
||||
});
|
||||
|
||||
it("should compile", () => {
|
||||
const testFile: Harness.Compiler.TestFile = {
|
||||
unitName: builtFile,
|
||||
content: fileContent
|
||||
};
|
||||
const inputFiles = [testFile];
|
||||
const output = Harness.Compiler.compileFiles(inputFiles, [], /*harnessSettings*/ undefined, /*options*/ {}, /*currentDirectory*/ undefined);
|
||||
assert(!output.result.errors || !output.result.errors.length, Harness.Compiler.minimalDiagnosticsToString(output.result.errors, /*pretty*/ true));
|
||||
});
|
||||
}
|
||||
|
||||
describe("for the language service and compiler", () => {
|
||||
verifyApi("typescript.d.ts");
|
||||
});
|
||||
it("for the language server should be acknowledged when they change", () => {
|
||||
Harness.Baseline.runBaseline("api/tsserverlibrary.d.ts", () => Harness.IO.readFile("built/local/tsserverlibrary.d.ts"));
|
||||
|
||||
describe("for the language server", () => {
|
||||
verifyApi("tsserverlibrary.d.ts");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
getCancellationToken() {
|
||||
getCancellationToken(): HostCancellationToken {
|
||||
return this.cancellationToken;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -7113,7 +7113,7 @@ declare namespace ts.server {
|
||||
getScriptKind(fileName: string): ScriptKind;
|
||||
getScriptVersion(filename: string): string;
|
||||
getScriptSnapshot(filename: string): IScriptSnapshot;
|
||||
getCancellationToken(): ThrottledCancellationToken;
|
||||
getCancellationToken(): HostCancellationToken;
|
||||
getCurrentDirectory(): string;
|
||||
getDefaultLibFileName(): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts(4,5): error TS1329: 'dec' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@dec()'?
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts (1 errors) ====
|
||||
@@ -7,5 +7,5 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts(4,5):
|
||||
class C {
|
||||
@dec ["method"]() {}
|
||||
~~~~
|
||||
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
!!! error TS1329: 'dec' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@dec()'?
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts(4,5): error TS1329: 'dec' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@dec()'?
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts (1 errors) ====
|
||||
@@ -7,5 +7,5 @@ tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts(
|
||||
class C {
|
||||
@dec prop;
|
||||
~~~~
|
||||
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
|
||||
!!! error TS1329: 'dec' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@dec()'?
|
||||
}
|
||||
@@ -28,9 +28,9 @@ var [a0, a1]: any = undefined;
|
||||
>undefined : undefined
|
||||
|
||||
var [a2 = false, a3 = 1]: any = undefined;
|
||||
>a2 : boolean
|
||||
>a2 : any
|
||||
>false : false
|
||||
>a3 : number
|
||||
>a3 : any
|
||||
>1 : 1
|
||||
>undefined : undefined
|
||||
|
||||
|
||||
+2
-2
@@ -28,9 +28,9 @@ var [a0, a1]: any = undefined;
|
||||
>undefined : undefined
|
||||
|
||||
var [a2 = false, a3 = 1]: any = undefined;
|
||||
>a2 : boolean
|
||||
>a2 : any
|
||||
>false : false
|
||||
>a3 : number
|
||||
>a3 : any
|
||||
>1 : 1
|
||||
>undefined : undefined
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ var [a0, a1]: any = undefined;
|
||||
>undefined : undefined
|
||||
|
||||
var [a2 = false, a3 = 1]: any = undefined;
|
||||
>a2 : boolean
|
||||
>a2 : any
|
||||
>false : false
|
||||
>a3 : number
|
||||
>a3 : any
|
||||
>1 : 1
|
||||
>undefined : undefined
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ var {1: b3} = { 1: "string" };
|
||||
>"string" : "string"
|
||||
|
||||
var {b4 = 1}: any = { b4: 100000 };
|
||||
>b4 : number
|
||||
>b4 : any
|
||||
>1 : 1
|
||||
>{ b4: 100000 } : { b4: number; }
|
||||
>b4 : number
|
||||
|
||||
@@ -39,7 +39,7 @@ var {1: b3} = { 1: "string" };
|
||||
>"string" : "string"
|
||||
|
||||
var {b4 = 1}: any = { b4: 100000 };
|
||||
>b4 : number
|
||||
>b4 : any
|
||||
>1 : 1
|
||||
>{ b4: 100000 } : { b4: number; }
|
||||
>b4 : number
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts ===
|
||||
const {
|
||||
a = 1,
|
||||
>a : 1
|
||||
>a : any
|
||||
>1 : 1
|
||||
|
||||
b = 2,
|
||||
>b : 2
|
||||
>b : any
|
||||
>2 : 2
|
||||
|
||||
c = b, // ok
|
||||
>c : 2
|
||||
>b : 2
|
||||
>c : any
|
||||
>b : any
|
||||
|
||||
d = a, // ok
|
||||
>d : 1
|
||||
>a : 1
|
||||
>d : any
|
||||
>a : any
|
||||
|
||||
e = f, // error
|
||||
>e : any
|
||||
|
||||
@@ -77,7 +77,7 @@ class C {
|
||||
}
|
||||
function foobar({ bar={}, ...opts }: any = {}) {
|
||||
>foobar : ({ bar, ...opts }?: any) => void
|
||||
>bar : {}
|
||||
>bar : any
|
||||
>{} : {}
|
||||
>opts : any
|
||||
>{} : {}
|
||||
|
||||
@@ -77,7 +77,7 @@ class C {
|
||||
}
|
||||
function foobar({ bar={}, ...opts }: any = {}) {
|
||||
>foobar : ({ bar, ...opts }?: any) => void
|
||||
>bar : {}
|
||||
>bar : any
|
||||
>{} : {}
|
||||
>opts : any
|
||||
>{} : {}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
tests/cases/compiler/potentiallyUncalledDecorators.ts(4,5): error TS1329: 'Input' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@Input()'?
|
||||
tests/cases/compiler/potentiallyUncalledDecorators.ts(35,1): error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'?
|
||||
tests/cases/compiler/potentiallyUncalledDecorators.ts(37,5): error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'?
|
||||
tests/cases/compiler/potentiallyUncalledDecorators.ts(38,5): error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'?
|
||||
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(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.
|
||||
Type 'OmniDecorator' is not assignable to type 'typeof C'.
|
||||
Type 'OmniDecorator' provides no match for the signature 'new (): C'.
|
||||
tests/cases/compiler/potentiallyUncalledDecorators.ts(49,5): error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'?
|
||||
tests/cases/compiler/potentiallyUncalledDecorators.ts(50,5): error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'?
|
||||
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(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(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(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>'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/potentiallyUncalledDecorators.ts (19 errors) ====
|
||||
// Angular-style Input/Output API:
|
||||
declare function Input(bindingPropertyName?: string): any;
|
||||
class FooComponent {
|
||||
@Input foo: string;
|
||||
~~~~~~
|
||||
!!! error TS1329: 'Input' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@Input()'?
|
||||
}
|
||||
|
||||
// Glimmer-style tracked API:
|
||||
declare const tracked: PropertyDecorator & { (...watchedProperties: string[]): any; }
|
||||
|
||||
class Person {
|
||||
@tracked person; any;
|
||||
}
|
||||
|
||||
class MultiplyByTwo {
|
||||
args: any;
|
||||
@tracked('args')
|
||||
get multiplied() {
|
||||
return this.args.number * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Other fun stuff.
|
||||
|
||||
interface OmniDecorator extends MethodDecorator, ClassDecorator, PropertyDecorator {
|
||||
}
|
||||
|
||||
declare function noArgs(): OmniDecorator;
|
||||
declare function allRest(...args: any[]): OmniDecorator;
|
||||
declare function oneOptional(x?: any): OmniDecorator;
|
||||
declare function twoOptional(x?: any, y?: any): OmniDecorator;
|
||||
declare function threeOptional(x?: any, y?: any, z?: any): OmniDecorator;
|
||||
declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator;
|
||||
declare const anyDec: any;
|
||||
|
||||
@noArgs
|
||||
~~~~~~~
|
||||
!!! error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'?
|
||||
class A {
|
||||
@noArgs foo: any;
|
||||
~~~~~~~
|
||||
!!! error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'?
|
||||
@noArgs bar() { }
|
||||
~~~~~~~
|
||||
!!! error TS1329: 'noArgs' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@noArgs()'?
|
||||
}
|
||||
|
||||
@allRest
|
||||
~~~~~~~~
|
||||
!!! error TS1238: Unable to resolve signature of class decorator when called as an expression.
|
||||
!!! error TS1238: Type 'OmniDecorator' is not assignable to type 'typeof B'.
|
||||
!!! error TS1238: Type 'OmniDecorator' provides no match for the signature 'new (): B'.
|
||||
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.
|
||||
@allRest bar() { }
|
||||
~~~~~~~~
|
||||
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
!!! error TS1241: Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
|
||||
}
|
||||
|
||||
@oneOptional
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1238: Unable to resolve signature of class decorator when called as an expression.
|
||||
!!! error TS1238: Type 'OmniDecorator' is not assignable to type 'typeof C'.
|
||||
!!! error TS1238: Type 'OmniDecorator' provides no match for the signature 'new (): C'.
|
||||
class C {
|
||||
@oneOptional foo: any;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'?
|
||||
@oneOptional bar() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1329: 'oneOptional' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@oneOptional()'?
|
||||
}
|
||||
|
||||
@twoOptional
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1238: Unable to resolve signature of class decorator when called as an expression.
|
||||
!!! error TS1238: Type 'OmniDecorator' is not assignable to type 'typeof D'.
|
||||
!!! error TS1238: Type 'OmniDecorator' provides no match for the signature 'new (): D'.
|
||||
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.
|
||||
@twoOptional bar() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
!!! error TS1241: Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
|
||||
}
|
||||
|
||||
@threeOptional
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1238: Unable to resolve signature of class decorator when called as an expression.
|
||||
!!! error TS1238: Type 'OmniDecorator' is not assignable to type 'typeof E'.
|
||||
!!! error TS1238: Type 'OmniDecorator' provides no match for the signature 'new (): E'.
|
||||
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.
|
||||
@threeOptional bar() { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
!!! error TS1241: Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
|
||||
}
|
||||
|
||||
@oneOptionalWithRest
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1238: Unable to resolve signature of class decorator when called as an expression.
|
||||
!!! error TS1238: Type 'OmniDecorator' is not assignable to type 'typeof F'.
|
||||
!!! error TS1238: Type 'OmniDecorator' provides no match for the signature 'new (): F'.
|
||||
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.
|
||||
@oneOptionalWithRest bar() { }
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||
!!! error TS1241: Type 'OmniDecorator' has no properties in common with type 'TypedPropertyDescriptor<() => void>'.
|
||||
}
|
||||
|
||||
@anyDec
|
||||
class G {
|
||||
@anyDec foo: any;
|
||||
@anyDec bar() { }
|
||||
}
|
||||
|
||||
export { };
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
//// [potentiallyUncalledDecorators.ts]
|
||||
// Angular-style Input/Output API:
|
||||
declare function Input(bindingPropertyName?: string): any;
|
||||
class FooComponent {
|
||||
@Input foo: string;
|
||||
}
|
||||
|
||||
// Glimmer-style tracked API:
|
||||
declare const tracked: PropertyDecorator & { (...watchedProperties: string[]): any; }
|
||||
|
||||
class Person {
|
||||
@tracked person; any;
|
||||
}
|
||||
|
||||
class MultiplyByTwo {
|
||||
args: any;
|
||||
@tracked('args')
|
||||
get multiplied() {
|
||||
return this.args.number * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Other fun stuff.
|
||||
|
||||
interface OmniDecorator extends MethodDecorator, ClassDecorator, PropertyDecorator {
|
||||
}
|
||||
|
||||
declare function noArgs(): OmniDecorator;
|
||||
declare function allRest(...args: any[]): OmniDecorator;
|
||||
declare function oneOptional(x?: any): OmniDecorator;
|
||||
declare function twoOptional(x?: any, y?: any): OmniDecorator;
|
||||
declare function threeOptional(x?: any, y?: any, z?: any): OmniDecorator;
|
||||
declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator;
|
||||
declare const anyDec: any;
|
||||
|
||||
@noArgs
|
||||
class A {
|
||||
@noArgs foo: any;
|
||||
@noArgs bar() { }
|
||||
}
|
||||
|
||||
@allRest
|
||||
class B {
|
||||
@allRest foo: any;
|
||||
@allRest bar() { }
|
||||
}
|
||||
|
||||
@oneOptional
|
||||
class C {
|
||||
@oneOptional foo: any;
|
||||
@oneOptional bar() { }
|
||||
}
|
||||
|
||||
@twoOptional
|
||||
class D {
|
||||
@twoOptional foo: any;
|
||||
@twoOptional bar() { }
|
||||
}
|
||||
|
||||
@threeOptional
|
||||
class E {
|
||||
@threeOptional foo: any;
|
||||
@threeOptional bar() { }
|
||||
}
|
||||
|
||||
@oneOptionalWithRest
|
||||
class F {
|
||||
@oneOptionalWithRest foo: any;
|
||||
@oneOptionalWithRest bar() { }
|
||||
}
|
||||
|
||||
@anyDec
|
||||
class G {
|
||||
@anyDec foo: any;
|
||||
@anyDec bar() { }
|
||||
}
|
||||
|
||||
export { };
|
||||
|
||||
|
||||
//// [potentiallyUncalledDecorators.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;
|
||||
};
|
||||
class FooComponent {
|
||||
}
|
||||
__decorate([
|
||||
Input
|
||||
], FooComponent.prototype, "foo", void 0);
|
||||
class Person {
|
||||
}
|
||||
__decorate([
|
||||
tracked
|
||||
], Person.prototype, "person", void 0);
|
||||
class MultiplyByTwo {
|
||||
get multiplied() {
|
||||
return this.args.number * 2;
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
tracked('args')
|
||||
], MultiplyByTwo.prototype, "multiplied", null);
|
||||
let A = class A {
|
||||
bar() { }
|
||||
};
|
||||
__decorate([
|
||||
noArgs
|
||||
], A.prototype, "foo", void 0);
|
||||
__decorate([
|
||||
noArgs
|
||||
], A.prototype, "bar", null);
|
||||
A = __decorate([
|
||||
noArgs
|
||||
], A);
|
||||
let B = class B {
|
||||
bar() { }
|
||||
};
|
||||
__decorate([
|
||||
allRest
|
||||
], B.prototype, "foo", void 0);
|
||||
__decorate([
|
||||
allRest
|
||||
], B.prototype, "bar", null);
|
||||
B = __decorate([
|
||||
allRest
|
||||
], B);
|
||||
let C = class C {
|
||||
bar() { }
|
||||
};
|
||||
__decorate([
|
||||
oneOptional
|
||||
], C.prototype, "foo", void 0);
|
||||
__decorate([
|
||||
oneOptional
|
||||
], C.prototype, "bar", null);
|
||||
C = __decorate([
|
||||
oneOptional
|
||||
], C);
|
||||
let D = class D {
|
||||
bar() { }
|
||||
};
|
||||
__decorate([
|
||||
twoOptional
|
||||
], D.prototype, "foo", void 0);
|
||||
__decorate([
|
||||
twoOptional
|
||||
], D.prototype, "bar", null);
|
||||
D = __decorate([
|
||||
twoOptional
|
||||
], D);
|
||||
let E = class E {
|
||||
bar() { }
|
||||
};
|
||||
__decorate([
|
||||
threeOptional
|
||||
], E.prototype, "foo", void 0);
|
||||
__decorate([
|
||||
threeOptional
|
||||
], E.prototype, "bar", null);
|
||||
E = __decorate([
|
||||
threeOptional
|
||||
], E);
|
||||
let F = class F {
|
||||
bar() { }
|
||||
};
|
||||
__decorate([
|
||||
oneOptionalWithRest
|
||||
], F.prototype, "foo", void 0);
|
||||
__decorate([
|
||||
oneOptionalWithRest
|
||||
], F.prototype, "bar", null);
|
||||
F = __decorate([
|
||||
oneOptionalWithRest
|
||||
], F);
|
||||
let G = class G {
|
||||
bar() { }
|
||||
};
|
||||
__decorate([
|
||||
anyDec
|
||||
], G.prototype, "foo", void 0);
|
||||
__decorate([
|
||||
anyDec
|
||||
], G.prototype, "bar", null);
|
||||
G = __decorate([
|
||||
anyDec
|
||||
], G);
|
||||
@@ -0,0 +1,200 @@
|
||||
=== tests/cases/compiler/potentiallyUncalledDecorators.ts ===
|
||||
// Angular-style Input/Output API:
|
||||
declare function Input(bindingPropertyName?: string): any;
|
||||
>Input : Symbol(Input, Decl(potentiallyUncalledDecorators.ts, 0, 0))
|
||||
>bindingPropertyName : Symbol(bindingPropertyName, Decl(potentiallyUncalledDecorators.ts, 1, 23))
|
||||
|
||||
class FooComponent {
|
||||
>FooComponent : Symbol(FooComponent, Decl(potentiallyUncalledDecorators.ts, 1, 58))
|
||||
|
||||
@Input foo: string;
|
||||
>Input : Symbol(Input, Decl(potentiallyUncalledDecorators.ts, 0, 0))
|
||||
>foo : Symbol(FooComponent.foo, Decl(potentiallyUncalledDecorators.ts, 2, 20))
|
||||
}
|
||||
|
||||
// Glimmer-style tracked API:
|
||||
declare const tracked: PropertyDecorator & { (...watchedProperties: string[]): any; }
|
||||
>tracked : Symbol(tracked, Decl(potentiallyUncalledDecorators.ts, 7, 13))
|
||||
>PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.es5.d.ts, --, --))
|
||||
>watchedProperties : Symbol(watchedProperties, Decl(potentiallyUncalledDecorators.ts, 7, 46))
|
||||
|
||||
class Person {
|
||||
>Person : Symbol(Person, Decl(potentiallyUncalledDecorators.ts, 7, 85))
|
||||
|
||||
@tracked person; any;
|
||||
>tracked : Symbol(tracked, Decl(potentiallyUncalledDecorators.ts, 7, 13))
|
||||
>person : Symbol(Person.person, Decl(potentiallyUncalledDecorators.ts, 9, 14))
|
||||
>any : Symbol(Person.any, Decl(potentiallyUncalledDecorators.ts, 10, 20))
|
||||
}
|
||||
|
||||
class MultiplyByTwo {
|
||||
>MultiplyByTwo : Symbol(MultiplyByTwo, Decl(potentiallyUncalledDecorators.ts, 11, 1))
|
||||
|
||||
args: any;
|
||||
>args : Symbol(MultiplyByTwo.args, Decl(potentiallyUncalledDecorators.ts, 13, 21))
|
||||
|
||||
@tracked('args')
|
||||
>tracked : Symbol(tracked, Decl(potentiallyUncalledDecorators.ts, 7, 13))
|
||||
|
||||
get multiplied() {
|
||||
>multiplied : Symbol(MultiplyByTwo.multiplied, Decl(potentiallyUncalledDecorators.ts, 14, 14))
|
||||
|
||||
return this.args.number * 2;
|
||||
>this.args : Symbol(MultiplyByTwo.args, Decl(potentiallyUncalledDecorators.ts, 13, 21))
|
||||
>this : Symbol(MultiplyByTwo, Decl(potentiallyUncalledDecorators.ts, 11, 1))
|
||||
>args : Symbol(MultiplyByTwo.args, Decl(potentiallyUncalledDecorators.ts, 13, 21))
|
||||
}
|
||||
}
|
||||
|
||||
// Other fun stuff.
|
||||
|
||||
interface OmniDecorator extends MethodDecorator, ClassDecorator, PropertyDecorator {
|
||||
>OmniDecorator : Symbol(OmniDecorator, Decl(potentiallyUncalledDecorators.ts, 19, 1))
|
||||
>MethodDecorator : Symbol(MethodDecorator, Decl(lib.es5.d.ts, --, --))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --))
|
||||
>PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.es5.d.ts, --, --))
|
||||
}
|
||||
|
||||
declare function noArgs(): OmniDecorator;
|
||||
>noArgs : Symbol(noArgs, Decl(potentiallyUncalledDecorators.ts, 24, 1))
|
||||
>OmniDecorator : Symbol(OmniDecorator, Decl(potentiallyUncalledDecorators.ts, 19, 1))
|
||||
|
||||
declare function allRest(...args: any[]): OmniDecorator;
|
||||
>allRest : Symbol(allRest, Decl(potentiallyUncalledDecorators.ts, 26, 41))
|
||||
>args : Symbol(args, Decl(potentiallyUncalledDecorators.ts, 27, 25))
|
||||
>OmniDecorator : Symbol(OmniDecorator, Decl(potentiallyUncalledDecorators.ts, 19, 1))
|
||||
|
||||
declare function oneOptional(x?: any): OmniDecorator;
|
||||
>oneOptional : Symbol(oneOptional, Decl(potentiallyUncalledDecorators.ts, 27, 56))
|
||||
>x : Symbol(x, Decl(potentiallyUncalledDecorators.ts, 28, 29))
|
||||
>OmniDecorator : Symbol(OmniDecorator, Decl(potentiallyUncalledDecorators.ts, 19, 1))
|
||||
|
||||
declare function twoOptional(x?: any, y?: any): OmniDecorator;
|
||||
>twoOptional : Symbol(twoOptional, Decl(potentiallyUncalledDecorators.ts, 28, 53))
|
||||
>x : Symbol(x, Decl(potentiallyUncalledDecorators.ts, 29, 29))
|
||||
>y : Symbol(y, Decl(potentiallyUncalledDecorators.ts, 29, 37))
|
||||
>OmniDecorator : Symbol(OmniDecorator, Decl(potentiallyUncalledDecorators.ts, 19, 1))
|
||||
|
||||
declare function threeOptional(x?: any, y?: any, z?: any): OmniDecorator;
|
||||
>threeOptional : Symbol(threeOptional, Decl(potentiallyUncalledDecorators.ts, 29, 62))
|
||||
>x : Symbol(x, Decl(potentiallyUncalledDecorators.ts, 30, 31))
|
||||
>y : Symbol(y, Decl(potentiallyUncalledDecorators.ts, 30, 39))
|
||||
>z : Symbol(z, Decl(potentiallyUncalledDecorators.ts, 30, 48))
|
||||
>OmniDecorator : Symbol(OmniDecorator, Decl(potentiallyUncalledDecorators.ts, 19, 1))
|
||||
|
||||
declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator;
|
||||
>oneOptionalWithRest : Symbol(oneOptionalWithRest, Decl(potentiallyUncalledDecorators.ts, 30, 73))
|
||||
>x : Symbol(x, Decl(potentiallyUncalledDecorators.ts, 31, 37))
|
||||
>args : Symbol(args, Decl(potentiallyUncalledDecorators.ts, 31, 45))
|
||||
>OmniDecorator : Symbol(OmniDecorator, Decl(potentiallyUncalledDecorators.ts, 19, 1))
|
||||
|
||||
declare const anyDec: any;
|
||||
>anyDec : Symbol(anyDec, Decl(potentiallyUncalledDecorators.ts, 32, 13))
|
||||
|
||||
@noArgs
|
||||
>noArgs : Symbol(noArgs, Decl(potentiallyUncalledDecorators.ts, 24, 1))
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(potentiallyUncalledDecorators.ts, 32, 26))
|
||||
|
||||
@noArgs foo: any;
|
||||
>noArgs : Symbol(noArgs, Decl(potentiallyUncalledDecorators.ts, 24, 1))
|
||||
>foo : Symbol(A.foo, Decl(potentiallyUncalledDecorators.ts, 35, 9))
|
||||
|
||||
@noArgs bar() { }
|
||||
>noArgs : Symbol(noArgs, Decl(potentiallyUncalledDecorators.ts, 24, 1))
|
||||
>bar : Symbol(A.bar, Decl(potentiallyUncalledDecorators.ts, 36, 21))
|
||||
}
|
||||
|
||||
@allRest
|
||||
>allRest : Symbol(allRest, Decl(potentiallyUncalledDecorators.ts, 26, 41))
|
||||
|
||||
class B {
|
||||
>B : Symbol(B, Decl(potentiallyUncalledDecorators.ts, 38, 1))
|
||||
|
||||
@allRest foo: any;
|
||||
>allRest : Symbol(allRest, Decl(potentiallyUncalledDecorators.ts, 26, 41))
|
||||
>foo : Symbol(B.foo, Decl(potentiallyUncalledDecorators.ts, 41, 9))
|
||||
|
||||
@allRest bar() { }
|
||||
>allRest : Symbol(allRest, Decl(potentiallyUncalledDecorators.ts, 26, 41))
|
||||
>bar : Symbol(B.bar, Decl(potentiallyUncalledDecorators.ts, 42, 22))
|
||||
}
|
||||
|
||||
@oneOptional
|
||||
>oneOptional : Symbol(oneOptional, Decl(potentiallyUncalledDecorators.ts, 27, 56))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(potentiallyUncalledDecorators.ts, 44, 1))
|
||||
|
||||
@oneOptional foo: any;
|
||||
>oneOptional : Symbol(oneOptional, Decl(potentiallyUncalledDecorators.ts, 27, 56))
|
||||
>foo : Symbol(C.foo, Decl(potentiallyUncalledDecorators.ts, 47, 9))
|
||||
|
||||
@oneOptional bar() { }
|
||||
>oneOptional : Symbol(oneOptional, Decl(potentiallyUncalledDecorators.ts, 27, 56))
|
||||
>bar : Symbol(C.bar, Decl(potentiallyUncalledDecorators.ts, 48, 26))
|
||||
}
|
||||
|
||||
@twoOptional
|
||||
>twoOptional : Symbol(twoOptional, Decl(potentiallyUncalledDecorators.ts, 28, 53))
|
||||
|
||||
class D {
|
||||
>D : Symbol(D, Decl(potentiallyUncalledDecorators.ts, 50, 1))
|
||||
|
||||
@twoOptional foo: any;
|
||||
>twoOptional : Symbol(twoOptional, Decl(potentiallyUncalledDecorators.ts, 28, 53))
|
||||
>foo : Symbol(D.foo, Decl(potentiallyUncalledDecorators.ts, 53, 9))
|
||||
|
||||
@twoOptional bar() { }
|
||||
>twoOptional : Symbol(twoOptional, Decl(potentiallyUncalledDecorators.ts, 28, 53))
|
||||
>bar : Symbol(D.bar, Decl(potentiallyUncalledDecorators.ts, 54, 26))
|
||||
}
|
||||
|
||||
@threeOptional
|
||||
>threeOptional : Symbol(threeOptional, Decl(potentiallyUncalledDecorators.ts, 29, 62))
|
||||
|
||||
class E {
|
||||
>E : Symbol(E, Decl(potentiallyUncalledDecorators.ts, 56, 1))
|
||||
|
||||
@threeOptional foo: any;
|
||||
>threeOptional : Symbol(threeOptional, Decl(potentiallyUncalledDecorators.ts, 29, 62))
|
||||
>foo : Symbol(E.foo, Decl(potentiallyUncalledDecorators.ts, 59, 9))
|
||||
|
||||
@threeOptional bar() { }
|
||||
>threeOptional : Symbol(threeOptional, Decl(potentiallyUncalledDecorators.ts, 29, 62))
|
||||
>bar : Symbol(E.bar, Decl(potentiallyUncalledDecorators.ts, 60, 28))
|
||||
}
|
||||
|
||||
@oneOptionalWithRest
|
||||
>oneOptionalWithRest : Symbol(oneOptionalWithRest, Decl(potentiallyUncalledDecorators.ts, 30, 73))
|
||||
|
||||
class F {
|
||||
>F : Symbol(F, Decl(potentiallyUncalledDecorators.ts, 62, 1))
|
||||
|
||||
@oneOptionalWithRest foo: any;
|
||||
>oneOptionalWithRest : Symbol(oneOptionalWithRest, Decl(potentiallyUncalledDecorators.ts, 30, 73))
|
||||
>foo : Symbol(F.foo, Decl(potentiallyUncalledDecorators.ts, 65, 9))
|
||||
|
||||
@oneOptionalWithRest bar() { }
|
||||
>oneOptionalWithRest : Symbol(oneOptionalWithRest, Decl(potentiallyUncalledDecorators.ts, 30, 73))
|
||||
>bar : Symbol(F.bar, Decl(potentiallyUncalledDecorators.ts, 66, 34))
|
||||
}
|
||||
|
||||
@anyDec
|
||||
>anyDec : Symbol(anyDec, Decl(potentiallyUncalledDecorators.ts, 32, 13))
|
||||
|
||||
class G {
|
||||
>G : Symbol(G, Decl(potentiallyUncalledDecorators.ts, 68, 1))
|
||||
|
||||
@anyDec foo: any;
|
||||
>anyDec : Symbol(anyDec, Decl(potentiallyUncalledDecorators.ts, 32, 13))
|
||||
>foo : Symbol(G.foo, Decl(potentiallyUncalledDecorators.ts, 71, 9))
|
||||
|
||||
@anyDec bar() { }
|
||||
>anyDec : Symbol(anyDec, Decl(potentiallyUncalledDecorators.ts, 32, 13))
|
||||
>bar : Symbol(G.bar, Decl(potentiallyUncalledDecorators.ts, 72, 21))
|
||||
}
|
||||
|
||||
export { };
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
=== tests/cases/compiler/potentiallyUncalledDecorators.ts ===
|
||||
// Angular-style Input/Output API:
|
||||
declare function Input(bindingPropertyName?: string): any;
|
||||
>Input : (bindingPropertyName?: string) => any
|
||||
>bindingPropertyName : string
|
||||
|
||||
class FooComponent {
|
||||
>FooComponent : FooComponent
|
||||
|
||||
@Input foo: string;
|
||||
>Input : (bindingPropertyName?: string) => any
|
||||
>foo : string
|
||||
}
|
||||
|
||||
// Glimmer-style tracked API:
|
||||
declare const tracked: PropertyDecorator & { (...watchedProperties: string[]): any; }
|
||||
>tracked : PropertyDecorator & ((...watchedProperties: string[]) => any)
|
||||
>PropertyDecorator : PropertyDecorator
|
||||
>watchedProperties : string[]
|
||||
|
||||
class Person {
|
||||
>Person : Person
|
||||
|
||||
@tracked person; any;
|
||||
>tracked : PropertyDecorator & ((...watchedProperties: string[]) => any)
|
||||
>person : any
|
||||
>any : any
|
||||
}
|
||||
|
||||
class MultiplyByTwo {
|
||||
>MultiplyByTwo : MultiplyByTwo
|
||||
|
||||
args: any;
|
||||
>args : any
|
||||
|
||||
@tracked('args')
|
||||
>tracked('args') : any
|
||||
>tracked : PropertyDecorator & ((...watchedProperties: string[]) => any)
|
||||
>'args' : "args"
|
||||
|
||||
get multiplied() {
|
||||
>multiplied : number
|
||||
|
||||
return this.args.number * 2;
|
||||
>this.args.number * 2 : number
|
||||
>this.args.number : any
|
||||
>this.args : any
|
||||
>this : this
|
||||
>args : any
|
||||
>number : any
|
||||
>2 : 2
|
||||
}
|
||||
}
|
||||
|
||||
// Other fun stuff.
|
||||
|
||||
interface OmniDecorator extends MethodDecorator, ClassDecorator, PropertyDecorator {
|
||||
>OmniDecorator : OmniDecorator
|
||||
>MethodDecorator : MethodDecorator
|
||||
>ClassDecorator : ClassDecorator
|
||||
>PropertyDecorator : PropertyDecorator
|
||||
}
|
||||
|
||||
declare function noArgs(): OmniDecorator;
|
||||
>noArgs : () => OmniDecorator
|
||||
>OmniDecorator : OmniDecorator
|
||||
|
||||
declare function allRest(...args: any[]): OmniDecorator;
|
||||
>allRest : (...args: any[]) => OmniDecorator
|
||||
>args : any[]
|
||||
>OmniDecorator : OmniDecorator
|
||||
|
||||
declare function oneOptional(x?: any): OmniDecorator;
|
||||
>oneOptional : (x?: any) => OmniDecorator
|
||||
>x : any
|
||||
>OmniDecorator : OmniDecorator
|
||||
|
||||
declare function twoOptional(x?: any, y?: any): OmniDecorator;
|
||||
>twoOptional : (x?: any, y?: any) => OmniDecorator
|
||||
>x : any
|
||||
>y : any
|
||||
>OmniDecorator : OmniDecorator
|
||||
|
||||
declare function threeOptional(x?: any, y?: any, z?: any): OmniDecorator;
|
||||
>threeOptional : (x?: any, y?: any, z?: any) => OmniDecorator
|
||||
>x : any
|
||||
>y : any
|
||||
>z : any
|
||||
>OmniDecorator : OmniDecorator
|
||||
|
||||
declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator;
|
||||
>oneOptionalWithRest : (x?: any, ...args: any[]) => OmniDecorator
|
||||
>x : any
|
||||
>args : any[]
|
||||
>OmniDecorator : OmniDecorator
|
||||
|
||||
declare const anyDec: any;
|
||||
>anyDec : any
|
||||
|
||||
@noArgs
|
||||
>noArgs : () => OmniDecorator
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
@noArgs foo: any;
|
||||
>noArgs : () => OmniDecorator
|
||||
>foo : any
|
||||
|
||||
@noArgs bar() { }
|
||||
>noArgs : () => OmniDecorator
|
||||
>bar : () => void
|
||||
}
|
||||
|
||||
@allRest
|
||||
>allRest : (...args: any[]) => OmniDecorator
|
||||
|
||||
class B {
|
||||
>B : B
|
||||
|
||||
@allRest foo: any;
|
||||
>allRest : (...args: any[]) => OmniDecorator
|
||||
>foo : any
|
||||
|
||||
@allRest bar() { }
|
||||
>allRest : (...args: any[]) => OmniDecorator
|
||||
>bar : () => void
|
||||
}
|
||||
|
||||
@oneOptional
|
||||
>oneOptional : (x?: any) => OmniDecorator
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@oneOptional foo: any;
|
||||
>oneOptional : (x?: any) => OmniDecorator
|
||||
>foo : any
|
||||
|
||||
@oneOptional bar() { }
|
||||
>oneOptional : (x?: any) => OmniDecorator
|
||||
>bar : () => void
|
||||
}
|
||||
|
||||
@twoOptional
|
||||
>twoOptional : (x?: any, y?: any) => OmniDecorator
|
||||
|
||||
class D {
|
||||
>D : D
|
||||
|
||||
@twoOptional foo: any;
|
||||
>twoOptional : (x?: any, y?: any) => OmniDecorator
|
||||
>foo : any
|
||||
|
||||
@twoOptional bar() { }
|
||||
>twoOptional : (x?: any, y?: any) => OmniDecorator
|
||||
>bar : () => void
|
||||
}
|
||||
|
||||
@threeOptional
|
||||
>threeOptional : (x?: any, y?: any, z?: any) => OmniDecorator
|
||||
|
||||
class E {
|
||||
>E : E
|
||||
|
||||
@threeOptional foo: any;
|
||||
>threeOptional : (x?: any, y?: any, z?: any) => OmniDecorator
|
||||
>foo : any
|
||||
|
||||
@threeOptional bar() { }
|
||||
>threeOptional : (x?: any, y?: any, z?: any) => OmniDecorator
|
||||
>bar : () => void
|
||||
}
|
||||
|
||||
@oneOptionalWithRest
|
||||
>oneOptionalWithRest : (x?: any, ...args: any[]) => OmniDecorator
|
||||
|
||||
class F {
|
||||
>F : F
|
||||
|
||||
@oneOptionalWithRest foo: any;
|
||||
>oneOptionalWithRest : (x?: any, ...args: any[]) => OmniDecorator
|
||||
>foo : any
|
||||
|
||||
@oneOptionalWithRest bar() { }
|
||||
>oneOptionalWithRest : (x?: any, ...args: any[]) => OmniDecorator
|
||||
>bar : () => void
|
||||
}
|
||||
|
||||
@anyDec
|
||||
>anyDec : any
|
||||
|
||||
class G {
|
||||
>G : G
|
||||
|
||||
@anyDec foo: any;
|
||||
>anyDec : any
|
||||
>foo : any
|
||||
|
||||
@anyDec bar() { }
|
||||
>anyDec : any
|
||||
>bar : () => void
|
||||
}
|
||||
|
||||
export { };
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(2,41): error TS1005: 'symbol' expected.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(3,19): error TS1337: 'unique symbol' types may not be used on a variable declaration with a binding name.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(4,13): error TS1336: A variable whose type is a 'unique symbol' type must be 'const'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(5,13): error TS1336: A variable whose type is a 'unique symbol' type must be 'const'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(8,38): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(9,46): error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(10,39): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(11,40): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(12,53): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(13,59): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(14,50): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(18,44): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(20,14): error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(21,5): error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(22,25): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(23,34): error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(24,26): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(25,27): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(26,40): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(27,46): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(28,37): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(29,26): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(30,28): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(32,12): error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(33,38): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(34,47): error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(35,39): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(36,40): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(37,53): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(38,59): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(39,50): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(40,39): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(41,41): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(46,5): error TS1334: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(47,25): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(48,34): error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(49,26): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(50,27): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(51,40): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(52,46): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(53,37): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(58,5): error TS1334: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(59,25): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(60,34): error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(61,26): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(62,27): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(63,40): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(64,46): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(65,37): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(69,21): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(70,52): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(71,49): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(74,44): error TS1339: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(75,34): error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(76,34): error TS1332: 'unique symbol' types are not allowed in a tuple type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(79,51): error TS1333: 'unique symbol' types are not allowed in a mapped type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,29): error TS1329: 'unique symbol' types are not allowed in a union type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,45): error TS1329: 'unique symbol' types are not allowed in a union type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,36): error TS1329: 'unique symbol' types are not allowed in a union type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,52): error TS1329: 'unique symbol' types are not allowed in a union type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(3,19): error TS1338: 'unique symbol' types may not be used on a variable declaration with a binding name.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(4,13): error TS1337: A variable whose type is a 'unique symbol' type must be 'const'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(5,13): error TS1337: A variable whose type is a 'unique symbol' type must be 'const'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(8,38): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(9,46): error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(10,39): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(11,40): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(12,53): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(13,59): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(14,50): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(18,44): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(20,14): error TS1336: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(21,5): error TS1336: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(22,25): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(23,34): error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(24,26): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(25,27): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(26,40): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(27,46): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(28,37): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(29,26): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(30,28): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(32,12): error TS1336: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(33,38): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(34,47): error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(35,39): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(36,40): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(37,53): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(38,59): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(39,50): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(40,39): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(41,41): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(46,5): error TS1335: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(47,25): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(48,34): error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(49,26): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(50,27): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(51,40): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(52,46): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(53,37): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(58,5): error TS1335: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(59,25): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(60,34): error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(61,26): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(62,27): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(63,40): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(64,46): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(65,37): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(69,21): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(70,52): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(71,49): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(74,44): error TS1340: 'unique symbol' types are not allowed here.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(75,34): error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(76,34): error TS1333: 'unique symbol' types are not allowed in a tuple type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(79,51): error TS1334: 'unique symbol' types are not allowed in a mapped type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,29): error TS1330: 'unique symbol' types are not allowed in a union type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,45): error TS1330: 'unique symbol' types are not allowed in a union type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,36): error TS1330: 'unique symbol' types are not allowed in a union type.
|
||||
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,52): error TS1330: 'unique symbol' types are not allowed in a union type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts (60 errors) ====
|
||||
@@ -67,203 +67,203 @@ tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,52): error
|
||||
!!! error TS1005: 'symbol' expected.
|
||||
declare const {}: unique symbol;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1337: 'unique symbol' types may not be used on a variable declaration with a binding name.
|
||||
!!! error TS1338: 'unique symbol' types may not be used on a variable declaration with a binding name.
|
||||
declare let invalidLetType: unique symbol;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1336: A variable whose type is a 'unique symbol' type must be 'const'.
|
||||
!!! error TS1337: A variable whose type is a 'unique symbol' type must be 'const'.
|
||||
declare var invalidVarType: unique symbol;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1336: A variable whose type is a 'unique symbol' type must be 'const'.
|
||||
!!! error TS1337: A variable whose type is a 'unique symbol' type must be 'const'.
|
||||
|
||||
// function arguments and return types
|
||||
declare function invalidArgType(arg: unique symbol): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
declare function invalidRestArgType(...arg: (unique symbol)[]): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
!!! error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
declare function invalidReturnType(): unique symbol;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
declare function invalidThisType(this: unique symbol): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
declare function invalidTypePredicate(n: any): n is unique symbol;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
declare function invalidTypeParameterConstraint<T extends unique symbol>(): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
declare function invalidTypeParameterDefault<T = unique symbol>(): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
|
||||
// classes
|
||||
class InvalidClass {
|
||||
constructor(invalidConstructorArgType: unique symbol) {}
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
|
||||
readonly invalidReadonlyPropertyType: unique symbol;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
!!! error TS1336: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
invalidPropertyType: unique symbol;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
!!! error TS1336: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
invalidArgType(arg: unique symbol): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidRestArgType(...args: (unique symbol)[]): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
!!! error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
invalidReturnType(): unique symbol { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidThisType(this: unique symbol): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidTypePredicate(n: any): n is unique symbol { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidTypeParameterConstraint<T extends unique symbol>(): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidTypeParameterDefault<T = unique symbol>(): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
get invalidGetter(): unique symbol { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
set invalidSetter(arg: unique symbol) { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
|
||||
static invalidStaticPropertyType: unique symbol;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1335: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
!!! error TS1336: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.
|
||||
static invalidStaticArgType(arg: unique symbol): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
!!! error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
static invalidStaticReturnType(): unique symbol { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
static invalidStaticThisType(this: unique symbol): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
static invalidStaticTypePredicate(n: any): n is unique symbol { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
static invalidStaticTypeParameterConstraint<T extends unique symbol>(): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
static invalidStaticTypeParameterDefault<T = unique symbol>(): void { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
static get invalidStaticGetter(): unique symbol { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
static set invalidStaticSetter(arg: unique symbol) { return; }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
}
|
||||
|
||||
// interfaces
|
||||
interface InvalidInterface {
|
||||
invalidPropertyType: unique symbol;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1334: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
|
||||
!!! error TS1335: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
|
||||
invalidArgType(arg: unique symbol): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidRestArgType(...args: (unique symbol)[]): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
!!! error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
invalidReturnType(): unique symbol;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidThisType(this: unique symbol);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidTypePredicate(n: any): n is unique symbol
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidTypeParameterConstraint<T extends unique symbol>(): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidTypeParameterDefault<T = unique symbol>(): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
}
|
||||
|
||||
// type literals
|
||||
type InvalidTypeLiteral = {
|
||||
invalidPropertyType: unique symbol;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1334: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
|
||||
!!! error TS1335: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.
|
||||
invalidArgType(arg: unique symbol): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidRestArgType(...args: (unique symbol)[]): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
!!! error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
invalidReturnType(): unique symbol;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidThisType(this: unique symbol);
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidTypePredicate(n: any): n is unique symbol
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidTypeParameterConstraint<T extends unique symbol>(): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
invalidTypeParameterDefault<T = unique symbol>(): void;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
};
|
||||
|
||||
// type alias
|
||||
type InvalidAlias = unique symbol;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
type InvalidAliasTypeParameterConstraint<T extends unique symbol> = never;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
type InvalidAliasTypeParameterDefault<T extends unique symbol> = never;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
|
||||
// type references
|
||||
declare const invalidTypeArgument: Promise<unique symbol>;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1339: 'unique symbol' types are not allowed here.
|
||||
!!! error TS1340: 'unique symbol' types are not allowed here.
|
||||
declare const invalidArrayType: (unique symbol)[];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1331: 'unique symbol' types are not allowed in an array type.
|
||||
!!! error TS1332: 'unique symbol' types are not allowed in an array type.
|
||||
declare const invalidTupleType: [unique symbol];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1332: 'unique symbol' types are not allowed in a tuple type.
|
||||
!!! error TS1333: 'unique symbol' types are not allowed in a tuple type.
|
||||
|
||||
// mapped types
|
||||
declare const invalidMappedType: { [P in string]: unique symbol };
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1333: 'unique symbol' types are not allowed in a mapped type.
|
||||
!!! error TS1334: 'unique symbol' types are not allowed in a mapped type.
|
||||
|
||||
// unions/intersection
|
||||
declare const invalidUnion: unique symbol | unique symbol;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1329: 'unique symbol' types are not allowed in a union type.
|
||||
!!! error TS1330: 'unique symbol' types are not allowed in a union type.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1329: 'unique symbol' types are not allowed in a union type.
|
||||
!!! error TS1330: 'unique symbol' types are not allowed in a union type.
|
||||
declare const invalidIntersection: unique symbol | unique symbol;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1329: 'unique symbol' types are not allowed in a union type.
|
||||
!!! error TS1330: 'unique symbol' types are not allowed in a union type.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1329: 'unique symbol' types are not allowed in a union type.
|
||||
!!! error TS1330: 'unique symbol' types are not allowed in a union type.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// @target: esnext
|
||||
// @module: esnext
|
||||
// @experimentalDecorators: true
|
||||
|
||||
// Angular-style Input/Output API:
|
||||
declare function Input(bindingPropertyName?: string): any;
|
||||
class FooComponent {
|
||||
@Input foo: string;
|
||||
}
|
||||
|
||||
// Glimmer-style tracked API:
|
||||
declare const tracked: PropertyDecorator & { (...watchedProperties: string[]): any; }
|
||||
|
||||
class Person {
|
||||
@tracked person; any;
|
||||
}
|
||||
|
||||
class MultiplyByTwo {
|
||||
args: any;
|
||||
@tracked('args')
|
||||
get multiplied() {
|
||||
return this.args.number * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Other fun stuff.
|
||||
|
||||
interface OmniDecorator extends MethodDecorator, ClassDecorator, PropertyDecorator {
|
||||
}
|
||||
|
||||
declare function noArgs(): OmniDecorator;
|
||||
declare function allRest(...args: any[]): OmniDecorator;
|
||||
declare function oneOptional(x?: any): OmniDecorator;
|
||||
declare function twoOptional(x?: any, y?: any): OmniDecorator;
|
||||
declare function threeOptional(x?: any, y?: any, z?: any): OmniDecorator;
|
||||
declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator;
|
||||
declare const anyDec: any;
|
||||
|
||||
@noArgs
|
||||
class A {
|
||||
@noArgs foo: any;
|
||||
@noArgs bar() { }
|
||||
}
|
||||
|
||||
@allRest
|
||||
class B {
|
||||
@allRest foo: any;
|
||||
@allRest bar() { }
|
||||
}
|
||||
|
||||
@oneOptional
|
||||
class C {
|
||||
@oneOptional foo: any;
|
||||
@oneOptional bar() { }
|
||||
}
|
||||
|
||||
@twoOptional
|
||||
class D {
|
||||
@twoOptional foo: any;
|
||||
@twoOptional bar() { }
|
||||
}
|
||||
|
||||
@threeOptional
|
||||
class E {
|
||||
@threeOptional foo: any;
|
||||
@threeOptional bar() { }
|
||||
}
|
||||
|
||||
@oneOptionalWithRest
|
||||
class F {
|
||||
@oneOptionalWithRest foo: any;
|
||||
@oneOptionalWithRest bar() { }
|
||||
}
|
||||
|
||||
@anyDec
|
||||
class G {
|
||||
@anyDec foo: any;
|
||||
@anyDec bar() { }
|
||||
}
|
||||
|
||||
export { };
|
||||
Reference in New Issue
Block a user