Skip to content

Commit cc506ce

Browse files
committed
fix(types): attrs default type
1 parent e4f4369 commit cc506ce

File tree

3 files changed

+1
-26
lines changed

3 files changed

+1
-26
lines changed

packages/runtime-core/src/componentPublicInstance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export type ComponentPublicInstance<
194194
Omit<P & PublicProps, keyof Defaults> &
195195
Omit<Attrs, keyof (P & PublicProps)>
196196
: P & PublicProps & Omit<Attrs, keyof (P & PublicProps)>
197-
$attrs: Omit<Attrs, keyof (P & PublicProps)> & AllowedComponentProps
197+
$attrs: Omit<Attrs, keyof (P & PublicProps)>
198198
$refs: Data
199199
$slots: Slots
200200
$root: ComponentPublicInstance | null

test-dts/defineComponent.test-d.tsx

-13
Original file line numberDiff line numberDiff line change
@@ -1315,19 +1315,6 @@ describe('define attrs', () => {
13151315
)
13161316
expectType<JSX.Element>(<MyComp foo="1" />)
13171317
})
1318-
1319-
test('define attrs w/ default attrs such as class, style', () => {
1320-
const MyComp = defineComponent({
1321-
props: {
1322-
foo: String
1323-
},
1324-
created() {
1325-
expectType<unknown>(this.$attrs.class)
1326-
expectType<unknown>(this.$attrs.style)
1327-
}
1328-
})
1329-
expectType<JSX.Element>(<MyComp class="1" style={1} />)
1330-
})
13311318
})
13321319

13331320
// #5948

test-dts/defineCustomElement.test-d.ts

-12
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,4 @@ describe('define attrs', () => {
159159
}
160160
)
161161
})
162-
163-
test('define attrs w/ default attrs such as class, style', () => {
164-
defineCustomElement({
165-
props: {
166-
foo: String
167-
},
168-
created() {
169-
expectType<unknown>(this.$attrs.class)
170-
expectType<unknown>(this.$attrs.style)
171-
}
172-
})
173-
})
174162
})

0 commit comments

Comments
 (0)