fix(create-docusaurus): fix support for TypeScript 6.0 + fix our CI#11843
fix(create-docusaurus): fix support for TypeScript 6.0 + fix our CI#11843
Conversation
|
How about providing 2 configurations for 5.9 and 6.0+ for a while? {
"extends": "@docusaurus/tsconfig/v5",
"compilerOptions": {
"baseUrl": "."
}
}or {
"extends": "@docusaurus/tsconfig/v6"
} |
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
|
Size Change: +116 B (0%) Total Size: 11.9 MB ℹ️ View Unchanged
|
|
Size Change: +116 B (0%) Total Size: 12.3 MB ℹ️ View Unchanged
|
otherwise we can't resolve @site aliases
I don't really see the value in doing so. Until we fully transition to TS 6.0+, users will simply need to use In Docusaurus v4, we'll simply remove Since we'll drop support for TS 5 in Docusaurus v4, it wouldn't be very useful to have distinct configs, and TS 7 is supposed to have parity with v6 so we likely won't need different base configs for a while. |
|
I think I'll remove Our TS template has had it since 2021: #5437 We also show a local baseUrl config here in our v3.0 release notes when we introduced the new base config package: https://docusaurus.io/blog/releases/3.0#typescript
The former externalized base config also documents the need for baseUrl: https://github.com/tsconfig/bases#docusaurus-v2-tsconfigjson
And our setup page has documented this since v2.x: https://docusaurus.io/docs/2.x/typescript-support#setup For that reason, it seems safe to just remove it from our base config: I won't consider it as a breaking change since it's not supposed to affect anyone unless they don't follow our recommended setup on purpose, in which case it remains easy to fix. |
This reverts commit 0e7014a.
|
I was wrong, because our base config has: "paths": {
"@site/*": ["./*"]
},Unfortunately, it seems that paths are resolved relative to the current file's baseUrl, and not the local config baseUrl. To be able to remove the baseUrl everywhere, we could need to use something like: "paths": {
"@site/*": ["${configDir}/*"]
},Unfortunately, this requires TS 5.5+, and Docusaurus v3 supports TS 5.1+ Another solution would be to move the So, for now, let's keep the baseUrl: we'll do the cleanup later in Docusaurus v4. |


Motivation
Our CI validates against a range of TS versions, and recently broke after TS 6.0 got published
We want our
create-docusaurusTS template to upgrade to TS 6.0 and to keep workingUnfortunately, we have to add
ignoreDeprecations: "6.0"and keepbaseUrl: '.'to our base TS config and init template, since we want Docusaurus v3 to remain retrocompatible and not force our user base to upgrade to TS 6.0 if they are not ready.In Docusaurus v4, we'll remove the
baseUrlandignoreDeprecationsfrom our base config and init template.This PR also:
@types/nodefrom v18 to v20 (I forgot to do it)@types/webpack-envto get rid of some local declarationTest Plan
CI