Regression of https://github.com/facebook/docusaurus/issues/2675
npx @docusaurus/init@next init my-website classic
Follow steps https://v2.docusaurus.io/docs/typescript-support#setup.
Rename src/pages/index.js to src/pages/index.tsx.
VSCode displays the following errors:
Hey,
We are still figuring out how to provide the best TypeScript experience in Docusaurus, by trying to use it first on Docusaurus 2 site itself.
@SamChou19815 has done some initial work, and you could probably get started by using a src/types.d.ts file containing:
/// <reference types="@docusaurus/module-type-aliases" />
/// <reference types="@docusaurus/theme-classic" />
We don't have much TS code in our website yet, but hopefully we'll migrate over time and be able to recommend a good TS setup to our users.
I like how CRA works. Including a TypeScript template in the init would be awesome.
Adding the src/types.d.ts didn't work.
The @docusaurus/module-type-aliases is outdated on npm (2.0.0-alpha.51). It doesn't declare those modules.
It has since been updated but not published to npm. Can someone publish?
https://github.com/facebook/docusaurus/blob/33ecc4bb1750ab00841b0dfeaee525e9f9d89498/packages/docusaurus-module-type-aliases/src/index.d.ts
I see, if you install it at the correct version it works. yarn add -D @docusaurus/[email protected]
Initializing a TS site is definitively something we want, and contributions are welcome (but this does not seem like an easy one as it requires more general better TS support)
But what we want more is i18n support and get out of alpha asap ;)
About packages, that's unfortunate that an alpha has been published as "current", you should install package with @next anyway, but hopefully this will be solved automatically when we move out of alpha ;)
this problem still appears to exist. Probably because the classic template doesn't have a tsconfig or anything. However, the tutorial that tells you that you can just use a tsx file if you want -uses the classic template and makes no mention of tsconfig
Most helpful comment
this problem still appears to exist. Probably because the classic template doesn't have a tsconfig or anything. However, the tutorial that tells you that you can just use a tsx file if you want -uses the classic template and makes no mention of tsconfig