Samagra-Development / templater

Template Manager
2 stars 8 forks source link

Type inference issue in RenderService #24

Open VarunGitGood opened 1 year ago

VarunGitGood commented 1 year ago

So while working on the new RenderService i've run into a snag and typescript is incorrectly infering the type

so image Here when i call the template from an external service ( template ) typescript only infers the scalars rather than transformers as well

This is the inferred type

    createdAt: Date;
    updatedAt: Date;
    id: bigint;
    type: TemplateType;
    useCase: string;
    body: string;
    meta: Prisma.JsonValue;
    user: string;
    tag: string[];
}, unknown> & {}

And if i call it directly in the Service itself like this image

this is the inferred type


    transformers: ({
        transformer: GetResult<{
            createdAt: Date;
            updatedAt: Date;
            id: bigint;
            type: TransformerType;
            meta: Prisma.JsonValue;
            sampleData: Prisma.JsonValue;
            functionDID: string;
        }, unknown> & {};
    } & GetResult<...> & {})[];
} & GetResult<...> & {}

could i get some possible solutions here thanks!!
VarunGitGood commented 1 year ago

@yuvrajsab @radhay-1199 could you help me out here i've been stuck for a while now Thanks!!