mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
refactor: clean Canny integration + rename 'Feedback' to 'Feature Requests' + improve TS doc page (#5389)
* Better Canny integration * Add missing netlify redirects * polish * TS doc: mention it's possible to use JSDoc in config * issue templates: use /feature-requests new url
This commit is contained in:
parent
974644d16b
commit
f40ce05102
16 changed files with 95 additions and 66 deletions
|
@ -183,4 +183,4 @@ In comparison with statically generated HTML and interactivity added using `<scr
|
|||
|
||||
If you find issues with the documentation or have suggestions on how to improve the documentation or the project in general, please [file an issue](https://github.com/facebook/docusaurus) for us, or send a tweet mentioning the [@docusaurus](https://twitter.com/docusaurus) Twitter account.
|
||||
|
||||
For new feature requests, you can create a post on our [Canny board](/feedback), which is a handy tool for roadmapping and allows for sorting by upvotes, which gives the core team a better indicator of what features are in high demand, as compared to GitHub issues which are harder to triage. Refrain from making a Pull Request for new features (especially large ones) as someone might already be working on it or will be part of our roadmap. Talk to us first!
|
||||
For new feature requests, you can create a post on our [feature requests board (Canny)](/feature-requests), which is a handy tool for roadmapping and allows for sorting by upvotes, which gives the core team a better indicator of what features are in high demand, as compared to GitHub issues which are harder to triage. Refrain from making a Pull Request for new features (especially large ones) as someone might already be working on it or will be part of our roadmap. Talk to us first!
|
||||
|
|
|
@ -3,6 +3,8 @@ id: typescript-support
|
|||
title: TypeScript Support
|
||||
---
|
||||
|
||||
Docusaurus is written in TypeScript, and provide first-class TypeScript support.
|
||||
|
||||
## Initialization {#initialization}
|
||||
|
||||
Docusaurus supports writing and using TypeScript theme components. If the init template provides a Typescript variant, you can directly initialize a site with full TypeScript support by using the `--typescript` flag.
|
||||
|
@ -34,6 +36,44 @@ Docusaurus doesn't use this `tsconfig.json` to compile your project. It is added
|
|||
|
||||
Now you can start writing TypeScript theme components.
|
||||
|
||||
## Typing the config file {#typing-config}
|
||||
|
||||
It is **not possible** to use a TypeScript config file in Docusaurus, unless you compile it yourself to JavaScript.
|
||||
|
||||
We recommend using [JSDoc type annotations](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html):
|
||||
|
||||
```js title="docusaurus.config.js
|
||||
// highlight-start
|
||||
/** @type {import('@docusaurus/types').Plugin} */
|
||||
// highlight-end
|
||||
function MyPlugin(context, options) {
|
||||
return {
|
||||
name: 'my-plugin',
|
||||
};
|
||||
}
|
||||
|
||||
// highlight-start
|
||||
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
||||
// highlight-end
|
||||
const config = {
|
||||
title: 'Docusaurus',
|
||||
tagline: 'Build optimized websites quickly, focus on your content',
|
||||
organizationName: 'facebook',
|
||||
projectName: 'docusaurus',
|
||||
plugins: [MyPlugin],
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
Type annotations are very useful and help your IDE understand the type of config objects!
|
||||
|
||||
The best IDEs (VSCode, WebStorm, Intellij...) will provide a nice auto-completion experience.
|
||||
|
||||
:::
|
||||
|
||||
## Swizzling TypeScript theme components {#swizzling-typescript-theme-components}
|
||||
|
||||
For themes that supports TypeScript theme components, you can add the `--typescript` flag to the end of swizzling command to get TypeScript source code. For example, the following command will generate `index.tsx` and `styles.module.css` into `src/theme/Footer`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue