You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Simply trying to instantiate the extension with a Monaco Editor instance in Svelte. Following the instructions in the readme
To Reproduce
Paste the following code into any svelte file. If not using svelte you should be able to copy and paste the imports and contents of the onMount function into any ts file and run from there.
<script lang="ts">
import type monaco from 'monaco-editor';
import { onMount } from 'svelte';
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
import { AutoTypings } from 'monaco-editor-auto-typings';
let divEl: HTMLDivElement;
let editor: monaco.editor.IStandaloneCodeEditor;
let monaco;
onMount(async () => {
self.MonacoEnvironment = {
getWorker: function (_moduleId: any, label: string) {
if (label === 'typescript' || label === 'javascript') {
return new tsWorker();
}
return new editorWorker();
}
};
monaco = await import('monaco-editor');
const value = `import { onMount } from 'svelte'\nlet count = 0; \nfunction add() {\n\tcount++;\n\treturn count;\n}`;
editor = monaco.editor.create(divEl, {
model: monaco.editor.createModel(value, 'typescript')
});
const autoTypings = await AutoTypings.create(editor, {
// sourceCache: new LocalStorageCache()
});
return () => {
editor.dispose();
};
});
</script>
<div bind:this={divEl} />
Expected behavior
I'm expecting it to work like the demo, but I might be missing something that is causing the error. I double checked with the docs but it seems like what I have should be what's needed.
Screenshots
Getting this error in Chrome Dev Tools
Describe the bug
Simply trying to instantiate the extension with a Monaco Editor instance in Svelte. Following the instructions in the readme
To Reproduce
Paste the following code into any svelte file. If not using svelte you should be able to copy and paste the imports and contents of the onMount function into any
ts
file and run from there.Expected behavior
I'm expecting it to work like the demo, but I might be missing something that is causing the error. I double checked with the docs but it seems like what I have should be what's needed.
Screenshots

Getting this error in Chrome Dev Tools
Environment:
monaco-editor-auto-typings
Version: "^0.4.4",monaco-editor
Version: "^0.43.0",The text was updated successfully, but these errors were encountered: