pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

Incremental strictNullChecks adoption: components/formBuilder/formBuilderHelpers.ts

Open fregante opened this issue 2 years ago • 1 comments

I've been skipping this file because I'm not sure of how you'd like to handle it:

https://github.com/pixiebrix/pixiebrix-extension/blob/main/src/components/formBuilder/formBuilderHelpers.ts

[3:45:34 PM] File change detected. Starting incremental compilation...

src/components/formBuilder/formBuilderHelpers.ts:185:5 - error TS18048: 'draft.schema.properties' is possibly 'undefined'.

185     draft.schema.properties[nextPropertyName] =
        ~~~~~~~~~~~~~~~~~~~~~~~

src/components/formBuilder/formBuilderHelpers.ts:185:5 - error TS2322: Type 'boolean | WritableDraft<JSONSchema7> | undefined' is not assignable to type 'boolean | WritableDraft<JSONSchema7>'.
  Type 'undefined' is not assignable to type 'boolean | WritableDraft<JSONSchema7>'.

185     draft.schema.properties[nextPropertyName] =
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/components/formBuilder/formBuilderHelpers.ts:186:7 - error TS18048: 'draft.schema.properties' is possibly 'undefined'.

186       draft.schema.properties[propertyName];
          ~~~~~~~~~~~~~~~~~~~~~~~

src/components/formBuilder/formBuilderHelpers.ts:187:12 - error TS18048: 'draft.schema.properties' is possibly 'undefined'.

187     delete draft.schema.properties[propertyName];
               ~~~~~~~~~~~~~~~~~~~~~~~

src/components/formBuilder/formBuilderHelpers.ts:224:33 - error TS18048: 'draft.schema.properties' is possibly 'undefined'.

224     const draftPropertySchema = draft.schema.properties[propertyName] as Schema;
                                    ~~~~~~~~~~~~~~~~~~~~~~~

src/components/formBuilder/formBuilderHelpers.ts:251:28 - error TS18048: 'rjsfSchema.schema.properties' is possibly 'undefined'.

251     const propertySchema = rjsfSchema.schema.properties[propertyName] as Schema;
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/components/formBuilder/formBuilderHelpers.ts:290:9 - error TS2322: Type '(JSONSchema7Type | undefined)[]' is not assignable to type 'JSONSchema7Type[]'.
  Type 'JSONSchema7Type | undefined' is not assignable to type 'JSONSchema7Type'.
    Type 'undefined' is not assignable to type 'JSONSchema7Type'.

290         draftPropertySchema.enum = Array.isArray(draftPropertySchema.oneOf)
            ~~~~~~~~~~~~~~~~~~~~~~~~

[3:45:34 PM] Found 7 errors. Watching for file changes.

Related:

  • https://github.com/pixiebrix/pixiebrix-extension/issues/6651

fregante avatar Oct 14 '23 07:10 fregante

This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.

github-actions[bot] avatar Feb 12 '24 00:02 github-actions[bot]