feat(49903): omit declare on type declarations (#49925)

This commit is contained in:
Oleksandr T authored and GitHub committed 2022-08-09 16:38:42 -07:00
1 parent b94b299a11
commit af90e703ab
171 files changed
+1857 -1841

No files matched your search

+6 -2
View File
@@ -1217,14 +1217,18 @@ namespace ts {
const previousNeedsDeclare = needsDeclare;
switch (input.kind) {
case SyntaxKind.TypeAliasDeclaration: // Type aliases get `declare`d if need be (for legacy support), but that's all
return cleanup(factory.updateTypeAliasDeclaration(
case SyntaxKind.TypeAliasDeclaration: {
needsDeclare = false;
const clean = cleanup(factory.updateTypeAliasDeclaration(
input,
ensureModifiers(input),
input.name,
visitNodes(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration),
visitNode(input.type, visitDeclarationSubtree, isTypeNode)
));
needsDeclare = previousNeedsDeclare;
return clean;
}
case SyntaxKind.InterfaceDeclaration: {
return cleanup(factory.updateInterfaceDeclaration(
input,
@@ -10,7 +10,7 @@ exports.__esModule = true;
//// [DeclarationErrorsNoEmitOnError.d.ts]
declare type T = {
type T = {
x: number;
};
export interface I {
@@ -122,7 +122,7 @@ export declare function wrapClass(param: any): {
foo(): any;
};
};
export declare type Constructor<T = {}> = new (...args: any[]) => T;
export type Constructor<T = {}> = new (...args: any[]) => T;
export declare function Timestamped<TBase extends Constructor>(Base: TBase): {
new (...args: any[]): {
timestamp: number;
@@ -48,15 +48,15 @@ exports.Broken = Broken;
//// [types.d.ts]
export declare type Merge<T, U> = T & U;
export type Merge<T, U> = T & U;
//// [type-a.d.ts]
export declare type TypeA = {
export type TypeA = {
a: string;
};
//// [type-b.d.ts]
import { Merge } from './types';
import { TypeA } from './type-a';
export declare type TypeB = Merge<TypeA, {
export type TypeB = Merge<TypeA, {
b: string;
}>;
//// [index.d.ts]
@@ -41,13 +41,13 @@ declare const c3: {
get foo(): string;
set foo(value: typeof c3.foo);
};
declare type T1 = {
type T1 = {
get foo(): T1["foo"];
};
declare type T2 = {
type T2 = {
set foo(value: T2["foo"]);
};
declare type T3 = {
type T3 = {
get foo(): string;
set foo(value: T3["foo"]);
};
@@ -20,10 +20,10 @@ function f(m) {
//// [circularBaseTypes.d.ts]
declare type M<T> = {
type M<T> = {
value: T;
};
interface M2 extends M<M3> {
}
declare type M3 = M2[keyof M2];
type M3 = M2[keyof M2];
declare function f(m: M3): any;
@@ -56,10 +56,10 @@ function foo() {
//// [circularIndexedAccessErrors.d.ts]
declare type T1 = {
type T1 = {
x: T1["x"];
};
declare type T2<K extends "x" | "y"> = {
type T2<K extends "x" | "y"> = {
x: T2<K>[K];
y: number;
};
@@ -50,10 +50,10 @@ call(actionB, printFn);
//// [coAndContraVariantInferences.d.ts]
declare type A = {
type A = {
kind: 'a';
};
declare type B = {
type B = {
kind: 'b';
};
declare const a: A;
+115 -115
View File
@@ -460,19 +460,19 @@ assign(a, { o: 2, c: { 0: { a: 2, c: '213123' } } });
//// [conditionalTypes1.d.ts]
declare type T00 = Exclude<"a" | "b" | "c" | "d", "a" | "c" | "f">;
declare type T01 = Extract<"a" | "b" | "c" | "d", "a" | "c" | "f">;
declare type T02 = Exclude<string | number | (() => void), Function>;
declare type T03 = Extract<string | number | (() => void), Function>;
declare type T04 = NonNullable<string | number | undefined>;
declare type T05 = NonNullable<(() => string) | string[] | null | undefined>;
type T00 = Exclude<"a" | "b" | "c" | "d", "a" | "c" | "f">;
type T01 = Extract<"a" | "b" | "c" | "d", "a" | "c" | "f">;
type T02 = Exclude<string | number | (() => void), Function>;
type T03 = Extract<string | number | (() => void), Function>;
type T04 = NonNullable<string | number | undefined>;
type T05 = NonNullable<(() => string) | string[] | null | undefined>;
declare function f1<T>(x: T, y: NonNullable<T>): void;
declare function f2<T extends string | undefined>(x: T, y: NonNullable<T>): void;
declare function f3<T>(x: Partial<T>[keyof T], y: NonNullable<Partial<T>[keyof T]>): void;
declare function f4<T extends {
x: string | undefined;
}>(x: T["x"], y: NonNullable<T["x"]>): void;
declare type Options = {
type Options = {
k: "a";
a: number;
} | {
@@ -482,26 +482,26 @@ declare type Options = {
k: "c";
c: boolean;
};
declare type T10 = Exclude<Options, {
type T10 = Exclude<Options, {
k: "a" | "b";
}>;
declare type T11 = Extract<Options, {
type T11 = Extract<Options, {
k: "a" | "b";
}>;
declare type T12 = Exclude<Options, {
type T12 = Exclude<Options, {
k: "a";
} | {
k: "b";
}>;
declare type T13 = Extract<Options, {
type T13 = Extract<Options, {
k: "a";
} | {
k: "b";
}>;
declare type T14 = Exclude<Options, {
type T14 = Exclude<Options, {
q: "a";
}>;
declare type T15 = Extract<Options, {
type T15 = Extract<Options, {
q: "a";
}>;
declare function f5<T extends Options, K extends string>(p: K): Extract<T, {
@@ -511,27 +511,27 @@ declare let x0: {
k: "a";
a: number;
};
declare type OptionsOfKind<K extends Options["k"]> = Extract<Options, {
type OptionsOfKind<K extends Options["k"]> = Extract<Options, {
k: K;
}>;
declare type T16 = OptionsOfKind<"a" | "b">;
declare type Select<T, K extends keyof T, V extends T[K]> = Extract<T, {
type T16 = OptionsOfKind<"a" | "b">;
type Select<T, K extends keyof T, V extends T[K]> = Extract<T, {
[P in K]: V;
}>;
declare type T17 = Select<Options, "k", "a" | "b">;
declare type TypeName<T> = T extends string ? "string" : T extends number ? "number" : T extends boolean ? "boolean" : T extends undefined ? "undefined" : T extends Function ? "function" : "object";
declare type T20 = TypeName<string | (() => void)>;
declare type T21 = TypeName<any>;
declare type T22 = TypeName<never>;
declare type T23 = TypeName<{}>;
declare type KnockoutObservable<T> = {
type T17 = Select<Options, "k", "a" | "b">;
type TypeName<T> = T extends string ? "string" : T extends number ? "number" : T extends boolean ? "boolean" : T extends undefined ? "undefined" : T extends Function ? "function" : "object";
type T20 = TypeName<string | (() => void)>;
type T21 = TypeName<any>;
type T22 = TypeName<never>;
type T23 = TypeName<{}>;
type KnockoutObservable<T> = {
object: T;
};
declare type KnockoutObservableArray<T> = {
type KnockoutObservableArray<T> = {
array: T;
};
declare type KnockedOut<T> = T extends any[] ? KnockoutObservableArray<T[number]> : KnockoutObservable<T>;
declare type KnockedOutObj<T> = {
type KnockedOut<T> = T extends any[] ? KnockoutObservableArray<T[number]> : KnockoutObservable<T>;
type KnockedOutObj<T> = {
[P in keyof T]: KnockedOut<T[P]>;
};
interface Item {
@@ -539,139 +539,139 @@ interface Item {
name: string;
subitems: string[];
}
declare type KOItem = KnockedOutObj<Item>;
type KOItem = KnockedOutObj<Item>;
interface Part {
id: number;
name: string;
subparts: Part[];
updatePart(newName: string): void;
}
declare type FunctionPropertyNames<T> = {
type FunctionPropertyNames<T> = {
[K in keyof T]: T[K] extends Function ? K : never;
}[keyof T];
declare type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>;
declare type NonFunctionPropertyNames<T> = {
type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>;
type NonFunctionPropertyNames<T> = {
[K in keyof T]: T[K] extends Function ? never : K;
}[keyof T];
declare type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
declare type T30 = FunctionProperties<Part>;
declare type T31 = NonFunctionProperties<Part>;
type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
type T30 = FunctionProperties<Part>;
type T31 = NonFunctionProperties<Part>;
declare function f7<T>(x: T, y: FunctionProperties<T>, z: NonFunctionProperties<T>): void;
declare function f8<T>(x: keyof T, y: FunctionPropertyNames<T>, z: NonFunctionPropertyNames<T>): void;
declare type DeepReadonly<T> = T extends any[] ? DeepReadonlyArray<T[number]> : T extends object ? DeepReadonlyObject<T> : T;
type DeepReadonly<T> = T extends any[] ? DeepReadonlyArray<T[number]> : T extends object ? DeepReadonlyObject<T> : T;
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {
}
declare type DeepReadonlyObject<T> = {
type DeepReadonlyObject<T> = {
readonly [P in NonFunctionPropertyNames<T>]: DeepReadonly<T[P]>;
};
declare function f10(part: DeepReadonly<Part>): void;
declare type ZeroOf<T extends number | string | boolean> = T extends number ? 0 : T extends string ? "" : false;
type ZeroOf<T extends number | string | boolean> = T extends number ? 0 : T extends string ? "" : false;
declare function zeroOf<T extends number | string | boolean>(value: T): ZeroOf<T>;
declare function f20<T extends string>(n: number, b: boolean, x: number | boolean, y: T): void;
declare function f21<T extends number | string>(x: T, y: ZeroOf<T>): void;
declare type T35<T extends {
type T35<T extends {
a: string;
b: number;
}> = T[];
declare type T36<T> = T extends {
type T36<T> = T extends {
a: string;
} ? T extends {
b: number;
} ? T35<T> : never : never;
declare type T37<T> = T extends {
type T37<T> = T extends {
b: number;
} ? T extends {
a: string;
} ? T35<T> : never : never;
declare type T38<T> = [T] extends [{
type T38<T> = [T] extends [{
a: string;
}] ? [T] extends [{
b: number;
}] ? T35<T> : never : never;
declare type Extends<T, U> = T extends U ? true : false;
declare type If<C extends boolean, T, F> = C extends true ? T : F;
declare type Not<C extends boolean> = If<C, false, true>;
declare type And<A extends boolean, B extends boolean> = If<A, B, false>;
declare type Or<A extends boolean, B extends boolean> = If<A, true, B>;
declare type IsString<T> = Extends<T, string>;
declare type Q1 = IsString<number>;
declare type Q2 = IsString<"abc">;
declare type Q3 = IsString<any>;
declare type Q4 = IsString<never>;
declare type N1 = Not<false>;
declare type N2 = Not<true>;
declare type N3 = Not<boolean>;
declare type A1 = And<false, false>;
declare type A2 = And<false, true>;
declare type A3 = And<true, false>;
declare type A4 = And<true, true>;
declare type A5 = And<boolean, false>;
declare type A6 = And<false, boolean>;
declare type A7 = And<boolean, true>;
declare type A8 = And<true, boolean>;
declare type A9 = And<boolean, boolean>;
declare type O1 = Or<false, false>;
declare type O2 = Or<false, true>;
declare type O3 = Or<true, false>;
declare type O4 = Or<true, true>;
declare type O5 = Or<boolean, false>;
declare type O6 = Or<false, boolean>;
declare type O7 = Or<boolean, true>;
declare type O8 = Or<true, boolean>;
declare type O9 = Or<boolean, boolean>;
declare type T40 = never extends never ? true : false;
declare type T41 = number extends never ? true : false;
declare type T42 = never extends number ? true : false;
declare type IsNever<T> = [T] extends [never] ? true : false;
declare type T50 = IsNever<never>;
declare type T51 = IsNever<number>;
declare type T52 = IsNever<any>;
type Extends<T, U> = T extends U ? true : false;
type If<C extends boolean, T, F> = C extends true ? T : F;
type Not<C extends boolean> = If<C, false, true>;
type And<A extends boolean, B extends boolean> = If<A, B, false>;
type Or<A extends boolean, B extends boolean> = If<A, true, B>;
type IsString<T> = Extends<T, string>;
type Q1 = IsString<number>;
type Q2 = IsString<"abc">;
type Q3 = IsString<any>;
type Q4 = IsString<never>;
type N1 = Not<false>;
type N2 = Not<true>;
type N3 = Not<boolean>;
type A1 = And<false, false>;
type A2 = And<false, true>;
type A3 = And<true, false>;
type A4 = And<true, true>;
type A5 = And<boolean, false>;
type A6 = And<false, boolean>;
type A7 = And<boolean, true>;
type A8 = And<true, boolean>;
type A9 = And<boolean, boolean>;
type O1 = Or<false, false>;
type O2 = Or<false, true>;
type O3 = Or<true, false>;
type O4 = Or<true, true>;
type O5 = Or<boolean, false>;
type O6 = Or<false, boolean>;
type O7 = Or<boolean, true>;
type O8 = Or<true, boolean>;
type O9 = Or<boolean, boolean>;
type T40 = never extends never ? true : false;
type T41 = number extends never ? true : false;
type T42 = never extends number ? true : false;
type IsNever<T> = [T] extends [never] ? true : false;
type T50 = IsNever<never>;
type T51 = IsNever<number>;
type T52 = IsNever<any>;
declare function f22<T>(x: T extends (infer U)[] ? U[] : never): void;
declare function f23<T extends string[]>(x: T extends (infer U)[] ? U[] : never): void;
declare type Eq<T, U> = T extends U ? U extends T ? true : false : false;
declare type T60 = Eq<true, true>;
declare type T61 = Eq<true, false>;
declare type T62 = Eq<false, true>;
declare type T63 = Eq<false, false>;
declare type Eq1<T, U> = Eq<T, U> extends false ? false : true;
declare type T70 = Eq1<true, true>;
declare type T71 = Eq1<true, false>;
declare type T72 = Eq1<false, true>;
declare type T73 = Eq1<false, false>;
declare type Eq2<T, U> = Eq<T, U> extends true ? true : false;
declare type T80 = Eq2<true, true>;
declare type T81 = Eq2<true, false>;
declare type T82 = Eq2<false, true>;
declare type T83 = Eq2<false, false>;
declare type Foo<T> = T extends string ? boolean : number;
declare type Bar<T> = T extends string ? boolean : number;
type Eq<T, U> = T extends U ? U extends T ? true : false : false;
type T60 = Eq<true, true>;
type T61 = Eq<true, false>;
type T62 = Eq<false, true>;
type T63 = Eq<false, false>;
type Eq1<T, U> = Eq<T, U> extends false ? false : true;
type T70 = Eq1<true, true>;
type T71 = Eq1<true, false>;
type T72 = Eq1<false, true>;
type T73 = Eq1<false, false>;
type Eq2<T, U> = Eq<T, U> extends true ? true : false;
type T80 = Eq2<true, true>;
type T81 = Eq2<true, false>;
type T82 = Eq2<false, true>;
type T83 = Eq2<false, false>;
type Foo<T> = T extends string ? boolean : number;
type Bar<T> = T extends string ? boolean : number;
declare const convert: <U>(value: Foo<U>) => Bar<U>;
declare type Baz<T> = Foo<T>;
type Baz<T> = Foo<T>;
declare const convert2: <T>(value: Foo<T>) => Foo<T>;
declare function f31<T>(): void;
declare function f32<T, U>(): void;
declare function f33<T, U>(): void;
declare type T90<T> = T extends 0 ? 0 : () => 0;
declare type T91<T> = T extends 0 ? 0 : () => 0;
type T90<T> = T extends 0 ? 0 : () => 0;
type T91<T> = T extends 0 ? 0 : () => 0;
declare const f40: <U>(a: T90<U>) => T91<U>;
declare const f41: <U>(a: T91<U>) => T90<U>;
declare type T92<T> = T extends () => 0 ? () => 1 : () => 2;
declare type T93<T> = T extends () => 0 ? () => 1 : () => 2;
type T92<T> = T extends () => 0 ? () => 1 : () => 2;
type T93<T> = T extends () => 0 ? () => 1 : () => 2;
declare const f42: <U>(a: T92<U>) => T93<U>;
declare const f43: <U>(a: T93<U>) => T92<U>;
declare type T94<T> = T extends string ? true : 42;
declare type T95<T> = T extends string ? boolean : number;
type T94<T> = T extends string ? true : 42;
type T95<T> = T extends string ? boolean : number;
declare const f44: <U>(value: T94<U>) => T95<U>;
declare const f45: <U>(value: T95<U>) => T94<U>;
declare function f50(): void;
declare type OldDiff<T extends keyof any, U extends keyof any> = ({
type OldDiff<T extends keyof any, U extends keyof any> = ({
[P in T]: P;
} & {
[P in U]: never;
} & {
[x: string]: never;
})[T];
declare type NewDiff<T, U> = T extends U ? never : T;
type NewDiff<T, U> = T extends U ? never : T;
interface A {
a: 'a';
}
@@ -683,16 +683,16 @@ interface B2 extends A {
b: 'b';
c: NewDiff<keyof this, keyof A>;
}
declare type c1 = B1['c'];
declare type c2 = B2['c'];
declare type NonFooKeys1<T extends object> = OldDiff<keyof T, 'foo'>;
declare type NonFooKeys2<T extends object> = Exclude<keyof T, 'foo'>;
declare type Test1 = NonFooKeys1<{
type c1 = B1['c'];
type c2 = B2['c'];
type NonFooKeys1<T extends object> = OldDiff<keyof T, 'foo'>;
type NonFooKeys2<T extends object> = Exclude<keyof T, 'foo'>;
type Test1 = NonFooKeys1<{
foo: 1;
bar: 2;
baz: 3;
}>;
declare type Test2 = NonFooKeys2<{
type Test2 = NonFooKeys2<{
foo: 1;
bar: 2;
baz: 3;
@@ -703,13 +703,13 @@ interface Foo2 {
interface Bar2 {
bar: string;
}
declare type FooBar = Foo2 | Bar2;
type FooBar = Foo2 | Bar2;
declare interface ExtractFooBar<FB extends FooBar> {
}
declare type Extracted<Struct> = {
type Extracted<Struct> = {
[K in keyof Struct]: Struct[K] extends FooBar ? ExtractFooBar<Struct[K]> : Struct[K];
};
declare type RecursivePartial<T> = {
type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends Array<any> ? {
[index: number]: RecursivePartial<T[P][0]>;
} : T[P] extends object ? RecursivePartial<T[P]> : T[P];
@@ -723,5 +723,5 @@ declare var a: {
c: string;
}[];
};
declare type Weird1 = (<U extends boolean>(a: U) => never) extends (<U extends true>(a: U) => never) ? never : never;
declare type Weird2 = (<U extends boolean>(a: U) => U) extends (<U extends true>(a: U) => infer T) ? T : never;
type Weird1 = (<U extends boolean>(a: U) => never) extends (<U extends true>(a: U) => never) ? never : never;
type Weird2 = (<U extends boolean>(a: U) => U) extends (<U extends true>(a: U) => infer T) ? T : never;
+35 -35
View File
@@ -343,10 +343,10 @@ declare function getFunction<T>(item: T): Extract<T, Function>;
declare function f10<T>(x: T): void;
declare function f11(x: string | (() => string) | undefined): void;
declare function f12(x: string | (() => string) | undefined): void;
declare type Foo = {
type Foo = {
foo: string;
};
declare type Bar = {
type Bar = {
bar: string;
};
declare function fooBar(x: {
@@ -357,7 +357,7 @@ declare function fooBat(x: {
foo: string;
bat: string;
}): void;
declare type Extract2<T, U, V> = T extends U ? T extends V ? T : never : never;
type Extract2<T, U, V> = T extends U ? T extends V ? T : never : never;
declare function f20<T>(x: Extract<Extract<T, Foo>, Bar>, y: Extract<T, Foo & Bar>, z: Extract2<T, Foo, Bar>): void;
declare function f21<T>(x: Extract<Extract<T, Foo>, Bar>, y: Extract<T, Foo & Bar>, z: Extract2<T, Foo, Bar>): void;
declare class Opt<T> {
@@ -381,79 +381,79 @@ interface B1<T> extends A1<T> {
declare function toString1(value: object | Function): string;
declare function toString2(value: Function): string;
declare function foo<T>(value: T): void;
declare type A<T, V, E> = T extends object ? {
type A<T, V, E> = T extends object ? {
[Q in {
[P in keyof T]: T[P] extends V ? P : P;
}[keyof T]]: A<T[Q], V, E>;
} : T extends V ? T : never;
declare type B<T, V> = T extends object ? {
type B<T, V> = T extends object ? {
[Q in {
[P in keyof T]: T[P] extends V ? P : P;
}[keyof T]]: B<T[Q], V>;
} : T extends V ? T : never;
declare type C<T, V, E> = {
type C<T, V, E> = {
[Q in {
[P in keyof T]: T[P] extends V ? P : P;
}[keyof T]]: C<T[Q], V, E>;
};
declare type A2<T, V, E> = T extends object ? T extends any[] ? T : {
type A2<T, V, E> = T extends object ? T extends any[] ? T : {
[Q in keyof T]: A2<T[Q], V, E>;
} : T;
declare type B2<T, V> = T extends object ? T extends any[] ? T : {
type B2<T, V> = T extends object ? T extends any[] ? T : {
[Q in keyof T]: B2<T[Q], V>;
} : T;
declare type C2<T, V, E> = T extends object ? {
type C2<T, V, E> = T extends object ? {
[Q in keyof T]: C2<T[Q], V, E>;
} : T;
declare type MaybeTrue<T extends {
type MaybeTrue<T extends {
b: boolean;
}> = true extends T["b"] ? "yes" : "no";
declare type T0 = MaybeTrue<{
type T0 = MaybeTrue<{
b: never;
}>;
declare type T1 = MaybeTrue<{
type T1 = MaybeTrue<{
b: false;
}>;
declare type T2 = MaybeTrue<{
type T2 = MaybeTrue<{
b: true;
}>;
declare type T3 = MaybeTrue<{
type T3 = MaybeTrue<{
b: boolean;
}>;
declare type Union = 'a' | 'b';
declare type Product<A extends Union, B> = {
type Union = 'a' | 'b';
type Product<A extends Union, B> = {
f1: A;
f2: B;
};
declare type ProductUnion = Product<'a', 0> | Product<'b', 1>;
declare type UnionComplement = {
type ProductUnion = Product<'a', 0> | Product<'b', 1>;
type UnionComplement = {
[K in Union]: Exclude<Union, K>;
};
declare type UCA = UnionComplement['a'];
declare type UCB = UnionComplement['b'];
declare type UnionComplementComplement = {
type UCA = UnionComplement['a'];
type UCB = UnionComplement['b'];
type UnionComplementComplement = {
[K in Union]: Exclude<Union, Exclude<Union, K>>;
};
declare type UCCA = UnionComplementComplement['a'];
declare type UCCB = UnionComplementComplement['b'];
declare type ProductComplement = {
type UCCA = UnionComplementComplement['a'];
type UCCB = UnionComplementComplement['b'];
type ProductComplement = {
[K in Union]: Exclude<ProductUnion, {
f1: K;
}>;
};
declare type PCA = ProductComplement['a'];
declare type PCB = ProductComplement['b'];
declare type ProductComplementComplement = {
type PCA = ProductComplement['a'];
type PCB = ProductComplement['b'];
type ProductComplementComplement = {
[K in Union]: Exclude<ProductUnion, Exclude<ProductUnion, {
f1: K;
}>>;
};
declare type PCCA = ProductComplementComplement['a'];
declare type PCCB = ProductComplementComplement['b'];
declare type Hmm<T, U extends T> = U extends T ? {
type PCCA = ProductComplementComplement['a'];
type PCCB = ProductComplementComplement['b'];
type Hmm<T, U extends T> = U extends T ? {
[K in keyof U]: number;
} : never;
declare type What = Hmm<{}, {
type What = Hmm<{}, {
a: string;
}>;
declare const w: What;
@@ -462,7 +462,7 @@ declare function exportCommand<TResponse>(functionToCall: IExportCallback<TRespo
interface IExportCallback<TResponse> {
(response: IRootResponse<TResponse>): void;
}
declare type IRootResponse<TResponse> = TResponse extends IRecord ? IRecordResponse<TResponse> : IResponse<TResponse>;
type IRootResponse<TResponse> = TResponse extends IRecord ? IRecordResponse<TResponse> : IResponse<TResponse>;
interface IRecord {
readonly Id: string;
}
@@ -478,12 +478,12 @@ declare type GetPropertyNamesOfType<T, RestrictToType> = {
declare type GetAllPropertiesOfType<T, RestrictToType> = Pick<T, GetPropertyNamesOfType<Required<T>, RestrictToType>>;
declare function ff(x: Foo3<string>): void;
declare function gg<T>(f: (x: Foo3<T>) => void): void;
declare type Foo3<T> = T extends number ? {
type Foo3<T> = T extends number ? {
n: T;
} : {
x: T;
};
declare type Wat<K extends string> = {
type Wat<K extends string> = {
x: {
y: 0;
z: 1;
@@ -493,4 +493,4 @@ declare type Wat<K extends string> = {
[P in K]: 0;
};
} ? true : false;
declare type Huh = Wat<"y">;
type Huh = Wat<"y">;
+3 -3
View File
@@ -304,9 +304,9 @@ declare const ts1: "foo-bar";
declare const ts2: "foo-1" | "foo-0";
declare const ts3: "top-left" | "top-right" | "bottom-left" | "bottom-right";
declare function ff3(x: 'foo' | 'bar', y: object): `foo${string}` | `bar${string}`;
declare type Action = "verify" | "write";
declare type ContentMatch = "match" | "nonMatch";
declare type Outcome = `${Action}_${ContentMatch}`;
type Action = "verify" | "write";
type ContentMatch = "match" | "nonMatch";
type Outcome = `${Action}_${ContentMatch}`;
declare function ff4(verify: boolean, contentMatches: boolean): "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch";
declare function ff5(verify: boolean, contentMatches: boolean): "verify_match" | "verify_nonMatch" | "write_match" | "write_nonMatch";
declare function accessorNames<S extends string>(propName: S): readonly [`get-${S}`, `set-${S}`];
@@ -38,7 +38,7 @@ var x = observable(false);
//// [contextuallyTypedBooleanLiterals.d.ts]
declare type Box<T> = {
type Box<T> = {
get: () => T;
set: (value: T) => void;
};
@@ -35,7 +35,7 @@ const x = { [A]: s => s.length };
//// [contextuallyTypedSymbolNamedProperties.d.ts]
declare const A: unique symbol;
declare const B: unique symbol;
declare type Action = {
type Action = {
type: typeof A;
data: string;
} | {
@@ -664,7 +664,7 @@ declare function f40(obj: {
kind: 'bar';
bar?: number;
}): void;
declare type Data = {
type Data = {
kind: 'str';
payload: string;
} | {
+24 -24
View File
@@ -358,12 +358,12 @@ var BAR_LOOKUP = makeCompleteLookupMapping(ALL_BARS, 'name');
//// [correlatedUnions.d.ts]
declare type RecordMap = {
type RecordMap = {
n: number;
s: string;
b: boolean;
};
declare type UnionRecord<K extends keyof RecordMap = keyof RecordMap> = {
type UnionRecord<K extends keyof RecordMap = keyof RecordMap> = {
[P in K]: {
kind: P;
v: RecordMap[P];
@@ -373,39 +373,39 @@ declare type UnionRecord<K extends keyof RecordMap = keyof RecordMap> = {
declare function processRecord<K extends keyof RecordMap>(rec: UnionRecord<K>): void;
declare const r1: UnionRecord<'n'>;
declare const r2: UnionRecord;
declare type TextFieldData = {
type TextFieldData = {
value: string;
};
declare type SelectFieldData = {
type SelectFieldData = {
options: string[];
selectedValue: string;
};
declare type FieldMap = {
type FieldMap = {
text: TextFieldData;
select: SelectFieldData;
};
declare type FormField<K extends keyof FieldMap> = {
type FormField<K extends keyof FieldMap> = {
type: K;
data: FieldMap[K];
};
declare type RenderFunc<K extends keyof FieldMap> = (props: FieldMap[K]) => void;
declare type RenderFuncMap = {
type RenderFunc<K extends keyof FieldMap> = (props: FieldMap[K]) => void;
type RenderFuncMap = {
[K in keyof FieldMap]: RenderFunc<K>;
};
declare function renderTextField(props: TextFieldData): void;
declare function renderSelectField(props: SelectFieldData): void;
declare const renderFuncs: RenderFuncMap;
declare function renderField<K extends keyof FieldMap>(field: FormField<K>): void;
declare type TypeMap = {
type TypeMap = {
foo: string;
bar: number;
};
declare type Keys = keyof TypeMap;
declare type HandlerMap = {
type Keys = keyof TypeMap;
type HandlerMap = {
[P in Keys]: (x: TypeMap[P]) => void;
};
declare const handlers: HandlerMap;
declare type DataEntry<K extends Keys = Keys> = {
type DataEntry<K extends Keys = Keys> = {
[P in K]: {
type: P;
data: TypeMap[P];
@@ -413,25 +413,25 @@ declare type DataEntry<K extends Keys = Keys> = {
}[K];
declare const data: DataEntry[];
declare function process<K extends Keys>(data: DataEntry<K>[]): void;
declare type LetterMap = {
type LetterMap = {
A: string;
B: number;
};
declare type LetterCaller<K extends keyof LetterMap> = {
type LetterCaller<K extends keyof LetterMap> = {
[P in K]: {
letter: Record<P, LetterMap[P]>;
caller: (x: Record<P, LetterMap[P]>) => void;
};
}[K];
declare function call<K extends keyof LetterMap>({ letter, caller }: LetterCaller<K>): void;
declare type A = {
type A = {
A: string;
};
declare type B = {
type B = {
B: number;
};
declare type ACaller = (a: A) => void;
declare type BCaller = (b: B) => void;
type ACaller = (a: A) => void;
type BCaller = (b: B) => void;
declare const xx: {
letter: A;
caller: ACaller;
@@ -439,7 +439,7 @@ declare const xx: {
letter: B;
caller: BCaller;
};
declare type Ev<K extends keyof DocumentEventMap> = {
type Ev<K extends keyof DocumentEventMap> = {
[P in K]: {
readonly name: P;
readonly once?: boolean;
@@ -459,12 +459,12 @@ declare const scrollEvent: {
readonly callback: (ev: Event) => void;
};
declare function ff1(): void;
declare type ArgMap = {
type ArgMap = {
a: number;
b: string;
};
declare type Func<K extends keyof ArgMap> = (x: ArgMap[K]) => void;
declare type Funcs = {
type Func<K extends keyof ArgMap> = (x: ArgMap[K]) => void;
type Funcs = {
[K in keyof ArgMap]: Func<K>;
};
declare function f1<K extends keyof ArgMap>(funcs: Funcs, key: K, arg: ArgMap[K]): void;
@@ -502,7 +502,7 @@ declare const BAR_LOOKUP: {
readonly name: "b";
};
};
declare type BarLookup = typeof BAR_LOOKUP;
declare type Baz = {
type BarLookup = typeof BAR_LOOKUP;
type Baz = {
[K in keyof BarLookup]: BarLookup[K]['name'];
};
@@ -72,9 +72,9 @@ exports.XmlElement2 = XmlElement2;
//// [declarationEmitClassMixinLocalClassDeclaration.d.ts]
export declare type AnyFunction<Result = any> = (...input: any[]) => Result;
export declare type AnyConstructor<Instance extends object = object, Static extends object = object> = (new (...input: any[]) => Instance) & Static;
declare type MixinHelperFunc = <A extends AnyConstructor, T>(required: [A], arg: T) => T extends AnyFunction<infer M> ? M : never;
export type AnyFunction<Result = any> = (...input: any[]) => Result;
export type AnyConstructor<Instance extends object = object, Static extends object = object> = (new (...input: any[]) => Instance) & Static;
type MixinHelperFunc = <A extends AnyConstructor, T>(required: [A], arg: T) => T extends AnyFunction<infer M> ? M : never;
export declare const Mixin: MixinHelperFunc;
export declare class Base {
}
@@ -44,14 +44,14 @@ declare class C1 {
z: string;
constructor([x, y, z]: string[]);
}
declare type TupleType1 = [string, number, boolean];
type TupleType1 = [string, number, boolean];
declare class C2 {
x: string;
y: number;
z: boolean;
constructor([x, y, z]: TupleType1);
}
declare type ObjType1 = {
type ObjType1 = {
x: number;
y: string;
z: boolean;
@@ -30,8 +30,8 @@ exports.lazyCard = lazyCard;
//// [Types.d.ts]
declare type Suit = 'Hearts' | 'Spades' | 'Clubs' | 'Diamonds';
declare type Rank = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'Jack' | 'Queen' | 'King';
type Suit = 'Hearts' | 'Spades' | 'Clubs' | 'Diamonds';
type Rank = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'Jack' | 'Queen' | 'King';
export { Suit, Rank };
//// [Card.d.ts]
import { Suit, Rank } from './Types';
@@ -21,7 +21,7 @@ exports.A1 = a_1.A;
//// [a.d.ts]
declare type AX = {
type AX = {
readonly A: unique symbol;
};
export declare const A: AX;
@@ -24,7 +24,7 @@ exports.v = v;
//// [0.d.ts]
export declare type Data = string | boolean;
export type Data = string | boolean;
//// [1.d.ts]
declare let v: string | boolean;
export { v };
@@ -21,7 +21,7 @@ exports.v = v;
//// [0.d.ts]
export declare type Data = string | boolean;
export type Data = string | boolean;
//// [1.d.ts]
declare let v: string | boolean;
export { v };
@@ -14,7 +14,7 @@ function returnSomeGlobalValue() {
//// [declarationEmitInferredTypeAlias8.d.ts]
declare type Foo<T> = T | {
type Foo<T> = T | {
x: Foo<T>;
};
declare var x: Foo<number[]>;
@@ -18,7 +18,7 @@ exports.returnSomeGlobalValue = returnSomeGlobalValue;
//// [declarationEmitInferredTypeAlias9.d.ts]
declare type Foo<T> = T | {
type Foo<T> = T | {
x: Foo<T>;
};
export declare function returnSomeGlobalValue(): Foo<number[]>;
@@ -47,8 +47,8 @@ export declare function excludePrivateKeys1<Obj>(obj: Obj): {
export declare function excludePrivateKeys2<Obj>(obj: Obj): {
[K in PublicKeys2<keyof Obj>]: Obj[K];
};
export declare type PublicKeys1<T> = T extends `_${string}` ? never : T;
declare type PublicKeys2<T> = T extends `_${string}` ? never : T;
export type PublicKeys1<T> = T extends `_${string}` ? never : T;
type PublicKeys2<T> = T extends `_${string}` ? never : T;
export {};
//// [api.d.ts]
export declare const dropPrivateProps1: <Obj>(obj: Obj) => { [K in import("./internal").PublicKeys1<keyof Obj>]: Obj[K]; };
@@ -17,4 +17,4 @@ exports.__esModule = true;
//// [Helpers.d.ts]
export declare type StringKeyOf<TObj> = Extract<string, keyof TObj>;
export type StringKeyOf<TObj> = Extract<string, keyof TObj>;
@@ -32,11 +32,11 @@ exports["default"] = { test: types_1["default"] };
//// [types.d.ts]
declare type Fns = Record<string, (...params: unknown[]) => unknown>;
declare type Map<T extends Fns> = {
type Fns = Record<string, (...params: unknown[]) => unknown>;
type Map<T extends Fns> = {
[K in keyof T]: T[K];
};
declare type AllArg<T extends Fns> = {
type AllArg<T extends Fns> = {
[K in keyof T]: Parameters<T[K]>;
};
declare function fn<T extends {
@@ -26,5 +26,5 @@ export declare enum Test {
B = 1,
C = 2
}
export declare type TestType = typeof Test;
export type TestType = typeof Test;
export declare const bar: Test[];
@@ -38,11 +38,11 @@ var c = getNested().a.b.c;
declare const foo: {
test: number;
};
export declare type AliasType = typeof foo;
export type AliasType = typeof foo;
declare const renamed: {
test: number;
};
export declare type AliasType2 = typeof renamed;
export type AliasType2 = typeof renamed;
declare const c: string;
export declare type AliasType3 = typeof c;
export type AliasType3 = typeof c;
export {};
@@ -63,7 +63,7 @@ exports.Api = Api;
//// [http-client.d.ts]
declare type TPromise<ResolveType, RejectType = any> = Omit<Promise<ResolveType>, "then" | "catch"> & {
type TPromise<ResolveType, RejectType = any> = Omit<Promise<ResolveType>, "then" | "catch"> & {
then<TResult1 = ResolveType, TResult2 = never>(onfulfilled?: ((value: ResolveType) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: RejectType) => TResult2 | PromiseLike<TResult2>) | undefined | null): TPromise<TResult1 | TResult2, RejectType>;
catch<TResult = never>(onrejected?: ((reason: RejectType) => TResult | PromiseLike<TResult>) | undefined | null): TPromise<ResolveType | TResult, RejectType>;
};
@@ -32,8 +32,8 @@ exports.createClient = createClient;
//// [declarationEmitShadowingInferNotRenamed.d.ts]
declare type Client = string;
declare type UpdatedClient<C> = C & {
type Client = string;
type UpdatedClient<C> = C & {
foo: number;
};
export declare const createClient: <D extends Record<string, new (...args: any[]) => Client> | (new (...args: any[]) => Client)>(clientDef: D) => D extends new (...args: any[]) => infer C ? UpdatedClient<C> : { [K in keyof D]: D[K] extends new (...args: any[]) => infer C_1 ? UpdatedClient<C_1> : never; };
@@ -42,8 +42,8 @@ exports.NotificationScenario = (0, index_1.test)(NotificationAPIUtils_1.getNotif
//// [NotificationAPIUtils.d.ts]
export declare type NotificationRequest = {};
export declare type NotificationResponse = {};
export type NotificationRequest = {};
export type NotificationResponse = {};
export declare function getNotification(): NotificationResponse;
//// [NotificationStore.d.ts]
export declare const NotificationScenario: () => import("../API/NotificationAPIUtils").NotificationResponse;
@@ -12,6 +12,6 @@ exports.y = y;
//// [declarationEmitTypeAliasWithTypeParameters1.d.ts]
export declare type Bar<X, Y> = () => [X, Y];
export declare type Foo<Y> = Bar<any, Y>;
export type Bar<X, Y> = () => [X, Y];
export type Foo<Y> = Bar<any, Y>;
export declare const y: (x: Foo<string>) => number;
@@ -13,7 +13,7 @@ exports.y = y;
//// [declarationEmitTypeAliasWithTypeParameters2.d.ts]
export declare type Bar<X, Y, Z> = () => [X, Y, Z];
export declare type Baz<M, N> = Bar<M, string, N>;
export declare type Baa<Y> = Baz<boolean, Y>;
export type Bar<X, Y, Z> = () => [X, Y, Z];
export type Baz<M, N> = Bar<M, string, N>;
export type Baa<Y> = Baz<boolean, Y>;
export declare const y: (x: Baa<number>) => number;
@@ -14,7 +14,7 @@ function bar() {
//// [declarationEmitTypeAliasWithTypeParameters3.d.ts]
declare type Foo<T> = {
type Foo<T> = {
foo<U>(): Foo<U>;
};
declare function bar(): Foo<number>;
@@ -16,8 +16,8 @@ function foo() {
//// [declarationEmitTypeAliasWithTypeParameters4.d.ts]
declare type Foo<T, Y> = {
type Foo<T, Y> = {
foo<U, J>(): Foo<U, J>;
};
declare type SubFoo<R> = Foo<string, R>;
type SubFoo<R> = Foo<string, R>;
declare function foo(): SubFoo<number>;
@@ -18,8 +18,8 @@ function foo() {
//// [declarationEmitTypeAliasWithTypeParameters5.d.ts]
declare type Foo<T, Y> = {
type Foo<T, Y> = {
foo<U, J>(): Foo<U, J>;
};
export declare type SubFoo<R> = Foo<string, R>;
export type SubFoo<R> = Foo<string, R>;
export {};
@@ -16,8 +16,8 @@ function foo() {
//// [declarationEmitTypeAliasWithTypeParameters6.d.ts]
declare type Foo<T, Y> = {
type Foo<T, Y> = {
foo<U, J>(): Foo<U, J>;
};
declare type SubFoo<R, S> = Foo<S, R>;
type SubFoo<R, S> = Foo<S, R>;
declare function foo(): SubFoo<number, string>;
@@ -35,7 +35,7 @@ exports.obj = (_a = {},
//// [other.d.ts]
declare type Experiment<Name> = {
type Experiment<Name> = {
name: Name;
};
declare const _default: Experiment<"foo">;
@@ -35,7 +35,7 @@ exports.obj = (_a = {},
//// [other.d.ts]
declare type Experiment<Name> = {
type Experiment<Name> = {
name: Name;
};
declare const _default: Experiment<"foo">;
@@ -55,12 +55,12 @@ exports.mixin = mixin;
//// [dom.d.ts]
export declare type DOMNode = Node;
export type DOMNode = Node;
//// [custom.d.ts]
export declare type Node = {};
export type Node = {};
//// [index.d.ts]
import { DOMNode } from './dom';
declare type Constructor = new (...args: any[]) => any;
type Constructor = new (...args: any[]) => any;
export declare const mixin: (Base: Constructor) => {
new (...args: any[]): {
[x: string]: any;
@@ -58,7 +58,7 @@ export { Hash, StringHash, StringHash2 };
interface Hash<T> {
[key: string]: T;
}
declare type StringHash = Hash<string>;
type StringHash = Hash<string>;
interface StringHash2 extends Hash<string> {
}
//// [a.d.ts]
@@ -92,8 +92,8 @@ void p3.result.three;
//// [declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.d.ts]
export declare type Key<U> = keyof U;
export declare type Value<K extends Key<U>, U> = U[K];
export type Key<U> = keyof U;
export type Value<K extends Key<U>, U> = U[K];
export declare const updateIfChanged: <T>(t: T) => (<K extends keyof T>(key: K) => (<K_1 extends keyof Value<K, T>>(key: K_1) => (<K_2 extends keyof Value<K_1, Value<K, T>>>(key: K_2) => (<K_3 extends keyof Value<K_2, Value<K_1, Value<K, T>>>>(key: K_3) => (<K_4 extends keyof Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>(key: K_4) => (<K_5 extends keyof Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>(key: K_5) => (<K_6 extends keyof Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>(key: K_6) => (<K_7 extends keyof Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>(key: K_7) => (<K_8 extends keyof Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>(key: K_8) => (<K_9 extends keyof Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>(key: K_9) => (<K_10 extends keyof Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>>(key: K_10) => any & {
map: (updater: (u: Value<K_10, Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>>) => Value<K_10, Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>>) => T;
set: (newU: Value<K_10, Value<K_9, Value<K_8, Value<K_7, Value<K_6, Value<K_5, Value<K_4, Value<K_3, Value<K_2, Value<K_1, Value<K, T>>>>>>>>>>>) => T;
@@ -111,6 +111,6 @@ type T1 = Foo<any>;
//// [deeplyNestedConditionalTypes.d.ts]
declare type Foo<T> = T extends 0 ? '0' : T extends 1 ? '1' : T extends 2 ? '2' : T extends 3 ? '3' : T extends 4 ? '4' : T extends 5 ? '5' : T extends 6 ? '6' : T extends 7 ? '7' : T extends 8 ? '8' : T extends 9 ? '9' : T extends 10 ? '10' : T extends 11 ? '11' : T extends 12 ? '12' : T extends 13 ? '13' : T extends 14 ? '14' : T extends 15 ? '15' : T extends 16 ? '16' : T extends 17 ? '17' : T extends 18 ? '18' : T extends 19 ? '19' : T extends 20 ? '20' : T extends 21 ? '21' : T extends 22 ? '22' : T extends 23 ? '23' : T extends 24 ? '24' : T extends 25 ? '25' : T extends 26 ? '26' : T extends 27 ? '27' : T extends 28 ? '28' : T extends 29 ? '29' : T extends 30 ? '30' : T extends 31 ? '31' : T extends 32 ? '32' : T extends 33 ? '33' : T extends 34 ? '34' : T extends 35 ? '35' : T extends 36 ? '36' : T extends 37 ? '37' : T extends 38 ? '38' : T extends 39 ? '39' : T extends 40 ? '40' : T extends 41 ? '41' : T extends 42 ? '42' : T extends 43 ? '43' : T extends 44 ? '44' : T extends 45 ? '45' : T extends 46 ? '46' : T extends 47 ? '47' : T extends 48 ? '48' : T extends 49 ? '49' : T extends 50 ? '50' : T extends 51 ? '51' : T extends 52 ? '52' : T extends 53 ? '53' : T extends 54 ? '54' : T extends 55 ? '55' : T extends 56 ? '56' : T extends 57 ? '57' : T extends 58 ? '58' : T extends 59 ? '59' : T extends 60 ? '60' : T extends 61 ? '61' : T extends 62 ? '62' : T extends 63 ? '63' : T extends 64 ? '64' : T extends 65 ? '65' : T extends 66 ? '66' : T extends 67 ? '67' : T extends 68 ? '68' : T extends 69 ? '69' : T extends 70 ? '70' : T extends 71 ? '71' : T extends 72 ? '72' : T extends 73 ? '73' : T extends 74 ? '74' : T extends 75 ? '75' : T extends 76 ? '76' : T extends 77 ? '77' : T extends 78 ? '78' : T extends 79 ? '79' : T extends 80 ? '80' : T extends 81 ? '81' : T extends 82 ? '82' : T extends 83 ? '83' : T extends 84 ? '84' : T extends 85 ? '85' : T extends 86 ? '86' : T extends 87 ? '87' : T extends 88 ? '88' : T extends 89 ? '89' : T extends 90 ? '90' : T extends 91 ? '91' : T extends 92 ? '92' : T extends 93 ? '93' : T extends 94 ? '94' : T extends 95 ? '95' : T extends 96 ? '96' : T extends 97 ? '97' : T extends 98 ? '98' : T extends 99 ? '99' : never;
declare type T0 = Foo<99>;
declare type T1 = Foo<any>;
type Foo<T> = T extends 0 ? '0' : T extends 1 ? '1' : T extends 2 ? '2' : T extends 3 ? '3' : T extends 4 ? '4' : T extends 5 ? '5' : T extends 6 ? '6' : T extends 7 ? '7' : T extends 8 ? '8' : T extends 9 ? '9' : T extends 10 ? '10' : T extends 11 ? '11' : T extends 12 ? '12' : T extends 13 ? '13' : T extends 14 ? '14' : T extends 15 ? '15' : T extends 16 ? '16' : T extends 17 ? '17' : T extends 18 ? '18' : T extends 19 ? '19' : T extends 20 ? '20' : T extends 21 ? '21' : T extends 22 ? '22' : T extends 23 ? '23' : T extends 24 ? '24' : T extends 25 ? '25' : T extends 26 ? '26' : T extends 27 ? '27' : T extends 28 ? '28' : T extends 29 ? '29' : T extends 30 ? '30' : T extends 31 ? '31' : T extends 32 ? '32' : T extends 33 ? '33' : T extends 34 ? '34' : T extends 35 ? '35' : T extends 36 ? '36' : T extends 37 ? '37' : T extends 38 ? '38' : T extends 39 ? '39' : T extends 40 ? '40' : T extends 41 ? '41' : T extends 42 ? '42' : T extends 43 ? '43' : T extends 44 ? '44' : T extends 45 ? '45' : T extends 46 ? '46' : T extends 47 ? '47' : T extends 48 ? '48' : T extends 49 ? '49' : T extends 50 ? '50' : T extends 51 ? '51' : T extends 52 ? '52' : T extends 53 ? '53' : T extends 54 ? '54' : T extends 55 ? '55' : T extends 56 ? '56' : T extends 57 ? '57' : T extends 58 ? '58' : T extends 59 ? '59' : T extends 60 ? '60' : T extends 61 ? '61' : T extends 62 ? '62' : T extends 63 ? '63' : T extends 64 ? '64' : T extends 65 ? '65' : T extends 66 ? '66' : T extends 67 ? '67' : T extends 68 ? '68' : T extends 69 ? '69' : T extends 70 ? '70' : T extends 71 ? '71' : T extends 72 ? '72' : T extends 73 ? '73' : T extends 74 ? '74' : T extends 75 ? '75' : T extends 76 ? '76' : T extends 77 ? '77' : T extends 78 ? '78' : T extends 79 ? '79' : T extends 80 ? '80' : T extends 81 ? '81' : T extends 82 ? '82' : T extends 83 ? '83' : T extends 84 ? '84' : T extends 85 ? '85' : T extends 86 ? '86' : T extends 87 ? '87' : T extends 88 ? '88' : T extends 89 ? '89' : T extends 90 ? '90' : T extends 91 ? '91' : T extends 92 ? '92' : T extends 93 ? '93' : T extends 94 ? '94' : T extends 95 ? '95' : T extends 96 ? '96' : T extends 97 ? '97' : T extends 98 ? '98' : T extends 99 ? '99' : never;
type T0 = Foo<99>;
type T1 = Foo<any>;
@@ -26,8 +26,8 @@ var BufferPool = /** @class */ (function () {
//// [deeplyNestedConstraints.d.ts]
declare type Enum = Record<string, string | number>;
declare type TypeMap<E extends Enum> = {
type Enum = Record<string, string | number>;
type TypeMap<E extends Enum> = {
[key in E[keyof E]]: number | boolean | string | number[];
};
declare class BufferPool<E extends Enum, M extends TypeMap<E>> {
@@ -124,7 +124,7 @@ declare function foo1(x: string | undefined, b: number): void;
declare function foo2(x: string | undefined, b: number): void;
declare function foo3(x: string | undefined, b: number): void;
declare function foo4(x: string | undefined, b: number): void;
declare type OptionalNullableString = string | null | undefined;
type OptionalNullableString = string | null | undefined;
declare function allowsNull(val?: OptionalNullableString): void;
declare function removeUndefinedButNotFalse(x?: boolean): false | undefined;
declare const cond: boolean;
@@ -38,17 +38,17 @@ function f3(x) {
//// [deferredLookupTypeResolution.d.ts]
declare type StringContains<S extends string, L extends string> = ({
type StringContains<S extends string, L extends string> = ({
[K in S]: 'true';
} & {
[key: string]: 'false';
})[L];
declare type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
declare type First<T> = ObjectHasKey<T, '0'>;
declare type T1 = ObjectHasKey<{
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
type First<T> = ObjectHasKey<T, '0'>;
type T1 = ObjectHasKey<{
a: string;
}, 'a'>;
declare type T2 = ObjectHasKey<{
type T2 = ObjectHasKey<{
a: string;
}, 'b'>;
declare function f1<A extends string, B extends string>(a: A, b: B): {
@@ -28,28 +28,28 @@ type DeepOK<T> = { true: 'true', otherwise: 'false' }[Juxtapose<T>];
//// [deferredLookupTypeResolution2.d.ts]
declare type StringContains<S extends string, L extends string> = ({
type StringContains<S extends string, L extends string> = ({
[K in S]: 'true';
} & {
[key: string]: 'false';
})[L];
declare type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
declare type A<T> = ObjectHasKey<T, '0'>;
declare type B = ObjectHasKey<[string, number], '1'>;
declare type C = ObjectHasKey<[string, number], '2'>;
declare type D = A<[string]>;
declare type E<T> = {
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
type A<T> = ObjectHasKey<T, '0'>;
type B = ObjectHasKey<[string, number], '1'>;
type C = ObjectHasKey<[string, number], '2'>;
type D = A<[string]>;
type E<T> = {
true: 'true';
}[ObjectHasKey<T, '1'>];
declare type Juxtapose<T> = ({
type Juxtapose<T> = ({
true: 'otherwise';
} & {
[k: string]: 'true';
})[ObjectHasKey<T, '1'>];
declare type DeepError<T> = {
type DeepError<T> = {
true: 'true';
}[Juxtapose<T>];
declare type DeepOK<T> = {
type DeepOK<T> = {
true: 'true';
otherwise: 'false';
}[Juxtapose<T>];
@@ -652,7 +652,7 @@ const fa3 = (guard, value) => {
//// [dependentDestructuredVariables.d.ts]
declare type Action = {
type Action = {
kind: 'A';
payload: number;
} | {
@@ -662,7 +662,7 @@ declare type Action = {
declare function f10({ kind, payload }: Action): void;
declare function f11(action: Action): void;
declare function f12({ kind, payload }: Action): void;
declare type Action2 = {
type Action2 = {
kind: 'A';
payload: number | undefined;
} | {
@@ -673,7 +673,7 @@ declare function f20({ kind, payload }: Action2): void;
declare function f21(action: Action2): void;
declare function f22(action: Action2): void;
declare function f23({ kind, payload }: Action2): void;
declare type Foo = {
type Foo = {
kind: 'A';
isA: true;
} | {
@@ -684,7 +684,7 @@ declare type Foo = {
isA: false;
};
declare function f30({ kind, isA }: Foo): void;
declare type Args = ['A', number] | ['B', string];
type Args = ['A', number] | ['B', string];
declare function f40(...[kind, data]: Args): void;
interface A<T> {
variant: 'a';
@@ -694,11 +694,11 @@ interface B<T> {
variant: 'b';
value: Array<T>;
}
declare type AB<T> = A<T> | B<T>;
type AB<T> = A<T> | B<T>;
declare function printValue<T>(t: T): void;
declare function printValueList<T>(t: Array<T>): void;
declare function unrefined1<T>(ab: AB<T>): void;
declare type Action3 = {
type Action3 = {
type: 'add';
payload: {
toAdd: number;
@@ -716,7 +716,7 @@ declare function f50(cb: (...args: Args) => void): void;
declare const f51: (...args: ['A', number] | ['B', string]) => void;
declare const f52: (...args: ['A', number] | ['B']) => void;
declare function readFile(path: string, callback: (...args: [err: null, data: unknown[]] | [err: Error, data: undefined]) => void): void;
declare type ReducerArgs = ["add", {
type ReducerArgs = ["add", {
a: number;
b: number;
}] | ["concat", {
@@ -724,7 +724,7 @@ declare type ReducerArgs = ["add", {
secondArr: any[];
}];
declare const reducer: (...args: ReducerArgs) => void;
declare type FooMethod = {
type FooMethod = {
method(...args: [
type: "str",
cb: (e: string) => void
@@ -734,7 +734,7 @@ declare type FooMethod = {
]): void;
};
declare let fooM: FooMethod;
declare type FooAsyncMethod = {
type FooAsyncMethod = {
method(...args: [
type: "str",
cb: (e: string) => void
@@ -744,7 +744,7 @@ declare type FooAsyncMethod = {
]): Promise<any>;
};
declare let fooAsyncM: FooAsyncMethod;
declare type FooGenMethod = {
type FooGenMethod = {
method(...args: [
type: "str",
cb: (e: string) => void
@@ -754,7 +754,7 @@ declare type FooGenMethod = {
]): Generator<any, any, any>;
};
declare let fooGenM: FooGenMethod;
declare type FooAsyncGenMethod = {
type FooAsyncGenMethod = {
method(...args: [
type: "str",
cb: (e: string) => void
@@ -764,7 +764,7 @@ declare type FooAsyncGenMethod = {
]): AsyncGenerator<any, any, any>;
};
declare let fooAsyncGenM: FooAsyncGenMethod;
declare type Func = <T extends ["a", number] | ["b", string]>(...args: T) => void;
type Func = <T extends ["a", number] | ["b", string]>(...args: T) => void;
declare const f60: Func;
declare function foo({ value1, test1, test2, test3, test4, test5, test6, test7, test8, test9 }: {
value1: any;
@@ -39,31 +39,31 @@ interface b {
interface c {
c: any;
}
declare type T1 = ([a, b, c]);
declare type F1 = ([a, b, c]: [any, any, any]) => void;
declare type T2 = ({
type T1 = ([a, b, c]);
type F1 = ([a, b, c]: [any, any, any]) => void;
type T2 = ({
a: any;
});
declare type F2 = ({ a }: {
type F2 = ({ a }: {
a: any;
}) => void;
declare type T3 = ([{
type T3 = ([{
a: b;
}, {
b: a;
}]);
declare type F3 = ([{ a }, { b }]: [{
type F3 = ([{ a }, { b }]: [{
a: any;
}, {
b: any;
}]) => void;
declare type T4 = ([{
type T4 = ([{
a: [b, c];
}]);
declare type F4 = ([{ a: [b, c] }]: [{
type F4 = ([{ a: [b, c] }]: [{
a: [any, any];
}]) => void;
declare type C1 = new ([{ a: [b, c] }]: [{
type C1 = new ([{ a: [b, c] }]: [{
a: [any, any];
}]) => void;
declare var v1: ([a, b, c]: [any, any, any]) => string;
@@ -45,7 +45,7 @@ interface IData<MenuItemVariant extends ListItemVariant = ListItemVariant.OneLin
menuItemsVariant?: MenuItemVariant;
}
declare function Menu<MenuItemVariant extends ListItemVariant = ListItemVariant.OneLine>(data: IData<MenuItemVariant>): any;
declare type IListItemData = {
type IListItemData = {
variant: ListItemVariant.Avatar;
} | {
variant: ListItemVariant.OneLine;
@@ -109,7 +109,7 @@ export declare class ClassMemberVisibility {
get [z](): number;
set [w](value: number);
}
export declare type ObjectTypeVisibility = {
export type ObjectTypeVisibility = {
[x]: number;
[y](): number;
};
@@ -117,7 +117,7 @@ export declare class FooItem {
foo(): void;
name?: string;
}
export declare type Constructor<T> = new (...args: any[]) => T;
export type Constructor<T> = new (...args: any[]) => T;
export declare function WithTags<T extends Constructor<FooItem>>(Base: T): {
new (...args: any[]): {
tags(): void;
@@ -60,5 +60,5 @@ export declare class C2 implements I2 {
}
//// [client.d.ts]
import { C, I } from "./server";
export declare type cValInterface = I;
export type cValInterface = I;
export declare var cVal: C;
@@ -501,7 +501,7 @@ interface Triangle {
kind: "triangle";
side: number;
}
declare type Shape = Square | Rectangle | Circle | Triangle;
type Shape = Square | Rectangle | Circle | Triangle;
declare function area(s: Shape): number;
declare function areaWrapped(s: Shape): number;
declare enum MyEnum {
@@ -524,7 +524,7 @@ interface Circle2 {
kind: "circle";
radius: number;
}
declare type Shape2 = Square2 | Circle2;
type Shape2 = Square2 | Circle2;
declare function withDefault(s1: Shape2, s2: Shape2): string;
declare function withoutDefault(s1: Shape2, s2: Shape2): string;
declare function test4(value: 1 | 2): string;
@@ -537,13 +537,13 @@ declare const zoo: {
} | undefined;
declare function expression(): Animal;
declare function foo(): void;
declare type O = {
type O = {
a: number;
b: number;
};
declare type K = keyof O | 'c';
type K = keyof O | 'c';
declare function ff(o: O, k: K): number;
declare type A = {
type A = {
kind: "abc";
} | {
kind: "def";
@@ -113,7 +113,7 @@ var AnotherMixedClass = (0, MixinClass_1.MyMixin)(FinalClass_1.MyExtendedClass);
//// [BaseClass.d.ts]
export declare type Constructor<T> = new (...args: any[]) => T;
export type Constructor<T> = new (...args: any[]) => T;
export declare class MyBaseClass<T> {
baseProperty: string;
constructor(value: T);
@@ -73,7 +73,7 @@ var fn = function (a) { return a; };
//// [genericContextualTypes1.d.ts]
declare type Box<T> = {
type Box<T> = {
value: T;
};
declare function wrap<A, B>(f: (a: A) => B): (a: A) => B;
@@ -103,5 +103,5 @@ declare const f23: <A>(a: A[]) => Box<A>[];
declare const f30: (a: string[]) => string[];
declare const f31: <T extends Box<number>>(a: T[]) => T[];
declare const f40: <A, B>(b: B, a: A) => [A, B];
declare type fn = <A>(a: A) => A;
type fn = <A>(a: A) => A;
declare const fn: fn;
+5 -5
View File
@@ -1000,18 +1000,18 @@ declare class Derived03 extends Base02 {
}
declare const Derived03c00: Derived03;
declare const Derived03c01: number;
declare type DerivedProps = keyof Derived03;
declare type t00<T = number> = {
type DerivedProps = keyof Derived03;
type t00<T = number> = {
a: T;
};
declare const t00c00: number;
declare const t00c01: number;
declare type t01<T, U = T> = {
type t01<T, U = T> = {
a: [T, U];
};
declare const t01c00: [number, number];
declare const t01c01: [number, string];
declare type t02<T extends number, U = T> = {
type t02<T extends number, U = T> = {
a: [T, U];
};
declare const t02c00: [number, number];
@@ -1019,7 +1019,7 @@ declare const t02c01: [1, 1];
declare const t02c02: [number, number];
declare const t02c03: [1, number];
declare const t02c04: [number, 1];
declare type t03<T extends number, U extends T = T> = {
type t03<T extends number, U extends T = T> = {
a: [T, U];
};
declare const t03c00: [number, number];
@@ -334,22 +334,22 @@ declare const g22: (z?: boolean | undefined) => string[];
declare const g23: () => string[];
declare function f30<T, U extends ((x: T) => any)[]>(x: T, ...args: U): U;
declare const c30: [(x: number) => string, (x: number) => number];
declare type T01 = Parameters<(x: number, y: string, z: boolean) => void>;
declare type T02 = Parameters<(...args: [number, string, boolean]) => void>;
declare type T03 = ConstructorParameters<new (x: number, y: string, z: boolean) => void>;
declare type T04 = ConstructorParameters<new (...args: [number, string, boolean]) => void>;
declare type T05<T> = Parameters<(...args: T[]) => void>;
declare type T06<T> = ConstructorParameters<new (...args: []) => void>;
declare type T07<T extends any[]> = Parameters<(...args: T) => void>;
declare type T08<T extends any[]> = ConstructorParameters<new (...args: T) => void>;
declare type T09 = Parameters<Function>;
declare type Record1 = {
type T01 = Parameters<(x: number, y: string, z: boolean) => void>;
type T02 = Parameters<(...args: [number, string, boolean]) => void>;
type T03 = ConstructorParameters<new (x: number, y: string, z: boolean) => void>;
type T04 = ConstructorParameters<new (...args: [number, string, boolean]) => void>;
type T05<T> = Parameters<(...args: T[]) => void>;
type T06<T> = ConstructorParameters<new (...args: []) => void>;
type T07<T extends any[]> = Parameters<(...args: T) => void>;
type T08<T extends any[]> = ConstructorParameters<new (...args: T) => void>;
type T09 = Parameters<Function>;
type Record1 = {
move: [number, 'left' | 'right'];
jump: [number, 'up' | 'down'];
stop: string;
done: [];
};
declare type EventType<T> = {
type EventType<T> = {
emit<K extends keyof T = keyof T>(e: K, ...payload: T[K] extends any[] ? T[K] : [T[K]]): void;
};
declare var events: EventType<Record1>;
@@ -149,16 +149,16 @@ declare let f13: (a: number, b: string, ...c: boolean[]) => void;
declare const ns: [number, string];
declare const sn: [string, number];
declare const f20: <T extends unknown[]>(...args: T) => T;
declare type T01 = Parameters<(x: number, y: string, ...z: boolean[]) => void>;
declare type T02 = Parameters<(...args: [number, string, ...boolean[]]) => void>;
declare type T03 = ConstructorParameters<new (x: number, y: string, ...z: boolean[]) => void>;
declare type T04 = ConstructorParameters<new (...args: [number, string, ...boolean[]]) => void>;
declare type T05<T extends any[]> = Parameters<(x: string, ...args: T) => void>;
declare type T06 = T05<[number, ...boolean[]]>;
declare type P1<T extends Function> = T extends (head: infer A, ...tail: infer B) => any ? {
type T01 = Parameters<(x: number, y: string, ...z: boolean[]) => void>;
type T02 = Parameters<(...args: [number, string, ...boolean[]]) => void>;
type T03 = ConstructorParameters<new (x: number, y: string, ...z: boolean[]) => void>;
type T04 = ConstructorParameters<new (...args: [number, string, ...boolean[]]) => void>;
type T05<T extends any[]> = Parameters<(x: string, ...args: T) => void>;
type T06 = T05<[number, ...boolean[]]>;
type P1<T extends Function> = T extends (head: infer A, ...tail: infer B) => any ? {
head: A;
tail: B;
} : any[];
declare type T10 = P1<(x: number, y: string, ...z: boolean[]) => void>;
declare type T11 = P1<(...z: number[]) => void>;
declare type T12 = P1<(x: number, y: number) => void>;
type T10 = P1<(x: number, y: string, ...z: boolean[]) => void>;
type T11 = P1<(...z: number[]) => void>;
type T12 = P1<(x: number, y: number) => void>;
@@ -160,9 +160,9 @@ declare const ca: CoolArray<number>;
declare function hmm<A extends [] | [number, string]>(...args: A): void;
declare function foo2(...args: string[] | number[]): void;
declare let x2: ReadonlyArray<string>;
declare type RestParams = [y: string] | [y: number];
declare type Signature = (x: string, ...rest: RestParams) => void;
declare type MergedParams = Parameters<Signature>;
type RestParams = [y: string] | [y: number];
type Signature = (x: string, ...rest: RestParams) => void;
type MergedParams = Parameters<Signature>;
declare let ff1: (...rest: [string, string] | [string, number]) => void;
declare let ff2: (x: string, ...rest: [string] | [number]) => void;
declare function ff3<A extends unknown[]>(s1: (...args: [x: string, ...rest: A | [number]]) => void, s2: (x: string, ...rest: A | [number]) => void): void;
@@ -29,7 +29,7 @@ function f1(state) {
//// [identityRelationNeverTypes.d.ts]
declare type Equals<A, B> = (<T>() => T extends B ? 1 : 0) extends (<T>() => T extends A ? 1 : 0) ? true : false;
type Equals<A, B> = (<T>() => T extends B ? 1 : 0) extends (<T>() => T extends A ? 1 : 0) ? true : false;
declare class State<TContext> {
_context: TContext;
_value: string;
@@ -37,6 +37,6 @@ exports.works2 = (0, module_1.fn)(function (x) { return x; });
export declare const fail1: import("module").Modifier<(<T>(x: T) => T)>;
export declare const fail2: import("module").Modifier<(<T>(x: T) => T)>;
export declare const works1: import("module").Modifier<(x: number) => number>;
declare type MakeItWork = <T>(x: T) => T;
type MakeItWork = <T>(x: T) => T;
export declare const works2: import("module").Modifier<MakeItWork>;
export {};
@@ -61,7 +61,7 @@ declare function f2<T>(x: {
declare function f3<T, U, K extends string>(x: {
[key: string]: T;
}, y: Record<K, U>): void;
declare type Dictionary = {
type Dictionary = {
[key: string]: string;
};
interface IBaseEntity {
+19 -19
View File
@@ -532,36 +532,36 @@ declare let dom: {
};
declare const y1: string;
declare const y2: string;
declare type Funcs = {
type Funcs = {
[key: `s${string}`]: (x: string) => void;
[key: `n${string}`]: (x: number) => void;
};
declare const funcs: Funcs;
declare type Duplicates = {
type Duplicates = {
[key: string | number]: any;
[key: number | symbol]: any;
[key: symbol | `foo${string}`]: any;
[key: `foo${string}`]: any;
};
declare type Conflicting = {
type Conflicting = {
[key: `a${string}`]: 'a';
[key: `${string}a`]: 'b';
[key: `a${string}a`]: 'c';
};
declare type Invalid<T extends string> = {
type Invalid<T extends string> = {
[key: 'a' | 'b' | 'c']: string;
[key: T | number]: string;
[key: Error]: string;
[key: T & string]: string;
};
declare type Tag1 = {
type Tag1 = {
__tag1__: void;
};
declare type Tag2 = {
type Tag2 = {
__tag2__: void;
};
declare type TaggedString1 = string & Tag1;
declare type TaggedString2 = string & Tag2;
type TaggedString1 = string & Tag1;
type TaggedString2 = string & Tag2;
declare let s0: string;
declare let s1: TaggedString1;
declare let s2: TaggedString2;
@@ -635,23 +635,23 @@ declare function foo<TArg, TRet, TDir>(options: {
declare let case1: void;
declare let case2: void;
declare let case3: void;
declare type Pseudo = `&:${string}`;
type Pseudo = `&:${string}`;
declare const AmIPseudo1: Pseudo;
declare const AmIPseudo: Pseudo;
declare type PseudoDeclaration = {
type PseudoDeclaration = {
[key in Pseudo]: string;
};
declare const test: PseudoDeclaration;
declare type FieldPattern = `/${string}`;
type FieldPattern = `/${string}`;
declare const path1: FieldPattern;
declare const path2: FieldPattern;
declare type PathsObject = {
type PathsObject = {
[P in FieldPattern]: object;
};
declare const pathObject: PathsObject;
declare type IdType = `${number}-${number}-${number}-${number}`;
type IdType = `${number}-${number}-${number}-${number}`;
declare const id: IdType;
declare type A = Record<IdType, string>;
type A = Record<IdType, string>;
declare const a: A;
declare let aid: string;
interface AA {
@@ -669,12 +669,12 @@ declare const obj2: {
declare const obj3: {
[key: number]: string;
};
declare type Id = string & {
type Id = string & {
__tag: 'id ';
};
declare type Rec1 = {
type Rec1 = {
[key: Id]: number;
};
declare type Rec2 = Record<Id, number>;
declare type K1 = keyof Rec1;
declare type K2 = keyof Rec2;
type Rec2 = Record<Id, number>;
type K1 = keyof Rec1;
type K2 = keyof Rec2;
@@ -319,7 +319,7 @@ export declare namespace DiagnosticSeverity {
const Information = 3;
const Hint = 4;
}
export declare type DiagnosticSeverity = 1 | 2 | 3 | 4;
export type DiagnosticSeverity = 1 | 2 | 3 | 4;
export interface Diagnostic {
severity?: DiagnosticSeverity;
code?: number | string;
+1 -1
View File
@@ -42,7 +42,7 @@ var b = a;
//// [inferTypes2.d.ts]
export declare function foo<T>(obj: T): T extends () => infer P ? P : never;
export declare function bar<T>(obj: T): T extends () => infer P ? P : never;
export declare type BadNested<T> = {
export type BadNested<T> = {
x: T extends number ? T : string;
};
export declare function foo2<T>(obj: T): T extends {
@@ -146,153 +146,153 @@ function f2() {
//// [inferTypesWithExtends1.d.ts]
declare type X1<T extends any[]> = T extends [infer U extends string] ? ["string", U] : T extends [infer U extends number] ? ["number", U] : never;
declare type X1_T1 = X1<["a"]>;
declare type X1_T2 = X1<[1]>;
declare type X1_T3 = X1<[object]>;
declare type X2<T extends (...args: any[]) => void> = T extends (a: infer U extends string) => void ? ["string", U] : T extends (a: infer U extends number) => void ? ["number", U] : never;
declare type X2_T1 = X2<(a: "a") => void>;
declare type X2_T2 = X2<(a: 1) => void>;
declare type X2_T3 = X2<(a: object) => void>;
declare type X3<T extends (...args: any[]) => any> = T extends (...args: any[]) => (infer U extends string) ? ["string", U] : T extends (...args: any[]) => (infer U extends number) ? ["number", U] : never;
declare type X3_T1 = X3<() => "a">;
declare type X3_T2 = X3<() => 1>;
declare type X3_T3 = X3<() => object>;
declare type X4<T extends new (...args: any[]) => any> = T extends new (...args: any[]) => (infer U extends {
type X1<T extends any[]> = T extends [infer U extends string] ? ["string", U] : T extends [infer U extends number] ? ["number", U] : never;
type X1_T1 = X1<["a"]>;
type X1_T2 = X1<[1]>;
type X1_T3 = X1<[object]>;
type X2<T extends (...args: any[]) => void> = T extends (a: infer U extends string) => void ? ["string", U] : T extends (a: infer U extends number) => void ? ["number", U] : never;
type X2_T1 = X2<(a: "a") => void>;
type X2_T2 = X2<(a: 1) => void>;
type X2_T3 = X2<(a: object) => void>;
type X3<T extends (...args: any[]) => any> = T extends (...args: any[]) => (infer U extends string) ? ["string", U] : T extends (...args: any[]) => (infer U extends number) ? ["number", U] : never;
type X3_T1 = X3<() => "a">;
type X3_T2 = X3<() => 1>;
type X3_T3 = X3<() => object>;
type X4<T extends new (...args: any[]) => any> = T extends new (...args: any[]) => (infer U extends {
a: string;
}) ? ["string", U] : T extends new (...args: any[]) => (infer U extends {
a: number;
}) ? ["number", U] : never;
declare type X4_T1 = X4<new () => {
type X4_T1 = X4<new () => {
a: "a";
}>;
declare type X4_T2 = X4<new () => {
type X4_T2 = X4<new () => {
a: 1;
}>;
declare type X4_T3 = X4<new () => {
type X4_T3 = X4<new () => {
a: object;
}>;
declare type X5<T> = T extends Promise<infer U extends string> ? ["string", U] : T extends Promise<infer U extends number> ? ["number", U] : never;
declare type X5_T1 = X5<Promise<"a" | "b">>;
declare type X5_T2 = X5<Promise<1 | 2>>;
declare type X5_T3 = X5<Promise<1n | 2n>>;
declare type X6<T> = T extends {
type X5<T> = T extends Promise<infer U extends string> ? ["string", U] : T extends Promise<infer U extends number> ? ["number", U] : never;
type X5_T1 = X5<Promise<"a" | "b">>;
type X5_T2 = X5<Promise<1 | 2>>;
type X5_T3 = X5<Promise<1n | 2n>>;
type X6<T> = T extends {
a: infer U extends string;
} ? ["string", U] : T extends {
a: infer U extends number;
} ? ["number", U] : never;
declare type X6_T1 = X6<{
type X6_T1 = X6<{
a: "a";
}>;
declare type X6_T2 = X6<{
type X6_T2 = X6<{
a: 1;
}>;
declare type X6_T3 = X6<{
type X6_T3 = X6<{
a: object;
}>;
declare type X7<T> = T extends {
type X7<T> = T extends {
a: infer U extends string;
b: infer U extends string;
} ? ["string", U] : T extends {
a: infer U extends number;
b: infer U extends number;
} ? ["number", U] : never;
declare type X7_T1 = X7<{
type X7_T1 = X7<{
a: "a";
b: "b";
}>;
declare type X7_T2 = X7<{
type X7_T2 = X7<{
a: 1;
b: 2;
}>;
declare type X7_T3 = X7<{
type X7_T3 = X7<{
a: object;
b: object;
}>;
declare type X7_T4 = X7<{
type X7_T4 = X7<{
a: "a";
b: 1;
}>;
declare type X8<T> = T extends {
type X8<T> = T extends {
a: infer U extends string;
b: infer U;
} ? ["string", U] : T extends {
a: infer U extends number;
b: infer U;
} ? ["number", U] : never;
declare type X8_T1 = X8<{
type X8_T1 = X8<{
a: "a";
b: "b";
}>;
declare type X8_T2 = X8<{
type X8_T2 = X8<{
a: 1;
b: 2;
}>;
declare type X8_T3 = X8<{
type X8_T3 = X8<{
a: object;
b: object;
}>;
declare type X8_T4 = X8<{
type X8_T4 = X8<{
a: "a";
b: 1;
}>;
declare type X9<T> = T extends {
type X9<T> = T extends {
a: infer U;
b: infer U extends string;
} ? ["string", U] : T extends {
a: infer U;
b: infer U extends number;
} ? ["number", U] : never;
declare type X9_T1 = X9<{
type X9_T1 = X9<{
a: "a";
b: "b";
}>;
declare type X9_T2 = X9<{
type X9_T2 = X9<{
a: 1;
b: 2;
}>;
declare type X9_T3 = X9<{
type X9_T3 = X9<{
a: object;
b: object;
}>;
declare type X9_T4 = X9<{
type X9_T4 = X9<{
a: "a";
b: 1;
}>;
declare type X10<T> = T extends (infer U extends number ? 1 : 0) ? 1 : 0;
declare type X10_Y1<T> = X10<T extends number ? 1 : 0>;
declare type X10_T1_T1 = X10_Y1<number>;
declare type X11<T> = T extends ((infer U) extends number ? 1 : 0) ? 1 : 0;
declare type X12<T> = T extends (infer U extends number) ? 1 : 0;
declare type X13<T> = T extends infer U extends number ? 1 : 0;
declare type X14<T> = T extends keyof infer U extends number ? 1 : 0;
declare type X15<T> = T extends {
type X10<T> = T extends (infer U extends number ? 1 : 0) ? 1 : 0;
type X10_Y1<T> = X10<T extends number ? 1 : 0>;
type X10_T1_T1 = X10_Y1<number>;
type X11<T> = T extends ((infer U) extends number ? 1 : 0) ? 1 : 0;
type X12<T> = T extends (infer U extends number) ? 1 : 0;
type X13<T> = T extends infer U extends number ? 1 : 0;
type X14<T> = T extends keyof infer U extends number ? 1 : 0;
type X15<T> = T extends {
[P in infer U extends keyof T ? 1 : 0]: 1;
} ? 1 : 0;
declare type X16<T> = T extends {
type X16<T> = T extends {
[P in infer U extends keyof T]: 1;
} ? 1 : 0;
declare type X17<T> = T extends {
type X17<T> = T extends {
[P in keyof T as infer U extends P ? 1 : 0]: 1;
} ? 1 : 0;
declare type X18<T> = T extends {
type X18<T> = T extends {
[P in keyof T as infer U extends P]: 1;
} ? 1 : 0;
declare type X19<T extends string | number> = T extends (infer U extends number) ? [T, U] : never;
declare type X19_T1 = X19<"a">;
declare type X19_T2 = X19<1>;
declare type X19_T3 = X19<1 | "a">;
declare type X20<T> = T extends (infer U extends number) ? T extends (infer V extends U) ? [T, U, V] : never : never;
declare type X20_T1 = X20<1 | "a">;
declare type X21<T, N extends number> = T extends (infer U extends N) ? [T, U] : never;
declare type X21_T1 = X21<1, 1>;
declare type X21_T2 = X21<1 | "a", 1>;
declare type X21_T3 = X21<1 | 2, 1>;
declare type X21_T4 = X21<1 | 2, 2 | 3>;
declare type X21_T5 = X21<1 | 2, 3>;
declare type IfEquals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B;
type X19<T extends string | number> = T extends (infer U extends number) ? [T, U] : never;
type X19_T1 = X19<"a">;
type X19_T2 = X19<1>;
type X19_T3 = X19<1 | "a">;
type X20<T> = T extends (infer U extends number) ? T extends (infer V extends U) ? [T, U, V] : never : never;
type X20_T1 = X20<1 | "a">;
type X21<T, N extends number> = T extends (infer U extends N) ? [T, U] : never;
type X21_T1 = X21<1, 1>;
type X21_T2 = X21<1 | "a", 1>;
type X21_T3 = X21<1 | 2, 1>;
type X21_T4 = X21<1 | 2, 2 | 3>;
type X21_T5 = X21<1 | 2, 3>;
type IfEquals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B;
declare const x1: <T>() => (T extends infer U extends number ? 1 : 0);
declare function f1(): <T>() => T extends infer U extends number ? 1 : 0;
declare type ExpectNumber<T extends number> = T;
type ExpectNumber<T extends number> = T;
declare const x2: <T>() => (T extends ExpectNumber<infer U> ? 1 : 0);
declare function f2(): <T>() => T extends infer U extends number ? 1 : 0;
@@ -28,7 +28,7 @@ interface X<A> {
interface Y<B> {
b: B;
}
declare type Z<A, B> = X<A> | Y<B>;
type Z<A, B> = X<A> | Y<B>;
declare function f1<A>(): Z<A, number>;
declare function f2<A, B, C, D, E>(a: A, b: B, c: C, d: D): Z<A, string[]>;
declare const x1: Z<string, number>;
@@ -275,14 +275,14 @@ declare function fx<T>(x: T): T;
declare function fx<T>(x: T, n: number): T;
declare function fx<T, U>(t: [T, U]): [T, U];
declare function f1(): void;
declare type T10 = typeof fx;
declare type T11 = typeof fx<string>;
declare type T12 = typeof fx<string, number>;
declare type T13 = typeof fx<string, number, boolean>;
type T10 = typeof fx;
type T11 = typeof fx<string>;
type T12 = typeof fx<string, number>;
type T13 = typeof fx<string, number, boolean>;
declare function f2(): void;
declare type T20 = typeof Array;
declare type T21 = typeof Array<string>;
declare type T22 = typeof Array<string, number>;
type T20 = typeof Array;
type T21 = typeof Array<string>;
type T22 = typeof Array<string, number>;
declare class C<T> {
constructor(x: T);
static f<U>(x: U): U[];
@@ -352,11 +352,11 @@ declare function f38<T extends (<A>(x: A) => A) | (<B>(x: B) => B[]), U>(f: T |
declare function makeBox<T>(value: T): {
value: T;
};
declare type BoxFunc<T> = typeof makeBox<T>;
declare type StringBoxFunc = BoxFunc<string>;
declare type Box<T> = ReturnType<typeof makeBox<T>>;
declare type StringBox = Box<string>;
declare type A<U> = InstanceType<typeof Array<U>>;
type BoxFunc<T> = typeof makeBox<T>;
type StringBoxFunc = BoxFunc<string>;
type Box<T> = ReturnType<typeof makeBox<T>>;
type StringBox = Box<string>;
type A<U> = InstanceType<typeof Array<U>>;
declare const g1: {
<T>(a: T): {
a: T;
@@ -365,18 +365,18 @@ declare const g1: {
b: U;
};
};
declare type T30<V> = typeof g1<V>;
declare type T31<A> = ReturnType<T30<A>>;
declare type T32<B> = InstanceType<T30<B>>;
type T30<V> = typeof g1<V>;
type T31<A> = ReturnType<T30<A>>;
type T32<B> = InstanceType<T30<B>>;
declare const g2: {
<T extends string>(a: T): T;
new <T extends number>(b: T): T;
};
declare type T40<U extends string> = typeof g2<U>;
declare type T41<U extends number> = typeof g2<U>;
type T40<U extends string> = typeof g2<U>;
type T41<U extends number> = typeof g2<U>;
declare const g3: {
<T extends string>(a: T): T;
new <T extends number, Q>(b: T): T;
};
declare type T50<U extends string> = typeof g3<U>;
declare type T51<U extends number> = typeof g3<U, any>;
type T50<U extends string> = typeof g3<U>;
type T51<U extends number> = typeof g3<U, any>;
@@ -338,7 +338,7 @@ declare function foo<A>(options: {
a: A;
b: (a: A) => void;
}): void;
declare type Chain<R1, R2> = {
type Chain<R1, R2> = {
a(): R1;
b(a: R1): R2;
c(b: R2): void;
@@ -347,11 +347,11 @@ declare function test<R1, R2>(foo: Chain<R1, R2>): void;
declare class Wrapper<T = any> {
value?: T;
}
declare type WrappedMap = Record<string, Wrapper>;
declare type Unwrap<D extends WrappedMap> = {
type WrappedMap = Record<string, Wrapper>;
type Unwrap<D extends WrappedMap> = {
[K in keyof D]: D[K] extends Wrapper<infer T> ? T : never;
};
declare type MappingComponent<I extends WrappedMap, O extends WrappedMap> = {
type MappingComponent<I extends WrappedMap, O extends WrappedMap> = {
setup(): {
inputs: I;
outputs: O;
+30 -30
View File
@@ -74,36 +74,36 @@ function foo4(x) {
//// [intrinsicTypes.d.ts]
declare type TU1 = Uppercase<'hello'>;
declare type TU2 = Uppercase<'foo' | 'bar'>;
declare type TU3 = Uppercase<string>;
declare type TU4 = Uppercase<any>;
declare type TU5 = Uppercase<never>;
declare type TU6 = Uppercase<42>;
declare type TL1 = Lowercase<'HELLO'>;
declare type TL2 = Lowercase<'FOO' | 'BAR'>;
declare type TL3 = Lowercase<string>;
declare type TL4 = Lowercase<any>;
declare type TL5 = Lowercase<never>;
declare type TL6 = Lowercase<42>;
declare type TC1 = Capitalize<'hello'>;
declare type TC2 = Capitalize<'foo' | 'bar'>;
declare type TC3 = Capitalize<string>;
declare type TC4 = Capitalize<any>;
declare type TC5 = Capitalize<never>;
declare type TC6 = Capitalize<42>;
declare type TN1 = Uncapitalize<'Hello'>;
declare type TN2 = Uncapitalize<'Foo' | 'Bar'>;
declare type TN3 = Uncapitalize<string>;
declare type TN4 = Uncapitalize<any>;
declare type TN5 = Uncapitalize<never>;
declare type TN6 = Uncapitalize<42>;
declare type TX1<S extends string> = Uppercase<`aB${S}`>;
declare type TX2 = TX1<'xYz'>;
declare type TX3<S extends string> = Lowercase<`aB${S}`>;
declare type TX4 = TX3<'xYz'>;
declare type TX5 = `${Uppercase<'abc'>}${Lowercase<'XYZ'>}`;
declare type MyUppercase<S extends string> = intrinsic;
type TU1 = Uppercase<'hello'>;
type TU2 = Uppercase<'foo' | 'bar'>;
type TU3 = Uppercase<string>;
type TU4 = Uppercase<any>;
type TU5 = Uppercase<never>;
type TU6 = Uppercase<42>;
type TL1 = Lowercase<'HELLO'>;
type TL2 = Lowercase<'FOO' | 'BAR'>;
type TL3 = Lowercase<string>;
type TL4 = Lowercase<any>;
type TL5 = Lowercase<never>;
type TL6 = Lowercase<42>;
type TC1 = Capitalize<'hello'>;
type TC2 = Capitalize<'foo' | 'bar'>;
type TC3 = Capitalize<string>;
type TC4 = Capitalize<any>;
type TC5 = Capitalize<never>;
type TC6 = Capitalize<42>;
type TN1 = Uncapitalize<'Hello'>;
type TN2 = Uncapitalize<'Foo' | 'Bar'>;
type TN3 = Uncapitalize<string>;
type TN4 = Uncapitalize<any>;
type TN5 = Uncapitalize<never>;
type TN6 = Uncapitalize<42>;
type TX1<S extends string> = Uppercase<`aB${S}`>;
type TX2 = TX1<'xYz'>;
type TX3<S extends string> = Lowercase<`aB${S}`>;
type TX4 = TX3<'xYz'>;
type TX5 = `${Uppercase<'abc'>}${Lowercase<'XYZ'>}`;
type MyUppercase<S extends string> = intrinsic;
declare function foo1<T extends string, U extends T>(s: string, x: Uppercase<T>, y: Uppercase<U>): void;
declare function foo2<T extends 'foo' | 'bar'>(x: Uppercase<T>): void;
declare function foo3<T extends string>(x: Uppercase<T>): T;
@@ -298,10 +298,10 @@ var o2 = getProps(myAny, ['foo', 'bar']);
//// [isomorphicMappedTypeInference.d.ts]
declare type Box<T> = {
type Box<T> = {
value: T;
};
declare type Boxified<T> = {
type Boxified<T> = {
[P in keyof T]: Box<T[P]>;
};
declare function box<T>(x: T): Box<T>;
@@ -332,13 +332,13 @@ declare function clone<T>(obj: {
declare function validateAndClone<T>(obj: {
readonly [P in keyof T]?: T[P];
}): T;
declare type Foo = {
type Foo = {
a?: number;
readonly b: string;
};
declare function f10(foo: Foo): void;
declare type Func<T> = (...args: any[]) => T;
declare type Spec<T> = {
type Func<T> = (...args: any[]) => T;
type Spec<T> = {
[P in keyof T]: Func<T[P]> | Spec<T[P]>;
};
/**
@@ -1115,10 +1115,10 @@ declare class Item {
declare class Options {
visible: "yes" | "no";
}
declare type Dictionary<T> = {
type Dictionary<T> = {
[x: string]: T;
};
declare type NumericallyIndexed<T> = {
type NumericallyIndexed<T> = {
[x: number]: T;
};
declare const enum E {
@@ -1126,47 +1126,47 @@ declare const enum E {
B = 1,
C = 2
}
declare type K00 = keyof any;
declare type K01 = keyof string;
declare type K02 = keyof number;
declare type K03 = keyof boolean;
declare type K04 = keyof void;
declare type K05 = keyof undefined;
declare type K06 = keyof null;
declare type K07 = keyof never;
declare type K08 = keyof unknown;
declare type K10 = keyof Shape;
declare type K11 = keyof Shape[];
declare type K12 = keyof Dictionary<Shape>;
declare type K13 = keyof {};
declare type K14 = keyof Object;
declare type K15 = keyof E;
declare type K16 = keyof [string, number];
declare type K17 = keyof (Shape | Item);
declare type K18 = keyof (Shape & Item);
declare type K19 = keyof NumericallyIndexed<Shape>;
declare type KeyOf<T> = keyof T;
declare type K20 = KeyOf<Shape>;
declare type K21 = KeyOf<Dictionary<Shape>>;
declare type NAME = "name";
declare type WIDTH_OR_HEIGHT = "width" | "height";
declare type Q10 = Shape["name"];
declare type Q11 = Shape["width" | "height"];
declare type Q12 = Shape["name" | "visible"];
declare type Q20 = Shape[NAME];
declare type Q21 = Shape[WIDTH_OR_HEIGHT];
declare type Q30 = [string, number][0];
declare type Q31 = [string, number][1];
declare type Q32 = [string, number][number];
declare type Q33 = [string, number][E.A];
declare type Q34 = [string, number][E.B];
declare type Q35 = [string, number]["0"];
declare type Q36 = [string, number]["1"];
declare type Q40 = (Shape | Options)["visible"];
declare type Q41 = (Shape & Options)["visible"];
declare type Q50 = Dictionary<Shape>["howdy"];
declare type Q51 = Dictionary<Shape>[123];
declare type Q52 = Dictionary<Shape>[E.B];
type K00 = keyof any;
type K01 = keyof string;
type K02 = keyof number;
type K03 = keyof boolean;
type K04 = keyof void;
type K05 = keyof undefined;
type K06 = keyof null;
type K07 = keyof never;
type K08 = keyof unknown;
type K10 = keyof Shape;
type K11 = keyof Shape[];
type K12 = keyof Dictionary<Shape>;
type K13 = keyof {};
type K14 = keyof Object;
type K15 = keyof E;
type K16 = keyof [string, number];
type K17 = keyof (Shape | Item);
type K18 = keyof (Shape & Item);
type K19 = keyof NumericallyIndexed<Shape>;
type KeyOf<T> = keyof T;
type K20 = KeyOf<Shape>;
type K21 = KeyOf<Dictionary<Shape>>;
type NAME = "name";
type WIDTH_OR_HEIGHT = "width" | "height";
type Q10 = Shape["name"];
type Q11 = Shape["width" | "height"];
type Q12 = Shape["name" | "visible"];
type Q20 = Shape[NAME];
type Q21 = Shape[WIDTH_OR_HEIGHT];
type Q30 = [string, number][0];
type Q31 = [string, number][1];
type Q32 = [string, number][number];
type Q33 = [string, number][E.A];
type Q34 = [string, number][E.B];
type Q35 = [string, number]["0"];
type Q36 = [string, number]["1"];
type Q40 = (Shape | Options)["visible"];
type Q41 = (Shape & Options)["visible"];
type Q50 = Dictionary<Shape>["howdy"];
type Q51 = Dictionary<Shape>[123];
type Q52 = Dictionary<Shape>[E.B];
declare let cond: boolean;
declare function getProperty<T, K extends keyof T>(obj: T, key: K): T[K];
declare function setProperty<T, K extends keyof T>(obj: T, key: K, value: T[K]): void;
@@ -1231,7 +1231,7 @@ declare class C1 {
set<K extends keyof this>(key: K, value: this[K]): void;
foo(): void;
}
declare type S2 = {
type S2 = {
a: string;
b: string;
};
@@ -1256,7 +1256,7 @@ declare function path<T, K1 extends keyof T>(obj: T, key1: K1): T[K1];
declare function path<T, K1 extends keyof T, K2 extends keyof T[K1]>(obj: T, key1: K1, key2: K2): T[K1][K2];
declare function path<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3];
declare function path(obj: any, ...keys: (string | number)[]): any;
declare type Thing = {
type Thing = {
a: {
x: number;
y: string;
@@ -1267,7 +1267,7 @@ declare function f1(thing: Thing): void;
declare const assignTo2: <T, K1 extends keyof T, K2 extends keyof T[K1]>(object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => T[K1][K2];
declare function one<T>(handler: (t: T) => void): T;
declare var empty: unknown;
declare type Handlers<T> = {
type Handlers<T> = {
[K in keyof T]: (t: T[K]) => void;
};
declare function on<T>(handlerHash: Handlers<T>): T;
@@ -1300,24 +1300,24 @@ interface R {
p: number;
}
declare function f<K extends keyof R>(p: K): void;
declare type MethodDescriptor = {
type MethodDescriptor = {
name: string;
args: any[];
returnValue: any;
};
declare function dispatchMethod<M extends MethodDescriptor>(name: M['name'], args: M['args']): M['returnValue'];
declare type SomeMethodDescriptor = {
type SomeMethodDescriptor = {
name: "someMethod";
args: [string, number];
returnValue: string[];
};
declare let result: string[];
declare type KeyTypes = "a" | "b";
type KeyTypes = "a" | "b";
declare let MyThingy: {
[key in KeyTypes]: string[];
};
declare function addToMyThingy<S extends KeyTypes>(key: S): void;
declare type Handler<T> = {
type Handler<T> = {
onChange: (name: keyof T) => void;
};
declare function onChangeGenericFunction<T>(handler: Handler<T & {
@@ -1357,17 +1357,17 @@ declare class AnotherSampleClass<T> extends SampleClass<T & Foo> {
brokenMethod(): void;
}
declare function f3<T, K extends Extract<keyof T, string>>(t: T, k: K, tk: T[K]): void;
declare type Predicates<TaggedRecord> = {
type Predicates<TaggedRecord> = {
[T in keyof TaggedRecord]: (variant: TaggedRecord[keyof TaggedRecord]) => variant is TaggedRecord[T];
};
declare type Example<T extends {
type Example<T extends {
[K in keyof T]: {
prop: any;
};
}> = {
[K in keyof T]: T[K]["prop"];
};
declare type Result = Example<{
type Result = Example<{
a: {
prop: string;
};
@@ -1375,15 +1375,15 @@ declare type Result = Example<{
prop: number;
};
}>;
declare type Helper2<T> = {
type Helper2<T> = {
[K in keyof T]: Extract<T[K], {
prop: any;
}>;
};
declare type Example2<T> = {
type Example2<T> = {
[K in keyof Helper2<T>]: Helper2<T>[K]["prop"];
};
declare type Result2 = Example2<{
type Result2 = Example2<{
1: {
prop: string;
};
@@ -1391,18 +1391,18 @@ declare type Result2 = Example2<{
prop: number;
};
}>;
declare type DBBoolTable<K extends string> = {
type DBBoolTable<K extends string> = {
[k in K]: 0 | 1;
};
declare enum Flag {
FLAG_1 = "flag_1",
FLAG_2 = "flag_2"
}
declare type SimpleDBRecord<Flag extends string> = {
type SimpleDBRecord<Flag extends string> = {
staticField: number;
} & DBBoolTable<Flag>;
declare function getFlagsFromSimpleRecord<Flag extends string>(record: SimpleDBRecord<Flag>, flags: Flag[]): SimpleDBRecord<Flag>[Flag];
declare type DynamicDBRecord<Flag extends string> = ({
type DynamicDBRecord<Flag extends string> = ({
dynamicField: number;
} | {
dynamicField: string;
@@ -1419,12 +1419,12 @@ declare class Unbounded<T> {
interface I7 {
x: any;
}
declare type Foo7<T extends number> = T;
type Foo7<T extends number> = T;
declare function f7<K extends keyof I7>(type: K): Foo7<I7[K]>;
declare type Dict<T extends string> = {
type Dict<T extends string> = {
[key in T]: number;
};
declare type DictDict<V extends string, T extends string> = {
type DictDict<V extends string, T extends string> = {
[key in V]: Dict<T>;
};
declare function ff1<V extends string, T extends string>(dd: DictDict<V, T>, k1: V, k2: T): number;
+18 -18
View File
@@ -32,25 +32,25 @@ type Result5 = Example5<Record<'x', any>, Record<'y', any>>; // "x" | "y"
//// [keyofIntersection.d.ts]
declare type A = {
type A = {
a: string;
};
declare type B = {
type B = {
b: string;
};
declare type T01 = keyof (A & B);
declare type T02<T> = keyof (T & B);
declare type T03<U> = keyof (A & U);
declare type T04<T, U> = keyof (T & U);
declare type T05 = T02<A>;
declare type T06 = T03<B>;
declare type T07 = T04<A, B>;
declare type Example1<T extends string, U extends string> = keyof (Record<T, any> & Record<U, any>);
declare type Result1 = Example1<'x', 'y'>;
declare type Result2 = keyof (Record<'x', any> & Record<'y', any>);
declare type Example3<T extends string> = keyof (Record<T, any>);
declare type Result3 = Example3<'x' | 'y'>;
declare type Example4<T extends string, U extends string> = (Record<T, any> & Record<U, any>);
declare type Result4 = keyof Example4<'x', 'y'>;
declare type Example5<T, U> = keyof (T & U);
declare type Result5 = Example5<Record<'x', any>, Record<'y', any>>;
type T01 = keyof (A & B);
type T02<T> = keyof (T & B);
type T03<U> = keyof (A & U);
type T04<T, U> = keyof (T & U);
type T05 = T02<A>;
type T06 = T03<B>;
type T07 = T04<A, B>;
type Example1<T extends string, U extends string> = keyof (Record<T, any> & Record<U, any>);
type Result1 = Example1<'x', 'y'>;
type Result2 = keyof (Record<'x', any> & Record<'y', any>);
type Example3<T extends string> = keyof (Record<T, any>);
type Result3 = Example3<'x' | 'y'>;
type Example4<T extends string, U extends string> = (Record<T, any> & Record<U, any>);
type Result4 = keyof Example4<'x', 'y'>;
type Example5<T, U> = keyof (T & U);
type Result5 = Example5<Record<'x', any>, Record<'y', any>>;
@@ -32,6 +32,6 @@ declare global {
}
}
//// [c.d.ts]
declare type Foo = teams.calling.Foo;
type Foo = teams.calling.Foo;
export declare const bar: (p?: Foo) => void;
export {};
@@ -16,5 +16,5 @@ exports.increment = increment;
//// [mapOnTupleTypes02.d.ts]
export declare type Point = [number, number];
export type Point = [number, number];
export declare function increment(point: Point): number[];
@@ -169,24 +169,24 @@ f("a"); // Error, should allow only "b"
//// [mappedTypeAsClauses.d.ts]
declare type Getters<T> = {
type Getters<T> = {
[P in keyof T & string as `get${Capitalize<P>}`]: () => T[P];
};
declare type TG1 = Getters<{
type TG1 = Getters<{
foo: string;
bar: number;
baz: {
z: boolean;
};
}>;
declare type PropDef<K extends keyof any, T> = {
type PropDef<K extends keyof any, T> = {
name: K;
type: T;
};
declare type TypeFromDefs<T extends PropDef<keyof any, any>> = {
type TypeFromDefs<T extends PropDef<keyof any, any>> = {
[P in T as P['name']]: P['type'];
};
declare type TP1 = TypeFromDefs<{
type TP1 = TypeFromDefs<{
name: 'a';
type: string;
} | {
@@ -196,26 +196,26 @@ declare type TP1 = TypeFromDefs<{
name: 'a';
type: boolean;
}>;
declare type TA1 = Getters<string[]>;
declare type TA2 = Getters<[number, boolean]>;
declare type Methods<T> = {
type TA1 = Getters<string[]>;
type TA2 = Getters<[number, boolean]>;
type Methods<T> = {
[P in keyof T as T[P] extends Function ? P : never]: T[P];
};
declare type TM1 = Methods<{
type TM1 = Methods<{
foo(): number;
bar(x: string): boolean;
baz: string | number;
}>;
declare type DoubleProp<T> = {
type DoubleProp<T> = {
[P in keyof T & string as `${P}1` | `${P}2`]: T[P];
};
declare type TD1 = DoubleProp<{
type TD1 = DoubleProp<{
a: string;
b: number;
}>;
declare type TD2 = keyof TD1;
declare type TD3<U> = keyof DoubleProp<U>;
declare type Lazyify<T> = {
type TD2 = keyof TD1;
type TD3<U> = keyof DoubleProp<U>;
type Lazyify<T> = {
[K in keyof T as `get${Capitalize<K & string>}`]: () => T[K];
};
interface Person {
@@ -223,17 +223,17 @@ interface Person {
age: number;
location?: string;
}
declare type LazyPerson = Lazyify<Person>;
declare type Example = {
type LazyPerson = Lazyify<Person>;
type Example = {
foo: string;
bar: number;
};
declare type PickByValueType<T, U> = {
type PickByValueType<T, U> = {
[K in keyof T as T[K] extends U ? K : never]: T[K];
};
declare type T1 = PickByValueType<Example, string>;
type T1 = PickByValueType<Example, string>;
declare const e1: T1;
declare type T2 = keyof T1;
type T2 = keyof T1;
declare const e2: T2;
interface Car {
name: string;
@@ -249,39 +249,39 @@ interface Wheel {
type: "summer" | "winter";
radius: number;
}
declare type Primitive = string | number | boolean;
declare type OnlyPrimitives<T> = {
type Primitive = string | number | boolean;
type OnlyPrimitives<T> = {
[K in keyof T as T[K] extends Primitive ? K : never]: T[K];
};
declare let primitiveCar: OnlyPrimitives<Car>;
declare let keys: keyof OnlyPrimitives<Car>;
declare type KeysOfPrimitives<T> = keyof OnlyPrimitives<T>;
type KeysOfPrimitives<T> = keyof OnlyPrimitives<T>;
declare let carKeys: KeysOfPrimitives<Car>;
declare type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
declare type If<Cond extends boolean, Then, Else> = Cond extends true ? Then : Else;
declare type GetKey<S, V> = keyof {
type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
type If<Cond extends boolean, Then, Else> = Cond extends true ? Then : Else;
type GetKey<S, V> = keyof {
[TP in keyof S as Equal<S[TP], V> extends true ? TP : never]: any;
};
declare type GetKeyWithIf<S, V> = keyof {
type GetKeyWithIf<S, V> = keyof {
[TP in keyof S as If<Equal<S[TP], V>, TP, never>]: any;
};
declare type GetObjWithIf<S, V> = {
type GetObjWithIf<S, V> = {
[TP in keyof S as If<Equal<S[TP], V>, TP, never>]: any;
};
declare type Task = {
type Task = {
isDone: boolean;
};
declare type Schema = {
type Schema = {
root: {
title: string;
task: Task;
};
Task: Task;
};
declare type Res1 = GetKey<Schema, Schema['root']['task']>;
declare type Res2 = GetKeyWithIf<Schema, Schema['root']['task']>;
declare type Res3 = keyof GetObjWithIf<Schema, Schema['root']['task']>;
declare type KeysExtendedBy<T, U> = keyof {
type Res1 = GetKey<Schema, Schema['root']['task']>;
type Res2 = GetKeyWithIf<Schema, Schema['root']['task']>;
type Res3 = keyof GetObjWithIf<Schema, Schema['root']['task']>;
type KeysExtendedBy<T, U> = keyof {
[K in keyof T as U extends T[K] ? K : never]: T[K];
};
interface M {
@@ -289,48 +289,48 @@ interface M {
b: number;
}
declare function f(x: KeysExtendedBy<M, number>): "b";
declare type NameMap = {
type NameMap = {
'a': 'x';
'b': 'y';
'c': 'z';
};
declare type TS0<T> = keyof {
type TS0<T> = keyof {
[P in keyof T as keyof Record<P, number>]: string;
};
declare type TS1<T> = keyof {
type TS1<T> = keyof {
[P in keyof T as Extract<P, 'a' | 'b' | 'c'>]: string;
};
declare type TS2<T> = keyof {
type TS2<T> = keyof {
[P in keyof T as P & ('a' | 'b' | 'c')]: string;
};
declare type TS3<T> = keyof {
type TS3<T> = keyof {
[P in keyof T as Exclude<P, 'a' | 'b' | 'c'>]: string;
};
declare type TS4<T> = keyof {
type TS4<T> = keyof {
[P in keyof T as NameMap[P & keyof NameMap]]: string;
};
declare type TS5<T> = keyof {
type TS5<T> = keyof {
[P in keyof T & keyof NameMap as NameMap[P]]: string;
};
declare type TS6<T, U, V> = keyof {
type TS6<T, U, V> = keyof {
[K in keyof T as V & (K extends U ? K : never)]: string;
};
declare type TN0<T> = keyof {
type TN0<T> = keyof {
[P in keyof T as T[P] extends number ? P : never]: string;
};
declare type TN1<T> = keyof {
type TN1<T> = keyof {
[P in keyof T as number extends T[P] ? P : never]: string;
};
declare type TN2<T> = keyof {
type TN2<T> = keyof {
[P in keyof T as 'a' extends P ? 'x' : 'y']: string;
};
declare type TN3<T> = keyof {
type TN3<T> = keyof {
[P in keyof T as Exclude<Exclude<Exclude<P, 'c'>, 'b'>, 'a'>]: string;
};
declare type TN4<T, U> = keyof {
type TN4<T, U> = keyof {
[K in keyof T as (K extends U ? T[K] : never) extends T[K] ? K : never]: string;
};
declare type TN5<T, U> = keyof {
type TN5<T, U> = keyof {
[K in keyof T as keyof {
[P in K as T[P] extends U ? K : never]: true;
}]: string;
@@ -74,25 +74,25 @@ function validate(obj, bounds) {
//// [mappedTypeConstraints2.d.ts]
declare type Mapped1<K extends string> = {
type Mapped1<K extends string> = {
[P in K]: {
a: P;
};
};
declare function f1<K extends string>(obj: Mapped1<K>, key: K): void;
declare type Mapped2<K extends string> = {
type Mapped2<K extends string> = {
[P in K as `get${P}`]: {
a: P;
};
};
declare function f2<K extends string>(obj: Mapped2<K>, key: `get${K}`): void;
declare type Mapped3<K extends string> = {
type Mapped3<K extends string> = {
[P in K as Uppercase<P>]: {
a: P;
};
};
declare function f3<K extends string>(obj: Mapped3<K>, key: Uppercase<K>): void;
declare type Foo<T extends string> = {
type Foo<T extends string> = {
[RemappedT in T as `get${RemappedT}`]: RemappedT;
};
declare const get: <T extends string>(t: T, foo: Foo<T>) => T;
@@ -100,7 +100,7 @@ interface Bounds {
min: number;
max: number;
}
declare type NumericBoundsOf<T> = {
type NumericBoundsOf<T> = {
[K in keyof T as T[K] extends number | undefined ? K : never]: Bounds;
};
declare function validate<T extends object>(obj: T, bounds: NumericBoundsOf<T>): boolean;
+14 -14
View File
@@ -255,23 +255,23 @@ interface Point {
x: number;
y: number;
}
declare type T00 = {
type T00 = {
[P in P]: string;
};
declare type T01 = {
type T01 = {
[P in number]: string;
};
declare type T02 = {
type T02 = {
[P in Date]: number;
};
declare type T03 = Record<Date, number>;
declare type T10 = Pick<Shape, "name">;
declare type T11 = Pick<Shape, "foo">;
declare type T12 = Pick<Shape, "name" | "foo">;
declare type T13 = Pick<Shape, keyof Named>;
declare type T14 = Pick<Shape, keyof Point>;
declare type T15 = Pick<Shape, never>;
declare type T16 = Pick<Shape, undefined>;
type T03 = Record<Date, number>;
type T10 = Pick<Shape, "name">;
type T11 = Pick<Shape, "foo">;
type T12 = Pick<Shape, "name" | "foo">;
type T13 = Pick<Shape, keyof Named>;
type T14 = Pick<Shape, keyof Point>;
type T15 = Pick<Shape, never>;
type T16 = Pick<Shape, undefined>;
declare function f1<T>(x: T): void;
declare function f2<T extends string | number>(x: T): void;
declare function f3<T extends keyof Shape>(x: T): void;
@@ -294,7 +294,7 @@ declare class C<T> {
setState<K extends keyof T>(props: Pick<T, K>): void;
}
declare let c: C<Foo>;
declare type T2 = {
type T2 = {
a?: number;
[key: string]: any;
};
@@ -303,7 +303,7 @@ declare let x2: Partial<T2>;
declare let x3: {
[P in keyof T2]: T2[P];
};
declare type Foo2<T, F extends keyof T> = {
type Foo2<T, F extends keyof T> = {
pf: {
[P in F]?: T[P];
};
@@ -311,7 +311,7 @@ declare type Foo2<T, F extends keyof T> = {
[P in T]?: T[P];
};
};
declare type O = {
type O = {
x: number;
y: boolean;
};
@@ -25,25 +25,25 @@ type T7<S extends 'a'|'b', L extends 'a'> = {[key in AB[S]]: true}[L];
//// [mappedTypeErrors2.d.ts]
declare type AB = {
type AB = {
a: 'a';
b: 'a';
};
declare type T1<K extends keyof AB> = {
type T1<K extends keyof AB> = {
[key in AB[K]]: true;
};
declare type T2<K extends 'a' | 'b'> = T1<K>[K];
declare type R = AB[keyof AB];
declare type T3 = {
type T2<K extends 'a' | 'b'> = T1<K>[K];
type R = AB[keyof AB];
type T3 = {
[key in R]: true;
};
declare type T4<K extends 'a' | 'b'> = T3[K];
declare type T5<S extends 'a' | 'b' | 'extra'> = {
type T4<K extends 'a' | 'b'> = T3[K];
type T5<S extends 'a' | 'b' | 'extra'> = {
[key in AB[S]]: true;
}[S];
declare type T6<S extends 'a' | 'b', L extends 'a' | 'b'> = {
type T6<S extends 'a' | 'b', L extends 'a' | 'b'> = {
[key in AB[S]]: true;
}[L];
declare type T7<S extends 'a' | 'b', L extends 'a'> = {
type T7<S extends 'a' | 'b', L extends 'a'> = {
[key in AB[S]]: true;
}[L];
@@ -69,7 +69,7 @@ var onSomeEvent = function (p) { var _a; return (_a = typeHandlers[p.t]) === nul
//// [mappedTypeGenericIndexedAccess.d.ts]
declare type Types = {
type Types = {
first: {
a1: true;
};
@@ -87,7 +87,7 @@ declare class Test {
constructor();
addEntry<T extends keyof Types>(name: T, entry: Types[T]): void;
}
declare type TypesMap = {
type TypesMap = {
[0]: {
foo: 'bar';
};
@@ -95,10 +95,10 @@ declare type TypesMap = {
a: 'b';
};
};
declare type P<T extends keyof TypesMap> = {
type P<T extends keyof TypesMap> = {
t: T;
} & TypesMap[T];
declare type TypeHandlers = {
type TypeHandlers = {
[T in keyof TypesMap]?: (p: P<T>) => void;
};
declare const typeHandlers: TypeHandlers;
@@ -30,7 +30,7 @@ exports.mappedUnionWithPrivateType = mappedUnionWithPrivateType;
//// [internal.d.ts]
export declare function usePrivateType<T extends unknown[]>(...args: T): PrivateMapped<T[any]>;
declare type PrivateMapped<Obj> = {
type PrivateMapped<Obj> = {
[K in keyof Obj]: Obj[K];
};
export {};
@@ -69,4 +69,4 @@ var E = (_b = /** @class */ (function () {
//// [mappedTypeProperties.d.ts]
export declare type PlaceType = 'openSky' | 'roofed' | 'garage';
export type PlaceType = 'openSky' | 'roofed' | 'garage';
@@ -343,7 +343,7 @@ declare function f20<T>(x: T, y: Readonly<T>, k: keyof T): void;
declare function f21<T, K extends keyof T>(x: T, y: Readonly<T>, k: K): void;
declare function f22<T, U extends T>(x: T, y: Readonly<U>, k: keyof T): void;
declare function f23<T, U extends T, K extends keyof T>(x: T, y: Readonly<U>, k: K): void;
declare type Thing = {
type Thing = {
a: string;
b: string;
};
@@ -351,22 +351,22 @@ declare function f30<T>(x: T, y: Partial<T>): void;
declare function f31<T extends Thing>(x: Partial<Thing>, y: Partial<T>): void;
declare function f40<T>(x: T, y: Readonly<T>): void;
declare function f41<T extends Thing>(x: Readonly<Thing>, y: Readonly<T>): void;
declare type Item = {
type Item = {
name: string;
};
declare type ItemMap = {
type ItemMap = {
[x: string]: Item;
};
declare function f50<T extends ItemMap>(obj: T, key: keyof T): string;
declare function f51<T extends ItemMap, K extends keyof T>(obj: T, key: K): string;
declare type T1<T> = {
type T1<T> = {
[P in keyof T]: T[P];
};
declare type T2<T> = {
type T2<T> = {
[P in keyof T]: T[P];
};
declare function f60<U>(x: T1<U>, y: T2<U>): void;
declare type Identity<T> = {
type Identity<T> = {
[P in keyof T]: T[P];
};
declare function f61<U>(x: Identity<U>, y: Partial<U>): void;
@@ -409,7 +409,7 @@ declare function f76<T, U extends T, K extends keyof T>(x: {
declare function f80<T>(t: T): Partial<T>;
declare function f81<T, K extends keyof T>(t: T, k: K): Partial<T[K]>;
declare function f82<T, K1 extends keyof T, K2 extends keyof T[K1]>(t: T, k1: K1, k2: K2): Partial<T[K1][K2]>;
declare type Numeric<T> = {
type Numeric<T> = {
[K in keyof T]?: number;
};
declare function f90<T extends {
@@ -80,10 +80,10 @@ var def = stringifyPair(void 0);
//// [mappedTypeWithAny.d.ts]
declare type Item = {
type Item = {
value: string;
};
declare type ItemMap<T> = {
type ItemMap<T> = {
[P in keyof T]: Item;
};
declare let x0: keyof any;
@@ -97,20 +97,20 @@ declare let x3: {
[P in keyof any]: Item;
};
declare let x4: ItemMap<any>;
declare type Data = {
type Data = {
value: string;
};
declare type StrictDataMap<T> = {
type StrictDataMap<T> = {
[P in keyof T]: Data;
};
declare let z: StrictDataMap<any>;
declare type Arrayish<T extends unknown[]> = {
type Arrayish<T extends unknown[]> = {
[K in keyof T]: T[K];
};
declare type Objectish<T extends unknown> = {
type Objectish<T extends unknown> = {
[K in keyof T]: T[K];
};
declare type IndirectArrayish<U extends unknown[]> = Objectish<U>;
type IndirectArrayish<U extends unknown[]> = Objectish<U>;
declare function bar(arrayish: Arrayish<any>, objectish: Objectish<any>, indirectArrayish: IndirectArrayish<any>): void;
declare function stringifyArray<T extends readonly any[]>(arr: T): {
-readonly [K in keyof T]: string;
@@ -120,9 +120,9 @@ declare function stringifyPair<T extends readonly [any, any]>(arr: T): {
-readonly [K in keyof T]: string;
};
declare let def: [any, any];
declare type Evolvable<E extends Evolver> = {
type Evolvable<E extends Evolver> = {
[P in keyof E]: never;
};
declare type Evolver<T extends Evolvable<any> = any> = {
type Evolver<T extends Evolvable<any> = any> = {
[key in keyof Partial<T>]: never;
};
+24 -24
View File
@@ -47,78 +47,78 @@ var x4 = f4();
//// [mappedTypes1.d.ts]
declare type Item = {
type Item = {
a: string;
b: number;
c: boolean;
};
declare type T00 = {
type T00 = {
[P in "x" | "y"]: number;
};
declare type T01 = {
type T01 = {
[P in "x" | "y"]: P;
};
declare type T02 = {
type T02 = {
[P in "a" | "b"]: Item[P];
};
declare type T03 = {
type T03 = {
[P in keyof Item]: Date;
};
declare type T10 = {
type T10 = {
[P in keyof Item]: Item[P];
};
declare type T11 = {
type T11 = {
[P in keyof Item]?: Item[P];
};
declare type T12 = {
type T12 = {
readonly [P in keyof Item]: Item[P];
};
declare type T13 = {
type T13 = {
readonly [P in keyof Item]?: Item[P];
};
declare type T20 = {
type T20 = {
[P in keyof Item]: Item[P] | null;
};
declare type T21 = {
type T21 = {
[P in keyof Item]: Array<Item[P]>;
};
declare type T30 = {
type T30 = {
[P in keyof any]: void;
};
declare type T31 = {
type T31 = {
[P in keyof string]: void;
};
declare type T32 = {
type T32 = {
[P in keyof number]: void;
};
declare type T33 = {
type T33 = {
[P in keyof boolean]: void;
};
declare type T34 = {
type T34 = {
[P in keyof undefined]: void;
};
declare type T35 = {
type T35 = {
[P in keyof null]: void;
};
declare type T36 = {
type T36 = {
[P in keyof void]: void;
};
declare type T37 = {
type T37 = {
[P in keyof symbol]: void;
};
declare type T38 = {
type T38 = {
[P in keyof never]: void;
};
declare type T40 = {
type T40 = {
[P in string]: void;
};
declare type T43 = {
type T43 = {
[P in "a" | "b"]: void;
};
declare type T44 = {
type T44 = {
[P in "a" | "b" | "0" | "1"]: void;
};
declare type T47 = {
type T47 = {
[P in string | "a" | "b" | "0" | "1"]: void;
};
declare function f1<T1>(): {
+3 -3
View File
@@ -139,14 +139,14 @@ function f6(shape) {
//// [mappedTypes2.d.ts]
declare function verifyLibTypes<T, K extends keyof T, U>(): void;
declare type Proxy<T> = {
type Proxy<T> = {
get(): T;
set(value: T): void;
};
declare type Proxify<T> = {
type Proxify<T> = {
[P in keyof T]: Proxy<T[P]>;
};
declare type DeepReadonly<T> = {
type DeepReadonly<T> = {
readonly [P in keyof T]: DeepReadonly<T[P]>;
};
declare function assign<T>(obj: T, props: Partial<T>): void;
+1 -1
View File
@@ -65,7 +65,7 @@ function f3(bb) {
declare class Box<P> {
value: P;
}
declare type Boxified<T> = {
type Boxified<T> = {
[K in keyof T]: Box<T[K]>;
};
declare function boxify<T>(obj: T): Boxified<T>;
+21 -21
View File
@@ -92,37 +92,37 @@ var z1;
//// [mappedTypes4.d.ts]
declare type Box<T> = {};
declare type Boxified<T> = {
type Box<T> = {};
type Boxified<T> = {
[P in keyof T]: Box<T[P]>;
};
declare function boxify<T>(obj: T): Boxified<T>;
declare type A = {
type A = {
a: string;
};
declare type B = {
type B = {
b: string;
};
declare type C = {
type C = {
c: string;
};
declare function f1(x: A | B | C | undefined): Boxified<A | B | C | undefined>;
declare type T00 = Partial<A | B | C>;
declare type T01 = Readonly<A | B | C | null | undefined>;
declare type T02 = Boxified<A | B[] | C | string>;
declare type T03 = Readonly<string | number | boolean | null | undefined | void>;
declare type T04 = Boxified<string | number | boolean | null | undefined | void>;
declare type T05 = Partial<"hello" | "world" | 42>;
declare type BoxifiedWithSentinel<T, U> = {
type T00 = Partial<A | B | C>;
type T01 = Readonly<A | B | C | null | undefined>;
type T02 = Boxified<A | B[] | C | string>;
type T03 = Readonly<string | number | boolean | null | undefined | void>;
type T04 = Boxified<string | number | boolean | null | undefined | void>;
type T05 = Partial<"hello" | "world" | 42>;
type BoxifiedWithSentinel<T, U> = {
[P in keyof T]: Box<T[P]> | U;
};
declare type T10 = BoxifiedWithSentinel<A | B | C, null>;
declare type T11 = BoxifiedWithSentinel<A | B | C, undefined>;
declare type T12 = BoxifiedWithSentinel<string, undefined>;
declare type DeepReadonly<T> = {
type T10 = BoxifiedWithSentinel<A | B | C, null>;
type T11 = BoxifiedWithSentinel<A | B | C, undefined>;
type T12 = BoxifiedWithSentinel<string, undefined>;
type DeepReadonly<T> = {
readonly [P in keyof T]: DeepReadonly<T[P]>;
};
declare type Foo = {
type Foo = {
x: number;
y: {
a: string;
@@ -130,7 +130,7 @@ declare type Foo = {
};
z: boolean;
};
declare type DeepReadonlyFoo = {
type DeepReadonlyFoo = {
readonly x: number;
readonly y: {
readonly a: string;
@@ -140,12 +140,12 @@ declare type DeepReadonlyFoo = {
};
declare var x1: DeepReadonly<Foo>;
declare var x1: DeepReadonlyFoo;
declare type Z = {
type Z = {
a: number;
};
declare type Clone<T> = {
type Clone<T> = {
[P in keyof (T & {})]: (T & {})[P];
};
declare type M = Clone<Z>;
type M = Clone<Z>;
declare var z1: Z;
declare var z1: Clone<Z>;
+20 -20
View File
@@ -198,65 +198,65 @@ x5.b = 1;
//// [mappedTypes6.d.ts]
declare type T00<T> = {
type T00<T> = {
[P in keyof T]: T[P];
};
declare type T01<T> = {
type T01<T> = {
[P in keyof T]?: T[P];
};
declare type T02<T> = {
type T02<T> = {
[P in keyof T]+?: T[P];
};
declare type T03<T> = {
type T03<T> = {
[P in keyof T]-?: T[P];
};
declare type T04<T> = {
type T04<T> = {
readonly [P in keyof T]: T[P];
};
declare type T05<T> = {
type T05<T> = {
readonly [P in keyof T]?: T[P];
};
declare type T06<T> = {
type T06<T> = {
readonly [P in keyof T]+?: T[P];
};
declare type T07<T> = {
type T07<T> = {
readonly [P in keyof T]-?: T[P];
};
declare type T08<T> = {
type T08<T> = {
+readonly [P in keyof T]: T[P];
};
declare type T09<T> = {
type T09<T> = {
+readonly [P in keyof T]?: T[P];
};
declare type T10<T> = {
type T10<T> = {
+readonly [P in keyof T]+?: T[P];
};
declare type T11<T> = {
type T11<T> = {
+readonly [P in keyof T]-?: T[P];
};
declare type T12<T> = {
type T12<T> = {
-readonly [P in keyof T]: T[P];
};
declare type T13<T> = {
type T13<T> = {
-readonly [P in keyof T]?: T[P];
};
declare type T14<T> = {
type T14<T> = {
-readonly [P in keyof T]+?: T[P];
};
declare type T15<T> = {
type T15<T> = {
-readonly [P in keyof T]-?: T[P];
};
declare function f1<T>(x: Required<T>, y: T, z: Partial<T>): void;
declare type Denullified<T> = {
type Denullified<T> = {
[P in keyof T]-?: NonNullable<T[P]>;
};
declare function f2<T>(w: Denullified<T>, x: Required<T>, y: T, z: Partial<T>): void;
declare function f3<T>(w: Denullified<T>, x: Required<T>, y: T, z: Partial<T>): void;
declare type Readwrite<T> = {
type Readwrite<T> = {
-readonly [P in keyof T]: T[P];
};
declare function f10<T>(x: Readonly<T>, y: T, z: Readwrite<T>): void;
declare type Foo = {
type Foo = {
a: number;
b: number | undefined;
c?: number;
@@ -264,7 +264,7 @@ declare type Foo = {
};
declare let x1: Foo;
declare let x2: Required<Foo>;
declare type Bar = {
type Bar = {
a: number;
readonly b: number;
};
@@ -125,44 +125,44 @@ function acceptMappedArray(arr) {
//// [mappedTypesArraysTuples.d.ts]
declare type Box<T> = {
type Box<T> = {
value: T;
};
declare type Boxified<T> = {
type Boxified<T> = {
[P in keyof T]: Box<T[P]>;
};
declare type T00 = Boxified<[number, string?, ...boolean[]]>;
declare type T01 = Partial<[number, string?, ...boolean[]]>;
declare type T02 = Required<[number, string?, ...boolean[]]>;
declare type T10 = Boxified<string[]>;
declare type T11 = Partial<string[]>;
declare type T12 = Required<string[]>;
declare type T13 = Boxified<ReadonlyArray<string>>;
declare type T14 = Partial<ReadonlyArray<string>>;
declare type T15 = Required<ReadonlyArray<string>>;
declare type T20 = Boxified<(string | undefined)[]>;
declare type T21 = Partial<(string | undefined)[]>;
declare type T22 = Required<(string | undefined)[]>;
declare type T23 = Boxified<ReadonlyArray<string | undefined>>;
declare type T24 = Partial<ReadonlyArray<string | undefined>>;
declare type T25 = Required<ReadonlyArray<string | undefined>>;
declare type T30 = Boxified<Partial<string[]>>;
declare type T31 = Partial<Boxified<string[]>>;
declare type A = {
type T00 = Boxified<[number, string?, ...boolean[]]>;
type T01 = Partial<[number, string?, ...boolean[]]>;
type T02 = Required<[number, string?, ...boolean[]]>;
type T10 = Boxified<string[]>;
type T11 = Partial<string[]>;
type T12 = Required<string[]>;
type T13 = Boxified<ReadonlyArray<string>>;
type T14 = Partial<ReadonlyArray<string>>;
type T15 = Required<ReadonlyArray<string>>;
type T20 = Boxified<(string | undefined)[]>;
type T21 = Partial<(string | undefined)[]>;
type T22 = Required<(string | undefined)[]>;
type T23 = Boxified<ReadonlyArray<string | undefined>>;
type T24 = Partial<ReadonlyArray<string | undefined>>;
type T25 = Required<ReadonlyArray<string | undefined>>;
type T30 = Boxified<Partial<string[]>>;
type T31 = Partial<Boxified<string[]>>;
type A = {
a: string;
};
declare type B = {
type B = {
b: string;
};
declare type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
declare type ReadWrite<T> = {
type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
type ReadWrite<T> = {
-readonly [P in keyof T]: T[P];
};
declare type T50 = Readonly<string[]>;
declare type T51 = Readonly<[number, number]>;
declare type T52 = Partial<Readonly<string[]>>;
declare type T53 = Readonly<Partial<string[]>>;
declare type T54 = ReadWrite<Required<T53>>;
type T50 = Readonly<string[]>;
type T51 = Readonly<[number, number]>;
type T52 = Partial<Readonly<string[]>>;
type T53 = Readonly<Partial<string[]>>;
type T54 = ReadWrite<Required<T53>>;
declare function unboxify<T>(x: Boxified<T>): T;
declare let x10: [Box<number>, Box<string>, ...Box<boolean>[]];
declare let y10: [number, string, ...boolean[]];
@@ -189,24 +189,24 @@ declare let y22: {
a: number;
b: string[];
};
declare type __Awaited<T> = T extends PromiseLike<infer U> ? U : T;
declare type Awaitified<T> = {
type __Awaited<T> = T extends PromiseLike<infer U> ? U : T;
type Awaitified<T> = {
[P in keyof T]: __Awaited<T[P]>;
};
declare function all<T extends any[]>(...values: T): Promise<Awaitified<T>>;
declare function f1(a: number, b: Promise<number>, c: string[], d: Promise<string[]>): void;
declare function f2<T extends any[]>(a: Boxified<T>): void;
declare type ElementType<T> = T extends Array<infer U> ? U : never;
declare type Mapped<T> = {
type ElementType<T> = T extends Array<infer U> ? U : never;
type Mapped<T> = {
[K in keyof T]: T[K];
};
declare type F<T> = ElementType<Mapped<T>>;
declare type R1 = F<[string, number, boolean]>;
declare type R2 = ElementType<Mapped<[string, number, boolean]>>;
type F<T> = ElementType<Mapped<T>>;
type R1 = F<[string, number, boolean]>;
type R2 = ElementType<Mapped<[string, number, boolean]>>;
declare function acceptArray(arr: any[]): void;
declare function mapArray<T extends any[]>(arr: T): Mapped<T>;
declare function acceptMappedArray<T extends any[]>(arr: T): void;
declare type Unconstrained<T> = ElementType<Mapped<T>>;
declare type T1 = Unconstrained<[string, number, boolean]>;
declare type Constrained<T extends any[]> = ElementType<Mapped<T>>;
declare type T2 = Constrained<[string, number, boolean]>;
type Unconstrained<T> = ElementType<Mapped<T>>;
type T1 = Unconstrained<[string, number, boolean]>;
type Constrained<T extends any[]> = ElementType<Mapped<T>>;
type T2 = Constrained<[string, number, boolean]>;
@@ -322,7 +322,7 @@ function f9(x) {
//// [mixinAccessModifiers.d.ts]
declare type Constructable = new (...args: any[]) => object;
type Constructable = new (...args: any[]) => object;
declare class Private {
constructor(...args: any[]);
private p;
@@ -155,7 +155,7 @@ var Thing3 = /** @class */ (function (_super) {
//// [mixinClassesAnnotated.d.ts]
declare type Constructor<T> = new (...args: any[]) => T;
type Constructor<T> = new (...args: any[]) => T;
declare class Base {
x: number;
y: number;
@@ -114,8 +114,8 @@ exports.argumentsOfG = f.apply(void 0, getArgsForInjection(g)); // captured argu
//// [namedTupleMembers.d.ts]
export declare type Segment = [length: number, count: number];
export declare type SegmentAnnotated = [
export type Segment = [length: number, count: number];
export type SegmentAnnotated = [
/**
* Size of message buffer segment handles
*/
@@ -125,16 +125,16 @@ export declare type SegmentAnnotated = [
*/
count: number
];
export declare type WithOptAndRest = [first: number, second?: number, ...rest: string[]];
export declare type Func<T extends any[]> = (...x: T) => void;
export type WithOptAndRest = [first: number, second?: number, ...rest: string[]];
export type Func<T extends any[]> = (...x: T) => void;
export declare const func: Func<SegmentAnnotated>;
export declare function useState<T>(initial: T): [value: T, setter: (T: any) => void];
export declare type Iter = Func<[step: number, iterations: number]>;
export type Iter = Func<[step: number, iterations: number]>;
export declare function readSegment([length, count]: [number, number]): void;
export declare const val: [number, number];
export declare type RecursiveTupleA = [initial: string, next: RecursiveTupleA];
export declare type RecursiveTupleB = [first: string, ptr: RecursiveTupleB];
export declare type RecusiveRest = [first: string, ...rest: RecusiveRest[]];
export declare type RecusiveRest2 = [string, ...RecusiveRest2[]];
export type RecursiveTupleA = [initial: string, next: RecursiveTupleA];
export type RecursiveTupleB = [first: string, ptr: RecursiveTupleB];
export type RecusiveRest = [first: string, ...rest: RecusiveRest[]];
export type RecusiveRest2 = [string, ...RecusiveRest2[]];
export declare const argumentsOfGAsFirstArgument: [[elem: object, index: number]];
export declare const argumentsOfG: [elem: object, index: number];
@@ -28,16 +28,16 @@ exports.__esModule = true;
//// [namedTupleMembersErrors.d.ts]
export declare type Segment1 = [length: number, number];
export declare type Segment2 = [number, size: number];
export declare type List = [item: any, ...any];
export declare type List2 = [any, ...remainder: any];
export declare type Pair = [item: any, any?];
export declare type Pair2 = [any, last?: any];
export declare type Opt = [element: string?];
export declare type Trailing = [first: string, rest: ...string[]];
export declare type OptTrailing = [first: string, rest: ...?string[]];
export declare type OptRest = [first: string, ...rest?: string[]];
export declare type NonArrayRest = [first: string, ...rest: number];
export declare type RecusiveRestUnlabeled = [string, ...RecusiveRestUnlabeled];
export declare type RecusiveRest = [first: string, ...rest: RecusiveRest];
export type Segment1 = [length: number, number];
export type Segment2 = [number, size: number];
export type List = [item: any, ...any];
export type List2 = [any, ...remainder: any];
export type Pair = [item: any, any?];
export type Pair2 = [any, last?: any];
export type Opt = [element: string?];
export type Trailing = [first: string, rest: ...string[]];
export type OptTrailing = [first: string, rest: ...?string[]];
export type OptRest = [first: string, ...rest?: string[]];
export type NonArrayRest = [first: string, ...rest: number];
export type RecusiveRestUnlabeled = [string, ...RecusiveRestUnlabeled];
export type RecusiveRest = [first: string, ...rest: RecusiveRest];
@@ -523,4 +523,4 @@ export interface ComponentConstructor<T extends object> {
pause(): void;
};
}
export declare type ComponentDefinition<T extends object = object> = T & Partial<Component> & ThisType<T & Component>;
export type ComponentDefinition<T extends object = object> = T & Partial<Component> & ThisType<T & Component>;
@@ -28,7 +28,7 @@ function foo() {
interface FindOperator<T> {
foo: T;
}
declare type FindConditions<T> = {
type FindConditions<T> = {
[P in keyof T]?: FindConditions<T[P]> | FindOperator<FindConditions<T[P]>>;
};
declare function foo<Entity>(): void;
@@ -31,6 +31,6 @@ exports.b = null;
//// [index.d.ts]
export declare type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface;
export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface;
export declare const a: import("pkg").RequireInterface;
export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface;
@@ -31,6 +31,6 @@ exports.b = null;
//// [index.d.ts]
export declare type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface;
export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface;
export declare const a: import("pkg").RequireInterface;
export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface;
@@ -120,28 +120,28 @@ exports.b = null;
//// [index.d.ts]
export declare type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface;
export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface;
export declare const a: import("pkg").RequireInterface;
export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface;
//// [other.d.ts]
export declare type LocalInterface = import("pkg", { assert: {} });
export type LocalInterface = import("pkg", { assert: {} });
export declare const a: any;
export declare const b: any;
//// [other2.d.ts]
export declare type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface;
export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface;
export declare const a: import("pkg").RequireInterface;
export declare const b: any;
//// [other3.d.ts]
export declare type LocalInterface = import("pkg", { assert: {} })[{
export type LocalInterface = import("pkg", { assert: {} })[{
"resolution-mode": "require";
}];
export declare const a: any;
export declare const b: any;
//// [other4.d.ts]
export declare type LocalInterface = import("pkg", { assert: {} });
export type LocalInterface = import("pkg", { assert: {} });
export declare const a: any, Asserts1: any, RequireInterface: any;
export declare const b: any, Asserts2: any, ImportInterface: any;
//// [other5.d.ts]
export declare type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface;
export type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface;
export declare const a: import("pkg").RequireInterface;
export declare const b: any;
Loaded 100 of 171 files, more files were not shown because too many files have changed in this diff. Show more