diff --git a/src/core/declaration.ts b/src/core/declaration.ts index 4fd2c168..7259be71 100644 --- a/src/core/declaration.ts +++ b/src/core/declaration.ts @@ -31,7 +31,7 @@ export function parseDeclaration(code: string): DeclarationImports | undefined { if (componentDeclaration) imports.component = extractImports(componentDeclaration) - const directiveDeclaration = /export\s+interface\s+ComponentCustomProperties\s*\{.*?\}/s.exec(code)?.[0] + const directiveDeclaration = /export\s+interface\s+GlobalDirectives\s*\{.*?\}/s.exec(code)?.[0] if (directiveDeclaration) imports.directive = extractImports(directiveDeclaration) @@ -132,7 +132,7 @@ declare module 'vue' {` } if (Object.keys(declarations.directive).length > 0) { code += ` - export interface ComponentCustomProperties { + export interface GlobalDirectives { ${declarations.directive.join('\n ')} }` } diff --git a/test/__snapshots__/dts.test.ts.snap b/test/__snapshots__/dts.test.ts.snap index 75752379..c1d09dda 100644 --- a/test/__snapshots__/dts.test.ts.snap +++ b/test/__snapshots__/dts.test.ts.snap @@ -29,7 +29,7 @@ export {} /* prettier-ignore */ declare module 'vue' { - export interface ComponentCustomProperties { + export interface GlobalDirectives { vLoading: typeof import('test/directive/Loading')['default'] } } @@ -51,7 +51,7 @@ declare module 'vue' { RouterView: typeof import('vue-router')['RouterView'] TestComp: typeof import('test/component/TestComp')['default'] } - export interface ComponentCustomProperties { + export interface GlobalDirectives { vLoading: typeof import('test/directive/Loading')['default'] } } @@ -130,7 +130,7 @@ declare module 'vue' { SomeComp: typeof import('test/component/SomeComp')['default'] TestComp: typeof import('test/component/TestComp')['default'] } - export interface ComponentCustomProperties { + export interface GlobalDirectives { vDirective: typeof import('foo') vLoading: typeof import('test/directive/Loading')['default'] vSome: typeof import('test/directive/Some')['default'] @@ -154,7 +154,7 @@ declare module 'vue' { RouterView: typeof import('vue-router')['RouterView'] TestComp: typeof import('test/component/TestComp')['default'] } - export interface ComponentCustomProperties { + export interface GlobalDirectives { vLoading: typeof import('test/directive/Loading')['default'] } } diff --git a/test/dts.test.ts b/test/dts.test.ts index b26ccba4..9ddf0f5d 100644 --- a/test/dts.test.ts +++ b/test/dts.test.ts @@ -57,7 +57,7 @@ declare module 'vue' { SomeComp: typeof import('test/component/SomeComp')['default'] TestComp: typeof import('test/component/OldComp')['default'] } - export interface ComponentCustomProperties{ + export interface GlobalDirectives{ // with comment: b // a: vSome: typeof import('test/directive/Some')['default'];vDirective:typeof import('foo') @@ -179,7 +179,7 @@ declare module 'vue' { IMdiLightAlarm: typeof import('~icons/mdi-light/alarm')['default'] } - export interface ComponentCustomProperties { + export interface GlobalDirectives { vDirective: typeof import('foo') vLoading: typeof import('test/directive/Loading')['default'] vSome: typeof import('test/directive/Some')['default']