Appearance
vue/define-emits-declaration
强制声明样式
defineEmits
¥enforce declaration style of
defineEmits
📖 规则详情
此规则强制执行 defineEmits
键入样式,你应该使用 type-based
、严格 type-literal
(在 Vue 3.3 中引入)或 runtime
声明。
¥This rule enforces defineEmits
typing style which you should use type-based
, strict type-literal
(introduced in Vue 3.3), or runtime
declaration.
此规则仅适用于安装脚本和 lang="ts"
。
¥This rule only works in setup script and lang="ts"
.
🔧选项
¥🔧 Options
json
"vue/define-emits-declaration": ["error", "type-based" | "type-literal" | "runtime"]
type-based
(默认)强制基于类型的声明¥
type-based
(default) enforces type based declarationtype-literal
强制执行严格的基于 "类型字面量" 类型的声明¥
type-literal
enforces strict "type literal" type based declarationruntime
强制执行运行时声明¥
runtime
enforces runtime declaration
runtime
type-literal
👫相关规则
¥👫 Related Rules
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则是在 eslint-plugin-vue v9.5.0 中引入的
¥This rule was introduced in eslint-plugin-vue v9.5.0
🔍代码实现
¥🔍 Implementation