/** * @file base component * @author okaychen */ import { Component, NodeType, TemplateComponent } from 'san'; import type { ComponentNewOptions } from 'san'; export type GetReturnType = { [K in keyof C]: C[K] extends (...args: any[]) => infer R ? R : never; }; export interface TextNode { nodeType: NodeType.TEXT; content: string; } interface IFNode { nodeType: NodeType.IF; } interface FORNode { nodeType: NodeType.FOR; } interface ELEMNode { nodeType: NodeType.ELEM; } interface SLOTNode { nodeType: NodeType.SLOT; } interface LOADERNode { nodeType: NodeType.LOADER; } interface ISNode { nodeType: NodeType.IS; } export interface SourceSlots { named: { [key: string]: JSONValue; }; noname: Record[]; } export type NodeChild = Base | TemplateComponent | TextNode | IFNode | FORNode | ELEMNode | SLOTNode | LOADERNode | ISNode; export interface SlotChild { children: Array; nodeType: NodeType; } export default class Base extends Component> { static template: string; constructor(options?: ComponentNewOptions); attached(): void; initData?(): State extends {} ? State : {}; sourceSlots: SourceSlots; slotChildren: SlotChild[]; parent: Base; children: any[]; owner: Base; id: string; } export {};