Skip to content

Commit

Permalink
chore: add docs links for sfc macros
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 2, 2023
1 parent c346af2 commit dfb21a5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/runtime-core/src/apiSetupHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const warnRuntimeUsage = (method: string) =>
* foo?: string
* bar: number
* }>()
*
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
* ```
*
* This is only usable inside `<script setup>`, is compiled away in the
Expand Down Expand Up @@ -118,6 +120,8 @@ type BooleanKey<T, K extends keyof T = keyof T> = K extends any
*
* This is only usable inside `<script setup>`, is compiled away in the
* output and should **not** be actually called at runtime.
*
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits}
*/
// overload 1: runtime emits w/ array
export function defineEmits<EE extends string = string>(
Expand Down Expand Up @@ -156,6 +160,8 @@ type ShortEmits<T extends Record<string, any>> = UnionToIntersection<
*
* This is only usable inside `<script setup>`, is compiled away in the
* output and should **not** be actually called at runtime.
*
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineexpose}
*/
export function defineExpose<
Exposed extends Record<string, any> = Record<string, any>
Expand All @@ -165,6 +171,13 @@ export function defineExpose<
}
}

/**
* Vue `<script setup>` compiler macro for declaring a component's additional
* options. This should be used only for options that cannot be expressed via
* Composition API - e.g. `inhertiAttrs`.
*
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineoptions}
*/
export function defineOptions<
RawBindings = {},
D = {},
Expand Down Expand Up @@ -232,6 +245,8 @@ type PropsWithDefaults<Base, Defaults> = Base & {
*
* This is only usable inside `<script setup>`, is compiled away in the output
* and should **not** be actually called at runtime.
*
* @see {@link https://vuejs.org/guide/typescript/composition-api.html#typing-component-props}
*/
export function withDefaults<Props, Defaults extends InferDefaults<Props>>(
props: Props,
Expand Down

0 comments on commit dfb21a5

Please sign in to comment.