You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Three remaining false rejections in ark/type/declare.ts (related to #1483):
Repros
// 1. Optional and variadic tuple elements (S11)type.declare<[string,number?]>().type(["string","number?"])// declared: number | undefined, inferred: numbertype.declare<[string, ...number[]]>().type(["string","...","number[]"])// rejected// 2. Object union member with assignable: true (S12)typeU={kind: "a";a: string}|{kind: "b";b: number}type.declare<U,{assignable: true}>().type({kind: "'a'",a: "string"})// TS2353: 'a' does not exist in type '{ kind: unknown }'// 3. Default on a declared-optional key with side: "in" (S13)type.declare<{a?: number},{side: "in"}>().type({a: "number = 1"})// "did you mean 'a?'" ("a?" cannot hold a default)
Causes & Fixes
S11 (ark/type/declare.ts:79-92validateArrayInference): Maps declared tuple index-by-index against declared[i] (which includes undefined for optional slots) and misaligns "..." rest elements. Compare optional elements against Required<declared>[i] and fall back to equals<inferDefinition<def>, declared> when "..." is present.
S12 (ark/type/declare.ts:101-135validateObjectKeys): Extracts requiredKeyOf<declared> over the union as a whole so non-shared keys vanish. Distribute declaredObjectOf over union members when assignable: true.
S13 (ark/type/declare.ts:230declaredOptionalKeySuggestion): Only permits OptionalPropertyDefinition; allow defaultable definitions (${string} = ${string} / [def, "=", v]) when side is "in".
Activity
fix(type): fix declare tuple distribution, generic defaulted constrai…
fix(type): resolve recursive readonly distill, variant/generic ergono…
ssalbdivad commentedon Dec 3, 2026
all three
type.declareitems (tuple optional/variadic, assignable unions,side: "in") were fixed in 3.0.0 (2c65fce4c,fdcb8704c) — closing.