Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 ')}
}`
}
Expand Down
8 changes: 4 additions & 4 deletions test/__snapshots__/dts.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export {}

/* prettier-ignore */
declare module 'vue' {
export interface ComponentCustomProperties {
export interface GlobalDirectives {
vLoading: typeof import('test/directive/Loading')['default']
}
}
Expand All @@ -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']
}
}
Expand Down Expand Up @@ -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']
Expand All @@ -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']
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/dts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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']
Expand Down