Skip to content

Support typeorm@0.3.0 plain object repositories #383

@matomesc

Description

@matomesc

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

With typeorm@0.3.0 release around the corner, repositories are no longer classes but plain objects, so instanceof checks will fail and the following won't work in 0.3.0:

https://github.com/nestjs/typeorm/blob/master/lib/common/typeorm.utils.ts#L32
https://github.com/nestjs/typeorm/blob/master/lib/typeorm.providers.ts#L17

Expected behavior

Don't use instanceof checks and use the typeof property to check the type of a repository and generate injection tokens:
https://github.com/typeorm/typeorm/blob/b177e230a6fcb11f1eb71d4d431d0297436b7f6f/src/repository/Repository.ts#L29

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


Nest version: 7.x.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions