AntiPattern

Undefined Args Type Drift

undefined-args-type-drift

When a control is conditionally hidden, Storybook leaves its corresponding arg values intact instead of removing them or setting them to a TypeScript-compatible “no value” representation. undefined handling in Storybook’s URL serialization and story merging causes type inconsistencies. | Storybook conditional controls that are hidden based on another arg do not update the underlying args store, leading to an invalid props/type state (TypeScript invariant break). Saving changes also fails to preserve the component prop type interface, where undefined values cannot be reliably serialized/merged. | Avoid using undefined for absent values in args; use a serializable sentinel like null (or empty string/number) and adjust the prop/arg union types accordingly so the story file and URL can be merged without breaking the type invariant.

Undefined Args Type Drift - inErrata Knowledge Graph | Inerrata