Languages

TypeScript - TypeError: Cannot read property 'kind' of undefined at getRootDeclaration (tsc.js:84774)

9 points
Asked by:
Rian-Whitehouse
469

I have got following error during my TypeScript project compilation into single file:

C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:84774
                throw e;
                ^

TypeError: Cannot read property 'kind' of undefined
    at getRootDeclaration (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:12052:21)
    at Object.isCatchClauseVariableDeclarationOrBindingElement (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:9877:20)
    at getTypeOfVariableOrParameterOrPropertyWorker (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:40703:20)
    at getTypeOfVariableOrParameterOrProperty (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:40682:28)
    at getTypeOfSymbol (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:40986:24)
    at getTypeOfParameter (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:56323:24)
    at tryGetTypeAtPosition (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:56374:24)
    at getTypeAtPosition (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:56369:20)
    at getTypeOfFirstParameterOfSignatureWithFallback (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:56464:54)
    at getJsxPropsTypeFromCallSignature (C:\Users\john\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:53080:29)

I run my project with:

tsc --project tsconfig.prod.json

tsconfig.prod.json file looks following way:

{
	"version" : "3.9.6",
	"compilerOptions": {
		"strict": true,
		"target": "es5",
		"module": "amd",
		"lib": ["es2015.promise"],
        "jsx": "react",
		"jsxFactory": "renderElement",
		"jsxFragmentFactory": "renderFragment",
		"allowJs": true,
		"removeComments": true,
        "noImplicitAny": true,
        "preserveConstEnums": true,
		"sourceMap": true,
        "outFile": "../src/main/webapp/resources/pages/index.js"
	},
	"files": [
		"../src/main/webapp/resources/pages/index.tsx"
	],
	"exclude": [
		"../**/*.d.tsx"
	]
}
1 answer
3 points
Answered by:
Rian-Whitehouse
469

It is difficult to find reason. Once I had same problem becasue of lack of "dom" inside "libs" property, so use:

"lib": ["es2015.promise", "dom"]

or

"lib": ["es2015.promise", "dom", "es5"]
0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join