@@ -33,7 +33,7 @@ export type RewriteInput = { script: SourceFile; template?: SourceFile };
3333//
3434// 1. It doesn't break Organize Imports command
3535// 2. It doesn't introduce any keywords/variables that'll show up in auto-complete suggestions
36- const EXTENSION_FIXING_HEADER_HACK = `
36+ const EXTENSION_FIXING_HEADER_HACK_GTS = `
3737// @ts-expect-error
3838({} as typeof import('./__glint-hacky-nonexistent.gts'));
3939
@@ -42,6 +42,15 @@ const EXTENSION_FIXING_HEADER_HACK = `
4242
4343` ;
4444
45+ const EXTENSION_FIXING_HEADER_HACK_GJS = `
46+ // @ts-expect-error
47+ (/** @type {typeof import("./__glint-hacky-nonexistent.gts")} */ ({}))
48+
49+ // @ts-expect-error
50+ (/** @type {typeof import("./__glint-hacky-nonexistent.gjs")} */ ({}))
51+
52+ ` ;
53+
4554/**
4655 * Given the script and/or template that together comprise a component module,
4756 * returns a `TransformedModule` representing the combined result, with the
@@ -70,7 +79,7 @@ export function rewriteModule(
7079 let sparseSpans = completeCorrelatedSpans ( partialSpans ) ;
7180 let { contents, correlatedSpans } = calculateTransformedSource ( script , sparseSpans ) ;
7281
73- return new TransformedModule ( contents , errors , directives , correlatedSpans ) ;
82+ return new TransformedModule ( contents , errors , directives , correlatedSpans , script . filename ) ;
7483}
7584
7685/**
@@ -94,7 +103,9 @@ function calculateCorrelatedSpans(
94103 originalStart : 0 ,
95104 originalLength : 0 ,
96105 insertionPoint : 0 ,
97- transformedSource : EXTENSION_FIXING_HEADER_HACK ,
106+ transformedSource : environment . isUntypedScript ( script . filename )
107+ ? EXTENSION_FIXING_HEADER_HACK_GJS
108+ : EXTENSION_FIXING_HEADER_HACK_GTS ,
98109 } ,
99110 ] ;
100111
0 commit comments