Skip to main content
Version: Current (v7.0.0-beta.3)

An unannotated uiSchema variable no longer fits the typed options

Detect​

  • Your TypeScript code holds a uiSchema in a variable with no type annotation, and sets yearsRange or shape in it. Inference widens yearsRange: [2000, 2030] to number[] and shape: 'heart' to string, and the type checker rejects the variable where it is passed as a uiSchema.

Change​

Annotate the variable, or mark those values as const:

- const uiSchema = { 'ui:options': { yearsRange: [2000, 2030] } };
+ const uiSchema: UiSchema = { 'ui:options': { yearsRange: [2000, 2030] } };

Don't mark the whole uiSchema as const. That also makes arrays such as ui:order and ui:enumNames read-only, which don't fit.

Verify​

Also read: