You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I try to upgrade mikro recently and found an interesting error.
Previously in v3.x, content is infer as Content which nice but lack of type safety.
In v4.x the new types Loaded and New introduced in c5f766b try to improve the type safety but somehow content is now infer as IContent which is a pure value object.
I try to digging into the source code and fix it but failed :|
To Reproduce
Steps to reproduce the behavior:
Passing a typed object into the second argument in orm.em.create.
The type of the return value is infer as the type of the object.
Expected behavior
The type of the return value should be an entity.
Versions
Dependency
Version
node
14.12.0
typescript
4.0.2
@mikro-orm/core
4.0.7
@mikro-orm/mysql
4.0.7
The text was updated successfully, but these errors were encountered:
Interesting. It has nothing to do with the Loaded or New types, the issue is with the T as it was inferred to your IContent. I managed to get around it, the issue was with the EntityData being defined as T | ..., removing that T | fixes it.
Describe the bug
I try to upgrade mikro recently and found an interesting error.
Previously in v3.x,
content
is infer asContent
which nice but lack of type safety.In v4.x the new types
Loaded
andNew
introduced in c5f766b try to improve the type safety but somehowcontent
is now infer asIContent
which is a pure value object.I try to digging into the source code and fix it but failed :|
To Reproduce
Steps to reproduce the behavior:
orm.em.create
.Expected behavior
The type of the return value should be an entity.
Versions
The text was updated successfully, but these errors were encountered: