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

Commit

Permalink
Merge pull request #58 from cdietrich/cd/betterExtensibility
Browse files Browse the repository at this point in the history
make subclassing MonacoEditorReactComp more easy
  • Loading branch information
kaisalmen authored Nov 6, 2023
2 parents f2f9f95 + 2652f71 commit 781685c
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 781685c

Please sign in to comment.