Skip to content

Support generics for TypeScript #49

@SamVerschueren

Description

@SamVerschueren

It would be nice if we could do something like this

interface User {
    id: string;
    name: string;
}

const UserTable = db.table<User>('User');

const result = UserTable.find().exec();
//=> result is now recognized as `User[]` so we can map over it etc.

Something we have to take into account is that when using limit(1) or findOne() it doesn't return an array but a single instance. Not sure if we can define that somehow.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions