Closed
Description
TypeScript Version: 3.5.2
Search Terms: debug failure unexpected node error message exception
Obviously the following code is incorrect, however I would expect a friendly error message directing the user to the problem, rather than the nasty/ambiguous error message that is currently given: Error: Debug Failure. Unexpected node
.
I ran into this in a large codebase and it took me awhile to find source of the problem.
Code
yarn add @types/lodash
import * as pick from 'lodash/pick';
export const pick = () => pick();
$ tsc
/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:73748
throw e;
^
Error: Debug Failure. Unexpected node.
Node 156 was unexpected.
at getDeclarationSpaces (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:46074:41)
at /Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:46066:84
at Object.forEach (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:217:30)
at getDeclarationSpaces (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:46066:28)
at checkExportsOnMergedDeclarations (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:46009:41)
at checkVariableLikeDeclaration (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:47011:17)
at checkVariableDeclaration (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:47048:20)
at checkSourceElementWorker (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:48787:28)
at checkSourceElement (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:48648:17)
at Object.forEach (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:217:30)