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

TypeScript checking for the monorepo during development #18249

Closed
okonet opened this issue May 18, 2022 · 3 comments
Closed

TypeScript checking for the monorepo during development #18249

okonet opened this issue May 18, 2022 · 3 comments
Labels
maintenance User-facing maintenance tasks

Comments

@okonet
Copy link
Contributor

okonet commented May 18, 2022

Is your feature request related to a problem? Please describe

While working on some PRs I've noticed that there is no type checks in place between packages.

For example, while having https://github.com/storybookjs/storybook/blob/ca2441260bdf2eaf29e6cf58d34bde60856ca7e9/lib/components/src/syntaxhighlighter/syntaxhighlighter.tsx open and removing

[key: string]: any;

I would expect syntaxhighlighter.tsx to get a TS error but it doesn't.

This is happening because the bootstrap script pre-builds all the packages and later on, other packages depend on the compiled code. So there is no static analysis outside of the package being currently edited.

Describe the solution you'd like

One of the main benefits of the monorepo is to get integrated code earlier on. Type checking is the crucial part of it and the shorter the feedback loop is the better. While working on #18146 I was certain I'm done with the refactoring only to realize I broke a lot of usages after I pushed my code to GitHub and waited for CI to finish.

I would define the requirements as follows:

  • Type checking of the whole monorepo (or at least major parts of it) while working locally
  • IDEs should be able to resolve to proper packages not /dist when "Go to declaration" is used
  • Refactorings in editors should work across all packages
  • Ideally, without the need to re-compile the whole project's source code
  • Faster compilation times of packages (probably out of scope but who knows)

Describe alternatives you've considered

See #18194 after reading the following:

but I didn't succeed to make it work.

Are you able to assist to bring the feature to reality?

Yes

@Andarist
Copy link
Contributor

This is happening because the bootstrap script pre-builds all the packages and later on, other packages depend on the compiled code. So there is no static analysis outside of the package being currently edited.

This should be solvable with project references - in fact with them you shouldn't even have to prebuild anything to get a good IDE experience. However, prebuilding + recompiling on watch might be better for startup times and overall performance. YMMV, it depends on the size of the monorepo in question

@Andarist
Copy link
Contributor

Andarist commented Jun 7, 2022

@ndelangen out of curiosity - what did you end up with? I couldn't quickly find a related PR

@shilman shilman added maintenance User-facing maintenance tasks and removed feature request needs triage labels Jun 7, 2022
@okonet
Copy link
Contributor Author

okonet commented Jun 7, 2022

I’m also curious! 😁

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

No branches or pull requests

4 participants