mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Improve constraints of conditional types applied to constrained type variables (#56004)
This commit is contained in:
parent
3e094edc97
commit
38ef79e0b0
@ -13679,7 +13679,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const checkType = (type as ConditionalType).checkType;
|
||||
const constraint = getLowerBoundOfKeyType(checkType);
|
||||
if (constraint !== checkType) {
|
||||
return getConditionalTypeInstantiation(type as ConditionalType, prependTypeMapping((type as ConditionalType).root.checkType, constraint, (type as ConditionalType).mapper));
|
||||
return getConditionalTypeInstantiation(type as ConditionalType, prependTypeMapping((type as ConditionalType).root.checkType, constraint, (type as ConditionalType).mapper), /*forConstraint*/ false);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
@ -14128,7 +14128,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const simplified = getSimplifiedType(type.checkType, /*writing*/ false);
|
||||
const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
|
||||
if (constraint && constraint !== type.checkType) {
|
||||
const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
|
||||
const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper), /*forConstraint*/ true);
|
||||
if (!(instantiated.flags & TypeFlags.Never)) {
|
||||
type.resolvedConstraintOfDistributive = instantiated;
|
||||
return instantiated;
|
||||
@ -18353,7 +18353,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
|
||||
}
|
||||
|
||||
function getConditionalType(root: ConditionalRoot, mapper: TypeMapper | undefined, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
|
||||
function getConditionalType(root: ConditionalRoot, mapper: TypeMapper | undefined, forConstraint: boolean, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
|
||||
let result;
|
||||
let extraTypes: Type[] | undefined;
|
||||
let tailCount = 0;
|
||||
@ -18432,8 +18432,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
// possible (the wildcard type is assignable to and from all types). If those are not related,
|
||||
// then no instantiations will be and we can just return the false branch type.
|
||||
if (!(inferredExtendsType.flags & TypeFlags.AnyOrUnknown) && (checkType.flags & TypeFlags.Any || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
|
||||
// Return union of trueType and falseType for 'any' since it matches anything
|
||||
if (checkType.flags & TypeFlags.Any) {
|
||||
// Return union of trueType and falseType for 'any' since it matches anything. Furthermore, for a
|
||||
// distributive conditional type applied to the constraint of a type variable, include trueType if
|
||||
// there are possible values of the check type that are also possible values of the extends type.
|
||||
// We use a reverse assignability check as it is less expensive than the comparable relationship
|
||||
// and avoids false positives of a non-empty intersection check.
|
||||
if (checkType.flags & TypeFlags.Any || forConstraint && !(inferredExtendsType.flags & TypeFlags.Never) && someType(getPermissiveInstantiation(inferredExtendsType), t => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
|
||||
(extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
|
||||
}
|
||||
// If falseType is an immediately nested conditional type that isn't distributive or has an
|
||||
@ -18557,7 +18561,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
aliasSymbol,
|
||||
aliasTypeArguments,
|
||||
};
|
||||
links.resolvedType = getConditionalType(root, /*mapper*/ undefined);
|
||||
links.resolvedType = getConditionalType(root, /*mapper*/ undefined, /*forConstraint*/ false);
|
||||
if (outerTypeParameters) {
|
||||
root.instantiations = new Map<string, Type>();
|
||||
root.instantiations.set(getTypeListId(outerTypeParameters), links.resolvedType);
|
||||
@ -19565,14 +19569,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getConditionalTypeInstantiation(type: ConditionalType, mapper: TypeMapper, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
|
||||
function getConditionalTypeInstantiation(type: ConditionalType, mapper: TypeMapper, forConstraint: boolean, 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) + getAliasId(aliasSymbol, aliasTypeArguments);
|
||||
const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
|
||||
let result = root.instantiations!.get(id);
|
||||
if (!result) {
|
||||
const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
|
||||
@ -19582,8 +19586,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
// distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
|
||||
// result is (A extends U ? X : Y) | (B extends U ? X : Y).
|
||||
result = distributionType && checkType !== distributionType && distributionType.flags & (TypeFlags.Union | TypeFlags.Never) ?
|
||||
mapTypeWithAlias(getReducedType(distributionType), t => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) :
|
||||
getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
|
||||
mapTypeWithAlias(getReducedType(distributionType), t => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) :
|
||||
getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
|
||||
root.instantiations!.set(id, result);
|
||||
}
|
||||
return result;
|
||||
@ -19665,7 +19669,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return getIndexedAccessType(instantiateType((type as IndexedAccessType).objectType, mapper), instantiateType((type as IndexedAccessType).indexType, mapper), (type as IndexedAccessType).accessFlags, /*accessNode*/ undefined, newAliasSymbol, newAliasTypeArguments);
|
||||
}
|
||||
if (flags & TypeFlags.Conditional) {
|
||||
return getConditionalTypeInstantiation(type as ConditionalType, combineTypeMappers((type as ConditionalType).mapper, mapper), aliasSymbol, aliasTypeArguments);
|
||||
return getConditionalTypeInstantiation(type as ConditionalType, combineTypeMappers((type as ConditionalType).mapper, mapper), /*forConstraint*/ false, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
if (flags & TypeFlags.Substitution) {
|
||||
const newBaseType = instantiateType((type as SubstitutionType).baseType, mapper);
|
||||
@ -22414,18 +22418,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// conditionals aren't related to one another via distributive constraint as it is much too inaccurate and allows way
|
||||
// more assignments than are desirable (since it maps the source check type to its constraint, it loses information)
|
||||
const distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source as ConditionalType) : undefined;
|
||||
if (distributiveConstraint) {
|
||||
if (result = isRelatedTo(distributiveConstraint, target, RecursionFlags.Source, reportErrors)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// conditionals _can_ be related to one another via normal constraint, as, eg, `A extends B ? O : never` should be assignable to `O`
|
||||
// conditionals can be related to one another via normal constraint, as, eg, `A extends B ? O : never` should be assignable to `O`
|
||||
// when `O` is a conditional (`never` is trivially assignable to `O`, as is `O`!).
|
||||
const defaultConstraint = getDefaultConstraintOfConditionalType(source as ConditionalType);
|
||||
if (defaultConstraint) {
|
||||
@ -22433,6 +22426,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// conditionals aren't related to one another via distributive constraint as it is much too inaccurate and allows way
|
||||
// more assignments than are desirable (since it maps the source check type to its constraint, it loses information).
|
||||
const distributiveConstraint = !(targetFlags & TypeFlags.Conditional) && hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source as ConditionalType) : undefined;
|
||||
if (distributiveConstraint) {
|
||||
resetErrorInfo(saveErrorInfo);
|
||||
if (result = isRelatedTo(distributiveConstraint, target, RecursionFlags.Source, reportErrors)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// An empty object type is related to any mapped type that includes a '?' modifier.
|
||||
|
||||
@ -1,31 +1,12 @@
|
||||
circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts(63,84): error TS2344: Type 'GetProps<C>' does not satisfy the constraint 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
Type 'unknown' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
Type 'Matching<TInjectedProps, GetProps<C>>' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P] : GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[P] | (TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Extract<keyof TInjectedProps, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] : GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] | (TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<string, keyof GetProps<C>>] | GetProps<C>[Extract<number, keyof GetProps<C>>] | GetProps<C>[Extract<symbol, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]) | (Extract<number, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : GetProps<C>[Extract<number, keyof GetProps<C>>]) | (Extract<symbol, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : GetProps<C>[Extract<symbol, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]) | GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] | TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'keyof GetProps<C> & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] : GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]) | GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] | TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Matching<TInjectedProps, GetProps<C>>' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P] : GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Extract<keyof TInjectedProps, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] : GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]) | (Extract<number, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : GetProps<C>[Extract<number, keyof GetProps<C>>]) | (Extract<symbol, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : GetProps<C>[Extract<symbol, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'keyof GetProps<C> & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] : GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
|
||||
|
||||
==== circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts (1 errors) ====
|
||||
@ -94,31 +75,12 @@ circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth
|
||||
) => ConnectedComponentClass<C, Omit<GetProps<C>, keyof Shared<TInjectedProps, GetProps<C>>> & TNeedsProps>;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2344: Type 'GetProps<C>' does not satisfy the constraint 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
!!! error TS2344: Type 'unknown' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
!!! error TS2344: Type 'Matching<TInjectedProps, GetProps<C>>' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P] : GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[P] | (TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Extract<keyof TInjectedProps, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] : GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] | (TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<string, keyof GetProps<C>>] | GetProps<C>[Extract<number, keyof GetProps<C>>] | GetProps<C>[Extract<symbol, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]) | (Extract<number, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : GetProps<C>[Extract<number, keyof GetProps<C>>]) | (Extract<symbol, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : GetProps<C>[Extract<symbol, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]) | GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] | TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'keyof GetProps<C> & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] : GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]) | GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] | TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Matching<TInjectedProps, GetProps<C>>' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P] : GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Extract<keyof TInjectedProps, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] : GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]) | (Extract<number, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : GetProps<C>[Extract<number, keyof GetProps<C>>]) | (Extract<symbol, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : GetProps<C>[Extract<symbol, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'keyof GetProps<C> & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] : GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
|
||||
@ -57,8 +57,10 @@ conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is
|
||||
conditionalTypes1.ts(137,10): error TS2339: Property 'updatePart' does not exist on type 'DeepReadonlyObject<Part>'.
|
||||
conditionalTypes1.ts(159,5): error TS2322: Type 'ZeroOf<T>' is not assignable to type 'T'.
|
||||
'ZeroOf<T>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'.
|
||||
'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'.
|
||||
Type 'string | number' is not assignable to type 'T'.
|
||||
'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
Type 'string' is not assignable to type 'T'.
|
||||
'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
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>'.
|
||||
@ -306,8 +308,10 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95<U>' is not assignable to t
|
||||
~
|
||||
!!! error TS2322: Type 'ZeroOf<T>' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'ZeroOf<T>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
!!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T'.
|
||||
!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
|
||||
y = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'ZeroOf<T>'.
|
||||
|
||||
@ -25,9 +25,8 @@ conditionalTypes2.ts(25,5): error TS2322: Type 'Invariant<A>' is not assignable
|
||||
Type 'A' is not assignable to type 'B'.
|
||||
'B' could be instantiated with an arbitrary type which could be unrelated to 'A'.
|
||||
conditionalTypes2.ts(73,12): error TS2345: Argument of type 'Extract<Extract<T, Foo>, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
|
||||
Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
|
||||
Type 'Extract<T, Bar>' is not assignable to type '{ foo: string; bat: string; }'.
|
||||
Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
|
||||
Type 'Extract<T, Bar>' is not assignable to type '{ foo: string; bat: string; }'.
|
||||
Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
|
||||
conditionalTypes2.ts(74,12): error TS2345: Argument of type 'Extract<T, Foo & Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
|
||||
Property 'bat' is missing in type 'Foo & Bar' but required in type '{ foo: string; bat: string; }'.
|
||||
conditionalTypes2.ts(75,12): error TS2345: Argument of type 'Extract2<T, Foo, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
|
||||
@ -145,10 +144,8 @@ conditionalTypes2.ts(75,12): error TS2345: Argument of type 'Extract2<T, Foo, Ba
|
||||
fooBat(x); // Error
|
||||
~
|
||||
!!! error TS2345: Argument of type 'Extract<Extract<T, Foo>, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
|
||||
!!! error TS2345: Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
|
||||
!!! error TS2345: Type 'Extract<T, Bar>' is not assignable to type '{ foo: string; bat: string; }'.
|
||||
!!! error TS2345: Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
|
||||
!!! related TS2728 conditionalTypes2.ts:62:43: 'bat' is declared here.
|
||||
!!! error TS2345: Type 'Extract<T, Bar>' is not assignable to type '{ foo: string; bat: string; }'.
|
||||
!!! error TS2345: Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
|
||||
!!! related TS2728 conditionalTypes2.ts:62:43: 'bat' is declared here.
|
||||
fooBat(y); // Error
|
||||
~
|
||||
|
||||
@ -0,0 +1,117 @@
|
||||
distributiveConditionalTypeConstraints.ts(4,9): error TS2322: Type 'boolean' is not assignable to type 'true'.
|
||||
distributiveConditionalTypeConstraints.ts(5,9): error TS2322: Type 'boolean' is not assignable to type 'false'.
|
||||
distributiveConditionalTypeConstraints.ts(10,9): error TS2322: Type 'IsArray<T>' is not assignable to type 'false'.
|
||||
Type 'true' is not assignable to type 'false'.
|
||||
distributiveConditionalTypeConstraints.ts(15,9): error TS2322: Type 'IsArray<T>' is not assignable to type 'false'.
|
||||
Type 'true' is not assignable to type 'false'.
|
||||
distributiveConditionalTypeConstraints.ts(19,9): error TS2322: Type 'IsArray<T>' is not assignable to type 'true'.
|
||||
Type 'false' is not assignable to type 'true'.
|
||||
distributiveConditionalTypeConstraints.ts(38,9): error TS2322: Type 'boolean' is not assignable to type 'false'.
|
||||
|
||||
|
||||
==== distributiveConditionalTypeConstraints.ts (6 errors) ====
|
||||
type IsArray<T> = T extends unknown[] ? true : false;
|
||||
|
||||
function f1<T extends object>(x: IsArray<T>) {
|
||||
let t: true = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'true'.
|
||||
let f: false = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'false'.
|
||||
}
|
||||
|
||||
function f2<T extends unknown[]>(x: IsArray<T>) {
|
||||
let t: true = x;
|
||||
let f: false = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'IsArray<T>' is not assignable to type 'false'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'false'.
|
||||
}
|
||||
|
||||
function f3<T extends string[]>(x: IsArray<T>) {
|
||||
let t: true = x;
|
||||
let f: false = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'IsArray<T>' is not assignable to type 'false'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'false'.
|
||||
}
|
||||
|
||||
function f4<T extends Function>(x: IsArray<T>) {
|
||||
let t: true = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'IsArray<T>' is not assignable to type 'true'.
|
||||
!!! error TS2322: Type 'false' is not assignable to type 'true'.
|
||||
let f: false = x;
|
||||
}
|
||||
|
||||
type ZeroOf<T> =
|
||||
T extends null ? null :
|
||||
T extends undefined ? undefined :
|
||||
T extends string ? "" :
|
||||
T extends number ? 0 :
|
||||
T extends boolean ? false :
|
||||
never;
|
||||
|
||||
function f10<T extends {}>(x: ZeroOf<T>) {
|
||||
let t: "" | 0 | false = x;
|
||||
}
|
||||
|
||||
type Foo<T> = T extends "abc" | 42 ? true : false;
|
||||
|
||||
function f20<T extends string>(x: Foo<T>) {
|
||||
let t: false = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'false'.
|
||||
}
|
||||
|
||||
// Modified repro from #30152
|
||||
|
||||
interface A { foo(): void; }
|
||||
interface B { bar(): void; }
|
||||
interface C { foo(): void, bar(): void }
|
||||
|
||||
function test1<T extends A>(y: T extends B ? number : string) {
|
||||
if (typeof y == 'string') {
|
||||
y; // T extends B ? number : string
|
||||
}
|
||||
else {
|
||||
y; // never
|
||||
}
|
||||
const newY: string | number = y;
|
||||
newY; // string
|
||||
}
|
||||
|
||||
function test2<T extends A>(y: T extends B ? string : number) {
|
||||
if (typeof y == 'string') {
|
||||
y; // never
|
||||
}
|
||||
else {
|
||||
y; // T extends B ? string : number
|
||||
}
|
||||
const newY: string | number = y;
|
||||
newY; // number
|
||||
}
|
||||
|
||||
function test3<T extends A>(y: T extends C ? number : string) {
|
||||
if (typeof y == 'string') {
|
||||
y; // (T extends C ? number : string) & string
|
||||
}
|
||||
else {
|
||||
y; // T extends C ? number : string
|
||||
}
|
||||
const newY: string | number = y;
|
||||
newY; // string | number
|
||||
}
|
||||
|
||||
function test4<T extends A>(y: T extends C ? string : number) {
|
||||
if (typeof y == 'string') {
|
||||
y; // (T extends C ? string : number) & string
|
||||
}
|
||||
else {
|
||||
y; // T extends C ? string : number
|
||||
}
|
||||
const newY: string | number = y;
|
||||
newY; // string | number
|
||||
}
|
||||
|
||||
@ -0,0 +1,242 @@
|
||||
//// [tests/cases/compiler/distributiveConditionalTypeConstraints.ts] ////
|
||||
|
||||
=== distributiveConditionalTypeConstraints.ts ===
|
||||
type IsArray<T> = T extends unknown[] ? true : false;
|
||||
>IsArray : Symbol(IsArray, Decl(distributiveConditionalTypeConstraints.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 0, 13))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 0, 13))
|
||||
|
||||
function f1<T extends object>(x: IsArray<T>) {
|
||||
>f1 : Symbol(f1, Decl(distributiveConditionalTypeConstraints.ts, 0, 53))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 2, 12))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 2, 30))
|
||||
>IsArray : Symbol(IsArray, Decl(distributiveConditionalTypeConstraints.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 2, 12))
|
||||
|
||||
let t: true = x; // Error
|
||||
>t : Symbol(t, Decl(distributiveConditionalTypeConstraints.ts, 3, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 2, 30))
|
||||
|
||||
let f: false = x; // Error
|
||||
>f : Symbol(f, Decl(distributiveConditionalTypeConstraints.ts, 4, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 2, 30))
|
||||
}
|
||||
|
||||
function f2<T extends unknown[]>(x: IsArray<T>) {
|
||||
>f2 : Symbol(f2, Decl(distributiveConditionalTypeConstraints.ts, 5, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 7, 12))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 7, 33))
|
||||
>IsArray : Symbol(IsArray, Decl(distributiveConditionalTypeConstraints.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 7, 12))
|
||||
|
||||
let t: true = x;
|
||||
>t : Symbol(t, Decl(distributiveConditionalTypeConstraints.ts, 8, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 7, 33))
|
||||
|
||||
let f: false = x; // Error
|
||||
>f : Symbol(f, Decl(distributiveConditionalTypeConstraints.ts, 9, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 7, 33))
|
||||
}
|
||||
|
||||
function f3<T extends string[]>(x: IsArray<T>) {
|
||||
>f3 : Symbol(f3, Decl(distributiveConditionalTypeConstraints.ts, 10, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 12, 12))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 12, 32))
|
||||
>IsArray : Symbol(IsArray, Decl(distributiveConditionalTypeConstraints.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 12, 12))
|
||||
|
||||
let t: true = x;
|
||||
>t : Symbol(t, Decl(distributiveConditionalTypeConstraints.ts, 13, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 12, 32))
|
||||
|
||||
let f: false = x; // Error
|
||||
>f : Symbol(f, Decl(distributiveConditionalTypeConstraints.ts, 14, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 12, 32))
|
||||
}
|
||||
|
||||
function f4<T extends Function>(x: IsArray<T>) {
|
||||
>f4 : Symbol(f4, Decl(distributiveConditionalTypeConstraints.ts, 15, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 17, 12))
|
||||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 17, 32))
|
||||
>IsArray : Symbol(IsArray, Decl(distributiveConditionalTypeConstraints.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 17, 12))
|
||||
|
||||
let t: true = x; // Error
|
||||
>t : Symbol(t, Decl(distributiveConditionalTypeConstraints.ts, 18, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 17, 32))
|
||||
|
||||
let f: false = x;
|
||||
>f : Symbol(f, Decl(distributiveConditionalTypeConstraints.ts, 19, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 17, 32))
|
||||
}
|
||||
|
||||
type ZeroOf<T> =
|
||||
>ZeroOf : Symbol(ZeroOf, Decl(distributiveConditionalTypeConstraints.ts, 20, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 22, 12))
|
||||
|
||||
T extends null ? null :
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 22, 12))
|
||||
|
||||
T extends undefined ? undefined :
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 22, 12))
|
||||
|
||||
T extends string ? "" :
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 22, 12))
|
||||
|
||||
T extends number ? 0 :
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 22, 12))
|
||||
|
||||
T extends boolean ? false :
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 22, 12))
|
||||
|
||||
never;
|
||||
|
||||
function f10<T extends {}>(x: ZeroOf<T>) {
|
||||
>f10 : Symbol(f10, Decl(distributiveConditionalTypeConstraints.ts, 28, 10))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 30, 13))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 30, 27))
|
||||
>ZeroOf : Symbol(ZeroOf, Decl(distributiveConditionalTypeConstraints.ts, 20, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 30, 13))
|
||||
|
||||
let t: "" | 0 | false = x;
|
||||
>t : Symbol(t, Decl(distributiveConditionalTypeConstraints.ts, 31, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 30, 27))
|
||||
}
|
||||
|
||||
type Foo<T> = T extends "abc" | 42 ? true : false;
|
||||
>Foo : Symbol(Foo, Decl(distributiveConditionalTypeConstraints.ts, 32, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 34, 9))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 34, 9))
|
||||
|
||||
function f20<T extends string>(x: Foo<T>) {
|
||||
>f20 : Symbol(f20, Decl(distributiveConditionalTypeConstraints.ts, 34, 50))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 36, 13))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 36, 31))
|
||||
>Foo : Symbol(Foo, Decl(distributiveConditionalTypeConstraints.ts, 32, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 36, 13))
|
||||
|
||||
let t: false = x; // Error
|
||||
>t : Symbol(t, Decl(distributiveConditionalTypeConstraints.ts, 37, 7))
|
||||
>x : Symbol(x, Decl(distributiveConditionalTypeConstraints.ts, 36, 31))
|
||||
}
|
||||
|
||||
// Modified repro from #30152
|
||||
|
||||
interface A { foo(): void; }
|
||||
>A : Symbol(A, Decl(distributiveConditionalTypeConstraints.ts, 38, 1))
|
||||
>foo : Symbol(A.foo, Decl(distributiveConditionalTypeConstraints.ts, 42, 13))
|
||||
|
||||
interface B { bar(): void; }
|
||||
>B : Symbol(B, Decl(distributiveConditionalTypeConstraints.ts, 42, 28))
|
||||
>bar : Symbol(B.bar, Decl(distributiveConditionalTypeConstraints.ts, 43, 13))
|
||||
|
||||
interface C { foo(): void, bar(): void }
|
||||
>C : Symbol(C, Decl(distributiveConditionalTypeConstraints.ts, 43, 28))
|
||||
>foo : Symbol(C.foo, Decl(distributiveConditionalTypeConstraints.ts, 44, 13))
|
||||
>bar : Symbol(C.bar, Decl(distributiveConditionalTypeConstraints.ts, 44, 26))
|
||||
|
||||
function test1<T extends A>(y: T extends B ? number : string) {
|
||||
>test1 : Symbol(test1, Decl(distributiveConditionalTypeConstraints.ts, 44, 40))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 46, 15))
|
||||
>A : Symbol(A, Decl(distributiveConditionalTypeConstraints.ts, 38, 1))
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 46, 28))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 46, 15))
|
||||
>B : Symbol(B, Decl(distributiveConditionalTypeConstraints.ts, 42, 28))
|
||||
|
||||
if (typeof y == 'string') {
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 46, 28))
|
||||
|
||||
y; // T extends B ? number : string
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 46, 28))
|
||||
}
|
||||
else {
|
||||
y; // never
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 46, 28))
|
||||
}
|
||||
const newY: string | number = y;
|
||||
>newY : Symbol(newY, Decl(distributiveConditionalTypeConstraints.ts, 53, 9))
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 46, 28))
|
||||
|
||||
newY; // string
|
||||
>newY : Symbol(newY, Decl(distributiveConditionalTypeConstraints.ts, 53, 9))
|
||||
}
|
||||
|
||||
function test2<T extends A>(y: T extends B ? string : number) {
|
||||
>test2 : Symbol(test2, Decl(distributiveConditionalTypeConstraints.ts, 55, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 57, 15))
|
||||
>A : Symbol(A, Decl(distributiveConditionalTypeConstraints.ts, 38, 1))
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 57, 28))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 57, 15))
|
||||
>B : Symbol(B, Decl(distributiveConditionalTypeConstraints.ts, 42, 28))
|
||||
|
||||
if (typeof y == 'string') {
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 57, 28))
|
||||
|
||||
y; // never
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 57, 28))
|
||||
}
|
||||
else {
|
||||
y; // T extends B ? string : number
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 57, 28))
|
||||
}
|
||||
const newY: string | number = y;
|
||||
>newY : Symbol(newY, Decl(distributiveConditionalTypeConstraints.ts, 64, 9))
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 57, 28))
|
||||
|
||||
newY; // number
|
||||
>newY : Symbol(newY, Decl(distributiveConditionalTypeConstraints.ts, 64, 9))
|
||||
}
|
||||
|
||||
function test3<T extends A>(y: T extends C ? number : string) {
|
||||
>test3 : Symbol(test3, Decl(distributiveConditionalTypeConstraints.ts, 66, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 68, 15))
|
||||
>A : Symbol(A, Decl(distributiveConditionalTypeConstraints.ts, 38, 1))
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 68, 28))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 68, 15))
|
||||
>C : Symbol(C, Decl(distributiveConditionalTypeConstraints.ts, 43, 28))
|
||||
|
||||
if (typeof y == 'string') {
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 68, 28))
|
||||
|
||||
y; // (T extends C ? number : string) & string
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 68, 28))
|
||||
}
|
||||
else {
|
||||
y; // T extends C ? number : string
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 68, 28))
|
||||
}
|
||||
const newY: string | number = y;
|
||||
>newY : Symbol(newY, Decl(distributiveConditionalTypeConstraints.ts, 75, 9))
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 68, 28))
|
||||
|
||||
newY; // string | number
|
||||
>newY : Symbol(newY, Decl(distributiveConditionalTypeConstraints.ts, 75, 9))
|
||||
}
|
||||
|
||||
function test4<T extends A>(y: T extends C ? string : number) {
|
||||
>test4 : Symbol(test4, Decl(distributiveConditionalTypeConstraints.ts, 77, 1))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 79, 15))
|
||||
>A : Symbol(A, Decl(distributiveConditionalTypeConstraints.ts, 38, 1))
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 79, 28))
|
||||
>T : Symbol(T, Decl(distributiveConditionalTypeConstraints.ts, 79, 15))
|
||||
>C : Symbol(C, Decl(distributiveConditionalTypeConstraints.ts, 43, 28))
|
||||
|
||||
if (typeof y == 'string') {
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 79, 28))
|
||||
|
||||
y; // (T extends C ? string : number) & string
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 79, 28))
|
||||
}
|
||||
else {
|
||||
y; // T extends C ? string : number
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 79, 28))
|
||||
}
|
||||
const newY: string | number = y;
|
||||
>newY : Symbol(newY, Decl(distributiveConditionalTypeConstraints.ts, 86, 9))
|
||||
>y : Symbol(y, Decl(distributiveConditionalTypeConstraints.ts, 79, 28))
|
||||
|
||||
newY; // string | number
|
||||
>newY : Symbol(newY, Decl(distributiveConditionalTypeConstraints.ts, 86, 9))
|
||||
}
|
||||
|
||||
@ -0,0 +1,217 @@
|
||||
//// [tests/cases/compiler/distributiveConditionalTypeConstraints.ts] ////
|
||||
|
||||
=== distributiveConditionalTypeConstraints.ts ===
|
||||
type IsArray<T> = T extends unknown[] ? true : false;
|
||||
>IsArray : IsArray<T>
|
||||
>true : true
|
||||
>false : false
|
||||
|
||||
function f1<T extends object>(x: IsArray<T>) {
|
||||
>f1 : <T extends object>(x: IsArray<T>) => void
|
||||
>x : IsArray<T>
|
||||
|
||||
let t: true = x; // Error
|
||||
>t : true
|
||||
>true : true
|
||||
>x : boolean
|
||||
|
||||
let f: false = x; // Error
|
||||
>f : false
|
||||
>false : false
|
||||
>x : boolean
|
||||
}
|
||||
|
||||
function f2<T extends unknown[]>(x: IsArray<T>) {
|
||||
>f2 : <T extends unknown[]>(x: IsArray<T>) => void
|
||||
>x : IsArray<T>
|
||||
|
||||
let t: true = x;
|
||||
>t : true
|
||||
>true : true
|
||||
>x : IsArray<T>
|
||||
|
||||
let f: false = x; // Error
|
||||
>f : false
|
||||
>false : false
|
||||
>x : IsArray<T>
|
||||
}
|
||||
|
||||
function f3<T extends string[]>(x: IsArray<T>) {
|
||||
>f3 : <T extends string[]>(x: IsArray<T>) => void
|
||||
>x : IsArray<T>
|
||||
|
||||
let t: true = x;
|
||||
>t : true
|
||||
>true : true
|
||||
>x : IsArray<T>
|
||||
|
||||
let f: false = x; // Error
|
||||
>f : false
|
||||
>false : false
|
||||
>x : IsArray<T>
|
||||
}
|
||||
|
||||
function f4<T extends Function>(x: IsArray<T>) {
|
||||
>f4 : <T extends Function>(x: IsArray<T>) => void
|
||||
>x : IsArray<T>
|
||||
|
||||
let t: true = x; // Error
|
||||
>t : true
|
||||
>true : true
|
||||
>x : IsArray<T>
|
||||
|
||||
let f: false = x;
|
||||
>f : false
|
||||
>false : false
|
||||
>x : IsArray<T>
|
||||
}
|
||||
|
||||
type ZeroOf<T> =
|
||||
>ZeroOf : ZeroOf<T>
|
||||
|
||||
T extends null ? null :
|
||||
T extends undefined ? undefined :
|
||||
T extends string ? "" :
|
||||
T extends number ? 0 :
|
||||
T extends boolean ? false :
|
||||
>false : false
|
||||
|
||||
never;
|
||||
|
||||
function f10<T extends {}>(x: ZeroOf<T>) {
|
||||
>f10 : <T extends {}>(x: ZeroOf<T>) => void
|
||||
>x : ZeroOf<T>
|
||||
|
||||
let t: "" | 0 | false = x;
|
||||
>t : false | "" | 0
|
||||
>false : false
|
||||
>x : false | "" | 0
|
||||
}
|
||||
|
||||
type Foo<T> = T extends "abc" | 42 ? true : false;
|
||||
>Foo : Foo<T>
|
||||
>true : true
|
||||
>false : false
|
||||
|
||||
function f20<T extends string>(x: Foo<T>) {
|
||||
>f20 : <T extends string>(x: Foo<T>) => void
|
||||
>x : Foo<T>
|
||||
|
||||
let t: false = x; // Error
|
||||
>t : false
|
||||
>false : false
|
||||
>x : boolean
|
||||
}
|
||||
|
||||
// Modified repro from #30152
|
||||
|
||||
interface A { foo(): void; }
|
||||
>foo : () => void
|
||||
|
||||
interface B { bar(): void; }
|
||||
>bar : () => void
|
||||
|
||||
interface C { foo(): void, bar(): void }
|
||||
>foo : () => void
|
||||
>bar : () => void
|
||||
|
||||
function test1<T extends A>(y: T extends B ? number : string) {
|
||||
>test1 : <T extends A>(y: T extends B ? number : string) => void
|
||||
>y : T extends B ? number : string
|
||||
|
||||
if (typeof y == 'string') {
|
||||
>typeof y == 'string' : boolean
|
||||
>typeof y : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>y : T extends B ? number : string
|
||||
>'string' : "string"
|
||||
|
||||
y; // T extends B ? number : string
|
||||
>y : T extends B ? number : string
|
||||
}
|
||||
else {
|
||||
y; // never
|
||||
>y : never
|
||||
}
|
||||
const newY: string | number = y;
|
||||
>newY : string | number
|
||||
>y : T extends B ? number : string
|
||||
|
||||
newY; // string
|
||||
>newY : string
|
||||
}
|
||||
|
||||
function test2<T extends A>(y: T extends B ? string : number) {
|
||||
>test2 : <T extends A>(y: T extends B ? string : number) => void
|
||||
>y : T extends B ? string : number
|
||||
|
||||
if (typeof y == 'string') {
|
||||
>typeof y == 'string' : boolean
|
||||
>typeof y : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>y : T extends B ? string : number
|
||||
>'string' : "string"
|
||||
|
||||
y; // never
|
||||
>y : never
|
||||
}
|
||||
else {
|
||||
y; // T extends B ? string : number
|
||||
>y : T extends B ? string : number
|
||||
}
|
||||
const newY: string | number = y;
|
||||
>newY : string | number
|
||||
>y : T extends B ? string : number
|
||||
|
||||
newY; // number
|
||||
>newY : number
|
||||
}
|
||||
|
||||
function test3<T extends A>(y: T extends C ? number : string) {
|
||||
>test3 : <T extends A>(y: T extends C ? number : string) => void
|
||||
>y : T extends C ? number : string
|
||||
|
||||
if (typeof y == 'string') {
|
||||
>typeof y == 'string' : boolean
|
||||
>typeof y : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>y : T extends C ? number : string
|
||||
>'string' : "string"
|
||||
|
||||
y; // (T extends C ? number : string) & string
|
||||
>y : (T extends C ? number : string) & string
|
||||
}
|
||||
else {
|
||||
y; // T extends C ? number : string
|
||||
>y : T extends C ? number : string
|
||||
}
|
||||
const newY: string | number = y;
|
||||
>newY : string | number
|
||||
>y : string | number
|
||||
|
||||
newY; // string | number
|
||||
>newY : string | number
|
||||
}
|
||||
|
||||
function test4<T extends A>(y: T extends C ? string : number) {
|
||||
>test4 : <T extends A>(y: T extends C ? string : number) => void
|
||||
>y : T extends C ? string : number
|
||||
|
||||
if (typeof y == 'string') {
|
||||
>typeof y == 'string' : boolean
|
||||
>typeof y : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"
|
||||
>y : T extends C ? string : number
|
||||
>'string' : "string"
|
||||
|
||||
y; // (T extends C ? string : number) & string
|
||||
>y : (T extends C ? string : number) & string
|
||||
}
|
||||
else {
|
||||
y; // T extends C ? string : number
|
||||
>y : T extends C ? string : number
|
||||
}
|
||||
const newY: string | number = y;
|
||||
>newY : string | number
|
||||
>y : string | number
|
||||
|
||||
newY; // string | number
|
||||
>newY : string | number
|
||||
}
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
flatArrayNoExcessiveStackDepth.ts(20,5): error TS2322: Type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, 0 | 2 | 1 | -1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20> : Arr' is not assignable to type 'FlatArray<Arr, D>'.
|
||||
Type 'unknown' is not assignable to type 'FlatArray<Arr, D>'.
|
||||
Type 'unknown' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
||||
Type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, 0 | 2 | 1 | -1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20> : Arr' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
||||
Type 'unknown' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
||||
Type 'FlatArray<InnerArr, 0 | 2 | 1 | -1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20>' is not assignable to type 'FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]>'.
|
||||
Type 'InnerArr' is not assignable to type 'FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]>'.
|
||||
Type 'InnerArr' is not assignable to type '(InnerArr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]]> : InnerArr) & InnerArr'.
|
||||
Type 'InnerArr' is not assignable to type 'InnerArr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]]> : InnerArr'.
|
||||
flatArrayNoExcessiveStackDepth.ts(20,5): error TS2322: Type 'FlatArray<Arr, any>' is not assignable to type 'FlatArray<Arr, D>'.
|
||||
Type 'Arr' is not assignable to type 'FlatArray<Arr, D>'.
|
||||
Type 'Arr' is not assignable to type '(Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr) & Arr'.
|
||||
Type 'Arr' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
||||
|
||||
|
||||
==== flatArrayNoExcessiveStackDepth.ts (1 errors) ====
|
||||
@ -31,14 +26,9 @@ flatArrayNoExcessiveStackDepth.ts(20,5): error TS2322: Type 'Arr extends readonl
|
||||
x = y;
|
||||
y = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, 0 | 2 | 1 | -1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20> : Arr' is not assignable to type 'FlatArray<Arr, D>'.
|
||||
!!! error TS2322: Type 'unknown' is not assignable to type 'FlatArray<Arr, D>'.
|
||||
!!! error TS2322: Type 'unknown' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
||||
!!! error TS2322: Type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, 0 | 2 | 1 | -1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20> : Arr' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
||||
!!! error TS2322: Type 'unknown' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
||||
!!! error TS2322: Type 'FlatArray<InnerArr, 0 | 2 | 1 | -1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20>' is not assignable to type 'FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]>'.
|
||||
!!! error TS2322: Type 'InnerArr' is not assignable to type 'FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]>'.
|
||||
!!! error TS2322: Type 'InnerArr' is not assignable to type '(InnerArr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]]> : InnerArr) & InnerArr'.
|
||||
!!! error TS2322: Type 'InnerArr' is not assignable to type 'InnerArr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]]> : InnerArr'.
|
||||
!!! error TS2322: Type 'FlatArray<Arr, any>' is not assignable to type 'FlatArray<Arr, D>'.
|
||||
!!! error TS2322: Type 'Arr' is not assignable to type 'FlatArray<Arr, D>'.
|
||||
!!! error TS2322: Type 'Arr' is not assignable to type '(Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr) & Arr'.
|
||||
!!! error TS2322: Type 'Arr' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
||||
}
|
||||
|
||||
@ -65,8 +65,8 @@ function f<Arr, D extends number>(x: FlatArray<Arr, any>, y: FlatArray<Arr, D>)
|
||||
>y : FlatArray<Arr, D>
|
||||
|
||||
y = x; // Error
|
||||
>y = x : Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, 0 | 2 | 1 | -1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20> : Arr
|
||||
>y = x : FlatArray<Arr, any>
|
||||
>y : FlatArray<Arr, D>
|
||||
>x : Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, 0 | 2 | 1 | -1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20> : Arr
|
||||
>x : FlatArray<Arr, any>
|
||||
}
|
||||
|
||||
|
||||
@ -1,15 +1,10 @@
|
||||
genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.ts(13,5): error TS2322: Type 'ReturnType<T[M]>' is not assignable to type 'A'.
|
||||
Type 'unknown' is not assignable to type 'A'.
|
||||
Type 'ReturnType<T[keyof T]>' is not assignable to type 'A'.
|
||||
Type 'unknown' is not assignable to type 'A'.
|
||||
Type 'ReturnType<T[string | number | symbol]>' is not assignable to type 'A'.
|
||||
Type 'unknown' is not assignable to type 'A'.
|
||||
Type 'ReturnType<T[string]> | ReturnType<T[number]> | ReturnType<T[symbol]>' is not assignable to type 'A'.
|
||||
Type 'ReturnType<T[string]>' is not assignable to type 'A'.
|
||||
Type 'unknown' is not assignable to type 'A'.
|
||||
Type 'ReturnType<FunctionsObj<T>[string]>' is not assignable to type 'A'.
|
||||
Type 'unknown' is not assignable to type 'A'.
|
||||
Property 'x' is missing in type '{}' but required in type 'A'.
|
||||
Type 'ReturnType<T[keyof T]>' is not assignable to type 'A'.
|
||||
Type 'ReturnType<T[string | number | symbol]>' is not assignable to type 'A'.
|
||||
Type 'ReturnType<T[string]> | ReturnType<T[number]> | ReturnType<T[symbol]>' is not assignable to type 'A'.
|
||||
Type 'ReturnType<T[string]>' is not assignable to type 'A'.
|
||||
Type 'ReturnType<FunctionsObj<T>[string]>' is not assignable to type 'A'.
|
||||
Type 'unknown' is not assignable to type 'A'.
|
||||
|
||||
|
||||
==== genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.ts (1 errors) ====
|
||||
@ -28,18 +23,12 @@ genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.ts(13,5): er
|
||||
x = a2;
|
||||
~
|
||||
!!! error TS2322: Type 'ReturnType<T[M]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'unknown' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'ReturnType<T[keyof T]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'unknown' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'ReturnType<T[string | number | symbol]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'unknown' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'ReturnType<T[string]> | ReturnType<T[number]> | ReturnType<T[symbol]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'ReturnType<T[string]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'unknown' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'ReturnType<FunctionsObj<T>[string]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'unknown' is not assignable to type 'A'.
|
||||
!!! error TS2322: Property 'x' is missing in type '{}' but required in type 'A'.
|
||||
!!! related TS2728 genericConditionalConstrainedToUnknownNotAssignableToConcreteObject.ts:1:15: 'x' is declared here.
|
||||
!!! error TS2322: Type 'ReturnType<T[keyof T]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'ReturnType<T[string | number | symbol]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'ReturnType<T[string]> | ReturnType<T[number]> | ReturnType<T[symbol]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'ReturnType<T[string]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'ReturnType<FunctionsObj<T>[string]>' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'unknown' is not assignable to type 'A'.
|
||||
}
|
||||
|
||||
// Original CFA report of the above issue
|
||||
|
||||
@ -40,10 +40,8 @@ keyofAndIndexedAccessErrors.ts(87,5): error TS2322: Type 'keyof T | keyof U' is
|
||||
Type 'keyof T' is not assignable to type 'keyof T & keyof U'.
|
||||
keyofAndIndexedAccessErrors.ts(103,9): error TS2322: Type 'Extract<keyof T, string>' is not assignable to type 'K'.
|
||||
'Extract<keyof T, string>' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
Type 'string & keyof T' is not assignable to type 'K'.
|
||||
'string & keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
Type 'string' is not assignable to type 'K'.
|
||||
'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
Type 'string' is not assignable to type 'K'.
|
||||
'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
keyofAndIndexedAccessErrors.ts(105,9): error TS2322: Type 'T[Extract<keyof T, string>]' is not assignable to type 'T[K]'.
|
||||
Type 'Extract<keyof T, string>' is not assignable to type 'K'.
|
||||
'Extract<keyof T, string>' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
@ -247,10 +245,8 @@ keyofAndIndexedAccessErrors.ts(165,5): error TS2322: Type 'number' is not assign
|
||||
~
|
||||
!!! error TS2322: Type 'Extract<keyof T, string>' is not assignable to type 'K'.
|
||||
!!! error TS2322: 'Extract<keyof T, string>' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
!!! error TS2322: Type 'string & keyof T' is not assignable to type 'K'.
|
||||
!!! error TS2322: 'string & keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'K'.
|
||||
!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'K'.
|
||||
!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
t[key] = tk; // ok, T[K] ==> T[keyof T]
|
||||
tk = t[key]; // error, T[keyof T] =/=> T[K]
|
||||
~~
|
||||
|
||||
@ -1,31 +1,12 @@
|
||||
reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): error TS2344: Type 'GetProps<C>' does not satisfy the constraint 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
Type 'unknown' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
Type 'Matching<TInjectedProps, GetProps<C>>' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P] : GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[P] | (TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Extract<keyof TInjectedProps, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] : GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] | (TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<string, keyof GetProps<C>>] | GetProps<C>[Extract<number, keyof GetProps<C>>] | GetProps<C>[Extract<symbol, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]) | (Extract<number, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : GetProps<C>[Extract<number, keyof GetProps<C>>]) | (Extract<symbol, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : GetProps<C>[Extract<symbol, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]) | GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] | TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'keyof GetProps<C> & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] : GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]) | GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] | TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Matching<TInjectedProps, GetProps<C>>' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P] : GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Extract<keyof TInjectedProps, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] : GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]) | (Extract<number, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : GetProps<C>[Extract<number, keyof GetProps<C>>]) | (Extract<symbol, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : GetProps<C>[Extract<symbol, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'keyof GetProps<C> & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] : GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
|
||||
|
||||
==== reactReduxLikeDeferredInferenceAllowsAssignment.ts (1 errors) ====
|
||||
@ -107,33 +88,14 @@ reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): error TS2344: Type 'G
|
||||
Omit<GetProps<C>, keyof Shared<TInjectedProps, GetProps<C>>> & TNeedsProps
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2344: Type 'GetProps<C>' does not satisfy the constraint 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
!!! error TS2344: Type 'unknown' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
!!! error TS2344: Type 'Matching<TInjectedProps, GetProps<C>>' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P] : GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[P] | (TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Extract<keyof TInjectedProps, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] : GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] | (TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<string, keyof GetProps<C>>] | GetProps<C>[Extract<number, keyof GetProps<C>>] | GetProps<C>[Extract<symbol, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]) | (Extract<number, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : GetProps<C>[Extract<number, keyof GetProps<C>>]) | (Extract<symbol, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : GetProps<C>[Extract<symbol, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]) | GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] | TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'keyof GetProps<C> & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] : GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]) | GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] | TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Matching<TInjectedProps, GetProps<C>>' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
|
||||
!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P] : GetProps<C>[P]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Extract<keyof TInjectedProps, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] extends GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] ? GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>] : TInjectedProps[Extract<keyof TInjectedProps, keyof GetProps<C>>] : GetProps<C>[Extract<keyof TInjectedProps, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]) | (Extract<number, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<number, keyof GetProps<C>>] : GetProps<C>[Extract<number, keyof GetProps<C>>]) | (Extract<symbol, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<symbol, keyof GetProps<C>>] : GetProps<C>[Extract<symbol, keyof GetProps<C>>])' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'Extract<string, keyof GetProps<C>> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] extends GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] ? GetProps<C>[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : TInjectedProps[keyof TInjectedProps & Extract<string, keyof GetProps<C>>] : GetProps<C>[Extract<string, keyof GetProps<C>>]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'keyof GetProps<C> & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] extends GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] ? GetProps<C>[keyof TInjectedProps & keyof GetProps<C> & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps<C> & string] : GetProps<C>[keyof GetProps<C> & string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps<C>[keyof TInjectedProps & string] ? GetProps<C>[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps<C>[string]' is not assignable to type '(TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never) | undefined'.
|
||||
>;
|
||||
|
||||
declare const connect: {
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
// @strict: true
|
||||
// @noEmit: true
|
||||
|
||||
type IsArray<T> = T extends unknown[] ? true : false;
|
||||
|
||||
function f1<T extends object>(x: IsArray<T>) {
|
||||
let t: true = x; // Error
|
||||
let f: false = x; // Error
|
||||
}
|
||||
|
||||
function f2<T extends unknown[]>(x: IsArray<T>) {
|
||||
let t: true = x;
|
||||
let f: false = x; // Error
|
||||
}
|
||||
|
||||
function f3<T extends string[]>(x: IsArray<T>) {
|
||||
let t: true = x;
|
||||
let f: false = x; // Error
|
||||
}
|
||||
|
||||
function f4<T extends Function>(x: IsArray<T>) {
|
||||
let t: true = x; // Error
|
||||
let f: false = x;
|
||||
}
|
||||
|
||||
type ZeroOf<T> =
|
||||
T extends null ? null :
|
||||
T extends undefined ? undefined :
|
||||
T extends string ? "" :
|
||||
T extends number ? 0 :
|
||||
T extends boolean ? false :
|
||||
never;
|
||||
|
||||
function f10<T extends {}>(x: ZeroOf<T>) {
|
||||
let t: "" | 0 | false = x;
|
||||
}
|
||||
|
||||
type Foo<T> = T extends "abc" | 42 ? true : false;
|
||||
|
||||
function f20<T extends string>(x: Foo<T>) {
|
||||
let t: false = x; // Error
|
||||
}
|
||||
|
||||
// Modified repro from #30152
|
||||
|
||||
interface A { foo(): void; }
|
||||
interface B { bar(): void; }
|
||||
interface C { foo(): void, bar(): void }
|
||||
|
||||
function test1<T extends A>(y: T extends B ? number : string) {
|
||||
if (typeof y == 'string') {
|
||||
y; // T extends B ? number : string
|
||||
}
|
||||
else {
|
||||
y; // never
|
||||
}
|
||||
const newY: string | number = y;
|
||||
newY; // string
|
||||
}
|
||||
|
||||
function test2<T extends A>(y: T extends B ? string : number) {
|
||||
if (typeof y == 'string') {
|
||||
y; // never
|
||||
}
|
||||
else {
|
||||
y; // T extends B ? string : number
|
||||
}
|
||||
const newY: string | number = y;
|
||||
newY; // number
|
||||
}
|
||||
|
||||
function test3<T extends A>(y: T extends C ? number : string) {
|
||||
if (typeof y == 'string') {
|
||||
y; // (T extends C ? number : string) & string
|
||||
}
|
||||
else {
|
||||
y; // T extends C ? number : string
|
||||
}
|
||||
const newY: string | number = y;
|
||||
newY; // string | number
|
||||
}
|
||||
|
||||
function test4<T extends A>(y: T extends C ? string : number) {
|
||||
if (typeof y == 'string') {
|
||||
y; // (T extends C ? string : number) & string
|
||||
}
|
||||
else {
|
||||
y; // T extends C ? string : number
|
||||
}
|
||||
const newY: string | number = y;
|
||||
newY; // string | number
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user