diff --git a/packages/dts-test/appUse.test-d.ts b/packages/dts-test/appUse.test-d.ts index 526aa888a..c1bebcd53 100644 --- a/packages/dts-test/appUse.test-d.ts +++ b/packages/dts-test/appUse.test-d.ts @@ -1,4 +1,4 @@ -import { createApp, App, Plugin } from './index' +import { createApp, App, Plugin } from 'vue' const app = createApp({}) diff --git a/packages/dts-test/compiler.test-d.ts b/packages/dts-test/compiler.test-d.ts index 974b49492..c62823739 100644 --- a/packages/dts-test/compiler.test-d.ts +++ b/packages/dts-test/compiler.test-d.ts @@ -1,5 +1,4 @@ import { - expectType, createBlock, VNode, Teleport, @@ -9,7 +8,8 @@ import { Fragment, Suspense, defineComponent -} from './index' +} from 'vue' +import { expectType } from './utils' expectType(createBlock(Teleport)) expectType(createBlock(Text)) diff --git a/packages/dts-test/component.test-d.ts b/packages/dts-test/component.test-d.ts index 5678c8e1c..5535419f1 100644 --- a/packages/dts-test/component.test-d.ts +++ b/packages/dts-test/component.test-d.ts @@ -1,20 +1,16 @@ import { - describe, Component, defineComponent, PropType, ref, Ref, - expectError, - expectType, ShallowUnwrapRef, FunctionalComponent, ComponentPublicInstance, toRefs, - IsAny, - SetupContext, - expectAssignable -} from './index' + SetupContext +} from 'vue' +import { describe, expectAssignable, expectType, IsAny } from './utils' declare function extractComponentOptions( obj: Component @@ -371,7 +367,7 @@ describe('array props', () => { const { props, rawBindings, setup } = extractComponentOptions(MyComponent) // @ts-expect-error props should be readonly - expectError((props.a = 1)) + props.a = 1 expectType(props.a) expectType(props.b) @@ -392,7 +388,7 @@ describe('array props', () => { const { props, rawBindings, setup } = extractComponentOptions(MyComponent) // @ts-expect-error props should be readonly - expectError((props.a = 1)) + props.a = 1 // TODO infer the correct keys // expectType(props.a) diff --git a/packages/dts-test/componentTypeExtensions.test-d.tsx b/packages/dts-test/componentTypeExtensions.test-d.tsx index e26c272c7..4b3c5d7d1 100644 --- a/packages/dts-test/componentTypeExtensions.test-d.tsx +++ b/packages/dts-test/componentTypeExtensions.test-d.tsx @@ -1,6 +1,7 @@ -import { defineComponent, expectError, expectType } from './index' +import { defineComponent } from 'vue' +import { expectType } from './utils' -declare module '@vue/runtime-core' { +declare module 'vue' { interface ComponentCustomOptions { test?(n: number): void } @@ -31,20 +32,16 @@ export const Custom = defineComponent({ methods: { aMethod() { - // @ts-expect-error - expectError(this.notExisting) this.counter++ this.state = 'running' - this.$.appContext.config.globalProperties.state = 'running' - expectError( - // @ts-expect-error - (this.$.appContext.config.globalProperties.state = 'not valid') - ) - // @ts-expect-error - expectError((this.state = 'not valid')) + this.notExisting + // @ts-expect-error + this.state = 'not valid' + // @ts-expect-error + this.$.appContext.config.globalProperties.state = 'not valid' } } }) @@ -57,10 +54,10 @@ expectType() // @ts-expect-error expectType() // @ts-expect-error -expectError() +; // @ts-expect-error -expectError() +; // @ts-expect-error -expectError() +; // @ts-expect-error -expectError() +; diff --git a/packages/dts-test/defineComponent.test-d.tsx b/packages/dts-test/defineComponent.test-d.tsx index 1ad6ee1f3..0d2e35d79 100644 --- a/packages/dts-test/defineComponent.test-d.tsx +++ b/packages/dts-test/defineComponent.test-d.tsx @@ -1,20 +1,16 @@ import { - describe, - test, Component, defineComponent, PropType, ref, reactive, createApp, - expectError, - expectType, ComponentPublicInstance, ComponentOptions, SetupContext, - IsUnion, h -} from './index' +} from 'vue' +import { describe, expectType, IsUnion } from './utils' describe('with object props', () => { interface ExpectedProps { @@ -178,7 +174,7 @@ describe('with object props', () => { expectType(props.lll) // @ts-expect-error props should be readonly - expectError((props.a = 1)) + props.a = 1 // setup context return { @@ -220,7 +216,7 @@ describe('with object props', () => { expectType(props.kkk) // @ts-expect-error props should be readonly - expectError((props.a = 1)) + props.a = 1 // should also expose declared props on `this` expectType(this.a) @@ -248,7 +244,7 @@ describe('with object props', () => { expectType(this.kkk) // @ts-expect-error props on `this` should be readonly - expectError((this.a = 1)) + this.a = 1 // assert setup context unwrapping expectType(this.c) @@ -305,18 +301,14 @@ describe('with object props', () => { ) // @ts-expect-error missing required props - expectError() + let c = + // @ts-expect-error wrong prop types + c = + // @ts-expect-error wrong prop types + c = - expectError( - // @ts-expect-error wrong prop types - - ) - expectError( - // @ts-expect-error wrong prop types - - ) // @ts-expect-error - expectError() + ; // `this` should be void inside of prop validators and prop default factories defineComponent({ @@ -353,17 +345,18 @@ describe('type inference w/ optional props declaration', () => { expectType() // @ts-expect-error - expectError() + ; // @ts-expect-error - expectError() + ; }) describe('type inference w/ direct setup function', () => { const MyComponent = defineComponent((_props: { msg: string }) => {}) expectType() // @ts-expect-error - expectError() - expectError() + ; + // @ts-expect-error + ; }) describe('type inference w/ array props declaration', () => { @@ -371,7 +364,7 @@ describe('type inference w/ array props declaration', () => { props: ['a', 'b'], setup(props) { // @ts-expect-error props should be readonly - expectError((props.a = 1)) + props.a = 1 expectType(props.a) expectType(props.b) return { @@ -382,7 +375,7 @@ describe('type inference w/ array props declaration', () => { expectType(this.$props.a) expectType(this.$props.b) // @ts-expect-error - expectError((this.$props.a = 1)) + this.$props.a = 1 expectType(this.a) expectType(this.b) expectType(this.c) @@ -390,7 +383,7 @@ describe('type inference w/ array props declaration', () => { }) expectType() // @ts-expect-error - expectError() + ; }) describe('type inference w/ options API', () => { @@ -609,17 +602,17 @@ describe('with mixins', () => { // props should be readonly // @ts-expect-error - expectError((this.aP1 = 'new')) + this.aP1 = 'new' // @ts-expect-error - expectError((this.z = 1)) + this.z = 1 // props on `this` should be readonly // @ts-expect-error - expectError((this.bP1 = 1)) + this.bP1 = 1 // string value can not assigned to number type value // @ts-expect-error - expectError((this.c = '1')) + this.c = '1' // setup context properties should be mutable this.d = 5 @@ -635,13 +628,13 @@ describe('with mixins', () => { // missing required props // @ts-expect-error - expectError() + ; // wrong prop types // @ts-expect-error - expectError() + ; // @ts-expect-error - expectError() + ; }) describe('with extends', () => { @@ -700,13 +693,13 @@ describe('with extends', () => { // missing required props // @ts-expect-error - expectError() + ; // wrong prop types // @ts-expect-error - expectError() + ; // @ts-expect-error - expectError() + ; }) describe('extends with mixins', () => { @@ -805,19 +798,19 @@ describe('extends with mixins', () => { // missing required props // @ts-expect-error - expectError() + ; // missing required props from mixin // @ts-expect-error - expectError() + ; // missing required props from extends // @ts-expect-error - expectError() + ; // wrong prop types // @ts-expect-error - expectError() + ; // @ts-expect-error - expectError() + ; // #3468 const CompWithD = defineComponent({ @@ -875,14 +868,14 @@ describe('compatibility w/ createApp', () => { }) describe('defineComponent', () => { - test('should accept components defined with defineComponent', () => { + describe('should accept components defined with defineComponent', () => { const comp = defineComponent({}) defineComponent({ components: { comp } }) }) - test('should accept class components with receiving constructor arguments', () => { + describe('should accept class components with receiving constructor arguments', () => { class Comp { static __vccOpts = {} constructor(_props: { foo: string }) {} @@ -915,29 +908,29 @@ describe('emits', () => { emit('click', 1) emit('input', 'foo') // @ts-expect-error - expectError(emit('nope')) + emit('nope') // @ts-expect-error - expectError(emit('click')) + emit('click') // @ts-expect-error - expectError(emit('click', 'foo')) + emit('click', 'foo') // @ts-expect-error - expectError(emit('input')) + emit('input') // @ts-expect-error - expectError(emit('input', 1)) + emit('input', 1) }, created() { this.$emit('click', 1) this.$emit('input', 'foo') // @ts-expect-error - expectError(this.$emit('nope')) + this.$emit('nope') // @ts-expect-error - expectError(this.$emit('click')) + this.$emit('click') // @ts-expect-error - expectError(this.$emit('click', 'foo')) + this.$emit('click', 'foo') // @ts-expect-error - expectError(this.$emit('input')) + this.$emit('input') // @ts-expect-error - expectError(this.$emit('input', 1)) + this.$emit('input', 1) }, mounted() { // #3599 @@ -947,15 +940,15 @@ describe('emits', () => { this.$emit('click', 1) this.$emit('input', 'foo') // @ts-expect-error - expectError(this.$emit('nope')) + this.$emit('nope') // @ts-expect-error - expectError(this.$emit('click')) + this.$emit('click') // @ts-expect-error - expectError(this.$emit('click', 'foo')) + this.$emit('click', 'foo') // @ts-expect-error - expectError(this.$emit('input')) + this.$emit('input') // @ts-expect-error - expectError(this.$emit('input', 1)) + this.$emit('input', 1) }) } }) @@ -970,14 +963,14 @@ describe('emits', () => { emit('foo', 123) emit('bar') // @ts-expect-error - expectError(emit('nope')) + emit('nope') }, created() { this.$emit('foo') this.$emit('foo', 123) this.$emit('bar') // @ts-expect-error - expectError(this.$emit('nope')) + this.$emit('nope') } }) @@ -990,9 +983,9 @@ describe('emits', () => { expectType<((n: number) => any) | undefined>(props.onClick) emit('click', 1) // @ts-expect-error - expectError(emit('click')) + emit('click') // @ts-expect-error - expectError(emit('click', 'foo')) + emit('click', 'foo') } }) @@ -1047,7 +1040,7 @@ describe('inject', () => { expectType(this.foo) expectType(this.bar) // @ts-expect-error - expectError((this.foobar = 1)) + this.foobar = 1 } }) @@ -1059,7 +1052,7 @@ describe('inject', () => { expectType(this.foo) expectType(this.bar) // @ts-expect-error - expectError((this.foobar = 1)) + this.foobar = 1 } }) @@ -1079,7 +1072,7 @@ describe('inject', () => { expectType(this.foo) expectType(this.bar) // @ts-expect-error - expectError((this.foobar = 1)) + this.foobar = 1 } }) @@ -1088,9 +1081,9 @@ describe('inject', () => { props: ['a', 'b'], created() { // @ts-expect-error - expectError((this.foo = 1)) + this.foo = 1 // @ts-expect-error - expectError((this.bar = 1)) + this.bar = 1 } }) }) @@ -1145,15 +1138,15 @@ describe('extract instance type', () => { expectType(compA.baseA) // @ts-expect-error - expectError((compA.a = true)) + compA.a = true // @ts-expect-error - expectError((compA.b = 'foo')) + compA.b = 'foo' // @ts-expect-error - expectError((compA.c = 1)) + compA.c = 1 // @ts-expect-error - expectError((compA.mA = 'foo')) + compA.mA = 'foo' // @ts-expect-error - expectError((compA.baseA = 1)) + compA.baseA = 1 }) describe('async setup', () => { @@ -1285,7 +1278,7 @@ import { AllowedComponentProps, ComponentCustomProps, ExtractPropTypes -} from './index' +} from 'vue' // code generated by tsc / vue-tsc, make sure this continues to work // so we don't accidentally change the args order of DefineComponent diff --git a/packages/dts-test/defineCustomElement.test-d.ts b/packages/dts-test/defineCustomElement.test-d.ts index 14a4b52a3..4e7cf2283 100644 --- a/packages/dts-test/defineCustomElement.test-d.ts +++ b/packages/dts-test/defineCustomElement.test-d.ts @@ -1,4 +1,5 @@ -import { defineCustomElement, expectType, expectError, describe } from './index' +import { defineCustomElement } from 'vue' +import { expectType, describe } from './utils' describe('inject', () => { // with object inject @@ -14,7 +15,7 @@ describe('inject', () => { expectType(this.foo) expectType(this.bar) // @ts-expect-error - expectError((this.foobar = 1)) + this.foobar = 1 } }) @@ -26,7 +27,7 @@ describe('inject', () => { expectType(this.foo) expectType(this.bar) // @ts-expect-error - expectError((this.foobar = 1)) + this.foobar = 1 } }) @@ -46,7 +47,7 @@ describe('inject', () => { expectType(this.foo) expectType(this.bar) // @ts-expect-error - expectError((this.foobar = 1)) + this.foobar = 1 } }) @@ -55,9 +56,9 @@ describe('inject', () => { props: ['a', 'b'], created() { // @ts-expect-error - expectError((this.foo = 1)) + this.foo = 1 // @ts-expect-error - expectError((this.bar = 1)) + this.bar = 1 } }) }) diff --git a/packages/dts-test/functionalComponent.test-d.tsx b/packages/dts-test/functionalComponent.test-d.tsx index fdcf346fb..383debcb7 100644 --- a/packages/dts-test/functionalComponent.test-d.tsx +++ b/packages/dts-test/functionalComponent.test-d.tsx @@ -1,11 +1,5 @@ -import { - h, - Text, - FunctionalComponent, - expectError, - expectType, - Component -} from './index' +import { h, Text, FunctionalComponent, Component } from 'vue' +import { expectType } from './utils' // simple function signature const Foo = (props: { foo: number }) => h(Text, null, props.foo) @@ -15,11 +9,11 @@ expectType() expectType() expectType() // @ts-expect-error -expectError() +; // @ts-expect-error -expectError() +; // @ts-expect-error -expectError() +; // Explicit signature with props + emits const Bar: FunctionalComponent< @@ -30,11 +24,11 @@ const Bar: FunctionalComponent< emit('update', 123) // @ts-expect-error - expectError(emit('nope')) + emit('nope') // @ts-expect-error - expectError(emit('update')) + emit('update') // @ts-expect-error - expectError(emit('update', 'nope')) + emit('update', 'nope') } // assigning runtime options @@ -42,22 +36,22 @@ Bar.props = { foo: Number } // @ts-expect-error -expectError((Bar.props = { foo: String })) +Bar.props = { foo: String } Bar.emits = { update: value => value > 1 } // @ts-expect-error -expectError((Bar.emits = { baz: () => void 0 })) +Bar.emits = { baz: () => void 0 } // TSX expectType() // @ts-expect-error -expectError() +; // @ts-expect-error -expectError() +; // @ts-expect-error -expectError() +; const Baz: FunctionalComponent<{}, string[]> = (props, { emit }) => { expectType<{}>(props) diff --git a/packages/dts-test/h.test-d.ts b/packages/dts-test/h.test-d.ts index 6116fff74..92246f0f9 100644 --- a/packages/dts-test/h.test-d.ts +++ b/packages/dts-test/h.test-d.ts @@ -1,5 +1,4 @@ import { - describe, h, defineComponent, ref, @@ -7,29 +6,28 @@ import { Teleport, Suspense, Component, - expectError, - expectAssignable, resolveComponent -} from './index' +} from 'vue' +import { describe, expectAssignable } from './utils' describe('h inference w/ element', () => { // key h('div', { key: 1 }) h('div', { key: 'foo' }) // @ts-expect-error - expectError(h('div', { key: [] })) + h('div', { key: [] }) // @ts-expect-error - expectError(h('div', { key: {} })) + h('div', { key: {} }) // ref h('div', { ref: 'foo' }) h('div', { ref: ref(null) }) h('div', { ref: _el => {} }) // @ts-expect-error - expectError(h('div', { ref: [] })) + h('div', { ref: [] }) // @ts-expect-error - expectError(h('div', { ref: {} })) + h('div', { ref: {} }) // @ts-expect-error - expectError(h('div', { ref: 123 })) + h('div', { ref: 123 }) // slots const slots = { default: () => {} } // RawSlots h('div', {}, slots) @@ -40,20 +38,20 @@ describe('h inference w/ Fragment', () => { h(Fragment, ['hello']) h(Fragment, { key: 123 }, ['hello']) // @ts-expect-error - expectError(h(Fragment, 'foo')) + h(Fragment, 'foo') // @ts-expect-error - expectError(h(Fragment, { key: 123 }, 'bar')) + h(Fragment, { key: 123 }, 'bar') }) describe('h inference w/ Teleport', () => { h(Teleport, { to: '#foo' }, 'hello') h(Teleport, { to: '#foo' }, { default() {} }) // @ts-expect-error - expectError(h(Teleport)) + h(Teleport) // @ts-expect-error - expectError(h(Teleport, {})) + h(Teleport, {}) // @ts-expect-error - expectError(h(Teleport, { to: '#foo' })) + h(Teleport, { to: '#foo' }) }) describe('h inference w/ Suspense', () => { @@ -64,7 +62,7 @@ describe('h inference w/ Suspense', () => { default: () => 'foo' }) // @ts-expect-error - expectError(h(Suspense, { onResolve: 1 })) + h(Suspense, { onResolve: 1 }) }) describe('h inference w/ functional component', () => { @@ -72,11 +70,11 @@ describe('h inference w/ functional component', () => { h(Func, { foo: 'hello' }) h(Func, { foo: 'hello', bar: 123 }) // @ts-expect-error - expectError(h(Func, { foo: 123 })) + h(Func, { foo: 123 }) // @ts-expect-error - expectError(h(Func, {})) + h(Func, {}) // @ts-expect-error - expectError(h(Func, { bar: 123 })) + h(Func, { bar: 123 }) }) describe('h support w/ plain object component', () => { @@ -106,11 +104,11 @@ describe('h inference w/ defineComponent', () => { // should allow extraneous props (attrs fallthrough) h(Foo, { bar: 1, foo: 'ok', class: 'extra' }) // @ts-expect-error should fail on missing required prop - expectError(h(Foo, {})) + h(Foo, {}) // @ts-expect-error - expectError(h(Foo, { foo: 'ok' })) + h(Foo, { foo: 'ok' }) // @ts-expect-error should fail on wrong type - expectError(h(Foo, { bar: 1, foo: 1 })) + h(Foo, { bar: 1, foo: 1 }) }) // describe('h inference w/ defineComponent + optional props', () => { @@ -123,11 +121,11 @@ describe('h inference w/ defineComponent', () => { // // should allow extraneous props (attrs fallthrough) // h(Foo, { bar: 1, foo: 'ok', class: 'extra' }) // // @ts-expect-error should fail on missing required prop -// expectError(h(Foo, {})) +// h(Foo, {}) // // @ts-expect-error -// expectError(h(Foo, { foo: 'ok' })) +// h(Foo, { foo: 'ok' }) // // @ts-expect-error should fail on wrong type -// expectError(h(Foo, { bar: 1, foo: 1 })) +// h(Foo, { bar: 1, foo: 1 }) // }) // describe('h inference w/ defineComponent + direct function', () => { @@ -138,11 +136,11 @@ describe('h inference w/ defineComponent', () => { // // should allow extraneous props (attrs fallthrough) // h(Foo, { bar: 1, foo: 'ok', class: 'extra' }) // // @ts-expect-error should fail on missing required prop -// expectError(h(Foo, {})) +// h(Foo, {}) // // @ts-expect-error -// expectError(h(Foo, { foo: 'ok' })) +// h(Foo, { foo: 'ok' }) // // @ts-expect-error should fail on wrong type -// expectError(h(Foo, { bar: 1, foo: 1 })) +// h(Foo, { bar: 1, foo: 1 }) // }) // #922 and #3218 @@ -223,7 +221,7 @@ describe('Boolean prop implicit false', () => { visible: true }) // @ts-expect-error - expectError(h(RequiredComponent, {})) + h(RequiredComponent, {}) }) // #2357 diff --git a/packages/dts-test/inject.test-d.ts b/packages/dts-test/inject.test-d.ts index 69e06f170..c34485a61 100644 --- a/packages/dts-test/inject.test-d.ts +++ b/packages/dts-test/inject.test-d.ts @@ -1,4 +1,5 @@ -import { provide, inject, InjectionKey, expectType } from './index' +import { provide, inject, InjectionKey } from 'vue' +import { expectType } from './utils' const key: InjectionKey = Symbol() diff --git a/packages/dts-test/package.json b/packages/dts-test/package.json index 72f0e322a..6894c3239 100644 --- a/packages/dts-test/package.json +++ b/packages/dts-test/package.json @@ -2,9 +2,6 @@ "name": "dts-test", "private": true, "dependencies": { - "vue": "workspace:*", - "@vue/runtime-core": "workspace:*", - "@vue/runtime-dom": "workspace:*", - "@vue/reactivity": "workspace:*" + "vue": "workspace:*" } } diff --git a/packages/dts-test/reactivity.test-d.ts b/packages/dts-test/reactivity.test-d.ts index 337f05e14..4504f9e35 100644 --- a/packages/dts-test/reactivity.test-d.ts +++ b/packages/dts-test/reactivity.test-d.ts @@ -1,21 +1,12 @@ -import { - ref, - readonly, - shallowReadonly, - describe, - expectError, - expectType, - Ref, - reactive, - markRaw -} from './index' +import { ref, readonly, shallowReadonly, Ref, reactive, markRaw } from 'vue' +import { describe, expectType } from './utils' describe('should support DeepReadonly', () => { const r = readonly({ obj: { k: 'v' } }) // @ts-expect-error - expectError((r.obj = {})) + r.obj = {} // @ts-expect-error - expectError((r.obj.k = 'x')) + r.obj.k = 'x' }) // #4180 diff --git a/packages/dts-test/reactivityMacros.test-d.ts b/packages/dts-test/reactivityMacros.test-d.ts index 6bc5f17cb..9f9b5faed 100644 --- a/packages/dts-test/reactivityMacros.test-d.ts +++ b/packages/dts-test/reactivityMacros.test-d.ts @@ -1,13 +1,7 @@ -import { - expectType, - ref, - computed, - Ref, - ComputedRef, - WritableComputedRef -} from './index' +import { ref, computed, Ref, ComputedRef, WritableComputedRef } from 'vue' import 'vue/macros-global' import { RefType, RefTypes } from 'vue/macros' +import { expectType } from './utils' // wrapping refs diff --git a/packages/dts-test/ref.test-d.ts b/packages/dts-test/ref.test-d.ts index accaaeee8..dbf54de09 100644 --- a/packages/dts-test/ref.test-d.ts +++ b/packages/dts-test/ref.test-d.ts @@ -5,15 +5,14 @@ import { isRef, unref, reactive, - expectType, proxyRefs, toRef, toRefs, ToRefs, shallowReactive, - readonly, - describe -} from './index' + readonly +} from 'vue' +import { expectType, describe } from './utils' function plainType(arg: number | Ref) { // ref coercing diff --git a/packages/dts-test/setupHelpers.test-d.ts b/packages/dts-test/setupHelpers.test-d.ts index 4d79fc8f4..8ad085f9b 100644 --- a/packages/dts-test/setupHelpers.test-d.ts +++ b/packages/dts-test/setupHelpers.test-d.ts @@ -1,13 +1,12 @@ import { - expectType, defineProps, defineEmits, useAttrs, useSlots, withDefaults, - Slots, - describe -} from './index' + Slots +} from 'vue' +import { describe, expectType } from './utils' describe('defineProps w/ type declaration', () => { // type declaration diff --git a/packages/dts-test/tsx.test-d.tsx b/packages/dts-test/tsx.test-d.tsx index ce1aec820..8dba0a806 100644 --- a/packages/dts-test/tsx.test-d.tsx +++ b/packages/dts-test/tsx.test-d.tsx @@ -1,13 +1,6 @@ // TSX w/ defineComponent is tested in defineComponent.test-d.tsx -import { - KeepAlive, - Suspense, - Fragment, - Teleport, - expectError, - expectType, - VNode -} from './index' +import { KeepAlive, Suspense, Fragment, Teleport, VNode } from 'vue' +import { expectType } from './utils' expectType(
) expectType(
) @@ -15,7 +8,7 @@ expectType(
) expectType() // @ts-expect-error style css property validation -expectError(
) +;
// allow array styles and nested array styles expectType(
) @@ -24,7 +17,7 @@ expectType( ) // @ts-expect-error unknown prop -expectError(
) +;
// allow key/ref on arbitrary element expectType(
) @@ -47,15 +40,15 @@ expectType() expectType() // @ts-expect-error -expectError() +; // @ts-expect-error -expectError() +; // KeepAlive expectType() expectType() // @ts-expect-error -expectError() +; // Suspense expectType() @@ -64,4 +57,4 @@ expectType( {}} onFallback={() => {}} onPending={() => {}} /> ) // @ts-expect-error -expectError() +; diff --git a/packages/dts-test/index.d.ts b/packages/dts-test/utils.d.ts similarity index 88% rename from packages/dts-test/index.d.ts rename to packages/dts-test/utils.d.ts index 2945d492d..012f97729 100644 --- a/packages/dts-test/index.d.ts +++ b/packages/dts-test/utils.d.ts @@ -1,13 +1,10 @@ // This directory contains a number of d.ts assertions // use \@ts-expect-error where errors are expected. -export * from 'vue' - export function describe(_name: string, _fn: () => void): void export function test(_name: string, _fn: () => any): void export function expectType(value: T): void -export function expectError(value: T): void export function expectAssignable(value: T2): void export type IsUnion = ( diff --git a/packages/dts-test/watch.test-d.ts b/packages/dts-test/watch.test-d.ts index 2c16cabd9..9d727999b 100644 --- a/packages/dts-test/watch.test-d.ts +++ b/packages/dts-test/watch.test-d.ts @@ -1,4 +1,5 @@ -import { ref, computed, watch, expectType, defineComponent } from './index' +import { ref, computed, watch, defineComponent } from 'vue' +import { expectType } from './utils' const source = ref('foo') const source2 = computed(() => source.value) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f7b074d64..849abe6e6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -182,14 +182,8 @@ importers: packages/dts-test: specifiers: - '@vue/reactivity': workspace:* - '@vue/runtime-core': workspace:* - '@vue/runtime-dom': workspace:* vue: workspace:* dependencies: - '@vue/reactivity': link:../reactivity - '@vue/runtime-core': link:../runtime-core - '@vue/runtime-dom': link:../runtime-dom vue: link:../vue packages/reactivity: