Skip to content

Commit 9b82005

Browse files
authored
test: defineOptions dts tests (#10849)
1 parent c146186 commit 9b82005

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

packages/dts-test/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Tests TypeScript types to ensure the types remain as expected.
44

55
- This directory is included in the root `tsconfig.json`, where package imports are aliased to `src` directories, so in IDEs and the `pnpm check` script the types are validated against source code.
66

7-
- When running `tsc` with `packages/dts-test/tsconfig.test.json`, packages are resolved using normal `node` resolution, so the types are validated against actual **built** types. This requires the types to be built first via `pnpm build-types`.
7+
- When running `tsc` with `packages/dts-test/tsconfig.test.json`, packages are resolved using normal `node` resolution, so the types are validated against actual **built** types. This requires the types to be built first via `pnpm build-dts`.

packages/dts-test/setupHelpers.test-d.ts

+19
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
defineComponent,
66
defineEmits,
77
defineModel,
8+
defineOptions,
89
defineProps,
910
defineSlots,
1011
toRefs,
@@ -501,3 +502,21 @@ describe('toRefs w/ type declaration', () => {
501502
}>()
502503
expectType<Ref<File | File[] | undefined>>(toRefs(props).file)
503504
})
505+
506+
describe('defineOptions', () => {
507+
defineOptions({
508+
name: 'MyComponent',
509+
inheritAttrs: true,
510+
})
511+
512+
defineOptions({
513+
// @ts-expect-error props should be defined via defineProps()
514+
props: ['props'],
515+
// @ts-expect-error emits should be defined via defineEmits()
516+
emits: ['emits'],
517+
// @ts-expect-error slots should be defined via defineSlots()
518+
slots: { default: 'default' },
519+
// @ts-expect-error expose should be defined via defineExpose()
520+
expose: ['expose'],
521+
})
522+
})

0 commit comments

Comments
 (0)