Skip to content

Commit

Permalink
fix(runtime-core): add useAttrs and useSlots export (#4053)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderl17 authored Jul 2, 2021
1 parent 2788154 commit 735ada1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/runtime-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export {
withAsyncContext,
// deprecated
defineEmit,
useContext
useContext,
useAttrs,
useSlots
} from './apiSetupHelpers'

// Advanced API ----------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions test-dts/setupHelpers.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
defineEmit,
defineEmits,
useContext,
useAttrs,
useSlots,
withDefaults,
Slots,
describe
Expand Down Expand Up @@ -134,3 +136,13 @@ describe('useContext', () => {
emit('foo')
emit('bar')
})

describe('useAttrs', () => {
const attrs = useAttrs()
expectType<Record<string, unknown>>(attrs)
})

describe('useSlots', () => {
const slots = useSlots()
expectType<Slots>(slots)
})

0 comments on commit 735ada1

Please sign in to comment.