Skip to content

Commit

Permalink
configure typescriptDefaults first thing in init()
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamjan committed Dec 30, 2023
1 parent d0ae4d9 commit 4f5b457
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions playground/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
* Configure the typescript language server.
*/
async function init() {
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ESNext,
module: monaco.languages.typescript.ModuleKind.ESNext,
allowNonTsExtensions: true,
});

let exampleCode = localStorage.getItem("example.ts");
if (!exampleCode) {
const req = await fetch('./example.ts');
Expand All @@ -22,12 +28,6 @@ async function init() {
// make it global for debugging
window.monacoEditor = editor;

monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ESNext,
module: monaco.languages.typescript.ModuleKind.ESNext,
allowNonTsExtensions: true,
});

const debouncedSave = debounce(() => save(editor), 1000);
editor.onKeyDown((ev) => {
if (ev.keyCode === 49 /** KeyCode.KeyS */ && ev.ctrlKey) {
Expand Down

0 comments on commit 4f5b457

Please sign in to comment.