跳至内容

vue/require-typed-ref

要求 refshallowRef 函数具有强类型

📖 规则详情

此规则禁止在使用 TypeScript 时,在没有泛型类型参数或参数的情况下调用 ref()shallowRef() 函数。

使用 TypeScript,可以通过使用 noImplicitAny 轻松防止使用 any。不幸的是,此规则很容易被 Vue 的 ref() 函数绕过。在没有泛型参数或初始值的情况下调用 ref() 函数会导致 ref 具有 Ref<any> 类型。

正在加载...

🔧 选项

无。

🚀 版本

此规则在 eslint-plugin-vue v9.15.0 中引入

🔍 实现