@mikro-orm/core 6.4.17-dev.91 → 6.4.17-dev.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/typings.d.ts +13 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.4.17-dev.91",
3
+ "version": "6.4.17-dev.93",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.3.1",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.4.17-dev.91",
67
+ "mikro-orm": "6.4.17-dev.93",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
package/typings.d.ts CHANGED
@@ -44,11 +44,15 @@ export declare const EagerProps: unique symbol;
44
44
  export declare const HiddenProps: unique symbol;
45
45
  export declare const Config: unique symbol;
46
46
  declare const __optional: unique symbol;
47
+ declare const __requiredNullable: unique symbol;
47
48
  declare const __hidden: unique symbol;
48
49
  declare const __config: unique symbol;
49
50
  export type Opt<T = unknown> = T & {
50
51
  [__optional]?: 1;
51
52
  };
53
+ export type RequiredNullable<T = never> = (T & {
54
+ [__requiredNullable]?: 1;
55
+ }) | null;
52
56
  export type Hidden<T = unknown> = T & {
53
57
  [__hidden]?: 1;
54
58
  };
@@ -216,7 +220,9 @@ export type EntityDataProp<T, C extends boolean> = T extends Date ? string | Dat
216
220
  __runtime?: infer Runtime;
217
221
  __raw?: infer Raw;
218
222
  } ? (C extends true ? Raw : Runtime) : T extends Reference<infer U> ? EntityDataNested<U, C> : T extends ScalarReference<infer U> ? EntityDataProp<U, C> : T extends Collection<infer U, any> ? U | U[] | EntityDataNested<U, C> | EntityDataNested<U, C>[] : T extends readonly (infer U)[] ? U extends NonArrayObject ? U | U[] | EntityDataNested<U, C> | EntityDataNested<U, C>[] : U[] | EntityDataNested<U, C>[] : EntityDataNested<T, C>;
219
- export type RequiredEntityDataProp<T, O, C extends boolean> = T extends Date ? string | Date : T extends Scalar ? T : T extends {
223
+ export type RequiredEntityDataProp<T, O, C extends boolean> = T extends Date ? string | Date : Exclude<T, null> extends {
224
+ [__requiredNullable]?: 1;
225
+ } ? T | null : T extends Scalar ? T : T extends {
220
226
  __runtime?: infer Runtime;
221
227
  __raw?: infer Raw;
222
228
  } ? (C extends true ? Raw : Runtime) : T extends Reference<infer U> ? RequiredEntityDataNested<U, O, C> : T extends ScalarReference<infer U> ? RequiredEntityDataProp<U, O, C> : T extends Collection<infer U, any> ? U | U[] | RequiredEntityDataNested<U, O, C> | RequiredEntityDataNested<U, O, C>[] : T extends readonly (infer U)[] ? U extends NonArrayObject ? U | U[] | RequiredEntityDataNested<U, O, C> | RequiredEntityDataNested<U, O, C>[] : U[] | RequiredEntityDataNested<U, O, C>[] : RequiredEntityDataNested<T, O, C>;
@@ -231,7 +237,12 @@ type ExplicitlyOptionalProps<T> = (T extends {
231
237
  type NullableKeys<T, V = null> = {
232
238
  [K in keyof T]: V extends T[K] ? K : never;
233
239
  }[keyof T];
234
- type ProbablyOptionalProps<T> = PrimaryProperty<T> | ExplicitlyOptionalProps<T> | NonNullable<NullableKeys<T, null | undefined>>;
240
+ type RequiredNullableKeys<T> = {
241
+ [K in keyof T]: Exclude<T[K], null> extends {
242
+ [__requiredNullable]?: 1;
243
+ } ? K : never;
244
+ }[keyof T];
245
+ type ProbablyOptionalProps<T> = PrimaryProperty<T> | ExplicitlyOptionalProps<T> | Exclude<NonNullable<NullableKeys<T, null | undefined>>, RequiredNullableKeys<T>>;
235
246
  type IsOptional<T, K extends keyof T, I> = T[K] extends Collection<any, any> ? true : ExtractType<T[K]> extends I ? true : K extends ProbablyOptionalProps<T> ? true : false;
236
247
  type RequiredKeys<T, K extends keyof T, I> = IsOptional<T, K, I> extends false ? CleanKeys<T, K> : never;
237
248
  type OptionalKeys<T, K extends keyof T, I> = IsOptional<T, K, I> extends false ? never : CleanKeys<T, K>;