Type 'Entity' does not satisfy the constraint 'ObjectLiteral'. update(): UpdateQueryBuilder<Entity>;
See original GitHub issueExpected Behavior
Just Build without any error.
Issue Description
Build Time error. It Work perfectly in development. When run build (tsc -p .) then getting this error below.
node_modules/typeorm/query-builder/QueryBuilder.d.ts:84:34 - error TS2344: Type 'Entity' does not satisfy the constraint 'ObjectLiteral'.
84 update(): UpdateQueryBuilder<Entity>;
~~~~~~
node_modules/typeorm/query-builder/QueryBuilder.d.ts:24:44
24 export declare abstract class QueryBuilder<Entity> {
~~~~~~
This type parameter might need an `extends ObjectLiteral` constraint.
node_modules/typeorm/query-builder/QueryBuilder.d.ts:88:75 - error TS2344: Type 'Entity' does not satisfy the constraint 'ObjectLiteral'.
88 update(updateSet: QueryDeepPartialEntity<Entity>): UpdateQueryBuilder<Entity>;
~~~~~~
node_modules/typeorm/query-builder/QueryBuilder.d.ts:24:44
24 export declare abstract class QueryBuilder<Entity> {
~~~~~~
This type parameter might need an `extends ObjectLiteral` constraint.
node_modules/typeorm/query-builder/QueryBuilder.d.ts:92:114 - error TS2344: Type 'Entity' does not satisfy the constraint 'ObjectLiteral'.
92 update<Entity>(entity: EntityTarget<Entity>, updateSet?: QueryDeepPartialEntity<Entity>): UpdateQueryBuilder<Entity>;
~~~~~~
node_modules/typeorm/query-builder/QueryBuilder.d.ts:92:12
92 update<Entity>(entity: EntityTarget<Entity>, updateSet?: QueryDeepPartialEntity<Entity>): UpdateQueryBuilder<Entity>;
~~~~~~
This type parameter might need an `extends ObjectLiteral` constraint.
node_modules/typeorm/query-builder/QueryBuilder.d.ts:96:95 - error TS2344: Type 'Entity' does not satisfy the constraint 'ObjectLiteral'.
96 update(tableName: string, updateSet?: QueryDeepPartialEntity<Entity>): UpdateQueryBuilder<Entity>;
~~~~~~
node_modules/typeorm/query-builder/QueryBuilder.d.ts:24:44
24 export declare abstract class QueryBuilder<Entity> {
~~~~~~
This type parameter might need an `extends ObjectLiteral` constraint.
Found 4 errors in the same file, starting at: node_modules/typeorm/query-builder/QueryBuilder.d.ts:84
Steps to Reproduce
My Environment
Dependency | Version |
---|---|
Operating System | |
Node.js version | v16.15.0 |
Typescript version | 4.8.2 |
TypeORM version | 0.3.8 |
Express | 4.18.1 |
Additional Context
Relevant Database Driver(s)
DB Type | Reproducible |
---|---|
aurora-mysql |
no |
aurora-postgres |
no |
better-sqlite3 |
no |
cockroachdb |
no |
cordova |
no |
expo |
no |
mongodb |
no |
mysql |
yes |
nativescript |
no |
oracle |
no |
postgres |
no |
react-native |
no |
sap |
no |
spanner |
no |
sqlite |
no |
sqlite-abstract |
no |
sqljs |
no |
sqlserver |
no |
- ✖️ Yes, I have the time, and I know how to start.
- ✅ Yes, I have the time, but I don’t know how to start. I would need guidance.
- ✖️ No, I don’t have the time, but I can support (using donations) development.
- ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
Issue Analytics
- State:
- Created a year ago
- Reactions:9
- Comments:5
Top Results From Across the Web
Typescript Type "Object does not satisfy the constraint ...
It compiles fine on the playground : enter image description here. And Visual studio and command line: enter image description here.
Read more >Incorrect, "Type does not satisfy the constraint" error when ...
Incorrect, "Type does not satisfy the constraint" error when using constraints with primitive types ... The following code is in fact valid, compiles...
Read more >Why is my Pick<> failing with "Type does not satisfy ... - Reddit
I have a file called ionIcons.ts. It contains a list of var delcarations. export declare var accessibility: string; export declare var…
Read more >Microsoft/TypeScript - Gitter
... of 'WeakMap' must have identical type parameters. typings/globals/lodash/index.d.ts(12451,56): error TS2344: Type 'K' does not satisfy the constraint ...
Read more >Typescript error "does not satisfy the constraint new" when ...
If you get an error when trying to use InstanceType from typegoose as a parameter to a method in typescript make sure you...
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
We are using version
0.2.45
and are faced with the same issue. It is difficult for us to migrate to typeorm 0.3 at this time and we would like to use the latest TS version. Is it possible to come up with a patch for typeorm 0.2? Here is the error we are seeing:Maybe https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#unconstrained-generics-no-longer-assignable-to is relevant to explain this issue.
Let me add a minimun example of my issue:
Consider ts playground references:
As metioned in TS 4.8 release notes linked above, T is no longer assignable to
{}
so it’s no longer valid in ts 4.8.X becauseT
no longer constraintsObjectLiteral
.Having said that, just to know, why typeorm’s
Repository
,QueryBuilder
… are enforcingEntity
to extendObjectLiteral
?./node_modules/typeorm/repository/Repository.d.ts
Having a look at
ObjectLiteral
:./node_modules/typeorm/common/ObjectLiteral.d.ts
It seems this constraint is the cause of the issue, do we have a reason for keeping it?