New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript 2.7.1 update cause repository.save(entity) error #1544
Comments
There is an issue open for that (microsoft/TypeScript#21671). It seems like a regression issue on their part. Let's see what they have to say. |
@daniel-lang how to reproduce this? $ ./node_modules/.bin/tsc
$ ./node_modules/.bin/tsc -v
Version 2.7.1 I don't have such error checking on |
I'm unable to reproduce it now, but when I wrote the comment I was. That's very strange. |
@rafaelbatistamarcilio @adrianhara can you provide more information? |
I'm stack too in this problem.. I'm using ts 2.7.2. |
anyone can tell how to reproduce this issue? |
I can give you my repo if you want, there you have the version of each npm package. just: You should change the typeormconfig to change the db |
yes it would be great |
this is my repo: |
@xavism thanks for the repo, but I expected something simple with a few lines of code, since example is complex Im not sure where is a problem. Lets wait until microsoft/TypeScript#21671 is resolved by typescript team. |
Sorry I thought would be easier to reproduce it. Here I add a simple example export class BaseService<T extends BaseEntity> implements IBaseService<T>{
constructor(
private readonly genericRepository: Repository<T>) {
console.log('Im the ORM Service');
}
create(entity: T): Promise<number>{
return new Promise<number> ((resolve, reject) => {
this.genericRepository.save(entity)
.then(created=> resolve(created.id))
.catch(err => reject(err))
})
}
} |
The problem is generated in the save method, where you pass a parameter of type T |
I have the same error, any updates? |
@aymehri microsoft/TypeScript#21671 in favor of microsoft/TypeScript#21592 in which the Typescript Team acknowledged that it's a bug. The current target for a fix is TypeScript 2.8.1 |
Thank you @daniel-lang , we just wait then. :) |
@aymehri To use it before the fix in TS 2.8.1, you just have to pass the entity as any. |
I'll close it, let's track a typescript issue instead. |
Can you guys please check it in the |
Can confirm this work ! |
Great! Would be great if everyone else confirm it |
Downgrading to |
me too |
Although what did fix the issue was downgrading |
Not for me, I was in 3.3.400. Downgrading to 3.1.6 did work, though. See : microsoft/TypeScript#29112 (comment) |
Issue 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
src/modules/common/services/base-data.service.ts(46,65): error TS2321: Excessive stack depth comparing types 'T' and 'DeepPartial'.
src/modules/common/services/base-data.service.ts(67,65): error TS2345: Argument of type 'T' is not assignable to parameter of type 'DeepPartial'.
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:
Someone know why this is happening?
Thanks!
The text was updated successfully, but these errors were encountered: