#TypeScript strict mode causing false positive errors from node_modules Vue components

4 messages · Page 1 of 1 (latest)

plush haven
#
Found 46 errors in 11 files.

Errors  Files
     3  node_modules/@agorastore/shared-ui/dist/runtime/components/layout/AppBanner.vue:12
    20  node_modules/@agorastore/shared-ui/dist/runtime/components/utils/input/FileDropZone.vue:137
     3  node_modules/@agorastore/shared-ui/dist/runtime/lib/data-list/components/table/ColumnConfig.vue:17
     1  node_modules/@agorastore/shared-ui/dist/runtime/lib/data-list/components/utils/FilterValuesPreview.vue:41
     2  node_modules/@agorastore/shared-ui/dist/runtime/lib/form/components/field/ArrayListField.vue:53
     1  node_modules/@agorastore/shared-ui/dist/runtime/lib/form/components/field/ArrayTabField.vue:51
     3  node_modules/@agorastore/shared-ui/dist/runtime/lib/form/components/field/CheckboxCardField.vue:18
     1  node_modules/@agorastore/shared-ui/dist/runtime/lib/form/components/field/PhoneNumberField.vue:151
     1  node_modules/@agorastore/shared-ui/dist/runtime/lib/form/components/field/UploadField.vue:23
     6  node_modules/@agorastore/shared-ui/dist/runtime/lib/form/components/renderer/StepperRenderer.vue:10
     5  node_modules/@agorastore/shared-ui/dist/runtime/lib/wizard/components/Wizard.vue:27
#
node_modules/@agorastore/shared-ui/dist/runtime/lib/form/components/renderer/StepperRenderer.vue:13:7 - error TS18048: 'currentStep' is possibly 'undefined'.

13   if (currentStep._status === StepStatus.INVALID) return 'error'
         ~~~~~~~~~~~

node_modules/@agorastore/shared-ui/dist/runtime/lib/form/components/renderer/StepperRenderer.vue:131:41 - error TS18048: '__VLS_ctx.activeStep' is possibly 'undefined'.

131       <component :is="() => renderVNode(activeStep.title ?? '')" />
                                            ~~~~~~~~~~

node_modules/@agorastore/shared-ui/dist/runtime/lib/form/components/renderer/StepperRenderer.vue:138:41 - error TS18048: '__VLS_ctx.activeStep' is possibly 'undefined'.

138       <component :is="() => renderVNode(activeStep.description ?? '')" />
                                            ~~~~~~~~~~

node_modules/@agorastore/shared-ui/dist/runtime/lib/wizard/components/Wizard.vue:27:12 - error TS2532: Object is possibly 'undefined'.

27   default: steps.value[0].key as StepKey,
              ~~~~~~~~~~~~~~

node_modules/@agorastore/shared-ui/dist/runtime/lib/wizard/components/Wizard.vue:42:41 - error TS2532: Object is possibly 'undefined'.

42   isFirstStep: currentStepKey.value === steps.value[0].key,
                                           ~~~~~~~~~~~~~~

node_modules/@agorastore/shared-ui/dist/runtime/lib/wizard/components/Wizard.vue:43:40 - error TS2532: Object is possibly 'undefined'.

43   isLastStep: currentStepKey.value === steps.value[steps.value.length - 1].key
                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@agorastore/shared-ui/dist/runtime/lib/wizard/components/Wizard.vue:82:5 - error TS2322: Type 'StepKey | undefined' is not assignable to type 'StepKey'.
  'StepKey' could be instantiated with an arbitrary type which could be unrelated to 'StepKey | undefined'.

82     currentStepKey.value = stepKeys.value[nextStepIndex]
       ~~~~~~~~~~~~~~~~~~~~
#

Here's an example of code that throws a ts error :

 <NP
      v-if="activeStep?.description"
      :depth="3"
      class="!m-0"
    >
      <component :is="() => renderVNode(activeStep.description ?? '')" />
    </NP>

Here, I do check if activeStep.description exists beforehand, so we can do activeStep.description without ?., works fine in

plush haven
#

!close