I set up a fresh new project with nuxt3 and prismic, but I'm running into two typescript issues I cannot solve
1:
in the slices/index.ts file (this I can solve by adding
to the tsconfig, but then I have errors in all .vue files)
probably because this is then overriding the default nuxt tsconfig, but I don't know how I could add it otherwise (there is an option to add in the nuxt.config, but that for some reason doesn't work like it should)
then at least the issue with the 'Content not found in '@prismicio/client'' is gone, but then I also lose my eslint config so not the ultimate solution
the other error in the slices/index.ts is still there though
import * as prismic from '@prismicio/client'
// The array passed to `getSliceComponentProps` is purely optional.
// Consider it as a visual hint for you when templating your slice.
defineProps(
getSliceComponentProps<prismic.Content.ScalingHeadlineSlice>([
'slice',
'index',
'slices',
'context'
])
)
works, but the other issue persists, and it would be nice to have the generated code by slicemaching to be correct in the first place
This looks like it's an ESLint issue with the import plugin used by @nuxtjs/eslint-config-typescript.
For transparency, we're currently reworking our ESLint packages at Nuxt, so this might get solved in the future, in the meantime, here are some workarounds (you should not need to update your tsconfig.json with those):
Disabling import/named rule
Since the project is TypeScript, it will already yell at you if you attempt to import something that does not exists, so I find this rule a bit redundant. If that works for you too, you can disable it this way:
"rules": {
"import/named": "off"
}
Telling eslint-plugin-import to ignore Prismic module
An alternative if to configure eslint-plugin-import to consider @prismicio/client to be there. It can be achieved this way in your ESLint config:
hey @lihbr
thanks a lot, both works, that's more than enough for now
I still have the error in the slices/index.ts file though
I already added this file to a .eslintignore so the eslint errors are gone, but there still persist the typescript errors
Nice! Was able to solve that one by removing the includes array from the tsconfig.json at your project root Seems like it doesn't merge with Nuxt's generated one.
you mean by removing these lines completely? don't have a custom includes rule
then I have errors in other vue components ...
think it does merge actually