/arkcompiler/ets_runtime/test/typeinfer/automatedcases/ |
D | unionAndIntersectionInference2.ts | 67 declare function f2<T>(x: T & { name: string }): T; function 86 f2(a2); // string 87 AssertType(f2(a2), "string"); 88 AssertType(f2, "<T>(T & { name: string; }) => T"); 91 f2(b2); // string[] 92 AssertType(f2(b2), "string[]"); 93 AssertType(f2, "<T>(T & { name: string; }) => T"); 96 f2(c2); // never 97 AssertType(f2(c2), "never"); 98 AssertType(f2, "<T>(T & { name: string; }) => T"); [all …]
|
D | contextualSignatureInstatiationCovariance.ts | 25 let f2: <T extends Giraffe>(x: T, y: T) => void; variable 26 AssertType(f2, "<T extends Giraffe>(T, T) => void"); 35 g2 = f2; // While neither Animal nor TallThing satisfy the constraint, T is at worst a Giraffe and … 36 AssertType(g2 = f2, "<T extends Giraffe>(T, T) => void"); 38 AssertType(f2, "<T extends Giraffe>(T, T) => void"); 45 h2 = f2; // Animal does not satisfy the constraint, but T is at worst a Giraffe and compatible with… 46 AssertType(h2 = f2, "<T extends Giraffe>(T, T) => void"); 48 AssertType(f2, "<T extends Giraffe>(T, T) => void");
|
D | unionTypeCallSignatures2.ts | 64 let f2: C | B | A; variable 65 AssertType(f2, "union"); 67 let n2 = f2(42); // number 69 AssertType(f2(42), "number"); 70 AssertType(f2, "union"); 73 let s2 = f2("abc"); // number | string | boolean 75 AssertType(f2("abc"), "union"); 76 AssertType(f2, "union"); 79 let a2 = f2([true, false]); // boolean[] 81 AssertType(f2([true, false]), "boolean[]"); [all …]
|
D | contravariantTypeAliasInference.ts | 27 declare let f2: Func1<"a">; 28 AssertType(f2, "Func1<"a">"); 30 declare function foo<T>(f1: Func1<T>, f2: Func1<T>): void; 32 foo(f1, f2); 33 AssertType(foo(f1, f2), "void"); 36 AssertType(f2, "Func1<"a">"); 46 bar(f1, f2); 47 AssertType(bar(f1, f2), "void"); 50 AssertType(f2, "Func1<"a">");
|
D | constEnum3.ts | 25 function f2(f: TestTypeStr) { } function 37 f2('foo') 38 AssertType(f2('foo'), "void"); 39 AssertType(f2, "(union) => void"); 42 f2('bar') 43 AssertType(f2('bar'), "void"); 44 AssertType(f2, "(union) => void");
|
D | intersectionTypeInference2.ts | 44 declare function f2<T, Key extends keyof T>(obj: {[K in keyof T]: T[K]}, key: Key): T[Key]; function 51 f2(obj, 'a'); 52 AssertType(f2(obj, 'a'), "string"); 53 AssertType(f2, "<T, Key extends keyof T>({ [K in keyof T]: T[K]; }, Key) => T[Key]"); 57 f2(obj, 'b'); 58 AssertType(f2(obj, 'b'), "string"); 59 AssertType(f2, "<T, Key extends keyof T>({ [K in keyof T]: T[K]; }, Key) => T[Key]");
|
D | genericInstantiationEquivalentToObjectLiteral.ts | 44 declare function f2<T, U>(x: { first: T; second: U; }); 56 f2(x); 57 AssertType(f2(x), "any"); 58 AssertType(f2, "<T, U>({ first: T; second: U; }) => any"); 61 f2(y); 62 AssertType(f2(y), "any"); 63 AssertType(f2, "<T, U>({ first: T; second: U; }) => any");
|
D | contextualTypingWithGenericSignature.ts | 23 let f2: { 24 AssertType(f2, "<T, U>(T, U) => T"); 32 f2 = (x, y) => { 33 AssertType(f2 = (x, y) => { return x }, "<T, U>(T, U) => T"); 36 AssertType(f2, "<T, U>(T, U) => T");
|
D | constructorOverloads2.ts | 48 let f2 = new Foo(0); variable 49 AssertType(f2, "Foo"); 60 let f4 = new Foo([f1,f2,f3]); 62 AssertType(new Foo([f1,f2,f3]), "Foo"); 64 AssertType([f1,f2,f3], "Foo[]"); 66 AssertType(f2, "Foo");
|
D | multiCallOverloads.ts | 35 let f2: ICallback = function(z?) { variable 36 AssertType(f2, "ICallback"); 48 load(f2) // ok 49 AssertType(load(f2), "void"); 51 AssertType(f2, "ICallback");
|
D | nonNullableReductionNonStrict.ts | 26 function test<T>(f1: Transform1<T>, f2: Transform2<T>) { 32 f2?.("hello"); 33 AssertType(f2?.("hello"), "T"); 34 AssertType(f2, "union"); 45 function f2<T, U extends null | undefined>(x: T | U) { function
|
D | nonNullableReduction.ts | 26 function test<T>(f1: Transform1<T>, f2: Transform2<T>) { 32 f2?.("hello"); 33 AssertType(f2?.("hello"), "union"); 34 AssertType(f2, "union"); 45 function f2<T, U extends null | undefined>(x: T | U) { function
|
D | unusedParametersThis.ts | 73 let f2 = function f2(this: A): number { variable 74 AssertType(f2, "(A) => number"); 75 AssertType(f2, "(A) => number"); 77 AssertType(function f2(this: A): number { return this.a;}, "(A) => number"); function
|
D | instanceofOperatorWithRHSIsSubtypeOfFunction.ts | 29 let f2: I; variable 30 AssertType(f2, "I"); 44 let r2 = x instanceof f2; variable 46 AssertType(x instanceof f2, "boolean"); 48 AssertType(f2, "I");
|
D | contextualTypingWithGenericAndNonGenericSignature.ts | 23 let f2: { 24 AssertType(f2, "{ (string, number): string; <T, U>(T, U): T; }"); 36 f2 = (x, y) => { 37 AssertType(f2 = (x, y) => { return x }, "(any, any) => any"); 40 AssertType(f2, "{ (string, number): string; <T, U>(T, U): T; }");
|
D | recursiveTypeParameterReferenceError1.ts | 39 let f2: Foo2<number>; variable 40 AssertType(f2, "Foo2<number>"); 42 let r2 = f2.ofC4; 44 AssertType(f2.ofC4, "C2<{ x: number; }>");
|
D | genericCallWithObjectTypeArgs2.ts | 64 function f2<T extends Base, U extends Base>(a: { x: T; y: U }) { function 71 let r3 = f2({ x: new Derived(), y: new Derived2() }); // Derived => Derived2 73 AssertType(f2({ x: new Derived(), y: new Derived2() }), "(Derived) => Derived2"); 74 AssertType(f2, "<T extends Base, U extends Base>({ x: T; y: U; }) => (T) => U"); 91 let r4 = f2(i); // Base => Derived 93 AssertType(f2(i), "(Base) => Derived"); 94 AssertType(f2, "<T extends Base, U extends Base>({ x: T; y: U; }) => (T) => U");
|
D | instantiatedTypeAliasDisplay.ts | 32 declare function f2<A, B, C, D, E>(a: A, b: B, c: C, d: D): Z<A, string[]>; 39 const x2 = f2({}, {}, {}, {}); // Z<{}, string[]> 41 AssertType(f2({}, {}, {}, {}), "Z<{}, string[]>"); 42 AssertType(f2, "<A, B, C, D, E>(A, B, C, D) => Z<A, string[]>");
|
D | commentsOverloads.ts | 38 function f2(a: number): number; function 40 function f2(b: string): number; 42 function f2(aOrb: any) { 46 f2("hello"); 47 AssertType(f2("hello"), "number"); 48 AssertType(f2, "{ (number): number; (string): number; }"); 51 f2(10); 52 AssertType(f2(10), "number"); 53 AssertType(f2, "{ (number): number; (string): number; }");
|
D | privacyInterface.ts | 53 f2(a1: C2_private); 80 f2(a1: C2_private); 119 f2(a1: C2_private); method 146 f2(a1: C2_private); method 183 f2(a1: C6_private); method 210 f2(a1: C6_private); method 222 f2(): string; method 247 f2(): string; method 270 f2(): string; method
|
D | deferredLookupTypeResolution.ts | 39 function f2<A extends string>(a: A) { function 48 AssertType(f2(x), "{ a: any; b: any; x: any; }"); 49 AssertType(f2, "<A extends string>(A) => { [P in union]: any; }"); 51 return f2(x);
|
/arkcompiler/ets_runtime/test/typeinfer/module_test/module_member_initialization/ |
D | module_member_initialization.ts | 21 let f2 = new foo2(); variable 26 AssertType(f2.a1, "number"); 27 AssertType(f2.a2, "string"); 28 AssertType(f2.a3, "foo1"); 29 AssertType(f2.a3.b2, "number"); 30 AssertType(f2.a4, "(number, number) => number");
|
/arkcompiler/ets_runtime/test/typeinfer/automatedcases/exportsAndImports4-amd/ |
D | t3.ts | 44 import f1, { default as f2 } from "./t1"; 48 f2; 49 AssertType(f2, "string"); 51 export { a, b, c, d, e1, e2, f1, f2 };
|
/arkcompiler/ets_runtime/test/typeinfer/automatedcases/exportsAndImports4-es6/ |
D | t3.ts | 44 import f1, { default as f2 } from "./t1"; 48 f2; 49 AssertType(f2, "string"); 51 export { a, b, c, d, e1, e2, f1, f2 };
|
/arkcompiler/ets_runtime/test/typeinfer/automatedcases/exportsAndImports4/ |
D | t3.ts | 44 import f1, { default as f2 } from "./t1"; 48 f2; 49 AssertType(f2, "string"); 51 export { a, b, c, d, e1, e2, f1, f2 };
|