mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Remove apparent type of primitives from errors
And accept baselines
This commit is contained in:
parent
57f1844e08
commit
c82fe86315
@ -376,6 +376,14 @@ namespace ts {
|
||||
return node.kind === SyntaxKind.SourceFile && !isExternalOrCommonJsModule(<SourceFile>node);
|
||||
}
|
||||
|
||||
/** Is this type one of the apparent types created from the primitive types. */
|
||||
function isPrimitiveApparentType(type: Type): boolean {
|
||||
return type === globalStringType ||
|
||||
type === globalNumberType ||
|
||||
type === globalBooleanType ||
|
||||
type === globalESSymbolType;
|
||||
}
|
||||
|
||||
function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol {
|
||||
if (meaning && hasProperty(symbols, name)) {
|
||||
const symbol = symbols[name];
|
||||
@ -5441,7 +5449,6 @@ namespace ts {
|
||||
if (!t.hasStringLiterals || target.flags & TypeFlags.FromSignature) {
|
||||
// Only elaborate errors from the first failure
|
||||
let shouldElaborateErrors = reportErrors;
|
||||
const checkedAbstractAssignability = false;
|
||||
for (const s of sourceSignatures) {
|
||||
if (!s.hasStringLiterals || source.flags & TypeFlags.FromSignature) {
|
||||
const related = signatureRelatedTo(s, t, shouldElaborateErrors);
|
||||
@ -5453,7 +5460,7 @@ namespace ts {
|
||||
shouldElaborateErrors = false;
|
||||
}
|
||||
}
|
||||
if (shouldElaborateErrors) {
|
||||
if (shouldElaborateErrors && !isPrimitiveApparentType(source)) {
|
||||
reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1,
|
||||
typeToString(source),
|
||||
signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind));
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
tests/cases/compiler/assignToFn.ts(8,5): error TS2322: Type 'string' is not assignable to type '(n: number) => boolean'.
|
||||
Type 'String' provides no match for the signature '(n: number): boolean'
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignToFn.ts (1 errors) ====
|
||||
@ -13,6 +12,5 @@ tests/cases/compiler/assignToFn.ts(8,5): error TS2322: Type 'string' is not assi
|
||||
x.f="hello";
|
||||
~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '(n: number) => boolean'.
|
||||
!!! error TS2322: Type 'String' provides no match for the signature '(n: number): boolean'
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentToObject.ts(3,5): error TS2322: Type '{ toString: number; }' is not assignable to type 'Object'.
|
||||
Types of property 'toString' are incompatible.
|
||||
Type 'number' is not assignable to type '() => string'.
|
||||
Type 'Number' provides no match for the signature '(): string'
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentToObject.ts (1 errors) ====
|
||||
@ -12,5 +11,4 @@ tests/cases/compiler/assignmentToObject.ts(3,5): error TS2322: Type '{ toString:
|
||||
!!! error TS2322: Type '{ toString: number; }' is not assignable to type 'Object'.
|
||||
!!! error TS2322: Types of property 'toString' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '() => string'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(): string'
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
tests/cases/compiler/assignmentToObjectAndFunction.ts(1,5): error TS2322: Type '{ toString: number; }' is not assignable to type 'Object'.
|
||||
Types of property 'toString' are incompatible.
|
||||
Type 'number' is not assignable to type '() => string'.
|
||||
Type 'Number' provides no match for the signature '(): string'
|
||||
tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2322: Type '{}' is not assignable to type 'Function'.
|
||||
Property 'apply' is missing in type '{}'.
|
||||
tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type 'typeof bad' is not assignable to type 'Function'.
|
||||
Types of property 'apply' are incompatible.
|
||||
Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'.
|
||||
Type 'Number' provides no match for the signature '(thisArg: any, argArray?: any): any'
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentToObjectAndFunction.ts (3 errors) ====
|
||||
@ -16,7 +14,6 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type
|
||||
!!! error TS2322: Type '{ toString: number; }' is not assignable to type 'Object'.
|
||||
!!! error TS2322: Types of property 'toString' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '() => string'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(): string'
|
||||
var goodObj: Object = {
|
||||
toString(x?) {
|
||||
return "";
|
||||
@ -51,5 +48,4 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type 'typeof bad' is not assignable to type 'Function'.
|
||||
!!! error TS2322: Types of property 'apply' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(thisArg: any, argArray?: any): any'
|
||||
!!! error TS2322: Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'.
|
||||
@ -1,7 +1,6 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(7,1): error TS2322: Type 'typeof A' is not assignable to type 'new () => A'.
|
||||
Cannot assign an abstract constructor type to a non-abstract constructor type.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts(8,1): error TS2322: Type 'string' is not assignable to type 'new () => A'.
|
||||
Type 'String' provides no match for the signature 'new (): A'
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts (2 errors) ====
|
||||
@ -17,5 +16,4 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
|
||||
!!! error TS2322: Cannot assign an abstract constructor type to a non-abstract constructor type.
|
||||
AAA = "asdf";
|
||||
~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'new () => A'.
|
||||
!!! error TS2322: Type 'String' provides no match for the signature 'new (): A'
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'new () => A'.
|
||||
@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'.
|
||||
Types of parameters 'a' and 'a' are incompatible.
|
||||
Type 'string' is not assignable to type '{ (): number; (i: number): number; }'.
|
||||
Type 'String' provides no match for the signature '(): number'
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTyping24.ts (1 errors) ====
|
||||
@ -9,5 +8,4 @@ tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(a: string
|
||||
~~~
|
||||
!!! error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'.
|
||||
!!! error TS2322: Types of parameters 'a' and 'a' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '{ (): number; (i: number): number; }'.
|
||||
!!! error TS2322: Type 'String' provides no match for the signature '(): number'
|
||||
!!! error TS2322: Type 'string' is not assignable to type '{ (): number; (i: number): number; }'.
|
||||
@ -6,11 +6,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
|
||||
Property 'toDateString' is missing in type 'Number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(33,9): error TS2322: Type 'E' is not assignable to type 'void'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(36,9): error TS2322: Type 'E' is not assignable to type '() => {}'.
|
||||
Type 'Number' provides no match for the signature '(): {}'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(37,9): error TS2322: Type 'E' is not assignable to type 'Function'.
|
||||
Property 'apply' is missing in type 'Number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(38,9): error TS2322: Type 'E' is not assignable to type '(x: number) => string'.
|
||||
Type 'Number' provides no match for the signature '(x: number): string'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(39,5): error TS2322: Type 'E' is not assignable to type 'C'.
|
||||
Property 'foo' is missing in type 'Number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(40,5): error TS2322: Type 'E' is not assignable to type 'I'.
|
||||
@ -20,7 +18,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(42,9): error TS2322: Type 'E' is not assignable to type '{ foo: string; }'.
|
||||
Property 'foo' is missing in type 'Number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(43,9): error TS2322: Type 'E' is not assignable to type '<T>(x: T) => T'.
|
||||
Type 'Number' provides no match for the signature '<T>(x: T): T'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(45,9): error TS2322: Type 'E' is not assignable to type 'String'.
|
||||
Property 'charAt' is missing in type 'Number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(47,21): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
@ -83,7 +80,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
|
||||
var j: () => {} = e;
|
||||
~
|
||||
!!! error TS2322: Type 'E' is not assignable to type '() => {}'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(): {}'
|
||||
var k: Function = e;
|
||||
~
|
||||
!!! error TS2322: Type 'E' is not assignable to type 'Function'.
|
||||
@ -91,7 +87,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
|
||||
var l: (x: number) => string = e;
|
||||
~
|
||||
!!! error TS2322: Type 'E' is not assignable to type '(x: number) => string'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(x: number): string'
|
||||
ac = e;
|
||||
~~
|
||||
!!! error TS2322: Type 'E' is not assignable to type 'C'.
|
||||
@ -111,7 +106,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi
|
||||
var o: <T>(x: T) => T = e;
|
||||
~
|
||||
!!! error TS2322: Type 'E' is not assignable to type '<T>(x: T) => T'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '<T>(x: T): T'
|
||||
var p: Number = e;
|
||||
var q: String = e;
|
||||
~
|
||||
|
||||
@ -4,7 +4,6 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty
|
||||
Type 'StringIterator' is not assignable to type 'Iterator<string>'.
|
||||
Types of property 'return' are incompatible.
|
||||
Type 'number' is not assignable to type '(value?: any) => IteratorResult<string>'.
|
||||
Type 'Number' provides no match for the signature '(value?: any): IteratorResult<string>'
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/for-ofStatements/for-of30.ts (1 errors) ====
|
||||
@ -16,7 +15,6 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty
|
||||
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator<string>'.
|
||||
!!! error TS2322: Types of property 'return' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult<string>'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(value?: any): IteratorResult<string>'
|
||||
|
||||
class StringIterator {
|
||||
next() {
|
||||
|
||||
@ -3,7 +3,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(33,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
Type 'Number' provides no match for the signature '(n: Object): number'
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts (2 errors) ====
|
||||
@ -46,5 +45,4 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
|
||||
var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error
|
||||
~~~~
|
||||
!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS2453: Type argument candidate '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
!!! error TS2453: Type 'Number' provides no match for the signature '(n: Object): number'
|
||||
!!! error TS2453: Type argument candidate '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'.
|
||||
@ -23,7 +23,6 @@ tests/cases/compiler/incompatibleTypes.ts(49,7): error TS2345: Argument of type
|
||||
tests/cases/compiler/incompatibleTypes.ts(66,47): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
|
||||
Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type 'number' is not assignable to type '() => string'.
|
||||
Type 'Number' provides no match for the signature '(): string'
|
||||
tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => number' is not assignable to type '() => any'.
|
||||
|
||||
|
||||
@ -133,7 +132,6 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) =>
|
||||
var i1c1: { (): string; } = 5;
|
||||
~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type '() => string'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(): string'
|
||||
|
||||
var fp1: () =>any = a => 0;
|
||||
~~~
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(7,7): error TS2415: Class 'b' incorrectly extends base class 'a'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type '() => string'.
|
||||
Type 'String' provides no match for the signature '(): string'
|
||||
tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS2423: Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member accessor.
|
||||
tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@ -19,7 +18,6 @@ tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(11,9): error T
|
||||
!!! error TS2415: Class 'b' incorrectly extends base class 'a'.
|
||||
!!! error TS2415: Types of property 'x' are incompatible.
|
||||
!!! error TS2415: Type 'string' is not assignable to type '() => string'.
|
||||
!!! error TS2415: Type 'String' provides no match for the signature '(): string'
|
||||
get x() {
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(7,7): error TS2417: Class static side 'typeof b' incorrectly extends base class static side 'typeof a'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type '() => string'.
|
||||
Type 'String' provides no match for the signature '(): string'
|
||||
tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
@ -18,7 +17,6 @@ tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(11,16): error
|
||||
!!! error TS2417: Class static side 'typeof b' incorrectly extends base class static side 'typeof a'.
|
||||
!!! error TS2417: Types of property 'x' are incompatible.
|
||||
!!! error TS2417: Type 'string' is not assignable to type '() => string'.
|
||||
!!! error TS2417: Type 'String' provides no match for the signature '(): string'
|
||||
static get x() {
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/inheritanceStaticPropertyOverridingMethod.ts(7,7): error TS2417: Class static side 'typeof b' incorrectly extends base class static side 'typeof a'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type 'string' is not assignable to type '() => string'.
|
||||
Type 'String' provides no match for the signature '(): string'
|
||||
|
||||
|
||||
==== tests/cases/compiler/inheritanceStaticPropertyOverridingMethod.ts (1 errors) ====
|
||||
@ -16,6 +15,5 @@ tests/cases/compiler/inheritanceStaticPropertyOverridingMethod.ts(7,7): error TS
|
||||
!!! error TS2417: Class static side 'typeof b' incorrectly extends base class static side 'typeof a'.
|
||||
!!! error TS2417: Types of property 'x' are incompatible.
|
||||
!!! error TS2417: Type 'string' is not assignable to type '() => string'.
|
||||
!!! error TS2417: Type 'String' provides no match for the signature '(): string'
|
||||
static x: string;
|
||||
}
|
||||
@ -21,7 +21,6 @@ tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function
|
||||
tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'.
|
||||
Type 'Base' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'.
|
||||
Type 'Boolean' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(120,22): error TS2304: Cannot find name 'i2'.
|
||||
tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@ -34,7 +33,6 @@ tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not as
|
||||
tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'.
|
||||
Type '() => void' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'.
|
||||
Type 'Boolean' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3'.
|
||||
tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@ -68,7 +66,6 @@ tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not as
|
||||
tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is not assignable to type 'i6'.
|
||||
Type 'void' is not assignable to type 'number'.
|
||||
tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'.
|
||||
Type 'Boolean' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(176,22): error TS2304: Cannot find name 'i6'.
|
||||
tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@ -81,7 +78,6 @@ tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Neither type 'Base'
|
||||
tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'.
|
||||
Type '() => void' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'.
|
||||
Type 'Boolean' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7'.
|
||||
tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@ -253,7 +249,6 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj20: i2 = new <i2> anyVar;
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i2'.
|
||||
!!! error TS2322: Type 'Boolean' provides no match for the signature '(): any'
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
@ -288,7 +283,6 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj31: i3 = new <i3> anyVar;
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i3'.
|
||||
!!! error TS2322: Type 'Boolean' provides no match for the signature 'new (): any'
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
@ -387,7 +381,6 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj64: i6 = new <i6> anyVar;
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i6'.
|
||||
!!! error TS2322: Type 'Boolean' provides no match for the signature '(): any'
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
@ -422,7 +415,6 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj75: i7 = new <i7> anyVar;
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i7'.
|
||||
!!! error TS2322: Type 'Boolean' provides no match for the signature 'new (): any'
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
|
||||
@ -7,7 +7,6 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(12
|
||||
tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(15,5): error TS2322: Type 'boolean' is not assignable to type 'I'.
|
||||
Property 'bar' is missing in type 'Boolean'.
|
||||
tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(17,5): error TS2322: Type 'boolean' is not assignable to type '() => string'.
|
||||
Type 'Boolean' provides no match for the signature '(): string'
|
||||
tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(21,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(24,5): error TS2322: Type 'boolean' is not assignable to type 'T'.
|
||||
tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
@ -47,7 +46,6 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26
|
||||
var h: { (): string } = x;
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type '() => string'.
|
||||
!!! error TS2322: Type 'Boolean' provides no match for the signature '(): string'
|
||||
var h2: { toString(): string } = x; // no error
|
||||
|
||||
module M { export var a = 1; }
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(1,35): error TS2322: Type 'number' is not assignable to type '() => typeof fn'.
|
||||
Type 'Number' provides no match for the signature '(): () => typeof fn'
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(3,5): error TS2322: Type '() => typeof fn' is not assignable to type 'number'.
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(4,5): error TS2322: Type '() => typeof fn' is not assignable to type '() => number'.
|
||||
Type '() => typeof fn' is not assignable to type 'number'.
|
||||
@ -7,23 +6,18 @@ tests/cases/compiler/recursiveFunctionTypes.ts(11,16): error TS2355: A function
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(12,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(17,5): error TS2322: Type '() => I<typeof f3>' is not assignable to type 'number'.
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(22,5): error TS2345: Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'.
|
||||
Type 'Number' provides no match for the signature '(t: (t: typeof g) => void): void'
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(25,1): error TS2322: Type 'number' is not assignable to type '() => any'.
|
||||
Type 'Number' provides no match for the signature '(): () => any'
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(30,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(33,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(34,4): error TS2345: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'.
|
||||
Type 'String' provides no match for the signature '(): { (): typeof f6; (a: typeof f6): () => number; }'
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(42,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'.
|
||||
Type 'String' provides no match for the signature '(): { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'
|
||||
|
||||
|
||||
==== tests/cases/compiler/recursiveFunctionTypes.ts (13 errors) ====
|
||||
function fn(): typeof fn { return 1; }
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type '() => typeof fn'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(): () => typeof fn'
|
||||
|
||||
var x: number = fn; // error
|
||||
~
|
||||
@ -58,13 +52,11 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of
|
||||
C.g(3); // error
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'.
|
||||
!!! error TS2345: Type 'Number' provides no match for the signature '(t: (t: typeof g) => void): void'
|
||||
|
||||
var f4: () => typeof f4;
|
||||
f4 = 3; // error
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type '() => any'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(): () => any'
|
||||
|
||||
function f5() { return f5; }
|
||||
|
||||
@ -80,7 +72,6 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of
|
||||
f6(""); // ok (function takes an any param)
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'.
|
||||
!!! error TS2345: Type 'String' provides no match for the signature '(): { (): typeof f6; (a: typeof f6): () => number; }'
|
||||
f6(); // ok
|
||||
|
||||
declare function f7(): typeof f7;
|
||||
@ -94,5 +85,4 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of
|
||||
f7(""); // ok (function takes an any param)
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'.
|
||||
!!! error TS2345: Type 'String' provides no match for the signature '(): { (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'
|
||||
f7(); // ok
|
||||
@ -3,7 +3,6 @@ tests/cases/compiler/typeName1.ts(9,5): error TS2322: Type 'number' is not assig
|
||||
tests/cases/compiler/typeName1.ts(10,5): error TS2322: Type 'number' is not assignable to type '{ f(s: string): number; }'.
|
||||
Property 'f' is missing in type 'Number'.
|
||||
tests/cases/compiler/typeName1.ts(11,5): error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; }'.
|
||||
Type 'Number' provides no match for the signature '(s: string): number'
|
||||
tests/cases/compiler/typeName1.ts(12,5): error TS2322: Type 'number' is not assignable to type '{ x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'.
|
||||
Property 'x' is missing in type 'Number'.
|
||||
tests/cases/compiler/typeName1.ts(13,5): error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'.
|
||||
@ -11,7 +10,6 @@ tests/cases/compiler/typeName1.ts(13,5): error TS2322: Type 'number' is not assi
|
||||
tests/cases/compiler/typeName1.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ z: number; f: { (n: number): string; (s: string): number; }; }'.
|
||||
Property 'z' is missing in type 'Number'.
|
||||
tests/cases/compiler/typeName1.ts(15,5): error TS2322: Type 'number' is not assignable to type '(s: string) => boolean'.
|
||||
Type 'Number' provides no match for the signature '(s: string): boolean'
|
||||
tests/cases/compiler/typeName1.ts(16,5): error TS2322: Type 'number' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'.
|
||||
Property 'z' is missing in type 'Number'.
|
||||
tests/cases/compiler/typeName1.ts(16,10): error TS2411: Property 'z' of type 'I' is not assignable to string index type '{ x: any; y: any; }'.
|
||||
@ -51,7 +49,6 @@ tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not as
|
||||
var x3:{ (s:string):number;(n:number):string; }=3;
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type '{ (s: string): number; (n: number): string; }'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(s: string): number'
|
||||
var x4:{ x;y;z:number;f(n:number):string;f(s:string):number; }=3;
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type '{ x: any; y: any; z: number; f(n: number): string; f(s: string): number; }'.
|
||||
@ -67,7 +64,6 @@ tests/cases/compiler/typeName1.ts(23,5): error TS2322: Type 'typeof C' is not as
|
||||
var x7:(s:string)=>boolean=3;
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type '(s: string) => boolean'.
|
||||
!!! error TS2322: Type 'Number' provides no match for the signature '(s: string): boolean'
|
||||
var x8:{ z:I;[s:string]:{ x; y; };[n:number]:{x; y;};():boolean; }=3;
|
||||
~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type '{ (): boolean; [s: string]: { x: any; y: any; }; [n: number]: { x: any; y: any; }; z: I; }'.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user