Skip to content

DeepPartial does not handle any and {[k: string]} #6580

@MatthiasKunnen

Description

@MatthiasKunnen

Issue type: Bug

[x] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[ ] @next
[] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

class Comment {
    any: any;
    object: {[k: string]: any};
}

commentRepository.create({
    any: {
        foo: 'bar',
    },
    object: {
        foo: 'bar'
    },
});

results in:

TS2322: Type '{ foo: string; }' is not assignable to type 'DeepPartial<{}>[] | ReadonlyArray<DeepPartial<{}>> | DeepPartial | undefined'.   Type '{ foo: string; }' is not assignable to type 'undefined'.

TS2322: Type '{ foo: string; }' is not assignable to type 'DeepPartial<{ [k: string]: any; }>'.   Property 'foo' is incompatible with index signature.     Type 'string' is not assignable to type 'DeepPartial<{}>[] | ReadonlyArray<DeepPartial<{}>> | DeepPartial | undefined'.

I'll create tests and a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions