Skip to content

Commit 72ecf96

Browse files
committed
fix(types): attrs default type
1 parent 83fe9dd commit 72ecf96

File tree

3 files changed

+1
-26
lines changed

3 files changed

+1
-26
lines changed

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

-13
Original file line numberDiff line numberDiff line change
@@ -1308,19 +1308,6 @@ describe('define attrs', () => {
13081308
)
13091309
expectType<JSX.Element>(<MyComp foo="1" />)
13101310
})
1311-
1312-
test('define attrs w/ default attrs such as class, style', () => {
1313-
const MyComp = defineComponent({
1314-
props: {
1315-
foo: String
1316-
},
1317-
created() {
1318-
expectType<unknown>(this.$attrs.class)
1319-
expectType<unknown>(this.$attrs.style)
1320-
}
1321-
})
1322-
expectType<JSX.Element>(<MyComp class="1" style={1} />)
1323-
})
13241311
})
13251312

13261313
// #5948

packages/dts-test/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
})

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

0 commit comments

Comments
 (0)