redom / redom

Tiny (2 KB) turboboosted JavaScript library for creating user interfaces.

Home Page:https://redom.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RedomComponentConstructor type definition bug

touho opened this issue · comments

I migrating my game engine project that uses ReDOM to use TypeScript. I'm glad you have made type definitions in ReDOM!

But I found a bug.

export function list(parent: RedomQuery, View: RedomComponentConstructor, key?: string, initData?: any): List;

...

export interface RedomComponentConstructor {
    new (): RedomComponent;
}

This means that all RedomComponent classes that I pass to list() must have a constructor without any parameters. However, List has this useful feature of passing initData: new View(initData, item, i, data).

So, I think it would be good if RedomComponentConstructor interface would have those four optional parameters defined. 🙏

Hi @touho!

Sorry I've been on holiday and forgot to answer. I haven't used TypeScript. @RauliL did definitely typed here, so you can either communicate with him, or create a pull request there yourself.

Thanks!

I'm closing this here, since definitely typed is separate project.