// @declaration: true interface A { a: number; } interface B { b: number; } interface C { c: number; } interface D { d: number; } interface AB { a: number; b: number; } interface BC { b: number; c: number; } declare const a: A; declare const b: B; declare const c: C; declare const d: D; declare const ab: AB; declare const bc: BC; declare const x: any; // function without type parameters declare function f00(a?: A): A; // no inference f00(); f00(a); // function with a type parameter without a default declare function f01(a?: T): T; // inference f01(); f01(a); // no inference, fully supplied f01(); f01(a); // function with a type paramter with a default declare function f02(a?: T): T; // inference f02(); f02(a); f02(b); // no inference, fully supplied f02(); f02(a); f02(); f02(b); // function with a type parameter with a default that refers to itself declare function f03(a?: T): T; // inference f03(); f03(a); f03(b); // no inference, fully supplied f03(); f03(a); f03(); f03(b); // function with a type paramter without a default and a type parameter with a default declare function f04(a?: T, b?: U): [T, U]; // inference f04(); f04(a); f04(a, b); f04(a, c); // no inference, partially supplied f04(); f04(a); f04(a, b); // no inference, fully supplied f04(); f04(a); f04(a, b); f04(); f04(a); f04(a, c); // function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter declare function f05(a?: T, b?: U): [T, U]; // inference f05(); f05(a); f05(a, a); f05(a, b); // no inference, partially supplied f05(); f05(a); f05(a, a); // no inference, fully supplied f05(); f05(a); f05(a, b); // function with a type parameter with a default that refers to an earlier type parameter with a default declare function f06(a?: T, b?: U): [T, U]; // inference f06(); f06(a); f06(a, a); f06(a, b); f06(b, a); f06(b, b); // no inference, partially supplied f06(); f06(a); f06(a, a); f06(); f06(b); f06(b, b); // no inference, fully supplied f06(); f06(a); f06(a, b); f06(); f06(b); f06(b, c); // function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter with a default declare function f07(a?: T, b?: U, c?: V): [T, U, V]; // inference f07(); f07(a, b); f07(a, c); f07(a, b, b); f07(a, b, c); f07(a, c, b); f07(a, c, c); // no inference, partially supplied f07(); f07(a); f07(a, b); f07(a, b, b); f07(); f07(a); f07(a, b); f07(a, b, b); f07(); f07(a); f07(a, c); f07(a, c, c); // no inference, fully supplied f07(); f07(a); f07(a, b); f07(a, b, c); f07(); f07(a); f07(a, c); f07(a, c, d); // function with a type parameter with a default that refers to an earlier type parameter with a constraint declare function f08(a?: T, b?: U): [T, U]; // inference f08(); f08(a); f08(a, a); f08(a, b); // no inference, partially supplied f08(); f08(a); f08(a, a); // no inference, fully supplied f08(); f08(a); f08(a, b); // function with a type parameter with a constraint and a default that refers to an earlier type parameter declare function f09(a?: T, b?: U): [T, U]; // inference f09(); f09(a); f09(a, a); f09(a, ab); // no inference, partially supplied f09(); f09(a); f09(a, a); f09(a, ab); // no inference, fully supplied f09(); f09(a); f09(a, ab); // function with a type parameter with a constraint and a default that refers to an earlier type parameter with a constraint declare function f10(a?: T, b?: U): [T, U]; // inference f10(); f10(a); f10(a, a); f10(a, ab); // no inference, partially supplied f10(); f10(a); f10(a, a); f10(a, ab); // no inference, fully supplied f10(); f10(a); f10(a, a); f10(a, ab); f10(); f10(a); f10(a, ab); // function with a type parameter with a default that refers to an earier type parameter in a union declare function f11(a?: T, b?: U): [T, U]; // inference f11(); f11(a); f11(a, a); f11(a, b); f11(a, c); // no inference, partially supplied f11(); f11(a); f11(a, a); f11(a, b); // no inference, fully supplied f11(); f11(a); f11(a, c); // function with a type parameter with a default that refers to an earlier type parameter in an intersection declare function f12(a?: T, b?: U): [T, U]; // inference f12(); f12(a); f12(a, a); f12(a, b); f12(a, c); // no inference, partially supplied f12(); f12(a); f12(a, ab); // no inference, fully supplied f12(); f12(a); f12(a, c); // function with a type parameter with a default that refers to a later type parameter with a default declare function f13(a?: T, b?: U): [T, U]; // inference f13(); f13(a); f13(a, b); f13(a, c); // no inference, partially supplied f13(); f13(a); f13(a, b); // no inference, fully supplied f13(); f13(a); f13(a, c); f13(a, c); // function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default declare function f14(a?: T, b?: U, c?: V): [T, U, V]; // inference f14(); f14(a); f14(a, b); f14(a, b, c); f14(a, b, d); // no inference, partially supplied f14(); f14(a); f14(a, b); f14(a, b, c); f14(); f14(a); f14(a, b); f14(a, b, c); // no inference fully supplied f14(); f14(a); f14(a, b); f14(a, b, d); // function with two type parameters with defaults that mutually refer to each other declare function f15(a?: T, b?: U): [T, U]; // inference f15(); f15(a); f15(a, b); // no inference, partially supplied f15(); f15(a); f15(a, a); // no inference, fully supplied f15(); f15(a); f15(a, b); // function with a type parameter without a default and two type parameters with defaults that mutually refer to each other declare function f16(a?: T, b?: U, c?: V): [T, U, V]; // no inference f16(); f16(a); f16(a, b); f16(a, b, b); // no inference, partially supplied f16(); f16(a); f16(a, b); f16(a, b, b); f16(); f16(a); f16(a, b); f16(a, b, b); // no inference, fully supplied f16(); f16(a); f16(a, b); f16(a, b, d); // function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union declare function f17(a?: T, b?: U): [T, U]; // inference f17(); f17(a); f17(a, a); f17(a, b); f17(a, c); // no inference, partially supplied f17(); f17(a); f17(a, a); f17(a, b); // no inference, fully supplied f17(); f17(a); f17(a, c); // function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union declare function f18(a?: T, b?: U, c?: V): [T, U, V]; // inference f18(); f18(a); f18(a, b); f18(a, b, b); f18(a, b, c); // no inference, partially supplied f18(); f18(a); f18(a, b); f18(a, b, b); f18(a, b, c); f18(); f18(a); f18(a, b); f18(a, b, b); f18(a, b, c); // no inference, fully supplied f18(); f18(a); f18(a, b); f18(a, b, d); // function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection declare function f19(a?: T, b?: U): [T, U]; // inference f19(); f19(a); f19(a, a); f19(a, b); f19(a, ab); f19(a, c); // no inference, partially supplied f19(); f19(a); f19(a, ab); // no inference, fully supplied f19(); f19(a); f19(a, c); // function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection declare function f20(a?: T, b?: U, c?: V): [T, U, V]; // inference f20(); f20(a); f20(a, b); f20(a, b, c); // no inference, partially supplied f20(); f20(a); f20(a, b); f20(a, b, bc); f20(); f20(a); f20(a, b); f20(a, b, bc); // no inference, fully supplied f20(); f20(a); f20(a, b); f20(a, b, d); interface i00 { a: T; } const i00c00 = (x).a; const i00c01 = (>x).a; interface i01 { a: [T, U]; } const i01c00 = (>x).a; const i01c01 = (>x).a; interface i02 { a: [T, U]; } const i02c00 = (>x).a; const i02c01 = (>x).a; const i02c02 = (>x).a; const i02c03 = (>x).a; const i02c04 = (>x).a; interface i03 { a: [T, U]; } const i03c00 = (>x).a; const i03c01 = (>x).a; const i03c02 = (>x).a; const i03c03 = (>x).a; const i03c04 = (>x).a; interface i04 {} interface i04 {} interface i04 {} interface i04 {} interface i05 { a: T; } const i05c00 = (x).a; const i05c01 = (>x).a; interface i06 { a: [T, U]; } const i06c00 = (x).a; const i06c01 = (>x).a; const i06c02 = (>x).a; interface i07 { a: A; } interface i07 { b: A; } const i07c00 = (x).a; const i07c01 = (x).b; const i07c02 = (>x).a; const i07c03 = (>x).b; interface Base01 { a: T; } interface Base01Constructor { new (a?: T): Base01; } declare const Base01: Base01Constructor; const Base01c00 = new Base01(); const Base01c01 = new Base01(1); const Base01c02 = new Base01(); const Base01c03 = new Base01(1); declare class Derived01 extends Base01 { } const Derived01c00 = new Derived01(); const Derived01c01 = new Derived01(1); const Derived01c02 = new Derived01(); const Derived01c03 = new Derived01(1); declare class Derived02 extends Base01 { } const Derived02c00 = new Derived02(); const Derived02c01 = new Derived02(1); const Derived02c02 = new Derived02(); const Derived02c03 = new Derived02(1); // https://github.com/Microsoft/TypeScript/issues/16211 interface Base02 {} interface Base02Constructor { new (a: T): Base02 & T; } declare const Base02: Base02Constructor; declare class Derived03 extends Base02 {} const Derived03c00 = new Derived03(ab); const Derived03c01 = Derived03c00.a; type DerivedProps = keyof Derived03; type t00 = { a: T; } const t00c00 = (x).a; const t00c01 = (>x).a; type t01 = { a: [T, U]; } const t01c00 = (>x).a; const t01c01 = (>x).a; type t02 = { a: [T, U]; } const t02c00 = (>x).a; const t02c01 = (>x).a; const t02c02 = (>x).a; const t02c03 = (>x).a; const t02c04 = (>x).a; type t03 = { a: [T, U]; } const t03c00 = (>x).a; const t03c01 = (>x).a; const t03c02 = (>x).a; const t03c03 = (>x).a; const t03c04 = (>x).a; // https://github.com/Microsoft/TypeScript/issues/16221 interface SelfReference> {}