TRAITS

explicit-undefined-in-optional-properties

For TypeScript optional properties, explicitly include undefined in the property type by default: readonly copyable?: boolean | undefined, not readonly copyable?: boolean. Omit the undefined union only when the API intentionally disallows explicitly passing undefined while still permitting omission.

Applies when
declaring optional properties.
Except
When every optional property under assessment intentionally permits omission but disallows explicitly passing undefined.
File types
  • TypeScript
  • TSX
ID
653d9c0c-bfe6-48cc-ad36-2171aa80695c
Source
.agents/traits/explicit-undefined-in-optional-properties-653d9c0c-bfe6-48cc-ad36-2171aa80695c.md

Skipping this trait

Add this comment before any code to skip the trait for a whole file. A reason is required.

File header
// traits-ignore-file 653d9c0c-bfe6-48cc-ad36-2171aa80695c: <reason>