domain-driven-hexagon
domain-driven-hexagon copied to clipboard
execute start:dev throws error
https://github.com/Sairyss/domain-driven-hexagon/blob/64387c47b07b941843d2f854fc358cde45051787/src/libs/ddd/infrastructure/database/base-classes/typeorm.repository.base.ts#L44-L47
when excute start:dev it throws error
src/libs/ddd/infrastructure/database/base-classes/typeorm.repository.base.ts:47:47 - error TS2769: No overload matches this call.
Overload 1 of 4, '(entities: DeepPartial<OrmEntity>[], options?: SaveOptions | undefined): Promise<(DeepPartial<OrmEntity> & OrmEntity)[]>', gave the following error.
Argument of type 'OrmEntity' is not assignable to parameter of type 'DeepPartial<OrmEntity>[]'.
Overload 2 of 4, '(entity: DeepPartial<OrmEntity>, options?: SaveOptions | undefined): Promise<DeepPartial<OrmEntity> & OrmEntity>', gave the following error.
Argument of type 'OrmEntity' is not assignable to parameter of type 'DeepPartial<OrmEntity>'.
47 const result = await this.repository.save(ormEntity);
what am i missing?
I just tried starting the application and I don't get any error. Try deleting node_modules and installing them again maybe this will help.
Thx for quick reply. Is there any opportunity that because of node version?
I'm using version 16.14.0. I also tried using version 12.22.11 and it worked too. If you have much older version try running it with a newer version of node. You can use nvm or volta for that.
Hi,
I have exactly the same issue here. Using:
- Node 16.13.2
- NestJS 8.0.0
- NestJS/typeorm 8.0.3
- typeorm 0.2.45
Already tried to delete the node_modules folder / npm upgrade / npm install --> no success
Any idea?
Thanks for your help.
This is caused by npm upgrade
. Newer versions of TypeOrm have breaking changes. Skip the upgrade part and make sure you are using package-lock.json file provided in a repository (and not the one that gets updated by running npm upgrade
)
Many thanks for pointing me to the right direction.
It seems this issue appeared with typeorm 0.2.42 and is being investigated by the typeorm team (https://github.com/typeorm/typeorm/issues/8681). A fix has been merged yesterday but it seems some users still encounter some issue.
I've downgraded the typeorm package to version 0.2.41 and it is working again 👍🏻