Skip to content
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

DeepPartial update breaks Active Record create/merge #9150

Open
bellstrand opened this issue Jun 25, 2022 · 0 comments
Open

DeepPartial update breaks Active Record create/merge #9150

bellstrand opened this issue Jun 25, 2022 · 0 comments

Comments

@bellstrand
Copy link

Issue Description

#8817 partially broke create & merge functions in Active Record setups by.

Expected Behavior

I'd expect a Active Record entities create & merge functions to be able to take a valid limited input as a parameter.

Actual Behavior

fails to compile because of

No overload matches this call.
  Overload 1 of 3, '(this: (new () => Item) & typeof BaseEntity, entityLikeArray: DeepPartial<Item>[]): Item[]', gave the following error.
    Argument of type 'Pick<Item, "value">' is not assignable to parameter of type 'DeepPartial<Item>[]'.
      Type 'Pick<Item, "value">' is missing the following properties from type 'DeepPartial<Item>[]': length, pop, push, concat, and 26 more.
  Overload 2 of 3, '(this: (new () => BaseEntity) & typeof BaseEntity, entityLike: DeepPartial<BaseEntity>): BaseEntity', gave the following error.
    Argument of type 'Pick<Item, "value">' is not assignable to parameter of type 'DeepPartial<BaseEntity>'.ts(2769)
BaseEntity.ts(185, 12): The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible.

Steps to Reproduce

  1. Copy & paste snippet
@Entity()
export class Item extends BaseEntity {
    @PrimaryColumn()
    id: string
    @Column()
    value: number
}

const input: Pick<Item, "value"> = { value: 42 }
const item = Item.create(input)

My Environment

Dependency Version
Operating System MacOS//Windows/Linux
Node.js version 16.15.0
Typescript version 4.7.4
TypeORM version 0.3.6

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 no
nativescript no
oracle no
postgres no
react-native no
sap no
spanner no
sqlite no
sqlite-abstract no
sqljs no
sqlserver no

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

  • ✅ 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant