Skip to content

Commit 61c2b07

Browse files
authored
feat(types): use GlobalDirectives instead of ComponentCustomProperties (#839)
1 parent 24f5c90 commit 61c2b07

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/core/declaration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function parseDeclaration(code: string): DeclarationImports | undefined {
3131
if (componentDeclaration)
3232
imports.component = extractImports(componentDeclaration)
3333

34-
const directiveDeclaration = /export\s+interface\s+ComponentCustomProperties\s*\{.*?\}/s.exec(code)?.[0]
34+
const directiveDeclaration = /export\s+interface\s+GlobalDirectives\s*\{.*?\}/s.exec(code)?.[0]
3535
if (directiveDeclaration)
3636
imports.directive = extractImports(directiveDeclaration)
3737

@@ -132,7 +132,7 @@ declare module 'vue' {`
132132
}
133133
if (Object.keys(declarations.directive).length > 0) {
134134
code += `
135-
export interface ComponentCustomProperties {
135+
export interface GlobalDirectives {
136136
${declarations.directive.join('\n ')}
137137
}`
138138
}

test/__snapshots__/dts.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export {}
2929
3030
/* prettier-ignore */
3131
declare module 'vue' {
32-
export interface ComponentCustomProperties {
32+
export interface GlobalDirectives {
3333
vLoading: typeof import('test/directive/Loading')['default']
3434
}
3535
}
@@ -51,7 +51,7 @@ declare module 'vue' {
5151
RouterView: typeof import('vue-router')['RouterView']
5252
TestComp: typeof import('test/component/TestComp')['default']
5353
}
54-
export interface ComponentCustomProperties {
54+
export interface GlobalDirectives {
5555
vLoading: typeof import('test/directive/Loading')['default']
5656
}
5757
}
@@ -130,7 +130,7 @@ declare module 'vue' {
130130
SomeComp: typeof import('test/component/SomeComp')['default']
131131
TestComp: typeof import('test/component/TestComp')['default']
132132
}
133-
export interface ComponentCustomProperties {
133+
export interface GlobalDirectives {
134134
vDirective: typeof import('foo')
135135
vLoading: typeof import('test/directive/Loading')['default']
136136
vSome: typeof import('test/directive/Some')['default']
@@ -154,7 +154,7 @@ declare module 'vue' {
154154
RouterView: typeof import('vue-router')['RouterView']
155155
TestComp: typeof import('test/component/TestComp')['default']
156156
}
157-
export interface ComponentCustomProperties {
157+
export interface GlobalDirectives {
158158
vLoading: typeof import('test/directive/Loading')['default']
159159
}
160160
}

test/dts.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ declare module 'vue' {
5757
SomeComp: typeof import('test/component/SomeComp')['default']
5858
TestComp: typeof import('test/component/OldComp')['default']
5959
}
60-
export interface ComponentCustomProperties{
60+
export interface GlobalDirectives{
6161
// with comment: b
6262
// a:
6363
vSome: typeof import('test/directive/Some')['default'];vDirective:typeof import('foo')
@@ -179,7 +179,7 @@ declare module 'vue' {
179179
IMdiLightAlarm: typeof import('~icons/mdi-light/alarm')['default']
180180
}
181181
182-
export interface ComponentCustomProperties {
182+
export interface GlobalDirectives {
183183
vDirective: typeof import('foo')
184184
vLoading: typeof import('test/directive/Loading')['default']
185185
vSome: typeof import('test/directive/Some')['default']

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy