Closed serialine closed 2 months ago
Ughhhhhhhhhhhhhhhhhh after some investigation this seemed to be a type issue in vue core...
Bump, this issue is blocking us from using very basic TS functionality like Partial
// OK if no optional properties on the nested object
defineProps<{
customProp: {
foo: string;
bar: string;
baz: string;
};
}>();
// OK if some optional properties on the nested object
defineProps<{
customProp: {
foo?: string;
bar?: string;
baz: string;
};
}>();
// NOT OK if all optional properties on the nested object
// TS Error 2339: Property 'foo' does not exist on type 'unknown'
// TS Error 2339: Property 'bar' does not exist on type 'unknown'
// TS Error 2339: Property 'baz' does not exist on type 'unknown'
defineProps<{
customProp: {
foo?: string;
bar?: string;
baz?: string;
};
}>();
Tested: This is not an issue anymore in v2
Volar version
1.8.11
Vue version
Nuxt 2.17.1 / Vue 2.7.14
Link to minimal reproduction
https://github.com/serialine/nuxt-2.17.1-ts
Steps to reproduce
tsconfig.json
What is expected?
Prop
option1
inferred as object and property 'title' inferred as string | undefined.What is actually happening?
Prop
option
inferred as 'unknown', Property 'title' does not exist on type 'unknown'Any additional comments?
duplicates from https://github.com/vuejs/core/issues/9169