File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -67,10 +67,23 @@ So I propose to pass `attrs` type to the second params of `defineComponent`.
67
67
The following blow is the design details.
68
68
- `attrs` is inferred to `{ class: unknown; style: unknown }` when the value of the second param is `undefined`
69
69
- `attrs` is lower priority than `props`.
70
-
70
+ - [see for more detail cases](https://github.com/vuejs/core/pull/7444/files)
71
71
72
72
## `useAttrs<T>`
73
- In the `setup-script`, the generic type of `useAttrs` will compile to the second param of `defineComponent`
73
+ In the `setup-script`, the generic type of `useAttrs` will compile to the second param of `defineComponent`.
74
+ ```ts
75
+ export default /*#__PURE__*/_defineComponent({
76
+ setup(__props, { expose }) {
77
+ expose();
78
+
79
+ const attrs = useAttrs<{ foo: number }>()
80
+
81
+ return { attrs, useAttrs, ref }
82
+ }
83
+
84
+ }, { attrs: {} as { foo: number }})"
85
+ ```
86
+
74
87
75
88
76
89
# Unresolved questions
You can’t perform that action at this time.
0 commit comments