A Vue ref is created without a type and without a value that gives one

tx0/ts:ref-without-typeallwarningmaintainability/designdepth fastsmell

What it finds

ref() and ref(null) infer the type undefined or null, so assigning the real value later fails to type-check or forces a cast. ref<User | null>(null) states what the ref will hold.

Reported, in TypeScript files, are calls of ref and shallowRef without type arguments whose argument is missing, null, undefined or an empty array.

From the rule's source, ref_without_type.rs.

Example from the rule's tests
import { ref } from "vue";export const user = ref(null);tx0 reports: this ref has no type for the value it will holdexport const count = ref(0);export const typed = ref<string | null>(null);
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the all tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:ref-without-type" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:ref-without-type] reason="..."

tx0 explain tx0/ts:ref-without-type shows the same in the terminal. Found a false positive? Report it.