@@ -219,40 +219,44 @@ export class StandardTemplateSourceHelper implements TemplateSourceHelper {
219
219
return undefined
220
220
}
221
221
222
- if ( this . typescript . isTaggedTemplateExpression ( node ) ) {
222
+ const { typescript : ts } = this
223
+
224
+ if ( ts . isTaggedTemplateExpression ( node ) ) {
223
225
return this . getValidTemplateNode ( node . template )
224
226
}
225
227
226
228
// TODO if templateSettings.enableForStringWithSubstitutions
227
- if ( this . typescript . isTemplateHead ( node ) || this . typescript . isTemplateSpan ( node ) ) {
229
+ if ( ts . isTemplateHead ( node ) || ts . isTemplateSpan ( node ) ) {
228
230
return this . getValidTemplateNode ( node . parent )
229
231
}
230
232
231
- if ( this . typescript . isTemplateMiddle ( node ) || this . typescript . isTemplateTail ( node ) ) {
233
+ if ( ts . isTemplateMiddle ( node ) || ts . isTemplateTail ( node ) ) {
232
234
return this . getValidTemplateNode ( node . parent )
233
235
}
234
236
235
237
// TODO Identifier, TemplateHead, TemplateMiddle, TemplateTail
236
238
// export type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
237
239
// export type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral;
238
240
if (
239
- ! (
240
- this . typescript . isStringLiteralLike ( node ) ||
241
- this . typescript . isTemplateLiteral ( node ) ||
242
- this . typescript . isTemplateExpression ( node )
243
- )
241
+ ! ( ts . isStringLiteralLike ( node ) || ts . isTemplateLiteral ( node ) || ts . isTemplateExpression ( node ) )
244
242
) {
245
243
return undefined
246
244
}
247
245
246
+ // Ignore strings that are part of an expression
247
+ // x + '...'
248
+ if ( ts . isStringLiteralLike ( node ) && ts . isBinaryExpression ( node . parent ) ) {
249
+ return undefined
250
+ }
251
+
248
252
let currentNode : ts . Node = node
249
253
250
- while ( currentNode && ! this . typescript . isSourceFile ( currentNode ) ) {
254
+ while ( currentNode && ! ts . isSourceFile ( currentNode ) ) {
251
255
if ( match ( currentNode , this . sourceMatchers ) ) {
252
256
return node
253
257
}
254
258
255
- if ( this . typescript . isCallLikeExpression ( currentNode ) ) {
259
+ if ( ts . isCallLikeExpression ( currentNode ) ) {
256
260
return undefined
257
261
}
258
262
0 commit comments