Comments (14)
Hi @f-lawe, do you have a repo that I can use as a repro?
from dts-bundle-generator.
I've started a new and very simple one: https://github.com/f-lawe/dts-bundle-generator-vue
For some reason, I'm stuck to Cannot find module './MyComponent.vue' or its corresponding type declarations
, while on the project I'm currently working on, Vue files are just ignored.
It's set up with Vite if that can help you.
from dts-bundle-generator.
Please read this #232, looks like this is exactly what you're experiencing.
from dts-bundle-generator.
Thanks for replying so fast!
I've updated the project using triple-slash directives, but I still face the same issue. Declaration bundle is built, but it's wrong. Regular build is ok, so it's only a Typescript thing.
from dts-bundle-generator.
I keep looking what's different on my other project.
from dts-bundle-generator.
It seems that if you do the following it helps a bit:
- remove https://github.com/f-lawe/dts-bundle-generator-vue/blob/cb3c7e4e55f6e11ad5fc9ff92f0c7aa118b36002/src/shims.d.ts#L5 line (I'll try to address this problem soon)
- change
*.vue
to./*.vue
at https://github.com/f-lawe/dts-bundle-generator-vue/blob/cb3c7e4e55f6e11ad5fc9ff92f0c7aa118b36002/src/shims.d.ts#L3
At least it generates correct file now. But the problem that I see right now is your components would have {}
props which I don't think is right. Sorry, I'm not that familiar with vuejs, not sure what's the best solution here and how it is done in other libraries.
from dts-bundle-generator.
I'll try to address this problem soon
As for this, please add declare
keyword to a constant here: declare const component: DefineComponent<{}, {}, any>;
.
from dts-bundle-generator.
Ok, it works with your changes, thanks. And indeed, Vue components are empty.
I'm not familiar with Typescript declarations from my side. But I know that vue-tsc is able to generate a valid output. There may be a way to leverage something from it?
from dts-bundle-generator.
Project updated with a new script: npm run vue-tsc
generates a full output.
from dts-bundle-generator.
@f-lawe it seems vue-tsc
already generates everything you need in 1 file and you don't need to use dts-bundle-generator?
from dts-bundle-generator.
I gave it a try, but the bundled output is not ok. I'm still investigating a bit and checking first if I'm not the one making a mistake. The regular output works, and this is what I use for the moment.
It just would be awesome to have one single package handling both regular JS and Vue. It's not a strong need.
from dts-bundle-generator.
It just would be awesome to have one single package handling both regular JS and Vue
Can you provide what exactly you'd like to get eventually as an output? I'm not quite understand tbh
from dts-bundle-generator.
I updated the dts-bundle-generator-vue project so you can have a look.
npm run dst:bundle-generator
-> Bundled declarations with your project, ok with regular Typescript, but missing details with Vue files
npm run dts:vue-tsc
-> Declarations generated with vue-tsc
, each file gets its own declaration file, but output is ok when using the lib within an other project
npm run dts-vue-tsc-bundle
-> Bundled declarations with vue-tsc
, not ok because every declaration is embedded into a module named after the original file
Ideally, the output should be bundled like your project and populated with the correct Vue declarations like vue-tsc
.
from dts-bundle-generator.
not ok because every declaration is embedded into a module named after the original file
@f-lawe is it the only problem with that output from your perspective? It feels like a feature request for vue-tsc
tbh (e.g. they can generate random names or so). But also I suppose you can run dts:vue-tsc
and then run dts-bundle-generator
with dts:vue-tsc
's output file as an input, but it fails right now as the tool doesn't support renaming (it is a known limitation), see #116 and #130. I'm closing this issue in favor of these.
from dts-bundle-generator.
Related Issues (20)
- jsdoc comments are stripped for nodes that were renamed because of the name collision
- Namespaced imports/exports don't generate a namespace if they are exported via name
- TS2307: Cannot find module *.module.css HOT 1
- Not all symbols in a declaration merging are exported
- Investigation: Use of `Context.Tag` from `effect` causes 4x slowdown HOT 13
- Star-imports don't get included in the bundle HOT 4
- Generics extended with declare module statement aren't included HOT 2
- Option to disable tree-shaking HOT 12
- Improve validation time performance by re-using caching compiler host from previous steps
- The exportElementSymbol occasionally returns undefined, resulting in an error in const namespaceImportForElement = getDeclarationsForSymbol(exportElementSymbol).find(ts.isNamespaceImport);. HOT 4
- Declarations of "unknown" modules aren't included despite enabled `inlineDeclareExternals` flag
- Maximum call stack size exceeded (Infinite Loop) at `computeUsagesRecursively` HOT 5
- Constants declared by using object/array binding pattern syntax fail the build HOT 9
- [9.4.0] A definition being referenced is lacking HOT 6
- Namespace import disappeared in output HOT 3
- Output strips `type` keyword from type import HOT 3
- 9.4.1 introduced significant overhead that can cause a 4.4x slow down
- [bug] Changes type to reference to the wrong variable
- Support ts 5.5 tsconfig.json with ${configDir} HOT 2
- Support dynamic libraries LibrariesOptions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dts-bundle-generator.