mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Support re-aliasing of type alias instantiations (#42284)
* New aliases for type alias instantiations * New aliases for conditional, mapped, and anonymous object type instantiations * Accept new baselines * Fix issues with re-aliasing * Accept new baselines
This commit is contained in:
+66
-42
@@ -12361,15 +12361,18 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function createDeferredTypeReference(target: GenericType, node: TypeReferenceNode | ArrayTypeNode | TupleTypeNode, mapper?: TypeMapper): DeferredTypeReference {
|
||||
const aliasSymbol = getAliasSymbolForTypeNode(node);
|
||||
const aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
|
||||
function createDeferredTypeReference(target: GenericType, node: TypeReferenceNode | ArrayTypeNode | TupleTypeNode, mapper?: TypeMapper, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): DeferredTypeReference {
|
||||
if (!aliasSymbol) {
|
||||
aliasSymbol = getAliasSymbolForTypeNode(node);
|
||||
const localAliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
|
||||
aliasTypeArguments = mapper ? instantiateTypes(localAliasTypeArguments, mapper) : localAliasTypeArguments;
|
||||
}
|
||||
const type = <DeferredTypeReference>createObjectType(ObjectFlags.Reference, target.symbol);
|
||||
type.target = target;
|
||||
type.node = node;
|
||||
type.mapper = mapper;
|
||||
type.aliasSymbol = aliasSymbol;
|
||||
type.aliasTypeArguments = mapper ? instantiateTypes(aliasTypeArguments, mapper) : aliasTypeArguments;
|
||||
type.aliasTypeArguments = aliasTypeArguments;
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -12443,17 +12446,19 @@ namespace ts {
|
||||
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
||||
}
|
||||
|
||||
function getTypeAliasInstantiation(symbol: Symbol, typeArguments: readonly Type[] | undefined): Type {
|
||||
function getTypeAliasInstantiation(symbol: Symbol, typeArguments: readonly Type[] | undefined, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
|
||||
const type = getDeclaredTypeOfSymbol(symbol);
|
||||
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName as string) && typeArguments && typeArguments.length === 1) {
|
||||
return getStringMappingType(symbol, typeArguments[0]);
|
||||
}
|
||||
const links = getSymbolLinks(symbol);
|
||||
const typeParameters = links.typeParameters!;
|
||||
const id = getTypeListId(typeArguments);
|
||||
const id = getTypeListId(typeArguments) + (aliasSymbol ? `@${getSymbolId(aliasSymbol)}` : "");
|
||||
let instantiation = links.instantiations!.get(id);
|
||||
if (!instantiation) {
|
||||
links.instantiations!.set(id, instantiation = instantiateType(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(symbol.valueDeclaration)))));
|
||||
links.instantiations!.set(id, instantiation = instantiateTypeWithAlias(type,
|
||||
createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), isInJSFile(symbol.valueDeclaration))),
|
||||
aliasSymbol, aliasTypeArguments));
|
||||
}
|
||||
return instantiation;
|
||||
}
|
||||
@@ -12479,7 +12484,8 @@ namespace ts {
|
||||
typeParameters.length);
|
||||
return errorType;
|
||||
}
|
||||
return getTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node));
|
||||
const aliasSymbol = getAliasSymbolForTypeNode(node);
|
||||
return getTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
||||
}
|
||||
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
||||
}
|
||||
@@ -13656,7 +13662,7 @@ namespace ts {
|
||||
const result = <IntersectionType>createType(TypeFlags.Intersection);
|
||||
result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ TypeFlags.Nullable);
|
||||
result.types = types;
|
||||
result.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
|
||||
result.aliasSymbol = aliasSymbol;
|
||||
result.aliasTypeArguments = aliasTypeArguments;
|
||||
return result;
|
||||
}
|
||||
@@ -14561,7 +14567,7 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function getConditionalType(root: ConditionalRoot, mapper: TypeMapper | undefined): Type {
|
||||
function getConditionalType(root: ConditionalRoot, mapper: TypeMapper | undefined, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
|
||||
let result;
|
||||
let extraTypes: Type[] | undefined;
|
||||
// We loop here for an immediately nested conditional type in the false position, effectively treating
|
||||
@@ -14628,8 +14634,8 @@ namespace ts {
|
||||
result.extendsType = extendsType;
|
||||
result.mapper = mapper;
|
||||
result.combinedMapper = combinedMapper;
|
||||
result.aliasSymbol = root.aliasSymbol;
|
||||
result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper!); // TODO: GH#18217
|
||||
result.aliasSymbol = aliasSymbol || root.aliasSymbol;
|
||||
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper!); // TODO: GH#18217
|
||||
break;
|
||||
}
|
||||
return extraTypes ? getUnionType(append(extraTypes, result)) : result;
|
||||
@@ -15429,7 +15435,7 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getObjectTypeInstantiation(type: AnonymousType | DeferredTypeReference, mapper: TypeMapper) {
|
||||
function getObjectTypeInstantiation(type: AnonymousType | DeferredTypeReference, mapper: TypeMapper, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]) {
|
||||
const declaration = type.objectFlags & ObjectFlags.Reference ? (<TypeReference>type).node! : type.symbol.declarations[0];
|
||||
const links = getNodeLinks(declaration);
|
||||
const target = type.objectFlags & ObjectFlags.Reference ? <DeferredTypeReference>links.resolvedType! :
|
||||
@@ -15457,17 +15463,19 @@ namespace ts {
|
||||
// instantiation cache key from the type IDs of the type arguments.
|
||||
const combinedMapper = combineTypeMappers(type.mapper, mapper);
|
||||
const typeArguments = map(typeParameters, t => getMappedType(t, combinedMapper));
|
||||
const id = getTypeListId(typeArguments);
|
||||
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
||||
const id = getTypeListId(typeArguments) + (newAliasSymbol ? `@${getSymbolId(newAliasSymbol)}` : "");
|
||||
if (!target.instantiations) {
|
||||
target.instantiations = new Map<string, Type>();
|
||||
target.instantiations.set(getTypeListId(typeParameters), target);
|
||||
target.instantiations.set(getTypeListId(typeParameters) + (target.aliasSymbol ? `@${getSymbolId(target.aliasSymbol)}` : ""), target);
|
||||
}
|
||||
let result = target.instantiations.get(id);
|
||||
if (!result) {
|
||||
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
||||
result = target.objectFlags & ObjectFlags.Reference ? createDeferredTypeReference((<DeferredTypeReference>type).target, (<DeferredTypeReference>type).node, newMapper) :
|
||||
target.objectFlags & ObjectFlags.Mapped ? instantiateMappedType(<MappedType>target, newMapper) :
|
||||
instantiateAnonymousType(target, newMapper);
|
||||
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
||||
result = target.objectFlags & ObjectFlags.Reference ? createDeferredTypeReference((<DeferredTypeReference>type).target, (<DeferredTypeReference>type).node, newMapper, newAliasSymbol, newAliasTypeArguments) :
|
||||
target.objectFlags & ObjectFlags.Mapped ? instantiateMappedType(<MappedType>target, newMapper, newAliasSymbol, newAliasTypeArguments) :
|
||||
instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
||||
target.instantiations.set(id, result);
|
||||
}
|
||||
return result;
|
||||
@@ -15520,7 +15528,7 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function instantiateMappedType(type: MappedType, mapper: TypeMapper): Type {
|
||||
function instantiateMappedType(type: MappedType, mapper: TypeMapper, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
|
||||
// For a homomorphic mapped type { [P in keyof T]: X }, where T is some type variable, the mapping
|
||||
// operation depends on T as follows:
|
||||
// * If T is a primitive type no mapping is performed and the result is simply T.
|
||||
@@ -15535,7 +15543,7 @@ namespace ts {
|
||||
if (typeVariable) {
|
||||
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
||||
if (typeVariable !== mappedTypeVariable) {
|
||||
return mapType(getReducedType(mappedTypeVariable), t => {
|
||||
return mapTypeWithAlias(getReducedType(mappedTypeVariable), t => {
|
||||
if (t.flags & (TypeFlags.AnyOrUnknown | TypeFlags.InstantiableNonPrimitive | TypeFlags.Object | TypeFlags.Intersection) && t !== wildcardType && t !== errorType) {
|
||||
if (!type.declaration.nameType) {
|
||||
if (isArrayType(t)) {
|
||||
@@ -15551,11 +15559,11 @@ namespace ts {
|
||||
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
||||
}
|
||||
return t;
|
||||
});
|
||||
}, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
}
|
||||
// If the constraint type of the instantiation is the wildcard type, return the wildcard type.
|
||||
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper);
|
||||
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
|
||||
function getModifiedReadonlyState(state: boolean, modifiers: MappedTypeModifiers) {
|
||||
@@ -15607,7 +15615,7 @@ namespace ts {
|
||||
propType;
|
||||
}
|
||||
|
||||
function instantiateAnonymousType(type: AnonymousType, mapper: TypeMapper): AnonymousType {
|
||||
function instantiateAnonymousType(type: AnonymousType, mapper: TypeMapper, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): AnonymousType {
|
||||
const result = <AnonymousType>createObjectType(type.objectFlags | ObjectFlags.Instantiated, type.symbol);
|
||||
if (type.objectFlags & ObjectFlags.Mapped) {
|
||||
(<MappedType>result).declaration = (<MappedType>type).declaration;
|
||||
@@ -15620,23 +15628,23 @@ namespace ts {
|
||||
}
|
||||
result.target = type;
|
||||
result.mapper = mapper;
|
||||
result.aliasSymbol = type.aliasSymbol;
|
||||
result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper);
|
||||
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
||||
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
||||
return result;
|
||||
}
|
||||
|
||||
function getConditionalTypeInstantiation(type: ConditionalType, mapper: TypeMapper): Type {
|
||||
function getConditionalTypeInstantiation(type: ConditionalType, mapper: TypeMapper, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
|
||||
const root = type.root;
|
||||
if (root.outerTypeParameters) {
|
||||
// We are instantiating a conditional type that has one or more type parameters in scope. Apply the
|
||||
// mapper to the type parameters to produce the effective list of type arguments, and compute the
|
||||
// instantiation cache key from the type IDs of the type arguments.
|
||||
const typeArguments = map(root.outerTypeParameters, t => getMappedType(t, mapper));
|
||||
const id = getTypeListId(typeArguments);
|
||||
const id = getTypeListId(typeArguments) + (aliasSymbol ? `@${getSymbolId(aliasSymbol)}` : "");
|
||||
let result = root.instantiations!.get(id);
|
||||
if (!result) {
|
||||
const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
|
||||
result = instantiateConditionalType(root, newMapper);
|
||||
result = instantiateConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
|
||||
root.instantiations!.set(id, result);
|
||||
}
|
||||
return result;
|
||||
@@ -15644,7 +15652,7 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function instantiateConditionalType(root: ConditionalRoot, mapper: TypeMapper): Type {
|
||||
function instantiateConditionalType(root: ConditionalRoot, mapper: TypeMapper, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
|
||||
// Check if we have a conditional type where the check type is a naked type parameter. If so,
|
||||
// the conditional type is distributive over union types and when T is instantiated to a union
|
||||
// type A | B, we produce (A extends U ? X : Y) | (B extends U ? X : Y).
|
||||
@@ -15652,16 +15660,20 @@ namespace ts {
|
||||
const checkType = <TypeParameter>root.checkType;
|
||||
const instantiatedType = getMappedType(checkType, mapper);
|
||||
if (checkType !== instantiatedType && instantiatedType.flags & (TypeFlags.Union | TypeFlags.Never)) {
|
||||
return mapType(instantiatedType, t => getConditionalType(root, prependTypeMapping(checkType, t, mapper)));
|
||||
return mapTypeWithAlias(instantiatedType, t => getConditionalType(root, prependTypeMapping(checkType, t, mapper)), aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
}
|
||||
return getConditionalType(root, mapper);
|
||||
return getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
|
||||
function instantiateType(type: Type, mapper: TypeMapper | undefined): Type;
|
||||
function instantiateType(type: Type | undefined, mapper: TypeMapper | undefined): Type | undefined;
|
||||
function instantiateType(type: Type | undefined, mapper: TypeMapper | undefined): Type | undefined {
|
||||
if (!(type && mapper && couldContainTypeVariables(type))) {
|
||||
return type && mapper ? instantiateTypeWithAlias(type, mapper, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined) : type;
|
||||
}
|
||||
|
||||
function instantiateTypeWithAlias(type: Type, mapper: TypeMapper, aliasSymbol: Symbol | undefined, aliasTypeArguments: readonly Type[] | undefined): Type {
|
||||
if (!couldContainTypeVariables(type)) {
|
||||
return type;
|
||||
}
|
||||
if (instantiationDepth === 50 || instantiationCount >= 5000000) {
|
||||
@@ -15675,12 +15687,12 @@ namespace ts {
|
||||
totalInstantiationCount++;
|
||||
instantiationCount++;
|
||||
instantiationDepth++;
|
||||
const result = instantiateTypeWorker(type, mapper);
|
||||
const result = instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments);
|
||||
instantiationDepth--;
|
||||
return result;
|
||||
}
|
||||
|
||||
function instantiateTypeWorker(type: Type, mapper: TypeMapper): Type {
|
||||
function instantiateTypeWorker(type: Type, mapper: TypeMapper, aliasSymbol: Symbol | undefined, aliasTypeArguments: readonly Type[] | undefined): Type {
|
||||
const flags = type.flags;
|
||||
if (flags & TypeFlags.TypeParameter) {
|
||||
return getMappedType(type, mapper);
|
||||
@@ -15688,12 +15700,12 @@ namespace ts {
|
||||
if (flags & TypeFlags.Object) {
|
||||
const objectFlags = (<ObjectType>type).objectFlags;
|
||||
if (objectFlags & (ObjectFlags.Reference | ObjectFlags.Anonymous | ObjectFlags.Mapped)) {
|
||||
if (objectFlags & ObjectFlags.Reference && !((<TypeReference>type).node)) {
|
||||
if (objectFlags & ObjectFlags.Reference && !(<TypeReference>type).node) {
|
||||
const resolvedTypeArguments = (<TypeReference>type).resolvedTypeArguments;
|
||||
const newTypeArguments = instantiateTypes(resolvedTypeArguments, mapper);
|
||||
return newTypeArguments !== resolvedTypeArguments ? createNormalizedTypeReference((<TypeReference>type).target, newTypeArguments) : type;
|
||||
}
|
||||
return getObjectTypeInstantiation(<TypeReference | AnonymousType | MappedType>type, mapper);
|
||||
return getObjectTypeInstantiation(<TypeReference | AnonymousType | MappedType>type, mapper, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -15701,10 +15713,14 @@ namespace ts {
|
||||
const origin = type.flags & TypeFlags.Union ? (<UnionType>type).origin : undefined;
|
||||
const types = origin && origin.flags & TypeFlags.UnionOrIntersection ? (<UnionOrIntersectionType>origin).types : (<UnionOrIntersectionType>type).types;
|
||||
const newTypes = instantiateTypes(types, mapper);
|
||||
return newTypes === types ? type :
|
||||
flags & TypeFlags.Intersection || origin && origin.flags & TypeFlags.Intersection ?
|
||||
getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) :
|
||||
getUnionType(newTypes, UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
|
||||
if (newTypes === types && aliasSymbol === type.aliasSymbol) {
|
||||
return type;
|
||||
}
|
||||
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
||||
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
||||
return flags & TypeFlags.Intersection || origin && origin.flags & TypeFlags.Intersection ?
|
||||
getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) :
|
||||
getUnionType(newTypes, UnionReduction.Literal, newAliasSymbol, newAliasTypeArguments);
|
||||
}
|
||||
if (flags & TypeFlags.Index) {
|
||||
return getIndexType(instantiateType((<IndexType>type).type, mapper));
|
||||
@@ -15716,10 +15732,12 @@ namespace ts {
|
||||
return getStringMappingType((<StringMappingType>type).symbol, instantiateType((<StringMappingType>type).type, mapper));
|
||||
}
|
||||
if (flags & TypeFlags.IndexedAccess) {
|
||||
return getIndexedAccessType(instantiateType((<IndexedAccessType>type).objectType, mapper), instantiateType((<IndexedAccessType>type).indexType, mapper), (<IndexedAccessType>type).noUncheckedIndexedAccessCandidate, /*accessNode*/ undefined, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
|
||||
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
||||
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
||||
return getIndexedAccessType(instantiateType((<IndexedAccessType>type).objectType, mapper), instantiateType((<IndexedAccessType>type).indexType, mapper), (<IndexedAccessType>type).noUncheckedIndexedAccessCandidate, /*accessNode*/ undefined, newAliasSymbol, newAliasTypeArguments);
|
||||
}
|
||||
if (flags & TypeFlags.Conditional) {
|
||||
return getConditionalTypeInstantiation(<ConditionalType>type, combineTypeMappers((<ConditionalType>type).mapper, mapper));
|
||||
return getConditionalTypeInstantiation(<ConditionalType>type, combineTypeMappers((<ConditionalType>type).mapper, mapper), aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
if (flags & TypeFlags.Substitution) {
|
||||
const maybeVariable = instantiateType((<SubstitutionType>type).baseType, mapper);
|
||||
@@ -21690,6 +21708,12 @@ namespace ts {
|
||||
return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? UnionReduction.None : UnionReduction.Literal) : type;
|
||||
}
|
||||
|
||||
function mapTypeWithAlias(type: Type, mapper: (t: Type) => Type, aliasSymbol: Symbol | undefined, aliasTypeArguments: readonly Type[] | undefined) {
|
||||
return type.flags & TypeFlags.Union && aliasSymbol ?
|
||||
getUnionType(map((<UnionType>type).types, mapper), UnionReduction.Literal, aliasSymbol, aliasTypeArguments) :
|
||||
mapType(type, mapper);
|
||||
}
|
||||
|
||||
function getConstituentCount(type: Type) {
|
||||
return type.flags & TypeFlags.UnionOrIntersection ? (<UnionOrIntersectionType>type).types.length : 1;
|
||||
}
|
||||
|
||||
@@ -4745,6 +4745,8 @@ namespace ts {
|
||||
typeParameters?: TypeParameter[]; // Type parameters of type alias (undefined if non-generic)
|
||||
outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type
|
||||
instantiations?: ESMap<string, Type>; // Instantiations of generic type alias (undefined if non-generic)
|
||||
aliasSymbol?: Symbol; // Alias associated with generic type alias instantiation
|
||||
aliasTypeArguments?: readonly Type[] // Alias type arguments (if any)
|
||||
inferredClassSymbol?: ESMap<SymbolId, TransientSymbol>; // Symbol of an inferred ES5 constructor function
|
||||
mapper?: TypeMapper; // Type mapper for instantiation alias
|
||||
referenced?: boolean; // True if alias symbol has been referenced as a value that can be emitted
|
||||
|
||||
+6
-6
@@ -8,10 +8,10 @@ type ExtendedMapper<HandledInputT, OutputT, ArgsT extends any[]> = (name : strin
|
||||
>args : ArgsT
|
||||
|
||||
type a = ExtendedMapper<any, any, [any]>;
|
||||
>a : ExtendedMapper<any, any, [any]>
|
||||
>a : a
|
||||
|
||||
type b = ExtendedMapper<any, any, any[]>;
|
||||
>b : ExtendedMapper<any, any, any[]>
|
||||
>b : b
|
||||
|
||||
type test = a extends b ? "y" : "n"
|
||||
>test : "y"
|
||||
@@ -32,10 +32,10 @@ type ExtendedMapper1<HandledInputT, OutputT, ArgsT extends any[]> = (
|
||||
);
|
||||
|
||||
type a1 = ExtendedMapper1<any, any, [any]>;
|
||||
>a1 : ExtendedMapper1<any, any, [any]>
|
||||
>a1 : a1
|
||||
|
||||
type b1 = ExtendedMapper1<any, any, any[]>;
|
||||
>b1 : ExtendedMapper1<any, any, any[]>
|
||||
>b1 : b1
|
||||
|
||||
type test1 = a1 extends b1 ? "y" : "n"
|
||||
>test1 : "y"
|
||||
@@ -56,10 +56,10 @@ type ExtendedMapper2<HandledInputT, OutputT, ArgsT extends any[]> = (
|
||||
);
|
||||
|
||||
type a2 = ExtendedMapper2<any, any, [any]>;
|
||||
>a2 : (name: string, mixed: any, args_0: any) => any
|
||||
>a2 : a2
|
||||
|
||||
type b2 = ExtendedMapper2<any, any, any[]>;
|
||||
>b2 : (name: string, mixed: any, ...args: any[]) => any
|
||||
>b2 : b2
|
||||
|
||||
type test2 = a2 extends b2 ? "y" : "n"
|
||||
>test2 : "y"
|
||||
|
||||
+2
-3
@@ -60,8 +60,7 @@ export declare type TypeB = Merge<TypeA, {
|
||||
b: string;
|
||||
}>;
|
||||
//// [index.d.ts]
|
||||
import { TypeB } from './type-b';
|
||||
export declare class Broken {
|
||||
method(): import("./types").Merge<import("./type-a").TypeA, {
|
||||
b: string;
|
||||
}>;
|
||||
method(): TypeB;
|
||||
}
|
||||
|
||||
+3
-3
@@ -6,10 +6,10 @@ export class Broken {
|
||||
>Broken : Broken
|
||||
|
||||
method () {
|
||||
>method : () => import("tests/cases/compiler/Uppercased_Dir/src/types").Merge<import("tests/cases/compiler/Uppercased_Dir/src/type-a").TypeA, { b: string; }>
|
||||
>method : () => TypeB
|
||||
|
||||
return { } as TypeB;
|
||||
>{ } as TypeB : import("tests/cases/compiler/Uppercased_Dir/src/types").Merge<import("tests/cases/compiler/Uppercased_Dir/src/type-a").TypeA, { b: string; }>
|
||||
>{ } as TypeB : TypeB
|
||||
>{ } : {}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import { TypeA } from './type-a';
|
||||
>TypeA : any
|
||||
|
||||
export type TypeB = Merge<TypeA, {
|
||||
>TypeB : Merge<TypeA, { b: string; }>
|
||||
>TypeB : TypeB
|
||||
|
||||
b: string;
|
||||
>b : string
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ export type Matching<InjectedProps, DecorationTargetProps> = {
|
||||
};
|
||||
|
||||
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
>Omit : Pick<T, Exclude<keyof T, K>>
|
||||
>Omit : Omit<T, K>
|
||||
|
||||
export type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> =
|
||||
>InferableComponentEnhancerWithProps : InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts ===
|
||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
>Omit : Pick<T, Exclude<keyof T, K>>
|
||||
>Omit : Omit<T, K>
|
||||
|
||||
type Shared< // Circularly self constraining type, defered thanks to mapping
|
||||
>Shared : Shared<InjectedProps, DecorationTargetProps>
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ export type ChannelType = Channel extends { type: infer R } ? R : never;
|
||||
>type : R
|
||||
|
||||
type Omit<T, K extends keyof T> = Pick<
|
||||
>Omit : Pick<T, ({ [P in keyof T]: P; } & { [P in K]: never; } & { [x: string]: never; })[keyof T]>
|
||||
>Omit : Omit<T, K>
|
||||
|
||||
T,
|
||||
({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never })[keyof T]
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
@@ -13,14 +13,24 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(29,5): error TS23
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(30,9): error TS2322: Type 'T["x"]' is not assignable to type 'string'.
|
||||
Type 'string | undefined' is not assignable to type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2322: Type 'Pick<T, FunctionPropertyNames<T>>' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, FunctionPropertyNames<T>>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'Pick<T, NonFunctionPropertyNames<T>>' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, NonFunctionPropertyNames<T>>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(106,5): error TS2322: Type 'Pick<T, NonFunctionPropertyNames<T>>' is not assignable to type 'Pick<T, FunctionPropertyNames<T>>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2322: Type 'FunctionProperties<T>' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'FunctionProperties<T>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to 'NonFunctionProperties<T>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(106,5): error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'FunctionProperties<T>'.
|
||||
Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(108,5): error TS2322: Type 'Pick<T, FunctionPropertyNames<T>>' is not assignable to type 'Pick<T, NonFunctionPropertyNames<T>>'.
|
||||
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
Type 'string | number | symbol' is not assignable to type 'never'.
|
||||
Type 'string' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(108,5): error TS2322: Type 'FunctionProperties<T>' is not assignable to type 'NonFunctionProperties<T>'.
|
||||
Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
|
||||
Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'keyof T' is not assignable to type 'never'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(114,5): error TS2322: Type 'keyof T' is not assignable to type 'FunctionPropertyNames<T>'.
|
||||
Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
@@ -52,7 +62,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf<T>'.
|
||||
Type 'string | number' is not assignable to type 'ZeroOf<T>'.
|
||||
Type 'string' is not assignable to type 'ZeroOf<T>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(263,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo<T & U>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(263,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'T2'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS2322: Type 'T95<U>' is not assignable to type 'T94<U>'.
|
||||
Type 'number | boolean' is not assignable to type 'T94<U>'.
|
||||
Type 'number' is not assignable to type 'T94<U>'.
|
||||
@@ -185,22 +195,32 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
function f7<T>(x: T, y: FunctionProperties<T>, z: NonFunctionProperties<T>) {
|
||||
x = y; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, FunctionPropertyNames<T>>' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, FunctionPropertyNames<T>>'.
|
||||
!!! error TS2322: Type 'FunctionProperties<T>' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'FunctionProperties<T>'.
|
||||
x = z; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, NonFunctionPropertyNames<T>>' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Pick<T, NonFunctionPropertyNames<T>>'.
|
||||
!!! error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'NonFunctionProperties<T>'.
|
||||
y = x;
|
||||
y = z; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, NonFunctionPropertyNames<T>>' is not assignable to type 'Pick<T, FunctionPropertyNames<T>>'.
|
||||
!!! error TS2322: Type 'NonFunctionProperties<T>' is not assignable to type 'FunctionProperties<T>'.
|
||||
!!! error TS2322: Type 'FunctionPropertyNames<T>' is not assignable to type 'NonFunctionPropertyNames<T>'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'never'.
|
||||
z = x;
|
||||
z = y; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Pick<T, FunctionPropertyNames<T>>' is not assignable to type 'Pick<T, NonFunctionPropertyNames<T>>'.
|
||||
!!! error TS2322: Type 'FunctionProperties<T>' is not assignable to type 'NonFunctionProperties<T>'.
|
||||
!!! error TS2322: Type 'NonFunctionPropertyNames<T>' is not assignable to type 'FunctionPropertyNames<T>'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'never'.
|
||||
}
|
||||
|
||||
function f8<T>(x: keyof T, y: FunctionPropertyNames<T>, z: NonFunctionPropertyNames<T>) {
|
||||
@@ -398,7 +418,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
|
||||
var z: T1;
|
||||
var z: T2; // Error, T2 is distributive, T1 isn't
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo<T & U>'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'T2'.
|
||||
!!! related TS6203 tests/cases/conformance/types/conditional/conditionalTypes1.ts:262:9: 'z' was also declared here.
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
=== tests/cases/conformance/types/conditional/conditionalTypes1.ts ===
|
||||
type T00 = Exclude<"a" | "b" | "c" | "d", "a" | "c" | "f">; // "b" | "d"
|
||||
>T00 : "b" | "d"
|
||||
>T00 : T00
|
||||
|
||||
type T01 = Extract<"a" | "b" | "c" | "d", "a" | "c" | "f">; // "a" | "c"
|
||||
>T01 : "a" | "c"
|
||||
>T01 : T01
|
||||
|
||||
type T02 = Exclude<string | number | (() => void), Function>; // string | number
|
||||
>T02 : string | number
|
||||
>T02 : T02
|
||||
|
||||
type T03 = Extract<string | number | (() => void), Function>; // () => void
|
||||
>T03 : () => void
|
||||
|
||||
type T04 = NonNullable<string | number | undefined>; // string | number
|
||||
>T04 : string | number
|
||||
>T04 : T04
|
||||
|
||||
type T05 = NonNullable<(() => string) | string[] | null | undefined>; // (() => string) | string[]
|
||||
>T05 : (() => string) | string[]
|
||||
>T05 : T05
|
||||
>null : null
|
||||
|
||||
function f1<T>(x: T, y: NonNullable<T>) {
|
||||
@@ -113,7 +113,7 @@ type T10 = Exclude<Options, { k: "a" | "b" }>; // { k: "c", c: boolean }
|
||||
>k : "a" | "b"
|
||||
|
||||
type T11 = Extract<Options, { k: "a" | "b" }>; // { k: "a", a: number } | { k: "b", b: string }
|
||||
>T11 : { k: "a"; a: number; } | { k: "b"; b: string; }
|
||||
>T11 : T11
|
||||
>k : "a" | "b"
|
||||
|
||||
type T12 = Exclude<Options, { k: "a" } | { k: "b" }>; // { k: "c", c: boolean }
|
||||
@@ -122,12 +122,12 @@ type T12 = Exclude<Options, { k: "a" } | { k: "b" }>; // { k: "c", c: boolean }
|
||||
>k : "b"
|
||||
|
||||
type T13 = Extract<Options, { k: "a" } | { k: "b" }>; // { k: "a", a: number } | { k: "b", b: string }
|
||||
>T13 : { k: "a"; a: number; } | { k: "b"; b: string; }
|
||||
>T13 : T13
|
||||
>k : "a"
|
||||
>k : "b"
|
||||
|
||||
type T14 = Exclude<Options, { q: "a" }>; // Options
|
||||
>T14 : Options
|
||||
>T14 : T14
|
||||
>q : "a"
|
||||
|
||||
type T15 = Extract<Options, { q: "a" }>; // never
|
||||
@@ -146,17 +146,17 @@ let x0 = f5("a"); // { k: "a", a: number }
|
||||
>"a" : "a"
|
||||
|
||||
type OptionsOfKind<K extends Options["k"]> = Extract<Options, { k: K }>;
|
||||
>OptionsOfKind : Extract<{ k: "a"; a: number; }, { k: K; }> | Extract<{ k: "b"; b: string; }, { k: K; }> | Extract<{ k: "c"; c: boolean; }, { k: K; }>
|
||||
>OptionsOfKind : OptionsOfKind<K>
|
||||
>k : K
|
||||
|
||||
type T16 = OptionsOfKind<"a" | "b">; // { k: "a", a: number } | { k: "b", b: string }
|
||||
>T16 : { k: "a"; a: number; } | { k: "b"; b: string; }
|
||||
>T16 : T16
|
||||
|
||||
type Select<T, K extends keyof T, V extends T[K]> = Extract<T, { [P in K]: V }>;
|
||||
>Select : Extract<T, { [P in K]: V; }>
|
||||
>Select : Select<T, K, V>
|
||||
|
||||
type T17 = Select<Options, "k", "a" | "b">; // // { k: "a", a: number } | { k: "b", b: string }
|
||||
>T17 : { k: "a"; a: number; } | { k: "b"; b: string; }
|
||||
>T17 : T17
|
||||
|
||||
type TypeName<T> =
|
||||
>TypeName : TypeName<T>
|
||||
@@ -169,7 +169,7 @@ type TypeName<T> =
|
||||
"object";
|
||||
|
||||
type T20 = TypeName<string | (() => void)>; // "string" | "function"
|
||||
>T20 : "string" | "function"
|
||||
>T20 : T20
|
||||
|
||||
type T21 = TypeName<any>; // "string" | "number" | "boolean" | "undefined" | "function" | "object"
|
||||
>T21 : "string" | "number" | "boolean" | "undefined" | "object" | "function"
|
||||
@@ -230,55 +230,55 @@ type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : ne
|
||||
>FunctionPropertyNames : FunctionPropertyNames<T>
|
||||
|
||||
type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>;
|
||||
>FunctionProperties : Pick<T, FunctionPropertyNames<T>>
|
||||
>FunctionProperties : FunctionProperties<T>
|
||||
|
||||
type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T];
|
||||
>NonFunctionPropertyNames : NonFunctionPropertyNames<T>
|
||||
|
||||
type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
|
||||
>NonFunctionProperties : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>NonFunctionProperties : NonFunctionProperties<T>
|
||||
|
||||
type T30 = FunctionProperties<Part>;
|
||||
>T30 : Pick<Part, "updatePart">
|
||||
>T30 : T30
|
||||
|
||||
type T31 = NonFunctionProperties<Part>;
|
||||
>T31 : Pick<Part, NonFunctionPropertyNames<Part>>
|
||||
>T31 : T31
|
||||
|
||||
function f7<T>(x: T, y: FunctionProperties<T>, z: NonFunctionProperties<T>) {
|
||||
>f7 : <T>(x: T, y: FunctionProperties<T>, z: NonFunctionProperties<T>) => void
|
||||
>x : T
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>y : FunctionProperties<T>
|
||||
>z : NonFunctionProperties<T>
|
||||
|
||||
x = y; // Error
|
||||
>x = y : Pick<T, FunctionPropertyNames<T>>
|
||||
>x = y : FunctionProperties<T>
|
||||
>x : T
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
>y : FunctionProperties<T>
|
||||
|
||||
x = z; // Error
|
||||
>x = z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>x = z : NonFunctionProperties<T>
|
||||
>x : T
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>z : NonFunctionProperties<T>
|
||||
|
||||
y = x;
|
||||
>y = x : T
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
>y : FunctionProperties<T>
|
||||
>x : T
|
||||
|
||||
y = z; // Error
|
||||
>y = z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>y = z : NonFunctionProperties<T>
|
||||
>y : FunctionProperties<T>
|
||||
>z : NonFunctionProperties<T>
|
||||
|
||||
z = x;
|
||||
>z = x : T
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>z : NonFunctionProperties<T>
|
||||
>x : T
|
||||
|
||||
z = y; // Error
|
||||
>z = y : Pick<T, FunctionPropertyNames<T>>
|
||||
>z : Pick<T, NonFunctionPropertyNames<T>>
|
||||
>y : Pick<T, FunctionPropertyNames<T>>
|
||||
>z = y : FunctionProperties<T>
|
||||
>z : NonFunctionProperties<T>
|
||||
>y : FunctionProperties<T>
|
||||
}
|
||||
|
||||
function f8<T>(x: keyof T, y: FunctionPropertyNames<T>, z: NonFunctionPropertyNames<T>) {
|
||||
@@ -523,20 +523,20 @@ type If<C extends boolean, T, F> = C extends true ? T : F;
|
||||
>true : true
|
||||
|
||||
type Not<C extends boolean> = If<C, false, true>;
|
||||
>Not : If<C, false, true>
|
||||
>Not : Not<C>
|
||||
>false : false
|
||||
>true : true
|
||||
|
||||
type And<A extends boolean, B extends boolean> = If<A, B, false>;
|
||||
>And : If<A, B, false>
|
||||
>And : And<A, B>
|
||||
>false : false
|
||||
|
||||
type Or<A extends boolean, B extends boolean> = If<A, true, B>;
|
||||
>Or : If<A, true, B>
|
||||
>Or : Or<A, B>
|
||||
>true : true
|
||||
|
||||
type IsString<T> = Extends<T, string>;
|
||||
>IsString : Extends<T, string>
|
||||
>IsString : IsString<T>
|
||||
|
||||
type Q1 = IsString<number>; // false
|
||||
>Q1 : false
|
||||
@@ -559,7 +559,7 @@ type N2 = Not<true>; // false
|
||||
>true : true
|
||||
|
||||
type N3 = Not<boolean>; // boolean
|
||||
>N3 : boolean
|
||||
>N3 : N3
|
||||
|
||||
type A1 = And<false, false>; // false
|
||||
>A1 : false
|
||||
@@ -590,7 +590,7 @@ type A6 = And<false, boolean>; // false
|
||||
>false : false
|
||||
|
||||
type A7 = And<boolean, true>; // boolean
|
||||
>A7 : boolean
|
||||
>A7 : A7
|
||||
>true : true
|
||||
|
||||
type A8 = And<true, boolean>; // boolean
|
||||
@@ -598,7 +598,7 @@ type A8 = And<true, boolean>; // boolean
|
||||
>true : true
|
||||
|
||||
type A9 = And<boolean, boolean>; // boolean
|
||||
>A9 : boolean
|
||||
>A9 : A9
|
||||
|
||||
type O1 = Or<false, false>; // false
|
||||
>O1 : false
|
||||
@@ -621,7 +621,7 @@ type O4 = Or<true, true>; // true
|
||||
>true : true
|
||||
|
||||
type O5 = Or<boolean, false>; // boolean
|
||||
>O5 : boolean
|
||||
>O5 : O5
|
||||
>false : false
|
||||
|
||||
type O6 = Or<false, boolean>; // boolean
|
||||
@@ -637,7 +637,7 @@ type O8 = Or<true, boolean>; // true
|
||||
>true : true
|
||||
|
||||
type O9 = Or<boolean, boolean>; // boolean
|
||||
>O9 : boolean
|
||||
>O9 : O9
|
||||
|
||||
type T40 = never extends never ? true : false; // true
|
||||
>T40 : true
|
||||
@@ -785,7 +785,7 @@ const convert = <U>(value: Foo<U>): Bar<U> => value;
|
||||
>value : Foo<U>
|
||||
|
||||
type Baz<T> = Foo<T>;
|
||||
>Baz : Foo<T>
|
||||
>Baz : Baz<T>
|
||||
|
||||
const convert2 = <T>(value: Foo<T>): Baz<T> => value;
|
||||
>convert2 : <T>(value: Foo<T>) => Foo<T>
|
||||
@@ -816,7 +816,7 @@ function f32<T, U>() {
|
||||
>T1 : T & U extends string ? boolean : number
|
||||
|
||||
type T2 = Foo<T & U>;
|
||||
>T2 : Foo<T & U>
|
||||
>T2 : T & U extends string ? boolean : number
|
||||
|
||||
var z: T1;
|
||||
>z : T & U extends string ? boolean : number
|
||||
@@ -829,16 +829,16 @@ function f33<T, U>() {
|
||||
>f33 : <T, U>() => void
|
||||
|
||||
type T1 = Foo<T & U>;
|
||||
>T1 : Foo<T & U>
|
||||
>T1 : T & U extends string ? boolean : number
|
||||
|
||||
type T2 = Bar<T & U>;
|
||||
>T2 : Bar<T & U>
|
||||
>T2 : T & U extends string ? boolean : number
|
||||
|
||||
var z: T1;
|
||||
>z : Foo<T & U>
|
||||
>z : T & U extends string ? boolean : number
|
||||
|
||||
var z: T2;
|
||||
>z : Foo<T & U>
|
||||
>z : T & U extends string ? boolean : number
|
||||
}
|
||||
|
||||
// Repro from #21823
|
||||
@@ -971,19 +971,19 @@ type c2 = B2['c']; // 'c' | 'b'
|
||||
// Repro from #21929
|
||||
|
||||
type NonFooKeys1<T extends object> = OldDiff<keyof T, 'foo'>;
|
||||
>NonFooKeys1 : OldDiff<keyof T, "foo">
|
||||
>NonFooKeys1 : NonFooKeys1<T>
|
||||
|
||||
type NonFooKeys2<T extends object> = Exclude<keyof T, 'foo'>;
|
||||
>NonFooKeys2 : Exclude<keyof T, "foo">
|
||||
>NonFooKeys2 : NonFooKeys2<T>
|
||||
|
||||
type Test1 = NonFooKeys1<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
>Test1 : OldDiff<"foo" | "bar" | "baz", "foo">
|
||||
>Test1 : Test1
|
||||
>foo : 1
|
||||
>bar : 2
|
||||
>baz : 3
|
||||
|
||||
type Test2 = NonFooKeys2<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
>Test2 : "bar" | "baz"
|
||||
>Test2 : Test2
|
||||
>foo : 1
|
||||
>bar : 2
|
||||
>baz : 3
|
||||
|
||||
@@ -500,7 +500,7 @@ declare type GetPropertyNamesOfType<T, RestrictToType> = {
|
||||
}[Extract<keyof T, string>];
|
||||
|
||||
declare type GetAllPropertiesOfType<T, RestrictToType> = Pick<
|
||||
>GetAllPropertiesOfType : Pick<T, GetPropertyNamesOfType<Required<T>, RestrictToType>>
|
||||
>GetAllPropertiesOfType : GetAllPropertiesOfType<T, RestrictToType>
|
||||
|
||||
T,
|
||||
GetPropertyNamesOfType<Required<T>, RestrictToType>
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Result } from "lib/result";
|
||||
>Result : any
|
||||
|
||||
export type T<T> = Result<Error, T>;
|
||||
>T : Result<Error, T>
|
||||
>T : import("tests/cases/compiler/src/datastore_result").T<T>
|
||||
|
||||
=== tests/cases/compiler/src/conditional_directive_field.ts ===
|
||||
import * as DatastoreResult from "src/datastore_result";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== /Helpers.ts ===
|
||||
export type StringKeyOf<TObj> = Extract<string, keyof TObj>;
|
||||
>StringKeyOf : Extract<string, keyof TObj>
|
||||
>StringKeyOf : StringKeyOf<TObj>
|
||||
|
||||
=== /FromFactor.ts ===
|
||||
export type RowToColumns<TColumns> = {
|
||||
|
||||
@@ -37,5 +37,6 @@ exports.fun2 = bbb_1.create();
|
||||
|
||||
|
||||
//// [index.d.ts]
|
||||
export declare const fun: () => import("./bbb").INode<import("./lib").G<import("./lib").E>>;
|
||||
export declare const fun2: () => import("./bbb").INode<import("./lib").G<import("./lib").E.A>>;
|
||||
import { T, Q } from "./lib";
|
||||
export declare const fun: () => import("./bbb").INode<T>;
|
||||
export declare const fun2: () => import("./bbb").INode<Q>;
|
||||
|
||||
@@ -24,10 +24,10 @@ export enum E {
|
||||
}
|
||||
|
||||
export type T = G<E>;
|
||||
>T : G<E>
|
||||
>T : T
|
||||
|
||||
export type Q = G<E.A>;
|
||||
>Q : G<E.A>
|
||||
>Q : Q
|
||||
>E : any
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
@@ -39,12 +39,12 @@ import { create } from "./bbb";
|
||||
>create : <T>() => () => import("tests/cases/compiler/bbb").INode<T>
|
||||
|
||||
export const fun = create<T>();
|
||||
>fun : () => import("tests/cases/compiler/bbb").INode<import("tests/cases/compiler/lib").G<import("tests/cases/compiler/lib").E>>
|
||||
>create<T>() : () => import("tests/cases/compiler/bbb").INode<import("tests/cases/compiler/lib").G<import("tests/cases/compiler/lib").E>>
|
||||
>fun : () => import("tests/cases/compiler/bbb").INode<T>
|
||||
>create<T>() : () => import("tests/cases/compiler/bbb").INode<T>
|
||||
>create : <T>() => () => import("tests/cases/compiler/bbb").INode<T>
|
||||
|
||||
export const fun2 = create<Q>();
|
||||
>fun2 : () => import("tests/cases/compiler/bbb").INode<import("tests/cases/compiler/lib").G<import("tests/cases/compiler/lib").E.A>>
|
||||
>create<Q>() : () => import("tests/cases/compiler/bbb").INode<import("tests/cases/compiler/lib").G<import("tests/cases/compiler/lib").E.A>>
|
||||
>fun2 : () => import("tests/cases/compiler/bbb").INode<Q>
|
||||
>create<Q>() : () => import("tests/cases/compiler/bbb").INode<Q>
|
||||
>create : <T>() => () => import("tests/cases/compiler/bbb").INode<T>
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ export type Bar<X, Y> = () => [X, Y];
|
||||
>Bar : Bar<X, Y>
|
||||
|
||||
export type Foo<Y> = Bar<any, Y>;
|
||||
>Foo : Bar<any, Y>
|
||||
>Foo : Foo<Y>
|
||||
|
||||
export const y = (x: Foo<string>) => 1
|
||||
>y : (x: Foo<string>) => number
|
||||
>(x: Foo<string>) => 1 : (x: Foo<string>) => number
|
||||
>x : Bar<any, string>
|
||||
>x : Foo<string>
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ export type Bar<X, Y, Z> = () => [X, Y, Z];
|
||||
>Bar : Bar<X, Y, Z>
|
||||
|
||||
export type Baz<M, N> = Bar<M, string, N>;
|
||||
>Baz : Bar<M, string, N>
|
||||
>Baz : Baz<M, N>
|
||||
|
||||
export type Baa<Y> = Baz<boolean, Y>;
|
||||
>Baa : Bar<boolean, string, Y>
|
||||
>Baa : Baa<Y>
|
||||
|
||||
export const y = (x: Baa<number>) => 1
|
||||
>y : (x: Baa<number>) => number
|
||||
>(x: Baa<number>) => 1 : (x: Baa<number>) => number
|
||||
>x : Bar<boolean, string, number>
|
||||
>x : Baa<number>
|
||||
>1 : 1
|
||||
|
||||
|
||||
@@ -20,4 +20,4 @@ declare type Foo<T, Y> = {
|
||||
foo<U, J>(): Foo<U, J>;
|
||||
};
|
||||
declare type SubFoo<R> = Foo<string, R>;
|
||||
declare function foo(): Foo<string, number>;
|
||||
declare function foo(): SubFoo<number>;
|
||||
|
||||
@@ -7,13 +7,13 @@ type Foo<T, Y> = {
|
||||
|
||||
};
|
||||
type SubFoo<R> = Foo<string, R>;
|
||||
>SubFoo : Foo<string, R>
|
||||
>SubFoo : SubFoo<R>
|
||||
|
||||
function foo() {
|
||||
>foo : () => Foo<string, number>
|
||||
>foo : () => SubFoo<number>
|
||||
|
||||
return {} as SubFoo<number>;
|
||||
>{} as SubFoo<number> : Foo<string, number>
|
||||
>{} as SubFoo<number> : SubFoo<number>
|
||||
>{} : {}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ type Foo<T, Y> = {
|
||||
|
||||
};
|
||||
export type SubFoo<R> = Foo<string, R>;
|
||||
>SubFoo : Foo<string, R>
|
||||
>SubFoo : SubFoo<R>
|
||||
|
||||
function foo() {
|
||||
>foo : () => Foo<string, number>
|
||||
>foo : () => SubFoo<number>
|
||||
|
||||
return {} as SubFoo<number>;
|
||||
>{} as SubFoo<number> : Foo<string, number>
|
||||
>{} as SubFoo<number> : SubFoo<number>
|
||||
>{} : {}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,4 +20,4 @@ declare type Foo<T, Y> = {
|
||||
foo<U, J>(): Foo<U, J>;
|
||||
};
|
||||
declare type SubFoo<R, S> = Foo<S, R>;
|
||||
declare function foo(): Foo<string, number>;
|
||||
declare function foo(): SubFoo<number, string>;
|
||||
|
||||
@@ -7,13 +7,13 @@ type Foo<T, Y> = {
|
||||
|
||||
};
|
||||
type SubFoo<R, S> = Foo<S, R>;
|
||||
>SubFoo : Foo<S, R>
|
||||
>SubFoo : SubFoo<R, S>
|
||||
|
||||
function foo() {
|
||||
>foo : () => Foo<string, number>
|
||||
>foo : () => SubFoo<number, string>
|
||||
|
||||
return {} as SubFoo<number, string>;
|
||||
>{} as SubFoo<number, string> : Foo<string, number>
|
||||
>{} as SubFoo<number, string> : SubFoo<number, string>
|
||||
>{} : {}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ type keys2working<
|
||||
> = O[K1] extends object ? keyof O[K1] : never;
|
||||
|
||||
type keys2workaround<O extends DeepObject, K1 extends keyof O> = Extract<
|
||||
>keys2workaround : Extract<O[K1] extends object ? keyof O[K1] : never, string>
|
||||
>keys2workaround : keys2workaround<O, K1>
|
||||
|
||||
O[K1] extends object ? keyof O[K1] : never,
|
||||
string
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Repro from #41931
|
||||
|
||||
type Enum = Record<string, string | number>;
|
||||
>Enum : Record<string, string | number>
|
||||
>Enum : Enum
|
||||
|
||||
type TypeMap<E extends Enum> = { [key in E[keyof E]]: number | boolean | string | number[] };
|
||||
>TypeMap : TypeMap<E>
|
||||
|
||||
@@ -11,10 +11,10 @@ type StringContains<S extends string, L extends string> = (
|
||||
)[L]
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>
|
||||
>ObjectHasKey : StringContains<Extract<keyof O, string>, L>
|
||||
>ObjectHasKey : ObjectHasKey<O, L>
|
||||
|
||||
type First<T> = ObjectHasKey<T, '0'>; // Should be deferred
|
||||
>First : StringContains<Extract<keyof T, string>, "0">
|
||||
>First : First<T>
|
||||
|
||||
type T1 = ObjectHasKey<{ a: string }, 'a'>; // 'true'
|
||||
>T1 : "true"
|
||||
|
||||
@@ -6,10 +6,10 @@ type StringContains<S extends string, L extends string> = ({ [K in S]: 'true' }
|
||||
>key : string
|
||||
|
||||
type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
|
||||
>ObjectHasKey : StringContains<Extract<keyof O, string>, L>
|
||||
>ObjectHasKey : ObjectHasKey<O, L>
|
||||
|
||||
type A<T> = ObjectHasKey<T, '0'>;
|
||||
>A : StringContains<Extract<keyof T, string>, "0">
|
||||
>A : A<T>
|
||||
|
||||
type B = ObjectHasKey<[string, number], '1'>; // "true"
|
||||
>B : "true"
|
||||
|
||||
@@ -464,18 +464,18 @@ type TypeBar2 = { type: BarEnum.bar2 };
|
||||
|
||||
function func3(value: Partial<UnionOfBar>) {
|
||||
>func3 : (value: Partial<UnionOfBar>) => void
|
||||
>value : Partial<TypeBar1> | Partial<TypeBar2>
|
||||
>value : Partial<UnionOfBar>
|
||||
|
||||
if (value.type !== undefined) {
|
||||
>value.type !== undefined : boolean
|
||||
>value.type : BarEnum | undefined
|
||||
>value : Partial<TypeBar1> | Partial<TypeBar2>
|
||||
>value : Partial<UnionOfBar>
|
||||
>type : BarEnum | undefined
|
||||
>undefined : undefined
|
||||
|
||||
switch (value.type) {
|
||||
>value.type : BarEnum
|
||||
>value : Partial<TypeBar1> | Partial<TypeBar2>
|
||||
>value : Partial<UnionOfBar>
|
||||
>type : BarEnum
|
||||
|
||||
case BarEnum.bar1:
|
||||
@@ -495,7 +495,7 @@ function func3(value: Partial<UnionOfBar>) {
|
||||
>never(value.type) : never
|
||||
>never : (value: never) => never
|
||||
>value.type : never
|
||||
>value : Partial<TypeBar1> | Partial<TypeBar2>
|
||||
>value : Partial<UnionOfBar>
|
||||
>type : never
|
||||
}
|
||||
}
|
||||
@@ -596,12 +596,12 @@ type AllTests = TestA | TestB;
|
||||
>AllTests : AllTests
|
||||
|
||||
type MapOfAllTests = Record<string, AllTests>;
|
||||
>MapOfAllTests : Record<string, AllTests>
|
||||
>MapOfAllTests : MapOfAllTests
|
||||
|
||||
const doTestingStuff = (mapOfTests: MapOfAllTests, ids: string[]) => {
|
||||
>doTestingStuff : (mapOfTests: MapOfAllTests, ids: string[]) => void
|
||||
>(mapOfTests: MapOfAllTests, ids: string[]) => { ids.forEach(id => { let test; test = mapOfTests[id]; if (test.type === 'testA') { console.log(test.bananas); } switch (test.type) { case 'testA': { console.log(test.bananas); } } });} : (mapOfTests: MapOfAllTests, ids: string[]) => void
|
||||
>mapOfTests : Record<string, AllTests>
|
||||
>mapOfTests : MapOfAllTests
|
||||
>ids : string[]
|
||||
|
||||
ids.forEach(id => {
|
||||
@@ -619,7 +619,7 @@ const doTestingStuff = (mapOfTests: MapOfAllTests, ids: string[]) => {
|
||||
>test = mapOfTests[id] : AllTests
|
||||
>test : any
|
||||
>mapOfTests[id] : AllTests
|
||||
>mapOfTests : Record<string, AllTests>
|
||||
>mapOfTests : MapOfAllTests
|
||||
>id : string
|
||||
|
||||
if (test.type === 'testA') {
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@ type ObjectIterator<TObject, TResult> = (
|
||||
) => TResult;
|
||||
|
||||
type DictionaryIterator<T, TResult> = ObjectIterator<Dictionary<T>, TResult>;
|
||||
>DictionaryIterator : ObjectIterator<Dictionary<T>, TResult>
|
||||
>DictionaryIterator : DictionaryIterator<T, TResult>
|
||||
|
||||
// In lodash.d.ts this function has many overloads, but this seems to be the problematic one.
|
||||
function mapValues<T, TResult>(
|
||||
@@ -37,7 +37,7 @@ function mapValues<T, TResult>(
|
||||
>null : null
|
||||
|
||||
callback: DictionaryIterator<T, TResult>
|
||||
>callback : ObjectIterator<Dictionary<T>, TResult>
|
||||
>callback : DictionaryIterator<T, TResult>
|
||||
|
||||
): Dictionary<TResult> {
|
||||
return null as any;
|
||||
@@ -73,7 +73,7 @@ export function fooToBar(
|
||||
>null : null
|
||||
>{} : {}
|
||||
>mapValues(foos, f => f.foo) : Dictionary<string>
|
||||
>mapValues : <T, TResult>(obj: Dictionary<T> | NumericDictionary<T>, callback: ObjectIterator<Dictionary<T>, TResult>) => Dictionary<TResult>
|
||||
>mapValues : <T, TResult>(obj: Dictionary<T> | NumericDictionary<T>, callback: DictionaryIterator<T, TResult>) => Dictionary<TResult>
|
||||
>foos : Record<string, Foo>
|
||||
>f => f.foo : (f: Foo) => string
|
||||
>f : Foo
|
||||
|
||||
+4
-4
@@ -26,7 +26,7 @@ type ObjectIterator<TObject, TResult> = (
|
||||
) => TResult;
|
||||
|
||||
type DictionaryIterator<T, TResult> = ObjectIterator<Dictionary<T>, TResult>;
|
||||
>DictionaryIterator : ObjectIterator<Dictionary<T>, TResult>
|
||||
>DictionaryIterator : DictionaryIterator<T, TResult>
|
||||
|
||||
// In lodash.d.ts this function has many overloads, but this seems to be the problematic one.
|
||||
function mapValues<T, TResult>(
|
||||
@@ -37,7 +37,7 @@ function mapValues<T, TResult>(
|
||||
>null : null
|
||||
|
||||
callback: DictionaryIterator<T, TResult>
|
||||
>callback : ObjectIterator<Dictionary<T>, TResult>
|
||||
>callback : DictionaryIterator<T, TResult>
|
||||
|
||||
): Dictionary<TResult> {
|
||||
return null as any;
|
||||
@@ -68,7 +68,7 @@ export function fooToBar(
|
||||
const wat = mapValues(foos, f => f.foo);
|
||||
>wat : Dictionary<string>
|
||||
>mapValues(foos, f => f.foo) : Dictionary<string>
|
||||
>mapValues : <T, TResult>(obj: Dictionary<T> | NumericDictionary<T>, callback: ObjectIterator<Dictionary<T>, TResult>) => Dictionary<TResult>
|
||||
>mapValues : <T, TResult>(obj: Dictionary<T> | NumericDictionary<T>, callback: DictionaryIterator<T, TResult>) => Dictionary<TResult>
|
||||
>foos : Record<string, Foo>
|
||||
>f => f.foo : (f: Foo) => string
|
||||
>f : Foo
|
||||
@@ -84,7 +84,7 @@ export function fooToBar(
|
||||
>null : null
|
||||
>{} : {}
|
||||
>mapValues(foos, f => f.foo) : Dictionary<string>
|
||||
>mapValues : <T, TResult>(obj: Dictionary<T> | NumericDictionary<T>, callback: ObjectIterator<Dictionary<T>, TResult>) => Dictionary<TResult>
|
||||
>mapValues : <T, TResult>(obj: Dictionary<T> | NumericDictionary<T>, callback: DictionaryIterator<T, TResult>) => Dictionary<TResult>
|
||||
>foos : Record<string, Foo>
|
||||
>f => f.foo : (f: Foo) => string
|
||||
>f : Foo
|
||||
|
||||
@@ -11,7 +11,7 @@ type Args<F> = F extends (...args: infer A) => void ? A : never;
|
||||
>args : A
|
||||
|
||||
type EventMap = Record<string, Function>;
|
||||
>EventMap : Record<string, Function>
|
||||
>EventMap : EventMap
|
||||
|
||||
interface B<M extends EventMap> extends A {
|
||||
emit<Event extends keyof M>(event: Event, ...args: Args<M[Event]>): boolean;
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
// Repro from #29067
|
||||
|
||||
function test<T extends { a: string }>(obj: T) {
|
||||
>test : <T extends { a: string; }>(obj: T) => Pick<T, Exclude<keyof T, "a">> & { b: string; }
|
||||
>test : <T extends { a: string; }>(obj: T) => Omit<T, "a"> & { b: string; }
|
||||
>a : string
|
||||
>obj : T
|
||||
|
||||
let { a, ...rest } = obj;
|
||||
>a : string
|
||||
>rest : Pick<T, Exclude<keyof T, "a">>
|
||||
>rest : Omit<T, "a">
|
||||
>obj : T
|
||||
|
||||
return { ...rest, b: a };
|
||||
>{ ...rest, b: a } : Pick<T, Exclude<keyof T, "a">> & { b: string; }
|
||||
>rest : Pick<T, Exclude<keyof T, "a">>
|
||||
>{ ...rest, b: a } : Omit<T, "a"> & { b: string; }
|
||||
>rest : Omit<T, "a">
|
||||
>b : string
|
||||
>a : string
|
||||
}
|
||||
@@ -30,7 +30,7 @@ let o2: { b: string, x: number } = test(o1);
|
||||
>o2 : { b: string; x: number; }
|
||||
>b : string
|
||||
>x : number
|
||||
>test(o1) : Pick<{ a: string; x: number; }, "x"> & { b: string; }
|
||||
>test : <T extends { a: string; }>(obj: T) => Pick<T, Exclude<keyof T, "a">> & { b: string; }
|
||||
>test(o1) : Omit<{ a: string; x: number; }, "a"> & { b: string; }
|
||||
>test : <T extends { a: string; }>(obj: T) => Omit<T, "a"> & { b: string; }
|
||||
>o1 : { a: string; x: number; }
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function f1<T extends { a: string, b: number }>(obj: T) {
|
||||
let { a: a1, ...r1 } = obj;
|
||||
>a : any
|
||||
>a1 : string
|
||||
>r1 : Pick<T, Exclude<keyof T, "a">>
|
||||
>r1 : Omit<T, "a">
|
||||
>obj : T
|
||||
|
||||
let { a: a2, b: b2, ...r2 } = obj;
|
||||
@@ -24,24 +24,24 @@ function f1<T extends { a: string, b: number }>(obj: T) {
|
||||
>a2 : string
|
||||
>b : any
|
||||
>b2 : number
|
||||
>r2 : Pick<T, Exclude<keyof T, "a" | "b">>
|
||||
>r2 : Omit<T, "a" | "b">
|
||||
>obj : T
|
||||
|
||||
let { 'a': a3, ...r3 } = obj;
|
||||
>a3 : string
|
||||
>r3 : Pick<T, Exclude<keyof T, "a">>
|
||||
>r3 : Omit<T, "a">
|
||||
>obj : T
|
||||
|
||||
let { ['a']: a4, ...r4 } = obj;
|
||||
>'a' : "a"
|
||||
>a4 : string
|
||||
>r4 : Pick<T, Exclude<keyof T, "a">>
|
||||
>r4 : Omit<T, "a">
|
||||
>obj : T
|
||||
|
||||
let { [a]: a5, ...r5 } = obj;
|
||||
>a : "a"
|
||||
>a5 : string
|
||||
>r5 : Pick<T, Exclude<keyof T, "a">>
|
||||
>r5 : Omit<T, "a">
|
||||
>obj : T
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ function f2<T extends { [sa]: string, [sb]: number }>(obj: T) {
|
||||
>a1 : string
|
||||
>sb : unique symbol
|
||||
>b1 : number
|
||||
>r1 : Pick<T, Exclude<keyof T, unique symbol | unique symbol>>
|
||||
>r1 : Omit<T, unique symbol | unique symbol>
|
||||
>obj : T
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ function f3<T, K1 extends keyof T, K2 extends keyof T>(obj: T, k1: K1, k2: K2) {
|
||||
>a1 : T[K1]
|
||||
>k2 : K2
|
||||
>a2 : T[K2]
|
||||
>r1 : Pick<T, Exclude<keyof T, K1 | K2>>
|
||||
>r1 : Omit<T, K1 | K2>
|
||||
>obj : T
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ function f4<K1 extends keyof Item, K2 extends keyof Item>(obj: Item, k1: K1, k2:
|
||||
>a1 : Item[K1]
|
||||
>k2 : K2
|
||||
>a2 : Item[K2]
|
||||
>r1 : Pick<Item, Exclude<"a", K1 | K2> | Exclude<"b", K1 | K2> | Exclude<"c", K1 | K2>>
|
||||
>r1 : Omit<Item, K1 | K2>
|
||||
>obj : Item
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ type Bind1<T extends (head: any, ...tail: any[]) => any> = (...args: Tail<Parame
|
||||
>args : Tail<Parameters<T>>
|
||||
|
||||
type Generic = Bind1<MyFunctionType>; // (bar: string) => boolean
|
||||
>Generic : Bind1<MyFunctionType>
|
||||
>Generic : Generic
|
||||
|
||||
function assignmentWithComplexRest<T extends any[]>() {
|
||||
>assignmentWithComplexRest : <T extends any[]>() => void
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ type AnyFunction = (...args: any[]) => any;
|
||||
>args : any[]
|
||||
|
||||
type Params<T> = Parameters<Extract<T, AnyFunction>>;
|
||||
>Params : Parameters<Extract<T, AnyFunction>>
|
||||
>Params : Params<T>
|
||||
|
||||
interface Wrapper<T> {
|
||||
call<K extends keyof T>(event: K, ...args: Params<T[K]>): void;
|
||||
|
||||
@@ -6,10 +6,10 @@ type Diff<T extends keyof any, U extends keyof any> =
|
||||
>x : string
|
||||
|
||||
type Omit<U, K extends keyof U> = Pick<U, Diff<keyof U, K>>
|
||||
>Omit : Pick<U, Diff<keyof U, K>>
|
||||
>Omit : Omit<U, K>
|
||||
|
||||
type Omit1<U, K extends keyof U> = Pick<U, Diff<keyof U, K>>;
|
||||
>Omit1 : Pick<U, Diff<keyof U, K>>
|
||||
>Omit1 : Omit1<U, K>
|
||||
|
||||
// is in fact an equivalent of
|
||||
|
||||
@@ -17,12 +17,12 @@ type Omit2<T, K extends keyof T> = {[P in Diff<keyof T, K>]: T[P]};
|
||||
>Omit2 : Omit2<T, K>
|
||||
|
||||
type O = Omit<{ a: number, b: string }, 'a'>
|
||||
>O : Pick<{ a: number; b: string; }, "b">
|
||||
>O : O
|
||||
>a : number
|
||||
>b : string
|
||||
|
||||
export const o: O = { b: '' }
|
||||
>o : Pick<{ a: number; b: string; }, "b">
|
||||
>o : O
|
||||
>{ b: '' } : { b: string; }
|
||||
>b : string
|
||||
>'' : ""
|
||||
|
||||
@@ -145,7 +145,7 @@ type P0 = {};
|
||||
>P0 : P0
|
||||
|
||||
type P3Names = RequiredPropNames<P3>; // expect 'a' | 'b'
|
||||
>P3Names : RequiredPropNames<P3>
|
||||
>P3Names : P3Names
|
||||
|
||||
type P2Names = RequiredPropNames<P2>; // expect 'a'
|
||||
>P2Names : "a"
|
||||
@@ -169,16 +169,16 @@ declare const p0NameTest: ExpectType<never, P0Names>;
|
||||
>p0NameTest : "Match"
|
||||
|
||||
type P3Props = RequiredProps<P3>; // expect { a: string; b: number }
|
||||
>P3Props : RequiredProps<P3>
|
||||
>P3Props : P3Props
|
||||
|
||||
type P2Props = RequiredProps<P2>; // expect { a: string; }
|
||||
>P2Props : RequiredProps<P2>
|
||||
>P2Props : P2Props
|
||||
|
||||
type P1Props = RequiredProps<P1>; // expect {}
|
||||
>P1Props : RequiredProps<P1>
|
||||
>P1Props : P1Props
|
||||
|
||||
type P0Props = RequiredProps<P0>; // expect {}
|
||||
>P0Props : RequiredProps<P0>
|
||||
>P0Props : P0Props
|
||||
|
||||
declare const p3Test: ExpectType<{ a: string; b: number }, P3Props>;
|
||||
>p3Test : "Match"
|
||||
@@ -214,7 +214,7 @@ type O0 = {};
|
||||
>O0 : O0
|
||||
|
||||
type O3Names = OptionalPropNames<O3>; // expect 'a' | 'b'
|
||||
>O3Names : OptionalPropNames<O3>
|
||||
>O3Names : O3Names
|
||||
|
||||
type O2Names = OptionalPropNames<O2>; // expect 'a'
|
||||
>O2Names : "a"
|
||||
@@ -238,16 +238,16 @@ declare const o0NameTest: ExpectType<never, O0Names>;
|
||||
>o0NameTest : "Match"
|
||||
|
||||
type O3Props = OptionalProps<O3>; // expect { a?: string | undefined; b?: number | undefined }
|
||||
>O3Props : OptionalProps<O3>
|
||||
>O3Props : O3Props
|
||||
|
||||
type O2Props = OptionalProps<O2>; // expect { a?: string | undefined; }
|
||||
>O2Props : OptionalProps<O2>
|
||||
>O2Props : O2Props
|
||||
|
||||
type O1Props = OptionalProps<O1>; // expect {}
|
||||
>O1Props : OptionalProps<O1>
|
||||
>O1Props : O1Props
|
||||
|
||||
type O0Props = OptionalProps<O0>; // expect {}
|
||||
>O0Props : OptionalProps<O0>
|
||||
>O0Props : O0Props
|
||||
|
||||
declare const o3Test: ExpectType<{ a?: string; b?: number }, O3Props>;
|
||||
>o3Test : "Match"
|
||||
|
||||
@@ -427,7 +427,7 @@ type MatchingKeys<T, U, K extends keyof T = keyof T> =
|
||||
K extends keyof T ? T[K] extends U ? K : never : never;
|
||||
|
||||
type VoidKeys<T> = MatchingKeys<T, void>;
|
||||
>VoidKeys : MatchingKeys<T, void, keyof T>
|
||||
>VoidKeys : VoidKeys<T>
|
||||
|
||||
interface test {
|
||||
a: 1,
|
||||
|
||||
@@ -7,7 +7,7 @@ export type Thunk<T> = (() => T) | T;
|
||||
>Thunk : Thunk<T>
|
||||
|
||||
export type ComposeOutputTypeDefinition = Readonly<ObjectTypeComposer<any, any> | EnumTypeComposer>;
|
||||
>ComposeOutputTypeDefinition : Readonly<ObjectTypeComposer<any, any>> | Readonly<EnumTypeComposer>
|
||||
>ComposeOutputTypeDefinition : ComposeOutputTypeDefinition
|
||||
|
||||
export class EnumTypeComposer {
|
||||
>EnumTypeComposer : EnumTypeComposer
|
||||
@@ -29,7 +29,7 @@ export class ObjectTypeComposer<TSource, TContext> {
|
||||
public addResolver<TResolverSource>(opts: { type?: Thunk<ComposeOutputTypeDefinition> }): this;
|
||||
>addResolver : <TResolverSource>(opts: { type?: Thunk<ComposeOutputTypeDefinition>;}) => this
|
||||
>opts : { type?: Thunk<ComposeOutputTypeDefinition>; }
|
||||
>type : Thunk<Readonly<ObjectTypeComposer<any, any>> | Readonly<EnumTypeComposer>>
|
||||
>type : Thunk<ComposeOutputTypeDefinition>
|
||||
}
|
||||
|
||||
export class Resolver {
|
||||
@@ -61,9 +61,9 @@ declare const User: ObjectTypeComposer<any, any>;
|
||||
|
||||
User.addResolver({
|
||||
>User.addResolver({ type: User, // `User as any` fix the problem}) : ObjectTypeComposer<any, any>
|
||||
>User.addResolver : <TResolverSource>(opts: { type?: import("tests/cases/compiler/graphql-compose").Thunk<Readonly<ObjectTypeComposer<any, any>> | Readonly<import("tests/cases/compiler/graphql-compose").EnumTypeComposer>>; }) => ObjectTypeComposer<any, any>
|
||||
>User.addResolver : <TResolverSource>(opts: { type?: import("tests/cases/compiler/graphql-compose").Thunk<import("tests/cases/compiler/graphql-compose").ComposeOutputTypeDefinition>; }) => ObjectTypeComposer<any, any>
|
||||
>User : ObjectTypeComposer<any, any>
|
||||
>addResolver : <TResolverSource>(opts: { type?: import("tests/cases/compiler/graphql-compose").Thunk<Readonly<ObjectTypeComposer<any, any>> | Readonly<import("tests/cases/compiler/graphql-compose").EnumTypeComposer>>; }) => ObjectTypeComposer<any, any>
|
||||
>addResolver : <TResolverSource>(opts: { type?: import("tests/cases/compiler/graphql-compose").Thunk<import("tests/cases/compiler/graphql-compose").ComposeOutputTypeDefinition>; }) => ObjectTypeComposer<any, any>
|
||||
>{ type: User, // `User as any` fix the problem} : { type: ObjectTypeComposer<any, any>; }
|
||||
|
||||
type: User, // `User as any` fix the problem
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/infiniteConstraints.ts(4,37): error TS2536: Type '"val"' cannot be used to index type 'B[Exclude<keyof B, K>]'.
|
||||
tests/cases/compiler/infiniteConstraints.ts(31,43): error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'.
|
||||
tests/cases/compiler/infiniteConstraints.ts(31,63): error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'.
|
||||
tests/cases/compiler/infiniteConstraints.ts(31,43): error TS2322: Type 'Value<"dup">' is not assignable to type 'never'.
|
||||
tests/cases/compiler/infiniteConstraints.ts(31,63): error TS2322: Type 'Value<"dup">' is not assignable to type 'never'.
|
||||
tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2536: Type '"foo"' cannot be used to index type 'T[keyof T]'.
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2536: Type '"foo"' c
|
||||
|
||||
const shouldBeError = ensureNoDuplicates({main: value("dup"), alternate: value("dup")});
|
||||
~~~~
|
||||
!!! error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'Value<"dup">' is not assignable to type 'never'.
|
||||
!!! related TS6500 tests/cases/compiler/infiniteConstraints.ts:31:43: The expected type comes from property 'main' which is declared here on type '{ main: never; alternate: never; }'
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'.
|
||||
!!! error TS2322: Type 'Value<"dup">' is not assignable to type 'never'.
|
||||
!!! related TS6500 tests/cases/compiler/infiniteConstraints.ts:31:63: The expected type comes from property 'alternate' which is declared here on type '{ main: never; alternate: never; }'
|
||||
|
||||
// Repro from #26448
|
||||
|
||||
@@ -32,14 +32,14 @@ const out = myBug({obj1: {a: "test"}})
|
||||
>"test" : "test"
|
||||
|
||||
type Value<V extends string = string> = Record<"val", V>;
|
||||
>Value : Record<"val", V>
|
||||
>Value : Value<V>
|
||||
|
||||
declare function value<V extends string>(val: V): Value<V>;
|
||||
>value : <V extends string>(val: V) => Value<V>
|
||||
>val : V
|
||||
|
||||
declare function ensureNoDuplicates<
|
||||
>ensureNoDuplicates : <T extends { [K in keyof T]: Extract<T[K], Record<"val", string>>["val"] extends Extract<T[Exclude<keyof T, K>], Record<"val", string>>["val"] ? never : any; }>(vals: T) => void
|
||||
>ensureNoDuplicates : <T extends { [K in keyof T]: Extract<T[K], Value<string>>["val"] extends Extract<T[Exclude<keyof T, K>], Value<string>>["val"] ? never : any; }>(vals: T) => void
|
||||
|
||||
T extends {
|
||||
[K in keyof T]: Extract<T[K], Value>["val"] extends Extract<T[Exclude<keyof T, K>], Value>["val"]
|
||||
@@ -52,39 +52,39 @@ declare function ensureNoDuplicates<
|
||||
const noError = ensureNoDuplicates({main: value("test"), alternate: value("test2")});
|
||||
>noError : void
|
||||
>ensureNoDuplicates({main: value("test"), alternate: value("test2")}) : void
|
||||
>ensureNoDuplicates : <T extends { [K in keyof T]: Extract<T[K], Record<"val", string>>["val"] extends Extract<T[Exclude<keyof T, K>], Record<"val", string>>["val"] ? never : any; }>(vals: T) => void
|
||||
>{main: value("test"), alternate: value("test2")} : { main: Record<"val", "test">; alternate: Record<"val", "test2">; }
|
||||
>main : Record<"val", "test">
|
||||
>value("test") : Record<"val", "test">
|
||||
>value : <V extends string>(val: V) => Record<"val", V>
|
||||
>ensureNoDuplicates : <T extends { [K in keyof T]: Extract<T[K], Value<string>>["val"] extends Extract<T[Exclude<keyof T, K>], Value<string>>["val"] ? never : any; }>(vals: T) => void
|
||||
>{main: value("test"), alternate: value("test2")} : { main: Value<"test">; alternate: Value<"test2">; }
|
||||
>main : Value<"test">
|
||||
>value("test") : Value<"test">
|
||||
>value : <V extends string>(val: V) => Value<V>
|
||||
>"test" : "test"
|
||||
>alternate : Record<"val", "test2">
|
||||
>value("test2") : Record<"val", "test2">
|
||||
>value : <V extends string>(val: V) => Record<"val", V>
|
||||
>alternate : Value<"test2">
|
||||
>value("test2") : Value<"test2">
|
||||
>value : <V extends string>(val: V) => Value<V>
|
||||
>"test2" : "test2"
|
||||
|
||||
const shouldBeNoError = ensureNoDuplicates({main: value("test")});
|
||||
>shouldBeNoError : void
|
||||
>ensureNoDuplicates({main: value("test")}) : void
|
||||
>ensureNoDuplicates : <T extends { [K in keyof T]: Extract<T[K], Record<"val", string>>["val"] extends Extract<T[Exclude<keyof T, K>], Record<"val", string>>["val"] ? never : any; }>(vals: T) => void
|
||||
>{main: value("test")} : { main: Record<"val", "test">; }
|
||||
>main : Record<"val", "test">
|
||||
>value("test") : Record<"val", "test">
|
||||
>value : <V extends string>(val: V) => Record<"val", V>
|
||||
>ensureNoDuplicates : <T extends { [K in keyof T]: Extract<T[K], Value<string>>["val"] extends Extract<T[Exclude<keyof T, K>], Value<string>>["val"] ? never : any; }>(vals: T) => void
|
||||
>{main: value("test")} : { main: Value<"test">; }
|
||||
>main : Value<"test">
|
||||
>value("test") : Value<"test">
|
||||
>value : <V extends string>(val: V) => Value<V>
|
||||
>"test" : "test"
|
||||
|
||||
const shouldBeError = ensureNoDuplicates({main: value("dup"), alternate: value("dup")});
|
||||
>shouldBeError : void
|
||||
>ensureNoDuplicates({main: value("dup"), alternate: value("dup")}) : void
|
||||
>ensureNoDuplicates : <T extends { [K in keyof T]: Extract<T[K], Record<"val", string>>["val"] extends Extract<T[Exclude<keyof T, K>], Record<"val", string>>["val"] ? never : any; }>(vals: T) => void
|
||||
>{main: value("dup"), alternate: value("dup")} : { main: Record<"val", "dup">; alternate: Record<"val", "dup">; }
|
||||
>main : Record<"val", "dup">
|
||||
>value("dup") : Record<"val", "dup">
|
||||
>value : <V extends string>(val: V) => Record<"val", V>
|
||||
>ensureNoDuplicates : <T extends { [K in keyof T]: Extract<T[K], Value<string>>["val"] extends Extract<T[Exclude<keyof T, K>], Value<string>>["val"] ? never : any; }>(vals: T) => void
|
||||
>{main: value("dup"), alternate: value("dup")} : { main: Value<"dup">; alternate: Value<"dup">; }
|
||||
>main : Value<"dup">
|
||||
>value("dup") : Value<"dup">
|
||||
>value : <V extends string>(val: V) => Value<V>
|
||||
>"dup" : "dup"
|
||||
>alternate : Record<"val", "dup">
|
||||
>value("dup") : Record<"val", "dup">
|
||||
>value : <V extends string>(val: V) => Record<"val", V>
|
||||
>alternate : Value<"dup">
|
||||
>value("dup") : Value<"dup">
|
||||
>value : <V extends string>(val: V) => Value<V>
|
||||
>"dup" : "dup"
|
||||
|
||||
// Repro from #26448
|
||||
|
||||
@@ -159,14 +159,14 @@ type M1 = { a: 1, b: 2 } & { a: 2, c: 3 }; // never
|
||||
>c : 3
|
||||
|
||||
type M2 = Merge1<{ a: 1, b: 2 }, { a: 2, c: 3 }>; // {}
|
||||
>M2 : Merge1<{ a: 1; b: 2; }, { a: 2; c: 3; }>
|
||||
>M2 : M2
|
||||
>a : 1
|
||||
>b : 2
|
||||
>a : 2
|
||||
>c : 3
|
||||
|
||||
type M3 = Merge2<{ a: 1, b: 2 }, { a: 2, c: 3 }>; // { a: 1, b: 2, c: 3 }
|
||||
>M3 : Merge2<{ a: 1; b: 2; }, { a: 2; c: 3; }>
|
||||
>M3 : M3
|
||||
>a : 1
|
||||
>b : 2
|
||||
>a : 2
|
||||
|
||||
@@ -159,14 +159,14 @@ type M1 = { a: 1, b: 2 } & { a: 2, c: 3 }; // never
|
||||
>c : 3
|
||||
|
||||
type M2 = Merge1<{ a: 1, b: 2 }, { a: 2, c: 3 }>; // {}
|
||||
>M2 : Merge1<{ a: 1; b: 2; }, { a: 2; c: 3; }>
|
||||
>M2 : M2
|
||||
>a : 1
|
||||
>b : 2
|
||||
>a : 2
|
||||
>c : 3
|
||||
|
||||
type M3 = Merge2<{ a: 1, b: 2 }, { a: 2, c: 3 }>; // { a: 1, b: 2, c: 3 }
|
||||
>M3 : Merge2<{ a: 1; b: 2; }, { a: 2; c: 3; }>
|
||||
>M3 : M3
|
||||
>a : 1
|
||||
>b : 2
|
||||
>a : 2
|
||||
|
||||
@@ -13,29 +13,29 @@ type Nominal<Kind extends string, Type> = Type & {
|
||||
};
|
||||
|
||||
type A = Nominal<'A', string>;
|
||||
>A : Nominal<"A", string>
|
||||
>A : A
|
||||
|
||||
declare const a: Set<A>;
|
||||
>a : Set<Nominal<"A", string>>
|
||||
>a : Set<A>
|
||||
|
||||
declare const b: Set<A>;
|
||||
>b : Set<Nominal<"A", string>>
|
||||
>b : Set<A>
|
||||
|
||||
const c1 = Array.from(a).concat(Array.from(b));
|
||||
>c1 : Nominal<"A", string>[]
|
||||
>Array.from(a).concat(Array.from(b)) : Nominal<"A", string>[]
|
||||
>Array.from(a).concat : { (...items: ConcatArray<Nominal<"A", string>>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray<Nominal<"A", string>>)[]): Nominal<"A", string>[]; }
|
||||
>Array.from(a) : Nominal<"A", string>[]
|
||||
>c1 : A[]
|
||||
>Array.from(a).concat(Array.from(b)) : A[]
|
||||
>Array.from(a).concat : { (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }
|
||||
>Array.from(a) : A[]
|
||||
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
|
||||
>Array : ArrayConstructor
|
||||
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
|
||||
>a : Set<Nominal<"A", string>>
|
||||
>concat : { (...items: ConcatArray<Nominal<"A", string>>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray<Nominal<"A", string>>)[]): Nominal<"A", string>[]; }
|
||||
>Array.from(b) : Nominal<"A", string>[]
|
||||
>a : Set<A>
|
||||
>concat : { (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }
|
||||
>Array.from(b) : A[]
|
||||
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
|
||||
>Array : ArrayConstructor
|
||||
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
|
||||
>b : Set<Nominal<"A", string>>
|
||||
>b : Set<A>
|
||||
|
||||
// Simpler repro
|
||||
|
||||
@@ -43,7 +43,7 @@ declare function from<T>(): T[];
|
||||
>from : <T>() => T[]
|
||||
|
||||
const c2: ReadonlyArray<A> = from();
|
||||
>c2 : readonly Nominal<"A", string>[]
|
||||
>from() : Nominal<"A", string>[]
|
||||
>c2 : readonly A[]
|
||||
>from() : A[]
|
||||
>from : <T>() => T[]
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(17
|
||||
Property 'y' is incompatible with index signature.
|
||||
Property 'a' is missing in type 'B' but required in type 'A'.
|
||||
tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(27,10): error TS2339: Property 'b' does not exist on type '{ a: string; }'.
|
||||
tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(29,7): error TS2322: Type 'constr<{}, { [key: string]: { a: string; }; }>' is not assignable to type '{ [key: string]: { a: string; b: string; }; }'.
|
||||
tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(29,7): error TS2322: Type 's' is not assignable to type '{ [key: string]: { a: string; b: string; }; }'.
|
||||
Index signatures are incompatible.
|
||||
Property 'b' is missing in type '{ a: string; }' but required in type '{ a: string; b: string; }'.
|
||||
tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(35,1): error TS2322: Type '{ a: string; } & { b: number; }' is not assignable to type '{ [key: string]: string; }'.
|
||||
@@ -48,7 +48,7 @@ tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(35
|
||||
|
||||
const d: { [key: string]: {a: string, b: string} } = q; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'constr<{}, { [key: string]: { a: string; }; }>' is not assignable to type '{ [key: string]: { a: string; b: string; }; }'.
|
||||
!!! error TS2322: Type 's' is not assignable to type '{ [key: string]: { a: string; b: string; }; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Property 'b' is missing in type '{ a: string; }' but required in type '{ a: string; b: string; }'.
|
||||
!!! related TS2728 tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts:29:39: 'b' is declared here.
|
||||
|
||||
@@ -65,19 +65,19 @@ type constr<Source, Tgt> = { [K in keyof Source]: string } & Pick<Tgt, Exclude<k
|
||||
>constr : constr<Source, Tgt>
|
||||
|
||||
type s = constr<{}, { [key: string]: { a: string } }>;
|
||||
>s : constr<{}, { [key: string]: { a: string; }; }>
|
||||
>s : s
|
||||
>key : string
|
||||
>a : string
|
||||
|
||||
declare const q: s;
|
||||
>q : constr<{}, { [key: string]: { a: string; }; }>
|
||||
>q : s
|
||||
|
||||
q["asd"].a.substr(1);
|
||||
>q["asd"].a.substr(1) : string
|
||||
>q["asd"].a.substr : (from: number, length?: number | undefined) => string
|
||||
>q["asd"].a : string
|
||||
>q["asd"] : { a: string; }
|
||||
>q : constr<{}, { [key: string]: { a: string; }; }>
|
||||
>q : s
|
||||
>"asd" : "asd"
|
||||
>a : string
|
||||
>substr : (from: number, length?: number | undefined) => string
|
||||
@@ -86,7 +86,7 @@ q["asd"].a.substr(1);
|
||||
q["asd"].b; // Error
|
||||
>q["asd"].b : any
|
||||
>q["asd"] : { a: string; }
|
||||
>q : constr<{}, { [key: string]: { a: string; }; }>
|
||||
>q : s
|
||||
>"asd" : "asd"
|
||||
>b : any
|
||||
|
||||
@@ -95,7 +95,7 @@ const d: { [key: string]: {a: string, b: string} } = q; // Error
|
||||
>key : string
|
||||
>a : string
|
||||
>b : string
|
||||
>q : constr<{}, { [key: string]: { a: string; }; }>
|
||||
>q : s
|
||||
|
||||
// Repro from #32484
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ type ExtractValueType<T> = T extends ReactSelectProps<infer U> ? U : never;
|
||||
>ExtractValueType : ExtractValueType<T>
|
||||
|
||||
export type ReactSingleSelectProps<
|
||||
>ReactSingleSelectProps : Overwrite<Omit<WrappedProps, "multi">, Props<ExtractValueType<WrappedProps>>>
|
||||
>ReactSingleSelectProps : ReactSingleSelectProps<WrappedProps>
|
||||
|
||||
WrappedProps extends ReactSelectProps<any>
|
||||
> = Overwrite<
|
||||
@@ -118,11 +118,11 @@ declare class ReactSelectClass<TValue = OptionValues> extends React.Component<Re
|
||||
}
|
||||
|
||||
export type OptionComponentType<TValue = OptionValues> = React.ComponentType<OptionComponentProps<TValue>>;
|
||||
>OptionComponentType : React.ComponentType<OptionComponentProps<TValue>>
|
||||
>OptionComponentType : OptionComponentType<TValue>
|
||||
>React : any
|
||||
|
||||
export type ValueComponentType<TValue = OptionValues> = React.ComponentType<ValueComponentProps<TValue>>;
|
||||
>ValueComponentType : React.ComponentType<ValueComponentProps<TValue>>
|
||||
>ValueComponentType : ValueComponentType<TValue>
|
||||
>React : any
|
||||
|
||||
export type HandlerRendererResult = JSX.Element | null | false;
|
||||
@@ -175,7 +175,7 @@ export type OnInputChangeHandler = (inputValue: string) => string;
|
||||
>inputValue : string
|
||||
|
||||
export type OnInputKeyDownHandler = React.KeyboardEventHandler<HTMLDivElement | HTMLInputElement>;
|
||||
>OnInputKeyDownHandler : (event: React.KeyboardEvent<HTMLDivElement | HTMLInputElement>) => void
|
||||
>OnInputKeyDownHandler : OnInputKeyDownHandler
|
||||
>React : any
|
||||
|
||||
export type OnMenuScrollToBottomHandler = () => void;
|
||||
@@ -185,11 +185,11 @@ export type OnOpenHandler = () => void;
|
||||
>OnOpenHandler : OnOpenHandler
|
||||
|
||||
export type OnFocusHandler = React.FocusEventHandler<HTMLDivElement | HTMLInputElement>;
|
||||
>OnFocusHandler : (event: React.FocusEvent<HTMLDivElement | HTMLInputElement>) => void
|
||||
>OnFocusHandler : OnFocusHandler
|
||||
>React : any
|
||||
|
||||
export type OnBlurHandler = React.FocusEventHandler<HTMLDivElement | HTMLInputElement>;
|
||||
>OnBlurHandler : (event: React.FocusEvent<HTMLDivElement | HTMLInputElement>) => void
|
||||
>OnBlurHandler : OnBlurHandler
|
||||
>React : any
|
||||
|
||||
export type OptionRendererHandler<TValue = OptionValues> = (option: Option<TValue>) => HandlerRendererResult;
|
||||
@@ -237,10 +237,10 @@ export type ShouldKeyDownEventCreateNewOptionHandler = (arg: { keyCode: number }
|
||||
>keyCode : number
|
||||
|
||||
export type OnChangeSingleHandler<TValue = OptionValues> = OnChangeHandler<TValue, Option<TValue>>;
|
||||
>OnChangeSingleHandler : OnChangeHandler<TValue, Option<TValue>>
|
||||
>OnChangeSingleHandler : OnChangeSingleHandler<TValue>
|
||||
|
||||
export type OnChangeMultipleHandler<TValue = OptionValues> = OnChangeHandler<TValue, Options<TValue>>;
|
||||
>OnChangeMultipleHandler : OnChangeHandler<TValue, Options<TValue>>
|
||||
>OnChangeMultipleHandler : OnChangeMultipleHandler<TValue>
|
||||
|
||||
export type OnChangeHandler<TValue = OptionValues, TOption = Option<TValue> | Options<TValue>> = (newValue: TOption | null) => void;
|
||||
>OnChangeHandler : OnChangeHandler<TValue, TOption>
|
||||
@@ -453,7 +453,7 @@ export interface ArrowRendererProps {
|
||||
* Arrow mouse down event handler.
|
||||
*/
|
||||
onMouseDown: React.MouseEventHandler<any>;
|
||||
>onMouseDown : (event: React.MouseEvent<any>) => void
|
||||
>onMouseDown : React.MouseEventHandler<any>
|
||||
>React : any
|
||||
|
||||
/**
|
||||
@@ -768,7 +768,7 @@ export interface ReactSelectProps<TValue = OptionValues> extends React.Props<Rea
|
||||
* onBlur handler: function (event) {}
|
||||
*/
|
||||
onBlur?: OnBlurHandler;
|
||||
>onBlur : ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement>) => void) | undefined
|
||||
>onBlur : OnBlurHandler | undefined
|
||||
|
||||
/**
|
||||
* whether to clear input on blur or not
|
||||
@@ -809,7 +809,7 @@ export interface ReactSelectProps<TValue = OptionValues> extends React.Props<Rea
|
||||
* onFocus handler: function (event) {}
|
||||
*/
|
||||
onFocus?: OnFocusHandler;
|
||||
>onFocus : ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement>) => void) | undefined
|
||||
>onFocus : OnFocusHandler | undefined
|
||||
|
||||
/**
|
||||
* onInputChange handler: function (inputValue) {}
|
||||
@@ -821,7 +821,7 @@ export interface ReactSelectProps<TValue = OptionValues> extends React.Props<Rea
|
||||
* onInputKeyDown handler: function (keyboardEvent) {}
|
||||
*/
|
||||
onInputKeyDown?: OnInputKeyDownHandler;
|
||||
>onInputKeyDown : ((event: React.KeyboardEvent<HTMLDivElement | HTMLInputElement>) => void) | undefined
|
||||
>onInputKeyDown : OnInputKeyDownHandler | undefined
|
||||
|
||||
/**
|
||||
* fires when the menu is scrolled to the bottom; can be used to paginate options
|
||||
@@ -859,7 +859,7 @@ export interface ReactSelectProps<TValue = OptionValues> extends React.Props<Rea
|
||||
* option component to render in dropdown
|
||||
*/
|
||||
optionComponent?: OptionComponentType<TValue>;
|
||||
>optionComponent : React.ComponentType<OptionComponentProps<TValue>> | undefined
|
||||
>optionComponent : OptionComponentType<TValue> | undefined
|
||||
|
||||
/**
|
||||
* function which returns a custom way to render the options in the menu
|
||||
@@ -973,7 +973,7 @@ export interface ReactSelectProps<TValue = OptionValues> extends React.Props<Rea
|
||||
* value component to render
|
||||
*/
|
||||
valueComponent?: ValueComponentType<TValue>;
|
||||
>valueComponent : React.ComponentType<ValueComponentProps<TValue>> | undefined
|
||||
>valueComponent : ValueComponentType<TValue> | undefined
|
||||
|
||||
/**
|
||||
* optional style to apply to the component wrapper
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ type ReactJSXElementChildrenAttribute = JSX.ElementChildrenAttribute
|
||||
>JSX : any
|
||||
|
||||
type ReactJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>
|
||||
>ReactJSXLibraryManagedAttributes : JSX.LibraryManagedAttributes<C, P>
|
||||
>ReactJSXLibraryManagedAttributes : ReactJSXLibraryManagedAttributes<C, P>
|
||||
>JSX : any
|
||||
|
||||
type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ type ReactJSXElementChildrenAttribute = JSX.ElementChildrenAttribute
|
||||
>JSX : any
|
||||
|
||||
type ReactJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>
|
||||
>ReactJSXLibraryManagedAttributes : JSX.LibraryManagedAttributes<C, P>
|
||||
>ReactJSXLibraryManagedAttributes : ReactJSXLibraryManagedAttributes<C, P>
|
||||
>JSX : any
|
||||
|
||||
type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes
|
||||
|
||||
@@ -270,38 +270,38 @@ function f10<T extends Item, K extends keyof T>(obj: T, k1: string, k2: keyof It
|
||||
}
|
||||
|
||||
type Dict = Record<string, number>;
|
||||
>Dict : Record<string, number>
|
||||
>Dict : Dict
|
||||
|
||||
function f11<K extends keyof Dict>(obj: Dict, k1: keyof Dict, k2: K) {
|
||||
>f11 : <K extends string>(obj: Dict, k1: keyof Dict, k2: K) => void
|
||||
>obj : Record<string, number>
|
||||
>obj : Dict
|
||||
>k1 : string
|
||||
>k2 : K
|
||||
|
||||
obj.foo = 123;
|
||||
>obj.foo = 123 : 123
|
||||
>obj.foo : number
|
||||
>obj : Record<string, number>
|
||||
>obj : Dict
|
||||
>foo : number
|
||||
>123 : 123
|
||||
|
||||
obj[k1] = 123;
|
||||
>obj[k1] = 123 : 123
|
||||
>obj[k1] : number
|
||||
>obj : Record<string, number>
|
||||
>obj : Dict
|
||||
>k1 : string
|
||||
>123 : 123
|
||||
|
||||
obj[k2] = 123;
|
||||
>obj[k2] = 123 : 123
|
||||
>obj[k2] : number
|
||||
>obj : Record<string, number>
|
||||
>obj : Dict
|
||||
>k2 : K
|
||||
>123 : 123
|
||||
}
|
||||
|
||||
function f12<T extends Readonly<Dict>, K extends keyof T>(obj: T, k1: keyof Dict, k2: keyof T, k3: K) {
|
||||
>f12 : <T extends Readonly<Record<string, number>>, K extends keyof T>(obj: T, k1: keyof Dict, k2: keyof T, k3: K) => void
|
||||
>f12 : <T extends Readonly<Dict>, K extends keyof T>(obj: T, k1: keyof Dict, k2: keyof T, k3: K) => void
|
||||
>obj : T
|
||||
>k1 : string
|
||||
>k2 : keyof T
|
||||
@@ -435,7 +435,7 @@ type A<T> = { [Q in { [P in keyof T]: P; }[keyof T]]: T[Q]; };
|
||||
>A : A<T>
|
||||
|
||||
type B<T, V> = A<{ [Q in keyof T]: StrictExclude<B<T[Q], V>, {}>; }>;
|
||||
>B : A<{ [Q in keyof T]: StrictExclude<A<{ [Q in keyof T[Q]]: StrictExclude<A<{ [Q in keyof T[Q][Q]]: StrictExclude<A<{ [Q in keyof T[Q][Q][Q]]: StrictExclude<A<{ [Q in keyof T[Q][Q][Q][Q]]: StrictExclude<A<{ [Q in keyof T[Q][Q][Q][Q][Q]]: StrictExclude<A<{ [Q in keyof T[Q][Q][Q][Q][Q][Q]]: StrictExclude<A<{ [Q in keyof T[Q][Q][Q][Q][Q][Q][Q]]: StrictExclude<A<{ [Q in keyof T[Q][Q][Q][Q][Q][Q][Q][Q]]: StrictExclude<A<{ [Q in keyof T[Q][Q][Q][Q][Q][Q][Q][Q][Q]]: StrictExclude<A<{ [Q in keyof T[Q][Q][Q][Q][Q][Q][Q][Q][Q][Q]]: StrictExclude<A<any>, {}>; }>, {}>; }>, {}>; }>, {}>; }>, {}>; }>, {}>; }>, {}>; }>, {}>; }>, {}>; }>, {}>; }>, {}>; }>
|
||||
>B : B<T, V>
|
||||
|
||||
// Repros from #30938
|
||||
|
||||
|
||||
@@ -85,6 +85,6 @@ type Values<T> = T[keyof T];
|
||||
>Values : Values<T>
|
||||
|
||||
type ValuesOfObj = Values<typeof obj>;
|
||||
>ValuesOfObj : Values<{ num: number; str: string; 0: 0; [sym]: symbol; }>
|
||||
>ValuesOfObj : ValuesOfObj
|
||||
>obj : { num: number; str: string; 0: 0; [sym]: symbol; }
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ type T04<T, U> = keyof (T & U); // keyof T | keyof U
|
||||
>T04 : keyof T | keyof U
|
||||
|
||||
type T05 = T02<A>; // "a" | "b"
|
||||
>T05 : "b" | "a"
|
||||
>T05 : T05
|
||||
|
||||
type T06 = T03<B>; // "a" | "b"
|
||||
>T06 : "b" | "a"
|
||||
>T06 : T06
|
||||
|
||||
type T07 = T04<A, B>; // "a" | "b"
|
||||
>T07 : "b" | "a"
|
||||
>T07 : T07
|
||||
|
||||
// Repros from #22291
|
||||
|
||||
@@ -34,7 +34,7 @@ type Example1<T extends string, U extends string> = keyof (Record<T, any> & Reco
|
||||
>Example1 : T | U
|
||||
|
||||
type Result1 = Example1<'x', 'y'>; // "x" | "y"
|
||||
>Result1 : "x" | "y"
|
||||
>Result1 : Result1
|
||||
|
||||
type Result2 = keyof (Record<'x', any> & Record<'y', any>); // "x" | "y"
|
||||
>Result2 : "x" | "y"
|
||||
@@ -55,5 +55,5 @@ type Example5<T, U> = keyof (T & U);
|
||||
>Example5 : keyof T | keyof U
|
||||
|
||||
type Result5 = Example5<Record<'x', any>, Record<'y', any>>; // "x" | "y"
|
||||
>Result5 : "x" | "y"
|
||||
>Result5 : Result5
|
||||
|
||||
|
||||
@@ -443,15 +443,15 @@ function test<T extends { a: string, b: string }>(obj: T): T {
|
||||
|
||||
let { a, ...rest } = obj;
|
||||
>a : string
|
||||
>rest : Pick<T, Exclude<keyof T, "a">>
|
||||
>rest : Omit<T, "a">
|
||||
>obj : T
|
||||
|
||||
return { a: 'hello', ...rest } as T;
|
||||
>{ a: 'hello', ...rest } as T : T
|
||||
>{ a: 'hello', ...rest } : { a: string; } & Pick<T, Exclude<keyof T, "a">>
|
||||
>{ a: 'hello', ...rest } : { a: string; } & Omit<T, "a">
|
||||
>a : string
|
||||
>'hello' : "hello"
|
||||
>rest : Pick<T, Exclude<keyof T, "a">>
|
||||
>rest : Omit<T, "a">
|
||||
}
|
||||
|
||||
// Repro from #32169
|
||||
|
||||
@@ -5,7 +5,7 @@ type Getters<T> = { [P in keyof T & string as `get${Capitalize<P>}`]: () => T[P]
|
||||
>Getters : Getters<T>
|
||||
|
||||
type TG1 = Getters<{ foo: string, bar: number, baz: { z: boolean } }>;
|
||||
>TG1 : Getters<{ foo: string; bar: number; baz: { z: boolean;}; }>
|
||||
>TG1 : TG1
|
||||
>foo : string
|
||||
>bar : number
|
||||
>baz : { z: boolean; }
|
||||
@@ -22,7 +22,7 @@ type TypeFromDefs<T extends PropDef<keyof any, any>> = { [P in T as P['name']]:
|
||||
>TypeFromDefs : TypeFromDefs<T>
|
||||
|
||||
type TP1 = TypeFromDefs<{ name: 'a', type: string } | { name: 'b', type: number } | { name: 'a', type: boolean }>;
|
||||
>TP1 : TypeFromDefs<{ name: 'a'; type: string; } | { name: 'b'; type: number; } | { name: 'a'; type: boolean; }>
|
||||
>TP1 : TP1
|
||||
>name : "a"
|
||||
>type : string
|
||||
>name : "b"
|
||||
@@ -33,10 +33,10 @@ type TP1 = TypeFromDefs<{ name: 'a', type: string } | { name: 'b', type: number
|
||||
// No array or tuple type mapping when 'as N' clause present
|
||||
|
||||
type TA1 = Getters<string[]>;
|
||||
>TA1 : Getters<string[]>
|
||||
>TA1 : TA1
|
||||
|
||||
type TA2 = Getters<[number, boolean]>;
|
||||
>TA2 : Getters<[number, boolean]>
|
||||
>TA2 : TA2
|
||||
|
||||
// Filtering using 'as N' clause
|
||||
|
||||
@@ -56,7 +56,7 @@ type DoubleProp<T> = { [P in keyof T & string as `${P}1` | `${P}2`]: T[P] }
|
||||
>DoubleProp : DoubleProp<T>
|
||||
|
||||
type TD1 = DoubleProp<{ a: string, b: number }>; // { a1: string, a2: string, b1: number, b2: number }
|
||||
>TD1 : DoubleProp<{ a: string; b: number; }>
|
||||
>TD1 : TD1
|
||||
>a : string
|
||||
>b : number
|
||||
|
||||
|
||||
@@ -98,12 +98,12 @@ const modifier = <T extends TargetProps>(targetProps: T) => {
|
||||
|
||||
let {bar, ...rest} = targetProps;
|
||||
>bar : string
|
||||
>rest : Pick<T, Exclude<keyof T, "bar">>
|
||||
>rest : Omit<T, "bar">
|
||||
>targetProps : T
|
||||
|
||||
rest.foo;
|
||||
>rest.foo : T["foo"]
|
||||
>rest : Pick<T, Exclude<keyof T, "bar">>
|
||||
>rest : Omit<T, "bar">
|
||||
>foo : T["foo"]
|
||||
|
||||
};
|
||||
|
||||
@@ -38,28 +38,28 @@ type T02 = { [P in Date]: number }; // Error
|
||||
>T02 : T02
|
||||
|
||||
type T03 = Record<Date, number>; // Error
|
||||
>T03 : Record<Date, number>
|
||||
>T03 : T03
|
||||
|
||||
type T10 = Pick<Shape, "name">;
|
||||
>T10 : Pick<Shape, "name">
|
||||
>T10 : T10
|
||||
|
||||
type T11 = Pick<Shape, "foo">; // Error
|
||||
>T11 : Pick<Shape, "foo">
|
||||
>T11 : T11
|
||||
|
||||
type T12 = Pick<Shape, "name" | "foo">; // Error
|
||||
>T12 : Pick<Shape, "name" | "foo">
|
||||
>T12 : T12
|
||||
|
||||
type T13 = Pick<Shape, keyof Named>;
|
||||
>T13 : Pick<Shape, "name">
|
||||
>T13 : T13
|
||||
|
||||
type T14 = Pick<Shape, keyof Point>; // Error
|
||||
>T14 : Pick<Shape, keyof Point>
|
||||
>T14 : T14
|
||||
|
||||
type T15 = Pick<Shape, never>;
|
||||
>T15 : Pick<Shape, never>
|
||||
>T15 : T15
|
||||
|
||||
type T16 = Pick<Shape, undefined>; // Error
|
||||
>T16 : Pick<Shape, undefined>
|
||||
>T16 : T16
|
||||
|
||||
function f1<T>(x: T) {
|
||||
>f1 : <T>(x: T) => void
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/mappedTypeUnionConstraintInferences.ts ===
|
||||
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
>Omit : Pick<T, Exclude<keyof T, K>>
|
||||
>Omit : Omit<T, K>
|
||||
|
||||
export declare type PartialProperties<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
||||
>PartialProperties : PartialProperties<T, K>
|
||||
|
||||
@@ -106,7 +106,7 @@ declare type B = {
|
||||
declare type C = {
|
||||
c: string;
|
||||
};
|
||||
declare function f1(x: A | B | C | undefined): Boxified<A> | Boxified<B> | Boxified<C> | undefined;
|
||||
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>;
|
||||
|
||||
@@ -61,35 +61,35 @@ type C = { c: string };
|
||||
>c : string
|
||||
|
||||
function f1(x: A | B | C | undefined) {
|
||||
>f1 : (x: A | B | C | undefined) => Boxified<A> | Boxified<B> | Boxified<C> | undefined
|
||||
>f1 : (x: A | B | C | undefined) => Boxified<A | B | C | undefined>
|
||||
>x : A | B | C | undefined
|
||||
|
||||
return boxify(x);
|
||||
>boxify(x) : Boxified<A> | Boxified<B> | Boxified<C> | undefined
|
||||
>boxify(x) : Boxified<A | B | C | undefined>
|
||||
>boxify : <T>(obj: T) => Boxified<T>
|
||||
>x : A | B | C | undefined
|
||||
}
|
||||
|
||||
type T00 = Partial<A | B | C>;
|
||||
>T00 : Partial<A> | Partial<B> | Partial<C>
|
||||
>T00 : T00
|
||||
|
||||
type T01 = Readonly<A | B | C | null | undefined>;
|
||||
>T01 : Readonly<A> | Readonly<B> | Readonly<C> | null | undefined
|
||||
>T01 : T01
|
||||
>null : null
|
||||
|
||||
type T02 = Boxified<A | B[] | C | string>
|
||||
>T02 : string | Boxified<A> | Boxified<C> | Box<B>[]
|
||||
>T02 : T02
|
||||
|
||||
type T03 = Readonly<string | number | boolean | null | undefined | void>;
|
||||
>T03 : string | number | boolean | void | null | undefined
|
||||
>T03 : T03
|
||||
>null : null
|
||||
|
||||
type T04 = Boxified<string | number | boolean | null | undefined | void>;
|
||||
>T04 : string | number | boolean | void | null | undefined
|
||||
>T04 : T04
|
||||
>null : null
|
||||
|
||||
type T05 = Partial<"hello" | "world" | 42>;
|
||||
>T05 : "hello" | "world" | 42
|
||||
>T05 : T05
|
||||
|
||||
type BoxifiedWithSentinel<T, U> = {
|
||||
>BoxifiedWithSentinel : BoxifiedWithSentinel<T, U>
|
||||
@@ -98,11 +98,11 @@ type BoxifiedWithSentinel<T, U> = {
|
||||
}
|
||||
|
||||
type T10 = BoxifiedWithSentinel<A | B | C, null>;
|
||||
>T10 : BoxifiedWithSentinel<A, null> | BoxifiedWithSentinel<B, null> | BoxifiedWithSentinel<C, null>
|
||||
>T10 : T10
|
||||
>null : null
|
||||
|
||||
type T11 = BoxifiedWithSentinel<A | B | C, undefined>;
|
||||
>T11 : BoxifiedWithSentinel<A, undefined> | BoxifiedWithSentinel<B, undefined> | BoxifiedWithSentinel<C, undefined>
|
||||
>T11 : T11
|
||||
|
||||
type T12 = BoxifiedWithSentinel<string, undefined>;
|
||||
>T12 : string
|
||||
|
||||
@@ -66,7 +66,7 @@ type B = { b: string };
|
||||
>b : string
|
||||
|
||||
type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
|
||||
>T40 : string | Box<string>[] | Boxified<A> | readonly Box<A>[] | [Box<A>, Box<B>] | Box<A>[]
|
||||
>T40 : T40
|
||||
|
||||
type ReadWrite<T> = { -readonly [P in keyof T] : T[P] };
|
||||
>ReadWrite : ReadWrite<T>
|
||||
@@ -229,7 +229,7 @@ type Mapped<T> = { [K in keyof T]: T[K] };
|
||||
>Mapped : Mapped<T>
|
||||
|
||||
type F<T> = ElementType<Mapped<T>>;
|
||||
>F : ElementType<Mapped<T>>
|
||||
>F : F<T>
|
||||
|
||||
type R1 = F<[string, number, boolean]>; // string | number | boolean
|
||||
>R1 : string | number | boolean
|
||||
@@ -262,13 +262,13 @@ function acceptMappedArray<T extends any[]>(arr: T) {
|
||||
// Repro from #26163
|
||||
|
||||
type Unconstrained<T> = ElementType<Mapped<T>>;
|
||||
>Unconstrained : ElementType<Mapped<T>>
|
||||
>Unconstrained : Unconstrained<T>
|
||||
|
||||
type T1 = Unconstrained<[string, number, boolean]>; // string | number | boolean
|
||||
>T1 : string | number | boolean
|
||||
|
||||
type Constrained<T extends any[]> = ElementType<Mapped<T>>;
|
||||
>Constrained : ElementType<Mapped<T>>
|
||||
>Constrained : Constrained<T>
|
||||
|
||||
type T2 = Constrained<[string, number, boolean]>; // string | number | boolean
|
||||
>T2 : string | number | boolean
|
||||
|
||||
@@ -112,7 +112,7 @@ export function useState<T>(initial: T): [value: T, setter: (T) => void] {
|
||||
|
||||
|
||||
export type Iter = Func<[step: number, iterations: number]>;
|
||||
>Iter : Func<[step: number, iterations: number]>
|
||||
>Iter : Iter
|
||||
|
||||
export function readSegment([length, count]: [number, number]) {}
|
||||
>readSegment : ([length, count]: [number, number]) => void
|
||||
|
||||
@@ -36,18 +36,18 @@ function stillMustBeLast({ ...mustBeLast, a }: { a: number, b: string }): void {
|
||||
>b : string
|
||||
}
|
||||
function generic<T extends { x, y }>(t: T) {
|
||||
>generic : <T extends { x: any; y: any; }>(t: T) => Pick<T, Exclude<keyof T, "x">>
|
||||
>generic : <T extends { x: any; y: any; }>(t: T) => Omit<T, "x">
|
||||
>x : any
|
||||
>y : any
|
||||
>t : T
|
||||
|
||||
let { x, ...rest } = t;
|
||||
>x : any
|
||||
>rest : Pick<T, Exclude<keyof T, "x">>
|
||||
>rest : Omit<T, "x">
|
||||
>t : T
|
||||
|
||||
return rest;
|
||||
>rest : Pick<T, Exclude<keyof T, "x">>
|
||||
>rest : Omit<T, "x">
|
||||
}
|
||||
|
||||
let rest: { b: string }
|
||||
|
||||
@@ -17,55 +17,55 @@ type A = {
|
||||
};
|
||||
|
||||
type B = Omit<A, 'a'>;
|
||||
>B : Pick<A, "b" | "c" | "d">
|
||||
>B : B
|
||||
|
||||
function f(x: B) {
|
||||
>f : (x: B) => void
|
||||
>x : Pick<A, "b" | "c" | "d">
|
||||
>x : B
|
||||
|
||||
const b = x.b;
|
||||
>b : string | undefined
|
||||
>x.b : string | undefined
|
||||
>x : Pick<A, "b" | "c" | "d">
|
||||
>x : B
|
||||
>b : string | undefined
|
||||
|
||||
x.b = "hello";
|
||||
>x.b = "hello" : "hello"
|
||||
>x.b : string | undefined
|
||||
>x : Pick<A, "b" | "c" | "d">
|
||||
>x : B
|
||||
>b : string | undefined
|
||||
>"hello" : "hello"
|
||||
|
||||
x.b = undefined;
|
||||
>x.b = undefined : undefined
|
||||
>x.b : string | undefined
|
||||
>x : Pick<A, "b" | "c" | "d">
|
||||
>x : B
|
||||
>b : string | undefined
|
||||
>undefined : undefined
|
||||
|
||||
const c = x.c;
|
||||
>c : boolean
|
||||
>x.c : boolean
|
||||
>x : Pick<A, "b" | "c" | "d">
|
||||
>x : B
|
||||
>c : boolean
|
||||
|
||||
x.c = true;
|
||||
>x.c = true : true
|
||||
>x.c : any
|
||||
>x : Pick<A, "b" | "c" | "d">
|
||||
>x : B
|
||||
>c : any
|
||||
>true : true
|
||||
|
||||
const d = x.d;
|
||||
>d : unknown
|
||||
>x.d : unknown
|
||||
>x : Pick<A, "b" | "c" | "d">
|
||||
>x : B
|
||||
>d : unknown
|
||||
|
||||
x.d = d;
|
||||
>x.d = d : unknown
|
||||
>x.d : unknown
|
||||
>x : Pick<A, "b" | "c" | "d">
|
||||
>x : B
|
||||
>d : unknown
|
||||
>d : unknown
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/omitTypeTestErrors01.ts(11,16): error TS2339: Property 'c' does not exist on type 'Pick<Foo, "a" | "b">'.
|
||||
tests/cases/compiler/omitTypeTestErrors01.ts(15,16): error TS2339: Property 'b' does not exist on type 'Pick<Foo, "a">'.
|
||||
tests/cases/compiler/omitTypeTestErrors01.ts(11,16): error TS2339: Property 'c' does not exist on type 'Bar'.
|
||||
tests/cases/compiler/omitTypeTestErrors01.ts(15,16): error TS2339: Property 'b' does not exist on type 'Baz'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/omitTypeTestErrors01.ts (2 errors) ====
|
||||
@@ -15,13 +15,13 @@ tests/cases/compiler/omitTypeTestErrors01.ts(15,16): error TS2339: Property 'b'
|
||||
export function getBarC(bar: Bar) {
|
||||
return bar.c;
|
||||
~
|
||||
!!! error TS2339: Property 'c' does not exist on type 'Pick<Foo, "a" | "b">'.
|
||||
!!! error TS2339: Property 'c' does not exist on type 'Bar'.
|
||||
}
|
||||
|
||||
export function getBazB(baz: Baz) {
|
||||
return baz.b;
|
||||
~
|
||||
!!! error TS2339: Property 'b' does not exist on type 'Pick<Foo, "a">'.
|
||||
!!! error TS2339: Property 'b' does not exist on type 'Baz'.
|
||||
}
|
||||
|
||||
|
||||
@@ -11,28 +11,28 @@ interface Foo {
|
||||
}
|
||||
|
||||
export type Bar = Omit<Foo, "c">;
|
||||
>Bar : Pick<Foo, "a" | "b">
|
||||
>Bar : Bar
|
||||
|
||||
export type Baz = Omit<Foo, "b" | "c">;
|
||||
>Baz : Pick<Foo, "a">
|
||||
>Baz : Baz
|
||||
|
||||
export function getBarC(bar: Bar) {
|
||||
>getBarC : (bar: Bar) => any
|
||||
>bar : Pick<Foo, "a" | "b">
|
||||
>bar : Bar
|
||||
|
||||
return bar.c;
|
||||
>bar.c : any
|
||||
>bar : Pick<Foo, "a" | "b">
|
||||
>bar : Bar
|
||||
>c : any
|
||||
}
|
||||
|
||||
export function getBazB(baz: Baz) {
|
||||
>getBazB : (baz: Baz) => any
|
||||
>baz : Pick<Foo, "a">
|
||||
>baz : Baz
|
||||
|
||||
return baz.b;
|
||||
>baz.b : any
|
||||
>baz : Pick<Foo, "a">
|
||||
>baz : Baz
|
||||
>b : any
|
||||
}
|
||||
|
||||
|
||||
@@ -11,28 +11,28 @@ interface Foo {
|
||||
}
|
||||
|
||||
export type Bar = Omit<Foo, "c">;
|
||||
>Bar : Pick<Foo, "a" | "b">
|
||||
>Bar : Bar
|
||||
|
||||
export type Baz = Omit<Foo, "b" | "c">;
|
||||
>Baz : Pick<Foo, "a">
|
||||
>Baz : Baz
|
||||
|
||||
export function getBarA(bar: Bar) {
|
||||
>getBarA : (bar: Bar) => string
|
||||
>bar : Pick<Foo, "a" | "b">
|
||||
>bar : Bar
|
||||
|
||||
return bar.a;
|
||||
>bar.a : string
|
||||
>bar : Pick<Foo, "a" | "b">
|
||||
>bar : Bar
|
||||
>a : string
|
||||
}
|
||||
|
||||
export function getBazA(baz: Baz) {
|
||||
>getBazA : (baz: Baz) => string
|
||||
>baz : Pick<Foo, "a">
|
||||
>baz : Baz
|
||||
|
||||
return baz.a;
|
||||
>baz.a : string
|
||||
>baz : Pick<Foo, "a">
|
||||
>baz : Baz
|
||||
>a : string
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export type RequiredKeys<V> = { [K in keyof V]-?: Exclude<V[K], undefined> exten
|
||||
>true : true
|
||||
|
||||
export type OptionalKeys<V> = Exclude<keyof V, RequiredKeys<V>>;
|
||||
>OptionalKeys : Exclude<keyof V, RequiredKeys<V>>
|
||||
>OptionalKeys : OptionalKeys<V>
|
||||
|
||||
export type InferPropsInner<V> = { [K in keyof V]-?: InferType<V[K]>; };
|
||||
>InferPropsInner : InferPropsInner<V>
|
||||
@@ -275,12 +275,12 @@ const propTypesWithoutAnnotation = {
|
||||
};
|
||||
|
||||
type ExtractedProps = PropTypes.InferProps<typeof propTypes>;
|
||||
>ExtractedProps : PropTypes.InferProps<PropTypes.ValidationMap<Props>>
|
||||
>ExtractedProps : ExtractedProps
|
||||
>PropTypes : any
|
||||
>propTypes : PropTypes.ValidationMap<Props>
|
||||
|
||||
type ExtractedPropsWithoutAnnotation = PropTypes.InferProps<typeof propTypesWithoutAnnotation>;
|
||||
>ExtractedPropsWithoutAnnotation : PropTypes.InferProps<{ any: PropTypes.Requireable<any>; array: PropTypes.Validator<any[]>; bool: PropTypes.Validator<boolean>; shape: PropTypes.Validator<PropTypes.InferProps<{ foo: PropTypes.Validator<string>; bar: PropTypes.Requireable<boolean>; baz: PropTypes.Requireable<any>; }>>; oneOfType: PropTypes.Validator<string | boolean | PropTypes.InferProps<{ foo: PropTypes.Requireable<string>; bar: PropTypes.Validator<number>; }>>; }>
|
||||
>ExtractedPropsWithoutAnnotation : ExtractedPropsWithoutAnnotation
|
||||
>PropTypes : any
|
||||
>propTypesWithoutAnnotation : { any: PropTypes.Requireable<any>; array: PropTypes.Validator<any[]>; bool: PropTypes.Validator<boolean>; shape: PropTypes.Validator<PropTypes.InferProps<{ foo: PropTypes.Validator<string>; bar: PropTypes.Requireable<boolean>; baz: PropTypes.Requireable<any>; }>>; oneOfType: PropTypes.Validator<string | boolean | PropTypes.InferProps<{ foo: PropTypes.Requireable<string>; bar: PropTypes.Validator<number>; }>>; }
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ declare namespace Tools {
|
||||
>Cast : Cast<X, Y>
|
||||
|
||||
type Pos<I extends any[]> =
|
||||
>Pos : Length<I>
|
||||
>Pos : Pos<I>
|
||||
|
||||
Length<I>;
|
||||
|
||||
@@ -93,7 +93,7 @@ declare namespace Tools {
|
||||
Prepend<any, I>;
|
||||
|
||||
type Prev<I extends any[]> =
|
||||
>Prev : Tail<I>
|
||||
>Prev : Prev<I>
|
||||
|
||||
Tail<I>;
|
||||
|
||||
@@ -116,7 +116,7 @@ declare namespace Tools {
|
||||
>Reverse : Reverse<T, R, I>
|
||||
|
||||
0: Reverse<T, Prepend<T[Pos<I>], R>, Next<I>>;
|
||||
>0 : Reverse<T, [head: T[Length<I>], ...args: R], [head: any, ...args: I]>
|
||||
>0 : Reverse<T, [head: T[Pos<I>], ...args: R], [head: any, ...args: I]>
|
||||
|
||||
1: R;
|
||||
>1 : R
|
||||
@@ -128,12 +128,12 @@ declare namespace Tools {
|
||||
];
|
||||
|
||||
type Concat<T1 extends any[], T2 extends any[]> =
|
||||
>Concat : Reverse<Reverse<T1, [], []> extends infer R ? Cast<R, any[]> : never, T2, []>
|
||||
>Concat : Concat<T1, T2>
|
||||
|
||||
Reverse<Reverse<T1> extends infer R ? Cast<R, any[]> : never, T2>;
|
||||
|
||||
type Append<E, T extends any[]> =
|
||||
>Append : Reverse<Reverse<T, [], []> extends infer R ? Cast<R, any[]> : never, [E], []>
|
||||
>Append : Append<E, T>
|
||||
|
||||
Concat<T, [E]>;
|
||||
|
||||
@@ -168,7 +168,7 @@ declare namespace Curry {
|
||||
>Tools : any
|
||||
|
||||
1: Tools.Concat<TN, Tools.Drop<Tools.Pos<I>, T2> extends infer D ? Tools.Cast<D, any[]> : never>;
|
||||
>1 : Tools.Reverse<Tools.Reverse<TN, [], []> extends infer R ? Tools.Cast<R, any[]> : never, Tools.Drop<Tools.Length<I>, T2, []> extends infer D ? Tools.Cast<D, any[]> : never, []>
|
||||
>1 : Tools.Concat<TN, Tools.Drop<Tools.Pos<I>, T2, []> extends infer D ? Tools.Cast<D, any[]> : never>
|
||||
>Tools : any
|
||||
>Tools : any
|
||||
>Tools : any
|
||||
|
||||
@@ -128,7 +128,7 @@ type Matching<InjectedProps, DecorationTargetProps> = {
|
||||
};
|
||||
|
||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
>Omit : Pick<T, Exclude<keyof T, K>>
|
||||
>Omit : Omit<T, K>
|
||||
|
||||
type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> = <
|
||||
>InferableComponentEnhancerWithProps : InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps>
|
||||
@@ -272,8 +272,8 @@ type Q = HandleThunkActionCreator<typeof simpleAction>;
|
||||
>simpleAction : (payload: boolean) => { type: string; payload: boolean; }
|
||||
|
||||
const Test1 = connect(
|
||||
>Test1 : ConnectedComponentClass<typeof TestComponent, Pick<TestComponentProps, "foo">>
|
||||
>connect( null, mapDispatchToProps)(TestComponent) : ConnectedComponentClass<typeof TestComponent, Pick<TestComponentProps, "foo">>
|
||||
>Test1 : ConnectedComponentClass<typeof TestComponent, Omit<TestComponentProps, "simpleAction" | "thunkAction">>
|
||||
>connect( null, mapDispatchToProps)(TestComponent) : ConnectedComponentClass<typeof TestComponent, Omit<TestComponentProps, "simpleAction" | "thunkAction">>
|
||||
>connect( null, mapDispatchToProps) : InferableComponentEnhancerWithProps<{ simpleAction: (payload: boolean) => { type: string; payload: boolean; }; thunkAction: (param1: number, param2: string) => Promise<string>; }, {}>
|
||||
>connect : <no_state = {}, TDispatchProps = {}, TOwnProps = {}>(mapStateToProps: null | undefined, mapDispatchToProps: TDispatchProps) => InferableComponentEnhancerWithProps<ResolveThunks<TDispatchProps>, TOwnProps>
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ type B0 = Flatten<string[][][]>;
|
||||
>B0 : string[]
|
||||
|
||||
type B1 = Flatten<string[][] | readonly (number[] | boolean[][])[]>;
|
||||
>B1 : string[] | readonly (number | boolean)[]
|
||||
>B1 : B1
|
||||
|
||||
type B2 = Flatten<InfiniteArray<string>>;
|
||||
>B2 : any[]
|
||||
@@ -96,7 +96,7 @@ type TT0 = TupleOf<string, 4>;
|
||||
>TT0 : [string, string, string, string]
|
||||
|
||||
type TT1 = TupleOf<number, 0 | 2 | 4>;
|
||||
>TT1 : [] | [number, number] | [number, number, number, number]
|
||||
>TT1 : TT1
|
||||
|
||||
type TT2 = TupleOf<number, number>;
|
||||
>TT2 : number[]
|
||||
|
||||
@@ -8,7 +8,7 @@ declare module Test1 {
|
||||
|
||||
};
|
||||
export type IStringContainer = Container<string>;
|
||||
>IStringContainer : Container<string>
|
||||
>IStringContainer : IStringContainer
|
||||
}
|
||||
|
||||
declare module Test2 {
|
||||
@@ -20,7 +20,7 @@ declare module Test2 {
|
||||
|
||||
};
|
||||
export type IStringContainer = Container<string>;
|
||||
>IStringContainer : Container<string>
|
||||
>IStringContainer : IStringContainer
|
||||
}
|
||||
|
||||
var x: Test1.Container<number>;
|
||||
@@ -28,20 +28,20 @@ var x: Test1.Container<number>;
|
||||
>Test1 : any
|
||||
|
||||
var s1: Test1.IStringContainer;
|
||||
>s1 : Test1.Container<string>
|
||||
>s1 : Test1.IStringContainer
|
||||
>Test1 : any
|
||||
|
||||
var s2: Test2.IStringContainer;
|
||||
>s2 : Test2.Container<string>
|
||||
>s2 : Test2.IStringContainer
|
||||
>Test2 : any
|
||||
|
||||
s1 = s2;
|
||||
>s1 = s2 : Test2.Container<string>
|
||||
>s1 : Test1.Container<string>
|
||||
>s2 : Test2.Container<string>
|
||||
>s1 = s2 : Test2.IStringContainer
|
||||
>s1 : Test1.IStringContainer
|
||||
>s2 : Test2.IStringContainer
|
||||
|
||||
s2 = s1;
|
||||
>s2 = s1 : Test1.Container<string>
|
||||
>s2 : Test2.Container<string>
|
||||
>s1 : Test1.Container<string>
|
||||
>s2 = s1 : Test1.IStringContainer
|
||||
>s2 : Test2.IStringContainer
|
||||
>s1 : Test1.IStringContainer
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ declare module Test1 {
|
||||
|
||||
};
|
||||
export type IStringContainer = Container<string>;
|
||||
>IStringContainer : Container<string>
|
||||
>IStringContainer : IStringContainer
|
||||
}
|
||||
|
||||
declare module Test2 {
|
||||
@@ -20,7 +20,7 @@ declare module Test2 {
|
||||
|
||||
};
|
||||
export type IStringContainer = Container<string>;
|
||||
>IStringContainer : Container<string>
|
||||
>IStringContainer : IStringContainer
|
||||
}
|
||||
|
||||
var x: Test1.Container<number>;
|
||||
@@ -28,20 +28,20 @@ var x: Test1.Container<number>;
|
||||
>Test1 : any
|
||||
|
||||
var s1: Test1.IStringContainer;
|
||||
>s1 : Test1.Container<string>
|
||||
>s1 : Test1.IStringContainer
|
||||
>Test1 : any
|
||||
|
||||
var s2: Test2.IStringContainer;
|
||||
>s2 : Test2.Container<string>
|
||||
>s2 : Test2.IStringContainer
|
||||
>Test2 : any
|
||||
|
||||
s1 = s2;
|
||||
>s1 = s2 : Test2.Container<string>
|
||||
>s1 : Test1.Container<string>
|
||||
>s2 : Test2.Container<string>
|
||||
>s1 = s2 : Test2.IStringContainer
|
||||
>s1 : Test1.IStringContainer
|
||||
>s2 : Test2.IStringContainer
|
||||
|
||||
s2 = s1;
|
||||
>s2 = s1 : Test1.Container<string>
|
||||
>s2 : Test2.Container<string>
|
||||
>s1 : Test1.Container<string>
|
||||
>s2 = s1 : Test1.IStringContainer
|
||||
>s2 : Test2.IStringContainer
|
||||
>s1 : Test1.IStringContainer
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ declare var product: Transform<Product>;
|
||||
>product : Transform<Product>
|
||||
|
||||
product.users; // (Transform<User> | Transform<Guest>)[]
|
||||
>product.users : (Transform<User> | Transform<Guest>)[]
|
||||
>product.users : Transform<User | Guest>[]
|
||||
>product : Transform<Product>
|
||||
>users : (Transform<User> | Transform<Guest>)[]
|
||||
>users : Transform<User | Guest>[]
|
||||
|
||||
// Repro from #29702
|
||||
|
||||
@@ -123,14 +123,14 @@ export interface ListWidget {
|
||||
}
|
||||
|
||||
type ListChild = Child<ListWidget>
|
||||
>ListChild : Child<ListWidget>
|
||||
>ListChild : ListChild
|
||||
|
||||
declare let x: ListChild;
|
||||
>x : Child<ListWidget>
|
||||
>x : ListChild
|
||||
|
||||
x.type;
|
||||
>x.type : any
|
||||
>x : Child<ListWidget>
|
||||
>x : ListChild
|
||||
>type : any
|
||||
|
||||
// Repros from #41790
|
||||
|
||||
@@ -5,7 +5,7 @@ export type Prop<T> = { (): T }
|
||||
>Prop : Prop<T>
|
||||
|
||||
export type PropType<T> = Prop<T>;
|
||||
>PropType : Prop<T>
|
||||
>PropType : PropType<T>
|
||||
|
||||
export type PropDefaultValue<T> = T;
|
||||
>PropDefaultValue : T
|
||||
@@ -16,14 +16,14 @@ export type PropValidatorFunction<T> = (value: T) => boolean;
|
||||
>value : T
|
||||
|
||||
export type PropValidator<T> = PropOptions<T>;
|
||||
>PropValidator : PropOptions<T>
|
||||
>PropValidator : PropValidator<T>
|
||||
|
||||
|
||||
export type PropOptions<T> = {
|
||||
>PropOptions : PropOptions<T>
|
||||
|
||||
type: PropType<T>;
|
||||
>type : Prop<T>
|
||||
>type : PropType<T>
|
||||
|
||||
value?: PropDefaultValue<T>,
|
||||
>value : T | undefined
|
||||
@@ -58,19 +58,19 @@ const r = extend({
|
||||
>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }>
|
||||
>extend({ props: { notResolved: { type: Object as PropType<MyType>, validator: x => { return x.valid; } }, explicit: { type: Object as PropType<MyType>, validator: (x: MyType) => { return x.valid; } } }}) : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }>
|
||||
>extend : <T>({ props }: { props: RecordPropsDefinition<T>; }) => RecordPropsDefinition<T>
|
||||
>{ props: { notResolved: { type: Object as PropType<MyType>, validator: x => { return x.valid; } }, explicit: { type: Object as PropType<MyType>, validator: (x: MyType) => { return x.valid; } } }} : { props: { notResolved: { type: Prop<MyType>; validator: (x: MyType) => boolean; }; explicit: { type: Prop<MyType>; validator: (x: MyType) => boolean; }; }; }
|
||||
>{ props: { notResolved: { type: Object as PropType<MyType>, validator: x => { return x.valid; } }, explicit: { type: Object as PropType<MyType>, validator: (x: MyType) => { return x.valid; } } }} : { props: { notResolved: { type: PropType<MyType>; validator: (x: MyType) => boolean; }; explicit: { type: PropType<MyType>; validator: (x: MyType) => boolean; }; }; }
|
||||
|
||||
props: {
|
||||
>props : { notResolved: { type: Prop<MyType>; validator: (x: MyType) => boolean; }; explicit: { type: Prop<MyType>; validator: (x: MyType) => boolean; }; }
|
||||
>{ notResolved: { type: Object as PropType<MyType>, validator: x => { return x.valid; } }, explicit: { type: Object as PropType<MyType>, validator: (x: MyType) => { return x.valid; } } } : { notResolved: { type: Prop<MyType>; validator: (x: MyType) => boolean; }; explicit: { type: Prop<MyType>; validator: (x: MyType) => boolean; }; }
|
||||
>props : { notResolved: { type: PropType<MyType>; validator: (x: MyType) => boolean; }; explicit: { type: PropType<MyType>; validator: (x: MyType) => boolean; }; }
|
||||
>{ notResolved: { type: Object as PropType<MyType>, validator: x => { return x.valid; } }, explicit: { type: Object as PropType<MyType>, validator: (x: MyType) => { return x.valid; } } } : { notResolved: { type: PropType<MyType>; validator: (x: MyType) => boolean; }; explicit: { type: PropType<MyType>; validator: (x: MyType) => boolean; }; }
|
||||
|
||||
notResolved: {
|
||||
>notResolved : { type: Prop<MyType>; validator: (x: MyType) => boolean; }
|
||||
>{ type: Object as PropType<MyType>, validator: x => { return x.valid; } } : { type: Prop<MyType>; validator: (x: MyType) => boolean; }
|
||||
>notResolved : { type: PropType<MyType>; validator: (x: MyType) => boolean; }
|
||||
>{ type: Object as PropType<MyType>, validator: x => { return x.valid; } } : { type: PropType<MyType>; validator: (x: MyType) => boolean; }
|
||||
|
||||
type: Object as PropType<MyType>,
|
||||
>type : Prop<MyType>
|
||||
>Object as PropType<MyType> : Prop<MyType>
|
||||
>type : PropType<MyType>
|
||||
>Object as PropType<MyType> : PropType<MyType>
|
||||
>Object : ObjectConstructor
|
||||
|
||||
validator: x => {
|
||||
@@ -85,12 +85,12 @@ const r = extend({
|
||||
}
|
||||
},
|
||||
explicit: {
|
||||
>explicit : { type: Prop<MyType>; validator: (x: MyType) => boolean; }
|
||||
>{ type: Object as PropType<MyType>, validator: (x: MyType) => { return x.valid; } } : { type: Prop<MyType>; validator: (x: MyType) => boolean; }
|
||||
>explicit : { type: PropType<MyType>; validator: (x: MyType) => boolean; }
|
||||
>{ type: Object as PropType<MyType>, validator: (x: MyType) => { return x.valid; } } : { type: PropType<MyType>; validator: (x: MyType) => boolean; }
|
||||
|
||||
type: Object as PropType<MyType>,
|
||||
>type : Prop<MyType>
|
||||
>Object as PropType<MyType> : Prop<MyType>
|
||||
>type : PropType<MyType>
|
||||
>Object as PropType<MyType> : PropType<MyType>
|
||||
>Object : ObjectConstructor
|
||||
|
||||
validator: (x: MyType) => {
|
||||
@@ -108,27 +108,27 @@ const r = extend({
|
||||
})
|
||||
|
||||
r.explicit
|
||||
>r.explicit : PropOptions<MyType>
|
||||
>r.explicit : PropValidator<MyType>
|
||||
>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }>
|
||||
>explicit : PropOptions<MyType>
|
||||
>explicit : PropValidator<MyType>
|
||||
|
||||
r.notResolved
|
||||
>r.notResolved : PropOptions<MyType>
|
||||
>r.notResolved : PropValidator<MyType>
|
||||
>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }>
|
||||
>notResolved : PropOptions<MyType>
|
||||
>notResolved : PropValidator<MyType>
|
||||
|
||||
r.explicit.required
|
||||
>r.explicit.required : boolean | undefined
|
||||
>r.explicit : PropOptions<MyType>
|
||||
>r.explicit : PropValidator<MyType>
|
||||
>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }>
|
||||
>explicit : PropOptions<MyType>
|
||||
>explicit : PropValidator<MyType>
|
||||
>required : boolean | undefined
|
||||
|
||||
r.notResolved.required
|
||||
>r.notResolved.required : boolean | undefined
|
||||
>r.notResolved : PropOptions<MyType>
|
||||
>r.notResolved : PropValidator<MyType>
|
||||
>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }>
|
||||
>notResolved : PropOptions<MyType>
|
||||
>notResolved : PropValidator<MyType>
|
||||
>required : boolean | undefined
|
||||
|
||||
// Modified repro from #30505
|
||||
|
||||
+3
-3
@@ -6,15 +6,15 @@ type BugHelper<T, TAll> = T extends any ? Exclude<UnionKeys<TAll>, keyof T> : ne
|
||||
>BugHelper : BugHelper<T, TAll>
|
||||
|
||||
type Bug<TAll> = BugHelper<TAll, TAll>
|
||||
>Bug : BugHelper<TAll, TAll>
|
||||
>Bug : Bug<TAll>
|
||||
|
||||
type Q = UnionKeys<{ a : any } | { b: any }> // should be "a" | "b"
|
||||
>Q : "a" | "b"
|
||||
>Q : Q
|
||||
>a : any
|
||||
>b : any
|
||||
|
||||
type R = Bug<{ a : any } | { b: any }> // should be "a" | "b"
|
||||
>R : "a" | "b"
|
||||
>R : R
|
||||
>a : any
|
||||
>b : any
|
||||
|
||||
|
||||
@@ -81,5 +81,6 @@ export * from "./src/bindingkey";
|
||||
import { Constructor } from "@loopback/context";
|
||||
export declare type ControllerClass = Constructor<any>;
|
||||
//// [usage.d.ts]
|
||||
import { ControllerClass } from './application';
|
||||
import { BindingKey } from '@loopback/context';
|
||||
export declare const CONTROLLER_CLASS: BindingKey<import("@loopback/context").Constructor<any>>;
|
||||
export declare const CONTROLLER_CLASS: BindingKey<ControllerClass>;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Constructor } from "@loopback/context";
|
||||
>Constructor : any
|
||||
|
||||
export type ControllerClass = Constructor<any>;
|
||||
>ControllerClass : Constructor<any>
|
||||
>ControllerClass : ControllerClass
|
||||
|
||||
=== tests/cases/compiler/monorepo/core/src/usage.ts ===
|
||||
import { ControllerClass } from './application';
|
||||
@@ -13,8 +13,8 @@ import { BindingKey } from '@loopback/context';
|
||||
>BindingKey : typeof BindingKey
|
||||
|
||||
export const CONTROLLER_CLASS = BindingKey.create<ControllerClass>(null as any); // line in question
|
||||
>CONTROLLER_CLASS : BindingKey<import("tests/cases/compiler/monorepo/context/index").Constructor<any>>
|
||||
>BindingKey.create<ControllerClass>(null as any) : BindingKey<import("tests/cases/compiler/monorepo/context/index").Constructor<any>>
|
||||
>CONTROLLER_CLASS : BindingKey<ControllerClass>
|
||||
>BindingKey.create<ControllerClass>(null as any) : BindingKey<ControllerClass>
|
||||
>BindingKey.create : <T extends import("tests/cases/compiler/monorepo/context/index").Constructor<any>>(ctor: T) => BindingKey<T>
|
||||
>BindingKey : typeof BindingKey
|
||||
>create : <T extends import("tests/cases/compiler/monorepo/context/index").Constructor<any>>(ctor: T) => BindingKey<T>
|
||||
|
||||
@@ -39,5 +39,6 @@ exports.CONTROLLER_CLASS = context_1.BindingKey.create(null); // line in questio
|
||||
import { Constructor } from "@loopback/context";
|
||||
export declare type ControllerClass = Constructor<any>;
|
||||
//// [usage.d.ts]
|
||||
import { ControllerClass } from './application';
|
||||
import { BindingKey } from '@loopback/context';
|
||||
export declare const CONTROLLER_CLASS: BindingKey<import("@loopback/context").Constructor<any>>;
|
||||
export declare const CONTROLLER_CLASS: BindingKey<ControllerClass>;
|
||||
|
||||
@@ -27,7 +27,7 @@ import { Constructor } from "@loopback/context";
|
||||
>Constructor : any
|
||||
|
||||
export type ControllerClass = Constructor<any>;
|
||||
>ControllerClass : Constructor<any>
|
||||
>ControllerClass : ControllerClass
|
||||
|
||||
=== tests/cases/compiler/monorepo/core/src/usage.ts ===
|
||||
import { ControllerClass } from './application';
|
||||
@@ -37,8 +37,8 @@ import { BindingKey } from '@loopback/context';
|
||||
>BindingKey : typeof BindingKey
|
||||
|
||||
export const CONTROLLER_CLASS = BindingKey.create<ControllerClass>(null as any); // line in question
|
||||
>CONTROLLER_CLASS : BindingKey<import("tests/cases/compiler/monorepo/context/index").Constructor<any>>
|
||||
>BindingKey.create<ControllerClass>(null as any) : BindingKey<import("tests/cases/compiler/monorepo/context/index").Constructor<any>>
|
||||
>CONTROLLER_CLASS : BindingKey<ControllerClass>
|
||||
>BindingKey.create<ControllerClass>(null as any) : BindingKey<ControllerClass>
|
||||
>BindingKey.create : <T extends import("tests/cases/compiler/monorepo/context/index").Constructor<any>>(ctor: T) => BindingKey<T>
|
||||
>BindingKey : typeof BindingKey
|
||||
>create : <T extends import("tests/cases/compiler/monorepo/context/index").Constructor<any>>(ctor: T) => BindingKey<T>
|
||||
|
||||
+6
-2
@@ -90,8 +90,9 @@ exports.__esModule = true;
|
||||
|
||||
|
||||
//// [/src/solution/lib/src/subProject2/index.d.ts]
|
||||
import { MyNominal } from '../subProject/index';
|
||||
declare const variable: {
|
||||
key: globalThis.MyNominal<string, "MyNominal">;
|
||||
key: MyNominal;
|
||||
};
|
||||
export declare function getVar(): keyof typeof variable;
|
||||
export {};
|
||||
@@ -136,7 +137,7 @@ exports.getVar = getVar;
|
||||
},
|
||||
"../src/subproject2/index.ts": {
|
||||
"version": "2747033208-import { MyNominal } from '../subProject/index';\nconst variable = {\n key: 'value' as MyNominal,\n};\nexport function getVar(): keyof typeof variable {\n return 'key';\n}",
|
||||
"signature": "-448645961-declare const variable: {\r\n key: globalThis.MyNominal<string, \"MyNominal\">;\r\n};\r\nexport declare function getVar(): keyof typeof variable;\r\nexport {};\r\n",
|
||||
"signature": "-5370006151-import { MyNominal } from '../subProject/index';\r\ndeclare const variable: {\r\n key: MyNominal;\r\n};\r\nexport declare function getVar(): keyof typeof variable;\r\nexport {};\r\n",
|
||||
"affectsGlobalScope": false
|
||||
}
|
||||
},
|
||||
@@ -160,6 +161,9 @@ exports.getVar = getVar;
|
||||
"exportedModulesMap": {
|
||||
"../src/subproject/index.ts": [
|
||||
"../src/common/nominal.ts"
|
||||
],
|
||||
"../src/subproject2/index.ts": [
|
||||
"../src/subproject/index.ts"
|
||||
]
|
||||
},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
|
||||
+6
-2
@@ -200,8 +200,9 @@ exports.__esModule = true;
|
||||
}
|
||||
|
||||
//// [/src/solution/lib/src/subProject2/index.d.ts]
|
||||
import { MyNominal } from '../subProject/index';
|
||||
declare const variable: {
|
||||
key: globalThis.MyNominal<string, "MyNominal">;
|
||||
key: MyNominal;
|
||||
};
|
||||
export declare function getVar(): keyof typeof variable;
|
||||
export {};
|
||||
@@ -246,7 +247,7 @@ exports.getVar = getVar;
|
||||
},
|
||||
"../../../src/subproject2/index.ts": {
|
||||
"version": "2747033208-import { MyNominal } from '../subProject/index';\nconst variable = {\n key: 'value' as MyNominal,\n};\nexport function getVar(): keyof typeof variable {\n return 'key';\n}",
|
||||
"signature": "-448645961-declare const variable: {\r\n key: globalThis.MyNominal<string, \"MyNominal\">;\r\n};\r\nexport declare function getVar(): keyof typeof variable;\r\nexport {};\r\n",
|
||||
"signature": "-5370006151-import { MyNominal } from '../subProject/index';\r\ndeclare const variable: {\r\n key: MyNominal;\r\n};\r\nexport declare function getVar(): keyof typeof variable;\r\nexport {};\r\n",
|
||||
"affectsGlobalScope": false
|
||||
}
|
||||
},
|
||||
@@ -273,6 +274,9 @@ exports.getVar = getVar;
|
||||
],
|
||||
"../subproject/index.d.ts": [
|
||||
"../common/nominal.d.ts"
|
||||
],
|
||||
"../../../src/subproject2/index.ts": [
|
||||
"../subproject/index.d.ts"
|
||||
]
|
||||
},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
|
||||
+4
-3
@@ -238,8 +238,9 @@ exports.__esModule = true;
|
||||
}
|
||||
|
||||
//// [/src/lib/solution/sub-project-2/index.d.ts]
|
||||
import { MyNominal } from '../sub-project/index';
|
||||
declare const variable: {
|
||||
key: import("../common/nominal").Nominal<string, "MyNominal">;
|
||||
key: MyNominal;
|
||||
};
|
||||
export declare function getVar(): keyof typeof variable;
|
||||
export {};
|
||||
@@ -279,7 +280,7 @@ exports.getVar = getVar;
|
||||
},
|
||||
"../../../solution/sub-project-2/index.ts": {
|
||||
"version": "-13939373533-import { MyNominal } from '../sub-project/index';\n\nconst variable = {\n key: 'value' as MyNominal,\n};\n\nexport function getVar(): keyof typeof variable {\n return 'key';\n}\n",
|
||||
"signature": "-17233212183-declare const variable: {\r\n key: import(\"../common/nominal\").Nominal<string, \"MyNominal\">;\r\n};\r\nexport declare function getVar(): keyof typeof variable;\r\nexport {};\r\n",
|
||||
"signature": "881159974-import { MyNominal } from '../sub-project/index';\r\ndeclare const variable: {\r\n key: MyNominal;\r\n};\r\nexport declare function getVar(): keyof typeof variable;\r\nexport {};\r\n",
|
||||
"affectsGlobalScope": false
|
||||
}
|
||||
},
|
||||
@@ -303,7 +304,7 @@ exports.getVar = getVar;
|
||||
"../common/nominal.d.ts"
|
||||
],
|
||||
"../../../solution/sub-project-2/index.ts": [
|
||||
"../common/nominal.d.ts"
|
||||
"../sub-project/index.d.ts"
|
||||
]
|
||||
},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
|
||||
@@ -174,8 +174,8 @@ declare const MyComponent: ComponentType<Props>;
|
||||
>MyComponent : ComponentType<Props>
|
||||
|
||||
withRouter(MyComponent);
|
||||
>withRouter(MyComponent) : ComponentClass<Pick<Props, "username">>
|
||||
>withRouter : <P extends RouteComponentProps, C extends ComponentType<P>>(component: C & ComponentType<P>) => ComponentClass<Pick<P, Exclude<keyof P, "route">>>
|
||||
>withRouter(MyComponent) : ComponentClass<Omit<Props, "route">>
|
||||
>withRouter : <P extends RouteComponentProps, C extends ComponentType<P>>(component: C & ComponentType<P>) => ComponentClass<Omit<P, "route">>
|
||||
>MyComponent : ComponentType<Props>
|
||||
|
||||
// Repro from #33490
|
||||
|
||||
@@ -91,7 +91,7 @@ type T35<T> = T extends unknown ? { x: T } : false;
|
||||
>false : false
|
||||
|
||||
type T36 = T35<string | number>; // { x: string } | { x: number }
|
||||
>T36 : { x: string; } | { x: number; }
|
||||
>T36 : T36
|
||||
|
||||
type T37 = T35<any>; // { x: any }
|
||||
>T37 : { x: any; }
|
||||
|
||||
+4
-4
@@ -142,11 +142,11 @@ type NeededInfo<MyNamespaceSchema = {}> = {
|
||||
};
|
||||
|
||||
export type MyInfo = NeededInfo<ToB<{ initialize: any }>>;
|
||||
>MyInfo : NeededInfo<ToB<{ initialize: any; }>>
|
||||
>MyInfo : MyInfo
|
||||
>initialize : any
|
||||
|
||||
const tmp1: MyInfo = null!;
|
||||
>tmp1 : NeededInfo<ToB<{ initialize: any; }>>
|
||||
>tmp1 : MyInfo
|
||||
>null! : never
|
||||
>null : null
|
||||
|
||||
@@ -157,12 +157,12 @@ function tmp2<N extends NeededInfo>(n: N) {}
|
||||
tmp2(tmp1); // uncommenting this line removes a type error from a completely unrelated line ??
|
||||
>tmp2(tmp1) : void
|
||||
>tmp2 : <N extends NeededInfo<{}>>(n: N) => void
|
||||
>tmp1 : NeededInfo<ToB<{ initialize: any; }>>
|
||||
>tmp1 : MyInfo
|
||||
|
||||
class Server<X extends NeededInfo> {}
|
||||
>Server : Server<X>
|
||||
|
||||
export class MyServer extends Server<MyInfo> {} // not assignable error at `MyInfo`
|
||||
>MyServer : MyServer
|
||||
>Server : Server<NeededInfo<ToB<{ initialize: any; }>>>
|
||||
>Server : Server<MyInfo>
|
||||
|
||||
|
||||
+3
-3
@@ -142,11 +142,11 @@ type NeededInfo<MyNamespaceSchema = {}> = {
|
||||
};
|
||||
|
||||
export type MyInfo = NeededInfo<ToB<{ initialize: any }>>;
|
||||
>MyInfo : NeededInfo<ToB<{ initialize: any; }>>
|
||||
>MyInfo : MyInfo
|
||||
>initialize : any
|
||||
|
||||
const tmp1: MyInfo = null!;
|
||||
>tmp1 : NeededInfo<ToB<{ initialize: any; }>>
|
||||
>tmp1 : MyInfo
|
||||
>null! : never
|
||||
>null : null
|
||||
|
||||
@@ -161,5 +161,5 @@ class Server<X extends NeededInfo> {}
|
||||
|
||||
export class MyServer extends Server<MyInfo> {} // not assignable error at `MyInfo`
|
||||
>MyServer : MyServer
|
||||
>Server : Server<NeededInfo<ToB<{ initialize: any; }>>>
|
||||
>Server : Server<MyInfo>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user