WidenNames<R extends string, N extends string>

type
types.ts:1928

The slice-name union after adding N.

The string extends N guard is load-bearing. Passing a string-typed variable rather than a literal would otherwise widen the union to string, and every S[R1] lookup downstream would resolve to the union of every slice's state - silently destroying useAtomicProp inference across the whole application. Degrading to "no widening" is the safe failure.

Definition

type
type WidenNames<R extends string, N extends string> = string extends N ? R : R | N

string extends N ? R : R | N

Type parameters

NameTypeDescription
Rextends string
Nextends string