https://github.com/remcohaszing/monaco-types
Type-only exports of Monaco editor
https://github.com/remcohaszing/monaco-types
monaco monaco-editor monaco-editor-core types typescript
Last synced: 11 months ago
JSON representation
Type-only exports of Monaco editor
- Host: GitHub
- URL: https://github.com/remcohaszing/monaco-types
- Owner: remcohaszing
- License: mit
- Created: 2023-03-03T15:22:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-03T15:26:27.000Z (over 3 years ago)
- Last Synced: 2025-08-09T11:21:04.275Z (11 months ago)
- Topics: monaco, monaco-editor, monaco-editor-core, types, typescript
- Language: TypeScript
- Homepage:
- Size: 6.84 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# monaco-types
[](https://github.com/remcohaszing/monaco-types/actions/workflows/ci.yaml)
[](https://www.npmjs.com/package/monaco-types)
[](https://prettier.io)
Users of Monaco editor may insert it into their webpage via multiple sources, for example from the
`monaco-editor` or `monaco-editor-core` package, from a CDN, or from a third party source.
This package provides type-only exports of Monaco editor from either `monaco-editor` or
`monaco-editor-core`, whatever is available.
## Installation
```sh
npm install monaco-types
```
## Usage
Instead of importing from `monaco-editor` or `monaco-editor-core`, import all type definitions from
`monaco-types`. This will allow you to write type annotations:
```ts
import { MarkerSeverity } from 'monaco-types'
let severity: MarkerSeverity
```
But TypeScript will show an error when using the import as a value
```ts
import { MarkerSeverity } from 'monaco-types'
let severity: MarkerSeverity
```
Also your user will only have to install either `monaco-editor` or `monaco-editor-core` to get type
definitions, but you don’t have to enforce either on them.
In order to support this, your library needs to accept `MonacoEditor` as an argument instead of
importing. For example:
```ts
import { IDisposable, MonacoEditor } from 'monaco-types'
export function configureMyPlugin(monaco: MonacoEditor): IDisposable {
// Use monaco here.
}
```
### License
[MIT](LICENSE.md) @ [Remco Haszing](https://github.com/remcohaszing)