Closed as not planned
Closed as not planned
Description
Vue version
3.5.16
Link to minimal reproduction
Steps to reproduce
import { computed, ref } from "vue";
// Inconsistent excess property checking: ref<T>() errors, computed<T>() doesn't
const withRef = ref<{ a: string }>({
a: "hello",
b: "world", // Error
});
const withComputed = computed<{ a: string }>(() => ({
a: "hello",
b: "world", // No error
}));
What is expected?
TypeScript should raise Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'. ts(2353)
for withComputed
, as it does for withRef
.
What is actually happening?
TypeScript does not raise any error for withComputed
, though it definitely should.
If, for some technical reason, type checking cannot be enforced with computed
in the same way it is with ref
, this behavior should be documented.
System Info
Any additional comments?
No response