Skip to content

Instantly share code, notes, and snippets.

@B4nan
Created January 13, 2020 11:47
Show Gist options
  • Select an option

  • Save B4nan/ff800fac1e60d98e1dcf5662c8f5a3b8 to your computer and use it in GitHub Desktop.

Select an option

Save B4nan/ff800fac1e60d98e1dcf5662c8f5a3b8 to your computer and use it in GitHub Desktop.
MikroORM 3: strict query typing
// correct query
em.find(Author, {
favouriteBook: {
author: { name: '...' },
},
age: { $gte: 40 }, // operators are also supported
});
// 2 errors will be reported here
em.find(Author, {
favouriteBook: {
author: { born: 'test' }, // string instead of Date
},
age: { $lte: 'nan' }, // string instead of number
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment