monaco-editor version: 0.10.1
Browser: Google Chrome
OS: Windows 10
function hello() {
alert('Hello world!');
}
/*
NativeScript adheres to the CommonJS specification for dealing with
JavaScript modules. The CommonJS require() function is how you import
JavaScript modules defined in other files.
*/
Actual result: The text is deselected but 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._t [as isJsxOpeningElement] (typescriptServices.js:33)
at Object.r [as getDocumentHighlights] (typescriptServices.js:59)
at C (typescriptServices.js:65)
at D (typescriptServices.js:65)
at Object.x [as getOccurrencesAtPosition] (typescriptServices.js:65)
at e.getOccurrencesAtPosition (worker.js:9)
at t.e.fmr (workerMain.js:7)
at t._handleMessage (workerMain.js:7)
at Object.handleMessage (workerMain.js:7)
at e._handleMessage (workerMain.js:7)
at Object._t [as isJsxOpeningElement] (typescriptServices.js:33)
at Object.r [as getDocumentHighlights] (typescriptServices.js:59)
at C (typescriptServices.js:65)
at D (typescriptServices.js:65)
at Object.x [as getOccurrencesAtPosition] (typescriptServices.js:65)
at e.getOccurrencesAtPosition (worker.js:9)
at t.e.fmr (workerMain.js:7)
at t._handleMessage (workerMain.js:7)
at Object.handleMessage (workerMain.js:7)
at e._handleMessage (workerMain.js:7)
at editor.main.js:31
Expected result: The text is deselected without errors
Repro demo:

P.S. The same error also happens in TypeScript files.
I also encountered such a problem.

So far I had to hack a temporal solution for these mouse event errors:
The TypeScriptServices file has methods that do not check for e to be defined before evaluating e.kind, they are short event check functions like function bt(e){ return 123===e.kind}. There are more than 250 in the minified file (/monaco-editor/dev/vs/language/typescript/lib/typescriptServices.js, yep, minified in the dev path)
Add the is-defined check to e so it looks like function bt(e){return e && 123===e.kind}.
In the file /monaco-editor/min/vs/language/typescript/lib/typescriptServices.js (and /monaco-editor/dev/vs/language/typescript/lib/typescriptServices.js):
Replace occurrences of /return ([0-9][0-9]*)===e.kind/ with /return e&&$1===e.kind/ . /.../ are regexps.
Upstream issue - https://github.com/Microsoft/TypeScript/issues/17245
Fixed by adopting TS 2.7.2 -- https://github.com/Microsoft/monaco-typescript/commit/4514e58f07deefea088fcd44beb4be685135c6fa
getting still the error when pressing up till the first row:
Uncaught Error: Cannot read property 'kind' of undefined
@jagenjo What version of the editor are you using?
Most helpful comment
I also encountered such a problem.
615