TypeScript
discord-jsx-renderer is written in TypeScript and comes pre-packaged with types.
However, there are some tweaks you need to do.
tsconfig.json
In your tsconfig file, make sure these two settings are set:
jsonc
{
"compilerOptions": {
// Use modern JSX
"jsx": "react-jsx",
// Don't include "DOM" types
"lib": ["ESNext"],
},
}React Element Types
The @types/react library exports a bunch of unwanted HTML/react-dom related types.
There has been numerous attempts to fix this:
We have created another package, pure-react-types to fix this issue. It is the same as @types/react but just does not have HTML/DOM related types.
You can install it as @types/react by specifying it as @types/react@npm:pure-react-types:
sh
$ npm add --save-dev @types/react@npm:pure-react-typessh
$ pnpm add --save-dev @types/react@npm:pure-react-typessh
$ yarn add --save-dev @types/react@npm:pure-react-types