vue-ref-value
A ref used without .value where its value was meant: as a condition, with !, &&, || or ??, or in a template string.
Why: a ref is an object that holds a value. As a condition it is always true, !ref is always false, ref || fallback always picks the ref, and ${ref} prints [object Object]. The template unwraps refs for you, so v-if="open" is right there, and the habit slips into the script, where it's wrong. Here, status() always says "Uploading [object Object]". TypeScript accepts it: any object is a valid condition. Guide: Vue.
✕ Rejectedvue-ref-value
ts
import { shallowRef } from "vue";
import type { Option } from "@evobug_com/safe-ts-std/result";
export function useUpload() {
// The file being uploaded, if any.
const uploading = shallowRef<Option<string>>(undefined);
const status = (): string => (uploading ? `Uploading ${uploading}` : "Ready");
return { uploading, status };
}✓ Accepted0 diagnostics
ts
import { shallowRef } from "vue";
import type { Option } from "@evobug_com/safe-ts-std/result";
export function useUpload() {
// The file being uploaded, if any.
const uploading = shallowRef<Option<string>>(undefined);
const status = (): string => (uploading.value === undefined ? "Ready" : `Uploading ${uploading.value}`);
return { uploading, status };
}Quick fix: Add .value.
What the rule can't see: it knows a binding is a ref from how it is made: ref(), shallowRef(), computed(), toRef(), customRef(), useTemplateRef(), defineModel(), useModel(). A ref returned from your own composable (const { open } = useMenu()) or passed in as a parameter is not checked.