dillonchanis / vue-error-boundary

A reusable error boundary component for catching JavaScript errors and displaying fallback UIs.
MIT License
91 stars 9 forks source link

Adds types to package.json export definition #14

Closed buggedcom closed 9 months ago

buggedcom commented 9 months ago

We have a frontend monorepo and due to how the tsconfig and vite config is setup we are getting issues where the types do not exist in the export so the builds fail type checks. For example:

vue-tsc --noEmit && vite build

src/ErrorBoundary.vue:10:28 - error TS7016: Could not find a declaration file for module 'vue-error-boundary'. '/Users/ollie/Repos/easyagvsystem/Source/FleetControllerFrontend/node_modules/vue-error-boundary/dist/vue-error-boundary.es.js' implicitly has an 'any' type.
  There are types at '/Users/ollie/Repos/easyagvsystem/Source/FleetControllerFrontend/node_modules/vue-error-boundary/dist/src/VErrorBoundary.d.ts', but this result could not be resolved when respecting package.json "exports". The 'vue-error-boundary' library may need to update its package.json or typings.

10 import VErrorBoundary from 'vue-error-boundary';
                              ~~~~~~~~~~~~~~~~~~~~

Found 1 error in src/ErrorBoundary.vue:10

npm ERR! Lifecycle script `build` failed with error: 
npm ERR! Error: command failed 

This commit adds the support required with no breaking changes for anything else as it still refers to the same type definitions as defined in the "types" property and increments a version bump.

dillonchanis commented 9 months ago

Looks great, I appreciate it!