typeshi 2.1.6 → 2.1.7

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.
@@ -38,10 +38,10 @@ export declare class Restrict {
38
38
  * and `source[sourceKey]` is `undefined`
39
39
  */
40
40
  export type TransformationSchema<T extends object, S extends object = any> = {
41
- [K in keyof T]?: ((val: S[keyof S]) => T[K]) | TransformOptions<T, K, S>;
41
+ [K in keyof T]?: ((val: any) => T[K]) | TransformOptions<T, K, S>;
42
42
  };
43
43
  export type TransformOptions<T extends object, K extends keyof T, S extends object = any> = {
44
- transform?: (val: S[keyof S], ...args: any[]) => T[K];
44
+ transform?: (val: any, ...args: any[]) => T[K];
45
45
  args?: any[];
46
46
  defaultValue?: T[K];
47
47
  sourceKey?: keyof S;
@@ -58,10 +58,10 @@ function sanitizeAndMap(obj, schema, passThroughKeys = []) {
58
58
  ? schemaValue.sourceKey
59
59
  : key);
60
60
  if (hasDefinedEntry(obj, sourceKey)) {
61
- if ((0, typeValidation_1.isFunction)(schemaValue)) { // schemaValue is ((val: S[keyof S]) => T[K])
61
+ if ((0, typeValidation_1.isFunction)(schemaValue)) { // schemaValue is ((val: any) => T[K])
62
62
  data[key] = schemaValue(obj[sourceKey]);
63
63
  }
64
- else if ((0, typeValidation_1.isFunction)(schemaValue.transform)) { // schemaValue is { transform?: (val: S[keyof S], ...args: any[]) => T[K]; args?: any[]; sourceKey?: keyof S}
64
+ else if ((0, typeValidation_1.isFunction)(schemaValue.transform)) { // schemaValue is { transform?: (val: any, ...args: any[]) => T[K]; args?: any[]; sourceKey?: keyof S}
65
65
  data[key] = schemaValue.transform(obj[sourceKey], ...(schemaValue.args ?? []));
66
66
  }
67
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typeshi",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "description": "TypeScript utility modules",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",