inferred-types 0.28.0 → 0.28.2

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.
package/dist/index.d.ts CHANGED
@@ -927,12 +927,13 @@ OR extends OptRequired, C extends MapCardinalityIllustrated> = C extends MapCard
927
927
  /**
928
928
  * **MapTo<I, O>**
929
929
  *
930
- * A mapping function between an input type `I` and output type `O`.
930
+ * A mapping function between an input type `I` and output type `O`. Defaults to using
931
+ * the _default_ OneToMany mapping config.
931
932
  *
932
933
  * **Note:** this type is designed to guide the userland mapping; refer
933
934
  * to `MapFn` if you want the type output by the `mapFn()` utility.
934
935
  */
935
- declare type MapTo<I, O, C extends FinalizedMapConfig<OptRequired, MapCardinalityIllustrated, OptRequired>> = MapIR<C> extends "opt" ? (source?: MapInput<I, MapIR<C>, MapCard<C>>) => MapOutput<O, MapOR<C>, MapCard<C>> : (source: MapInput<I, MapIR<C>, MapCard<C>>) => MapOutput<O, MapOR<C>, MapCard<C>>;
936
+ declare type MapTo<I, O, C extends FinalizedMapConfig<OptRequired, MapCardinalityIllustrated, OptRequired> = DefaultOneToManyMapping> = MapIR<C> extends "opt" ? (source?: MapInput<I, MapIR<C>, MapCard<C>>) => MapOutput<O, MapOR<C>, MapCard<C>> : (source: MapInput<I, MapIR<C>, MapCard<C>>) => MapOutput<O, MapOR<C>, MapCard<C>>;
936
937
  declare type MapFnOutput<I, O, S, OR extends OptRequired, C extends MapCardinalityIllustrated> = C extends "I -> O[]" | MapCardinality.OneToMany ? S extends I[] ? OR extends "opt" ? O[] : [O, ...O[]] : OR extends "opt" ? O[] | null : O[] : C extends MapCardinality.OneToOne | "I -> O" ? S extends I[] ? OR extends "opt" ? O[] : [O, ...O[]] : OR extends "opt" ? O | null : O : C extends MapCardinality.ManyToOne | "I[] -> O" ? S extends I[][] ? OR extends "opt" ? O[] : [O, ...O[]] : OR extends "opt" ? O | null : O : never;
937
938
  declare type MapFnInput<I, IR extends OptRequired, D extends MapCardinalityIllustrated> = D extends "I -> O[]" | MapCardinality.OneToMany ? IR extends "opt" ? I | I[] | undefined : I | I[] : D extends MapCardinality.OneToOne | "I -> O" ? IR extends "opt" ? I | I[] | undefined : I | I[] : D extends MapCardinality.ManyToOne | "I[] -> O" ? IR extends "opt" ? I[] | I[][] | undefined : I[] | I[][] : never;
938
939
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inferred-types",
3
- "version": "0.28.0",
3
+ "version": "0.28.2",
4
4
  "description": "Functions which provide useful type inference on TS projects",
5
5
  "license": "MIT",
6
6
  "author": "Ken Snyder<ken@ken.net>",
@@ -252,7 +252,8 @@ export type MapOutput<
252
252
  /**
253
253
  * **MapTo<I, O>**
254
254
  *
255
- * A mapping function between an input type `I` and output type `O`.
255
+ * A mapping function between an input type `I` and output type `O`. Defaults to using
256
+ * the _default_ OneToMany mapping config.
256
257
  *
257
258
  * **Note:** this type is designed to guide the userland mapping; refer
258
259
  * to `MapFn` if you want the type output by the `mapFn()` utility.
@@ -260,7 +261,11 @@ export type MapOutput<
260
261
  export type MapTo<
261
262
  I,
262
263
  O,
263
- C extends FinalizedMapConfig<OptRequired, MapCardinalityIllustrated, OptRequired>
264
+ C extends FinalizedMapConfig<
265
+ OptRequired,
266
+ MapCardinalityIllustrated,
267
+ OptRequired
268
+ > = DefaultOneToManyMapping
264
269
  > = MapIR<C> extends "opt"
265
270
  ? (source?: MapInput<I, MapIR<C>, MapCard<C>>) => MapOutput<O, MapOR<C>, MapCard<C>>
266
271
  : (source: MapInput<I, MapIR<C>, MapCard<C>>) => MapOutput<O, MapOR<C>, MapCard<C>>;