mirror of https://github.com/vuejs/core.git
test: defineOptions dts tests (#10849)
This commit is contained in:
parent
c146186396
commit
9b82005bf3
|
@ -4,4 +4,4 @@ Tests TypeScript types to ensure the types remain as expected.
|
||||||
|
|
||||||
- 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.
|
- 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.
|
||||||
|
|
||||||
- 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`.
|
- 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`.
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
defineComponent,
|
defineComponent,
|
||||||
defineEmits,
|
defineEmits,
|
||||||
defineModel,
|
defineModel,
|
||||||
|
defineOptions,
|
||||||
defineProps,
|
defineProps,
|
||||||
defineSlots,
|
defineSlots,
|
||||||
toRefs,
|
toRefs,
|
||||||
|
@ -501,3 +502,21 @@ describe('toRefs w/ type declaration', () => {
|
||||||
}>()
|
}>()
|
||||||
expectType<Ref<File | File[] | undefined>>(toRefs(props).file)
|
expectType<Ref<File | File[] | undefined>>(toRefs(props).file)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('defineOptions', () => {
|
||||||
|
defineOptions({
|
||||||
|
name: 'MyComponent',
|
||||||
|
inheritAttrs: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
// @ts-expect-error props should be defined via defineProps()
|
||||||
|
props: ['props'],
|
||||||
|
// @ts-expect-error emits should be defined via defineEmits()
|
||||||
|
emits: ['emits'],
|
||||||
|
// @ts-expect-error slots should be defined via defineSlots()
|
||||||
|
slots: { default: 'default' },
|
||||||
|
// @ts-expect-error expose should be defined via defineExpose()
|
||||||
|
expose: ['expose'],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue