@@ -16,7 +16,7 @@ const isLiteralWhitelisted = /*@__PURE__*/ makeMap('true,false,null,this');
1616export function * generateInterpolation (
1717 options : Pick <
1818 TemplateCodegenOptions | StyleCodegenOptions ,
19- 'ts' | 'destructuredPropNames' | ' templateRefNames'
19+ 'ts' | 'templateRefNames'
2020 > ,
2121 ctx : TemplateCodegenContext ,
2222 block : SfcBlock ,
@@ -70,9 +70,9 @@ export function* generateInterpolation(
7070}
7171
7272function * forEachInterpolationSegment (
73- options : Pick <
73+ { ts , templateRefNames } : Pick <
7474 TemplateCodegenOptions | StyleCodegenOptions ,
75- 'ts' | 'destructuredPropNames' | ' templateRefNames'
75+ 'ts' | 'templateRefNames'
7676 > ,
7777 ctx : TemplateCodegenContext ,
7878 block : SfcBlock ,
@@ -93,7 +93,7 @@ function* forEachInterpolationSegment(
9393
9494 for (
9595 const [ name , offset , isShorthand ] of forEachIdentifiers (
96- options ,
96+ ts ,
9797 ctx ,
9898 block ,
9999 originalCode ,
@@ -113,7 +113,7 @@ function* forEachInterpolationSegment(
113113 // fix https://github.com/vuejs/language-tools/issues/1264
114114 yield [ '' , offset , 'errorMappingOnly' ] ;
115115
116- if ( options . templateRefNames . has ( name ) ) {
116+ if ( templateRefNames . has ( name ) ) {
117117 yield `__VLS_unref(` ;
118118 yield [ name , offset ] ;
119119 yield `)` ;
@@ -134,29 +134,25 @@ function* forEachInterpolationSegment(
134134}
135135
136136function * forEachIdentifiers (
137- options : Pick <
138- TemplateCodegenOptions | StyleCodegenOptions ,
139- 'ts' | 'destructuredPropNames'
140- > ,
137+ ts : typeof import ( 'typescript' ) ,
141138 ctx : TemplateCodegenContext ,
142139 block : SfcBlock ,
143140 originalCode : string ,
144141 code : string ,
145142 prefix : string ,
146143) : Generator < [ string , number , boolean ] > {
147144 if (
148- identifierRegex . test ( originalCode ) && ! shouldIdentifierSkipped ( options , ctx , originalCode )
145+ identifierRegex . test ( originalCode ) && ! shouldIdentifierSkipped ( ctx , originalCode )
149146 ) {
150147 yield [ originalCode , prefix . length , false ] ;
151148 return ;
152149 }
153150
154- const { ts } = options ;
155151 const endScope = ctx . startScope ( ) ;
156152 const ast = getTypeScriptAST ( ts , block , code ) ;
157153 for ( const [ id , isShorthand ] of forEachDeclarations ( ts , ast , ast , ctx ) ) {
158154 const text = getNodeText ( ts , id , ast ) ;
159- if ( shouldIdentifierSkipped ( options , ctx , text ) ) {
155+ if ( shouldIdentifierSkipped ( ctx , text ) ) {
160156 continue ;
161157 }
162158 yield [ text , getStartEnd ( ts , id , ast ) . start , isShorthand ] ;
@@ -288,10 +284,6 @@ function* forEachDeclarationsInTypeNode(
288284}
289285
290286function shouldIdentifierSkipped (
291- { destructuredPropNames } : Pick <
292- TemplateCodegenOptions | StyleCodegenOptions ,
293- 'destructuredPropNames'
294- > ,
295287 ctx : TemplateCodegenContext ,
296288 text : string ,
297289) {
@@ -300,6 +292,5 @@ function shouldIdentifierSkipped(
300292 || isGloballyAllowed ( text )
301293 || isLiteralWhitelisted ( text )
302294 || text === 'require'
303- || text . startsWith ( '__VLS_' )
304- || destructuredPropNames . has ( text ) ;
295+ || text . startsWith ( '__VLS_' ) ;
305296}
0 commit comments