-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
After days and hours of searching, I have to ask the community for help.
Right now I found two ways of adding type definitions to monaco editor.
-
first way
monaco.languages.typescript.typescriptDefaults.addExtraLib( DTSFileContent, 'file:///node_modules/@types/your-file-path.d.ts') -
second way
monaco.languages.typescript.typescriptDefaults.addExtraLib(declare module "${lib.name}" { ${DTSFileContent } }, lib.name);
i have several issues with these two approaches.
- adding libs in a first manner does not allow to create lib path like "@angular/core", while "angular/core" is possible
- i was not able to find a way for loading d.ts files that reference other libs. Example - barrel d.ts files for angular. those references are not taken into account.
I could just say it's not possible - but it is.
Look at stackblitz. https://stackblitz.com/edit/angular-3ccygq
Inside browser console type and you'll see this.
monaco.languages.typescript.typescriptDefaults._extraLibs
Somehow it's possible to add libraries that reference each other. But not able to replicate that in monaco-template.
Any idea?
Thanks!
