/third_party/typescript/tests/baselines/reference/ |
D | inDoesNotOperateOnPrimitiveTypes.js | 3 thing: T, 6 return key in thing; // Ok 10 thing: T, 13 return key in thing; // Ok (as T may be instantiated with a valid type) 17 thing: T, 20 return key in thing; // Error (because all possible instantiations are errors) 23 function union1<T extends string | number, U extends boolean>(thing: T | U) { 24 "key" in thing; // Error (because all possible instantiations are errors) 27 function union2<T extends object, U extends string | number>(thing: T | U) { 28 "key" in thing; // Error (because narrowing is possible) [all …]
|
D | privateNameAndAny.types | 9 method(thing: any) { 10 >method : (thing: any) => void 11 >thing : any 13 thing.#foo; // OK 14 >thing.#foo : any 15 >thing : any 17 thing.#bar; // Error 18 >thing.#bar : any 19 >thing : any 21 thing.#foo(); [all …]
|
D | privateNameAndAny.symbols | 8 method(thing: any) { 10 >thing : Symbol(thing, Decl(privateNameAndAny.ts, 2, 11)) 12 thing.#foo; // OK 13 >thing : Symbol(thing, Decl(privateNameAndAny.ts, 2, 11)) 15 thing.#bar; // Error 16 >thing : Symbol(thing, Decl(privateNameAndAny.ts, 2, 11)) 18 thing.#foo(); 19 >thing : Symbol(thing, Decl(privateNameAndAny.ts, 2, 11)) 21 methodU(thing: unknown) { 23 >thing : Symbol(thing, Decl(privateNameAndAny.ts, 7, 12)) [all …]
|
D | inDoesNotOperateOnPrimitiveTypes.types | 3 >validHasKey : <T extends object>(thing: T, key: string) => boolean 4 ><T extends object>( thing: T, key: string,): boolean => { return key in thing; // Ok} : <T exte… 6 thing: T, 7 >thing : T 13 return key in thing; // Ok 14 >key in thing : boolean 16 >thing : T 21 >alsoValidHasKey : <T>(thing: T, key: string) => boolean 22 ><T>( thing: T, key: string,): boolean => { return key in thing; // Ok (as T may be instantiated… 24 thing: T, [all …]
|
D | privateNameAndAny.js | 4 method(thing: any) { 5 thing.#foo; // OK 6 thing.#bar; // Error 7 thing.#foo(); 9 methodU(thing: unknown) { 10 thing.#foo; 11 thing.#bar; 12 thing.#foo(); 14 methodN(thing: never) { 15 thing.#foo; [all …]
|
D | inDoesNotOperateOnPrimitiveTypes.symbols | 6 thing: T, 7 >thing : Symbol(thing, Decl(inDoesNotOperateOnPrimitiveTypes.ts, 0, 39)) 14 return key in thing; // Ok 16 >thing : Symbol(thing, Decl(inDoesNotOperateOnPrimitiveTypes.ts, 0, 39)) 24 thing: T, 25 >thing : Symbol(thing, Decl(inDoesNotOperateOnPrimitiveTypes.ts, 7, 28)) 32 return key in thing; // Ok (as T may be instantiated with a valid type) 34 >thing : Symbol(thing, Decl(inDoesNotOperateOnPrimitiveTypes.ts, 7, 28)) 42 thing: T, 43 >thing : Symbol(thing, Decl(inDoesNotOperateOnPrimitiveTypes.ts, 14, 50)) [all …]
|
D | typeInferenceTypePredicate2.types | 3 >[true, true, false, null] .filter((thing): thing is boolean => thing !== null) .map(thing =>… 4 >[true, true, false, null] .filter((thing): thing is boolean => thing !== null) .map : <U>(ca… 5 >[true, true, false, null] .filter((thing): thing is boolean => thing !== null) : boolean[] 13 .filter((thing): thing is boolean => thing !== null) 15 >(thing): thing is boolean => thing !== null : (thing: boolean) => thing is boolean 16 >thing : boolean 17 >thing !== null : boolean 18 >thing : boolean 21 .map(thing => thing.toString()); 23 >thing => thing.toString() : (thing: boolean) => string [all …]
|
D | logicalAssignment4(target=es2015).js | 25 function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal… 27 if (thing &&= thing.original) { 28 thing.name; 32 if (thing &&= defaultValue) { 33 thing.name; 38 if (thing ||= defaultValue) { 39 thing.name; 44 if (thing ??= defaultValue) { 45 thing.name; 67 function doSomethingWithAlias(thing, defaultValue) { [all …]
|
D | logicalAssignment4(target=es2020).js | 25 function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal… 27 if (thing &&= thing.original) { 28 thing.name; 32 if (thing &&= defaultValue) { 33 thing.name; 38 if (thing ||= defaultValue) { 39 thing.name; 44 if (thing ??= defaultValue) { 45 thing.name; 67 function doSomethingWithAlias(thing, defaultValue) { [all …]
|
D | controlFlowInstanceOfGuardPrimitives.types | 2 function distinguish(thing: string | number | Date) { 3 >distinguish : (thing: string | number | Date) => void 4 >thing : string | number | Date 6 if (thing instanceof Object) { 7 >thing instanceof Object : boolean 8 >thing : string | number | Date 11 console.log("Aha!! It's a Date in " + thing.getFullYear()); 12 >console.log("Aha!! It's a Date in " + thing.getFullYear()) : void 16 >"Aha!! It's a Date in " + thing.getFullYear() : string 18 >thing.getFullYear() : number [all …]
|
D | logicalAssignment4(target=es2020).types | 76 function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal… 77 >doSomethingWithAlias : (thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal | un… 78 >thing : ThingWithOriginal | undefined 86 if (thing &&= thing.original) { 87 >thing &&= thing.original : ThingWithOriginal | undefined 88 >thing : ThingWithOriginal | undefined 89 >thing.original : ThingWithOriginal | undefined 90 >thing : ThingWithOriginal 93 thing.name; 94 >thing.name : string [all …]
|
D | logicalAssignment4(target=es2015).types | 76 function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal… 77 >doSomethingWithAlias : (thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal | un… 78 >thing : ThingWithOriginal | undefined 86 if (thing &&= thing.original) { 87 >thing &&= thing.original : ThingWithOriginal | undefined 88 >thing : ThingWithOriginal | undefined 89 >thing.original : ThingWithOriginal | undefined 90 >thing : ThingWithOriginal 93 thing.name; 94 >thing.name : string [all …]
|
D | logicalAssignment4(target=esnext).types | 76 function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal… 77 >doSomethingWithAlias : (thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal | un… 78 >thing : ThingWithOriginal | undefined 86 if (thing &&= thing.original) { 87 >thing &&= thing.original : ThingWithOriginal | undefined 88 >thing : ThingWithOriginal | undefined 89 >thing.original : ThingWithOriginal | undefined 90 >thing : ThingWithOriginal 93 thing.name; 94 >thing.name : string [all …]
|
D | logicalAssignment4(target=esnext).js | 25 function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal… 27 if (thing &&= thing.original) { 28 thing.name; 32 if (thing &&= defaultValue) { 33 thing.name; 38 if (thing ||= defaultValue) { 39 thing.name; 44 if (thing ??= defaultValue) { 45 thing.name; 67 function doSomethingWithAlias(thing, defaultValue) { [all …]
|
D | lambdaParamTypes.js | 9 var thing = create([{ name: "bob", id: 24 }, { name: "doug", id: 32 }]); 12 thing.doSomething((x, y) => x.name.charAt(0)); // x.name should be string, so should be OK 13 thing.doSomething((x, y) => x.id.toExponential(0)); // x.id should be string, so should be OK 14 thing.doSomething((x, y) => y.name.charAt(0)); // x.name should be string, so should be OK 15 thing.doSomething((x, y) => y.id.toExponential(0)); // x.id should be string, so should be OK 18 thing.doSomething((x, y) => x.foo); // no such property on x 19 thing.doSomething((x, y) => y.foo); // no such property on y 20 thing.doSomething((x, y) => x.id.charAt(0)); // x.id should be number, no charAt member 21 thing.doSomething((x, y) => x.name.toExponential(0)); // x.name should be string, no toExponential … 22 thing.doSomething((x, y) => y.id.charAt(0)); [all …]
|
D | asyncFunctionReturnExpressionErrorSpans.types | 4 >bar : { baz: { inner: { thing: string; };}; } 7 >baz : { inner: { thing: string;}; } 10 >inner : { thing: string; } 12 thing: string 13 >thing : string 23 … inner: { thing: 1 } } } } : { bar: { … 26 >bar : { baz: { inner: { thing: number; }; }; } 27 … inner: { thing: 1 } } } : { baz: {… 30 >baz : { inner: { thing: number; }; } 31 >{ inner: { thing: 1 } } : { inner: { t… [all …]
|
D | deeplyNestedAssignabilityIssue.types | 9 >something : { another: { more: { thing: A; }; yetstill: { another: A; };… 12 >another : { more: { thing: A;}; yetstill: { another: A;}; } 15 >more : { thing: A; } 17 thing: A; 18 >thing : A 32 … thing: {} }, yetstill: { another: {} } … 35 >something : { another: { more: { thing: {}; }; yetstill: { another: {}; }; }; } 36 … thing: {} }, yetstill: { another: {} }… 39 >another : { more: { thing: {}; }; yetstill: { another: {}; }; } 40 …e: { thing: {} }, yetstill: { another: {} … [all …]
|
D | typeInferenceTypePredicate2.symbols | 3 >[true, true, false, null] .filter((thing): thing is boolean => thing !== null) .map : Symbol… 6 .filter((thing): thing is boolean => thing !== null) 8 >thing : Symbol(thing, Decl(typeInferenceTypePredicate2.ts, 1, 13)) 9 >thing : Symbol(thing, Decl(typeInferenceTypePredicate2.ts, 1, 13)) 10 >thing : Symbol(thing, Decl(typeInferenceTypePredicate2.ts, 1, 13)) 12 .map(thing => thing.toString()); 14 >thing : Symbol(thing, Decl(typeInferenceTypePredicate2.ts, 2, 9)) 15 >thing.toString : Symbol(Object.toString, Decl(lib.es5.d.ts, --, --)) 16 >thing : Symbol(thing, Decl(typeInferenceTypePredicate2.ts, 2, 9))
|
D | logicalAssignment4(target=es2015).symbols | 61 function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal… 63 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 71 if (thing &&= thing.original) { 72 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 73 >thing.original : Symbol(ThingWithOriginal.original, Decl(logicalAssignment4.ts, 19, 17)) 74 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 77 thing.name; 78 >thing.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29)) 79 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 86 if (thing &&= defaultValue) { [all …]
|
D | logicalAssignment4(target=es2020).symbols | 61 function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal… 63 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 71 if (thing &&= thing.original) { 72 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 73 >thing.original : Symbol(ThingWithOriginal.original, Decl(logicalAssignment4.ts, 19, 17)) 74 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 77 thing.name; 78 >thing.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29)) 79 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 86 if (thing &&= defaultValue) { [all …]
|
D | logicalAssignment4(target=esnext).symbols | 61 function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal… 63 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 71 if (thing &&= thing.original) { 72 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 73 >thing.original : Symbol(ThingWithOriginal.original, Decl(logicalAssignment4.ts, 19, 17)) 74 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 77 thing.name; 78 >thing.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29)) 79 >thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30)) 86 if (thing &&= defaultValue) { [all …]
|
D | declarationEmitUnnessesaryTypeReferenceNotAdded.symbols | 19 declare namespace thing { 20 >thing : Symbol(thing, Decl(minimist.d.ts, 2, 1), Decl(minimist.d.ts, 0, 0)) 25 declare function thing(x: any): thing.ParsedArgs; 26 >thing : Symbol(thing, Decl(minimist.d.ts, 2, 1), Decl(minimist.d.ts, 0, 0)) 28 >thing : Symbol(thing, Decl(minimist.d.ts, 2, 1), Decl(minimist.d.ts, 0, 0)) 29 >ParsedArgs : Symbol(thing.ParsedArgs, Decl(minimist.d.ts, 0, 25)) 31 export = thing; 32 >thing : Symbol(thing, Decl(minimist.d.ts, 2, 1), Decl(minimist.d.ts, 0, 0)) 35 declare const thing: any; 36 >thing : Symbol(thing, Decl(process.d.ts, 0, 13)) [all …]
|
D | controlFlowInstanceOfGuardPrimitives.js | 2 function distinguish(thing: string | number | Date) { 3 if (thing instanceof Object) { 4 console.log("Aha!! It's a Date in " + thing.getFullYear()); 5 } else if (typeof thing === 'string') { 6 console.log("Aha!! It's a string of length " + thing.length); 8 console.log("Aha!! It's the number " + thing.toPrecision(3)); 17 function distinguish(thing) { 18 if (thing instanceof Object) { 19 console.log("Aha!! It's a Date in " + thing.getFullYear()); 21 else if (typeof thing === 'string') { [all …]
|
/third_party/typescript/tests/cases/compiler/ |
D | inDoesNotOperateOnPrimitiveTypes.ts | 2 thing: T, 5 return key in thing; // Ok 9 thing: T, 12 return key in thing; // Ok (as T may be instantiated with a valid type) 16 thing: T, 19 return key in thing; // Error (because all possible instantiations are errors) 22 function union1<T extends string | number, U extends boolean>(thing: T | U) { 23 "key" in thing; // Error (because all possible instantiations are errors) 26 function union2<T extends object, U extends string | number>(thing: T | U) { 27 "key" in thing; // Error (because narrowing is possible) [all …]
|
/third_party/typescript/tests/cases/conformance/classes/members/privateNames/ |
D | privateNameAndAny.ts | 6 method(thing: any) { 7 thing.#foo; // OK 8 thing.#bar; // Error 9 thing.#foo(); 11 methodU(thing: unknown) { 12 thing.#foo; 13 thing.#bar; 14 thing.#foo(); 16 methodN(thing: never) { 17 thing.#foo; [all …]
|