-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
It looks like it was introduced in e1b4f01#diff-233e1126c0abc811c4098757f9e4516eR2742, but I'm getting:
var path = sourceFile.path || ts.toPath(sourceFile.fileName, currentDirectory, getCanonicalFileName);
^
TypeError: Cannot read property 'path' of undefined
at sourceFileUpToDate (node_modules/typescript/lib/typescript.js:46061:38)
at programUpToDate (node_modules/typescript/lib/typescript.js:46077:26)
at synchronizeHostData (node_modules/typescript/lib/typescript.js:45958:17)
at Object.getEmitOutput (node_modules/typescript/lib/typescript.js:49060:13)
at getOutput (dist/ts-node.js:75:30)
at compile (dist/ts-node.js:97:26)
at Object.loader (dist/ts-node.js:110:27)
] to not exist
at dist/ts-node.spec.js:9:2004
at ChildProcess.exithandler (child_process.js:758:5)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
Reference: https://travis-ci.org/TypeStrong/ts-node/jobs/90594369
I went through the code and found that adding the default library path to the getScriptFileNames
array fixes things. The specific case when the file is undefined is when ts-node
is running over TypeScript, then JavaScript, and back to TypeScript. Might be able to occur on other loaders too, but I haven't investigated the root cause far enough yet. The two arrays compared for length on the previous line look like:
// Root file names according to TypeScript:
[ '/Users/blakeembrey/Projects/blakeembrey/ts-node/typings/ambient/main/node.d.ts',
'/Users/blakeembrey/Projects/blakeembrey/ts-node/tests/complex/index.ts',
'/Users/blakeembrey/Projects/blakeembrey/ts-node/tests/complex/foo.ts' ]
// File names in the source program:
[ '/Users/blakeembrey/Projects/blakeembrey/ts-node/node_modules/typescript/lib/lib.d.ts',
'/Users/blakeembrey/Projects/blakeembrey/ts-node/typings/ambient/main/node.d.ts',
'/Users/blakeembrey/Projects/blakeembrey/ts-node/tests/complex/index.ts' ]
Edit: Please let me know what other information is needed to narrow this down.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue