From 98da168a6a6ffdaf302528b1a5a6f31f1ca1854b Mon Sep 17 00:00:00 2001 From: Daniel Ledda Date: Tue, 3 Jan 2023 12:04:30 +0100 Subject: [PATCH] made rungs generic --- lib/Rung.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Rung.ts b/lib/Rung.ts index d311c63..00fdf2b 100644 --- a/lib/Rung.ts +++ b/lib/Rung.ts @@ -2,12 +2,12 @@ import {SubNode} from "./helpers"; export type RungOptions = {}; -export default abstract class Rung { - protected node: Node | null = null; +export default abstract class Rung { + protected node: NodeType | null = null; protected constructor(options: RungOptions) {} - render(): Node { + render(): NodeType { if (!this.node) { this.node = this.build(); } @@ -28,7 +28,7 @@ export default abstract class Rung { } } - protected abstract build(): Node; + protected abstract build(): NodeType; } -export type FunctionalRung, N extends HTMLElement> = (attributes: Props, subNodes?: SubNode[]) => N; +export type FunctionalRung, N extends Node = Node> = (attributes: Props, subNodes?: SubNode[]) => N;