grapoza / vue-tree

Tree components for Vue 3
MIT License
101 stars 12 forks source link

Import not working according to docs #322

Open moyalmic opened 9 months ago

moyalmic commented 9 months ago

Hello, I'm trying to use the library to make a file explorer and after taking the steps described in the docs to setup the project and adding the import statement as displayed in the tutorial, I get an error saying Could not find a declaration file for module '@grapoza/vue-tree'.

I was wondering if there is some other step that I need to take other than installing the library through npm? Thanks in advance!

The version i'm using is version 5.2.2.

grapoza commented 8 months ago

Hi @moyalmic, I haven't added TypeScript support yet (that's issue #276) so what I've had to do for now is add a declaration to my index.d.ts for projects where I use the tree:

declare module "@grapoza/vue-tree";

My goal was/is to get a basic TreeGrid component in place and then get the typing in place, since that effort has included a whole lot of refactoring. I'm hoping to get back to that effort soon so I can knock it out and start focusing on some infrastructure things like TS and probably some DX improvements as well.

moyalmic commented 8 months ago

Oh, I'm sorry I'm still quite new to web development in general. Do I understand correctly then that creating an index.d.ts file in my project and adding the line declare module "@grapoza/vue-tree"; to it would solve my issue?

Many thanks.

grapoza commented 8 months ago

Sorry for the delay getting back to your questions, I'm traveling all this week and last so I'm offline quite a bit! I believe that's all you have to do to get TypeScript to recognize the module. What you won't get is all the type safety you'd expect if I actually had the tree written with proper types, but at least that one error will stop yelling at you. 😬