Part of #226. After the conditional-relation round (deferred-conditional constraints, conditional↔conditional rule, distributivity flag), conditionalTypes1.ts is the last conditional-cluster Fail. Its diff is down to three independent feature areas (baseline-relative lines):
1. Mapped-type relation rules — f7/f8 (missing TS2322@106/108/115/117, extra @105/107/112/113)
FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>> and the { [K in keyof T]: T[K] extends Function ? K : never }[keyof T] key-filter idiom. tsc relates these through:
- source
T → homomorphic mapped target Pick<T, K> when K ⊆ keyof T (so y = x / z = x are OK),
- structural comparison of two deferred mapped/indexed key-filter types with DIFFERENT conditional templates (
FunctionPropertyNames<T> vs NonFunctionPropertyNames<T> must be incompatible both ways),
FunctionPropertyNames<T> → keyof T via the [keyof T] index upper bound (so x = y / x = z are OK).
We currently get the polarity roughly inverted (accept what tsc rejects in f7's cross-assignments, reject the keyof-upper-bound directions in f8).
2. DeepReadonly / readonly-mapped enforcement — f10 (missing TS2540@134, TS2542@135, TS2540@136, TS2339@137; extra TS2312@125, TS7053@131/133/136, TS2349@137)
Needs, in order:
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {} accepted (we emit TS2312 — ReadonlyArray isn't modeled as an extendable interface),
DeepReadonly<Part> evaluating through T extends any[] / T extends object to DeepReadonlyObject<Part> — a mapped type whose keys filter through NonFunctionPropertyNames<Part> (drops updatePart → TS2339@137) ,
- readonly enforcement: assignment to a readonly mapped property = TS2540, write through a readonly index signature = TS2542.
3. Assignment narrowing for generic vars with union constraints (extra TS2322@18)
function f2<T extends string | undefined>(x: T, y: NonNullable<T>) {
x = y;
let s1: string = x; // tsc: NO error — x narrowed to `string` by the assignment
}
tsc narrows a reference whose declared type is a type parameter with a union constraint by assignment (the constraint is the narrowing domain). We don't narrow, so s1 = x reports the constraint error.
4. TS2403@263 — filed separately as #336 (annotation-only duplicate var skips the redeclaration check; the distributivity identity half is already in place).
Items 1+2 are the bulk and overlap with the mapped-type machinery the type-AST migration keeps routing toward; recommend treating them as one mapped-types round.
Part of #226. After the conditional-relation round (deferred-conditional constraints, conditional↔conditional rule, distributivity flag),
conditionalTypes1.tsis the last conditional-cluster Fail. Its diff is down to three independent feature areas (baseline-relative lines):1. Mapped-type relation rules — f7/f8 (missing TS2322@106/108/115/117, extra @105/107/112/113)
FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>and the{ [K in keyof T]: T[K] extends Function ? K : never }[keyof T]key-filter idiom. tsc relates these through:T→ homomorphic mapped targetPick<T, K>whenK ⊆ keyof T(soy = x/z = xare OK),FunctionPropertyNames<T>vsNonFunctionPropertyNames<T>must be incompatible both ways),FunctionPropertyNames<T>→keyof Tvia the[keyof T]index upper bound (sox = y/x = zare OK).We currently get the polarity roughly inverted (accept what tsc rejects in f7's cross-assignments, reject the keyof-upper-bound directions in f8).
2. DeepReadonly / readonly-mapped enforcement — f10 (missing TS2540@134, TS2542@135, TS2540@136, TS2339@137; extra TS2312@125, TS7053@131/133/136, TS2349@137)
Needs, in order:
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}accepted (we emit TS2312 — ReadonlyArray isn't modeled as an extendable interface),DeepReadonly<Part>evaluating throughT extends any[] / T extends objecttoDeepReadonlyObject<Part>— a mapped type whose keys filter throughNonFunctionPropertyNames<Part>(dropsupdatePart→ TS2339@137) ,3. Assignment narrowing for generic vars with union constraints (extra TS2322@18)
tsc narrows a reference whose declared type is a type parameter with a union constraint by assignment (the constraint is the narrowing domain). We don't narrow, so
s1 = xreports the constraint error.4. TS2403@263 — filed separately as #336 (annotation-only duplicate
varskips the redeclaration check; the distributivity identity half is already in place).Items 1+2 are the bulk and overlap with the mapped-type machinery the type-AST migration keeps routing toward; recommend treating them as one mapped-types round.