/third_party/typescript/tests/baselines/reference/ |
D | constAssertions.js | 35 declare let d: { [x: string]: string }; 60 declare function id<T>(x: T): T; 199 declare let v1: "abc"; 200 declare let v2: "abc"; 201 declare let v3: 10; 202 declare let v4: -10; 203 declare let v5: 10; 204 declare let v6: 10n; 205 declare let v7: -10n; 206 declare let v8: true; [all …]
|
D | strictFunctionTypes1.js | 2 declare function f1<T>(f1: (x: T) => void, f2: (x: T) => void): (x: T) => void; 3 declare function f2<T>(obj: T, f1: (x: T) => void, f2: (x: T) => void): T; 4 declare function f3<T>(obj: T, f1: (x: T) => void, f2: (f: (x: T) => void) => void): T; 8 declare function f4<T>(f1: Func<T>, f2: Func<T>): Func<T>; 10 declare function fo(x: Object): void; 11 declare function fs(x: string): void; 12 declare function fx(f: (x: "def") => void): void; 19 declare const never: never; 26 declare function foo<T>(a: ReadonlyArray<T>): T; 34 declare function acceptUnion(x: A | number): void; [all …]
|
D | vardecl.js | 12 declare var declaredVar; 13 declare var declareVar2 15 declare var declaredVar3; 16 declare var deckareVarWithType: number; 79 declare var d1, d2; 81 declare var v1; 83 export declare var d1E, d2E; 85 export declare var v1E; 91 declare var da1, da2; 93 declare var dv1; [all …]
|
D | mappedTypesArraysTuples.js | 39 declare function unboxify<T>(x: Boxified<T>): T; 41 declare let x10: [Box<number>, Box<string>, ...Box<boolean>[]]; 44 declare let x11: Box<number>[]; 47 declare let x12: { a: Box<number>, b: Box<string[]> }; 50 declare function nonpartial<T>(x: Partial<T>): T; 52 declare let x20: [number | undefined, string?, ...boolean[]]; 55 declare let x21: (number | undefined)[]; 58 declare let x22: { a: number | undefined, b?: string[] }; 64 declare function all<T extends any[]>(...values: T): Promise<Awaitified<T>>; 89 declare function acceptArray(arr: any[]): void; [all …]
|
D | uniqueSymbolsDeclarations.js | 8 declare const constType: unique symbol; 67 declare const c: C; 90 declare const i: I; 103 declare const l: L; 117 declare const s: unique symbol; 118 declare namespace N { const s: unique symbol; } 119 declare const o: { [s]: "a", [N.s]: "b" }; 120 declare function f<T>(x: T): T; 121 declare function g(x: typeof s): void; 122 declare function g(x: typeof N.s): void; [all …]
|
D | genericRestParameters1.js | 2 declare let f1: (...x: [number, string, boolean]) => void; 3 declare let f2: (x0: number, x1: string, x2: boolean) => void; 8 declare const t3: [number, string, boolean]; 9 declare const t2: [string, boolean]; 10 declare const t1: [boolean]; 11 declare const t0: []; 13 declare const ns: [number, string]; 14 declare const sn: [string, number]; 34 declare function f10<T extends unknown[]>(...args: T): T; 53 declare function f11<T extends (string | number | boolean)[]>(...args: T): T; [all …]
|
D | restTupleElements1.js | 18 declare function assign<T, S extends T>(): void; 49 declare const t: T20; 50 declare const x: number; 58 declare function f0<T, U>(x: [T, ...U[]]): [T, U]; 65 declare function f1(a: [(x: number) => number, ...((x: string) => number)[]]): void; 66 declare function f2(...a: [(x: number) => number, ...((x: string) => number)[]]): void; 102 declare type T00 = [string?]; 103 declare type T01 = [string, string?]; 104 declare type T02 = [string?, string]; 105 declare type T03 = [...string[]]; [all …]
|
D | mappedTypes1.js | 32 declare function f1<T1>(): { [P in keyof T1]: void }; 33 declare function f2<T1 extends string>(): { [P in keyof T1]: void }; 34 declare function f3<T1 extends number>(): { [P in keyof T1]: void }; 35 declare function f4<T1 extends Number>(): { [P in keyof T1]: void }; 50 declare type Item = { variable 55 declare type T00 = { variable 58 declare type T01 = { variable 61 declare type T02 = { variable 64 declare type T03 = { variable 67 declare type T10 = { variable [all …]
|
D | anyAssignabilityInInheritance.js | 11 declare function foo2(x: number): number; 12 declare function foo2(x: any): any; 15 declare function foo3(x: string): string; 16 declare function foo3(x: any): any; 19 declare function foo4(x: boolean): boolean; 20 declare function foo4(x: any): any; 23 declare function foo5(x: Date): Date; 24 declare function foo5(x: any): any; 27 declare function foo6(x: RegExp): RegExp; 28 declare function foo6(x: any): any; [all …]
|
D | intrinsicTypes.js | 51 declare function foo3<T extends string>(x: Uppercase<T>): T; 77 declare type TU1 = Uppercase<'hello'>; 78 declare type TU2 = Uppercase<'foo' | 'bar'>; 79 declare type TU3 = Uppercase<string>; 80 declare type TU4 = Uppercase<any>; 81 declare type TU5 = Uppercase<never>; 82 declare type TU6 = Uppercase<42>; 83 declare type TL1 = Lowercase<'HELLO'>; 84 declare type TL2 = Lowercase<'FOO' | 'BAR'>; 85 declare type TL3 = Lowercase<string>; [all …]
|
D | stringLiteralTypesWithVariousOperators01.js | 60 declare let abc: "ABC"; 61 declare let xyz: "XYZ"; 62 declare let abcOrXyz: "ABC" | "XYZ"; 63 declare let abcOrXyzOrNumber: "ABC" | "XYZ" | number; 64 declare let a: string; 65 declare let b: string; 66 declare let c: string; 67 declare let d: string; 68 declare let e: string; 69 declare let f: string; [all …]
|
D | funcdecl.js | 65 declare function fooAmbient(n: number): string; function 67 declare function overloadAmbient(n: number): string; 68 declare function overloadAmbient(s: string): string; 135 declare function simpleFunc(): string; 136 declare var simpleFuncVar: typeof simpleFunc; 137 declare function anotherFuncNoReturn(): void; 138 declare var anotherFuncNoReturnVar: typeof anotherFuncNoReturn; 139 declare function withReturn(): string; 140 declare var withReturnVar: typeof withReturn; 141 declare function withParams(a: string): string; [all …]
|
D | conditionalTypes1.js | 46 declare function f5<T extends Options, K extends string>(p: K): Extract<T, { k: K }>; 337 declare interface ExtractFooBar<FB extends FooBar> { } 350 declare function assign<T>(o: T, a: RecursivePartial<T>): void; variable 463 declare type T00 = Exclude<"a" | "b" | "c" | "d", "a" | "c" | "f">; 464 declare type T01 = Extract<"a" | "b" | "c" | "d", "a" | "c" | "f">; 465 declare type T02 = Exclude<string | number | (() => void), Function>; 466 declare type T03 = Extract<string | number | (() => void), Function>; 467 declare type T04 = NonNullable<string | number | undefined>; 468 declare type T05 = NonNullable<(() => string) | string[] | null | undefined>; 469 declare function f1<T>(x: T, y: NonNullable<T>): void; variable [all …]
|
D | variadicTuples1.js | 31 declare const sa: string[]; 46 declare function foo1(a: number, b: string, c: boolean, ...d: number[]): void; 57 declare function foo3<T extends unknown[]>(x: number, ...args: [...T, number]): T; 68 declare function ft1<T extends unknown[]>(t: T): T; 69 declare function ft2<T extends unknown[]>(t: T): readonly [...T]; 70 declare function ft3<T extends unknown[]>(t: [...T]): T; 71 declare function ft4<T extends unknown[]>(t: [...T]): readonly [...T]; 119 declare function fm1<T extends unknown[]>(t: Arrayify<[string, number, ...T]>): T; 125 declare function fx1<T extends unknown[]>(a: string, ...args: T): T; 135 declare function fx2<T extends readonly unknown[]>(a: string, ...args: T): T; [all …]
|
D | enumAssignabilityInInheritance.js | 13 declare function foo(x: E): E; 14 declare function foo(x: number): number; 15 declare function foo(x: any): any; 20 declare function foo2(x: string): string; 21 declare function foo2(x: E): E; 25 declare function foo3(x: boolean): boolean; 26 declare function foo3(x: E): E; 30 declare function foo4(x: Date): Date; 31 declare function foo4(x: E): E; 35 declare function foo5(x: RegExp): RegExp; [all …]
|
D | namespacesWithTypeAliasOnlyExportsMerge.js | 5 declare const Q: number; 6 declare namespace Q { 9 declare const try1: Q.A; 10 declare namespace Q2 { 13 declare const try2: Q2.Q.A; 14 declare namespace Q3 { 17 declare const try3: Q3.B; 18 declare namespace Q4 { 21 declare const try4: Q4.default.A; 24 declare namespace NS1 { [all …]
|
D | recursiveTypeReferences1.js | 52 declare function flat<T>(a: RecArray<T>): Array<T>; 53 declare function flat1<T>(a: Array<T | Array<T>>): Array<T> 54 declare function flat2<T>(a: Array<T | Array<T | Array<T>>>): Array<T>; 85 declare function foo1<T>(a: ValueOrArray1<T>): T; 86 declare let ra1: ValueOrArray2<string>; 93 declare function foo2<T>(a: ValueOrArray1<T>): T; 94 declare let ra2: ValueOrArray2<string>; 216 declare type ValueOrArray<T> = T | Array<ValueOrArray<T>>; 217 declare const a0: ValueOrArray<number>; 218 declare const a1: ValueOrArray<number>; [all …]
|
D | ambientDeclarations.js | 3 declare var n; 6 declare var m: string; 9 declare function fn1(); 12 declare function fn2(n: string): number; 15 declare function fn3(n: string): number; 16 declare function fn4(n: number, y: number): string; 19 declare function fn5(x, y?); 20 declare function fn6(e?); 21 declare function fn7(x, y?, ...z); 22 declare function fn8(y?, ...z: number[]); [all …]
|
D | genericRestParameters3.js | 2 declare let f1: (x: string, ...args: [string] | [number, boolean]) => void; 3 declare let f2: (x: string, y: string) => void; 4 declare let f3: (x: string, y: number, z: boolean) => void; 5 declare let f4: (...args: [string, string] | [string, number, boolean]) => void; 7 declare const t1: [string] | [number, boolean]; 8 declare const t2: readonly [string] | [number, boolean]; 9 declare const t3: [string] | readonly [number, boolean]; 10 declare const t4: readonly [string] | readonly [number, boolean]; 34 declare function foo<T extends any[]>(cb: (...args: T) => void): void; 47 declare function baz<T>(...args: CoolArray<T>): void; [all …]
|
D | commentsClass.js | 151 declare class c2 { 153 declare var i2: c2; 154 declare var i2_c: typeof c2; 155 declare class c3 { 159 declare var i3: c3; 160 declare var i3_c: typeof c3; 162 declare class c4 { 166 declare var i4: c4; 167 declare var i4_c: typeof c4; 169 declare class c5 { [all …]
|
D | recursiveConditionalTypes.js | 54 declare function f23<T>(t: TupleOf<T, 3>): T; 64 declare function unbox<T>(box: RecBox<T>): T 73 declare let b1: Box<Box<Box<Box<Box<Box<string>>>>>>; 74 declare let b2: T6; 75 declare let b3: InfBox<string>; 76 declare let b4: { value: { value: { value: typeof b4 }}}; 90 declare function foo<T>(x: Box1<Box1<T>>): T; 92 declare let z: Box2<Box2<string>>; 174 declare type Awaited<T> = T extends null | undefined ? T : T extends PromiseLike<infer U> ? Awaited… 175 declare type MyPromise<T> = { [all …]
|
D | genericContextualTypes1.js | 4 declare function wrap<A, B>(f: (a: A) => B): (a: A) => B; 6 declare function compose<A, B, C>(f: (a: A) => B, g: (b: B) => C): (a: A) => C; 8 declare function list<T>(a: T): T[]; 10 declare function unlist<T>(a: T[]): T; 12 declare function box<V>(x: V): Box<V>; 14 declare function unbox<W>(x: Box<W>): W; 16 declare function map<T, U>(a: T[], f: (x: T) => U): U[]; 18 declare function identity<T>(x: T): T; 20 declare function zip<A, B>(a: A, b: B): [A, B]; 22 declare function flip<X, Y, Z>(f: (x: X, y: Y) => Z): (y: Y, x: X) => Z; [all …]
|
D | noImplicitAnyParametersInAmbientFunctions.js | 3 declare function d_f1(): void; 6 declare function d_f2(x): void; 9 declare function d_f3(x: any): void; 12 declare function d_f4(x, y, z): void; 15 declare function d_f5(x, y: any, z): void; 18 declare function d_f6(...r): void; 21 declare function d_f7(x, ...r): void; 24 declare function d_f8(x1, y1: number): any; 25 declare function d_f8(x2: string, y2): any; 26 declare function d_f8(x3, y3): any; [all …]
|
D | jsDeclarationsJSDocRedirectedLookups.js | 64 /** @type {String} */ declare const a: string; 65 /** @type {Number} */ declare const b: number; 66 /** @type {Boolean} */ declare const c: boolean; 67 /** @type {Void} */ declare const d: void; 68 /** @type {Undefined} */ declare const e: undefined; 69 /** @type {Null} */ declare const f: null; 70 /** @type {Function} */ declare const g: Function; 71 /** @type {function} */ declare const h: Function; 72 /** @type {array} */ declare const i: any[]; 73 /** @type {promise} */ declare const j: Promise<any>; [all …]
|
D | genericRestParameters2.js | 2 declare const t1: [number, string, ...boolean[]]; 3 declare const t2: [string, ...boolean[]]; 4 declare const t3: [...boolean[]]; 5 declare const t4: []; 7 declare let f00: (...x: [number, string, boolean]) => void; 8 declare let f01: (a: number, ...x: [string, boolean]) => void; 9 declare let f02: (a: number, b: string, ...x: [boolean]) => void; 10 declare let f03: (a: number, b: string, c: boolean) => void; 11 declare let f04: (a: number, b: string, c: boolean, ...x: []) => void; 13 declare let f10: (...x: [number, string, ...boolean[]]) => void; [all …]
|