Skip to content

TS 3.2 RC: TypeError: Cannot read property 'kind' of undefined in JS file #28576

@vkrol

Description

@vkrol

TypeScript Version: 3.2.0-rc

Search Terms:
TypeError: Cannot read property 'kind' of undefined

Code
tsconfig.json

{
    "compilerOptions": {
        "allowJs": true,
    },
}

This is the JS file:

import someModule from "some-module";

{
	someModule.bar = 1;
}

Expected behavior:
No errors.

Actual behavior:

D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:10482
        return node.kind === 191;
                    ^

TypeError: Cannot read property 'kind' of undefined
    at Object.isCallExpression (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:10482:21)
    at isExpandoSymbol (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:23967:20)
    at bindPotentiallyNewExpandoMemberToNamespace (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:23943:38)
    at bindPropertyAssignment (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:23960:13)
    at bindStaticPropertyAssignment (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:23922:13)
    at bindSpecialPropertyAssignment (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:23917:17)
    at bindWorker (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:23568:29)
    at bind (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:23461:13)
    at visitNode (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:12938:24)
    at Object.forEachChild (D:\Projects\typescript-3.2-rc-kind-bug\node_modules\typescript\lib\tsc.js:13170:24)

Playground Link: N/A

Related Issues: -

Repository: https://github.com/vkrol/typescript-3.2-rc-kind-bug

Notes:
This is the blocker for us, because we have the similar code in our codebase:

import $ from "jquery";

if ($.notify === null) {
  $.notify = function () { }
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFixedA PR has been merged for this issueHigh Priority

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions