Skip to content

Commit d61d803

Browse files
authored
chore: add jsdoc for defineSlots (#14566)
1 parent fdd863f commit d61d803

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/runtime-core/src/apiSetupHelpers.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,22 @@ export function defineOptions<
233233
}
234234
}
235235

236+
/**
237+
* Vue `<script setup>` compiler macro for providing type hints to IDEs for
238+
* slot name and slot props type checking.
239+
*
240+
* Example usage:
241+
* ```ts
242+
* const slots = defineSlots<{
243+
* default(props: { msg: string }): any
244+
* }>()
245+
* ```
246+
*
247+
* This is only usable inside `<script setup>`, is compiled away in the
248+
* output and should **not** be actually called at runtime.
249+
*
250+
* @see {@link https://vuejs.org/api/sfc-script-setup.html#defineslots}
251+
*/
236252
export function defineSlots<
237253
S extends Record<string, any> = Record<string, any>,
238254
>(): StrictUnwrapSlotsType<SlotsType<S>> {

0 commit comments

Comments
 (0)