You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enables strict templates. When set to true, all checkUnknown* options will be enabled by default. These can be overridden individually by setting an explicit value for an option.
strictSlotChildren v3.0.0 (experimental)
Type: boolean
Default: if not explicitly set, this uses the strictTemplates option's value
Strict type constraints of slot children. Setting this option to true makes it possible to specify what type of children are allowed in a slot.
Warning
This feature is experimental, syntax may change. It is recommended not to apply the new defineSlots syntax on existing or new codebases while this feature is still experimental.
Follow or provide feedback in this discussion
strictVModel v3.0.0
Type: boolean
Default: if not explicitly set, this uses the strictTemplates option's value
Enables strict type constraints of v-model, requiring the variable passed to v-model to exactly match the type it expects to receive.
Example
ComponentWithModel.vue
<template>...</template>
<script setup lang="ts">
const model =defineModel<string|number>({ required: true,})
</script>
Home.vue
<template>
<ComponentWithModelv-model="testValue" />
<!-- ^ Type 'string | number' is not assignable to type 'string'. -->
</template>
<script setup lang="ts">
const testValue =ref("Hello, World")
</script>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
(WIP) Here are some suggestions to make the Wiki about
vueCompilerOptions
a bit more understandable.strictTemplates
boolean | object
false
Enables strict templates. When set to
true
, allcheckUnknown*
options will be enabled by default. These can be overridden individually by setting an explicit value for an option.strictSlotChildren
v3.0.0
(experimental)boolean
strictTemplates
option's valueStrict type constraints of slot children. Setting this option to
true
makes it possible to specify what type of children are allowed in a slot.Warning
This feature is experimental, syntax may change. It is recommended not to apply the new
defineSlots
syntax on existing or new codebases while this feature is still experimental.Follow or provide feedback in this discussion
strictVModel
v3.0.0
boolean
strictTemplates
option's valueEnables strict type constraints of
v-model
, requiring the variable passed tov-model
to exactly match the type it expects to receive.Example
ComponentWithModel.vue
Home.vue
This can be prevented as follows:
ComponentWithModel.vue
strictCssModules
v3.0.0
boolean
false
Strict type checking of CSS modules.
checkUnknownProps
v2.2.2
boolean
strictTemplates
option's valueCheck unknown props.
checkUnknownEvents
v2.2.2
boolean
strictTemplates
option's valueCheck unknown events.
checkUnknownDirectives
v2.2.2
boolean
strictTemplates
option's valueCheck unknown directives.
checkUnknownComponents
v2.2.2
boolean
strictTemplates
option's valueCheck unknown components.
inferComponentDollarEl
v2.2.4
boolean
false
Infer
$el
type on the component instance.Details
When
false
,$el
is always typed asany
in the following scenarios:When
true
,$el
may be typed as the root element of the component (e.g.HTMLDivElement
) in simple cases:Caveats:
<component>
inferComponentDollarRefs
v2.2.4
boolean
false
Infer
$refs
type on the component instance.inferTemplateDollarAttrs
v2.2.4
boolean
false
Infer
$attrs
type in the template and the return type ofuseAttrs
.inferTemplateDollarEl
v2.2.4
boolean
false
Infer
$el
type in the template.inferTemplateDollarRefs
v2.2.4
boolean
false
Infer
$refs
type in the template.inferTemplateDollarSlots
v2.2.4
boolean
false
Infer
$slots
type in the template and the return type ofuseSlots
.Beta Was this translation helpful? Give feedback.
All reactions