mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Accepted baselines.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(6,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1183: An implementation cannot be declared in ambient contexts.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(29,9): error TS1066: In ambient enum declarations member initializer must be constant expression.
|
||||
@@ -15,7 +14,7 @@ tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient m
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements.
|
||||
|
||||
|
||||
==== tests/cases/conformance/ambient/ambientErrors.ts (15 errors) ====
|
||||
==== tests/cases/conformance/ambient/ambientErrors.ts (14 errors) ====
|
||||
// Ambient variable with an initializer
|
||||
declare var x = 4;
|
||||
~
|
||||
@@ -24,8 +23,6 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
|
||||
// Ambient functions with invalid overloads
|
||||
declare function fn(x: number): string;
|
||||
declare function fn(x: 'foo'): number;
|
||||
~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
// Ambient functions with duplicate signatures
|
||||
declare function fn1(x: number): string;
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
tests/cases/compiler/callbackArgsDifferByOptionality.ts(1,23): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/callbackArgsDifferByOptionality.ts(4,5): error TS2304: Cannot find name 'cb'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/callbackArgsDifferByOptionality.ts (2 errors) ====
|
||||
==== tests/cases/compiler/callbackArgsDifferByOptionality.ts (1 errors) ====
|
||||
function x3(callback: (x?: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function x3(callback: (x: string) => number);
|
||||
function x3(callback: (x: any) => number) {
|
||||
cb();
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts (3 errors) ====
|
||||
class Base { foo() { } }
|
||||
class Derived1 extends Base { bar() { } }
|
||||
class Derived2 extends Base { baz() { } }
|
||||
class Derived3 extends Base { biz() { } }
|
||||
|
||||
function foo(tagName: 'canvas'): Derived3;
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function foo(tagName: 'div'): Derived2;
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function foo(tagName: 'span'): Derived1;
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function foo(tagName: number): Base;
|
||||
function foo(tagName: any): Base {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
=== tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts ===
|
||||
class Base { foo() { } }
|
||||
>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0))
|
||||
>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 12))
|
||||
|
||||
class Derived1 extends Base { bar() { } }
|
||||
>Derived1 : Symbol(Derived1, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 24))
|
||||
>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0))
|
||||
>bar : Symbol(bar, Decl(constantOverloadFunctionNoSubtypeError.ts, 1, 29))
|
||||
|
||||
class Derived2 extends Base { baz() { } }
|
||||
>Derived2 : Symbol(Derived2, Decl(constantOverloadFunctionNoSubtypeError.ts, 1, 41))
|
||||
>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0))
|
||||
>baz : Symbol(baz, Decl(constantOverloadFunctionNoSubtypeError.ts, 2, 29))
|
||||
|
||||
class Derived3 extends Base { biz() { } }
|
||||
>Derived3 : Symbol(Derived3, Decl(constantOverloadFunctionNoSubtypeError.ts, 2, 41))
|
||||
>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0))
|
||||
>biz : Symbol(biz, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 29))
|
||||
|
||||
function foo(tagName: 'canvas'): Derived3;
|
||||
>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36))
|
||||
>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 13))
|
||||
>Derived3 : Symbol(Derived3, Decl(constantOverloadFunctionNoSubtypeError.ts, 2, 41))
|
||||
|
||||
function foo(tagName: 'div'): Derived2;
|
||||
>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36))
|
||||
>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 13))
|
||||
>Derived2 : Symbol(Derived2, Decl(constantOverloadFunctionNoSubtypeError.ts, 1, 41))
|
||||
|
||||
function foo(tagName: 'span'): Derived1;
|
||||
>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36))
|
||||
>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 13))
|
||||
>Derived1 : Symbol(Derived1, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 24))
|
||||
|
||||
function foo(tagName: number): Base;
|
||||
>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36))
|
||||
>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 13))
|
||||
>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0))
|
||||
|
||||
function foo(tagName: any): Base {
|
||||
>foo : Symbol(foo, Decl(constantOverloadFunctionNoSubtypeError.ts, 3, 41), Decl(constantOverloadFunctionNoSubtypeError.ts, 5, 42), Decl(constantOverloadFunctionNoSubtypeError.ts, 6, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 7, 40), Decl(constantOverloadFunctionNoSubtypeError.ts, 8, 36))
|
||||
>tagName : Symbol(tagName, Decl(constantOverloadFunctionNoSubtypeError.ts, 9, 13))
|
||||
>Base : Symbol(Base, Decl(constantOverloadFunctionNoSubtypeError.ts, 0, 0))
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
=== tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts ===
|
||||
class Base { foo() { } }
|
||||
>Base : Base
|
||||
>foo : () => void
|
||||
|
||||
class Derived1 extends Base { bar() { } }
|
||||
>Derived1 : Derived1
|
||||
>Base : Base
|
||||
>bar : () => void
|
||||
|
||||
class Derived2 extends Base { baz() { } }
|
||||
>Derived2 : Derived2
|
||||
>Base : Base
|
||||
>baz : () => void
|
||||
|
||||
class Derived3 extends Base { biz() { } }
|
||||
>Derived3 : Derived3
|
||||
>Base : Base
|
||||
>biz : () => void
|
||||
|
||||
function foo(tagName: 'canvas'): Derived3;
|
||||
>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; }
|
||||
>tagName : "canvas"
|
||||
>Derived3 : Derived3
|
||||
|
||||
function foo(tagName: 'div'): Derived2;
|
||||
>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; }
|
||||
>tagName : "div"
|
||||
>Derived2 : Derived2
|
||||
|
||||
function foo(tagName: 'span'): Derived1;
|
||||
>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; }
|
||||
>tagName : "span"
|
||||
>Derived1 : Derived1
|
||||
|
||||
function foo(tagName: number): Base;
|
||||
>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; }
|
||||
>tagName : number
|
||||
>Base : Base
|
||||
|
||||
function foo(tagName: any): Base {
|
||||
>foo : { (tagName: "canvas"): Derived3; (tagName: "div"): Derived2; (tagName: "span"): Derived1; (tagName: number): Base; }
|
||||
>tagName : any
|
||||
>Base : Base
|
||||
|
||||
return null;
|
||||
>null : null
|
||||
}
|
||||
|
||||
@@ -1,22 +1,12 @@
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(3,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(4,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(17,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(18,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(20,5): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(28,5): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(33,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(34,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(18,5): error TS2394: Overload signature is not compatible with function implementation.
|
||||
tests/cases/compiler/constructorsWithSpecializedSignatures.ts(26,5): error TS2394: Overload signature is not compatible with function implementation.
|
||||
|
||||
|
||||
==== tests/cases/compiler/constructorsWithSpecializedSignatures.ts (8 errors) ====
|
||||
==== tests/cases/compiler/constructorsWithSpecializedSignatures.ts (2 errors) ====
|
||||
// errors
|
||||
declare class C {
|
||||
constructor(x: "hi");
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
constructor(x: "foo");
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
constructor(x: number);
|
||||
}
|
||||
|
||||
@@ -30,35 +20,27 @@ tests/cases/compiler/constructorsWithSpecializedSignatures.ts(34,5): error TS238
|
||||
// errors
|
||||
class D {
|
||||
constructor(x: "hi");
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
constructor(x: "foo");
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
constructor(x: number);
|
||||
constructor(x: "hi") { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
}
|
||||
|
||||
// overloads are ok
|
||||
class D2 {
|
||||
constructor(x: "hi");
|
||||
constructor(x: "foo");
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
constructor(x: string);
|
||||
constructor(x: "hi") { } // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
}
|
||||
|
||||
// errors
|
||||
interface I {
|
||||
new (x: "hi");
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
new (x: "foo");
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
new (x: number);
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -1,16 +1,13 @@
|
||||
tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(9,5): error TS2322: Type '(x: "hi", items: string[]) => typeof foo' is not assignable to type 'D'.
|
||||
Property 'x' is missing in type '(x: "hi", items: string[]) => typeof foo'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts (2 errors) ====
|
||||
==== tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts (1 errors) ====
|
||||
class C {
|
||||
private x = 1;
|
||||
}
|
||||
class D extends C { }
|
||||
function foo(x: "hi", items: string[]): typeof foo;
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function foo(x: string, items: string[]): typeof foo {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,8): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(2,37): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (2 errors) ====
|
||||
==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (1 errors) ====
|
||||
|
||||
var f: (x: 'hi') => number = ('hi') => { return 1; };
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
@@ -1,19 +0,0 @@
|
||||
tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(1,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts (2 errors) ====
|
||||
function foo(a: 'hi', x: string);
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function foo(a: 'hi', x: string);
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function foo(a: any, x: any) {
|
||||
}
|
||||
|
||||
function foo2(a: 'hi', x: string);
|
||||
function foo2(a: 'hi', x: string);
|
||||
function foo2(a: string, x: string);
|
||||
function foo2(a: any, x: any) {
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts ===
|
||||
function foo(a: 'hi', x: string);
|
||||
>foo : Symbol(foo, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 0), Decl(overloadOnConstDuplicateOverloads1.ts, 0, 33), Decl(overloadOnConstDuplicateOverloads1.ts, 1, 33))
|
||||
>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 13))
|
||||
>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 21))
|
||||
|
||||
function foo(a: 'hi', x: string);
|
||||
>foo : Symbol(foo, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 0), Decl(overloadOnConstDuplicateOverloads1.ts, 0, 33), Decl(overloadOnConstDuplicateOverloads1.ts, 1, 33))
|
||||
>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 1, 13))
|
||||
>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 1, 21))
|
||||
|
||||
function foo(a: any, x: any) {
|
||||
>foo : Symbol(foo, Decl(overloadOnConstDuplicateOverloads1.ts, 0, 0), Decl(overloadOnConstDuplicateOverloads1.ts, 0, 33), Decl(overloadOnConstDuplicateOverloads1.ts, 1, 33))
|
||||
>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 2, 13))
|
||||
>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 2, 20))
|
||||
}
|
||||
|
||||
function foo2(a: 'hi', x: string);
|
||||
>foo2 : Symbol(foo2, Decl(overloadOnConstDuplicateOverloads1.ts, 3, 1), Decl(overloadOnConstDuplicateOverloads1.ts, 5, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 6, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 7, 36))
|
||||
>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 5, 14))
|
||||
>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 5, 22))
|
||||
|
||||
function foo2(a: 'hi', x: string);
|
||||
>foo2 : Symbol(foo2, Decl(overloadOnConstDuplicateOverloads1.ts, 3, 1), Decl(overloadOnConstDuplicateOverloads1.ts, 5, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 6, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 7, 36))
|
||||
>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 6, 14))
|
||||
>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 6, 22))
|
||||
|
||||
function foo2(a: string, x: string);
|
||||
>foo2 : Symbol(foo2, Decl(overloadOnConstDuplicateOverloads1.ts, 3, 1), Decl(overloadOnConstDuplicateOverloads1.ts, 5, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 6, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 7, 36))
|
||||
>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 7, 14))
|
||||
>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 7, 24))
|
||||
|
||||
function foo2(a: any, x: any) {
|
||||
>foo2 : Symbol(foo2, Decl(overloadOnConstDuplicateOverloads1.ts, 3, 1), Decl(overloadOnConstDuplicateOverloads1.ts, 5, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 6, 34), Decl(overloadOnConstDuplicateOverloads1.ts, 7, 36))
|
||||
>a : Symbol(a, Decl(overloadOnConstDuplicateOverloads1.ts, 8, 14))
|
||||
>x : Symbol(x, Decl(overloadOnConstDuplicateOverloads1.ts, 8, 21))
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts ===
|
||||
function foo(a: 'hi', x: string);
|
||||
>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; }
|
||||
>a : "hi"
|
||||
>x : string
|
||||
|
||||
function foo(a: 'hi', x: string);
|
||||
>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; }
|
||||
>a : "hi"
|
||||
>x : string
|
||||
|
||||
function foo(a: any, x: any) {
|
||||
>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; }
|
||||
>a : any
|
||||
>x : any
|
||||
}
|
||||
|
||||
function foo2(a: 'hi', x: string);
|
||||
>foo2 : { (a: "hi", x: string): any; (a: "hi", x: string): any; (a: string, x: string): any; }
|
||||
>a : "hi"
|
||||
>x : string
|
||||
|
||||
function foo2(a: 'hi', x: string);
|
||||
>foo2 : { (a: "hi", x: string): any; (a: "hi", x: string): any; (a: string, x: string): any; }
|
||||
>a : "hi"
|
||||
>x : string
|
||||
|
||||
function foo2(a: string, x: string);
|
||||
>foo2 : { (a: "hi", x: string): any; (a: "hi", x: string): any; (a: string, x: string): any; }
|
||||
>a : string
|
||||
>x : string
|
||||
|
||||
function foo2(a: any, x: any) {
|
||||
>foo2 : { (a: "hi", x: string): any; (a: "hi", x: string): any; (a: string, x: string): any; }
|
||||
>a : any
|
||||
>x : any
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts (2 errors) ====
|
||||
interface I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
x1(a: number, callback: (x: 'hi') => number) { // error
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts ===
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 1, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 1, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 1, 29))
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : Symbol(C, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 2, 1))
|
||||
>I : Symbol(I, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number) { // error
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 4, 22))
|
||||
>a : Symbol(a, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 5, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 5, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstInBaseWithBadImplementationInDerived.ts, 5, 29))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/overloadOnConstInBaseWithBadImplementationInDerived.ts ===
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : C
|
||||
>I : I
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number) { // error
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => void
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
tests/cases/compiler/overloadOnConstInCallback1.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstInCallback1.ts (1 errors) ====
|
||||
class C {
|
||||
x1(a: number, callback: (x: 'hi') => number); // error
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
x1(a: number, callback: (x: any) => number) {
|
||||
callback('hi');
|
||||
callback('bye');
|
||||
var hm = "hm";
|
||||
callback(hm);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
=== tests/cases/compiler/overloadOnConstInCallback1.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(overloadOnConstInCallback1.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number); // error
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstInCallback1.ts, 0, 9), Decl(overloadOnConstInCallback1.ts, 1, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstInCallback1.ts, 1, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 1, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstInCallback1.ts, 1, 29))
|
||||
|
||||
x1(a: number, callback: (x: any) => number) {
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstInCallback1.ts, 0, 9), Decl(overloadOnConstInCallback1.ts, 1, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstInCallback1.ts, 2, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 2, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstInCallback1.ts, 2, 29))
|
||||
|
||||
callback('hi');
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 2, 17))
|
||||
|
||||
callback('bye');
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 2, 17))
|
||||
|
||||
var hm = "hm";
|
||||
>hm : Symbol(hm, Decl(overloadOnConstInCallback1.ts, 5, 11))
|
||||
|
||||
callback(hm);
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInCallback1.ts, 2, 17))
|
||||
>hm : Symbol(hm, Decl(overloadOnConstInCallback1.ts, 5, 11))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
=== tests/cases/compiler/overloadOnConstInCallback1.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number); // error
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
|
||||
x1(a: number, callback: (x: any) => number) {
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: any) => number
|
||||
>x : any
|
||||
|
||||
callback('hi');
|
||||
>callback('hi') : number
|
||||
>callback : (x: any) => number
|
||||
>'hi' : string
|
||||
|
||||
callback('bye');
|
||||
>callback('bye') : number
|
||||
>callback : (x: any) => number
|
||||
>'bye' : string
|
||||
|
||||
var hm = "hm";
|
||||
>hm : string
|
||||
>"hm" : string
|
||||
|
||||
callback(hm);
|
||||
>callback(hm) : number
|
||||
>callback : (x: any) => number
|
||||
>hm : string
|
||||
}
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts(5,35): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts (2 errors) ====
|
||||
interface I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
var i2: I = { x1: (a: number, cb: (x: 'hi') => number) => { } }; // error
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts ===
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 1, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 1, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 1, 29))
|
||||
}
|
||||
|
||||
var i2: I = { x1: (a: number, cb: (x: 'hi') => number) => { } }; // error
|
||||
>i2 : Symbol(i2, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 3))
|
||||
>I : Symbol(I, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 0, 0))
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 13))
|
||||
>a : Symbol(a, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 19))
|
||||
>cb : Symbol(cb, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 29))
|
||||
>x : Symbol(x, Decl(overloadOnConstInObjectLiteralImplementingAnInterface.ts, 4, 35))
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/overloadOnConstInObjectLiteralImplementingAnInterface.ts ===
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
}
|
||||
|
||||
var i2: I = { x1: (a: number, cb: (x: 'hi') => number) => { } }; // error
|
||||
>i2 : I
|
||||
>I : I
|
||||
>{ x1: (a: number, cb: (x: 'hi') => number) => { } } : { x1: (a: number, cb: (x: "hi") => number) => void; }
|
||||
>x1 : (a: number, cb: (x: "hi") => number) => void
|
||||
>(a: number, cb: (x: 'hi') => number) => { } : (a: number, cb: (x: "hi") => number) => void
|
||||
>a : number
|
||||
>cb : (x: "hi") => number
|
||||
>x : "hi"
|
||||
|
||||
@@ -2,10 +2,9 @@ tests/cases/compiler/overloadOnConstInheritance2.ts(5,11): error TS2430: Interfa
|
||||
Types of property 'addEventListener' are incompatible.
|
||||
Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'.
|
||||
Type '(x: "bar") => string' provides no match for the signature '(x: string): any'
|
||||
tests/cases/compiler/overloadOnConstInheritance2.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstInheritance2.ts (2 errors) ====
|
||||
==== tests/cases/compiler/overloadOnConstInheritance2.ts (1 errors) ====
|
||||
interface Base {
|
||||
addEventListener(x: string): any;
|
||||
addEventListener(x: 'foo'): string;
|
||||
@@ -17,7 +16,5 @@ tests/cases/compiler/overloadOnConstInheritance2.ts(6,5): error TS2382: Speciali
|
||||
!!! error TS2430: Type '(x: "bar") => string' is not assignable to type '{ (x: string): any; (x: "foo"): string; }'.
|
||||
!!! error TS2430: Type '(x: "bar") => string' provides no match for the signature '(x: string): any'
|
||||
addEventListener(x: 'bar'): string; // shouldn't need to redeclare the string overload
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
@@ -2,11 +2,9 @@ tests/cases/compiler/overloadOnConstInheritance3.ts(4,11): error TS2430: Interfa
|
||||
Types of property 'addEventListener' are incompatible.
|
||||
Type '{ (x: "bar"): string; (x: "foo"): string; }' is not assignable to type '(x: string) => any'.
|
||||
Type '{ (x: "bar"): string; (x: "foo"): string; }' provides no match for the signature '(x: string): any'
|
||||
tests/cases/compiler/overloadOnConstInheritance3.ts(6,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstInheritance3.ts(7,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstInheritance3.ts (3 errors) ====
|
||||
==== tests/cases/compiler/overloadOnConstInheritance3.ts (1 errors) ====
|
||||
interface Base {
|
||||
addEventListener(x: string): any;
|
||||
}
|
||||
@@ -18,10 +16,6 @@ tests/cases/compiler/overloadOnConstInheritance3.ts(7,5): error TS2382: Speciali
|
||||
!!! error TS2430: Type '{ (x: "bar"): string; (x: "foo"): string; }' provides no match for the signature '(x: string): any'
|
||||
// shouldn't need to redeclare the string overload
|
||||
addEventListener(x: 'bar'): string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
addEventListener(x: 'foo'): string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
tests/cases/compiler/overloadOnConstInheritance4.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstInheritance4.ts(5,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstInheritance4.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstInheritance4.ts (3 errors) ====
|
||||
interface I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
class C implements I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
x1(a: number, callback: (x: 'hi') => number) {
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/compiler/overloadOnConstInheritance4.ts ===
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(overloadOnConstInheritance4.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstInheritance4.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(overloadOnConstInheritance4.ts, 1, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInheritance4.ts, 1, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstInheritance4.ts, 1, 29))
|
||||
}
|
||||
class C implements I {
|
||||
>C : Symbol(C, Decl(overloadOnConstInheritance4.ts, 2, 1))
|
||||
>I : Symbol(I, Decl(overloadOnConstInheritance4.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstInheritance4.ts, 3, 22), Decl(overloadOnConstInheritance4.ts, 4, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstInheritance4.ts, 4, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInheritance4.ts, 4, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstInheritance4.ts, 4, 29))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number) {
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstInheritance4.ts, 3, 22), Decl(overloadOnConstInheritance4.ts, 4, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstInheritance4.ts, 5, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstInheritance4.ts, 5, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstInheritance4.ts, 5, 29))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/compiler/overloadOnConstInheritance4.ts ===
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
}
|
||||
class C implements I {
|
||||
>C : C
|
||||
>I : I
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number) {
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(1,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(2,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(9,8): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(14,7): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstNoAnyImplementation.ts (4 errors) ====
|
||||
==== tests/cases/compiler/overloadOnConstNoAnyImplementation.ts (1 errors) ====
|
||||
function x1(a: number, cb: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function x1(a: number, cb: (x: 'bye') => number);
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function x1(a: number, cb: (x: string) => number) {
|
||||
cb('hi');
|
||||
cb('bye');
|
||||
@@ -25,6 +18,4 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation.ts(14,7): error TS2381:
|
||||
var cb: (number) => number = (x: number) => 1;
|
||||
x1(1, cb);
|
||||
x1(1, (x: 'hi') => 1); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
x1(1, (x: string) => 1);
|
||||
@@ -1,21 +1,13 @@
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(17,9): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts (5 errors) ====
|
||||
==== tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts (1 errors) ====
|
||||
interface I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
class C {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
x1(a: number, callback: (x: string) => number) {
|
||||
callback('hi');
|
||||
callback('bye');
|
||||
@@ -29,11 +21,7 @@ tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2381:
|
||||
|
||||
var c: C;
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
c.x1(1, (x) => { return 1; } );
|
||||
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
@@ -1,11 +0,0 @@
|
||||
tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts(2,4): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts (1 errors) ====
|
||||
class C {
|
||||
x1(a: 'hi'); // error, no non-specialized signature in overload list
|
||||
~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
x1(a: string) { }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(overloadOnConstNoNonSpecializedSignature.ts, 0, 0))
|
||||
|
||||
x1(a: 'hi'); // error, no non-specialized signature in overload list
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstNoNonSpecializedSignature.ts, 0, 9), Decl(overloadOnConstNoNonSpecializedSignature.ts, 1, 15))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoNonSpecializedSignature.ts, 1, 6))
|
||||
|
||||
x1(a: string) { }
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstNoNonSpecializedSignature.ts, 0, 9), Decl(overloadOnConstNoNonSpecializedSignature.ts, 1, 15))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoNonSpecializedSignature.ts, 2, 6))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/overloadOnConstNoNonSpecializedSignature.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
x1(a: 'hi'); // error, no non-specialized signature in overload list
|
||||
>x1 : (a: "hi") => any
|
||||
>a : "hi"
|
||||
|
||||
x1(a: string) { }
|
||||
>x1 : (a: "hi") => any
|
||||
>a : string
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation.ts(1,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation.ts(2,28): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation.ts(14,7): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstNoStringImplementation.ts (3 errors) ====
|
||||
function x2(a: number, cb: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function x2(a: number, cb: (x: 'bye') => number);
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function x2(a: number, cb: (x: any) => number) {
|
||||
cb('hi');
|
||||
cb('bye');
|
||||
var hm = 'hm';
|
||||
cb(hm); // should this work without a string definition?
|
||||
cb('uh');
|
||||
cb(1);
|
||||
}
|
||||
|
||||
var cb: (number) => number = (x: number) => 1;
|
||||
x2(1, cb); // error
|
||||
x2(1, (x: 'hi') => 1); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
x2(1, (x: string) => 1);
|
||||
@@ -0,0 +1,56 @@
|
||||
=== tests/cases/compiler/overloadOnConstNoStringImplementation.ts ===
|
||||
function x2(a: number, cb: (x: 'hi') => number);
|
||||
>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoStringImplementation.ts, 0, 12))
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 0, 22))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 0, 28))
|
||||
|
||||
function x2(a: number, cb: (x: 'bye') => number);
|
||||
>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoStringImplementation.ts, 1, 12))
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 1, 22))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 1, 28))
|
||||
|
||||
function x2(a: number, cb: (x: any) => number) {
|
||||
>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoStringImplementation.ts, 2, 12))
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 2, 28))
|
||||
|
||||
cb('hi');
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22))
|
||||
|
||||
cb('bye');
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22))
|
||||
|
||||
var hm = 'hm';
|
||||
>hm : Symbol(hm, Decl(overloadOnConstNoStringImplementation.ts, 5, 7))
|
||||
|
||||
cb(hm); // should this work without a string definition?
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22))
|
||||
>hm : Symbol(hm, Decl(overloadOnConstNoStringImplementation.ts, 5, 7))
|
||||
|
||||
cb('uh');
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22))
|
||||
|
||||
cb(1);
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 2, 22))
|
||||
}
|
||||
|
||||
var cb: (number) => number = (x: number) => 1;
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 11, 3))
|
||||
>number : Symbol(number, Decl(overloadOnConstNoStringImplementation.ts, 11, 9))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 11, 30))
|
||||
|
||||
x2(1, cb); // error
|
||||
>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49))
|
||||
>cb : Symbol(cb, Decl(overloadOnConstNoStringImplementation.ts, 11, 3))
|
||||
|
||||
x2(1, (x: 'hi') => 1); // error
|
||||
>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 13, 7))
|
||||
|
||||
x2(1, (x: string) => 1);
|
||||
>x2 : Symbol(x2, Decl(overloadOnConstNoStringImplementation.ts, 0, 0), Decl(overloadOnConstNoStringImplementation.ts, 0, 48), Decl(overloadOnConstNoStringImplementation.ts, 1, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation.ts, 14, 7))
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
=== tests/cases/compiler/overloadOnConstNoStringImplementation.ts ===
|
||||
function x2(a: number, cb: (x: 'hi') => number);
|
||||
>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; }
|
||||
>a : number
|
||||
>cb : (x: "hi") => number
|
||||
>x : "hi"
|
||||
|
||||
function x2(a: number, cb: (x: 'bye') => number);
|
||||
>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; }
|
||||
>a : number
|
||||
>cb : (x: "bye") => number
|
||||
>x : "bye"
|
||||
|
||||
function x2(a: number, cb: (x: any) => number) {
|
||||
>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; }
|
||||
>a : number
|
||||
>cb : (x: any) => number
|
||||
>x : any
|
||||
|
||||
cb('hi');
|
||||
>cb('hi') : number
|
||||
>cb : (x: any) => number
|
||||
>'hi' : string
|
||||
|
||||
cb('bye');
|
||||
>cb('bye') : number
|
||||
>cb : (x: any) => number
|
||||
>'bye' : string
|
||||
|
||||
var hm = 'hm';
|
||||
>hm : string
|
||||
>'hm' : string
|
||||
|
||||
cb(hm); // should this work without a string definition?
|
||||
>cb(hm) : number
|
||||
>cb : (x: any) => number
|
||||
>hm : string
|
||||
|
||||
cb('uh');
|
||||
>cb('uh') : number
|
||||
>cb : (x: any) => number
|
||||
>'uh' : string
|
||||
|
||||
cb(1);
|
||||
>cb(1) : number
|
||||
>cb : (x: any) => number
|
||||
>1 : number
|
||||
}
|
||||
|
||||
var cb: (number) => number = (x: number) => 1;
|
||||
>cb : (number: any) => number
|
||||
>number : any
|
||||
>(x: number) => 1 : (x: number) => number
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
x2(1, cb); // error
|
||||
>x2(1, cb) : any
|
||||
>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; }
|
||||
>1 : number
|
||||
>cb : (number: any) => number
|
||||
|
||||
x2(1, (x: 'hi') => 1); // error
|
||||
>x2(1, (x: 'hi') => 1) : any
|
||||
>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; }
|
||||
>1 : number
|
||||
>(x: 'hi') => 1 : (x: "hi") => number
|
||||
>x : "hi"
|
||||
>1 : number
|
||||
|
||||
x2(1, (x: string) => 1);
|
||||
>x2(1, (x: string) => 1) : any
|
||||
>x2 : { (a: number, cb: (x: "hi") => number): any; (a: number, cb: (x: "bye") => number): any; }
|
||||
>1 : number
|
||||
>(x: string) => 1 : (x: string) => number
|
||||
>x : string
|
||||
>1 : number
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(17,9): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/compiler/overloadOnConstNoStringImplementation2.ts(18,9): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts (4 errors) ====
|
||||
interface I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
x1(a: number, callback: (x: any) => number) {
|
||||
callback('hi');
|
||||
callback('bye');
|
||||
var hm = "hm";
|
||||
callback(hm);
|
||||
callback(1);
|
||||
}
|
||||
}
|
||||
|
||||
var c: C;
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
c.x1(1, (x: string) => { return 1; } );
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
@@ -0,0 +1,73 @@
|
||||
=== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts ===
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(overloadOnConstNoStringImplementation2.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstNoStringImplementation2.ts, 0, 13))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoStringImplementation2.ts, 1, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 1, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 1, 29))
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : Symbol(C, Decl(overloadOnConstNoStringImplementation2.ts, 2, 1))
|
||||
>I : Symbol(I, Decl(overloadOnConstNoStringImplementation2.ts, 0, 0))
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoStringImplementation2.ts, 5, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 5, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 5, 29))
|
||||
|
||||
x1(a: number, callback: (x: any) => number) {
|
||||
>x1 : Symbol(x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>a : Symbol(a, Decl(overloadOnConstNoStringImplementation2.ts, 6, 7))
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 6, 29))
|
||||
|
||||
callback('hi');
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
|
||||
callback('bye');
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
|
||||
var hm = "hm";
|
||||
>hm : Symbol(hm, Decl(overloadOnConstNoStringImplementation2.ts, 9, 11))
|
||||
|
||||
callback(hm);
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
>hm : Symbol(hm, Decl(overloadOnConstNoStringImplementation2.ts, 9, 11))
|
||||
|
||||
callback(1);
|
||||
>callback : Symbol(callback, Decl(overloadOnConstNoStringImplementation2.ts, 6, 17))
|
||||
}
|
||||
}
|
||||
|
||||
var c: C;
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>C : Symbol(C, Decl(overloadOnConstNoStringImplementation2.ts, 2, 1))
|
||||
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
>c.x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 16, 9))
|
||||
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
>c.x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 17, 9))
|
||||
|
||||
c.x1(1, (x: string) => { return 1; } );
|
||||
>c.x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 18, 9))
|
||||
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
>c.x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>c : Symbol(c, Decl(overloadOnConstNoStringImplementation2.ts, 15, 3))
|
||||
>x1 : Symbol(C.x1, Decl(overloadOnConstNoStringImplementation2.ts, 4, 22), Decl(overloadOnConstNoStringImplementation2.ts, 5, 49))
|
||||
>x : Symbol(x, Decl(overloadOnConstNoStringImplementation2.ts, 19, 9))
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
=== tests/cases/compiler/overloadOnConstNoStringImplementation2.ts ===
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
}
|
||||
|
||||
class C implements I {
|
||||
>C : C
|
||||
>I : I
|
||||
|
||||
x1(a: number, callback: (x: 'hi') => number);
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: "hi") => number
|
||||
>x : "hi"
|
||||
|
||||
x1(a: number, callback: (x: any) => number) {
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>a : number
|
||||
>callback : (x: any) => number
|
||||
>x : any
|
||||
|
||||
callback('hi');
|
||||
>callback('hi') : number
|
||||
>callback : (x: any) => number
|
||||
>'hi' : string
|
||||
|
||||
callback('bye');
|
||||
>callback('bye') : number
|
||||
>callback : (x: any) => number
|
||||
>'bye' : string
|
||||
|
||||
var hm = "hm";
|
||||
>hm : string
|
||||
>"hm" : string
|
||||
|
||||
callback(hm);
|
||||
>callback(hm) : number
|
||||
>callback : (x: any) => number
|
||||
>hm : string
|
||||
|
||||
callback(1);
|
||||
>callback(1) : number
|
||||
>callback : (x: any) => number
|
||||
>1 : number
|
||||
}
|
||||
}
|
||||
|
||||
var c: C;
|
||||
>c : C
|
||||
>C : C
|
||||
|
||||
c.x1(1, (x: 'hi') => { return 1; } );
|
||||
>c.x1(1, (x: 'hi') => { return 1; } ) : any
|
||||
>c.x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>c : C
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>1 : number
|
||||
>(x: 'hi') => { return 1; } : (x: "hi") => number
|
||||
>x : "hi"
|
||||
>1 : number
|
||||
|
||||
c.x1(1, (x: 'bye') => { return 1; } );
|
||||
>c.x1(1, (x: 'bye') => { return 1; } ) : any
|
||||
>c.x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>c : C
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>1 : number
|
||||
>(x: 'bye') => { return 1; } : (x: "bye") => number
|
||||
>x : "bye"
|
||||
>1 : number
|
||||
|
||||
c.x1(1, (x: string) => { return 1; } );
|
||||
>c.x1(1, (x: string) => { return 1; } ) : any
|
||||
>c.x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>c : C
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>1 : number
|
||||
>(x: string) => { return 1; } : (x: string) => number
|
||||
>x : string
|
||||
>1 : number
|
||||
|
||||
c.x1(1, (x: number) => { return 1; } );
|
||||
>c.x1(1, (x: number) => { return 1; } ) : any
|
||||
>c.x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>c : C
|
||||
>x1 : (a: number, callback: (x: "hi") => number) => any
|
||||
>1 : number
|
||||
>(x: number) => { return 1; } : (x: number) => number
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(7,10): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: Argument of type '"HI"' is not assignable to parameter of type '"SPAN"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts (3 errors) ====
|
||||
==== tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts (2 errors) ====
|
||||
class Base { foo() { } }
|
||||
class Derived1 extends Base { bar() { } }
|
||||
class Derived2 extends Base { baz() { } }
|
||||
@@ -11,10 +10,8 @@ tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345:
|
||||
|
||||
function foo(name: "SPAN"): Derived1;
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
function foo(name: "DIV"): Derived2 {
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
tests/cases/compiler/overloadingOnConstants2.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadingOnConstants2.ts(9,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadingOnConstants2.ts(9,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
tests/cases/compiler/overloadingOnConstants2.ts(15,13): error TS2345: Argument of type '"um"' is not assignable to parameter of type '"bye"'.
|
||||
tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadingOnConstants2.ts (4 errors) ====
|
||||
==== tests/cases/compiler/overloadingOnConstants2.ts (3 errors) ====
|
||||
class C {
|
||||
private x = 1;
|
||||
}
|
||||
@@ -13,11 +12,9 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2382: Specialize
|
||||
private y = 1;
|
||||
}
|
||||
function foo(x: "hi", items: string[]): D;
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function foo(x: "bye", items: string[]): E;
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
function foo(x: string, items: string[]): C {
|
||||
return null;
|
||||
}
|
||||
@@ -31,7 +28,7 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2382: Specialize
|
||||
//function bar(x: "hi", items: string[]): D;
|
||||
function bar(x: "bye", items: string[]): E;
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
function bar(x: string, items: string[]): C;
|
||||
function bar(x: string, items: string[]): C {
|
||||
return null;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
tests/cases/compiler/overloadingOnConstantsInImplementation.ts(1,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadingOnConstantsInImplementation.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/overloadingOnConstantsInImplementation.ts(3,10): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadingOnConstantsInImplementation.ts (3 errors) ====
|
||||
function foo(a: 'hi', x: string);
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function foo(a: 'hi', x: string);
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function foo(a: 'hi', x: any) {
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/overloadingOnConstantsInImplementation.ts ===
|
||||
function foo(a: 'hi', x: string);
|
||||
>foo : Symbol(foo, Decl(overloadingOnConstantsInImplementation.ts, 0, 0), Decl(overloadingOnConstantsInImplementation.ts, 0, 33), Decl(overloadingOnConstantsInImplementation.ts, 1, 33))
|
||||
>a : Symbol(a, Decl(overloadingOnConstantsInImplementation.ts, 0, 13))
|
||||
>x : Symbol(x, Decl(overloadingOnConstantsInImplementation.ts, 0, 21))
|
||||
|
||||
function foo(a: 'hi', x: string);
|
||||
>foo : Symbol(foo, Decl(overloadingOnConstantsInImplementation.ts, 0, 0), Decl(overloadingOnConstantsInImplementation.ts, 0, 33), Decl(overloadingOnConstantsInImplementation.ts, 1, 33))
|
||||
>a : Symbol(a, Decl(overloadingOnConstantsInImplementation.ts, 1, 13))
|
||||
>x : Symbol(x, Decl(overloadingOnConstantsInImplementation.ts, 1, 21))
|
||||
|
||||
function foo(a: 'hi', x: any) {
|
||||
>foo : Symbol(foo, Decl(overloadingOnConstantsInImplementation.ts, 0, 0), Decl(overloadingOnConstantsInImplementation.ts, 0, 33), Decl(overloadingOnConstantsInImplementation.ts, 1, 33))
|
||||
>a : Symbol(a, Decl(overloadingOnConstantsInImplementation.ts, 2, 13))
|
||||
>x : Symbol(x, Decl(overloadingOnConstantsInImplementation.ts, 2, 21))
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/overloadingOnConstantsInImplementation.ts ===
|
||||
function foo(a: 'hi', x: string);
|
||||
>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; }
|
||||
>a : "hi"
|
||||
>x : string
|
||||
|
||||
function foo(a: 'hi', x: string);
|
||||
>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; }
|
||||
>a : "hi"
|
||||
>x : string
|
||||
|
||||
function foo(a: 'hi', x: any) {
|
||||
>foo : { (a: "hi", x: string): any; (a: "hi", x: string): any; }
|
||||
>a : "hi"
|
||||
>x : any
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
tests/cases/compiler/specializedOverloadWithRestParameters.ts(3,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/compiler/specializedOverloadWithRestParameters.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/specializedOverloadWithRestParameters.ts (2 errors) ====
|
||||
class Base { foo() { } }
|
||||
class Derived1 extends Base { bar() { } }
|
||||
function f(tagName: 'span', ...args): Derived1; // error
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f(tagName: number, ...args): Base;
|
||||
function f(tagName: any): Base {
|
||||
return null;
|
||||
}
|
||||
function g(tagName: 'span', arg): Derived1; // error
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function g(tagName: number, arg): Base;
|
||||
function g(tagName: any): Base {
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
=== tests/cases/compiler/specializedOverloadWithRestParameters.ts ===
|
||||
class Base { foo() { } }
|
||||
>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0))
|
||||
>foo : Symbol(foo, Decl(specializedOverloadWithRestParameters.ts, 0, 12))
|
||||
|
||||
class Derived1 extends Base { bar() { } }
|
||||
>Derived1 : Symbol(Derived1, Decl(specializedOverloadWithRestParameters.ts, 0, 24))
|
||||
>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0))
|
||||
>bar : Symbol(bar, Decl(specializedOverloadWithRestParameters.ts, 1, 29))
|
||||
|
||||
function f(tagName: 'span', ...args): Derived1; // error
|
||||
>f : Symbol(f, Decl(specializedOverloadWithRestParameters.ts, 1, 41), Decl(specializedOverloadWithRestParameters.ts, 2, 47), Decl(specializedOverloadWithRestParameters.ts, 3, 43))
|
||||
>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 2, 11))
|
||||
>args : Symbol(args, Decl(specializedOverloadWithRestParameters.ts, 2, 27))
|
||||
>Derived1 : Symbol(Derived1, Decl(specializedOverloadWithRestParameters.ts, 0, 24))
|
||||
|
||||
function f(tagName: number, ...args): Base;
|
||||
>f : Symbol(f, Decl(specializedOverloadWithRestParameters.ts, 1, 41), Decl(specializedOverloadWithRestParameters.ts, 2, 47), Decl(specializedOverloadWithRestParameters.ts, 3, 43))
|
||||
>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 3, 11))
|
||||
>args : Symbol(args, Decl(specializedOverloadWithRestParameters.ts, 3, 27))
|
||||
>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0))
|
||||
|
||||
function f(tagName: any): Base {
|
||||
>f : Symbol(f, Decl(specializedOverloadWithRestParameters.ts, 1, 41), Decl(specializedOverloadWithRestParameters.ts, 2, 47), Decl(specializedOverloadWithRestParameters.ts, 3, 43))
|
||||
>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 4, 11))
|
||||
>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0))
|
||||
|
||||
return null;
|
||||
}
|
||||
function g(tagName: 'span', arg): Derived1; // error
|
||||
>g : Symbol(g, Decl(specializedOverloadWithRestParameters.ts, 6, 1), Decl(specializedOverloadWithRestParameters.ts, 7, 43), Decl(specializedOverloadWithRestParameters.ts, 8, 39))
|
||||
>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 7, 11))
|
||||
>arg : Symbol(arg, Decl(specializedOverloadWithRestParameters.ts, 7, 27))
|
||||
>Derived1 : Symbol(Derived1, Decl(specializedOverloadWithRestParameters.ts, 0, 24))
|
||||
|
||||
function g(tagName: number, arg): Base;
|
||||
>g : Symbol(g, Decl(specializedOverloadWithRestParameters.ts, 6, 1), Decl(specializedOverloadWithRestParameters.ts, 7, 43), Decl(specializedOverloadWithRestParameters.ts, 8, 39))
|
||||
>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 8, 11))
|
||||
>arg : Symbol(arg, Decl(specializedOverloadWithRestParameters.ts, 8, 27))
|
||||
>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0))
|
||||
|
||||
function g(tagName: any): Base {
|
||||
>g : Symbol(g, Decl(specializedOverloadWithRestParameters.ts, 6, 1), Decl(specializedOverloadWithRestParameters.ts, 7, 43), Decl(specializedOverloadWithRestParameters.ts, 8, 39))
|
||||
>tagName : Symbol(tagName, Decl(specializedOverloadWithRestParameters.ts, 9, 11))
|
||||
>Base : Symbol(Base, Decl(specializedOverloadWithRestParameters.ts, 0, 0))
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
=== tests/cases/compiler/specializedOverloadWithRestParameters.ts ===
|
||||
class Base { foo() { } }
|
||||
>Base : Base
|
||||
>foo : () => void
|
||||
|
||||
class Derived1 extends Base { bar() { } }
|
||||
>Derived1 : Derived1
|
||||
>Base : Base
|
||||
>bar : () => void
|
||||
|
||||
function f(tagName: 'span', ...args): Derived1; // error
|
||||
>f : { (tagName: "span", ...args: any[]): Derived1; (tagName: number, ...args: any[]): Base; }
|
||||
>tagName : "span"
|
||||
>args : any[]
|
||||
>Derived1 : Derived1
|
||||
|
||||
function f(tagName: number, ...args): Base;
|
||||
>f : { (tagName: "span", ...args: any[]): Derived1; (tagName: number, ...args: any[]): Base; }
|
||||
>tagName : number
|
||||
>args : any[]
|
||||
>Base : Base
|
||||
|
||||
function f(tagName: any): Base {
|
||||
>f : { (tagName: "span", ...args: any[]): Derived1; (tagName: number, ...args: any[]): Base; }
|
||||
>tagName : any
|
||||
>Base : Base
|
||||
|
||||
return null;
|
||||
>null : null
|
||||
}
|
||||
function g(tagName: 'span', arg): Derived1; // error
|
||||
>g : { (tagName: "span", arg: any): Derived1; (tagName: number, arg: any): Base; }
|
||||
>tagName : "span"
|
||||
>arg : any
|
||||
>Derived1 : Derived1
|
||||
|
||||
function g(tagName: number, arg): Base;
|
||||
>g : { (tagName: "span", arg: any): Derived1; (tagName: number, arg: any): Base; }
|
||||
>tagName : number
|
||||
>arg : any
|
||||
>Base : Base
|
||||
|
||||
function g(tagName: any): Base {
|
||||
>g : { (tagName: "span", arg: any): Derived1; (tagName: number, arg: any): Base; }
|
||||
>tagName : any
|
||||
>Base : Base
|
||||
|
||||
return null;
|
||||
>null : null
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(7,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,7): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts (3 errors) ====
|
||||
==== tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts (2 errors) ====
|
||||
function x3(a: number, cb: (x: number) => number);
|
||||
function x3(a: string, cb: (x: number) => number);
|
||||
function x3(a: any, cb: (x: number) => number) {
|
||||
@@ -15,6 +14,4 @@ tests/cases/compiler/specializedSignatureAsCallbackParameter1.ts(8,7): error TS2
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
x3(1, (x: 'hm') => 1);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
+3
-36
@@ -1,91 +1,58 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(8,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(14,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(20,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(26,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(28,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(33,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(35,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(40,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(42,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(47,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(49,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(4,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts (12 errors) ====
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts (1 errors) ====
|
||||
// Specialized signatures must be a subtype of a non-specialized signature
|
||||
// All the below should be errors
|
||||
|
||||
function foo(x: 'a');
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
function foo(x: number) { }
|
||||
|
||||
class C {
|
||||
foo(x: 'a');
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: number);
|
||||
foo(x: any) { }
|
||||
}
|
||||
|
||||
class C2<T> {
|
||||
foo(x: 'a');
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: T);
|
||||
foo(x: any) { }
|
||||
}
|
||||
|
||||
class C3<T extends String> {
|
||||
foo(x: 'a');
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: T);
|
||||
foo(x: any) { }
|
||||
}
|
||||
|
||||
interface I {
|
||||
(x: 'a');
|
||||
~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
(x: number);
|
||||
foo(x: 'a');
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: number);
|
||||
}
|
||||
|
||||
interface I2<T> {
|
||||
(x: 'a');
|
||||
~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
(x: T);
|
||||
foo(x: 'a');
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: T);
|
||||
}
|
||||
|
||||
interface I3<T extends String> {
|
||||
(x: 'a');
|
||||
~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
(x: T);
|
||||
foo(x: 'a');
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: T);
|
||||
}
|
||||
|
||||
var a: {
|
||||
(x: 'a');
|
||||
~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
(x: number);
|
||||
foo(x: 'a');
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: number);
|
||||
}
|
||||
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
tests/cases/compiler/specializedSignatureOverloadReturnTypeWithIndexers.ts(15,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/specializedSignatureOverloadReturnTypeWithIndexers.ts (1 errors) ====
|
||||
interface A {
|
||||
f(p: string): { [p: string]: string; };
|
||||
f(p: "spec"): { [p: string]: any; } // Should be ok
|
||||
}
|
||||
interface B {
|
||||
f(p: string): { [p: number]: string; };
|
||||
f(p: "spec"): { [p: string]: any; } // Should be ok
|
||||
}
|
||||
interface C {
|
||||
f(p: string): { [p: number]: string; };
|
||||
f(p: "spec"): { [p: number]: any; } // Should be ok
|
||||
}
|
||||
interface D {
|
||||
f(p: string): { [p: string]: string; };
|
||||
f(p: "spec"): { [p: number]: any; } // Should be error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/specializedSignatureOverloadReturnTypeWithIndexers.ts ===
|
||||
interface A {
|
||||
>A : Symbol(A, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 0, 0))
|
||||
|
||||
f(p: string): { [p: string]: string; };
|
||||
>f : Symbol(f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 0, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 1, 43))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 1, 6))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 1, 21))
|
||||
|
||||
f(p: "spec"): { [p: string]: any; } // Should be ok
|
||||
>f : Symbol(f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 0, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 1, 43))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 2, 6))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 2, 21))
|
||||
}
|
||||
interface B {
|
||||
>B : Symbol(B, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 3, 1))
|
||||
|
||||
f(p: string): { [p: number]: string; };
|
||||
>f : Symbol(f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 4, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 5, 43))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 5, 6))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 5, 21))
|
||||
|
||||
f(p: "spec"): { [p: string]: any; } // Should be ok
|
||||
>f : Symbol(f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 4, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 5, 43))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 6, 6))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 6, 21))
|
||||
}
|
||||
interface C {
|
||||
>C : Symbol(C, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 7, 1))
|
||||
|
||||
f(p: string): { [p: number]: string; };
|
||||
>f : Symbol(f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 8, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 9, 43))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 9, 6))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 9, 21))
|
||||
|
||||
f(p: "spec"): { [p: number]: any; } // Should be ok
|
||||
>f : Symbol(f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 8, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 9, 43))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 10, 6))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 10, 21))
|
||||
}
|
||||
interface D {
|
||||
>D : Symbol(D, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 11, 1))
|
||||
|
||||
f(p: string): { [p: string]: string; };
|
||||
>f : Symbol(f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 12, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 13, 43))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 13, 6))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 13, 21))
|
||||
|
||||
f(p: "spec"): { [p: number]: any; } // Should be error
|
||||
>f : Symbol(f, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 12, 13), Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 13, 43))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 14, 6))
|
||||
>p : Symbol(p, Decl(specializedSignatureOverloadReturnTypeWithIndexers.ts, 14, 21))
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/specializedSignatureOverloadReturnTypeWithIndexers.ts ===
|
||||
interface A {
|
||||
>A : A
|
||||
|
||||
f(p: string): { [p: string]: string; };
|
||||
>f : { (p: string): { [p: string]: string; }; (p: "spec"): { [p: string]: any; }; }
|
||||
>p : string
|
||||
>p : string
|
||||
|
||||
f(p: "spec"): { [p: string]: any; } // Should be ok
|
||||
>f : { (p: string): { [p: string]: string; }; (p: "spec"): { [p: string]: any; }; }
|
||||
>p : "spec"
|
||||
>p : string
|
||||
}
|
||||
interface B {
|
||||
>B : B
|
||||
|
||||
f(p: string): { [p: number]: string; };
|
||||
>f : { (p: string): { [p: number]: string; }; (p: "spec"): { [p: string]: any; }; }
|
||||
>p : string
|
||||
>p : number
|
||||
|
||||
f(p: "spec"): { [p: string]: any; } // Should be ok
|
||||
>f : { (p: string): { [p: number]: string; }; (p: "spec"): { [p: string]: any; }; }
|
||||
>p : "spec"
|
||||
>p : string
|
||||
}
|
||||
interface C {
|
||||
>C : C
|
||||
|
||||
f(p: string): { [p: number]: string; };
|
||||
>f : { (p: string): { [p: number]: string; }; (p: "spec"): { [p: number]: any; }; }
|
||||
>p : string
|
||||
>p : number
|
||||
|
||||
f(p: "spec"): { [p: number]: any; } // Should be ok
|
||||
>f : { (p: string): { [p: number]: string; }; (p: "spec"): { [p: number]: any; }; }
|
||||
>p : "spec"
|
||||
>p : number
|
||||
}
|
||||
interface D {
|
||||
>D : D
|
||||
|
||||
f(p: string): { [p: string]: string; };
|
||||
>f : { (p: string): { [p: string]: string; }; (p: "spec"): { [p: number]: any; }; }
|
||||
>p : string
|
||||
>p : string
|
||||
|
||||
f(p: "spec"): { [p: number]: any; } // Should be error
|
||||
>f : { (p: string): { [p: string]: string; }; (p: "spec"): { [p: number]: any; }; }
|
||||
>p : "spec"
|
||||
>p : number
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(22,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(26,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(30,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(34,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(38,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(77,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(90,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts (7 errors) ====
|
||||
// string literal types are subtypes of string, any
|
||||
|
||||
// ok
|
||||
function f1(x: 'a');
|
||||
function f1(x: string);
|
||||
function f1(x: string) { }
|
||||
|
||||
// ok
|
||||
function f2(x: 'a');
|
||||
function f2(x: any);
|
||||
function f2(x: any) { }
|
||||
|
||||
// errors
|
||||
function f3(x: 'a');
|
||||
function f3(x: Object);
|
||||
function f3(x: any) { }
|
||||
|
||||
function f4(x: 'a');
|
||||
function f4(x: {});
|
||||
function f4(x: any) { }
|
||||
|
||||
function f5(x: 'a');
|
||||
~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f5(x: number);
|
||||
function f5(x: any) { }
|
||||
|
||||
function f6(x: 'a');
|
||||
~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f6(x: boolean);
|
||||
function f6(x: any) { }
|
||||
|
||||
function f7(x: 'a');
|
||||
~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f7(x: Date);
|
||||
function f7(x: any) { }
|
||||
|
||||
function f8(x: 'a');
|
||||
~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f8(x: RegExp);
|
||||
function f8(x: any) { }
|
||||
|
||||
function f9(x: 'a');
|
||||
~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f9(x: () => {});
|
||||
function f9(x: any) { }
|
||||
|
||||
class C implements String {
|
||||
toString(): string { return null; }
|
||||
charAt(pos: number): string { return null; }
|
||||
charCodeAt(index: number): number { return null; }
|
||||
concat(...strings: string[]): string { return null; }
|
||||
indexOf(searchString: string, position?: number): number { return null; }
|
||||
lastIndexOf(searchString: string, position?: number): number { return null; }
|
||||
localeCompare(that: string): number { return null; }
|
||||
match(regexp: any): string[] { return null; }
|
||||
replace(searchValue: any, replaceValue: any): string { return null; }
|
||||
search(regexp: any): number { return null; }
|
||||
slice(start?: number, end?: number): string { return null; }
|
||||
split(separator: any, limit?: number): string[] { return null; }
|
||||
substring(start: number, end?: number): string { return null; }
|
||||
toLowerCase(): string { return null; }
|
||||
toLocaleLowerCase(): string { return null; }
|
||||
toUpperCase(): string { return null; }
|
||||
toLocaleUpperCase(): string { return null; }
|
||||
trim(): string { return null; }
|
||||
length: number;
|
||||
substr(from: number, length?: number): string { return null; }
|
||||
valueOf(): string { return null; }
|
||||
[index: number]: string;
|
||||
}
|
||||
|
||||
// BUG 831846
|
||||
function f10(x: 'a');
|
||||
function f10(x: C);
|
||||
function f10(x: any) { }
|
||||
|
||||
interface I extends String {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
// BUG 831846
|
||||
function f11(x: 'a');
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f11(x: I);
|
||||
function f11(x: any) { }
|
||||
|
||||
function f12<T>(x: 'a');
|
||||
function f12<T>(x: T);
|
||||
function f12<T>(x: any) { }
|
||||
|
||||
function f13<T extends String>(x: 'a');
|
||||
function f13<T extends String>(x: T);
|
||||
function f13<T extends String>(x: any) { }
|
||||
|
||||
enum E { A }
|
||||
function f14(x: 'a');
|
||||
~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f14(x: E);
|
||||
function f14(x: any) { }
|
||||
|
||||
function f15<T, U extends T>(x: 'a');
|
||||
function f15<T, U extends T>(x: U);
|
||||
function f15<T, U extends T>(x: any) { }
|
||||
|
||||
function f16<T extends String, U extends T>(x: 'a');
|
||||
function f16<T extends String, U extends T>(x: U);
|
||||
function f16<T extends String, U extends T>(x: any) { }
|
||||
@@ -0,0 +1,343 @@
|
||||
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts ===
|
||||
// string literal types are subtypes of string, any
|
||||
|
||||
// ok
|
||||
function f1(x: 'a');
|
||||
>f1 : Symbol(f1, Decl(stringLiteralTypeIsSubtypeOfString.ts, 0, 0), Decl(stringLiteralTypeIsSubtypeOfString.ts, 3, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 4, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 3, 12))
|
||||
|
||||
function f1(x: string);
|
||||
>f1 : Symbol(f1, Decl(stringLiteralTypeIsSubtypeOfString.ts, 0, 0), Decl(stringLiteralTypeIsSubtypeOfString.ts, 3, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 4, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 4, 12))
|
||||
|
||||
function f1(x: string) { }
|
||||
>f1 : Symbol(f1, Decl(stringLiteralTypeIsSubtypeOfString.ts, 0, 0), Decl(stringLiteralTypeIsSubtypeOfString.ts, 3, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 4, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 5, 12))
|
||||
|
||||
// ok
|
||||
function f2(x: 'a');
|
||||
>f2 : Symbol(f2, Decl(stringLiteralTypeIsSubtypeOfString.ts, 5, 26), Decl(stringLiteralTypeIsSubtypeOfString.ts, 8, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 9, 20))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 8, 12))
|
||||
|
||||
function f2(x: any);
|
||||
>f2 : Symbol(f2, Decl(stringLiteralTypeIsSubtypeOfString.ts, 5, 26), Decl(stringLiteralTypeIsSubtypeOfString.ts, 8, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 9, 20))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 9, 12))
|
||||
|
||||
function f2(x: any) { }
|
||||
>f2 : Symbol(f2, Decl(stringLiteralTypeIsSubtypeOfString.ts, 5, 26), Decl(stringLiteralTypeIsSubtypeOfString.ts, 8, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 9, 20))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 10, 12))
|
||||
|
||||
// errors
|
||||
function f3(x: 'a');
|
||||
>f3 : Symbol(f3, Decl(stringLiteralTypeIsSubtypeOfString.ts, 10, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 13, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 14, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 13, 12))
|
||||
|
||||
function f3(x: Object);
|
||||
>f3 : Symbol(f3, Decl(stringLiteralTypeIsSubtypeOfString.ts, 10, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 13, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 14, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 14, 12))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
function f3(x: any) { }
|
||||
>f3 : Symbol(f3, Decl(stringLiteralTypeIsSubtypeOfString.ts, 10, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 13, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 14, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 15, 12))
|
||||
|
||||
function f4(x: 'a');
|
||||
>f4 : Symbol(f4, Decl(stringLiteralTypeIsSubtypeOfString.ts, 15, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 17, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 18, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 17, 12))
|
||||
|
||||
function f4(x: {});
|
||||
>f4 : Symbol(f4, Decl(stringLiteralTypeIsSubtypeOfString.ts, 15, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 17, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 18, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 18, 12))
|
||||
|
||||
function f4(x: any) { }
|
||||
>f4 : Symbol(f4, Decl(stringLiteralTypeIsSubtypeOfString.ts, 15, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 17, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 18, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 19, 12))
|
||||
|
||||
function f5(x: 'a');
|
||||
>f5 : Symbol(f5, Decl(stringLiteralTypeIsSubtypeOfString.ts, 19, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 21, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 22, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 21, 12))
|
||||
|
||||
function f5(x: number);
|
||||
>f5 : Symbol(f5, Decl(stringLiteralTypeIsSubtypeOfString.ts, 19, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 21, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 22, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 22, 12))
|
||||
|
||||
function f5(x: any) { }
|
||||
>f5 : Symbol(f5, Decl(stringLiteralTypeIsSubtypeOfString.ts, 19, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 21, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 22, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 23, 12))
|
||||
|
||||
function f6(x: 'a');
|
||||
>f6 : Symbol(f6, Decl(stringLiteralTypeIsSubtypeOfString.ts, 23, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 25, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 26, 24))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 25, 12))
|
||||
|
||||
function f6(x: boolean);
|
||||
>f6 : Symbol(f6, Decl(stringLiteralTypeIsSubtypeOfString.ts, 23, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 25, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 26, 24))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 26, 12))
|
||||
|
||||
function f6(x: any) { }
|
||||
>f6 : Symbol(f6, Decl(stringLiteralTypeIsSubtypeOfString.ts, 23, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 25, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 26, 24))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 12))
|
||||
|
||||
function f7(x: 'a');
|
||||
>f7 : Symbol(f7, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 21))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 12))
|
||||
|
||||
function f7(x: Date);
|
||||
>f7 : Symbol(f7, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 21))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 12))
|
||||
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
function f7(x: any) { }
|
||||
>f7 : Symbol(f7, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 21))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 31, 12))
|
||||
|
||||
function f8(x: 'a');
|
||||
>f8 : Symbol(f8, Decl(stringLiteralTypeIsSubtypeOfString.ts, 31, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 33, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 34, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 33, 12))
|
||||
|
||||
function f8(x: RegExp);
|
||||
>f8 : Symbol(f8, Decl(stringLiteralTypeIsSubtypeOfString.ts, 31, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 33, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 34, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 34, 12))
|
||||
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
function f8(x: any) { }
|
||||
>f8 : Symbol(f8, Decl(stringLiteralTypeIsSubtypeOfString.ts, 31, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 33, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 34, 23))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 35, 12))
|
||||
|
||||
function f9(x: 'a');
|
||||
>f9 : Symbol(f9, Decl(stringLiteralTypeIsSubtypeOfString.ts, 35, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 37, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 38, 25))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 37, 12))
|
||||
|
||||
function f9(x: () => {});
|
||||
>f9 : Symbol(f9, Decl(stringLiteralTypeIsSubtypeOfString.ts, 35, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 37, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 38, 25))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 38, 12))
|
||||
|
||||
function f9(x: any) { }
|
||||
>f9 : Symbol(f9, Decl(stringLiteralTypeIsSubtypeOfString.ts, 35, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 37, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 38, 25))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 39, 12))
|
||||
|
||||
class C implements String {
|
||||
>C : Symbol(C, Decl(stringLiteralTypeIsSubtypeOfString.ts, 39, 23))
|
||||
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
toString(): string { return null; }
|
||||
>toString : Symbol(toString, Decl(stringLiteralTypeIsSubtypeOfString.ts, 41, 27))
|
||||
|
||||
charAt(pos: number): string { return null; }
|
||||
>charAt : Symbol(charAt, Decl(stringLiteralTypeIsSubtypeOfString.ts, 42, 39))
|
||||
>pos : Symbol(pos, Decl(stringLiteralTypeIsSubtypeOfString.ts, 43, 11))
|
||||
|
||||
charCodeAt(index: number): number { return null; }
|
||||
>charCodeAt : Symbol(charCodeAt, Decl(stringLiteralTypeIsSubtypeOfString.ts, 43, 48))
|
||||
>index : Symbol(index, Decl(stringLiteralTypeIsSubtypeOfString.ts, 44, 15))
|
||||
|
||||
concat(...strings: string[]): string { return null; }
|
||||
>concat : Symbol(concat, Decl(stringLiteralTypeIsSubtypeOfString.ts, 44, 54))
|
||||
>strings : Symbol(strings, Decl(stringLiteralTypeIsSubtypeOfString.ts, 45, 11))
|
||||
|
||||
indexOf(searchString: string, position?: number): number { return null; }
|
||||
>indexOf : Symbol(indexOf, Decl(stringLiteralTypeIsSubtypeOfString.ts, 45, 57))
|
||||
>searchString : Symbol(searchString, Decl(stringLiteralTypeIsSubtypeOfString.ts, 46, 12))
|
||||
>position : Symbol(position, Decl(stringLiteralTypeIsSubtypeOfString.ts, 46, 33))
|
||||
|
||||
lastIndexOf(searchString: string, position?: number): number { return null; }
|
||||
>lastIndexOf : Symbol(lastIndexOf, Decl(stringLiteralTypeIsSubtypeOfString.ts, 46, 77))
|
||||
>searchString : Symbol(searchString, Decl(stringLiteralTypeIsSubtypeOfString.ts, 47, 16))
|
||||
>position : Symbol(position, Decl(stringLiteralTypeIsSubtypeOfString.ts, 47, 37))
|
||||
|
||||
localeCompare(that: string): number { return null; }
|
||||
>localeCompare : Symbol(localeCompare, Decl(stringLiteralTypeIsSubtypeOfString.ts, 47, 81))
|
||||
>that : Symbol(that, Decl(stringLiteralTypeIsSubtypeOfString.ts, 48, 18))
|
||||
|
||||
match(regexp: any): string[] { return null; }
|
||||
>match : Symbol(match, Decl(stringLiteralTypeIsSubtypeOfString.ts, 48, 56))
|
||||
>regexp : Symbol(regexp, Decl(stringLiteralTypeIsSubtypeOfString.ts, 49, 10))
|
||||
|
||||
replace(searchValue: any, replaceValue: any): string { return null; }
|
||||
>replace : Symbol(replace, Decl(stringLiteralTypeIsSubtypeOfString.ts, 49, 49))
|
||||
>searchValue : Symbol(searchValue, Decl(stringLiteralTypeIsSubtypeOfString.ts, 50, 12))
|
||||
>replaceValue : Symbol(replaceValue, Decl(stringLiteralTypeIsSubtypeOfString.ts, 50, 29))
|
||||
|
||||
search(regexp: any): number { return null; }
|
||||
>search : Symbol(search, Decl(stringLiteralTypeIsSubtypeOfString.ts, 50, 73))
|
||||
>regexp : Symbol(regexp, Decl(stringLiteralTypeIsSubtypeOfString.ts, 51, 11))
|
||||
|
||||
slice(start?: number, end?: number): string { return null; }
|
||||
>slice : Symbol(slice, Decl(stringLiteralTypeIsSubtypeOfString.ts, 51, 48))
|
||||
>start : Symbol(start, Decl(stringLiteralTypeIsSubtypeOfString.ts, 52, 10))
|
||||
>end : Symbol(end, Decl(stringLiteralTypeIsSubtypeOfString.ts, 52, 25))
|
||||
|
||||
split(separator: any, limit?: number): string[] { return null; }
|
||||
>split : Symbol(split, Decl(stringLiteralTypeIsSubtypeOfString.ts, 52, 64))
|
||||
>separator : Symbol(separator, Decl(stringLiteralTypeIsSubtypeOfString.ts, 53, 10))
|
||||
>limit : Symbol(limit, Decl(stringLiteralTypeIsSubtypeOfString.ts, 53, 25))
|
||||
|
||||
substring(start: number, end?: number): string { return null; }
|
||||
>substring : Symbol(substring, Decl(stringLiteralTypeIsSubtypeOfString.ts, 53, 68))
|
||||
>start : Symbol(start, Decl(stringLiteralTypeIsSubtypeOfString.ts, 54, 14))
|
||||
>end : Symbol(end, Decl(stringLiteralTypeIsSubtypeOfString.ts, 54, 28))
|
||||
|
||||
toLowerCase(): string { return null; }
|
||||
>toLowerCase : Symbol(toLowerCase, Decl(stringLiteralTypeIsSubtypeOfString.ts, 54, 67))
|
||||
|
||||
toLocaleLowerCase(): string { return null; }
|
||||
>toLocaleLowerCase : Symbol(toLocaleLowerCase, Decl(stringLiteralTypeIsSubtypeOfString.ts, 55, 42))
|
||||
|
||||
toUpperCase(): string { return null; }
|
||||
>toUpperCase : Symbol(toUpperCase, Decl(stringLiteralTypeIsSubtypeOfString.ts, 56, 48))
|
||||
|
||||
toLocaleUpperCase(): string { return null; }
|
||||
>toLocaleUpperCase : Symbol(toLocaleUpperCase, Decl(stringLiteralTypeIsSubtypeOfString.ts, 57, 42))
|
||||
|
||||
trim(): string { return null; }
|
||||
>trim : Symbol(trim, Decl(stringLiteralTypeIsSubtypeOfString.ts, 58, 48))
|
||||
|
||||
length: number;
|
||||
>length : Symbol(length, Decl(stringLiteralTypeIsSubtypeOfString.ts, 59, 35))
|
||||
|
||||
substr(from: number, length?: number): string { return null; }
|
||||
>substr : Symbol(substr, Decl(stringLiteralTypeIsSubtypeOfString.ts, 60, 19))
|
||||
>from : Symbol(from, Decl(stringLiteralTypeIsSubtypeOfString.ts, 61, 11))
|
||||
>length : Symbol(length, Decl(stringLiteralTypeIsSubtypeOfString.ts, 61, 24))
|
||||
|
||||
valueOf(): string { return null; }
|
||||
>valueOf : Symbol(valueOf, Decl(stringLiteralTypeIsSubtypeOfString.ts, 61, 66))
|
||||
|
||||
[index: number]: string;
|
||||
>index : Symbol(index, Decl(stringLiteralTypeIsSubtypeOfString.ts, 63, 5))
|
||||
}
|
||||
|
||||
// BUG 831846
|
||||
function f10(x: 'a');
|
||||
>f10 : Symbol(f10, Decl(stringLiteralTypeIsSubtypeOfString.ts, 64, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 67, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 68, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 67, 13))
|
||||
|
||||
function f10(x: C);
|
||||
>f10 : Symbol(f10, Decl(stringLiteralTypeIsSubtypeOfString.ts, 64, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 67, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 68, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 68, 13))
|
||||
>C : Symbol(C, Decl(stringLiteralTypeIsSubtypeOfString.ts, 39, 23))
|
||||
|
||||
function f10(x: any) { }
|
||||
>f10 : Symbol(f10, Decl(stringLiteralTypeIsSubtypeOfString.ts, 64, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 67, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 68, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 69, 13))
|
||||
|
||||
interface I extends String {
|
||||
>I : Symbol(I, Decl(stringLiteralTypeIsSubtypeOfString.ts, 69, 24))
|
||||
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
foo: string;
|
||||
>foo : Symbol(foo, Decl(stringLiteralTypeIsSubtypeOfString.ts, 71, 28))
|
||||
}
|
||||
|
||||
// BUG 831846
|
||||
function f11(x: 'a');
|
||||
>f11 : Symbol(f11, Decl(stringLiteralTypeIsSubtypeOfString.ts, 73, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 76, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 77, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 76, 13))
|
||||
|
||||
function f11(x: I);
|
||||
>f11 : Symbol(f11, Decl(stringLiteralTypeIsSubtypeOfString.ts, 73, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 76, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 77, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 77, 13))
|
||||
>I : Symbol(I, Decl(stringLiteralTypeIsSubtypeOfString.ts, 69, 24))
|
||||
|
||||
function f11(x: any) { }
|
||||
>f11 : Symbol(f11, Decl(stringLiteralTypeIsSubtypeOfString.ts, 73, 1), Decl(stringLiteralTypeIsSubtypeOfString.ts, 76, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 77, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 78, 13))
|
||||
|
||||
function f12<T>(x: 'a');
|
||||
>f12 : Symbol(f12, Decl(stringLiteralTypeIsSubtypeOfString.ts, 78, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 22))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 13))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 16))
|
||||
|
||||
function f12<T>(x: T);
|
||||
>f12 : Symbol(f12, Decl(stringLiteralTypeIsSubtypeOfString.ts, 78, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 22))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 13))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 16))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 13))
|
||||
|
||||
function f12<T>(x: any) { }
|
||||
>f12 : Symbol(f12, Decl(stringLiteralTypeIsSubtypeOfString.ts, 78, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 80, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 81, 22))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 13))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 16))
|
||||
|
||||
function f13<T extends String>(x: 'a');
|
||||
>f13 : Symbol(f13, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 27), Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 39), Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 37))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 13))
|
||||
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 31))
|
||||
|
||||
function f13<T extends String>(x: T);
|
||||
>f13 : Symbol(f13, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 27), Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 39), Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 37))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 13))
|
||||
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 31))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 13))
|
||||
|
||||
function f13<T extends String>(x: any) { }
|
||||
>f13 : Symbol(f13, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 27), Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 39), Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 37))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 13))
|
||||
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 31))
|
||||
|
||||
enum E { A }
|
||||
>E : Symbol(E, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 42))
|
||||
>A : Symbol(E.A, Decl(stringLiteralTypeIsSubtypeOfString.ts, 88, 8))
|
||||
|
||||
function f14(x: 'a');
|
||||
>f14 : Symbol(f14, Decl(stringLiteralTypeIsSubtypeOfString.ts, 88, 12), Decl(stringLiteralTypeIsSubtypeOfString.ts, 89, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 90, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 89, 13))
|
||||
|
||||
function f14(x: E);
|
||||
>f14 : Symbol(f14, Decl(stringLiteralTypeIsSubtypeOfString.ts, 88, 12), Decl(stringLiteralTypeIsSubtypeOfString.ts, 89, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 90, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 90, 13))
|
||||
>E : Symbol(E, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 42))
|
||||
|
||||
function f14(x: any) { }
|
||||
>f14 : Symbol(f14, Decl(stringLiteralTypeIsSubtypeOfString.ts, 88, 12), Decl(stringLiteralTypeIsSubtypeOfString.ts, 89, 21), Decl(stringLiteralTypeIsSubtypeOfString.ts, 90, 19))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 91, 13))
|
||||
|
||||
function f15<T, U extends T>(x: 'a');
|
||||
>f15 : Symbol(f15, Decl(stringLiteralTypeIsSubtypeOfString.ts, 91, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 37), Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 35))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 13))
|
||||
>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 15))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 13))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 29))
|
||||
|
||||
function f15<T, U extends T>(x: U);
|
||||
>f15 : Symbol(f15, Decl(stringLiteralTypeIsSubtypeOfString.ts, 91, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 37), Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 35))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 13))
|
||||
>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 15))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 13))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 29))
|
||||
>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 15))
|
||||
|
||||
function f15<T, U extends T>(x: any) { }
|
||||
>f15 : Symbol(f15, Decl(stringLiteralTypeIsSubtypeOfString.ts, 91, 24), Decl(stringLiteralTypeIsSubtypeOfString.ts, 93, 37), Decl(stringLiteralTypeIsSubtypeOfString.ts, 94, 35))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 13))
|
||||
>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 15))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 13))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 29))
|
||||
|
||||
function f16<T extends String, U extends T>(x: 'a');
|
||||
>f16 : Symbol(f16, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 40), Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 52), Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 50))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 13))
|
||||
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 30))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 13))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 44))
|
||||
|
||||
function f16<T extends String, U extends T>(x: U);
|
||||
>f16 : Symbol(f16, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 40), Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 52), Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 50))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 13))
|
||||
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 30))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 13))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 44))
|
||||
>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 30))
|
||||
|
||||
function f16<T extends String, U extends T>(x: any) { }
|
||||
>f16 : Symbol(f16, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 40), Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 52), Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 50))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 13))
|
||||
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 30))
|
||||
>T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 13))
|
||||
>x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 44))
|
||||
|
||||
@@ -0,0 +1,363 @@
|
||||
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts ===
|
||||
// string literal types are subtypes of string, any
|
||||
|
||||
// ok
|
||||
function f1(x: 'a');
|
||||
>f1 : { (x: "a"): any; (x: string): any; }
|
||||
>x : "a"
|
||||
|
||||
function f1(x: string);
|
||||
>f1 : { (x: "a"): any; (x: string): any; }
|
||||
>x : string
|
||||
|
||||
function f1(x: string) { }
|
||||
>f1 : { (x: "a"): any; (x: string): any; }
|
||||
>x : string
|
||||
|
||||
// ok
|
||||
function f2(x: 'a');
|
||||
>f2 : { (x: "a"): any; (x: any): any; }
|
||||
>x : "a"
|
||||
|
||||
function f2(x: any);
|
||||
>f2 : { (x: "a"): any; (x: any): any; }
|
||||
>x : any
|
||||
|
||||
function f2(x: any) { }
|
||||
>f2 : { (x: "a"): any; (x: any): any; }
|
||||
>x : any
|
||||
|
||||
// errors
|
||||
function f3(x: 'a');
|
||||
>f3 : { (x: "a"): any; (x: Object): any; }
|
||||
>x : "a"
|
||||
|
||||
function f3(x: Object);
|
||||
>f3 : { (x: "a"): any; (x: Object): any; }
|
||||
>x : Object
|
||||
>Object : Object
|
||||
|
||||
function f3(x: any) { }
|
||||
>f3 : { (x: "a"): any; (x: Object): any; }
|
||||
>x : any
|
||||
|
||||
function f4(x: 'a');
|
||||
>f4 : { (x: "a"): any; (x: {}): any; }
|
||||
>x : "a"
|
||||
|
||||
function f4(x: {});
|
||||
>f4 : { (x: "a"): any; (x: {}): any; }
|
||||
>x : {}
|
||||
|
||||
function f4(x: any) { }
|
||||
>f4 : { (x: "a"): any; (x: {}): any; }
|
||||
>x : any
|
||||
|
||||
function f5(x: 'a');
|
||||
>f5 : { (x: "a"): any; (x: number): any; }
|
||||
>x : "a"
|
||||
|
||||
function f5(x: number);
|
||||
>f5 : { (x: "a"): any; (x: number): any; }
|
||||
>x : number
|
||||
|
||||
function f5(x: any) { }
|
||||
>f5 : { (x: "a"): any; (x: number): any; }
|
||||
>x : any
|
||||
|
||||
function f6(x: 'a');
|
||||
>f6 : { (x: "a"): any; (x: boolean): any; }
|
||||
>x : "a"
|
||||
|
||||
function f6(x: boolean);
|
||||
>f6 : { (x: "a"): any; (x: boolean): any; }
|
||||
>x : boolean
|
||||
|
||||
function f6(x: any) { }
|
||||
>f6 : { (x: "a"): any; (x: boolean): any; }
|
||||
>x : any
|
||||
|
||||
function f7(x: 'a');
|
||||
>f7 : { (x: "a"): any; (x: Date): any; }
|
||||
>x : "a"
|
||||
|
||||
function f7(x: Date);
|
||||
>f7 : { (x: "a"): any; (x: Date): any; }
|
||||
>x : Date
|
||||
>Date : Date
|
||||
|
||||
function f7(x: any) { }
|
||||
>f7 : { (x: "a"): any; (x: Date): any; }
|
||||
>x : any
|
||||
|
||||
function f8(x: 'a');
|
||||
>f8 : { (x: "a"): any; (x: RegExp): any; }
|
||||
>x : "a"
|
||||
|
||||
function f8(x: RegExp);
|
||||
>f8 : { (x: "a"): any; (x: RegExp): any; }
|
||||
>x : RegExp
|
||||
>RegExp : RegExp
|
||||
|
||||
function f8(x: any) { }
|
||||
>f8 : { (x: "a"): any; (x: RegExp): any; }
|
||||
>x : any
|
||||
|
||||
function f9(x: 'a');
|
||||
>f9 : { (x: "a"): any; (x: () => {}): any; }
|
||||
>x : "a"
|
||||
|
||||
function f9(x: () => {});
|
||||
>f9 : { (x: "a"): any; (x: () => {}): any; }
|
||||
>x : () => {}
|
||||
|
||||
function f9(x: any) { }
|
||||
>f9 : { (x: "a"): any; (x: () => {}): any; }
|
||||
>x : any
|
||||
|
||||
class C implements String {
|
||||
>C : C
|
||||
>String : String
|
||||
|
||||
toString(): string { return null; }
|
||||
>toString : () => string
|
||||
>null : null
|
||||
|
||||
charAt(pos: number): string { return null; }
|
||||
>charAt : (pos: number) => string
|
||||
>pos : number
|
||||
>null : null
|
||||
|
||||
charCodeAt(index: number): number { return null; }
|
||||
>charCodeAt : (index: number) => number
|
||||
>index : number
|
||||
>null : null
|
||||
|
||||
concat(...strings: string[]): string { return null; }
|
||||
>concat : (...strings: string[]) => string
|
||||
>strings : string[]
|
||||
>null : null
|
||||
|
||||
indexOf(searchString: string, position?: number): number { return null; }
|
||||
>indexOf : (searchString: string, position?: number) => number
|
||||
>searchString : string
|
||||
>position : number
|
||||
>null : null
|
||||
|
||||
lastIndexOf(searchString: string, position?: number): number { return null; }
|
||||
>lastIndexOf : (searchString: string, position?: number) => number
|
||||
>searchString : string
|
||||
>position : number
|
||||
>null : null
|
||||
|
||||
localeCompare(that: string): number { return null; }
|
||||
>localeCompare : (that: string) => number
|
||||
>that : string
|
||||
>null : null
|
||||
|
||||
match(regexp: any): string[] { return null; }
|
||||
>match : (regexp: any) => string[]
|
||||
>regexp : any
|
||||
>null : null
|
||||
|
||||
replace(searchValue: any, replaceValue: any): string { return null; }
|
||||
>replace : (searchValue: any, replaceValue: any) => string
|
||||
>searchValue : any
|
||||
>replaceValue : any
|
||||
>null : null
|
||||
|
||||
search(regexp: any): number { return null; }
|
||||
>search : (regexp: any) => number
|
||||
>regexp : any
|
||||
>null : null
|
||||
|
||||
slice(start?: number, end?: number): string { return null; }
|
||||
>slice : (start?: number, end?: number) => string
|
||||
>start : number
|
||||
>end : number
|
||||
>null : null
|
||||
|
||||
split(separator: any, limit?: number): string[] { return null; }
|
||||
>split : (separator: any, limit?: number) => string[]
|
||||
>separator : any
|
||||
>limit : number
|
||||
>null : null
|
||||
|
||||
substring(start: number, end?: number): string { return null; }
|
||||
>substring : (start: number, end?: number) => string
|
||||
>start : number
|
||||
>end : number
|
||||
>null : null
|
||||
|
||||
toLowerCase(): string { return null; }
|
||||
>toLowerCase : () => string
|
||||
>null : null
|
||||
|
||||
toLocaleLowerCase(): string { return null; }
|
||||
>toLocaleLowerCase : () => string
|
||||
>null : null
|
||||
|
||||
toUpperCase(): string { return null; }
|
||||
>toUpperCase : () => string
|
||||
>null : null
|
||||
|
||||
toLocaleUpperCase(): string { return null; }
|
||||
>toLocaleUpperCase : () => string
|
||||
>null : null
|
||||
|
||||
trim(): string { return null; }
|
||||
>trim : () => string
|
||||
>null : null
|
||||
|
||||
length: number;
|
||||
>length : number
|
||||
|
||||
substr(from: number, length?: number): string { return null; }
|
||||
>substr : (from: number, length?: number) => string
|
||||
>from : number
|
||||
>length : number
|
||||
>null : null
|
||||
|
||||
valueOf(): string { return null; }
|
||||
>valueOf : () => string
|
||||
>null : null
|
||||
|
||||
[index: number]: string;
|
||||
>index : number
|
||||
}
|
||||
|
||||
// BUG 831846
|
||||
function f10(x: 'a');
|
||||
>f10 : { (x: "a"): any; (x: C): any; }
|
||||
>x : "a"
|
||||
|
||||
function f10(x: C);
|
||||
>f10 : { (x: "a"): any; (x: C): any; }
|
||||
>x : C
|
||||
>C : C
|
||||
|
||||
function f10(x: any) { }
|
||||
>f10 : { (x: "a"): any; (x: C): any; }
|
||||
>x : any
|
||||
|
||||
interface I extends String {
|
||||
>I : I
|
||||
>String : String
|
||||
|
||||
foo: string;
|
||||
>foo : string
|
||||
}
|
||||
|
||||
// BUG 831846
|
||||
function f11(x: 'a');
|
||||
>f11 : { (x: "a"): any; (x: I): any; }
|
||||
>x : "a"
|
||||
|
||||
function f11(x: I);
|
||||
>f11 : { (x: "a"): any; (x: I): any; }
|
||||
>x : I
|
||||
>I : I
|
||||
|
||||
function f11(x: any) { }
|
||||
>f11 : { (x: "a"): any; (x: I): any; }
|
||||
>x : any
|
||||
|
||||
function f12<T>(x: 'a');
|
||||
>f12 : { <T>(x: "a"): any; <T>(x: T): any; }
|
||||
>T : T
|
||||
>x : "a"
|
||||
|
||||
function f12<T>(x: T);
|
||||
>f12 : { <T>(x: "a"): any; <T>(x: T): any; }
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
|
||||
function f12<T>(x: any) { }
|
||||
>f12 : { <T>(x: "a"): any; <T>(x: T): any; }
|
||||
>T : T
|
||||
>x : any
|
||||
|
||||
function f13<T extends String>(x: 'a');
|
||||
>f13 : { <T extends String>(x: "a"): any; <T extends String>(x: T): any; }
|
||||
>T : T
|
||||
>String : String
|
||||
>x : "a"
|
||||
|
||||
function f13<T extends String>(x: T);
|
||||
>f13 : { <T extends String>(x: "a"): any; <T extends String>(x: T): any; }
|
||||
>T : T
|
||||
>String : String
|
||||
>x : T
|
||||
>T : T
|
||||
|
||||
function f13<T extends String>(x: any) { }
|
||||
>f13 : { <T extends String>(x: "a"): any; <T extends String>(x: T): any; }
|
||||
>T : T
|
||||
>String : String
|
||||
>x : any
|
||||
|
||||
enum E { A }
|
||||
>E : E
|
||||
>A : E
|
||||
|
||||
function f14(x: 'a');
|
||||
>f14 : { (x: "a"): any; (x: E): any; }
|
||||
>x : "a"
|
||||
|
||||
function f14(x: E);
|
||||
>f14 : { (x: "a"): any; (x: E): any; }
|
||||
>x : E
|
||||
>E : E
|
||||
|
||||
function f14(x: any) { }
|
||||
>f14 : { (x: "a"): any; (x: E): any; }
|
||||
>x : any
|
||||
|
||||
function f15<T, U extends T>(x: 'a');
|
||||
>f15 : { <T, U extends T>(x: "a"): any; <T, U extends T>(x: U): any; }
|
||||
>T : T
|
||||
>U : U
|
||||
>T : T
|
||||
>x : "a"
|
||||
|
||||
function f15<T, U extends T>(x: U);
|
||||
>f15 : { <T, U extends T>(x: "a"): any; <T, U extends T>(x: U): any; }
|
||||
>T : T
|
||||
>U : U
|
||||
>T : T
|
||||
>x : U
|
||||
>U : U
|
||||
|
||||
function f15<T, U extends T>(x: any) { }
|
||||
>f15 : { <T, U extends T>(x: "a"): any; <T, U extends T>(x: U): any; }
|
||||
>T : T
|
||||
>U : U
|
||||
>T : T
|
||||
>x : any
|
||||
|
||||
function f16<T extends String, U extends T>(x: 'a');
|
||||
>f16 : { <T extends String, U extends T>(x: "a"): any; <T extends String, U extends T>(x: U): any; }
|
||||
>T : T
|
||||
>String : String
|
||||
>U : U
|
||||
>T : T
|
||||
>x : "a"
|
||||
|
||||
function f16<T extends String, U extends T>(x: U);
|
||||
>f16 : { <T extends String, U extends T>(x: "a"): any; <T extends String, U extends T>(x: U): any; }
|
||||
>T : T
|
||||
>String : String
|
||||
>U : U
|
||||
>T : T
|
||||
>x : U
|
||||
>U : U
|
||||
|
||||
function f16<T extends String, U extends T>(x: any) { }
|
||||
>f16 : { <T extends String, U extends T>(x: "a"): any; <T extends String, U extends T>(x: U): any; }
|
||||
>T : T
|
||||
>String : String
|
||||
>U : U
|
||||
>T : T
|
||||
>x : any
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts(18,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts (2 errors) ====
|
||||
|
||||
type Kind = "A" | "B"
|
||||
|
||||
interface Entity {
|
||||
kind: Kind;
|
||||
}
|
||||
|
||||
interface A extends Entity {
|
||||
kind: "A";
|
||||
a: number;
|
||||
}
|
||||
|
||||
interface B extends Entity {
|
||||
kind: "B";
|
||||
b: string;
|
||||
}
|
||||
|
||||
function hasKind(entity: Entity, kind: "A"): entity is A;
|
||||
~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function hasKind(entity: Entity, kind: "B"): entity is B;
|
||||
~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function hasKind(entity: Entity, kind: Kind): entity is (A | B) {
|
||||
return entity.kind === kind;
|
||||
}
|
||||
|
||||
let x: A = {
|
||||
kind: "A",
|
||||
a: 100,
|
||||
}
|
||||
|
||||
if (hasKind(x, "A")) {
|
||||
let a = x;
|
||||
}
|
||||
else {
|
||||
let b = x;
|
||||
}
|
||||
|
||||
if (!hasKind(x, "B")) {
|
||||
let c = x;
|
||||
}
|
||||
else {
|
||||
let d = x;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts ===
|
||||
|
||||
type Kind = "A" | "B"
|
||||
>Kind : Symbol(Kind, Decl(stringLiteralTypesAsTags02.ts, 0, 0))
|
||||
|
||||
interface Entity {
|
||||
>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21))
|
||||
|
||||
kind: Kind;
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 3, 18))
|
||||
>Kind : Symbol(Kind, Decl(stringLiteralTypesAsTags02.ts, 0, 0))
|
||||
}
|
||||
|
||||
interface A extends Entity {
|
||||
>A : Symbol(A, Decl(stringLiteralTypesAsTags02.ts, 5, 1))
|
||||
>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21))
|
||||
|
||||
kind: "A";
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 7, 28))
|
||||
|
||||
a: number;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesAsTags02.ts, 8, 14))
|
||||
}
|
||||
|
||||
interface B extends Entity {
|
||||
>B : Symbol(B, Decl(stringLiteralTypesAsTags02.ts, 10, 1))
|
||||
>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21))
|
||||
|
||||
kind: "B";
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 12, 28))
|
||||
|
||||
b: string;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesAsTags02.ts, 13, 14))
|
||||
}
|
||||
|
||||
function hasKind(entity: Entity, kind: "A"): entity is A;
|
||||
>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57))
|
||||
>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 17, 17))
|
||||
>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21))
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 17, 32))
|
||||
>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 17, 17))
|
||||
>A : Symbol(A, Decl(stringLiteralTypesAsTags02.ts, 5, 1))
|
||||
|
||||
function hasKind(entity: Entity, kind: "B"): entity is B;
|
||||
>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57))
|
||||
>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 18, 17))
|
||||
>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21))
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 18, 32))
|
||||
>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 18, 17))
|
||||
>B : Symbol(B, Decl(stringLiteralTypesAsTags02.ts, 10, 1))
|
||||
|
||||
function hasKind(entity: Entity, kind: Kind): entity is (A | B) {
|
||||
>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57))
|
||||
>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 19, 17))
|
||||
>Entity : Symbol(Entity, Decl(stringLiteralTypesAsTags02.ts, 1, 21))
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 19, 32))
|
||||
>Kind : Symbol(Kind, Decl(stringLiteralTypesAsTags02.ts, 0, 0))
|
||||
>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 19, 17))
|
||||
>A : Symbol(A, Decl(stringLiteralTypesAsTags02.ts, 5, 1))
|
||||
>B : Symbol(B, Decl(stringLiteralTypesAsTags02.ts, 10, 1))
|
||||
|
||||
return entity.kind === kind;
|
||||
>entity.kind : Symbol(Entity.kind, Decl(stringLiteralTypesAsTags02.ts, 3, 18))
|
||||
>entity : Symbol(entity, Decl(stringLiteralTypesAsTags02.ts, 19, 17))
|
||||
>kind : Symbol(Entity.kind, Decl(stringLiteralTypesAsTags02.ts, 3, 18))
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 19, 32))
|
||||
}
|
||||
|
||||
let x: A = {
|
||||
>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3))
|
||||
>A : Symbol(A, Decl(stringLiteralTypesAsTags02.ts, 5, 1))
|
||||
|
||||
kind: "A",
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesAsTags02.ts, 23, 12))
|
||||
|
||||
a: 100,
|
||||
>a : Symbol(a, Decl(stringLiteralTypesAsTags02.ts, 24, 14))
|
||||
}
|
||||
|
||||
if (hasKind(x, "A")) {
|
||||
>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3))
|
||||
|
||||
let a = x;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesAsTags02.ts, 29, 7))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3))
|
||||
}
|
||||
else {
|
||||
let b = x;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesAsTags02.ts, 32, 7))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3))
|
||||
}
|
||||
|
||||
if (!hasKind(x, "B")) {
|
||||
>hasKind : Symbol(hasKind, Decl(stringLiteralTypesAsTags02.ts, 15, 1), Decl(stringLiteralTypesAsTags02.ts, 17, 57), Decl(stringLiteralTypesAsTags02.ts, 18, 57))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3))
|
||||
|
||||
let c = x;
|
||||
>c : Symbol(c, Decl(stringLiteralTypesAsTags02.ts, 36, 7))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3))
|
||||
}
|
||||
else {
|
||||
let d = x;
|
||||
>d : Symbol(d, Decl(stringLiteralTypesAsTags02.ts, 39, 7))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesAsTags02.ts, 23, 3))
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags02.ts ===
|
||||
|
||||
type Kind = "A" | "B"
|
||||
>Kind : "A" | "B"
|
||||
|
||||
interface Entity {
|
||||
>Entity : Entity
|
||||
|
||||
kind: Kind;
|
||||
>kind : "A" | "B"
|
||||
>Kind : "A" | "B"
|
||||
}
|
||||
|
||||
interface A extends Entity {
|
||||
>A : A
|
||||
>Entity : Entity
|
||||
|
||||
kind: "A";
|
||||
>kind : "A"
|
||||
|
||||
a: number;
|
||||
>a : number
|
||||
}
|
||||
|
||||
interface B extends Entity {
|
||||
>B : B
|
||||
>Entity : Entity
|
||||
|
||||
kind: "B";
|
||||
>kind : "B"
|
||||
|
||||
b: string;
|
||||
>b : string
|
||||
}
|
||||
|
||||
function hasKind(entity: Entity, kind: "A"): entity is A;
|
||||
>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; }
|
||||
>entity : Entity
|
||||
>Entity : Entity
|
||||
>kind : "A"
|
||||
>entity : any
|
||||
>A : A
|
||||
|
||||
function hasKind(entity: Entity, kind: "B"): entity is B;
|
||||
>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; }
|
||||
>entity : Entity
|
||||
>Entity : Entity
|
||||
>kind : "B"
|
||||
>entity : any
|
||||
>B : B
|
||||
|
||||
function hasKind(entity: Entity, kind: Kind): entity is (A | B) {
|
||||
>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; }
|
||||
>entity : Entity
|
||||
>Entity : Entity
|
||||
>kind : "A" | "B"
|
||||
>Kind : "A" | "B"
|
||||
>entity : any
|
||||
>A : A
|
||||
>B : B
|
||||
|
||||
return entity.kind === kind;
|
||||
>entity.kind === kind : boolean
|
||||
>entity.kind : "A" | "B"
|
||||
>entity : Entity
|
||||
>kind : "A" | "B"
|
||||
>kind : "A" | "B"
|
||||
}
|
||||
|
||||
let x: A = {
|
||||
>x : A
|
||||
>A : A
|
||||
>{ kind: "A", a: 100,} : { kind: "A"; a: number; }
|
||||
|
||||
kind: "A",
|
||||
>kind : "A"
|
||||
>"A" : "A"
|
||||
|
||||
a: 100,
|
||||
>a : number
|
||||
>100 : number
|
||||
}
|
||||
|
||||
if (hasKind(x, "A")) {
|
||||
>hasKind(x, "A") : entity is A
|
||||
>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; }
|
||||
>x : A
|
||||
>"A" : "A"
|
||||
|
||||
let a = x;
|
||||
>a : A
|
||||
>x : A
|
||||
}
|
||||
else {
|
||||
let b = x;
|
||||
>b : A
|
||||
>x : A
|
||||
}
|
||||
|
||||
if (!hasKind(x, "B")) {
|
||||
>!hasKind(x, "B") : boolean
|
||||
>hasKind(x, "B") : entity is B
|
||||
>hasKind : { (entity: Entity, kind: "A"): entity is A; (entity: Entity, kind: "B"): entity is B; }
|
||||
>x : A
|
||||
>"B" : "B"
|
||||
|
||||
let c = x;
|
||||
>c : A
|
||||
>x : A
|
||||
}
|
||||
else {
|
||||
let d = x;
|
||||
>d : A
|
||||
>x : A
|
||||
}
|
||||
@@ -43,26 +43,3 @@ declare let g: (x: "foo") => "foo";
|
||||
declare let gResult: "foo";
|
||||
declare let h: (x: "foo" | "bar") => "foo" | "bar";
|
||||
declare let hResult: "foo" | "bar";
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.d.ts(3,16): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.d.ts(5,16): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.d.ts (2 errors) ====
|
||||
declare function foo<T extends "foo">(f: (x: T) => T): (x: T) => T;
|
||||
declare function bar<T extends "foo" | "bar">(f: (x: T) => T): (x: T) => T;
|
||||
declare let f: (x: "foo") => "foo";
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
declare let fResult: "foo";
|
||||
declare let g: (x: "foo") => "foo";
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
declare let gResult: "foo";
|
||||
declare let h: (x: "foo" | "bar") => "foo" | "bar";
|
||||
declare let hResult: "foo" | "bar";
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(3,10): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(4,18): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(5,10): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(8,5): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(12,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(13,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(17,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(18,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(22,5): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(23,17): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(24,8): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts (11 errors) ====
|
||||
// String literal types are only valid in overload signatures
|
||||
|
||||
function foo(x: 'hi') { }
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
var f = function foo(x: 'hi') { }
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
var f2 = (x: 'hi', y: 'hi') => { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
class C {
|
||||
foo(x: 'hi') { }
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
}
|
||||
|
||||
interface I {
|
||||
(x: 'hi');
|
||||
~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: 'hi', y: 'hi');
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
var a: {
|
||||
(x: 'hi');
|
||||
~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: 'hi');
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
var b = {
|
||||
foo(x: 'hi') { },
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
a: function foo(x: 'hi', y: 'hi') { },
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
b: (x: 'hi') => { }
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts ===
|
||||
// String literal types are only valid in overload signatures
|
||||
|
||||
function foo(x: 'hi') { }
|
||||
>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 2, 13))
|
||||
|
||||
var f = function foo(x: 'hi') { }
|
||||
>f : Symbol(f, Decl(stringLiteralTypesInImplementationSignatures.ts, 3, 3))
|
||||
>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 3, 7))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 3, 21))
|
||||
|
||||
var f2 = (x: 'hi', y: 'hi') => { }
|
||||
>f2 : Symbol(f2, Decl(stringLiteralTypesInImplementationSignatures.ts, 4, 3))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 4, 10))
|
||||
>y : Symbol(y, Decl(stringLiteralTypesInImplementationSignatures.ts, 4, 18))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(stringLiteralTypesInImplementationSignatures.ts, 4, 34))
|
||||
|
||||
foo(x: 'hi') { }
|
||||
>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 6, 9))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 7, 8))
|
||||
}
|
||||
|
||||
interface I {
|
||||
>I : Symbol(I, Decl(stringLiteralTypesInImplementationSignatures.ts, 8, 1))
|
||||
|
||||
(x: 'hi');
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 11, 5))
|
||||
|
||||
foo(x: 'hi', y: 'hi');
|
||||
>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 11, 14))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 12, 8))
|
||||
>y : Symbol(y, Decl(stringLiteralTypesInImplementationSignatures.ts, 12, 16))
|
||||
}
|
||||
|
||||
var a: {
|
||||
>a : Symbol(a, Decl(stringLiteralTypesInImplementationSignatures.ts, 15, 3))
|
||||
|
||||
(x: 'hi');
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 16, 5))
|
||||
|
||||
foo(x: 'hi');
|
||||
>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 16, 14))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 17, 8))
|
||||
}
|
||||
|
||||
var b = {
|
||||
>b : Symbol(b, Decl(stringLiteralTypesInImplementationSignatures.ts, 20, 3))
|
||||
|
||||
foo(x: 'hi') { },
|
||||
>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 20, 9))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 21, 8))
|
||||
|
||||
a: function foo(x: 'hi', y: 'hi') { },
|
||||
>a : Symbol(a, Decl(stringLiteralTypesInImplementationSignatures.ts, 21, 21))
|
||||
>foo : Symbol(foo, Decl(stringLiteralTypesInImplementationSignatures.ts, 22, 6))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 22, 20))
|
||||
>y : Symbol(y, Decl(stringLiteralTypesInImplementationSignatures.ts, 22, 28))
|
||||
|
||||
b: (x: 'hi') => { }
|
||||
>b : Symbol(b, Decl(stringLiteralTypesInImplementationSignatures.ts, 22, 42))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesInImplementationSignatures.ts, 23, 8))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts ===
|
||||
// String literal types are only valid in overload signatures
|
||||
|
||||
function foo(x: 'hi') { }
|
||||
>foo : (x: "hi") => void
|
||||
>x : "hi"
|
||||
|
||||
var f = function foo(x: 'hi') { }
|
||||
>f : (x: "hi") => void
|
||||
>function foo(x: 'hi') { } : (x: "hi") => void
|
||||
>foo : (x: "hi") => void
|
||||
>x : "hi"
|
||||
|
||||
var f2 = (x: 'hi', y: 'hi') => { }
|
||||
>f2 : (x: "hi", y: "hi") => void
|
||||
>(x: 'hi', y: 'hi') => { } : (x: "hi", y: "hi") => void
|
||||
>x : "hi"
|
||||
>y : "hi"
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
foo(x: 'hi') { }
|
||||
>foo : (x: "hi") => void
|
||||
>x : "hi"
|
||||
}
|
||||
|
||||
interface I {
|
||||
>I : I
|
||||
|
||||
(x: 'hi');
|
||||
>x : "hi"
|
||||
|
||||
foo(x: 'hi', y: 'hi');
|
||||
>foo : (x: "hi", y: "hi") => any
|
||||
>x : "hi"
|
||||
>y : "hi"
|
||||
}
|
||||
|
||||
var a: {
|
||||
>a : { (x: "hi"): any; foo(x: "hi"): any; }
|
||||
|
||||
(x: 'hi');
|
||||
>x : "hi"
|
||||
|
||||
foo(x: 'hi');
|
||||
>foo : (x: "hi") => any
|
||||
>x : "hi"
|
||||
}
|
||||
|
||||
var b = {
|
||||
>b : { foo(x: "hi"): void; a: (x: "hi", y: "hi") => void; b: (x: "hi") => void; }
|
||||
>{ foo(x: 'hi') { }, a: function foo(x: 'hi', y: 'hi') { }, b: (x: 'hi') => { }} : { foo(x: "hi"): void; a: (x: "hi", y: "hi") => void; b: (x: "hi") => void; }
|
||||
|
||||
foo(x: 'hi') { },
|
||||
>foo : (x: "hi") => void
|
||||
>x : "hi"
|
||||
|
||||
a: function foo(x: 'hi', y: 'hi') { },
|
||||
>a : (x: "hi", y: "hi") => void
|
||||
>function foo(x: 'hi', y: 'hi') { } : (x: "hi", y: "hi") => void
|
||||
>foo : (x: "hi", y: "hi") => void
|
||||
>x : "hi"
|
||||
>y : "hi"
|
||||
|
||||
b: (x: 'hi') => { }
|
||||
>b : (x: "hi") => void
|
||||
>(x: 'hi') => { } : (x: "hi") => void
|
||||
>x : "hi"
|
||||
}
|
||||
|
||||
@@ -1,74 +1,38 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(4,10): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(8,5): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(12,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(13,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(14,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(15,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(19,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(20,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(21,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(22,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(26,5): error TS2300: Duplicate identifier 'foo'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(26,5): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(27,5): error TS2300: Duplicate identifier 'foo'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(27,5): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (14 errors) ====
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (2 errors) ====
|
||||
// String literal types are only valid in overload signatures
|
||||
|
||||
function foo(x: any);
|
||||
function foo(x: 'hi') { }
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
class C {
|
||||
foo(x: string);
|
||||
foo(x: 'hi') { }
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
}
|
||||
|
||||
interface I {
|
||||
(x: 'a');
|
||||
~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
(x: 'hi');
|
||||
~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: 'a', y: 'a');
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: 'hi', y: 'hi');
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
var a: {
|
||||
(x: 'hi');
|
||||
~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
(x: 'a');
|
||||
~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: 'hi');
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
foo(x: 'a');
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
}
|
||||
|
||||
var b = {
|
||||
foo(x: 'hi') { },
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
foo(x: 'a') { },
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
~~~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts (2 errors) ====
|
||||
|
||||
function f(x: "foo"): number;
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f(x: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function g(x: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
let b = g;
|
||||
|
||||
a = b;
|
||||
b = a;
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability01.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability01.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability01.ts, 1, 11))
|
||||
|
||||
function f(x: string): number {
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability01.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability01.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability01.ts, 2, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability01.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability01.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability01.ts, 6, 11))
|
||||
|
||||
function g(x: string): number {
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability01.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability01.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability01.ts, 7, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability01.ts, 11, 3))
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability01.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability01.ts, 1, 29))
|
||||
|
||||
let b = g;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability01.ts, 12, 3))
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability01.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability01.ts, 6, 29))
|
||||
|
||||
a = b;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability01.ts, 11, 3))
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability01.ts, 12, 3))
|
||||
|
||||
b = a;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability01.ts, 12, 3))
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability01.ts, 11, 3))
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
function f(x: string): number {
|
||||
>f : (x: "foo") => number
|
||||
>x : string
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
>g : (x: "bar") => number
|
||||
>x : "bar"
|
||||
|
||||
function g(x: string): number {
|
||||
>g : (x: "bar") => number
|
||||
>x : string
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : (x: "foo") => number
|
||||
>f : (x: "foo") => number
|
||||
|
||||
let b = g;
|
||||
>b : (x: "bar") => number
|
||||
>g : (x: "bar") => number
|
||||
|
||||
a = b;
|
||||
>a = b : (x: "bar") => number
|
||||
>a : (x: "foo") => number
|
||||
>b : (x: "bar") => number
|
||||
|
||||
b = a;
|
||||
>b = a : (x: "foo") => number
|
||||
>b : (x: "bar") => number
|
||||
>a : (x: "foo") => number
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(3,10): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts(8,10): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts (4 errors) ====
|
||||
|
||||
function f(x: "foo"): number;
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f(x: "foo"): number {
|
||||
~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function g(x: "bar"): number {
|
||||
~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
let b = g;
|
||||
|
||||
a = b;
|
||||
b = a;
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability02.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability02.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability02.ts, 1, 11))
|
||||
|
||||
function f(x: "foo"): number {
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability02.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability02.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability02.ts, 2, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability02.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability02.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability02.ts, 6, 11))
|
||||
|
||||
function g(x: "bar"): number {
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability02.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability02.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability02.ts, 7, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability02.ts, 11, 3))
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability02.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability02.ts, 1, 29))
|
||||
|
||||
let b = g;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability02.ts, 12, 3))
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability02.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability02.ts, 6, 29))
|
||||
|
||||
a = b;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability02.ts, 11, 3))
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability02.ts, 12, 3))
|
||||
|
||||
b = a;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability02.ts, 12, 3))
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability02.ts, 11, 3))
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability02.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
function f(x: "foo"): number {
|
||||
>f : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
function g(x: "bar"): number;
|
||||
>g : (x: "bar") => number
|
||||
>x : "bar"
|
||||
|
||||
function g(x: "bar"): number {
|
||||
>g : (x: "bar") => number
|
||||
>x : "bar"
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : (x: "foo") => number
|
||||
>f : (x: "foo") => number
|
||||
|
||||
let b = g;
|
||||
>b : (x: "bar") => number
|
||||
>g : (x: "bar") => number
|
||||
|
||||
a = b;
|
||||
>a = b : (x: "bar") => number
|
||||
>a : (x: "foo") => number
|
||||
>b : (x: "bar") => number
|
||||
|
||||
b = a;
|
||||
>b = a : (x: "foo") => number
|
||||
>b : (x: "bar") => number
|
||||
>a : (x: "foo") => number
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts (2 errors) ====
|
||||
|
||||
function f(x: "foo"): number;
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f(x: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function g(x: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
let b = g;
|
||||
|
||||
a = b;
|
||||
b = a;
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability03.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability03.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability03.ts, 1, 11))
|
||||
|
||||
function f(x: string): number {
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability03.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability03.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability03.ts, 2, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability03.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability03.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability03.ts, 6, 11))
|
||||
|
||||
function g(x: string): number {
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability03.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability03.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability03.ts, 7, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability03.ts, 11, 3))
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability03.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability03.ts, 1, 29))
|
||||
|
||||
let b = g;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability03.ts, 12, 3))
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability03.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability03.ts, 6, 29))
|
||||
|
||||
a = b;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability03.ts, 11, 3))
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability03.ts, 12, 3))
|
||||
|
||||
b = a;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability03.ts, 12, 3))
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability03.ts, 11, 3))
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability03.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
function f(x: string): number {
|
||||
>f : (x: "foo") => number
|
||||
>x : string
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
>g : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
function g(x: string): number {
|
||||
>g : (x: "foo") => number
|
||||
>x : string
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : (x: "foo") => number
|
||||
>f : (x: "foo") => number
|
||||
|
||||
let b = g;
|
||||
>b : (x: "foo") => number
|
||||
>g : (x: "foo") => number
|
||||
|
||||
a = b;
|
||||
>a = b : (x: "foo") => number
|
||||
>a : (x: "foo") => number
|
||||
>b : (x: "foo") => number
|
||||
|
||||
b = a;
|
||||
>b = a : (x: "foo") => number
|
||||
>b : (x: "foo") => number
|
||||
>a : (x: "foo") => number
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts(3,10): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts(8,10): error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts (4 errors) ====
|
||||
|
||||
function f(x: "foo"): number;
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function f(x: "foo"): number {
|
||||
~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function g(x: "foo"): number {
|
||||
~
|
||||
!!! error TS2381: A signature with an implementation cannot use a string literal type.
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
let b = g;
|
||||
|
||||
a = b;
|
||||
b = a;
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability04.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability04.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability04.ts, 1, 11))
|
||||
|
||||
function f(x: "foo"): number {
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability04.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability04.ts, 1, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability04.ts, 2, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability04.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability04.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability04.ts, 6, 11))
|
||||
|
||||
function g(x: "foo"): number {
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability04.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability04.ts, 6, 29))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesOverloadAssignability04.ts, 7, 11))
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability04.ts, 11, 3))
|
||||
>f : Symbol(f, Decl(stringLiteralTypesOverloadAssignability04.ts, 0, 0), Decl(stringLiteralTypesOverloadAssignability04.ts, 1, 29))
|
||||
|
||||
let b = g;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability04.ts, 12, 3))
|
||||
>g : Symbol(g, Decl(stringLiteralTypesOverloadAssignability04.ts, 4, 1), Decl(stringLiteralTypesOverloadAssignability04.ts, 6, 29))
|
||||
|
||||
a = b;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability04.ts, 11, 3))
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability04.ts, 12, 3))
|
||||
|
||||
b = a;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesOverloadAssignability04.ts, 12, 3))
|
||||
>a : Symbol(a, Decl(stringLiteralTypesOverloadAssignability04.ts, 11, 3))
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability04.ts ===
|
||||
|
||||
function f(x: "foo"): number;
|
||||
>f : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
function f(x: "foo"): number {
|
||||
>f : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
>g : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
function g(x: "foo"): number {
|
||||
>g : (x: "foo") => number
|
||||
>x : "foo"
|
||||
|
||||
return 0;
|
||||
>0 : number
|
||||
}
|
||||
|
||||
let a = f;
|
||||
>a : (x: "foo") => number
|
||||
>f : (x: "foo") => number
|
||||
|
||||
let b = g;
|
||||
>b : (x: "foo") => number
|
||||
>g : (x: "foo") => number
|
||||
|
||||
a = b;
|
||||
>a = b : (x: "foo") => number
|
||||
>a : (x: "foo") => number
|
||||
>b : (x: "foo") => number
|
||||
|
||||
b = a;
|
||||
>b = a : (x: "foo") => number
|
||||
>b : (x: "foo") => number
|
||||
>a : (x: "foo") => number
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts(16,1): error TS2322: Type '(x: "foo") => number' is not assignable to type '{ (x: "foo"): number; (x: string): number; }'.
|
||||
Type '(x: "foo") => number' provides no match for the signature '(x: string): number'
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts (2 errors) ====
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability05.ts (1 errors) ====
|
||||
|
||||
function f(x: "foo"): number;
|
||||
function f(x: string): number;
|
||||
@@ -12,8 +11,6 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignabil
|
||||
}
|
||||
|
||||
function g(x: "foo"): number;
|
||||
~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function g(x: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts (2 errors) ====
|
||||
|
||||
type Kind = "A" | "B"
|
||||
|
||||
function kindIs(kind: Kind, is: "A"): kind is "A";
|
||||
~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function kindIs(kind: Kind, is: "B"): kind is "B";
|
||||
~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
function kindIs(kind: Kind, is: Kind): boolean {
|
||||
return kind === is;
|
||||
}
|
||||
|
||||
var x: Kind = "A";
|
||||
|
||||
if (kindIs(x, "A")) {
|
||||
let a = x;
|
||||
}
|
||||
else {
|
||||
let b = x;
|
||||
}
|
||||
|
||||
if (!kindIs(x, "B")) {
|
||||
let c = x;
|
||||
}
|
||||
else {
|
||||
let d = x;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts ===
|
||||
|
||||
type Kind = "A" | "B"
|
||||
>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0))
|
||||
|
||||
function kindIs(kind: Kind, is: "A"): kind is "A";
|
||||
>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50))
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 3, 16))
|
||||
>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0))
|
||||
>is : Symbol(is, Decl(stringLiteralTypesTypePredicates01.ts, 3, 27))
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 3, 16))
|
||||
|
||||
function kindIs(kind: Kind, is: "B"): kind is "B";
|
||||
>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50))
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 4, 16))
|
||||
>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0))
|
||||
>is : Symbol(is, Decl(stringLiteralTypesTypePredicates01.ts, 4, 27))
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 4, 16))
|
||||
|
||||
function kindIs(kind: Kind, is: Kind): boolean {
|
||||
>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50))
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 5, 16))
|
||||
>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0))
|
||||
>is : Symbol(is, Decl(stringLiteralTypesTypePredicates01.ts, 5, 27))
|
||||
>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0))
|
||||
|
||||
return kind === is;
|
||||
>kind : Symbol(kind, Decl(stringLiteralTypesTypePredicates01.ts, 5, 16))
|
||||
>is : Symbol(is, Decl(stringLiteralTypesTypePredicates01.ts, 5, 27))
|
||||
}
|
||||
|
||||
var x: Kind = "A";
|
||||
>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3))
|
||||
>Kind : Symbol(Kind, Decl(stringLiteralTypesTypePredicates01.ts, 0, 0))
|
||||
|
||||
if (kindIs(x, "A")) {
|
||||
>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3))
|
||||
|
||||
let a = x;
|
||||
>a : Symbol(a, Decl(stringLiteralTypesTypePredicates01.ts, 12, 7))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3))
|
||||
}
|
||||
else {
|
||||
let b = x;
|
||||
>b : Symbol(b, Decl(stringLiteralTypesTypePredicates01.ts, 15, 7))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3))
|
||||
}
|
||||
|
||||
if (!kindIs(x, "B")) {
|
||||
>kindIs : Symbol(kindIs, Decl(stringLiteralTypesTypePredicates01.ts, 1, 21), Decl(stringLiteralTypesTypePredicates01.ts, 3, 50), Decl(stringLiteralTypesTypePredicates01.ts, 4, 50))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3))
|
||||
|
||||
let c = x;
|
||||
>c : Symbol(c, Decl(stringLiteralTypesTypePredicates01.ts, 19, 7))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3))
|
||||
}
|
||||
else {
|
||||
let d = x;
|
||||
>d : Symbol(d, Decl(stringLiteralTypesTypePredicates01.ts, 22, 7))
|
||||
>x : Symbol(x, Decl(stringLiteralTypesTypePredicates01.ts, 9, 3))
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesTypePredicates01.ts ===
|
||||
|
||||
type Kind = "A" | "B"
|
||||
>Kind : "A" | "B"
|
||||
|
||||
function kindIs(kind: Kind, is: "A"): kind is "A";
|
||||
>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; }
|
||||
>kind : "A" | "B"
|
||||
>Kind : "A" | "B"
|
||||
>is : "A"
|
||||
>kind : any
|
||||
|
||||
function kindIs(kind: Kind, is: "B"): kind is "B";
|
||||
>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; }
|
||||
>kind : "A" | "B"
|
||||
>Kind : "A" | "B"
|
||||
>is : "B"
|
||||
>kind : any
|
||||
|
||||
function kindIs(kind: Kind, is: Kind): boolean {
|
||||
>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; }
|
||||
>kind : "A" | "B"
|
||||
>Kind : "A" | "B"
|
||||
>is : "A" | "B"
|
||||
>Kind : "A" | "B"
|
||||
|
||||
return kind === is;
|
||||
>kind === is : boolean
|
||||
>kind : "A" | "B"
|
||||
>is : "A" | "B"
|
||||
}
|
||||
|
||||
var x: Kind = "A";
|
||||
>x : "A" | "B"
|
||||
>Kind : "A" | "B"
|
||||
>"A" : "A"
|
||||
|
||||
if (kindIs(x, "A")) {
|
||||
>kindIs(x, "A") : kind is "A"
|
||||
>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; }
|
||||
>x : "A" | "B"
|
||||
>"A" : "A"
|
||||
|
||||
let a = x;
|
||||
>a : "A"
|
||||
>x : "A"
|
||||
}
|
||||
else {
|
||||
let b = x;
|
||||
>b : "B"
|
||||
>x : "B"
|
||||
}
|
||||
|
||||
if (!kindIs(x, "B")) {
|
||||
>!kindIs(x, "B") : boolean
|
||||
>kindIs(x, "B") : kind is "B"
|
||||
>kindIs : { (kind: "A" | "B", is: "A"): kind is "A"; (kind: "A" | "B", is: "B"): kind is "B"; }
|
||||
>x : "A" | "B"
|
||||
>"B" : "B"
|
||||
|
||||
let c = x;
|
||||
>c : "A"
|
||||
>x : "A"
|
||||
}
|
||||
else {
|
||||
let d = x;
|
||||
>d : "B"
|
||||
>x : "B"
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(4,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(37,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(38,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(39,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
@@ -36,13 +35,11 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0
|
||||
Type '"World"' is not assignable to type '"Hello"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (25 errors) ====
|
||||
==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (24 errors) ====
|
||||
|
||||
declare function randBool(): boolean;
|
||||
declare function takeReturnString(str: string): string;
|
||||
declare function takeReturnHello(str: "Hello"): "Hello";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
declare function takeReturnHelloWorld(str: "Hello" | "World"): "Hello" | "World";
|
||||
|
||||
function fun1<T>(x: T, y: T) {
|
||||
|
||||
Reference in New Issue
Block a user