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

Babel 7 + Typescript - extracting declaration `d.ts` file on transpile #9668

Open
jaredvacanti opened this Issue Mar 12, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@jaredvacanti
Copy link

jaredvacanti commented Mar 12, 2019

Feature Request

Is your feature request related to a problem? Please describe.
When bundling a library with webpack using some light typescript (using Babel and ESLint with their respective typescript integrations), I'd like to emit the type declarations file alongside the library.

tsc is not invoked in the workflow currently, and doing so would require another tsconfig.json due to conflicting settings associated with the --emitDeclarationsOnly flag. If ESTree is handling the AST in order to remove the typescript and compile to es5, can the removed typescript be retained and extracted to a declarations file for later API consumption?

Describe the solution you'd like
An option to extract a declaration file

Describe alternatives you've considered
Currently I write a standalone declaration file (typically written to accompany projects written in javascript that are being incorporated into typescript projects).

@babel-bot

This comment has been minimized.

Copy link
Collaborator

babel-bot commented Mar 12, 2019

Hey @jaredvacanti! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@chrisblossom

This comment has been minimized.

Copy link

chrisblossom commented Mar 19, 2019

I would recommend creating an additional typescript config file tsconfig.types.json that extends your base tsconfig.json then running tsc --project tsconfig.types.json command during your build process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.