Skip to content

vue/require-typed-ref

require ref and shallowRef functions to be strongly typed

📖 Rule Details

This rule disallows calling ref() or shallowRef() functions without generic type parameter or an argument when using TypeScript.

With TypeScript it is easy to prevent usage of any by using noImplicitAny. Unfortunately this rule is easily bypassed with Vue ref() function. Calling ref() function without a generic parameter or an initial value leads to ref having Ref<any> type.

Now loading...

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-vue v9.15.0

🔍 Implementation