Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

make subclassing MonacoEditorReactComp more easy #58

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/monaco-editor-react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ export type MonacoEditorProps = {
onLoad?: () => void;
}

export class MonacoEditorReactComp extends React.Component<MonacoEditorProps> {
export class MonacoEditorReactComp<T extends MonacoEditorProps = MonacoEditorProps> extends React.Component<T> {

private wrapper: MonacoEditorLanguageClientWrapper = new MonacoEditorLanguageClientWrapper();
private containerElement?: HTMLDivElement;
private _subscription: IDisposable | null = null;
private isStarting?: Promise<void>;

constructor(props: MonacoEditorProps) {
constructor(props: T) {
super(props);
this.containerElement = undefined;
}
Expand All @@ -32,7 +32,7 @@ export class MonacoEditorReactComp extends React.Component<MonacoEditorProps> {
await this.initMonaco();
}

override async componentDidUpdate(prevProps: MonacoEditorProps) {
override async componentDidUpdate(prevProps: T) {
const { className, userConfig } = this.props;
const { wrapper } = this;

Expand Down