@@ -207,30 +207,30 @@ export class ExportedNames {
207207 }
208208
209209 // Easy mode: User uses TypeScript and typed the $props() rune
210- if ( node . initializer . typeArguments ?. length > 0 || node . type ) {
210+ if ( node . type ) {
211211 this . hoistableInterfaces . analyze$propsRune ( node ) ;
212212
213- const generic_arg = node . initializer . typeArguments ?. [ 0 ] || node . type ;
214- const generic = generic_arg . getText ( ) ;
215- if ( ts . isTypeReferenceNode ( generic_arg ) ) {
216- this . $props . type = generic ;
213+ const props_type = node . type ;
214+ const type_name = props_type . getText ( ) ;
215+ if ( ts . isTypeReferenceNode ( props_type ) ) {
216+ this . $props . type = type_name ;
217217 } else {
218218 // Create a virtual type alias for the unnamed generic and reuse it for the props return type
219219 // so that rename, find references etc works seamlessly across components
220220 this . $props . type = '$$ComponentProps' ;
221221 preprendStr (
222222 this . str ,
223- generic_arg . pos + this . astOffset ,
223+ props_type . pos + this . astOffset ,
224224 `;type ${ this . $props . type } = `
225225 ) ;
226- this . str . appendLeft ( generic_arg . end + this . astOffset , ';' ) ;
226+ this . str . appendLeft ( props_type . end + this . astOffset , ';' ) ;
227227 this . str . move (
228- generic_arg . pos + this . astOffset ,
229- generic_arg . end + this . astOffset ,
228+ props_type . pos + this . astOffset ,
229+ props_type . end + this . astOffset ,
230230 node . parent . pos + this . astOffset
231231 ) ;
232232 this . str . appendRight (
233- generic_arg . end + this . astOffset ,
233+ props_type . end + this . astOffset ,
234234 // so that semantic tokens ignore it, preventing an overlap of tokens
235235 surroundWithIgnoreComments ( this . $props . type )
236236 ) ;
0 commit comments