What rule do you want to change?
vue/require-typed-ref
Does this change cause the rule to produce more or fewer warnings?
Fewer
How will the change be implemented? (New option, new default behavior, etc.)?
I think this could be default behavior, but an option would also be ok if it would be disruptive to other use cases.
Please provide some example code that this change will affect:
// Example 1
const value1: Ref<string | null> = ref(null)
// Example 2
const value2: Ref<string | undefined> = ref()
// Example 3
function test(x: Ref<string | null>) {
// ...
}
test(ref(null));
// Example 4
function test(x: Ref<string | undefined>) {
// ...
}
test(ref());
What does the rule currently do for this code?
Each example reports a violation of vue/require-typed-ref, despite them being properly type-checked
What will the rule do after it's changed?
No errors reported for these examples.
Additional context
It might be a separate bug that ref(null) is reported by this rule, since it would be properly type checked even without the type annotation since it is inferred to be Ref<null, null>. I see there was some discussion about that when the rule was created, but since it does not infer to any, I don't think it should be reported by this rule.
What rule do you want to change?
vue/require-typed-refDoes this change cause the rule to produce more or fewer warnings?
Fewer
How will the change be implemented? (New option, new default behavior, etc.)?
I think this could be default behavior, but an option would also be ok if it would be disruptive to other use cases.
Please provide some example code that this change will affect:
// Example 1 const value1: Ref<string | null> = ref(null) // Example 2 const value2: Ref<string | undefined> = ref() // Example 3 function test(x: Ref<string | null>) { // ... } test(ref(null)); // Example 4 function test(x: Ref<string | undefined>) { // ... } test(ref());What does the rule currently do for this code?
Each example reports a violation of
vue/require-typed-ref, despite them being properly type-checkedWhat will the rule do after it's changed?
No errors reported for these examples.
Additional context
It might be a separate bug that
ref(null)is reported by this rule, since it would be properly type checked even without the type annotation since it is inferred to beRef<null, null>. I see there was some discussion about that when the rule was created, but since it does not infer toany, I don't think it should be reported by this rule.