TypeScript: TypeError: Cannot read property 'kind' of undefined
TypeScript Version: 3.9.1-rc
Search Terms: typeerror kind
Code
Unknown
Expected behavior:
Compilation
Actual behavior:
TypeError: Cannot read property 'kind' of undefined
at getErrorSpanForNode (.../node_modules/typescript/lib/typescript.js:13845:22)
at createDiagnosticForNodeInSourceFile (.../node_modules/typescript/lib/typescript.js:13794:20)
at Object.createDiagnosticForNode (.../node_modules/typescript/lib/typescript.js:13785:16)
at .../node_modules/typescript/lib/typescript.js:41784:135
at Map.forEach (<anonymous>)
at getInitializerTypeFromAssignmentDeclaration (.../node_modules/typescript/lib/typescript.js:41766:52)
at getWidenedTypeForAssignmentDeclaration (.../node_modules/typescript/lib/typescript.js:41660:123)
at getTypeOfFuncClassEnumModuleWorker (.../node_modules/typescript/lib/typescript.js:42220:34)
at getTypeOfFuncClassEnumModule (.../node_modules/typescript/lib/typescript.js:42199:51)
at getTypeOfSymbol (.../node_modules/typescript/lib/typescript.js:42312:24)
Playground Link:
Unknown
Related Issues:
Unknown
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 29
- Comments: 33 (10 by maintainers)
Commits related to this issue
- Fix merging of JS value & TS type decl Fixes #38383 — committed to elibarzilay/TypeScript by elibarzilay 4 years ago
- Fix merging of JS value & TS type decl Fixes #38383 — committed to microsoft/TypeScript by elibarzilay 4 years ago
Had the fix been released? I still have the same issue with latest: next 9.4.4, typescript 3.9.5 and ts-node 8.10.2. node -v 12.4.0. The same as was mentioned previously: switching to typescript 3.8.3 fixes the problem.
This is still a problem with TypeScript 3.9.7. @elibarzilay’s repro fails without any modifications. Unfortunately downgrading 3.8.3 is not an option for me because old versions ironically have another bug. Will we get this problem fixed?
I have the problem with typescript 3.9.3 and next 9.4.2 and ts-node 8.10.1. Switching to typescript 3.8.3 fixes the problem.
I see this running
typedoc
ontypescript 4.3.2
tooSo, after digging through that pile of s…tuff, here’s an actual minimal repro:
x.js
:y.d.ts
:I seem to have the same issue with next 9.4.2, typescript 3.9.3 and ts-node 8.10.1.
@elibarzilay this happened to me today as I was setting up a new nextjs project. Basically if your checkout this example or
yarn create next-app --example custom-server-typescript custom-server-typescript-app
and runyarn dev
you get this error:If you pin Typescript to 3.8.3 the error goes away. Cheers
When I switch to Nextjs version 9.4.2, Typescript version 3.9.3, I could no longer see the error
@elibarzilay Hi, Downgrading the TypeScript version from latest to
3.8.3
solves the problem but downgrading TS version is not a good option for me as well. Can we expect a fix for this?@elibarzilay I opened @SeyedAlirezaFatemi repo in Gitpod and ran these commands:
After opening http://localhost:3000 with preview button in Open Ports tab I get the error.
I reproduced the error in this repo: https://github.com/SeyedAlirezaFatemi/ts-error Started from https://github.com/vercel/next.js/tree/canary/examples/custom-server-typescript. build and start and you will see the error.
Same thing here, @SurjitSahoo . Previously it was working fine, but now throws that error. Did you find out a solution? NOTE: My package.json got updated to TS 4.2.4 (cause the ^) and thus the error (some issue with that version I guess…). Editing TS to 4.2 it seems to work fine now.
@sourabh8003 IIRC, it was only included in 4.0.
Sorry, I should have read more carefully. It’s working on 4.0.0-dev.20200729. Thank you.