I was trying out https://github.com/yjs/y-monaco in the monaco package.
I am getting the following error for typing
packages/monaco/src/browser/monaco-editor-provider.ts:46:31 - error TS7016: Could not find a declaration file for module 'y-monaco'. '/Users/vinay/Desktop/theia/node_modules/y-monaco/dist/y-monaco.js' implicitly has an 'any' type.
Try `npm install @types/y-monaco` if it exists or add a new declaration (.d.ts) file containing `declare module 'y-monaco';`
46 import { MonacoBinding } from 'y-monaco';
Modified the following function in theia/packages/monaco/src/browser/monaco-editor-provider.ts
protected async doCreateEditor(uri: URI, factory: (override: IEditorOverrideServices, toDispose: DisposableCollection) => Promise<MonacoEditor>): Promise<MonacoEditor> {
const commandService = this.commandServiceFactory();
const contextKeyService = this.contextKeyService.createScoped();
const { codeEditorService, textModelService, contextMenuService } = this;
const IWorkspaceEditService = this.bulkEditService;
const toDispose = new DisposableCollection(commandService);
const openerService = new monaco.services.OpenerService(codeEditorService, commandService);
openerService.registerOpener({
open: (u, options) => this.interceptOpen(u, options)
});
const editor = await factory({
codeEditorService,
textModelService,
contextMenuService,
commandService,
IWorkspaceEditService,
contextKeyService,
openerService
}, toDispose);
editor.onDispose(() => toDispose.dispose());
this.suppressMonacoKeybindingListener(editor);
this.injectKeybindingResolver(editor);
const standaloneCommandService = new monaco.services.StandaloneCommandService(editor.instantiationService);
commandService.setDelegate(standaloneCommandService);
toDispose.push(this.installQuickOpenService(editor));
toDispose.push(this.installReferencesController(editor));
toDispose.push(editor.onFocusChanged(focused => {
if (focused) {
this._current = editor;
}
}));
toDispose.push(Disposable.create(() => {
if (this._current === editor) {
this._current = undefined;
}
}));
const ydocument = new Y.Doc()
const provider = new WebsocketProvider(`${location.protocol === 'http:' ? 'ws:' : 'wss:'}//localhost:1234`, 'monaco', ydocument)
const type = ydocument.getText('monaco')
MonacoBinding(type, editor.getControl().getModel(), new Set([editor]), provider.awareness);
return editor;
}
@akosyakov
@svenefftinge
Any suggestion to fix this?