builder
builder copied to clipboard
`@builder.io/sdk-vue` is not properly reporting type declarations in `package.json`, causing type errors
Describe the bug
@builder.io/sdk-vue
is not properly reporting its type declarations in the output package.json
. The .d.cts
files exist, but they appear to not be configured in the exports
object. This causes a TS7016 error as shown below:
TS7016: Could not find a declaration file for module @builder.io/sdk-vue.
.../node_modules/.pnpm/@[email protected][email protected]/node_modules/@builder.io/sdk-vue/lib/browser/index.js
implicitly has an any type.
There are types at .../node_modules/@builder.io/sdk-vue/lib/node/index.d.cts, but this result could not be resolved when respecting package.json exports. The @builder.io/sdk-vue library may need to update its package.json or typings.
According to: https://github.com/BuilderIO/builder/blob/46a8ba4c0f577f2539fd649f1194cc65746912c7/packages/sdks/output/vue/package.json#L45-L48
It might be possible to fix this by adding a types
key to each export referencing the .d.cts
file.
To Reproduce
Steps to reproduce the behavior:
- Use
@builder.io/sdk-vue
in an environment with a type checker (such asvue-tsc
) - Attempt to reference an export from
@builder-io/sdk-vue
. - Run the type checker if it was not done automatically during dev/build.
Expected behavior
Type checking and TypeScript IDE features function properly.
Screenshots
@Joepocalyptic thanks for the detailed report!
@samijaber can you take a look please?
Hi! Just wondering if there was any progress on this?
@Joepocalyptic Can you try 1.0.28? It includes a fix for ESM types
https://github.com/BuilderIO/builder/blob/main/packages/sdks/output/vue/CHANGELOG.md#1028
Marking this as closed given the fix made above.