Stop beliving the lies of GL's .d.ts (#4209)

This commit is contained in:
Rubén Rincón Blanco
2022-12-19 19:57:53 -06:00
committed by Matt Godbolt
parent cfd9d79164
commit b3a619b6a1
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -679,9 +679,11 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
newPaneDropdown.dropdown('toggle');
};
// Note that the .d.ts file lies. createDragSource returns the newly created DragSource
// Note that the .d.ts file lies in more than 1 way!
// createDragSource returns the newly created DragSource
// the second parameter can be a function that returns the config!
this.container.layoutManager
.createDragSource(this.domRoot.find('.btn.add-compiler'), cloneComponent())
.createDragSource(this.domRoot.find('.btn.add-compiler'), cloneComponent as any)
// @ts-ignore
._dragListener.on('dragStart', togglePannerAdder);
+2 -1
View File
@@ -295,7 +295,8 @@ export class Conformance extends Pane<ConformanceViewState> {
);
};
this.container.layoutManager.createDragSource(popCompilerButton, getCompilerConfig());
// The .d.ts for GL lies. You can pass a function that returns the config as a second parameter
this.container.layoutManager.createDragSource(popCompilerButton, getCompilerConfig as any);
popCompilerButton.on('click', () => {
const insertPoint =