Skip to content

Typescript problem for load / preload #26

Open
@patrik-devswiss

Description

@patrik-devswiss

Hello,

generated types for SoftDeletes mixin in file build/src/mixin.d.ts contains many types from BaseModel not only new ones from SoftDelete.

Problematic is types for load and preload:
Your file have these types:

    load: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;
    preload: import("@adonisjs/lucid/types/model").LucidRowPreload<any>;

but Lucid types from BaseModel are:

    load: LucidRowPreload<this>;
    preload: LucidRowPreload<this>;

so <this> instead of <any>

when i use SoftDelete on model and then call .load() there is loader with type any and many problem with it:
image

same code without SoftDelete mixin:
image

there can be many more problems with types in this mixin.
should it contains only methods which mixin is create/override, shouldn't it? and do not touch what is not changing?

for now it is very complicated to use load with models with SoftDeleted

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions