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

SchemaUtilsType gains canExpand and allowsAdditionalProperties

Detect​

  • Your code has a class or object typed as SchemaUtilsType that you wrote yourself, rather than one createSchemaUtils() returns.
  • The type checker reports Type 'MySchemaUtils' is missing the following properties from type 'SchemaUtilsType<...>': allowsAdditionalProperties, canExpand (the exact list and type arguments depend on your code).

Change​

Add both methods. They answer with the form's own SchemaContext, which now carries the additionalPropertiesWhenAbsent setting, so delegate to an instance from createSchemaUtils() if you can:

class MySchemaUtils implements SchemaUtilsType {
+ canExpand(schema, uiSchema, formData) {
+ return this.inner.canExpand(schema, uiSchema, formData);
+ }
+ allowsAdditionalProperties(schema) {
+ return this.inner.allowsAdditionalProperties(schema);
+ }
}

Verify​

Also read: