-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
fix(create-docusaurus): Fix TS issues on newly initialized sites #10694
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
Size Change: +350 B (0%) Total Size: 11.2 MB ℹ️ View Unchanged
|
Size Change: +340 B (0%) Total Size: 11.7 MB ℹ️ View Unchanged
|
"types": [ | ||
"node", | ||
"@docusaurus/module-type-aliases", | ||
"@docusaurus/theme-classic" | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Josh-Cena any opinion on this removal?
I thought types
added packages for TS to look at, but it turns out it's the opposite and it restricts TS to only look at these types.
https://www.typescriptlang.org/tsconfig/#types
I misunderstood this config initially and not sure why we would use this instead of just having explicit dependencies. 🤔
More historical context about our TS preset is available here:
- https://github.com/tsconfig/bases/blob/main/bases/docusaurus.json
- Add docusaurus tsconfig/bases#27
- Add @docusaurus/theme-classic to compilerOptions.types tsconfig/bases#70
Wondering if this is safe to be considered as a bugfix for v3, or if I should change this later for v4.
The alternative is that our init template has to depend on @docusaurus/theme-classic
+ @types/node
just because of pnpm (maybe yarn berry pnp too but tsc is disabled in CI atm):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to ship this in next patch and consider it a bugfix
Although it's not 100% retro-compatible, I think it's fine to consider that a site that use types without explicitly depending on them is a buggy site, and that it's ok to break TS typechecking for such sites and recommend site owners to add the missing dependencies.
If this was a bad decision, we can revert it.
* fix(deps): update dependencies (non-major) * fix(website-tsconfig): add docusaurus types manually More details on facebook/docusaurus#10694. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: sabertazimi <[email protected]>
* fix(deps): update dependencies (non-major) * fix(website-tsconfig): add docusaurus types manually More details on facebook/docusaurus#10694. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: sabertazimi <[email protected]> 56f6d70
* fix(deps): update dependencies (non-major) * fix(website-tsconfig): add docusaurus types manually More details on facebook/docusaurus#10694. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: sabertazimi <[email protected]>
* fix(deps): update dependencies (non-major) * fix(website-tsconfig): add docusaurus types manually More details on facebook/docusaurus#10694. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: sabertazimi <[email protected]> 6b000de
For anyone passing by and seeing TS errors appearing in v3.6.2, check this comment: #10733 (comment) |
Motivation
Surprisingly, our e2e test suite only runs TS type-check for yarn berry (node linker only).
CI e2e tests should type-check the newly initialized sites to ensure no site is initialized with any TS errors
Fix #9080
Test Plan
CI