Added comments and additional circularity tests
This commit is contained in:
parent
25cb02e267
commit
ca16ba8fe7
8 changed files with 614 additions and 184 deletions
|
@ -4840,15 +4840,60 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
function getDefaultOfTypeParameter(typeParameter: TypeParameter): Type {
|
||||
/**
|
||||
* Gets the default type for a type parameter.
|
||||
*
|
||||
* If the type parameter is the result of an instantiation, this gets the instantiated
|
||||
* default type of its target. If the type parameter has no default type, `undefined`
|
||||
* is returned.
|
||||
*
|
||||
* This function *does not* perform a circularity check.
|
||||
*/
|
||||
function getDefaultFromTypeParameter(typeParameter: TypeParameter): Type | undefined {
|
||||
if (!typeParameter.default) {
|
||||
if (typeParameter.target) {
|
||||
const targetDefault = getDefaultFromTypeParameter(typeParameter.target);
|
||||
typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintOrDefaultType;
|
||||
}
|
||||
else {
|
||||
const defaultDeclaration = typeParameter.symbol && forEach(typeParameter.symbol.declarations, decl => isTypeParameter(decl) && decl.default);
|
||||
typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintOrDefaultType;
|
||||
}
|
||||
}
|
||||
return typeParameter.default === noConstraintOrDefaultType ? undefined : typeParameter.default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default type for a type parameter.
|
||||
*
|
||||
* If the type parameter is the result of an instantiation, this gets the instantiated
|
||||
* default type of its target. If the type parameter has no default type, or if the default
|
||||
* type circularly references the type parameter, `undefined` is returned.
|
||||
*
|
||||
* This function *does* perform a circularity check.
|
||||
*/
|
||||
function getDefaultOfTypeParameter(typeParameter: TypeParameter): Type | undefined {
|
||||
return hasNonCircularDefault(typeParameter) ? getDefaultFromTypeParameter(typeParameter) : undefined;
|
||||
}
|
||||
|
||||
function hasNonCircularDefault(type: TypeParameter) {
|
||||
return getResolvedDefault(type) !== circularConstraintOrDefaultType;
|
||||
/**
|
||||
* Determines whether a type parameter has a non-circular default type.
|
||||
*
|
||||
* Note that this function also returns `true` if a type parameter *does not* have a
|
||||
* default type.
|
||||
*/
|
||||
function hasNonCircularDefault(typeParameter: TypeParameter): boolean {
|
||||
return getResolvedDefault(typeParameter) !== circularConstraintOrDefaultType;
|
||||
}
|
||||
|
||||
function getResolvedDefault(typeParameter: TypeParameter) {
|
||||
/**
|
||||
* Resolves the default type of a type parameter.
|
||||
*
|
||||
* If the type parameter has no default, the `noConstraintOrDefaultType` singleton is
|
||||
* returned. If the type parameter has a circular default, the
|
||||
* `circularConstraintOrDefaultType` singleton is returned.
|
||||
*/
|
||||
function getResolvedDefault(typeParameter: TypeParameter): Type {
|
||||
if (!typeParameter.resolvedDefault) {
|
||||
if (!pushTypeResolution(typeParameter, TypeSystemPropertyName.ResolvedDefault)) {
|
||||
return circularConstraintOrDefaultType;
|
||||
|
@ -4863,6 +4908,12 @@ namespace ts {
|
|||
return typeParameter.resolvedDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively resolves the default type for a type.
|
||||
*
|
||||
* If the type is a union or intersection type and any of its constituents is a circular
|
||||
* reference, the `circularConstraintOrDefaultType` singleton is returned.
|
||||
*/
|
||||
function getResolvedDefaultWorker(type: Type): Type {
|
||||
if (type.flags & TypeFlags.TypeParameter) {
|
||||
return getResolvedDefault(<TypeParameter>type);
|
||||
|
@ -5173,6 +5224,14 @@ namespace ts {
|
|||
return minTypeArgumentCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill in default types for unsupplied type arguments. If `typeArguments` is undefined
|
||||
* when a default type is supplied, a new array will be created and returned.
|
||||
*
|
||||
* @param typeArguments The supplied type arguments.
|
||||
* @param typeParameters The requested type parameters.
|
||||
* @param minTypeArgumentCount The minimum number of required type arguments.
|
||||
*/
|
||||
function fillMissingTypeArguments(typeArguments: Type[] | undefined, typeParameters: TypeParameter[] | undefined, minTypeArgumentCount: number) {
|
||||
const numTypeParameters = typeParameters ? typeParameters.length : 0;
|
||||
if (numTypeParameters) {
|
||||
|
@ -5488,20 +5547,6 @@ namespace ts {
|
|||
return typeParameter.constraint === noConstraintOrDefaultType ? undefined : typeParameter.constraint;
|
||||
}
|
||||
|
||||
function getDefaultFromTypeParameter(typeParameter: TypeParameter): Type | undefined {
|
||||
if (!typeParameter.default) {
|
||||
if (typeParameter.target) {
|
||||
const targetDefault = getDefaultFromTypeParameter(typeParameter.target);
|
||||
typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintOrDefaultType;
|
||||
}
|
||||
else {
|
||||
const defaultDeclaration = typeParameter.symbol && forEach(typeParameter.symbol.declarations, decl => isTypeParameter(decl) && decl.default);
|
||||
typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintOrDefaultType;
|
||||
}
|
||||
}
|
||||
return typeParameter.default === noConstraintOrDefaultType ? undefined : typeParameter.default;
|
||||
}
|
||||
|
||||
function getParentSymbolOfTypeParameter(typeParameter: TypeParameter): Symbol {
|
||||
return getSymbolOfNode(getDeclarationOfKind(typeParameter.symbol, SyntaxKind.TypeParameter).parent);
|
||||
}
|
||||
|
@ -13535,6 +13580,7 @@ namespace ts {
|
|||
? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false)
|
||||
: undefined;
|
||||
|
||||
// fix each supplied type argument in the inference context
|
||||
if (typeArguments) {
|
||||
for (let i = 0; i < typeArguments.length; i++) {
|
||||
inferenceContext.inferredTypes[i] = getTypeFromTypeNode(typeArguments[i]);
|
||||
|
@ -13545,8 +13591,10 @@ namespace ts {
|
|||
while (true) {
|
||||
candidate = originalCandidate;
|
||||
if (candidate.typeParameters) {
|
||||
typeArgumentsAreValid = typeArguments ? checkTypeArguments(candidate, typeArguments, inferenceContext.inferredTypes, /*reportErrors*/ false) : true;
|
||||
// Check any supplied type arguments against the candidate.
|
||||
typeArgumentsAreValid = !typeArguments || checkTypeArguments(candidate, typeArguments, inferenceContext.inferredTypes, /*reportErrors*/ false);
|
||||
if (typeArgumentsAreValid) {
|
||||
// Infer any unsupplied type arguments for the candidate.
|
||||
inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext);
|
||||
typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,28 @@ const f03c06 = f03<number, number>();
|
|||
const f03c07 = f03<number, number>(1);
|
||||
const f03c08 = f03<number, number>(1, 2);
|
||||
|
||||
declare function f04<T, U = T | { a: number }>(a?: T, b?: U): [T, U];
|
||||
const f04c00 = f04();
|
||||
const f04c01 = f04(1);
|
||||
const f04c02 = f04(1, 1);
|
||||
const f04c03 = f04<number>();
|
||||
const f04c04 = f04<number>(1);
|
||||
const f04c05 = f04<number>(1, 2);
|
||||
const f04c06 = f04<number, number>();
|
||||
const f04c07 = f04<number, number>(1);
|
||||
const f04c08 = f04<number, number>(1, 2);
|
||||
|
||||
declare function f05<T, U = T & { a: number }>(a?: T, b?: U): [T, U];
|
||||
const f05c00 = f05();
|
||||
const f05c01 = f05(1);
|
||||
const f05c02 = f05(1, 1);
|
||||
const f05c03 = f05<number>();
|
||||
const f05c04 = f05<number>(1);
|
||||
const f05c05 = f05<number>(1, 2);
|
||||
const f05c06 = f05<number, number>();
|
||||
const f05c07 = f05<number, number>(1);
|
||||
const f05c08 = f05<number, number>(1, 2);
|
||||
|
||||
interface i00<T = number> { a: T; }
|
||||
const i00c00 = (<i00>x).a;
|
||||
const i00c01 = (<i00<number>>x).a;
|
||||
|
@ -120,6 +142,24 @@ var f03c05 = f03(1, 2);
|
|||
var f03c06 = f03();
|
||||
var f03c07 = f03(1);
|
||||
var f03c08 = f03(1, 2);
|
||||
var f04c00 = f04();
|
||||
var f04c01 = f04(1);
|
||||
var f04c02 = f04(1, 1);
|
||||
var f04c03 = f04();
|
||||
var f04c04 = f04(1);
|
||||
var f04c05 = f04(1, 2);
|
||||
var f04c06 = f04();
|
||||
var f04c07 = f04(1);
|
||||
var f04c08 = f04(1, 2);
|
||||
var f05c00 = f05();
|
||||
var f05c01 = f05(1);
|
||||
var f05c02 = f05(1, 1);
|
||||
var f05c03 = f05();
|
||||
var f05c04 = f05(1);
|
||||
var f05c05 = f05(1, 2);
|
||||
var f05c06 = f05();
|
||||
var f05c07 = f05(1);
|
||||
var f05c08 = f05(1, 2);
|
||||
var i00c00 = x.a;
|
||||
var i00c01 = x.a;
|
||||
var i01c00 = x.a;
|
||||
|
@ -187,6 +227,46 @@ declare const f03c05: [number, number];
|
|||
declare const f03c06: [number, number];
|
||||
declare const f03c07: [number, number];
|
||||
declare const f03c08: [number, number];
|
||||
declare function f04<T, U = T | {
|
||||
a: number;
|
||||
}>(a?: T, b?: U): [T, U];
|
||||
declare const f04c00: [{}, {} | {
|
||||
a: number;
|
||||
}];
|
||||
declare const f04c01: [number, number | {
|
||||
a: number;
|
||||
}];
|
||||
declare const f04c02: [number, number];
|
||||
declare const f04c03: [number, number | {
|
||||
a: number;
|
||||
}];
|
||||
declare const f04c04: [number, number | {
|
||||
a: number;
|
||||
}];
|
||||
declare const f04c05: [number, number];
|
||||
declare const f04c06: [number, number];
|
||||
declare const f04c07: [number, number];
|
||||
declare const f04c08: [number, number];
|
||||
declare function f05<T, U = T & {
|
||||
a: number;
|
||||
}>(a?: T, b?: U): [T, U];
|
||||
declare const f05c00: [{}, {} & {
|
||||
a: number;
|
||||
}];
|
||||
declare const f05c01: [number, number & {
|
||||
a: number;
|
||||
}];
|
||||
declare const f05c02: [number, number];
|
||||
declare const f05c03: [number, number & {
|
||||
a: number;
|
||||
}];
|
||||
declare const f05c04: [number, number & {
|
||||
a: number;
|
||||
}];
|
||||
declare const f05c05: [number, number];
|
||||
declare const f05c06: [number, number];
|
||||
declare const f05c07: [number, number];
|
||||
declare const f05c08: [number, number];
|
||||
interface i00<T = number> {
|
||||
a: T;
|
||||
}
|
||||
|
|
|
@ -178,213 +178,311 @@ const f03c08 = f03<number, number>(1, 2);
|
|||
>f03c08 : Symbol(f03c08, Decl(genericDefaults.ts, 41, 5))
|
||||
>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43))
|
||||
|
||||
declare function f04<T, U = T | { a: number }>(a?: T, b?: U): [T, U];
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 43, 21))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 43, 23))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 43, 21))
|
||||
>a : Symbol(a, Decl(genericDefaults.ts, 43, 33))
|
||||
>a : Symbol(a, Decl(genericDefaults.ts, 43, 47))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 43, 21))
|
||||
>b : Symbol(b, Decl(genericDefaults.ts, 43, 53))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 43, 23))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 43, 21))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 43, 23))
|
||||
|
||||
const f04c00 = f04();
|
||||
>f04c00 : Symbol(f04c00, Decl(genericDefaults.ts, 44, 5))
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
|
||||
const f04c01 = f04(1);
|
||||
>f04c01 : Symbol(f04c01, Decl(genericDefaults.ts, 45, 5))
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
|
||||
const f04c02 = f04(1, 1);
|
||||
>f04c02 : Symbol(f04c02, Decl(genericDefaults.ts, 46, 5))
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
|
||||
const f04c03 = f04<number>();
|
||||
>f04c03 : Symbol(f04c03, Decl(genericDefaults.ts, 47, 5))
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
|
||||
const f04c04 = f04<number>(1);
|
||||
>f04c04 : Symbol(f04c04, Decl(genericDefaults.ts, 48, 5))
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
|
||||
const f04c05 = f04<number>(1, 2);
|
||||
>f04c05 : Symbol(f04c05, Decl(genericDefaults.ts, 49, 5))
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
|
||||
const f04c06 = f04<number, number>();
|
||||
>f04c06 : Symbol(f04c06, Decl(genericDefaults.ts, 50, 5))
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
|
||||
const f04c07 = f04<number, number>(1);
|
||||
>f04c07 : Symbol(f04c07, Decl(genericDefaults.ts, 51, 5))
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
|
||||
const f04c08 = f04<number, number>(1, 2);
|
||||
>f04c08 : Symbol(f04c08, Decl(genericDefaults.ts, 52, 5))
|
||||
>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41))
|
||||
|
||||
declare function f05<T, U = T & { a: number }>(a?: T, b?: U): [T, U];
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 54, 21))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 54, 23))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 54, 21))
|
||||
>a : Symbol(a, Decl(genericDefaults.ts, 54, 33))
|
||||
>a : Symbol(a, Decl(genericDefaults.ts, 54, 47))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 54, 21))
|
||||
>b : Symbol(b, Decl(genericDefaults.ts, 54, 53))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 54, 23))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 54, 21))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 54, 23))
|
||||
|
||||
const f05c00 = f05();
|
||||
>f05c00 : Symbol(f05c00, Decl(genericDefaults.ts, 55, 5))
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
|
||||
const f05c01 = f05(1);
|
||||
>f05c01 : Symbol(f05c01, Decl(genericDefaults.ts, 56, 5))
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
|
||||
const f05c02 = f05(1, 1);
|
||||
>f05c02 : Symbol(f05c02, Decl(genericDefaults.ts, 57, 5))
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
|
||||
const f05c03 = f05<number>();
|
||||
>f05c03 : Symbol(f05c03, Decl(genericDefaults.ts, 58, 5))
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
|
||||
const f05c04 = f05<number>(1);
|
||||
>f05c04 : Symbol(f05c04, Decl(genericDefaults.ts, 59, 5))
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
|
||||
const f05c05 = f05<number>(1, 2);
|
||||
>f05c05 : Symbol(f05c05, Decl(genericDefaults.ts, 60, 5))
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
|
||||
const f05c06 = f05<number, number>();
|
||||
>f05c06 : Symbol(f05c06, Decl(genericDefaults.ts, 61, 5))
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
|
||||
const f05c07 = f05<number, number>(1);
|
||||
>f05c07 : Symbol(f05c07, Decl(genericDefaults.ts, 62, 5))
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
|
||||
const f05c08 = f05<number, number>(1, 2);
|
||||
>f05c08 : Symbol(f05c08, Decl(genericDefaults.ts, 63, 5))
|
||||
>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41))
|
||||
|
||||
interface i00<T = number> { a: T; }
|
||||
>i00 : Symbol(i00, Decl(genericDefaults.ts, 41, 41))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 43, 14))
|
||||
>a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 43, 14))
|
||||
>i00 : Symbol(i00, Decl(genericDefaults.ts, 63, 41))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 65, 14))
|
||||
>a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 65, 14))
|
||||
|
||||
const i00c00 = (<i00>x).a;
|
||||
>i00c00 : Symbol(i00c00, Decl(genericDefaults.ts, 44, 5))
|
||||
>(<i00>x).a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27))
|
||||
>i00 : Symbol(i00, Decl(genericDefaults.ts, 41, 41))
|
||||
>i00c00 : Symbol(i00c00, Decl(genericDefaults.ts, 66, 5))
|
||||
>(<i00>x).a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27))
|
||||
>i00 : Symbol(i00, Decl(genericDefaults.ts, 63, 41))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27))
|
||||
>a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27))
|
||||
|
||||
const i00c01 = (<i00<number>>x).a;
|
||||
>i00c01 : Symbol(i00c01, Decl(genericDefaults.ts, 45, 5))
|
||||
>(<i00<number>>x).a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27))
|
||||
>i00 : Symbol(i00, Decl(genericDefaults.ts, 41, 41))
|
||||
>i00c01 : Symbol(i00c01, Decl(genericDefaults.ts, 67, 5))
|
||||
>(<i00<number>>x).a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27))
|
||||
>i00 : Symbol(i00, Decl(genericDefaults.ts, 63, 41))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27))
|
||||
>a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27))
|
||||
|
||||
interface i01<T, U = T> { a: [T, U]; }
|
||||
>i01 : Symbol(i01, Decl(genericDefaults.ts, 45, 34))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 47, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 47, 16))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 47, 14))
|
||||
>a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 47, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 47, 16))
|
||||
>i01 : Symbol(i01, Decl(genericDefaults.ts, 67, 34))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 69, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 69, 16))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 69, 14))
|
||||
>a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 69, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 69, 16))
|
||||
|
||||
const i01c00 = (<i01<number>>x).a;
|
||||
>i01c00 : Symbol(i01c00, Decl(genericDefaults.ts, 48, 5))
|
||||
>(<i01<number>>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25))
|
||||
>i01 : Symbol(i01, Decl(genericDefaults.ts, 45, 34))
|
||||
>i01c00 : Symbol(i01c00, Decl(genericDefaults.ts, 70, 5))
|
||||
>(<i01<number>>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25))
|
||||
>i01 : Symbol(i01, Decl(genericDefaults.ts, 67, 34))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25))
|
||||
>a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25))
|
||||
|
||||
const i01c01 = (<i01<number, string>>x).a;
|
||||
>i01c01 : Symbol(i01c01, Decl(genericDefaults.ts, 49, 5))
|
||||
>(<i01<number, string>>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25))
|
||||
>i01 : Symbol(i01, Decl(genericDefaults.ts, 45, 34))
|
||||
>i01c01 : Symbol(i01c01, Decl(genericDefaults.ts, 71, 5))
|
||||
>(<i01<number, string>>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25))
|
||||
>i01 : Symbol(i01, Decl(genericDefaults.ts, 67, 34))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25))
|
||||
>a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25))
|
||||
|
||||
interface i02<T extends number, U = T> { a: [T, U]; }
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 51, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 51, 31))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 51, 14))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 51, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 51, 31))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 73, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 73, 31))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 73, 14))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 73, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 73, 31))
|
||||
|
||||
const i02c00 = (<i02<number>>x).a;
|
||||
>i02c00 : Symbol(i02c00, Decl(genericDefaults.ts, 52, 5))
|
||||
>(<i02<number>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42))
|
||||
>i02c00 : Symbol(i02c00, Decl(genericDefaults.ts, 74, 5))
|
||||
>(<i02<number>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
|
||||
const i02c01 = (<i02<1>>x).a;
|
||||
>i02c01 : Symbol(i02c01, Decl(genericDefaults.ts, 53, 5))
|
||||
>(<i02<1>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42))
|
||||
>i02c01 : Symbol(i02c01, Decl(genericDefaults.ts, 75, 5))
|
||||
>(<i02<1>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
|
||||
const i02c02 = (<i02<number, number>>x).a;
|
||||
>i02c02 : Symbol(i02c02, Decl(genericDefaults.ts, 54, 5))
|
||||
>(<i02<number, number>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42))
|
||||
>i02c02 : Symbol(i02c02, Decl(genericDefaults.ts, 76, 5))
|
||||
>(<i02<number, number>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
|
||||
const i02c03 = (<i02<1, number>>x).a;
|
||||
>i02c03 : Symbol(i02c03, Decl(genericDefaults.ts, 55, 5))
|
||||
>(<i02<1, number>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42))
|
||||
>i02c03 : Symbol(i02c03, Decl(genericDefaults.ts, 77, 5))
|
||||
>(<i02<1, number>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
|
||||
const i02c04 = (<i02<number, 1>>x).a;
|
||||
>i02c04 : Symbol(i02c04, Decl(genericDefaults.ts, 56, 5))
|
||||
>(<i02<number, 1>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42))
|
||||
>i02c04 : Symbol(i02c04, Decl(genericDefaults.ts, 78, 5))
|
||||
>(<i02<number, 1>>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40))
|
||||
>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40))
|
||||
|
||||
interface i03<T extends number, U extends T = T> { a: [T, U]; }
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 58, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 58, 31))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 58, 14))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 58, 14))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 58, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 58, 31))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 80, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 80, 31))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 80, 14))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 80, 14))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 80, 14))
|
||||
>U : Symbol(U, Decl(genericDefaults.ts, 80, 31))
|
||||
|
||||
const i03c00 = (<i03<number>>x).a;
|
||||
>i03c00 : Symbol(i03c00, Decl(genericDefaults.ts, 59, 5))
|
||||
>(<i03<number>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37))
|
||||
>i03c00 : Symbol(i03c00, Decl(genericDefaults.ts, 81, 5))
|
||||
>(<i03<number>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
|
||||
const i03c01 = (<i03<1>>x).a;
|
||||
>i03c01 : Symbol(i03c01, Decl(genericDefaults.ts, 60, 5))
|
||||
>(<i03<1>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37))
|
||||
>i03c01 : Symbol(i03c01, Decl(genericDefaults.ts, 82, 5))
|
||||
>(<i03<1>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
|
||||
const i03c02 = (<i03<number, number>>x).a;
|
||||
>i03c02 : Symbol(i03c02, Decl(genericDefaults.ts, 61, 5))
|
||||
>(<i03<number, number>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37))
|
||||
>i03c02 : Symbol(i03c02, Decl(genericDefaults.ts, 83, 5))
|
||||
>(<i03<number, number>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
|
||||
const i03c03 = (<i03<1, 1>>x).a;
|
||||
>i03c03 : Symbol(i03c03, Decl(genericDefaults.ts, 62, 5))
|
||||
>(<i03<1, 1>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37))
|
||||
>i03c03 : Symbol(i03c03, Decl(genericDefaults.ts, 84, 5))
|
||||
>(<i03<1, 1>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
|
||||
const i03c04 = (<i03<number, 1>>x).a;
|
||||
>i03c04 : Symbol(i03c04, Decl(genericDefaults.ts, 63, 5))
|
||||
>(<i03<number, 1>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37))
|
||||
>i03c04 : Symbol(i03c04, Decl(genericDefaults.ts, 85, 5))
|
||||
>(<i03<number, 1>>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37))
|
||||
>x : Symbol(x, Decl(genericDefaults.ts, 0, 13))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50))
|
||||
>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50))
|
||||
|
||||
interface Base01<T> { a: T; }
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 65, 17))
|
||||
>a : Symbol(Base01.a, Decl(genericDefaults.ts, 65, 21))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 65, 17))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 87, 17))
|
||||
>a : Symbol(Base01.a, Decl(genericDefaults.ts, 87, 21))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 87, 17))
|
||||
|
||||
interface Base01Constructor { new <T = number>(a?: T): Base01<T>; }
|
||||
>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 65, 29))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 66, 35))
|
||||
>a : Symbol(a, Decl(genericDefaults.ts, 66, 47))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 66, 35))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 66, 35))
|
||||
>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 87, 29))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 88, 35))
|
||||
>a : Symbol(a, Decl(genericDefaults.ts, 88, 47))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 88, 35))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 88, 35))
|
||||
|
||||
declare const Base01: Base01Constructor;
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13))
|
||||
>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 65, 29))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13))
|
||||
>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 87, 29))
|
||||
|
||||
const Base01c00 = new Base01();
|
||||
>Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 69, 5))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13))
|
||||
>Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 91, 5))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13))
|
||||
|
||||
const Base01c01 = new Base01(1);
|
||||
>Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 70, 5))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13))
|
||||
>Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 92, 5))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13))
|
||||
|
||||
const Base01c02 = new Base01<number>();
|
||||
>Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 71, 5))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13))
|
||||
>Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 93, 5))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13))
|
||||
|
||||
const Base01c03 = new Base01<number>(1);
|
||||
>Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 72, 5))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13))
|
||||
>Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 94, 5))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13))
|
||||
|
||||
declare class Derived01<T> extends Base01<T> { }
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 74, 24))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 74, 24))
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 96, 24))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 96, 24))
|
||||
|
||||
const Derived01c00 = new Derived01();
|
||||
>Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 75, 5))
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40))
|
||||
>Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 97, 5))
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40))
|
||||
|
||||
const Derived01c01 = new Derived01(1);
|
||||
>Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 76, 5))
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40))
|
||||
>Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 98, 5))
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40))
|
||||
|
||||
const Derived01c02 = new Derived01<number>();
|
||||
>Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 77, 5))
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40))
|
||||
>Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 99, 5))
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40))
|
||||
|
||||
const Derived01c03 = new Derived01<number>(1);
|
||||
>Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 78, 5))
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40))
|
||||
>Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 100, 5))
|
||||
>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40))
|
||||
|
||||
declare class Derived02<T = string> extends Base01<T> { }
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 80, 24))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 80, 24))
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 102, 24))
|
||||
>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13))
|
||||
>T : Symbol(T, Decl(genericDefaults.ts, 102, 24))
|
||||
|
||||
const Derived02c00 = new Derived02();
|
||||
>Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 81, 5))
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46))
|
||||
>Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 103, 5))
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46))
|
||||
|
||||
const Derived02c01 = new Derived02(1);
|
||||
>Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 82, 5))
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46))
|
||||
>Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 104, 5))
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46))
|
||||
|
||||
const Derived02c02 = new Derived02<number>();
|
||||
>Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 83, 5))
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46))
|
||||
>Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 105, 5))
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46))
|
||||
|
||||
const Derived02c03 = new Derived02<number>(1);
|
||||
>Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 84, 5))
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46))
|
||||
>Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 106, 5))
|
||||
>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46))
|
||||
|
||||
|
|
|
@ -242,6 +242,140 @@ const f03c08 = f03<number, number>(1, 2);
|
|||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
declare function f04<T, U = T | { a: number }>(a?: T, b?: U): [T, U];
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>T : T
|
||||
>U : U
|
||||
>T : T
|
||||
>a : number
|
||||
>a : T
|
||||
>T : T
|
||||
>b : U
|
||||
>U : U
|
||||
>T : T
|
||||
>U : U
|
||||
|
||||
const f04c00 = f04();
|
||||
>f04c00 : [{}, {} | { a: number; }]
|
||||
>f04() : [{}, {} | { a: number; }]
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
|
||||
const f04c01 = f04(1);
|
||||
>f04c01 : [number, number | { a: number; }]
|
||||
>f04(1) : [number, number | { a: number; }]
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
|
||||
const f04c02 = f04(1, 1);
|
||||
>f04c02 : [number, number]
|
||||
>f04(1, 1) : [number, number]
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
>1 : 1
|
||||
|
||||
const f04c03 = f04<number>();
|
||||
>f04c03 : [number, number | { a: number; }]
|
||||
>f04<number>() : [number, number | { a: number; }]
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
|
||||
const f04c04 = f04<number>(1);
|
||||
>f04c04 : [number, number | { a: number; }]
|
||||
>f04<number>(1) : [number, number | { a: number; }]
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
|
||||
const f04c05 = f04<number>(1, 2);
|
||||
>f04c05 : [number, number]
|
||||
>f04<number>(1, 2) : [number, number]
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
const f04c06 = f04<number, number>();
|
||||
>f04c06 : [number, number]
|
||||
>f04<number, number>() : [number, number]
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
|
||||
const f04c07 = f04<number, number>(1);
|
||||
>f04c07 : [number, number]
|
||||
>f04<number, number>(1) : [number, number]
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
|
||||
const f04c08 = f04<number, number>(1, 2);
|
||||
>f04c08 : [number, number]
|
||||
>f04<number, number>(1, 2) : [number, number]
|
||||
>f04 : <T, U = T | { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
declare function f05<T, U = T & { a: number }>(a?: T, b?: U): [T, U];
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>T : T
|
||||
>U : U
|
||||
>T : T
|
||||
>a : number
|
||||
>a : T
|
||||
>T : T
|
||||
>b : U
|
||||
>U : U
|
||||
>T : T
|
||||
>U : U
|
||||
|
||||
const f05c00 = f05();
|
||||
>f05c00 : [{}, {} & { a: number; }]
|
||||
>f05() : [{}, {} & { a: number; }]
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
|
||||
const f05c01 = f05(1);
|
||||
>f05c01 : [number, number & { a: number; }]
|
||||
>f05(1) : [number, number & { a: number; }]
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
|
||||
const f05c02 = f05(1, 1);
|
||||
>f05c02 : [number, number]
|
||||
>f05(1, 1) : [number, number]
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
>1 : 1
|
||||
|
||||
const f05c03 = f05<number>();
|
||||
>f05c03 : [number, number & { a: number; }]
|
||||
>f05<number>() : [number, number & { a: number; }]
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
|
||||
const f05c04 = f05<number>(1);
|
||||
>f05c04 : [number, number & { a: number; }]
|
||||
>f05<number>(1) : [number, number & { a: number; }]
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
|
||||
const f05c05 = f05<number>(1, 2);
|
||||
>f05c05 : [number, number]
|
||||
>f05<number>(1, 2) : [number, number]
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
const f05c06 = f05<number, number>();
|
||||
>f05c06 : [number, number]
|
||||
>f05<number, number>() : [number, number]
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
|
||||
const f05c07 = f05<number, number>(1);
|
||||
>f05c07 : [number, number]
|
||||
>f05<number, number>(1) : [number, number]
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
|
||||
const f05c08 = f05<number, number>(1, 2);
|
||||
>f05c08 : [number, number]
|
||||
>f05<number, number>(1, 2) : [number, number]
|
||||
>f05 : <T, U = T & { a: number; }>(a?: T, b?: U) => [T, U]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
interface i00<T = number> { a: T; }
|
||||
>i00 : i00<T>
|
||||
>T : T
|
||||
|
|
|
@ -7,25 +7,33 @@ tests/cases/compiler/genericDefaultsErrors.ts(8,59): error TS2344: Type 'T' does
|
|||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(9,44): error TS2344: Type 'T' does not satisfy the constraint 'number'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(10,39): error TS2344: Type 'number' does not satisfy the constraint 'T'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(14,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(17,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(20,11): error TS2428: All declarations of 'i00' must have identical type parameters.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(23,11): error TS2428: All declarations of 'i01' must have identical type parameters.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(25,19): error TS2706: Type parameter 'T' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(26,19): error TS2706: Type parameter 'T' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(26,26): error TS2706: Type parameter 'U' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(27,22): error TS2705: Required type parameters may not follow optional type parameters
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(28,34): error TS2344: Type 'number' does not satisfy the constraint 'string'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(29,52): error TS2344: Type 'T' does not satisfy the constraint 'number'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(11,26): error TS2706: Type parameter 'T' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(11,33): error TS2706: Type parameter 'U' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(12,26): error TS2706: Type parameter 'T' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(12,33): error TS2706: Type parameter 'U' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(13,26): error TS2706: Type parameter 'T' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(13,33): error TS2706: Type parameter 'U' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(14,26): error TS2706: Type parameter 'T' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(14,33): error TS2706: Type parameter 'U' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(18,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(21,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(24,11): error TS2428: All declarations of 'i00' must have identical type parameters.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(27,11): error TS2428: All declarations of 'i01' must have identical type parameters.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(29,19): error TS2706: Type parameter 'T' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(30,19): error TS2706: Type parameter 'T' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(30,26): error TS2706: Type parameter 'U' has a circular default.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(31,22): error TS2705: Required type parameters may not follow optional type parameters
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(32,34): error TS2344: Type 'number' does not satisfy the constraint 'string'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(33,52): error TS2344: Type 'T' does not satisfy the constraint 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(30,37): error TS2344: Type 'T' does not satisfy the constraint 'number'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(31,32): error TS2344: Type 'number' does not satisfy the constraint 'T'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(34,15): error TS2707: Generic type 'i09<T, U, V>' requires between 2 and 3 type arguments
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(35,15): error TS2707: Generic type 'i09<T, U, V>' requires between 2 and 3 type arguments
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(34,37): error TS2344: Type 'T' does not satisfy the constraint 'number'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(35,32): error TS2344: Type 'number' does not satisfy the constraint 'T'.
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(38,15): error TS2707: Generic type 'i09<T, U, V>' requires between 2 and 3 type arguments
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(39,15): error TS2707: Generic type 'i09<T, U, V>' requires between 2 and 3 type arguments
|
||||
tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type 'i09<T, U, V>' requires between 2 and 3 type arguments
|
||||
|
||||
|
||||
==== tests/cases/compiler/genericDefaultsErrors.ts (23 errors) ====
|
||||
==== tests/cases/compiler/genericDefaultsErrors.ts (31 errors) ====
|
||||
|
||||
declare const x: any;
|
||||
|
||||
|
@ -53,15 +61,35 @@ tests/cases/compiler/genericDefaultsErrors.ts(38,15): error TS2707: Generic type
|
|||
declare function f06<T, U extends T = number>(): void;
|
||||
~~~~~~
|
||||
!!! error TS2344: Type 'number' does not satisfy the constraint 'T'.
|
||||
declare function f07<T = U, U = T | { a: number }>(): void;
|
||||
~
|
||||
!!! error TS2706: Type parameter 'T' has a circular default.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2706: Type parameter 'U' has a circular default.
|
||||
declare function f08<T = U, U = T & { a: number }>(): void;
|
||||
~
|
||||
!!! error TS2706: Type parameter 'T' has a circular default.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2706: Type parameter 'U' has a circular default.
|
||||
declare function f09<T = U, U = T | { a: number }>(): void;
|
||||
~
|
||||
!!! error TS2706: Type parameter 'T' has a circular default.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2706: Type parameter 'U' has a circular default.
|
||||
declare function f10<T = U, U = T & { a: number }>(): void;
|
||||
~
|
||||
!!! error TS2706: Type parameter 'T' has a circular default.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2706: Type parameter 'U' has a circular default.
|
||||
|
||||
declare function f07<T, U, V = number>(): void;
|
||||
f07(); // ok
|
||||
f07<1>(); // error
|
||||
declare function f11<T, U, V = number>(): void;
|
||||
f11(); // ok
|
||||
f11<1>(); // error
|
||||
~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
f07<1, 2>(); // ok
|
||||
f07<1, 2, 3>(); // ok
|
||||
f07<1, 2, 3, 4>(); // error
|
||||
f11<1, 2>(); // ok
|
||||
f11<1, 2, 3>(); // ok
|
||||
f11<1, 2, 3, 4>(); // error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
|
|
|
@ -9,13 +9,17 @@ declare function f03<T extends string = number>(): void;
|
|||
declare function f04<T extends string, U extends number = T>(): void;
|
||||
declare function f05<T, U extends number = T>(): void;
|
||||
declare function f06<T, U extends T = number>(): void;
|
||||
declare function f07<T = U, U = T | { a: number }>(): void;
|
||||
declare function f08<T = U, U = T & { a: number }>(): void;
|
||||
declare function f09<T = U, U = T | { a: number }>(): void;
|
||||
declare function f10<T = U, U = T & { a: number }>(): void;
|
||||
|
||||
declare function f07<T, U, V = number>(): void;
|
||||
f07(); // ok
|
||||
f07<1>(); // error
|
||||
f07<1, 2>(); // ok
|
||||
f07<1, 2, 3>(); // ok
|
||||
f07<1, 2, 3, 4>(); // error
|
||||
declare function f11<T, U, V = number>(): void;
|
||||
f11(); // ok
|
||||
f11<1>(); // error
|
||||
f11<1, 2>(); // ok
|
||||
f11<1, 2, 3>(); // ok
|
||||
f11<1, 2, 3, 4>(); // error
|
||||
|
||||
interface i00<T> { }
|
||||
interface i00<T = number> { }
|
||||
|
@ -39,11 +43,11 @@ type i09t03 = i09<1, 2, 3>; // ok
|
|||
type i09t04 = i09<1, 2, 3, 4>; // error
|
||||
|
||||
//// [genericDefaultsErrors.js]
|
||||
f07(); // ok
|
||||
f07(); // error
|
||||
f07(); // ok
|
||||
f07(); // ok
|
||||
f07(); // error
|
||||
f11(); // ok
|
||||
f11(); // error
|
||||
f11(); // ok
|
||||
f11(); // ok
|
||||
f11(); // error
|
||||
|
||||
|
||||
//// [genericDefaultsErrors.d.ts]
|
||||
|
@ -55,7 +59,19 @@ declare function f03<T extends string = number>(): void;
|
|||
declare function f04<T extends string, U extends number = T>(): void;
|
||||
declare function f05<T, U extends number = T>(): void;
|
||||
declare function f06<T, U extends T = number>(): void;
|
||||
declare function f07<T, U, V = number>(): void;
|
||||
declare function f07<T = U, U = T | {
|
||||
a: number;
|
||||
}>(): void;
|
||||
declare function f08<T = U, U = T & {
|
||||
a: number;
|
||||
}>(): void;
|
||||
declare function f09<T = U, U = T | {
|
||||
a: number;
|
||||
}>(): void;
|
||||
declare function f10<T = U, U = T & {
|
||||
a: number;
|
||||
}>(): void;
|
||||
declare function f11<T, U, V = number>(): void;
|
||||
interface i00<T> {
|
||||
}
|
||||
interface i00<T = number> {
|
||||
|
|
|
@ -42,6 +42,28 @@ const f03c06 = f03<number, number>();
|
|||
const f03c07 = f03<number, number>(1);
|
||||
const f03c08 = f03<number, number>(1, 2);
|
||||
|
||||
declare function f04<T, U = T | { a: number }>(a?: T, b?: U): [T, U];
|
||||
const f04c00 = f04();
|
||||
const f04c01 = f04(1);
|
||||
const f04c02 = f04(1, 1);
|
||||
const f04c03 = f04<number>();
|
||||
const f04c04 = f04<number>(1);
|
||||
const f04c05 = f04<number>(1, 2);
|
||||
const f04c06 = f04<number, number>();
|
||||
const f04c07 = f04<number, number>(1);
|
||||
const f04c08 = f04<number, number>(1, 2);
|
||||
|
||||
declare function f05<T, U = T & { a: number }>(a?: T, b?: U): [T, U];
|
||||
const f05c00 = f05();
|
||||
const f05c01 = f05(1);
|
||||
const f05c02 = f05(1, 1);
|
||||
const f05c03 = f05<number>();
|
||||
const f05c04 = f05<number>(1);
|
||||
const f05c05 = f05<number>(1, 2);
|
||||
const f05c06 = f05<number, number>();
|
||||
const f05c07 = f05<number, number>(1);
|
||||
const f05c08 = f05<number, number>(1, 2);
|
||||
|
||||
interface i00<T = number> { a: T; }
|
||||
const i00c00 = (<i00>x).a;
|
||||
const i00c01 = (<i00<number>>x).a;
|
||||
|
|
|
@ -9,13 +9,17 @@ declare function f03<T extends string = number>(): void;
|
|||
declare function f04<T extends string, U extends number = T>(): void;
|
||||
declare function f05<T, U extends number = T>(): void;
|
||||
declare function f06<T, U extends T = number>(): void;
|
||||
declare function f07<T = U, U = T | { a: number }>(): void;
|
||||
declare function f08<T = U, U = T & { a: number }>(): void;
|
||||
declare function f09<T = U, U = T | { a: number }>(): void;
|
||||
declare function f10<T = U, U = T & { a: number }>(): void;
|
||||
|
||||
declare function f07<T, U, V = number>(): void;
|
||||
f07(); // ok
|
||||
f07<1>(); // error
|
||||
f07<1, 2>(); // ok
|
||||
f07<1, 2, 3>(); // ok
|
||||
f07<1, 2, 3, 4>(); // error
|
||||
declare function f11<T, U, V = number>(): void;
|
||||
f11(); // ok
|
||||
f11<1>(); // error
|
||||
f11<1, 2>(); // ok
|
||||
f11<1, 2, 3>(); // ok
|
||||
f11<1, 2, 3, 4>(); // error
|
||||
|
||||
interface i00<T> { }
|
||||
interface i00<T = number> { }
|
||||
|
|
Loading…
Reference in a new issue