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

Feature: Use api-extractor when generating the .d.ts files for distribution #5921

Open
etrepum opened this issue Apr 18, 2024 · 4 comments
Open
Labels
enhancement Improvement over existing feature packaging

Comments

@etrepum
Copy link
Contributor

etrepum commented Apr 18, 2024

It's easy to make a mistake that will export an internal type. TypeScript doesn't seem to have any options to roll-up or inline types, but they do suggest using api-extractor in the stripInternal docs.

I have a hotfix up in #5920 to address #5918, this would be the better long-term solution.

tsup might be worth looking into as an alternative as well

@StyleT
Copy link
Contributor

StyleT commented Apr 26, 2024

Short summary here of my research done in #5920:

  • tsup doesn't work well because:
  • dts-bundle-generator is painfully slow and requires excessive configuration as it doesn't works same was as tsc
  • api-extractor fails to figure out types for vars where we do destruction (known issue)
  • rollup-plugin-ts requires rollup 3.x+ and has same issues as tsup except last one

@StyleT
Copy link
Contributor

StyleT commented Apr 26, 2024

So likely some custom solution (probably based on rollup-plugin-ts) needed here

@etrepum
Copy link
Contributor Author

etrepum commented Apr 26, 2024

Is tsc's hardcoded esnext target a problem in our situation? I don't recall running into any issue with it when I prototyped it locally, but invoking tsup for each package is very much noticeably slower running tsc over the whole repository (tsup for even a single package seemed slower than the whole-repo tsc). Fixing up the output is not that big of a deal so long as we are certain about what to remove.

Trying rollup-plugin-ts sounds like a pretty good idea though, especially if it can be combined with the existing rollup usage which would hopefully be more performant.

@StyleT
Copy link
Contributor

StyleT commented Apr 27, 2024

Yeah, I got TS errors as ESNext is more strict comparing to the target lexical uses now.
Not all packages had them, but lexical did

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement over existing feature packaging
Projects
None yet
Development

No branches or pull requests

2 participants