Subissue of #229.
ADR-065 documents what an absent nullable means on a prop:
true for StringProp, NumberProp, SlotProp, ImageProp — open value sets
false for EnumProp — enum enumerates every accepted value
Three consumers predate that and read omission as not-nullable, which inverts the documented default:
specs/packages/cli/src/transforms/Contract.ts:72 — an omitted nullable emits label: string where string | null is meant, for essentially every non-enum string prop
specs/packages/cli/src/analyzers/Props.ts:123 — reports omission as non-nullable
specs-from-figma/packages/react-from-specs/src/React — ignores nullable entirely; only slot props get optional treatment in scaffold.ts:157
Scope
- Apply the per-type default in all three, rather than testing for an explicit
true
- Generated contracts will widen to include
null for open-valued props — expected, and the correction; regenerate fixtures
- Use nullability when deriving React prop optionality
Depends on
Schema side ships in @directededges/specs-schema 0.29.0 (PR #273).
Subissue of #229.
ADR-065 documents what an absent
nullablemeans on a prop:trueforStringProp,NumberProp,SlotProp,ImageProp— open value setsfalseforEnumProp—enumenumerates every accepted valueThree consumers predate that and read omission as not-nullable, which inverts the documented default:
specs/packages/cli/src/transforms/Contract.ts:72— an omittednullableemitslabel: stringwherestring | nullis meant, for essentially every non-enum string propspecs/packages/cli/src/analyzers/Props.ts:123— reports omission as non-nullablespecs-from-figma/packages/react-from-specs/src/React— ignoresnullableentirely; only slot props get optional treatment inscaffold.ts:157Scope
truenullfor open-valued props — expected, and the correction; regenerate fixturesDepends on
Schema side ships in
@directededges/specs-schema0.29.0 (PR #273).