Update to typeorm 0.2.42 gives compilation error
See original GitHub issueSaw this when upgrading typeorm to latest (0.2.43). Issue arises in 02.42. Fix was to revert to 0.2.41
node_modules/@nestjsx/crud-typeorm/lib/typeorm-crud.service.d.ts:30:5 - error TS2416: Property 'createOne' in type 'TypeOrmCrudService<T>' is not assignable to the same property in base type 'CrudService<T>'.
Type '(req: CrudRequest, dto: DeepPartial<T>) => Promise<T>' is not assignable to type '(req: CrudRequest, dto: T) => Promise<T>'.
Types of parameters 'dto' and 'dto' are incompatible.
Type 'T' is not assignable to type 'DeepPartial<T>'.
30 createOne(req: CrudRequest, dto: DeepPartial<T>): Promise<T>;
~~~~~~~~~
node_modules/@nestjsx/crud-typeorm/lib/typeorm-crud.service.d.ts:32:5 - error TS2416: Property 'updateOne' in type 'TypeOrmCrudService<T>' is not assignable to the same property in base type 'CrudService<T>'.
Type '(req: CrudRequest, dto: DeepPartial<T>) => Promise<T>' is not assignable to type '(req: CrudRequest, dto: T) => Promise<T>'.
Types of parameters 'dto' and 'dto' are incompatible.
Type 'T' is not assignable to type 'DeepPartial<T>'.
32 updateOne(req: CrudRequest, dto: DeepPartial<T>): Promise<T>;
~~~~~~~~~
node_modules/@nestjsx/crud-typeorm/lib/typeorm-crud.service.d.ts:33:5 - error TS2416: Property 'replaceOne' in type 'TypeOrmCrudService<T>' is not assignable to the same property in base type 'CrudService<T>'.
Type '(req: CrudRequest, dto: DeepPartial<T>) => Promise<T>' is not assignable to type '(req: CrudRequest, dto: T) => Promise<T>'.
Types of parameters 'dto' and 'dto' are incompatible.
Type 'T' is not assignable to type 'DeepPartial<T>'.
33 replaceOne(req: CrudRequest, dto: DeepPartial<T>): Promise<T>;
~~~~~~~~~~
[9:40:39 AM] Found 3 errors. Watching for file changes.
git diffing typeorm 0.2.42 with 0.2.41 found the following which may be the cause
index 17223f43..0b8b0f70 100644
--- a/src/entity-manager/EntityManager.ts
+++ b/src/entity-manager/EntityManager.ts
@@ -163,17 +163,17 @@ export class EntityManager {
}
createQueryBuilder<Entity>(entityClass?: EntityTarget<Entity>|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {
if (alias) {
@@ -247,7 +247,7 @@ export class EntityManager {
return metadata.create(this.queryRunner);
if (Array.isArray(plainObjectOrObjects))
- return plainObjectOrObjects.map(plainEntityLike => this.create(entityClass as any, plainEntityLike));
+ return (plainObjectOrObjects as DeepPartial<Entity>[]).map(plainEntityLike => this.create(entityClass, plainEntityLike));
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Update to >= typeorm 0.2.42 gives compilation error ... - GitHub
Update to >= typeorm 0.2.42 gives compilation error for projects using nestjsx/crud #8698. Open.
Read more >Update to typeorm 0.2.42 gives compilation error - Issuehunt
Saw this when upgrading typeorm to latest (0.2.43). Issue arises in 02.42. Fix was to revert to 0.2.41
Read more >typeorm: CHANGELOG
compilation target now is es2020 . This requires Node.JS version 14+. TypeORM now properly works when installed within different node_modules contexts ...
Read more >Upgrade Typeorm version 0.2.28 to 0.2.45 - Stack Overflow
I want to upgrade my typeorm version from 0.2.28 to 0.2.45 but when I tried to start the server I had an error...
Read more >0.3.7 (2022-06-29) | TypeORM Docs
NOTE: FOR UPDATE locking does not work with findOne in Oracle since FOR UPDATE cannot be used with FETCH NEXT in a single...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@in-live-md We are still waiting for zMotivat0r to give deployment access to rewiko because it has set out to be a new maintainer. Until this is done, rewiko has forked it to release some fixes and updates to the library.
You can see more in #710.
The problem is with the TypeOrmCrudService and how they are typed.
I create a fix in rewiko version of nestjsx/crud.