Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adjust Typescript definition export #5583

Merged
merged 1 commit into from
May 14, 2024
Merged

fix: Adjust Typescript definition export #5583

merged 1 commit into from
May 14, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented May 11, 2024

☑️ Resolves

Make sure Typescript definitions are correctly exported. Also export them from the package.

🖼️ Screenshots

🏚️ Before 🏡 After
Screenshot_20240511_153835 Screenshot_20240511_151519

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 3️⃣ Backport to next requested with a Vue 3 upgrade

@susnux susnux added bug Something isn't working 3. to review Waiting for reviews vue 3 Related to the vue 3 migration labels May 11, 2024
@susnux susnux added this to the 9.0.0-alpha.3 milestone May 11, 2024
@@ -39,22 +39,27 @@
"require": "./dist/index.cjs"
},
"./dist/Components/*.js": {
"types": "./dist/components/*/index.d.ts",
"import": "./dist/Components/*.mjs",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be so happy to get rid of the uppercase path...

@@ -607,7 +607,7 @@ export default defineComponent({
},

ncPopoverTriggerAttrs() {
return this.getNcPopoverTriggerAttrs()
return (this.getNcPopoverTriggerAttrs as () => Record<string, string|undefined>)()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using Options API it is always infered as unknown only Composition API (setup) will provide correct type information without any need to cast it here.

@@ -3,5 +3,5 @@
"compilerOptions": {
"rootDir": ".."
},
"include": ["./**/*.ts"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only need to reset the excludes from the root config

Make sure Typescript definitions are correctly exported.
Also export them from the package.

Signed-off-by: Ferdinand Thiessen <[email protected]>
Comment on lines -107 to +116
libraryFormats: ['es', 'cjs'],
libraryFormats: ['cjs', 'es'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure Typescript definitions are emitted for ESM output (overwrites the CJS)

@ShGKme ShGKme mentioned this pull request May 13, 2024
Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine

@susnux susnux merged commit c449d82 into next May 14, 2024
18 checks passed
@susnux susnux deleted the fix/types branch May 14, 2024 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working vue 3 Related to the vue 3 migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants