Skip to content
Discussion options

You must be logged in to vote

The issue here is the NonNullable type helper we use internally, which strips the explicit enumeration of values for autocompletion.

Runtime-wise, either is correct as it will accept any string, as defined by the type, but for some reason:

type ColorType = 'red' | 'green' | 'blue'  | (string & {});

type A = NonNullable<ColorType> // string
type B = Exclude<ColorType, null | undefined> // 'red' | 'green' | 'blue'  | (string & {});

This would also cause the same issue with the Prettify helper we use to resolve types in useQueryStates and other features.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by GrahamQuan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants