Skip to content

Commit 704173e

Browse files
authoredOct 11, 2024··
fix(types): ensure this.$props type does not include string (#12123)
close #12122
1 parent d9d4d4e commit 704173e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
 

‎packages-private/dts-test/defineComponent.test-d.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -2068,3 +2068,13 @@ expectString(instance.actionText)
20682068
// public prop on $props should be optional
20692069
// @ts-expect-error
20702070
expectString(instance.$props.actionText)
2071+
2072+
// #12122
2073+
defineComponent({
2074+
props: { foo: String },
2075+
render() {
2076+
expectType<{ readonly foo?: string }>(this.$props)
2077+
// @ts-expect-error
2078+
expectType<string>(this.$props)
2079+
},
2080+
})

‎packages/runtime-core/src/apiDefineComponent.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export function defineComponent<
265265
Mixin,
266266
Extends,
267267
ResolvedEmits,
268-
RuntimeEmitsKeys,
268+
{},
269269
{},
270270
false,
271271
InjectOptions,

0 commit comments

Comments
 (0)
Please sign in to comment.