Skip to content

【Important】The ts type prompt issue for EntityManager.increment and EntityManager.decrement!! #10437

Closed

Description

@qq1147050160

What was unclear or otherwise insufficient?

Missing type hint for the second parameter (conditions) in the increase method. If I pass a number value. The generation of SQL is batch updated, and there may be a lack of where conditions, which is actually very dangerous. Actually, this happened to me. I suggest improving the type prompts for these two methods to avoid more injuries

Recommended Fix

increment<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, conditions: FindOptionsWhere<Entity>, propertyPath: keyof Entity, value: number | string): Promise<UpdateResult>;

decrement<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, conditions: FindOptionsWhere<Entity>, propertyPath: keyof Entity, value: number | string): Promise<UpdateResult>;

Additional Context

in --- EntityManager.d.ts

increment<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, conditions: any, propertyPath: string, value: number | string): Promise<UpdateResult>;

decrement<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, conditions: any, propertyPath: string, value: number | string): Promise<UpdateResult>;

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Activity

  1. changed the title [-]【Important】The ts type prompt issue for EntityManager.increment and EntityManager.increment!![/-] [+]【Important】The ts type prompt issue for EntityManager.increment and EntityManager.decrement!![/+] on Oct 18, 2023
  2. qq1147050160 commented on Jul 9, 2025

    @qq1147050160
    Author

    help me???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions