diff --git a/src/core/declaration.ts b/src/core/declaration.ts index fa6241c4..f270b3db 100644 --- a/src/core/declaration.ts +++ b/src/core/declaration.ts @@ -114,20 +114,14 @@ export function getDeclaration(ctx: Context, filepath: string, originalImports?: directive: stringifyDeclarationImports({ ...originalImports?.directive, ...imports.directive }), } - const head = ctx.options.version === 2.7 - ? `export {} - -declare module 'vue' {` - : `export {} - -declare module 'vue' {` - let code = `/* eslint-disable */ -/* prettier-ignore */ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 -${head}` +export {} + +/* prettier-ignore */ +declare module 'vue' {` if (Object.keys(declarations.component).length > 0) { code += ` diff --git a/test/__snapshots__/dts.test.ts.snap b/test/__snapshots__/dts.test.ts.snap index ea2af4da..7dabf7c9 100644 --- a/test/__snapshots__/dts.test.ts.snap +++ b/test/__snapshots__/dts.test.ts.snap @@ -2,12 +2,12 @@ exports[`dts > components only 1`] = ` "/* eslint-disable */ -/* prettier-ignore */ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { RouterLink: typeof import('vue-router')['RouterLink'] @@ -20,12 +20,12 @@ declare module 'vue' { exports[`dts > directive only 1`] = ` "/* eslint-disable */ -/* prettier-ignore */ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface ComponentCustomProperties { vLoading: typeof import('test/directive/Loading')['default'] @@ -36,12 +36,12 @@ declare module 'vue' { exports[`dts > getDeclaration 1`] = ` "/* eslint-disable */ -/* prettier-ignore */ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { RouterLink: typeof import('vue-router')['RouterLink'] @@ -94,12 +94,12 @@ exports[`dts > parseDeclaration 1`] = ` exports[`dts > vue 2.7 components only 1`] = ` "/* eslint-disable */ -/* prettier-ignore */ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { RouterLink: typeof import('vue-router')['RouterLink'] @@ -112,12 +112,12 @@ declare module 'vue' { exports[`dts > writeDeclaration - keep unused 1`] = ` "/* eslint-disable */ -/* prettier-ignore */ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { RouterLink: typeof import('vue-router')['RouterLink'] @@ -136,12 +136,12 @@ declare module 'vue' { exports[`dts > writeDeclaration 1`] = ` "/* eslint-disable */ -/* prettier-ignore */ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/test/dts.test.ts b/test/dts.test.ts index b47de6b5..318f069b 100644 --- a/test/dts.test.ts +++ b/test/dts.test.ts @@ -124,12 +124,12 @@ const _directive_loading = _resolveDirective("loading")` test('parseDeclaration', async () => { const code = ` /* eslint-disable */ -/* prettier-ignore */ // generated by unplugin-vue-components // We suggest you to commit this file into source control // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { ComponentA: typeof import('./src/components/ComponentA.vue')['default'] @@ -145,12 +145,12 @@ declare module 'vue' { test('parseDeclaration - has icon component like ', async () => { const code = ` /* eslint-disable */ -/* prettier-ignore */ // generated by unplugin-vue-components // We suggest you to commit this file into source control // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { ComponentA: typeof import('./src/components/ComponentA.vue')['default'] @@ -166,12 +166,12 @@ declare module 'vue' { test('parseDeclaration - with directives', async () => { const code = ` /* eslint-disable */ -/* prettier-ignore */ // generated by unplugin-vue-components // We suggest you to commit this file into source control // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { ComponentA: typeof import('./src/components/ComponentA.vue')['default']