just a simple question because I don't understand how to do that.
I'm aware of what the official documentation says:
Instead of editing next-env.d.ts, you can include additional types by adding a new file e.g. additional.d.ts and then referencing it in the include array in your tsconfig.json.
So:
- I create a file named "env.d.ts" and write:
type React from "react"
// it won't work with "declare type ..." nor "export type ..." etc.
- I edit
tsconfig.json
{
"include": ["next-env.d.ts", "env.d.ts", "**/*.ts", "**/*.tsx"]
}
My goal is to declare types globally for my app.
I gave the example of "React" because when I create a component in a .tsx
file, I write it that way:
const MyComponent: React.FC = () => {};
My IDE wants me to write "import type React from 'react'". I want to avoid doing this on all the files.