pinia-orm icon indicating copy to clipboard operation
pinia-orm copied to clipboard

Cannot find module 'pinia-orm/decorators' or its corresponding type declarations.ts(2307) using Typescript

Open annymosse opened this issue 1 year ago • 3 comments

Environment

VSCode: 1.86.0 pinia: ^2.1.7 pinia-orm: ^1.7.2 typescript: ^5.3.3 vite: ^5.0.12 vite-plugin-vuetify: ^2.0.1 vue: ^3.4.15 vue-tsc: ^1.8.27

Reproduction

just follow the website 'https://pinia-orm.codedredd.de/guide/getting-started/typescript'

Describe the bug

as the title description, and when not using decorators and try to insert a new user as the docs there's no autocomplete unless export an interface describe the model fileds

Additional context

No response

Logs

No response

Edit: by checking the pinia-orm installed package I couldn't find any declarations folder/file except the dist folder.

annymosse avatar Feb 02 '24 12:02 annymosse

Can you please try import { Attr, Cast, Uid } from 'pinia-orm/dist/decorators' ... i know i need to adapt the docs. Have a lot of todos :)

CodeDredd avatar Feb 02 '24 14:02 CodeDredd

@annymosse You are probably using "moduleResolution": "node" in your tsconfig.json file. It's deprecated and causes various resolution problems in modern code. Please check out this discussion.

daniser avatar Feb 09 '24 13:02 daniser

Can you please try import { Attr, Cast, Uid } from 'pinia-orm/dist/decorators' ... i know i need to adapt the docs. Have a lot of todos :)

@CodeDredd Sorry for the delay, I tried it and it didn't work, I will try to use "moduleResolution" it might work as @daniser mentioned above.

annymosse avatar Feb 09 '24 13:02 annymosse

This seems to be solved by using the right "moduleResolution". Updating my packages also to nodenext

CodeDredd avatar May 04 '24 07:05 CodeDredd