[TS] Require override keyword (#3746)

This commit is contained in:
filtered
2025-05-04 09:54:45 +10:00
committed by GitHub
parent c30244ef66
commit 8713cd6e25
13 changed files with 48 additions and 40 deletions

View File

@@ -81,7 +81,7 @@ export class ClipspaceDialog extends ComfyDialog {
super()
}
createButtons() {
override createButtons() {
const buttons = []
for (let idx in ClipspaceDialog.items) {
@@ -177,7 +177,7 @@ export class ClipspaceDialog extends ComfyDialog {
} else return []
}
show() {
override show() {
ClipspaceDialog.invalidate()
this.element.style.display = 'block'

View File

@@ -69,7 +69,10 @@ class Load3dAnimation extends Load3d {
animate()
}
async loadModel(url: string, originalFileName?: string): Promise<void> {
override async loadModel(
url: string,
originalFileName?: string
): Promise<void> {
await super.loadModel(url, originalFileName)
if (this.modelManager.currentModel) {
@@ -80,7 +83,7 @@ class Load3dAnimation extends Load3d {
}
}
clearModel(): void {
override clearModel(): void {
this.animationManager.dispose()
super.clearModel()
}
@@ -125,7 +128,7 @@ class Load3dAnimation extends Load3d {
return this.animationManager.currentAnimation
}
remove(): void {
override remove(): void {
this.animationManager.dispose()
super.remove()
}

View File

@@ -165,7 +165,7 @@ export class MaskEditorDialogOld extends ComfyDialog {
])
}
createButtons() {
override createButtons() {
return []
}
@@ -442,7 +442,7 @@ export class MaskEditorDialogOld extends ComfyDialog {
maskCanvas.style.opacity = maskCanvasStyle.opacity.toString()
}
async show() {
override async show() {
this.zoom_ratio = 1.0
this.pan_x = 0
this.pan_y = 0

View File

@@ -869,7 +869,7 @@ class MaskEditorDialog extends ComfyDialog {
return MaskEditorDialog.instance
}
async show() {
override async show() {
this.cleanup()
if (!this.isLayoutCreated) {
// layout

View File

@@ -61,7 +61,7 @@ class ManageTemplates extends ComfyDialog {
}) as HTMLInputElement
}
createButtons() {
override createButtons() {
const btns = super.createButtons()
btns[0].textContent = 'Close'
btns[0].onclick = () => {
@@ -160,7 +160,7 @@ class ManageTemplates extends ComfyDialog {
}, 0)
}
show() {
override show() {
// Show list of template names + delete button
super.show(
$el(

View File

@@ -10,14 +10,14 @@ app.registerExtension({
name: 'Comfy.NoteNode',
registerCustomNodes() {
class NoteNode extends LGraphNode {
static category: string
static override category: string
static collapsable: boolean
static title_mode: number
color = LGraphCanvas.node_colors.yellow.color
bgcolor = LGraphCanvas.node_colors.yellow.bgcolor
override color = LGraphCanvas.node_colors.yellow.color
override bgcolor = LGraphCanvas.node_colors.yellow.bgcolor
groupcolor = LGraphCanvas.node_colors.yellow.groupcolor
isVirtualNode: boolean
override isVirtualNode: boolean
constructor(title: string) {
super(title)
@@ -51,10 +51,10 @@ app.registerExtension({
/** Markdown variant of NoteNode */
class MarkdownNoteNode extends LGraphNode {
static title = 'Markdown Note'
static override title = 'Markdown Note'
color = LGraphCanvas.node_colors.yellow.color
bgcolor = LGraphCanvas.node_colors.yellow.bgcolor
override color = LGraphCanvas.node_colors.yellow.color
override bgcolor = LGraphCanvas.node_colors.yellow.bgcolor
groupcolor = LGraphCanvas.node_colors.yellow.groupcolor
constructor(title: string) {

View File

@@ -14,7 +14,7 @@ app.registerExtension({
}
class RerouteNode extends LGraphNode {
static category: string | undefined
static override category: string | undefined
static defaultVisibility = false
constructor(title?: string) {
@@ -277,7 +277,7 @@ app.registerExtension({
)
return []
}
computeSize(): [number, number] {
override computeSize(): [number, number] {
return [
this.properties.showOutputText && this.outputs && this.outputs.length
? Math.max(

View File

@@ -25,7 +25,7 @@ const replacePropertyName = 'Run widget replace on values'
export class PrimitiveNode extends LGraphNode {
controlValues?: any[]
lastType?: string
static category: string
static override category: string
constructor(title: string) {
super(title)
this.addOutput('connect to widget input', '*')
@@ -37,7 +37,7 @@ export class PrimitiveNode extends LGraphNode {
}
}
applyToGraph(extraLinks: LLink[] = []) {
override applyToGraph(extraLinks: LLink[] = []) {
if (!this.outputs[0].links?.length) return
const links = [
@@ -83,7 +83,7 @@ export class PrimitiveNode extends LGraphNode {
}
}
refreshComboInNode() {
override refreshComboInNode() {
const widget = this.widgets?.[0]
if (widget?.type === 'combo') {
// @ts-expect-error fixme ts strict error
@@ -98,7 +98,7 @@ export class PrimitiveNode extends LGraphNode {
}
}
onAfterGraphConfigured() {
override onAfterGraphConfigured() {
if (this.outputs[0].links?.length && !this.widgets?.length) {
this.#onFirstConnection()
@@ -117,7 +117,11 @@ export class PrimitiveNode extends LGraphNode {
}
}
onConnectionsChange(_type: ISlotType, _index: number, connected: boolean) {
override onConnectionsChange(
_type: ISlotType,
_index: number,
connected: boolean
) {
if (app.configuringGraph) {
// Dont run while the graph is still setting up
return
@@ -138,7 +142,7 @@ export class PrimitiveNode extends LGraphNode {
}
}
onConnectOutput(
override onConnectOutput(
slot: number,
_type: string,
input: INodeInputSlot,