vue-tsc How to generate for .vue files only and merge into one file
See original GitHub issueHi,
The first question, how to declare for .vue files only I could probably solve with some bash hacking (simply delete whatever is changed in git and isn’t *.vue.d.ts) but I can’t figure out how to merge all the declaration files into one. Tried to RTFM but neither --outDir nor --outFile worked for me.
Actually, checked StackOverflow and saw this
To map a .d.ts file to its javascript file you need to give the .d.ts file the same name as the javascript file, keep them in the same folder, and point the code that needs it to the .d.ts file.
So its possible that everything is working as designed. They’re basically header like files. But I’ll ask the question anyway so you can confirm and others wondering the same will be able to find it here
But it would be nice if you could process .vue files only and overwrite existing .d.ts files. Because the script I’m currently thinking of will be something along the lines of
find -name '*.vue.d.ts' | xargs rm || true
npx vue-tsc --declaration --emitDeclarationOnly
git ls-files --others --exclude-standard | grep -v vue | grep .d.ts | xargs rm || true
which is… ok 😃
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Generate it to another dir such as
./generated/src/App.vue.ts
and use rootDirs to resolve it.thanks @johnsoncodehk
For anyone wondering what his
tsconfig.build-dts.json
snippet does, it does what my bash hack does. Delete (or better, prevents creating) unwanted filesBut I added xstate and Pinia to my exports and now it complains about
TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed
. I have a feeling I’ll have to rethink how to approach testing