Closed Kieran-DK closed 3 months ago
I can't really reproduce it. But i am gonna remove the one definition. Maybe it's solving your problem.
I can't really reproduce it. But i am gonna remove the one definition. Maybe it's solving your problem.
Hi @CodeDredd, thanks for looking into this. Unfortunately, after testing the fix locally, I'm still encountering the issue. If you build the pinia-orm
package and view the file packages/pinia-orm/dist/shared/pinia-orm.<HASH>.d.ts
, you'll see that the Repository
class is missing the find
method definition.
I've attached a video of the issue in action, whereby clicking through to the Repository
class definition in VSCode shows that the find
method is not present and so any
is inferred by default.
Thanks for your help with this, greatly appreciated.
https://github.com/CodeDredd/pinia-orm/assets/148753049/14321772-e3f5-415d-865c-bd0038f53f80
How does your tsconfig look like?
How does your tsconfig look like?
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": [
"app/Vue/**/*"
],
"exclude": [
"node_modules"
],
"compilerOptions": {
"target": "ES6",
"allowJs": true,
"declaration": false,
"moduleResolution": "node",
"baseUrl": ".",
"outDir": "",
"paths": {
"@/*": [
"./app/Vue/*"
],
"~": [
"./app/*"
]
},
"types": [
"vitest/globals"
]
}
}
@Kieran-DK ok i found it now. Now the typings should be working normal again. I incorrectly overloaded the Repository.
@Kieran-DK ok i found it now. Now the typings should be working normal again. I incorrectly overloaded the Repository.
Amazing, thanks @CodeDredd. I can confirm this fixes the issue 🙏
@Kieran-DK Thanks for the support! Just saw it ❤️ 💯
Environment
Vue 3 (not Nuxt) + TypeScript
Reproduction
Describe the bug
When using
useRepo
to get a repository instance, when calling thefind
method, the type of the returned value isany
, not the type of the Model as you would expect.This may have been caused by the removal of
.find
from theRepository
class: https://github.com/CodeDredd/pinia-orm/pull/1831/files#diff-de773c674180b12ca839cbf77f65443d6964b83ad45e8615e727e76601c7330fL340-L348Additional context
No response
Logs
No response