Skip to content

Add type keyword to export to avoid runtime class exports#747

Merged
cenk1cenk2 merged 2 commits into
listr2:masterfrom
karlhorky:patch-2
Aug 21, 2025
Merged

Add type keyword to export to avoid runtime class exports#747
cenk1cenk2 merged 2 commits into
listr2:masterfrom
karlhorky:patch-2

Conversation

@karlhorky

@karlhorky karlhorky commented Aug 21, 2025

Copy link
Copy Markdown
Contributor

Closes #745

Maybe this is what tsc / tsdown need to get the type keyword into the export in dist/index.d.ts, via one of:

  • export type { TaskWrapper as ListrTaskWrapper };
  • export { type TaskWrapper as ListrTaskWrapper };

If this approach doesn't work, then maybe TaskWrapper as ListrTaskWrapper is exported somewhere else in the codebase as class?

@cenk1cenk2

Copy link
Copy Markdown
Member

Hey Karl,

This was like this before the recent changes.

Do you want to revert this back?

@karlhorky

karlhorky commented Aug 21, 2025

Copy link
Copy Markdown
Contributor Author

I'm not sure what tsc / tsdown needs to get the type keyword into the export in dist/index.d.ts in the published source.

Currently, dist/index.d.ts looks like this - no type keyword:

export { ... TaskWrapper as ListrTaskWrapper, ... }

I was just thinking that maybe the type keyword was needed in the export as well, but maybe that also does not work?

Alternatively, as I wrote above, if this approach doesn't work, then I could imagine that maybe TaskWrapper as ListrTaskWrapper is exported somewhere else in the codebase as class?

@cenk1cenk2
cenk1cenk2 merged commit c9572dc into listr2:master Aug 21, 2025
5 checks passed
@cenk1cenk2

Copy link
Copy Markdown
Member

Let us give it a try since it is nothing descructive.

@karlhorky

karlhorky commented Aug 21, 2025

Copy link
Copy Markdown
Contributor Author

If CI could show us the results of tsdown + all other publishing steps (eg. via CodeSandbox CI - I can recommend this), then that would help with validating the PR by building + publishing a version from each commit in the PR before merging.

Example of CodeSandbox CI here:

This empty object in .codesandbox/ci.json is the only code change that I needed to do to set it up:

For listr2, probably the packages config option would need to be configured.

@karlhorky

Copy link
Copy Markdown
Contributor Author

But yeah, since this is already merged, I'll keep an eye on the releases and test out the next version, maybe [email protected]

@karlhorky

karlhorky commented Aug 21, 2025

Copy link
Copy Markdown
Contributor Author

@cenk1cenk2 I tried the build out locally, to avoid waiting for the published version, and it still doesn't add the type keyword.

But this version looks like it works:

@karlhorky karlhorky mentioned this pull request Aug 21, 2025
@cenk1cenk2

Copy link
Copy Markdown
Member

🎉 This PR is included in version 9.0.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@cenk1cenk2

Copy link
Copy Markdown
Member

🎉 This PR is included in version 3.0.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@cenk1cenk2

Copy link
Copy Markdown
Member

🎉 This PR is included in version 3.0.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@cenk1cenk2

Copy link
Copy Markdown
Member

🎉 This PR is included in version 3.0.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: no error with runtime ListrTaskWrapper import with verbatimModuleSyntax: true in tsconfig.json

2 participants