wip: defineContext
This commit is contained in:
15
packages/runtime-core/src/helpers/useSetupContext.ts
Normal file
15
packages/runtime-core/src/helpers/useSetupContext.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { EMPTY_OBJ } from '@vue/shared'
|
||||
import { Slots } from '../componentSlots'
|
||||
|
||||
interface DefaultContext {
|
||||
props: Record<string, unknown>
|
||||
attrs: Record<string, unknown>
|
||||
emit: (...args: any[]) => void
|
||||
slots: Slots
|
||||
}
|
||||
|
||||
export function useSetupContext<T extends Partial<DefaultContext> = {}>(
|
||||
opts?: any // TODO infer
|
||||
): { [K in keyof DefaultContext]: T[K] extends {} ? T[K] : DefaultContext[K] } {
|
||||
return EMPTY_OBJ as any
|
||||
}
|
||||
@@ -261,6 +261,8 @@ import {
|
||||
setCurrentRenderingInstance
|
||||
} from './componentRenderUtils'
|
||||
import { isVNode, normalizeVNode } from './vnode'
|
||||
import { Slots } from './componentSlots'
|
||||
import { EMPTY_OBJ } from '@vue/shared/src'
|
||||
|
||||
const _ssrUtils = {
|
||||
createComponentInstance,
|
||||
|
||||
Reference in New Issue
Block a user