question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Types for monaco not resoving

See original GitHub issue

When I try to use:

import { monaco } from '@monaco-editor/react';

loader.then(instance => {});

the instance is not resolved as seen here:

2019-12-23_13-12-04

I’m wondering if its because you have monaco-editor as a peerDependency but you don’t tell people to install it when they install the package?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
RickeyWardcommented, Mar 18, 2020

I have monaco-editor installed but I still don’t get types in my Create-React-Typescript project. I get partial types but not the full monaco-editor types such as IEditorOptions.

0reactions
Altair2169commented, Dec 7, 2021

You need to do two things to resolve the types correctly:

  1. Install monaco-editor as that includes the types
  2. Include those types in your tsconfig.json:
{
  "include": [
    "src",
    "node_modules/monaco-editor/monaco.d.ts"
  ]
}

After that you can refer to the types without any special imports:

const onValidate = (markers: monaco.editor.IMarker[]) => { ... }

I tried that but it still throws the error namespace monaco not found

Read more comments on GitHub >

github_iconTop Results From Across the Web

Models with "@" in their name do not resolve as dependencies
I'm trying to specify dependencies manually via monaco.editor.createModel() , which works fine for dependency outside of organizations, but if a ...
Read more >
monaco-editor typescript not providing suggestions
In monaco-editor if you try to use a union type as a parameter of a function it does not provide you any suggestions....
Read more >
@fluentui/monaco-editor - npm
1. Webpack configuration · config ( webpack.Configuration ): Your configuration object. Its entry must be an object (not an array or function), ...
Read more >
Building a code editor with Monaco - Expo Blog
To make “Find All References” work, we had to monkeypatch Monaco: This allows Monaco to properlly resolve a model using the URI. Making...
Read more >
@monaco-editor/react | Yarn - Package Manager
Monaco Editor for React - use the monaco-editor in any React application without needing to use webpack (or rollup/parcel/etc) configuration files / plugins....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found