File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
language-service/lib/plugins
typescript-plugin/lib/requests Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -327,7 +327,7 @@ export function create(
327
327
...attrs . map < ComponentPropInfo > ( attr => ( { name : attr } ) ) ,
328
328
] ) {
329
329
330
- const isGlobal = ! propsSet . has ( prop . name ) ;
330
+ const isGlobal = prop . isAttribute || ! propsSet . has ( prop . name ) ;
331
331
const name = casing . attr === AttrNameCasing . Camel ? prop . name : hyphenateAttr ( prop . name ) ;
332
332
const isEvent = hyphenateAttr ( name ) . startsWith ( 'on-' ) ;
333
333
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export interface ComponentPropInfo {
7
7
name : string ;
8
8
required ?: boolean ;
9
9
deprecated ?: boolean ;
10
+ isAttribute ?: boolean ;
10
11
commentMarkdown ?: string ;
11
12
values ?: string [ ] ;
12
13
}
@@ -84,10 +85,27 @@ export function getComponentProps(
84
85
}
85
86
}
86
87
88
+ let isAttribute : boolean | undefined ;
89
+ for ( const { parent } of checker . getRootSymbols ( prop ) . flatMap ( root => root . declarations ?? [ ] ) ) {
90
+ if ( ! ts . isInterfaceDeclaration ( parent ) ) {
91
+ continue ;
92
+ }
93
+ const { text } = parent . name ;
94
+ if (
95
+ text . endsWith ( 'HTMLAttributes' )
96
+ || text === 'AriaAttributes'
97
+ || text === 'SVGAttributes'
98
+ ) {
99
+ isAttribute = true ;
100
+ break ;
101
+ }
102
+ }
103
+
87
104
result . set ( name , {
88
105
name,
89
106
required,
90
107
deprecated,
108
+ isAttribute,
91
109
commentMarkdown,
92
110
values,
93
111
} ) ;
You can’t perform that action at this time.
0 commit comments