From 8b890fdffeb37f61e8b23669e02efe320090347c Mon Sep 17 00:00:00 2001 From: Hamzat Victor Date: Tue, 24 Sep 2024 13:00:49 +0100 Subject: [PATCH] fix: remove editor red squiggly lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit by dynamically loading project'sĀ tsconfigĀ file and adding nice defaults # Conflicts: # frontend/components/editor/index.tsx # frontend/lib/utils.ts --- frontend/components/editor/index.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/components/editor/index.tsx b/frontend/components/editor/index.tsx index 5435b8d..b426f9c 100644 --- a/frontend/components/editor/index.tsx +++ b/frontend/components/editor/index.tsx @@ -1228,4 +1228,17 @@ export default function CodeEditor({ ) } +/** + * Configure the typescript compiler to detect JSX and load type definitions + */ +const defaultCompilerOptions: monaco.languages.typescript.CompilerOptions = { + allowJs: true, + allowSyntheticDefaultImports: true, + allowNonTsExtensions: true, + resolveJsonModule: true, + jsx: monaco.languages.typescript.JsxEmit.ReactJSX, + module: monaco.languages.typescript.ModuleKind.ESNext, + moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs, + target: monaco.languages.typescript.ScriptTarget.ESNext, +}