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

Emit declaration files for composite projects #1159

Open
Andarist opened this issue Jul 19, 2019 · 10 comments
Open

Emit declaration files for composite projects #1159

Andarist opened this issue Jul 19, 2019 · 10 comments
Labels

Comments

@Andarist
Copy link

Issue

Seems to me that the easiest thing one can do is run one tool at a time. So ideally I'd like to run only jest and have my monorepo just reference itself (its modules) when needed. I fail though when it comes to type checking (done within ts-jest), because composite packages needs packages on which they depend built to disk - otherwise they can't load them.

IMHO it would be nice to support this as it could work kinda out of the box then for the user. Having to run both tsc and jest at the same time feels kinda counter-productive.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jan 9, 2020

Hi, would you please explain clearly what is the issue/error you encountered and a repo to reproduce your issue ?

@ahnpnl ahnpnl added need minimal repo that reproduces this issue 🤷‍♂️ Needs More Info waiting for more information from author of the issue labels Jan 9, 2020
@Andarist
Copy link
Author

This is really more a feature request than a bug report.

Problem is that it's often useful for another tooling (like an editor) to have types written to disk (especially when working in a monorepo), so it would be good (in my opinion) to have declaration files being generated while type-checking with ts-jest to avoid separate processes just for this.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jan 11, 2020

does emit declaration file depend on tsconfig.json for composite project ?

@Andarist
Copy link
Author

Hm, not completely sure. Type-checking relies on it for sure, declaration files alone are not options-specific anyhow (I think?) so it actually could not rely on it. If my reasoning is correct then only options related to disk location are relevant - so to answer the question: yes, a little bit.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jan 11, 2020

how do you want ts-jest to do with this ? declaration files are only known to typescript. ts-jest cannot itself emit declaration files. Do you have any suggestions ?
From typescript doc, when using composite option, declaration must be turned on. It means typescript will always emit declaration. Since ts-jest just calls typescript compiler and use your tsconfig so emit declaration should work.

@Andarist
Copy link
Author

They are not, as you are using JS API for TypeScript this kind of thing would have to be implemented in ts-jest (using TypeScript APIs, not from scratch), it doesn't behave as if tsc would get called.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jan 12, 2020

I will close this in favor of #1336

@ahnpnl ahnpnl closed this as completed Jan 12, 2020
@ahnpnl ahnpnl added Enhancement ✨ and removed need minimal repo that reproduces this issue 🤷‍♂️ Needs More Info waiting for more information from author of the issue labels Feb 13, 2020
@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 14, 2020

Issue

Seems to me that the easiest thing one can do is run one tool at a time. So ideally I'd like to run only jest and have my monorepo just reference itself (its modules) when needed. I fail though when it comes to type checking (done within ts-jest), because composite packages needs packages on which they depend built to disk - otherwise they can't load them.

IMHO it would be nice to support this as it could work kinda out of the box then for the user. Having to run both tsc and jest at the same time feels kinda counter-productive.

@Andarist I think I might have an idea how to tackle this issue. Just to understand you correctly: your request is while running tests with ts-jest, you want to have at the same time type declaration files are written on disk, similar to running tsc before running tests

@ahnpnl ahnpnl added the 🚀 Feature Request new suggested feature label Apr 14, 2020
@Andarist
Copy link
Author

@ahnpnl yes, exactly that. This would allow for not having to generate type declarations in a separate watch process and they are useful for other tools (such as VScode when dealing with project references)

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 15, 2020

thanks for confirmation 👍 , I would say this feature request should be applicable for both monorepo and non-monorepo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants