TypeScript 2.7.1 update cause repository.save(entity) error
See original GitHub issueIssue type:
[ ] question [x ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[x ] postgres
[ ] sqlite
[ ] sqljs
[ ] websql
TypeORM version:
[ x] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
When i update my typescript version to 2.7.1 my application’s build broken with the follow error:
PS C:\dsv\nest-api> npm run start:prod
nest-typescript-starter@1.0.0 prestart:prod C:\dsv\nest-api tsc
src/modules/common/services/base-data.service.ts(46,65): error TS2321: Excessive stack depth comparing types ‘T’ and ‘DeepPartial<T>’. src/modules/common/services/base-data.service.ts(67,65): error TS2345: Argument of type ‘T’ is not assignable to parameter of type ‘DeepPartial<T>’.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nest-typescript-starter@1.0.0 prestart:prod: tsc
npm ERR! Exit status 2
The service code is the follow:
export abstract class BaseDataService<T extends BaseModel> implements ICrudService<T>{
constructor() {
}
... other crud methods
public abstract getRepository(): Repository<T>;
public async save(entity: T): Promise<T> {
try {
const response: T = await this.getRepository().save(entity);
return response;
} catch (error) {
throw new BadGatewayException('ERROR.BASEDATASERVICE.SAVE');
}
}
}
Someone know why this is happening?
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:24 (11 by maintainers)
Can you guys please check it in the
0.2.15-rc.1
? (npm i typeorm@0.2.15-rc.1
)Downgrading to
0.2.15-rc.1
did not fix the issue for me.