Skip to content

Commit

Permalink
feat(compiler-sfc): useAttrs support generic type
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyxu1102 committed Aug 30, 2023
1 parent a643c41 commit 20e2364
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,39 @@ return { get aa() { return aa }, set aa(v) { aa = v }, bb, cc, dd, get a() { ret
}"
`;
exports[`SFC compile <script setup> > useAttrs w/ generic type 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
import { useAttrs, ref} from 'vue'
export default /*#__PURE__*/_defineComponent({
setup(__props, { expose }) {
expose();
const attrs = useAttrs<{ foo: number }>()
return { attrs, useAttrs, ref }
}
}, { attrs: {} as { foo: number }})"
`;
exports[`SFC compile <script setup> > useAttrs w/ type reference 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
import { useAttrs, ref} from 'vue'
type CompAttrs = { foo: number }
export default /*#__PURE__*/_defineComponent({
setup(__props, { expose }) {
expose();
const attrs = useAttrs<CompAttrs>()
return { attrs, useAttrs, ref }
}
}, { attrs: {} as { foo: number }})"
`;
exports[`SFC compile <script setup> > with TypeScript > const Enum 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
const enum Foo { A = 123 }
Expand Down

0 comments on commit 20e2364

Please sign in to comment.