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
Really excited to be using the new webpack build of monaco-editor! I've been trying to use it as part of a library that emits type declarations, and it looks like the shipped typings are broken – see below for details (and a possible fix?)
monaco-editor version: 0.11.0
Browser: N/A
OS: macOS 10.13.3
Steps or JS usage snippet reproducing the issue:
mkdir temp &&cd temp
npm init -y
npm install -D typescript monaco-editor
# Write a simple index file that reexports some of the monaco typesecho"export { Selection } from 'monaco-editor';"> index.ts
# Attempt to compile with declarations
./node_modules/.bin/tsc --declaration index.ts
Compilation fails with following errors:
node_modules/monaco-editor/esm/vs/editor/editor.api.d.ts(766,1): error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file.
node_modules/monaco-editor/esm/vs/editor/editor.api.d.ts(5295,43): error TS2503: Cannot find namespace 'monaco'.
node_modules/monaco-editor/esm/vs/editor/editor.api.d.ts(5296,43): error TS2503: Cannot find namespace 'monaco'.
...it seems this is related to this commit that introduces some manual text manipulation to the monaco.d.ts file and saves it as editor.api.d.ts.
I'm not sure exactly what's going on here, but I got the above example to compile properly by ignoring the editor.api.d.ts and doing the following:
# Add "export = monaco;" to the end of monaco.d.tsecho"export = monaco;">> node_modules/monaco-editor/monaco.d.ts
# Change the package.json to use the typings in monaco.d.ts, not editor.api.d.ts
sed -i .bak 's/esm\/vs\/editor\/editor.api.d.ts/monaco.d.ts/' node_modules/monaco-editor/package.json
# Now compiles fine!
./node_modules/.bin/tsc --declaration index.ts
The text was updated successfully, but these errors were encountered:
Really excited to be using the new webpack build of monaco-editor! I've been trying to use it as part of a library that emits type declarations, and it looks like the shipped typings are broken – see below for details (and a possible fix?)
monaco-editor version: 0.11.0
Browser: N/A
OS: macOS 10.13.3
Steps or JS usage snippet reproducing the issue:
Compilation fails with following errors:
...it seems this is related to this commit that introduces some manual text manipulation to the
monaco.d.ts
file and saves it aseditor.api.d.ts
.I'm not sure exactly what's going on here, but I got the above example to compile properly by ignoring the
editor.api.d.ts
and doing the following:The text was updated successfully, but these errors were encountered: