141 lines
7.8 KiB
Plaintext
141 lines
7.8 KiB
Plaintext
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(22,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(26,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(30,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(34,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(38,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(76,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(89,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(93,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(94,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(95,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(97,32): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(98,32): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(99,32): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
|
|
|
|
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts (13 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; }
|
|
[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');
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
function f15<T, U extends T>(x: U);
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
function f15<T, U extends T>(x: any) { }
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
|
|
function f16<T extends String, U extends T>(x: 'a');
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
function f16<T extends String, U extends T>(x: U);
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
function f16<T extends String, U extends T>(x: any) { }
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. |