vue-storefront icon indicating copy to clipboard operation
vue-storefront copied to clipboard

void' is not assignable to type '(callback: Function)

Open jaydubb12 opened this issue 4 years ago • 0 comments
trafficstars

Package

@vue-storefront/[email protected]

Current behavior

When incremental compilation checks are added to path packages/core/core a compilation error is produced on the file at "packages/core/core/src/utils/ssr/index.ts"

Error

semantic error TS2322: Type '(fn: () => void) => void' is not assignable to type '(callback: Function) => void'. Types of parameters 'fn' and 'callback' are incompatible. Type 'Function' is not assignable to type '() => void'. Type 'Function' provides no match for the signature '(): void'.

Root Cause

When the package's tsconfig is configured to perform strict null checks, this issue / error is surfaced.

Additional Consideration

The resulting changes to the type system and lines of code are somewhat complex and add bytes to the overall package, which may not inherently add value if there is appropriate test coverage to ensure that the scripts and features work.

On the other hand, resolving the issue does provide a code base that better adheres to the Typescript standards and practices.

Expected behavior

Compilation would complete without error

Steps to reproduce the issue

  1. Navigate to tsconfig at "packages/core/core/src/utils/ssr/index.ts"
  2. Set compiler option "strictFunctionTypes" to true
  3. Execute compilation on package at "packages/core/core"

Version of Vue Storefront

  • [ ] Vue Storefront
  • [X] Vue Storefront Next

Can you handle fixing this bug by yourself?

  • [x] YES
  • [ ] NO

Which Release Cycle state this refers to? Info for developer. (doesn't apply to Next)

Pick one option.

  • [ ] This is a bug report for test version on https://test.storefrontcloud.io - In this case Developer should create branch from develop branch and create Pull Request 2. Feature / Improvement back to develop.
  • [ ] This is a bug report for current Release Candidate version on https://next.storefrontcloud.io - In this case Developer should create branch from release branch and create Pull Request 3. Stabilisation fix back to release.
  • [ ] This is a bug report for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version hotfix - In this case Developer should create branch from hotfix or master branch and create Pull Request 4. Hotfix back to hotfix.

Environment details

[email protected] [email protected] [email protected] IDE@[email protected]

Additional information

None

jaydubb12 avatar Jul 20 '21 17:07 jaydubb12