Utility Types
INFO
This page only lists a few commonly used utility types that may need explanation for their usage. For a full list of exported types, consult the source code .
PropType<T>
Used to annotate a prop with more advanced types when using runtime props declarations.
-
Example
-
See also Guide - Typing Component Props
MaybeRef<T>
Alias for
T | Ref<T>
. Useful for annotating arguments of
Composables
.
- Only supported in 3.3+.
MaybeRefOrGetter<T>
Alias for
T | Ref<T> | (() => T)
. Useful for annotating arguments of
Composables
.
- Only supported in 3.3+.
ExtractPropTypes<T>
Extract prop types from a runtime props options object. The extracted types are internal facing - i.e. the resolved props received by the component. This means boolean props and props with default values are always defined, even if they are not required.
To extract public facing props, i.e. props that the parent is allowed to pass, use
ExtractPublicPropTypes
.
-
Example
ExtractPublicPropTypes<T>
Extract prop types from a runtime props options object. The extracted types are public facing - i.e. the props that the parent is allowed to pass.
-
Example
ComponentCustomProperties
Used to augment the component instance type to support custom global properties.
-
Example
TIP
Augmentations must be placed in a module
.tsor.d.tsfile. See Type Augmentation Placement for more details. -
See also Guide - Augmenting Global Properties
ComponentCustomOptions
Used to augment the component options type to support custom options.
-
Example
TIP
Augmentations must be placed in a module
.tsor.d.tsfile. See Type Augmentation Placement for more details. -
See also Guide - Augmenting Custom Options
ComponentCustomProps
Used to augment allowed TSX props in order to use non-declared props on TSX elements.
-
Example
TIP
Augmentations must be placed in a module
.tsor.d.tsfile. See Type Augmentation Placement for more details.
CSSProperties
Used to augment allowed values in style property bindings.
-
Example
Allow any custom CSS property