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
By being explicit about undefined acceptance on optional properties, you could both enable support for the feature disabled and enabled at the same time:
Since the component does work with undefined being passed to it and its compatible, adding | undefined should be 100% always fine. But developers who have the option enabled can write code that differs in this terms, but still can use your library.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When enabled

exactOptionalPropertyTypes
in tsconfig, example:This is because checked is defined as follows:
By being explicit about
undefined
acceptance on optional properties, you could both enable support for the feature disabled and enabled at the same time:Since the component does work with
undefined
being passed to it and its compatible, adding| undefined
should be 100% always fine. But developers who have the option enabled can write code that differs in this terms, but still can use your library.Beta Was this translation helpful? Give feedback.
All reactions