You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.
That doesn't work due to the bundling process, or at least the way it is configured atm.. Not specific to CRA(-ts), but to every project using typescript while bundling with webpack.
However, there are two ways to achieve what you want.
Follow the instructions from the ts-loader README - but beware, since it requires adding a plugin, you'd have to eject: https://github.com/TypeStrong/ts-loader/blob/master/README.md#declarations-dts
Benefit: Generates a single bundle containing your typings.
Drawback: Requires ejecting; plugin does not seem to be that actively maintained.
Generate them via npx tsc -p tsconfig.json --emitDeclarationOnly. The declarations will end up in build/dist (or whatever you changed outDir to) in hierachical structure.
Benefit: Does not require ejecting, can be done without any additional tools.
Drawback: It's not a bundle, but a collection of files.
Is this a bug report?
Yes
Can you also reproduce the problem with npm 4.x?
Yes
Which terms did you search for in User Guide?
declaration
Environment
npm ls react-scripts-ts
(if you haven’t ejected): 2.13.0node -v
: v8.9.4npm -v
: 5.6.0yarn --version
(if you use Yarn): 1.3.2Then, specify:
Steps to Reproduce
(Write your steps here:)
"declaration": true,
to thepackage.json
and remove"allowJs": true,
ls build/static/js
Expected Behavior
I should see
.d.ts
types declarationsActual Behavior
I don't see
.d.ts
types declarationsThe text was updated successfully, but these errors were encountered: