inferred-types 0.29.0 → 0.30.0
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
package/dist/index.js
CHANGED
|
@@ -643,7 +643,9 @@ var mapper = (config) => (map) => {
|
|
|
643
643
|
input: config.input,
|
|
644
644
|
output: config.output,
|
|
645
645
|
cardinality: config.cardinality,
|
|
646
|
-
debug: config.debug
|
|
646
|
+
debug: config.debug,
|
|
647
|
+
inputType: {},
|
|
648
|
+
outputType: {}
|
|
647
649
|
});
|
|
648
650
|
};
|
|
649
651
|
var setMapper = (config = { input: void 0, output: void 0, cardinality: void 0 }, defaultValue) => ({
|
package/dist/index.mjs
CHANGED
|
@@ -552,7 +552,9 @@ var mapper = (config) => (map) => {
|
|
|
552
552
|
input: config.input,
|
|
553
553
|
output: config.output,
|
|
554
554
|
cardinality: config.cardinality,
|
|
555
|
-
debug: config.debug
|
|
555
|
+
debug: config.debug,
|
|
556
|
+
inputType: {},
|
|
557
|
+
outputType: {}
|
|
556
558
|
});
|
|
557
559
|
};
|
|
558
560
|
var setMapper = (config = { input: void 0, output: void 0, cardinality: void 0 }, defaultValue) => ({
|
package/package.json
CHANGED
|
@@ -262,6 +262,12 @@ describe("mapTo() utility function", () => {
|
|
|
262
262
|
expect(m1.output).toBe("req");
|
|
263
263
|
expect(m1.cardinality).toBe("I -> O");
|
|
264
264
|
expect(m1(i)).toEqual(i);
|
|
265
|
+
|
|
266
|
+
type cases = [
|
|
267
|
+
Expect<Equal<typeof m1["inputType"], I>>, //
|
|
268
|
+
Expect<Equal<typeof m1["outputType"], I>> //
|
|
269
|
+
];
|
|
270
|
+
const cases: cases = [true, true];
|
|
265
271
|
});
|
|
266
272
|
|
|
267
273
|
it("M:1 conversion", () => {
|
|
@@ -309,9 +315,13 @@ describe("mapTo() utility function", () => {
|
|
|
309
315
|
.config({ output: "req", cardinality: "I -> O[]" })
|
|
310
316
|
.map<I, O>((i) => [{ title: i.title, count: i.products.length }]);
|
|
311
317
|
const o = m([i, i2]);
|
|
318
|
+
type RT = ReturnType<typeof m>;
|
|
312
319
|
|
|
313
320
|
expect(o.length).toBe(2);
|
|
314
321
|
o.map((item) => expect("title" in item).toBeTruthy());
|
|
322
|
+
|
|
323
|
+
type cases = [Expect<Equal<RT, O[] | [O, ...O[]]>>];
|
|
324
|
+
const cases: cases = [true];
|
|
315
325
|
});
|
|
316
326
|
|
|
317
327
|
it("1:M conversion with filtering", () => {
|