@types/knockout.mapping 2.0.37 → 2.0.38

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.
knockout.mapping/LICENSE CHANGED
File without changes
@@ -8,7 +8,7 @@ This package contains type definitions for Knockout.Mapping (https://github.com/
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/knockout.mapping.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 11 Jan 2022 16:31:41 GMT
11
+ * Last updated: Thu, 14 Sep 2023 01:49:18 GMT
12
12
  * Dependencies: [@types/knockout](https://npmjs.com/package/@types/knockout)
13
13
  * Global values: `mapping`
14
14
 
@@ -1,6 +1,6 @@
1
1
  // Type definitions for Knockout.Mapping 2.0
2
2
  // Project: https://github.com/SteveSanderson/knockout.mapping
3
- // Definitions by: Boris Yankov <https://github.com/borisyankov>
3
+ // Definitions by: Boris Yankov <https://github.com/borisyankov>
4
4
  // Mathias Lorenzen <https://github.com/ffMathy>
5
5
  // Leonardo Lombardi <https://github.com/ltlombardi>
6
6
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -16,23 +16,23 @@ export = self;
16
16
  type Primitives = string | number | boolean | symbol;
17
17
 
18
18
  declare global {
19
-
20
- type MappedType<T> =
21
- [T] extends [Primitives] ? KnockoutObservable<T> :
22
- [T] extends [object] ? KnockoutObservableType<T> :
23
- any;
19
+ type MappedType<T> = [T] extends [Primitives] ? KnockoutObservable<T>
20
+ : [T] extends [object] ? KnockoutObservableType<T>
21
+ : any;
24
22
 
25
23
  type KnockoutObservableType<T> = {
26
- [P in keyof T]: T[P] extends Primitives ? KnockoutObservable<T[P]> :
27
- T[P] extends any[] ? KnockoutObservableArrayType<T[P][number]> :
28
- T[P] extends ReadonlyArray<any> ? KnockoutReadonlyObservableArrayType<T[P][number]> :
29
- MappedType<T[P]>;
24
+ [P in keyof T]: T[P] extends Primitives ? KnockoutObservable<T[P]>
25
+ : T[P] extends any[] ? KnockoutObservableArrayType<T[P][number]>
26
+ : T[P] extends ReadonlyArray<any> ? KnockoutReadonlyObservableArrayType<T[P][number]>
27
+ : MappedType<T[P]>;
30
28
  };
31
29
 
32
30
  // Could not get this to return any when T is any. It returns a Union type of the possible values.
33
- type KnockoutObservableArrayType<T> = T extends Primitives ? KnockoutObservableArray<T> : KnockoutObservableArray<KnockoutObservableType<T>>;
31
+ type KnockoutObservableArrayType<T> = T extends Primitives ? KnockoutObservableArray<T>
32
+ : KnockoutObservableArray<KnockoutObservableType<T>>;
34
33
 
35
- type KnockoutReadonlyObservableArrayType<T> = T extends Primitives ? KnockoutReadonlyObservableArray<T> : KnockoutReadonlyObservableArray<KnockoutObservableType<T>>;
34
+ type KnockoutReadonlyObservableArrayType<T> = T extends Primitives ? KnockoutReadonlyObservableArray<T>
35
+ : KnockoutReadonlyObservableArray<KnockoutObservableType<T>>;
36
36
 
37
37
  type KnockoutMappingOptions<T> = KnockoutMappingSpecificOptions<T> | KnockoutMappingStandardOptions;
38
38
 
@@ -46,8 +46,8 @@ declare global {
46
46
  }
47
47
 
48
48
  type KnockoutMappingSpecificOptions<T> = {
49
- [P in keyof T]?: KnockoutPropertyMappingCallBack
50
- }
49
+ [P in keyof T]?: KnockoutPropertyMappingCallBack;
50
+ };
51
51
 
52
52
  interface KnockoutPropertyMappingCallBack {
53
53
  create?: ((options: KnockoutMappingCreateOptions) => void) | undefined;
@@ -74,13 +74,17 @@ declare global {
74
74
  */
75
75
  isMapped(viewModel: any): boolean;
76
76
  /**
77
- * Creates an observable array view model. Objects on the source array are also converted to observables. Primitive types and arrays are not.
77
+ * Creates an observable array view model. Objects on the source array are also converted to observables. Primitive types and arrays are not.
78
78
  * If 'target' is supplied, instead, target's observable properties are updated.
79
79
  * @param source Array to be mapped.
80
80
  * @param options Options on mapping behavior.
81
81
  * @param target View model object previosly mapped to be updated.
82
82
  */
83
- fromJS<T>(source: T[], options?: KnockoutMappingOptions<T[]>, target?: KnockoutObservableArrayType<T>): KnockoutObservableArrayType<T>;
83
+ fromJS<T>(
84
+ source: T[],
85
+ options?: KnockoutMappingOptions<T[]>,
86
+ target?: KnockoutObservableArrayType<T>,
87
+ ): KnockoutObservableArrayType<T>;
84
88
  /**
85
89
  * Updates target's observable properties with those of the sources.
86
90
  * @param source Array to be mapped.
@@ -88,21 +92,28 @@ declare global {
88
92
  */
89
93
  fromJS<T>(source: T[], target: KnockoutObservableArrayType<T>): KnockoutObservableArrayType<T>;
90
94
  /**
91
- * Creates an readonly observable array view model. Objects on the source array are also converted to observables. Primitive types and arrays are not.
95
+ * Creates an readonly observable array view model. Objects on the source array are also converted to observables. Primitive types and arrays are not.
92
96
  * If 'target' is supplied, instead, target's observable properties are updated.
93
97
  * @param source Array to be mapped.
94
98
  * @param options Options on mapping behavior.
95
99
  * @param target View model object previosly mapped to be updated.
96
100
  */
97
- fromJS<T>(source: ReadonlyArray<T>, options?: KnockoutMappingOptions<ReadonlyArray<T>>, target?: KnockoutReadonlyObservableArrayType<T>): KnockoutReadonlyObservableArrayType<T>;
101
+ fromJS<T>(
102
+ source: ReadonlyArray<T>,
103
+ options?: KnockoutMappingOptions<ReadonlyArray<T>>,
104
+ target?: KnockoutReadonlyObservableArrayType<T>,
105
+ ): KnockoutReadonlyObservableArrayType<T>;
98
106
  /**
99
107
  * Updates target's observable properties with those of the sources.
100
108
  * @param source Array to be mapped.
101
109
  * @param target View model object previosly mapped to be updated.
102
110
  */
103
- fromJS<T>(source: ReadonlyArray<T>, target: KnockoutReadonlyObservableArrayType<T>): KnockoutReadonlyObservableArrayType<T>;
111
+ fromJS<T>(
112
+ source: ReadonlyArray<T>,
113
+ target: KnockoutReadonlyObservableArrayType<T>,
114
+ ): KnockoutReadonlyObservableArrayType<T>;
104
115
  /**
105
- * Creates a view model object with observable properties for each of the properties on the source.
116
+ * Creates a view model object with observable properties for each of the properties on the source.
106
117
  * If 'target' is supplied, instead, target's observable properties are updated.
107
118
  * @param source Plain JavaScript object to be mapped.
108
119
  * @param options Options on mapping behavior.
@@ -116,7 +127,7 @@ declare global {
116
127
  */
117
128
  fromJS<T>(source: T, target: MappedType<T>): MappedType<T>;
118
129
  /**
119
- * Creates a view model object with observable properties for each of the properties on the source.
130
+ * Creates a view model object with observable properties for each of the properties on the source.
120
131
  * If 'target' is supplied, instead, target's observable properties are updated.
121
132
  * @param source JSON of a JavaScript object to be mapped.
122
133
  * @param options Options on mapping behavior.
@@ -130,7 +141,7 @@ declare global {
130
141
  */
131
142
  fromJSON(source: string, target: any): any;
132
143
  /**
133
- * Creates an unmapped object containing only the properties of the mapped object that were part of your original JS object.
144
+ * Creates an unmapped object containing only the properties of the mapped object that were part of your original JS object.
134
145
  * @param viewModel View model object previosly mapped.
135
146
  * @param options Options on mapping behavior.
136
147
  */
@@ -163,7 +174,13 @@ declare global {
163
174
  visitModel(
164
175
  rootObject: any,
165
176
  callback: Function,
166
- options?: { visitedObjects?: any; parentName?: string | undefined; ignore?: string[] | undefined; copy?: string[] | undefined; include?: string[] | undefined; }
177
+ options?: {
178
+ visitedObjects?: any;
179
+ parentName?: string | undefined;
180
+ ignore?: string[] | undefined;
181
+ copy?: string[] | undefined;
182
+ include?: string[] | undefined;
183
+ },
167
184
  ): any;
168
185
  }
169
186
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/knockout.mapping",
3
- "version": "2.0.37",
3
+ "version": "2.0.38",
4
4
  "description": "TypeScript definitions for Knockout.Mapping",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/knockout.mapping",
6
6
  "license": "MIT",
@@ -32,6 +32,6 @@
32
32
  "dependencies": {
33
33
  "@types/knockout": "*"
34
34
  },
35
- "typesPublisherContentHash": "6ba47fc51cd64cd605a372e38acf9a3e911e9b9bea060732350546087f8efd55",
36
- "typeScriptVersion": "3.8"
35
+ "typesPublisherContentHash": "cef9efc87a712cb32b7a3fe974b114dcba23b8c3b6d54809dafabf42e0e94704",
36
+ "typeScriptVersion": "4.5"
37
37
  }