Generate type declarations for create-react-app

Viewed 475

I can't seem to get my create-react-app with typescript to generate declaration files. A .d.ts file should be added to the build folder when building. Adding "declaration": true to the tsconfig.json didn't change it. To reproduce create a new app with npx create-react-app --template typescript and build it with yarn build.

I also tried npx tsc --declaration and npx tsc --declarationOnly and didn't get the file either.

How would I get a new or already existing create-react-app to generate a .d.ts declaration file upon building?

Edit: I declaration files, because this project can be used as a library.

0 Answers
Related