mirror of https://github.com/vuejs/core.git
parent
5ea8a8a4fa
commit
7374e93f02
|
@ -0,0 +1,5 @@
|
||||||
|
# dts built-package test
|
||||||
|
|
||||||
|
This package is private and for testing only. It is used to verify edge cases for external libraries that build their types using Vue core types - e.g. Vuetify as in [#8376](https://github.com/vuejs/core/issues/8376).
|
||||||
|
|
||||||
|
When running the `build-dts` task, this package's types are built alongside other packages. Then, during `test-dts-only` it is imported and used in [`packages/dts-test/built.test-d.ts`](https://github.com/vuejs/core/blob/main/packages/dts-test/built.test-d.ts) to verify that the built types work correctly.
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"name": "@vue/dts-built-test",
|
||||||
|
"private": true,
|
||||||
|
"types": "dist/dts-built-test.d.ts",
|
||||||
|
"dependencies": {
|
||||||
|
"@vue/shared": "workspace:*",
|
||||||
|
"@vue/reactivity": "workspace:*",
|
||||||
|
"vue": "workspace:*"
|
||||||
|
},
|
||||||
|
"version": "3.3.6"
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { defineComponent } from 'vue'
|
||||||
|
|
||||||
|
const _CustomPropsNotErased = defineComponent({
|
||||||
|
props: {},
|
||||||
|
setup() {}
|
||||||
|
})
|
||||||
|
|
||||||
|
// #8376
|
||||||
|
export const CustomPropsNotErased =
|
||||||
|
_CustomPropsNotErased as typeof _CustomPropsNotErased & {
|
||||||
|
foo: string
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { CustomPropsNotErased } from '@vue/dts-built-test'
|
||||||
|
import { expectType, describe } from './utils'
|
||||||
|
|
||||||
|
declare module 'vue' {
|
||||||
|
interface ComponentCustomProps {
|
||||||
|
custom?: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// #8376 - custom props should not be erased
|
||||||
|
describe('Custom Props not erased', () => {
|
||||||
|
expectType<number | undefined>(new CustomPropsNotErased().$props.custom)
|
||||||
|
})
|
|
@ -2,7 +2,8 @@
|
||||||
"name": "dts-test",
|
"name": "dts-test",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "workspace:*"
|
"vue": "workspace:*",
|
||||||
|
"@vue/dts-built-test": "workspace:*"
|
||||||
},
|
},
|
||||||
"version": "3.3.6"
|
"version": "3.3.6"
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,11 +206,9 @@ export type ComponentPublicInstance<
|
||||||
> = {
|
> = {
|
||||||
$: ComponentInternalInstance
|
$: ComponentInternalInstance
|
||||||
$data: D
|
$data: D
|
||||||
$props: Prettify<
|
$props: MakeDefaultsOptional extends true
|
||||||
MakeDefaultsOptional extends true
|
? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults>
|
||||||
? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults>
|
: Prettify<P> & PublicProps
|
||||||
: P & PublicProps
|
|
||||||
>
|
|
||||||
$attrs: Data
|
$attrs: Data
|
||||||
$refs: Data
|
$refs: Data
|
||||||
$slots: UnwrapSlotsType<S>
|
$slots: UnwrapSlotsType<S>
|
||||||
|
|
|
@ -257,8 +257,23 @@ importers:
|
||||||
specifier: 3.3.6
|
specifier: 3.3.6
|
||||||
version: link:../shared
|
version: link:../shared
|
||||||
|
|
||||||
|
packages/dts-built-test:
|
||||||
|
dependencies:
|
||||||
|
'@vue/reactivity':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../reactivity
|
||||||
|
'@vue/shared':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../shared
|
||||||
|
vue:
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../vue
|
||||||
|
|
||||||
packages/dts-test:
|
packages/dts-test:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@vue/dts-built-test':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../dts-built-test
|
||||||
vue:
|
vue:
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../vue
|
version: link:../vue
|
||||||
|
|
Loading…
Reference in New Issue