-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
qb.getResultAndCount() fails on execution, if Entity field type uses TS allias #5221
Comments
Using ts-morph I guess? That's the important part here that you skipped from the report.
If this is your first step to set up a minimal repro, you don't understand what a minimal repro means :] You don't need web server to reproduce anything. |
What TS version are you using? I am not able to reproduce this with 5.3. On the other hand, I know quite well what's happening and I can fix that, it's just not reproducible on my end. |
Thank you for fix. I'm sorry for bad repro steps. No, I don't use |
Hmm, then it needs to be caused by SWC, their reflect-metadata support is pretty broken, so many differences... Anyway, the fix I did should cover this too, the property type validation is now limited only to a set of known types, and those don't include You can also get around such problems by specifying the @Property({ type: 'string', length: 50, nullable: true }) // strings are by default mapped to varchar
public firstName!: Nullable<string>; And one more note - your entity definition is a bit wrong, since you use @Property({ columnType: 'varchar(50)', nullable: true })
public firstName!: Nullable<string>; |
Describe the bug
Code like this example will fail with the exception posted below if the field of entity using named type alias instead of notation with a pipe and the recond in DB table has value that is not NULL
The problem appeared after updating mikro-orm to version 6.x, on previous (4, 5) there were no problems with that
Reproduction
type Nullable<T> = T | null;
eg.
public constructor(private readonly orm: MikroORM<PostgreSqlDriver>) {}
e.g.
What driver are you using?
@mikro-orm/postgresql
MikroORM version
6.1.0
Node.js version
node v20.10.0, npm 10.2.3
Operating system
Windows 11
Validations
The text was updated successfully, but these errors were encountered: