Closed MichaHuhn closed 5 months ago
Currently, emits are listed by using the runtime declaration without types:
defineEmits(['updateStyle', 'updateFamily', 'updateSize'])
This PR implements emit types by using the type-based declaration:
const emit = defineEmits<{ updateSize: [size: number] updateFamily: [family: FontAwesomeFamily] updateStyle: [style: FontAwesomeStyle] }>()
The type-based declaration provides type-safety and autocompletion when using emits which is super awesome.
Currently, it's possible to emit any value. With this PR, only the specified values are allowed and such errors will be caught:
Here is an example from the documentation:
https://vuejs.org/api/sfc-script-setup.html#type-only-props-emit-declarations
Currently, emits are listed by using the runtime declaration without types:
This PR implements emit types by using the type-based declaration:
The type-based declaration provides type-safety and autocompletion when using emits which is super awesome.
Currently, it's possible to emit any value. With this PR, only the specified values are allowed and such errors will be caught:
Here is an example from the documentation:
https://vuejs.org/api/sfc-script-setup.html#type-only-props-emit-declarations