Skip to content

ts-node no longer working with TypeScript@2.7 #527

Closed
@rbuckton

Description

@rbuckton

ts-node has a dependency on an old api called parseConfigFile that was removed in 1.7. In TypeScript 2.7 a new internal parseConfigFile was added with a different signature for a different purpose and it seems that due to the order in which ts-node looks for an API to parse a tsconfig.json file.

Example:

npm i ts-node
node
> require("ts-node/register.js");
TypeError: host.onUnRecoverableConfigFileDiagnostic is not a function
    at Object.parseConfigFile (C:\dev\TypeScript\node_modules\typescript\lib\typescript.js:76999:18)
    at readConfig (C:\dev\TypeScript\node_modules\ts-node\src\index.ts:471:25)
    at Object.register (C:\dev\TypeScript\node_modules\ts-node\src\index.ts:205:18)
    at Object.<anonymous> (C:\dev\TypeScript\node_modules\ts-node\register\index.js:1:16)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)

I would recommend changing the order of feature testing to push the check for parseConfigFile later in the readConfig function above and first test for newer functionality, or check against the ts.version property to ensure the correct version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions