/third_party/typescript/tests/baselines/reference/ |
D | deeplyNestedConditionalTypes.types | 5 T extends 0 ? '0' : 6 T extends 1 ? '1' : 7 T extends 2 ? '2' : 8 T extends 3 ? '3' : 9 T extends 4 ? '4' : 10 T extends 5 ? '5' : 11 T extends 6 ? '6' : 12 T extends 7 ? '7' : 13 T extends 8 ? '8' : 14 T extends 9 ? '9' : [all …]
|
D | recursiveConditionalCrash3.types | 11 export type CanBeExpanded<T extends object = object, D = string> = { 25 interface User extends Base { 36 interface Role extends Base { 48 interface X extends Base { 65 type Join<K, P> = K extends string | number ? 68 P extends string | number ? 69 `${K}${"" extends P ? "" : "."}${P}` 72 type PrefixWith<P, S, C = '.'> = P extends '' ? `${string & S}` : `${string & P}${string & C}${stri… 75 type SplitWithAllPossibleCombinations<S extends string, D extends string> = 78 string extends S ? string : [all …]
|
D | typeParameterUsedAsConstraint.types | 2 class C<T, U extends T> { } 5 class C2<T extends U, U> { } 8 class C3<T extends Date, U extends T> { } 11 class C4<T extends U, U extends Date> { } 14 class C5<T extends U, U extends V, V> { } 17 class C6<T, U extends T, V extends U> { } 20 interface I<T, U extends T> { } 21 interface I2<T extends U, U> { } 22 interface I3<T extends Date, U extends T> { } 23 interface I4<T extends U, U extends Date> { } [all …]
|
D | privacyTypeParameterOfFunctionDeclFile.types | 11 new <T extends privateClass>(): privateClass; // Error 12 <T extends privateClass>(): privateClass; // Error 13 myMethod<T extends privateClass>(): privateClass; // Error 14 >myMethod : <T extends privateClass>() => privateClass 18 new <T extends publicClass>(): publicClass; 19 <T extends publicClass>(): publicClass; 20 myMethod<T extends publicClass>(): publicClass; 21 >myMethod : <T extends publicClass>() => publicClass 25 new <T extends privateClass>(): privateClass; 26 <T extends privateClass>(): privateClass; [all …]
|
D | arrayFakeFlatNoCrashInferenceDeclarations.types | 2 type BadFlatArray<Arr, Depth extends number> = {obj: { 3 …extends readonly (infer InnerArr)[] ? { done: InnerArr; recur: InnerArr extends readonly (infer In… 4 …extends readonly (infer InnerArr)[] ? { done: InnerArr; recur: InnerArr extends readonly (infer In… 9 "recur": Arr extends ReadonlyArray<infer InnerArr> 10 …extends readonly (infer InnerArr)[] ? { done: InnerArr; recur: InnerArr extends readonly (infer In… 17 }[Depth extends -1 ? "done" : "recur"]}["obj"]; 21 declare function flat<A, D extends number = 1>( 22 >flat : <A, D extends number = 1>(arr: A, depth?: D) => BadFlatArray<A, D>[] 33 … : <T>(arr: T[], depth: number) => (T | (T extends readonly (infer InnerArr)[] ? InnerArr | (Inner… 38 >flat(arr, depth) : (T | (T extends readonly (infer InnerArr)[] ? InnerArr | (InnerArr extends read… [all …]
|
D | templateLiteralTypes4.errors.txt | 7 type TNumber0 = "100" extends `${infer N extends number}` ? N : never; // 100 8 type TNumber1 = "-100" extends `${infer N extends number}` ? N : never; // -100 9 type TNumber2 = "1.1" extends `${infer N extends number}` ? N : never; // 1.1 10 … type TNumber3 = "8e-11" extends `${infer N extends number}` ? N : never; // 8e-11 (0.00000000008) 11 …type TNumber4 = "0x10" extends `${infer N extends number}` ? N : never; // number (not round-tripp… 12 …type TNumber5 = "0o10" extends `${infer N extends number}` ? N : never; // number (not round-tripp… 13 …type TNumber6 = "0b10" extends `${infer N extends number}` ? N : never; // number (not round-tripp… 14 …type TNumber7 = "10e2" extends `${infer N extends number}` ? N : never; // number (not round-tripp… 15 type TNumber8 = "abcd" extends `${infer N extends number}` ? N : never; // never 18 type TBigInt0 = "100" extends `${infer N extends bigint}` ? N : never; // 100n [all …]
|
D | typeParameterUsedAsTypeParameterConstraint2.types | 5 function foo<T, U extends T>(x: T, y: U) { 6 >foo : <T, U extends T>(x: T, y: U) => void 10 function bar<V extends T, W extends U>() { 11 >bar : <V extends T, W extends U>() => void 13 function baz<X extends W, Y extends V>(a: X, b: Y): T { 14 >baz : <X extends W, Y extends V>(a: X, b: Y) => T 29 function foo2<U extends T, T>(x: T, y: U) { 30 >foo2 : <U extends T, T>(x: T, y: U) => void 34 function bar<V extends T, W extends U>() { 35 >bar : <V extends T, W extends U>() => void [all …]
|
D | deeplyNestedConditionalTypes.symbols | 6 T extends 0 ? '0' : 9 T extends 1 ? '1' : 12 T extends 2 ? '2' : 15 T extends 3 ? '3' : 18 T extends 4 ? '4' : 21 T extends 5 ? '5' : 24 T extends 6 ? '6' : 27 T extends 7 ? '7' : 30 T extends 8 ? '8' : 33 T extends 9 ? '9' : [all …]
|
D | templateLiteralTypes4.types | 3 type TNumber0 = "100" extends `${infer N extends number}` ? N : never; // 100 6 type TNumber1 = "-100" extends `${infer N extends number}` ? N : never; // -100 9 type TNumber2 = "1.1" extends `${infer N extends number}` ? N : never; // 1.1 12 type TNumber3 = "8e-11" extends `${infer N extends number}` ? N : never; // 8e-11 (0.00000000008) 15 type TNumber4 = "0x10" extends `${infer N extends number}` ? N : never; // number (not round-trippa… 18 type TNumber5 = "0o10" extends `${infer N extends number}` ? N : never; // number (not round-trippa… 21 type TNumber6 = "0b10" extends `${infer N extends number}` ? N : never; // number (not round-trippa… 24 type TNumber7 = "10e2" extends `${infer N extends number}` ? N : never; // number (not round-trippa… 27 type TNumber8 = "abcd" extends `${infer N extends number}` ? N : never; // never 31 type TBigInt0 = "100" extends `${infer N extends bigint}` ? N : never; // 100n [all …]
|
D | typeParameterUsedAsTypeParameterConstraint4.types | 5 class C<T, U extends T, V extends U> { 11 foo<W extends V>(x: W): T { 12 >foo : <W extends V>(x: W) => T 23 interface I<T, U extends T, V extends U> { 33 foo<W extends V>(x: W): T; 34 >foo : <W extends V>(x: W) => T 38 function foo<T, U extends T>(x: T, y: U): V { // error 39 >foo : <T, U extends T>(x: T, y: U) => V 43 function bar<V extends T, W extends U>(): X { // error 44 >bar : <V extends T, W extends U>() => X [all …]
|
D | privacyTypeParameterOfFunction.types | 12 new <T extends privateClass>(): privateClass; 15 <T extends privateClass>(): privateClass; 18 myMethod<T extends privateClass>(): privateClass; 19 >myMethod : <T extends privateClass>() => privateClass 23 new <T extends publicClass>(): publicClass; 24 <T extends publicClass>(): publicClass; 25 myMethod<T extends publicClass>(): publicClass; 26 >myMethod : <T extends publicClass>() => publicClass 30 new <T extends privateClass>(): privateClass; 31 <T extends privateClass>(): privateClass; [all …]
|
D | subtypesOfTypeParameterWithConstraints.types | 11 class D1<T extends U, U> extends C3<T> { 22 class D2<T extends U, U> extends C3<U> { 33 class D3<T extends U, U> extends C3<T> { 44 class D4<T extends U, U> extends C3<U> { 59 class D5<T extends U, U extends V, V> extends C3<T> { 70 class D6<T extends U, U extends V, V> extends C3<U> { 81 class D7<T extends U, U extends V, V> extends C3<V> { 94 class D8<T extends U, U extends V, V> extends C3<T> { 105 class D9<T extends U, U extends V, V> extends C3<U> { 116 class D10<T extends U, U extends V, V> extends C3<V> { [all …]
|
D | typeParameterIndirectlyConstrainedToItself.types | 2 class C<U extends T, T extends U> { } 5 class C2<T extends U, U extends V, V extends T> { } 8 interface I<U extends T, T extends U> { } 9 interface I2<T extends U, U extends V, V extends T> { } 11 function f<U extends T, T extends U>() { } 14 function f2<T extends U, U extends V, V extends T>() { } 20 <U extends T, T extends U>(): void; 21 <T extends U, U extends V, V extends T>(): void; 24 var b = <U extends T, T extends U>() => { } 26 ><U extends T, T extends U>() => { } : <U, T>() => void [all …]
|
D | inferTypesWithExtends1.types | 3 type X1<T extends any[]> = 6 T extends [infer U extends string] ? ["string", U] : 7 T extends [infer U extends number] ? ["number", U] : 20 type X2<T extends (...args: any[]) => void> = 24 T extends (a: infer U extends string) => void ? ["string", U] : 27 T extends (a: infer U extends number) => void ? ["number", U] : 45 type X3<T extends (...args: any[]) => any> = 49 T extends (...args: any[]) => (infer U extends string) ? ["string", U] : 52 T extends (...args: any[]) => (infer U extends number) ? ["number", U] : 67 type X4<T extends new (...args: any[]) => any> = [all …]
|
D | genericCallWithConstraintsTypeArgumentInference.types | 8 class Derived extends Base { bar: string; } 13 class Derived2 extends Derived { baz: string; } 27 function foo<T extends Base>(t: T) { 28 >foo : <T extends Base>(t: T) => T 38 >foo : <T extends Base>(t: T) => T 44 >foo : <T extends Base>(t: T) => T 47 function foo2<T extends Base, U extends Derived>(t: T, u: U) { 48 >foo2 : <T extends Base, U extends Derived>(t: T, u: U) => U 56 function foo2b<T extends Base, U extends Derived>(u: U) { 57 >foo2b : <T extends Base, U extends Derived>(u: U) => T [all …]
|
D | performanceComparisonOfStructurallyIdenticalInterfacesWithGenericSignatures.types | 2 export declare type ThenArg<T> = T extends any ? any : T extends PromiseLike<infer U> ? U : T; 17 await<R extends ThenArg<T>>(): InterfaceA<R>; 18 >await : <R extends ThenArg<T>>() => InterfaceA<R> 20 awaitLatest<R extends ThenArg<T>>(): InterfaceA<R>; 21 >awaitLatest : <R extends ThenArg<T>>() => InterfaceA<R> 23 awaitOrdered<R extends ThenArg<T>>(): InterfaceA<R>; 24 >awaitOrdered : <R extends ThenArg<T>>() => InterfaceA<R> 26 awaitOrdered2<R extends ThenArg<T>>(): InterfaceA<R>; 27 >awaitOrdered2 : <R extends ThenArg<T>>() => InterfaceA<R> 29 awaitOrdered3<R extends ThenArg<T>>(): InterfaceA<R>; [all …]
|
D | deepKeysIndexing.types | 16 O extends DeepObject, 17 K1 extends keyof O 18 > = O[K1] extends object ? Extract<keyof O[K1], string> : never; 23 O extends DeepObject, 24 K1 extends keyof O 25 > = O[K1] extends object ? keyof O[K1] : never; 27 type keys2workaround<O extends DeepObject, K1 extends keyof O> = Extract< 30 O[K1] extends object ? keyof O[K1] : never, 34 interface Foo extends DeepObject { 50 class Bar<O extends DeepObject> { [all …]
|
D | ramdaToolsNoInfinite.types | 6 type Head<T extends any[]> = 9 T extends [any, ...any[]] 13 type Tail<T extends any[]> = 16 ((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) 24 type HasTail<T extends any[]> = 27 T extends ([] | [any]) 34 type Last<T extends any[]> = { 44 HasTail<T> extends true 51 type Length<T extends any[]> = 56 type Prepend<E, T extends any[]> = [all …]
|
D | propertyAccessOnTypeParameterWithConstraints2.types | 12 class B extends A { 24 class C<U extends A, T extends A> { 69 //class C<U extends T, T extends A> { 102 interface I<U extends A, T extends A> { 106 //interface I<U extends T, T extends A> { 131 >a : { <U extends A, T extends A>(): U; <U extends A, T extends A>(x: U): U; <U extends A, T extend… 133 <U extends A, T extends A>(): U; 134 <U extends A, T extends A>(x: U): U; 137 <U extends A, T extends A>(x: U, y: T): U; 142 // <U extends T, T extends A>(): U; [all …]
|
D | recursiveConditionalCrash1.types | 2 type C1<T> = [T extends string ? C1<T> : never][0]; 3 …extends string ? T extends string ? T extends string ? T extends string ? T extends string ? T ext… 5 type C2<T> = [T extends string ? [C2<T>] : never][0]; 6 …extends string ? [T extends string ? [T extends string ? [T extends string ? [T extends string ? […
|
D | nonPrimitiveConstraintOfIndexAccessType.types | 3 function f<T extends object, P extends keyof T>(s: string, tp: T[P]): void { 4 >f : <T extends object, P extends keyof T>(s: string, tp: T[P]) => void 13 function g<T extends null, P extends keyof T>(s: string, tp: T[P]): void { 14 >g : <T extends null, P extends keyof T>(s: string, tp: T[P]) => void 24 function h<T extends undefined, P extends keyof T>(s: string, tp: T[P]): void { 25 >h : <T extends undefined, P extends keyof T>(s: string, tp: T[P]) => void 34 function i<T extends void, P extends keyof T>(s: string, tp: T[P]): void { 35 >i : <T extends void, P extends keyof T>(s: string, tp: T[P]) => void 44 function j<T extends never, P extends keyof T>(s: string, tp: T[P]): void { 45 >j : <T extends never, P extends keyof T>(s: string, tp: T[P]) => void [all …]
|
D | objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.types | 6 class B<T extends U, U extends Array<number>> { 15 class C<T extends U, U extends String> { 24 class D<T extends U, U extends Number> { 33 interface I<T extends U, U extends Number> { 40 new<T extends U, U extends Boolean>(x: T, y: U): string; 45 var a: { new<T extends U, U extends Array<string>>(x: T, y: U): string } 46 >a : new <T extends U, U extends string[]>(x: T, y: U) => string 50 var b = { new<T extends U, U extends RegExp>(x: T, y: U) { return ''; } }; // not a construct signa… 51 >b : { new<T extends U, U extends RegExp>(x: T, y: U): string; } 52 >{ new<T extends U, U extends RegExp>(x: T, y: U) { return ''; } } : { new<T extends U, U extends R… [all …]
|
D | typeParameterConstraints1.types | 2 function foo1<T extends any>(test: T) { } 3 >foo1 : <T extends unknown>(test: T) => void 6 function foo2<T extends number>(test: T) { } 7 >foo2 : <T extends number>(test: T) => void 10 function foo3<T extends string>(test: T) { } 11 >foo3 : <T extends string>(test: T) => void 14 function foo4<T extends Date>(test: T) { } // valid 15 >foo4 : <T extends Date>(test: T) => void 18 function foo5<T extends RegExp>(test: T) { } // valid 19 >foo5 : <T extends RegExp>(test: T) => void [all …]
|
D | ramdaToolsNoInfinite2.types | 11 …extends any> = Extends<A, Function> extends 1 ? 'function' : Extends<A, List> extends 1 ? 'array' … 17 export type Compute<A extends any> = A extends Function ? A : { 29 type __Pick<O extends object, K extends keyof O> = { 35 export type _Pick<O extends object, K extends Key> = __Pick<O, keyof O & K>; 38 …export type Pick<O extends object, K extends Key> = O extends unknown ? _Pick<O, K & keyof O> : ne… 48 export type Keys<O extends object> = UKeys<O>; 66 export type _Omit<O extends object, K extends Key> = _Pick<O, Exclude<Keys<O>, K>>; 69 export type Omit<O extends object, K extends Key> = O extends unknown ? _Omit<O, K> : never; 81 …type AtStrict<O extends object, K extends Key> = [K & keyof O] extends [never] ? never : O[K & key… 84 type AtLoose<O extends object, K extends Key> = O extends unknown ? AtStrict<O, K> : never; [all …]
|
D | privacyInterfaceExtendsClauseDeclFile.types | 9 …interface privateInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPublicModul… 11 …interface privateInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPublicMod… 13 …export interface publicInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPubli… 15 …export interface publicInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPub… 18 …interface privateInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInter… 21 …export interface publicInterfaceImplementingFromPrivateModuleInterface extends privateModule.publi… 25 …export interface publicInterfaceImplementingPrivateAndPublicInterface extends privateInterfaceInPu… 37 …interface privateInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPrivateModu… 39 …interface privateInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPrivateMo… 41 …export interface publicInterfaceImplementingPublicInterfaceInModule extends publicInterfaceInPriva… [all …]
|