vuestorefront/vue-storefront

Type issue: Ref<UseBillingErrors> ' is not assignable to type 'null'. [Bug]:

Closed this issue · 0 comments

Describe the Bug

Issue

When more robust type checks are put into place via strict null checks, the compilation of the following packages | files fail to compile. Common issue "...is not assignable to parameter of type 'null | undefined'."

Instances in Core Package

  1. /core/core/src/factories/useBillingFactory.ts(23,7)
  2. /core/core/src/factories/useCartFactory.ts(48,7)

Message

/packages/core/core/src/factories/useBillingFactory.ts(23,7): semantic error TS2345: Argument of type '{ mainRef: Ref; alias: string; loading: Ref; error: Ref; }' is not assignable to parameter of type 'null | undefined'.

Type '{ mainRef: Ref; alias: string; loading: Ref; error: Ref; }' is not assignable to type 'null'.

Current behavior

Compilation wit TypeChecking disabled does not result in this behavior

Expected behavior

Types would be properly maintained within the key libraries of the code base

Steps to reproduce

Access the branch maintained by @jaydubb12 titled "feature/6602" remove the ts-ignore on line 23, and build the code base.

What version of Vue Storefront are you using?

2.5.0

What version of Node.js are you using?

16.13.1

What browser (and version) are you using?

Chrome

What operating system (and version) are you using?

MacOS

Relevant log output

src/factories/useBillingFactory.ts[!] (plugin rpt2) Error: /Users/jason.wolf/IdeaProjects/jaydubb12-vue-storefront/packages/core/core/src/factories/useBillingFactory.ts(23,7): semantic error TS2345: Argument of type '{ mainRef: Ref<BILLING>; alias: string; loading: Ref<boolean>; error: Ref<UseBillingErrors>; }' is not assignable to parameter of type 'null | undefined'.
  Type '{ mainRef: Ref<BILLING>; alias: string; loading: Ref<boolean>; error: Ref<UseBillingErrors>; }' is not assignable to type 'null'.
src/factories/useBillingFactory.ts

Able to fix / change the documentation?

  • Yes
  • No

Code of Conduct

  • I agree to follow this project's Code of Conduct