Can not emit declaration files for TypeScript
See original GitHub issueVersion
3.0.0-beta.6
Reproduction link
https://github.com/HuijiFE/void-ui/tree/0.1
Steps to reproduce
git clone git@github.com:HuijiFE/void-ui.git
cd void-ui
git checkout 0.1
yarn
yarn build:void
What is expected?
Output declaration files after building.
What is actually happening?
There is not any declaration files after building.
I have set "declaration": true,
in tsconfig.json, but it doesn’t output the typescript declaration files.
And then I use tsc --emitDeclarationOnly
, although it output the declaration files but without vue single file component.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:27
- Comments:51 (7 by maintainers)
Top Results From Across the Web
Documentation - Creating .d.ts Files from .js files - TypeScript
emitDeclarationOnly ": true,. // Types should go into this directory. // Removing this would place the .d.ts files. // next to the .js...
Read more >typescript - How to emit TS declarations for legacy CommonJS ...
I checked TypeScript's own code, and there's no evident way to change how the declare module line is generated. Fortunately, you can just ......
Read more >@rollup/plugin-typescript - npm
Having @rollup/plugin-typescript only do typechecking / declarations with "emitDeclarationOnly": true while deferring to @rollup/plugin-babel ...
Read more >Compiler Options - TypeScript
Option Type Default
‑‑allowJs boolean false
‑‑allowSyntheticDefaultImports boolean module === "system" or ‑‑esModuleInterop
‑‑allowUmdGlobalAccess boolean false
Read more >Webpack and TypeScript can't resolve declaration file for Vue ...
Coding example for the question Webpack and TypeScript can't resolve declaration file for Vue-Vue.js.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just hit this issue myself. The solution for me was substantially similar to some of the previous ones claimed to work, but with some key differences. This is my
vue.config.js
:In particular, the section in previous examples that disabled
thread-loader
had no effect. I had to addparallel: false
to avoid the errorCannot read property 'options' of undefined
.Additionally (this is obvious but bears mentioning), you must specify
"declaration": true
in yourtsconfig.json
to have declaration files emitted. This is with the latest (4.1.x) Vue CLI.Same here for library 😦
npx vue-cli-service build --target lib --dest lib ./src/index.ts
I have set “declaration”: true, in tsconfig.json, but it doesn’t output the typescript declaration files.