/arkcompiler/ets_runtime/test/typeinfer/automatedcases/ |
D | manyConstExports.ts | 20 declare function AssertType(value:any, type:string):void; 22 AssertType(exp0, "string"); 23 AssertType("test", "string"); 26 AssertType(exp1, "string"); 27 AssertType("test", "string"); 30 AssertType(exp2, "string"); 31 AssertType("test", "string"); 34 AssertType(exp3, "string"); 35 AssertType("test", "string"); 38 AssertType(exp4, "string"); [all …]
|
D | numericIndexingResults.ts | 20 declare function AssertType(value:any, type:string):void; 22 [x: number]: string; 31 AssertType(r1, "string"); 32 AssertType(c['1'], "string"); 34 AssertType('1', "string"); 37 AssertType(r2, "string"); 38 AssertType(c['2'], "string"); 40 AssertType('2', "string"); 43 AssertType(r3, "string"); 44 AssertType(c['3'], "string"); [all …]
|
D | voidOperatorWithStringType.ts | 20 declare function AssertType(value:any, type:string):void; 21 // void operator on string type 22 let STRING: string; 23 AssertType(STRING, "string"); 25 let STRING1: string[] = ["", "abc"]; 26 AssertType(STRING1, "string[]"); 27 AssertType(["", "abc"], "string[]"); 28 AssertType("", "string"); 29 AssertType("abc", "string"); 31 function foo(): string { [all …]
|
D | typeGuardsInFunction.ts | 20 declare function AssertType(value:any, type:string):void; 28 let let1: string | number; 32 function f(param: string | number) { 34 num = typeof let1 === "string" && let1.length; // string 35 AssertType(num = typeof let1 === "string" && let1.length, "number"); 37 AssertType(typeof let1 === "string" && let1.length, "number"); 38 AssertType(typeof let1 === "string", "boolean"); 41 AssertType("string", "string"); 45 let let2: string | number; 48 num = typeof let2 === "string" && let2.length; // string [all …]
|
D | objectRestAssignment.ts | 20 declare function AssertType(value:any, type:string):void; 55 let overEmit: { a: { ka: string, x: string }[], b: { z: string, ki: string, ku: string }, ke: strin… 56 …e(overEmit, "{ a: { ka: string; x: string;}[]; b: { z: string; ki: string; ku: stri… 57 AssertType(a, "{ ka: string; x: string; }[]"); 58 AssertType(ka, "string"); 59 AssertType(x, "string"); 60 AssertType(b, "{ z: string; ki: string; ku: string; }"); 61 AssertType(z, "string"); 62 AssertType(ki, "string"); 63 AssertType(ku, "string"); [all …]
|
D | stringIndexingResults.ts | 20 declare function AssertType(value:any, type:string):void; 22 [x: string]: string; 30 AssertType(r1, "string"); 31 AssertType(c['y'], "string"); 33 AssertType('y', "string"); 36 AssertType(r2, "string"); 37 AssertType(c['a'], "string"); 39 AssertType('a', "string"); 42 AssertType(r3, "string"); 43 AssertType(c[1], "string"); [all …]
|
D | contextualTypeWithUnionTypeMembers.ts | 20 declare function AssertType(value:any, type:string):void; 24 commonMethodType(a: string): string; 25 commonPropertyType: string; 28 methodOnlyInI1(a: string): string; 29 propertyOnlyInI1: string; 32 commonMethodType(a: string): string; 33 commonPropertyType: string; 36 methodOnlyInI2(a: string): string; 37 propertyOnlyInI2: string; 58 …string; commonMethodType: (string) => string; commonMethodWithTypeParameter: (number) => number; m… [all …]
|
D | typeGuardsInClassAccessors.ts | 20 declare function AssertType(value:any, type:string):void; 28 let strOrNum: string | number; 31 let let1: string | number; 38 num = typeof let1 === "string" && let1.length; // string 39 AssertType(num = typeof let1 === "string" && let1.length, "number"); 41 AssertType(typeof let1 === "string" && let1.length, "number"); 42 AssertType(typeof let1 === "string", "boolean"); 45 AssertType("string", "string"); 49 let let2: string | number; 52 num = typeof let2 === "string" && let2.length; // string [all …]
|
D | additionOperatorWithStringAndEveryType.ts | 20 declare function AssertType(value:any, type:string):void; 32 let d: string; 33 AssertType(d, "string"); 44 let x: string; 45 AssertType(x, "string"); 47 // string could plus every type, and the result is always string 48 // string as left operand 50 AssertType(r1, "string"); 51 AssertType(x + a, "string"); 52 AssertType(x, "string"); [all …]
|
D | typeGuardsInClassMethods.ts | 20 declare function AssertType(value:any, type:string):void; 28 let let1: string | number; 32 constructor(param: string | number) { 34 num = typeof let1 === "string" && let1.length; // string 35 AssertType(num = typeof let1 === "string" && let1.length, "number"); 37 AssertType(typeof let1 === "string" && let1.length, "number"); 38 AssertType(typeof let1 === "string", "boolean"); 41 AssertType("string", "string"); 45 let let2: string | number; 48 num = typeof let2 === "string" && let2.length; // string [all …]
|
D | typeGuardRedundancy.ts | 20 declare function AssertType(value:any, type:string):void; 21 let x: string|number; 24 let r1 = typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed; 26 AssertType(typeof x === "string" && typeof x === "string" ? x.substr : x.toFixed, "union"); 27 AssertType(typeof x === "string" && typeof x === "string", "boolean"); 28 AssertType(typeof x === "string", "boolean"); 31 AssertType("string", "string"); 32 AssertType(typeof x === "string", "boolean"); 34 AssertType(x, "string"); 35 AssertType("string", "string"); [all …]
|
D | newWithSpreadES6.ts | 20 declare function AssertType(value:any, type:string):void; 21 function f(x: number, y: number, ...z: string[]) { 24 function f2(...x: string[]) { 29 new (x: number, y: number, ...z: string[]); 34 constructor(x: number, y: number, ...z: string[]) {} 45 let a: string[]; 46 AssertType(a, "string[]"); 57 let e: { [key: string]: A }; 58 AssertType(e, "{ [string]: A; }"); 59 AssertType(key, "string"); [all …]
|
D | newWithSpreadES5.ts | 20 declare function AssertType(value:any, type:string):void; 21 function f(x: number, y: number, ...z: string[]) { 24 function f2(...x: string[]) {} 28 new (x: number, y: number, ...z: string[]); 33 constructor(x: number, y: number, ...z: string[]) {} 44 let a: string[]; 45 AssertType(a, "string[]"); 56 let e: { [key: string]: A }; 57 AssertType(e, "{ [string]: A; }"); 58 AssertType(key, "string"); [all …]
|
D | privateNameComputedPropertyName1targetesnext.ts | 20 declare function AssertType(value:any, type:string):void; 23 #b: string; 26 readonly #d: string; 32 AssertType(this.#b = 'b', "string"); 33 AssertType(this.#b, "string"); 35 AssertType('b', "string"); 38 AssertType(this.#d = 'd', "string"); 39 AssertType(this.#d, "string"); 41 AssertType('d', "string"); 45 const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' }; [all …]
|
D | privateNameComputedPropertyName1targetes2022.ts | 20 declare function AssertType(value:any, type:string):void; 23 #b: string; 26 readonly #d: string; 32 AssertType(this.#b = 'b', "string"); 33 AssertType(this.#b, "string"); 35 AssertType('b', "string"); 38 AssertType(this.#d = 'd', "string"); 39 AssertType(this.#d, "string"); 41 AssertType('d', "string"); 45 const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' }; [all …]
|
D | privateNameComputedPropertyName1targetes2015.ts | 20 declare function AssertType(value:any, type:string):void; 23 #b: string; 26 readonly #d: string; 32 AssertType(this.#b = 'b', "string"); 33 AssertType(this.#b, "string"); 35 AssertType('b', "string"); 38 AssertType(this.#d = 'd', "string"); 39 AssertType(this.#d, "string"); 41 AssertType('d', "string"); 45 const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' }; [all …]
|
D | parenthesizedTypes.ts | 20 declare function AssertType(value:any, type:string):void; 21 let a: string; 22 AssertType(a, "string"); 24 let a: (string); 25 AssertType(a, "string"); 27 let a: ((string) | string | (((string)))); 28 AssertType(a, "string"); 30 let a: ((((((((((((((((((((((((((((((((((((((((string)))))))))))))))))))))))))))))))))))))))); 31 AssertType(a, "string"); 33 let b: (x: string) => string; [all …]
|
D | overloadResolutionWithAny.ts | 20 declare function AssertType(value:any, type:string):void; 22 AssertType(func, "{ (string): number; (any): string; }"); 24 (s: string): number; 25 AssertType(s, "string"); 27 (s: any): string; 34 AssertType(func, "{ (string): number; (any): string; }"); 35 AssertType("", "string"); 37 func(3); // string 38 AssertType(func(3), "string"); 39 AssertType(func, "{ (string): number; (any): string; }"); [all …]
|
D | conditionalOperatorConditoinIsStringType.ts | 20 declare function AssertType(value:any, type:string):void; 21 //Cond ? Expr1 : Expr2, Cond is of string type, Expr1 and Expr2 have the same type 22 let condString: string; 23 AssertType(condString, "string"); 34 let exprString1: string; 35 AssertType(exprString1, "string"); 49 let exprString2: string; 50 AssertType(exprString2, "string"); 55 //Cond is a string type letiable 58 AssertType(condString, "string"); [all …]
|
D | typeGuardsObjectMethods.ts | 20 declare function AssertType(value:any, type:string):void; 28 let strOrNum: string | number; 31 let let1: string | number; 36 …string | number) { // global lets in function declaration num = typeof let1 === "str… 39 method(param: string | number) { 44 num = typeof let1 === "string" && let1.length; // string 45 AssertType(num = typeof let1 === "string" && let1.length, "number"); 47 AssertType(typeof let1 === "string" && let1.length, "number"); 48 AssertType(typeof let1 === "string", "boolean"); 51 AssertType("string", "string"); [all …]
|
D | functionConstraintSatisfaction3.ts | 20 declare function AssertType(value:any, type:string):void; 23 function foo<T extends (x: string) => string>(x: T): T { 29 (): string; 35 foo: string; 38 let a: { (): string }; 39 AssertType(a, "() => string"); 41 let b: { new (): string }; 42 AssertType(b, "new () => string"); 44 let c: { (): string; (x): string }; 45 AssertType(c, "{ (): string; (any): string; }"); [all …]
|
D | typeGuardsInProperties.ts | 20 declare function AssertType(value:any, type:string):void; 27 let strOrNum: string | number; 31 private pp1: string | number; 32 pp2: string | number; 39 strOrNum = typeof this.pp1 === "string" && this.pp1; // string | number 40 AssertType(strOrNum = typeof this.pp1 === "string" && this.pp1, "string"); 42 AssertType(typeof this.pp1 === "string" && this.pp1, "string"); 43 AssertType(typeof this.pp1 === "string", "boolean"); 47 AssertType("string", "string"); 48 AssertType(this.pp1, "string"); [all …]
|
D | typeGuardNesting.ts | 20 declare function AssertType(value:any, type:string):void; 21 let strOrBool: string|boolean; 24 if ((typeof strOrBool === 'boolean' && !strOrBool) || typeof strOrBool === 'string') { 25 let label: string = (typeof strOrBool === 'string') ? strOrBool : "string"; 26 AssertType(label, "string"); 27 AssertType((typeof strOrBool === 'string') ? strOrBool : "string", "string"); 28 AssertType((typeof strOrBool === 'string'), "boolean"); 29 AssertType(typeof strOrBool === 'string', "boolean"); 32 AssertType('string', "string"); 33 AssertType(strOrBool, "string"); [all …]
|
D | assignmentCompatWithObjectMembersNumericNames.ts | 20 declare function AssertType(value:any, type:string):void; 24 class S { 1: string; } 25 class T { 1.: string; } 32 interface S2 { 1: string; bar?: string } 33 interface T2 { 1.0: string; baz?: string } 40 let a: { 1.: string; bar?: string 41 AssertType(a, "{ 1: string; bar?: string; }"); 43 AssertType(1., "string"); 45 AssertType(bar, "string"); 48 let b: { 1.0: string; baz?: string [all …]
|
/arkcompiler/ets_runtime/test/typeinfer/automatedcases/jsDeclarationsPackageJson/ |
D | index.js | 20 declare function AssertType(value:any, type:string):void; 22 …string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node… 23 …string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node… 25 AssertType("./package.json", "string"); 28 …string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node… 29 …string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node… 30 …string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node…
|