I'm adding TypeScript support to my application Data-Forge Notebook.
Its a notebook-style application for JavaScript. When I use the 'await' keyword in a code cell Monaco flags it as an error as shown in this screenshot:
When the code is executed or exported this whole chunk of code gets wrapped in an async
function so when that happens there is no error.
I need to be able to customize Monaco to remove this error because it doesn't make sense in this context.
Is it possible to remove or modify errors like this when using the Monaco editor?
This is a bit late, but I've found another solution. It's possible to suppress errors by error code the following way:
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
diagnosticCodesToIgnore: [1375]
});
Where 1375 is the error code for the "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module. (1375)" error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With