@types/knockout.mapping 2.0.37 → 2.0.39

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
@@ -2,15 +2,14 @@
2
2
  > `npm install --save @types/knockout.mapping`
3
3
 
4
4
  # Summary
5
- This package contains type definitions for Knockout.Mapping (https://github.com/SteveSanderson/knockout.mapping).
5
+ This package contains type definitions for knockout.mapping (https://github.com/SteveSanderson/knockout.mapping).
6
6
 
7
7
  # Details
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: Wed, 18 Oct 2023 05:47:07 GMT
12
12
  * Dependencies: [@types/knockout](https://npmjs.com/package/@types/knockout)
13
- * Global values: `mapping`
14
13
 
15
14
  # Credits
16
15
  These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Mathias Lorenzen](https://github.com/ffMathy), and [Leonardo Lombardi](https://github.com/ltlombardi).
@@ -1,11 +1,3 @@
1
- // Type definitions for Knockout.Mapping 2.0
2
- // Project: https://github.com/SteveSanderson/knockout.mapping
3
- // Definitions by: Boris Yankov <https://github.com/borisyankov>
4
- // Mathias Lorenzen <https://github.com/ffMathy>
5
- // Leonardo Lombardi <https://github.com/ltlombardi>
6
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
- // TypeScript Version: 2.8
8
-
9
1
  /// <reference types="knockout" />
10
2
 
11
3
  export as namespace mapping;
@@ -16,23 +8,23 @@ export = self;
16
8
  type Primitives = string | number | boolean | symbol;
17
9
 
18
10
  declare global {
19
-
20
- type MappedType<T> =
21
- [T] extends [Primitives] ? KnockoutObservable<T> :
22
- [T] extends [object] ? KnockoutObservableType<T> :
23
- any;
11
+ type MappedType<T> = [T] extends [Primitives] ? KnockoutObservable<T>
12
+ : [T] extends [object] ? KnockoutObservableType<T>
13
+ : any;
24
14
 
25
15
  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]>;
16
+ [P in keyof T]: T[P] extends Primitives ? KnockoutObservable<T[P]>
17
+ : T[P] extends any[] ? KnockoutObservableArrayType<T[P][number]>
18
+ : T[P] extends ReadonlyArray<any> ? KnockoutReadonlyObservableArrayType<T[P][number]>
19
+ : MappedType<T[P]>;
30
20
  };
31
21
 
32
22
  // 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>>;
23
+ type KnockoutObservableArrayType<T> = T extends Primitives ? KnockoutObservableArray<T>
24
+ : KnockoutObservableArray<KnockoutObservableType<T>>;
34
25
 
35
- type KnockoutReadonlyObservableArrayType<T> = T extends Primitives ? KnockoutReadonlyObservableArray<T> : KnockoutReadonlyObservableArray<KnockoutObservableType<T>>;
26
+ type KnockoutReadonlyObservableArrayType<T> = T extends Primitives ? KnockoutReadonlyObservableArray<T>
27
+ : KnockoutReadonlyObservableArray<KnockoutObservableType<T>>;
36
28
 
37
29
  type KnockoutMappingOptions<T> = KnockoutMappingSpecificOptions<T> | KnockoutMappingStandardOptions;
38
30
 
@@ -46,8 +38,8 @@ declare global {
46
38
  }
47
39
 
48
40
  type KnockoutMappingSpecificOptions<T> = {
49
- [P in keyof T]?: KnockoutPropertyMappingCallBack
50
- }
41
+ [P in keyof T]?: KnockoutPropertyMappingCallBack;
42
+ };
51
43
 
52
44
  interface KnockoutPropertyMappingCallBack {
53
45
  create?: ((options: KnockoutMappingCreateOptions) => void) | undefined;
@@ -74,13 +66,17 @@ declare global {
74
66
  */
75
67
  isMapped(viewModel: any): boolean;
76
68
  /**
77
- * Creates an observable array view model. Objects on the source array are also converted to observables. Primitive types and arrays are not.
69
+ * Creates an observable array view model. Objects on the source array are also converted to observables. Primitive types and arrays are not.
78
70
  * If 'target' is supplied, instead, target's observable properties are updated.
79
71
  * @param source Array to be mapped.
80
72
  * @param options Options on mapping behavior.
81
73
  * @param target View model object previosly mapped to be updated.
82
74
  */
83
- fromJS<T>(source: T[], options?: KnockoutMappingOptions<T[]>, target?: KnockoutObservableArrayType<T>): KnockoutObservableArrayType<T>;
75
+ fromJS<T>(
76
+ source: T[],
77
+ options?: KnockoutMappingOptions<T[]>,
78
+ target?: KnockoutObservableArrayType<T>,
79
+ ): KnockoutObservableArrayType<T>;
84
80
  /**
85
81
  * Updates target's observable properties with those of the sources.
86
82
  * @param source Array to be mapped.
@@ -88,21 +84,28 @@ declare global {
88
84
  */
89
85
  fromJS<T>(source: T[], target: KnockoutObservableArrayType<T>): KnockoutObservableArrayType<T>;
90
86
  /**
91
- * Creates an readonly observable array view model. Objects on the source array are also converted to observables. Primitive types and arrays are not.
87
+ * Creates an readonly observable array view model. Objects on the source array are also converted to observables. Primitive types and arrays are not.
92
88
  * If 'target' is supplied, instead, target's observable properties are updated.
93
89
  * @param source Array to be mapped.
94
90
  * @param options Options on mapping behavior.
95
91
  * @param target View model object previosly mapped to be updated.
96
92
  */
97
- fromJS<T>(source: ReadonlyArray<T>, options?: KnockoutMappingOptions<ReadonlyArray<T>>, target?: KnockoutReadonlyObservableArrayType<T>): KnockoutReadonlyObservableArrayType<T>;
93
+ fromJS<T>(
94
+ source: ReadonlyArray<T>,
95
+ options?: KnockoutMappingOptions<ReadonlyArray<T>>,
96
+ target?: KnockoutReadonlyObservableArrayType<T>,
97
+ ): KnockoutReadonlyObservableArrayType<T>;
98
98
  /**
99
99
  * Updates target's observable properties with those of the sources.
100
100
  * @param source Array to be mapped.
101
101
  * @param target View model object previosly mapped to be updated.
102
102
  */
103
- fromJS<T>(source: ReadonlyArray<T>, target: KnockoutReadonlyObservableArrayType<T>): KnockoutReadonlyObservableArrayType<T>;
103
+ fromJS<T>(
104
+ source: ReadonlyArray<T>,
105
+ target: KnockoutReadonlyObservableArrayType<T>,
106
+ ): KnockoutReadonlyObservableArrayType<T>;
104
107
  /**
105
- * Creates a view model object with observable properties for each of the properties on the source.
108
+ * Creates a view model object with observable properties for each of the properties on the source.
106
109
  * If 'target' is supplied, instead, target's observable properties are updated.
107
110
  * @param source Plain JavaScript object to be mapped.
108
111
  * @param options Options on mapping behavior.
@@ -116,7 +119,7 @@ declare global {
116
119
  */
117
120
  fromJS<T>(source: T, target: MappedType<T>): MappedType<T>;
118
121
  /**
119
- * Creates a view model object with observable properties for each of the properties on the source.
122
+ * Creates a view model object with observable properties for each of the properties on the source.
120
123
  * If 'target' is supplied, instead, target's observable properties are updated.
121
124
  * @param source JSON of a JavaScript object to be mapped.
122
125
  * @param options Options on mapping behavior.
@@ -130,7 +133,7 @@ declare global {
130
133
  */
131
134
  fromJSON(source: string, target: any): any;
132
135
  /**
133
- * Creates an unmapped object containing only the properties of the mapped object that were part of your original JS object.
136
+ * Creates an unmapped object containing only the properties of the mapped object that were part of your original JS object.
134
137
  * @param viewModel View model object previosly mapped.
135
138
  * @param options Options on mapping behavior.
136
139
  */
@@ -163,7 +166,13 @@ declare global {
163
166
  visitModel(
164
167
  rootObject: any,
165
168
  callback: Function,
166
- options?: { visitedObjects?: any; parentName?: string | undefined; ignore?: string[] | undefined; copy?: string[] | undefined; include?: string[] | undefined; }
169
+ options?: {
170
+ visitedObjects?: any;
171
+ parentName?: string | undefined;
172
+ ignore?: string[] | undefined;
173
+ copy?: string[] | undefined;
174
+ include?: string[] | undefined;
175
+ },
167
176
  ): any;
168
177
  }
169
178
 
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "@types/knockout.mapping",
3
- "version": "2.0.37",
4
- "description": "TypeScript definitions for Knockout.Mapping",
3
+ "version": "2.0.39",
4
+ "description": "TypeScript definitions for knockout.mapping",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/knockout.mapping",
6
6
  "license": "MIT",
7
7
  "contributors": [
8
8
  {
9
9
  "name": "Boris Yankov",
10
- "url": "https://github.com/borisyankov",
11
- "githubUsername": "borisyankov"
10
+ "githubUsername": "borisyankov",
11
+ "url": "https://github.com/borisyankov"
12
12
  },
13
13
  {
14
14
  "name": "Mathias Lorenzen",
15
- "url": "https://github.com/ffMathy",
16
- "githubUsername": "ffMathy"
15
+ "githubUsername": "ffMathy",
16
+ "url": "https://github.com/ffMathy"
17
17
  },
18
18
  {
19
19
  "name": "Leonardo Lombardi",
20
- "url": "https://github.com/ltlombardi",
21
- "githubUsername": "ltlombardi"
20
+ "githubUsername": "ltlombardi",
21
+ "url": "https://github.com/ltlombardi"
22
22
  }
23
23
  ],
24
24
  "main": "",
@@ -32,6 +32,6 @@
32
32
  "dependencies": {
33
33
  "@types/knockout": "*"
34
34
  },
35
- "typesPublisherContentHash": "6ba47fc51cd64cd605a372e38acf9a3e911e9b9bea060732350546087f8efd55",
36
- "typeScriptVersion": "3.8"
35
+ "typesPublisherContentHash": "476b6f39f9348bf0e117a8ae8e7f5ad63178b2d770561bf236aad4e80862eb4c",
36
+ "typeScriptVersion": "4.5"
37
37
  }