From 74a6dce39ba2e60c6d35369c1b40e4574580b52e Mon Sep 17 00:00:00 2001 From: Eric Hwang Date: Fri, 28 Jun 2024 03:27:02 -0700 Subject: [PATCH] Fix TS typings for component.create(), broken by 4b15771 Resolves error TS2425: Class 'Component' defines instance member property 'create', but extended class 'MyComponent' defines it as instance member function. --- src/components.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components.ts b/src/components.ts index 8480b59a..948bd958 100644 --- a/src/components.ts +++ b/src/components.ts @@ -100,7 +100,7 @@ export abstract class Component extends Controller * `init()` could be called from the server and the browser, so do not use any DOM-only methods * here. Put those in `create()` instead. */ - init(_model: ChildModel): void {} + init?(_model: ChildModel): void; /** * Method called by Derby once a component is loaded and ready in the DOM. @@ -110,7 +110,7 @@ export abstract class Component extends Controller * * This will only be called in the browser. */ - create?: (() => void) | (() => Promise); + create?(): void; destroy() { this.emit('destroy');