fix(types): ensure `this.$props` type does not include `string` (#12123)

close #12122
This commit is contained in:
Tycho 2024-10-11 10:30:09 +08:00 committed by GitHub
parent d9d4d4e158
commit 704173e242
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -2068,3 +2068,13 @@ expectString(instance.actionText)
// public prop on $props should be optional
// @ts-expect-error
expectString(instance.$props.actionText)
// #12122
defineComponent({
props: { foo: String },
render() {
expectType<{ readonly foo?: string }>(this.$props)
// @ts-expect-error
expectType<string>(this.$props)
},
})

View File

@ -265,7 +265,7 @@ export function defineComponent<
Mixin,
Extends,
ResolvedEmits,
RuntimeEmitsKeys,
{},
{},
false,
InjectOptions,