Skip to content

ts-node fails when tsc runs ok #391

Description

@leoasis

I have an app with ts-node and ts-babel-node configured (using the register require). When I try to start the app, I get the following error (app specific):

Uncaught exception: TSError: ⨯ Unable to compile TypeScript
.../verification/spec.ts (21,28): Parameter 'state' implicitly has an 'any' type. (7006)
.../verification/spec.ts (28,28): Parameter 'state' implicitly has an 'any' type. (7006)
at getOutput (.../node_modules/ts-node/dist/index.js:169:23)
at Object.compile (.../node_modules/ts-node/dist/index.js:272:19)
at Module.m._compile (.../node_modules/ts-node/dist/index.js:212:49)
at Module._extensions..js (module.js:579:10)
at Object.hook (.../node_modules/ts-babel-node/index.js:52:3)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at require (internal/module.js:20:19)
at Object.<anonymous> (.../verification/index.ts:9:13)

But when I run tsc, it gives no errors. Also, in VSCode, I see no error when viewing that file.

I managed to see why this was happening and this block caught my attention (

// Add all files into the file hash.
):

// Add all files into the file hash.for(constfileNameofconfig.fileNames){if(/\.d\.ts$/.test(fileName)){cache.versions[fileName]=1}}

If I remove the condition to only add the .d.ts files into the cache, and run the app, I see no errors. I think this condition is not right, as all the files should go to the cache since they are later used for getScriptFileNames in the service host (

getScriptFileNames: ()=>Object.keys(cache.versions),
).

I'll try to find a minimal example to repro this since I still don't understand why is this the case, but just filing this issue with a pointer to that suspicious piece in case you maybe know more about it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugresearchNeeds design work, investigation, or prototyping. Implementation uncertain.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions