Skip to content

"Cannot read property 'kind' of undefined" is thrown by declaring unassigned constants after exported const in JS #2058

@jpinilloslr

Description

@jpinilloslr

monaco-editor version: 0.20.0
Browser: Google Chrome, Safari, Microsoft Edge
OS: MacOS Catalina 10.15.6

  1. Open the Monaco Editor homepage: https://microsoft.github.io/monaco-editor/
  2. Select javascript or typescript language.
  3. Paste this code:
export const foo = 1;
const bar

Actual result: The following error is printed to the browser console:

Uncaught Error: Cannot read property 'kind' of undefined

TypeError: Cannot read property 'kind' of undefined
    at Object.e.isImportClause (tsWorker.js:21)
    at Object.n.deleteDeclaration (tsWorker.js:21)
    at r (tsWorker.js:21)
    at n.finishDeleteDeclarations (tsWorker.js:21)
    at n.getChanges (tsWorker.js:21)
    at Function.n.with (tsWorker.js:21)
    at Object.getCodeActions (tsWorker.js:21)
    at tsWorker.js:21
    at Object.e.flatMap (tsWorker.js:21)
    at Object.n.getFixes (tsWorker.js:21)
    at errors.ts:22

Expected result: No errors are shown in the browser console.

Screenshot:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions