-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScript
Milestone
Description
TypeScript Version: 3.6.3, 3.7.0-dev.20190928
Search Terms:
Code
const ts = require('typescript');
const lines = [
'const rs = require("rs.ts");',
'const rt = require(`rt.ts`);',
'const is = import("is.ts");',
'const it = import(`it.ts`);',
].join('\n')
console.log(ts.preProcessFile(lines, true, true));Expected behavior:
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: 'rs.ts', pos: 19, end: 24 },
{ fileName: 'rt.ts', pos: 48, end: 53 },
{ fileName: 'is.ts', pos: 76, end: 81 },
{ fileName: 'it.ts', pos: 104, end: 109 }
],
isLibFile: false,
ambientExternalModules: undefined
}Actual behavior:
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: 'rs.ts', pos: 19, end: 24 },
{ fileName: 'is.ts', pos: 76, end: 81 }
],
isLibFile: false,
ambientExternalModules: undefined
}Because src/services/preProcess.ts only checks for StringLiteral's bun not for NoSubstitutionTemplateLiteral's which were allowed there for a long time.
Playground Link: N/A
Related Issues: found during implementing #32064 , but this syntax and type checked worked long before this PR
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript