splitType()function
splitType(type: string): { readonly members: readonly string[]; readonly optional: boolean }| Param | Type | |
|---|---|---|
type | string | The type expression to split (e.g. "Schemas<T> | DataSchema<T>"). required |
| Return | |
|---|---|
{ readonly members: readonly string[]; readonly optional: boolean } | The non- undefined members, plus whether an undefined member was dropped. |
Split a type expression on | into its individual union members.
- An
undefinedmember is dropped from display and instead flags the value as optional — we often write| undefinedexplicitly (e.g. forexactOptionalPropertyTypes, or to allow an explicitundefinedto trigger a default), which reads as noise in the docs. - When nothing but
undefinedis left, the members are kept as-is rather than emptied.