-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Closed
Copy link
Labels
Description
Describe the feature
vueCompilerOptions in nuxt.config.ts
Currently, the defineNuxtConfig
's typescript.tsConfig.vueCompilerOptions
property is not officially supported on type-level: the compiler will yell at you if you try to use it.
However, the configuration options defined in vueCompilerOptions
still work as intended.
Enhancing the tsConfig
interface locally to include the vueCompilerOptions
property is a possible workaround (the VueCompilerOptions
type is currently available and exported from vue's languageModule), but an official solution would be much appreciated.
You can find this reproduction on stackblitz
Prerequisites
- A minimal Nuxt app started with
npx nuxi@latest init
vue-tsc
andtypescript
installed as dev dependencies (see Nuxt's TypeScript documentation)- A
nuxt.config.ts
file with thevueCompilerOptions
property added to thetsConfig
property. To observe the behavior, the easiest way is to add thestrictTemplates
property to thevueCompilerOptions
object.
Steps to reproduce
- Create a component and define a prop in the component using the
defineProps
macro and passing it theProps
type argument - Use your new component in a page and pass it the prop you defined (this is not really necessary, but it's a good way to observe the behavior)
- Pass your component a prop that is not defined in the component's
props
, (e.g.:nonExistentProp="true"
) - Save and run
npx nuxi typecheck
. You l'll get one error from thenuxt.config.ts
file, saying that thevueCompilerOptions
property is not allowed, and one from the page where you used the component, saying thatnon-existent-prop
is not defined in the component'sProps
type.
Additional information
- Would you be willing to help implement this feature?
- Could this feature be implemented as a module?
Final checks
- Read the contribution guide.
- Check existing discussions and issues.