Fix type-only exports#748
Conversation
|
This is interesting, it did not act like this before. But also a bit dangerous since I have to go through inferfaces now and see whether we need something as concrete and not just type. |
|
I'm assuming this just affects classes, since |
|
@cenk1cenk2 what do you think about merging only this change as-is to start? Or, if that's not ok, what would you like to see here before merging? |
|
Hey @karlhorky, Sorry for the delay, I do not get what is the difference between moving the type export exactly as a type export from a file to the index. Does this solve your issue? |
|
Yes, it resolves my issue - I built locally and tested this (also mentioned in the PR description above): The previous version didn't work: #747 (comment) I don't know what the difference is either, but I would assume that Current (broken)
export * from './interfaces'
export type { Task as ListrTaskObject, TaskWrapper as ListrTaskWrapper } from '@lib'Output: export { ... TaskWrapper as ListrTaskWrapper, ...After this PR (fixed)
export { ... type Task as ListrTaskObject, type TaskWrapper as ListrTaskWrapper } from './lib'Output (note the export { ... type TaskWrapper as ListrTaskWrapper, ... |
|
Thank you for the explanation yet again. |
|
Reported the |
|
@cenk1cenk2 if you would publish a new release with this change, I'll take a look to verify it's working. |
|
Ah i see it did not match eoth the commits so did not publish, sorry missed that. I will trigger one when infront of computer. Sorry for that. |
|
🎉 This PR is included in version 9.0.4 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 3.0.4 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 3.0.4 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 3.0.4 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
|
Nice, thanks for the release! I can confirm that
|

Closes #745
The previous approaches didn't lead to
dist/index.d.tscontaining thetypekeyword in the exports forListrTaskObjectandListrTaskWrapper:verbatimModuleSyntax: trueintsconfig.json#745 (comment)typekeyword to export to avoid runtime class exports #747 (comment)This appears to be caused by the
export * from './interfaces'here, which converts the type-only exports into non-type-only exports:listr2/packages/listr2/src/index.ts
Line 6 in c9572dc
I tried a new approach, of using the
typekeyword at the top-levelsrc/index.tsfile, and that appears to generate the correct types indist/index.d.ts.Proof (
typekeywords indist/index.d.ts):