monaco-editor
monaco-editor copied to clipboard
[Bug] cannot access top level languages via `monaco-editor/esm/vs/editor/editor.api.js`
Reproducible in vscode.dev or in VS Code Desktop?
- [x] Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- [x] Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
Reproduction Steps
I'm using the minimal entry monaco-editor/esm/vs/editor/editor.api.js
import * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions(
diagnosticsOptions,
);
but meet the following error in v0.55.1:
Property 'typescriptDefaults' does not exist on type '{ deprecated: true; }'.ts(2339)
Then I tried the top level typescript but it seems not exported from monaco-editor/esm/vs/editor/editor.api.js:
Module '"monaco-editor/esm/vs/editor/editor.api.js"' has no exported member 'typescript'.ts(2305)
Actual (Problematic) Behavior
No response
Expected Behavior
No response
Additional Context
No response
Unfortunately, this is all a bit messy.
You should be able to import the language support like this: import * as css from 'monaco-editor/language/css/monaco.contribution';.
I believe the monaco-editor package should have better entry points:
-
monaco-editor- gives you everything -
monaco-editor/editor- gives you just the editor -
monaco-editor/languages- exports all languages -
monaco-editor/languages/css- just css support -
monaco-editor/editorContributions- registers all contributions
Currently, the <language>.contribution type declaration file is empty (its .d.ts only contains export {}).