@wix/sdk-types 1.13.2 → 1.13.3

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/build/index.d.mts CHANGED
@@ -324,6 +324,26 @@ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
324
324
 
325
325
  const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
326
326
  //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
327
+
328
+ // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
329
+
330
+ // Consider the following example:
331
+
332
+ type UserData = {
333
+ [metadata: string]: string;
334
+ email: string;
335
+ name: string;
336
+ role: 'admin' | 'user';
337
+ };
338
+
339
+ // `Omit` clearly doesn't behave as expected in this case:
340
+ type PostPayload = Omit<UserData, 'email'>;
341
+ //=> type PostPayload = { [x: string]: string; [x: number]: string; }
342
+
343
+ // In situations like this, `Except` works better.
344
+ // It simply removes the `email` key while preserving all the other keys.
345
+ type PostPayload = Except<UserData, 'email'>;
346
+ //=> type PostPayload = { [x: string]: string; name: string; role: 'admin' | 'user'; }
327
347
  ```
328
348
 
329
349
  @category Object
package/build/index.d.ts CHANGED
@@ -324,6 +324,26 @@ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
324
324
 
325
325
  const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
326
326
  //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
327
+
328
+ // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
329
+
330
+ // Consider the following example:
331
+
332
+ type UserData = {
333
+ [metadata: string]: string;
334
+ email: string;
335
+ name: string;
336
+ role: 'admin' | 'user';
337
+ };
338
+
339
+ // `Omit` clearly doesn't behave as expected in this case:
340
+ type PostPayload = Omit<UserData, 'email'>;
341
+ //=> type PostPayload = { [x: string]: string; [x: number]: string; }
342
+
343
+ // In situations like this, `Except` works better.
344
+ // It simply removes the `email` key while preserving all the other keys.
345
+ type PostPayload = Except<UserData, 'email'>;
346
+ //=> type PostPayload = { [x: string]: string; name: string; role: 'admin' | 'user'; }
327
347
  ```
328
348
 
329
349
  @category Object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk-types",
3
- "version": "1.13.2",
3
+ "version": "1.13.3",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Ronny Ringel",
@@ -28,14 +28,14 @@
28
28
  "*.{js,ts}": "yarn lint"
29
29
  },
30
30
  "dependencies": {
31
- "@wix/monitoring-types": "^0.4.0"
31
+ "@wix/monitoring-types": "^0.5.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "^20.17.14",
34
+ "@types/node": "^20.17.16",
35
35
  "eslint": "^8.57.1",
36
36
  "eslint-config-sdk": "0.0.0",
37
37
  "tsup": "^7.3.0",
38
- "type-fest": "^4.32.0",
38
+ "type-fest": "^4.33.0",
39
39
  "typescript": "^5.7.3"
40
40
  },
41
41
  "eslintConfig": {
@@ -58,5 +58,5 @@
58
58
  "wallaby": {
59
59
  "autoDetect": true
60
60
  },
61
- "falconPackageHash": "064a672bede000fa0e2ae8b96591ca62a3af58270c85f6321951226e"
61
+ "falconPackageHash": "ecd26712dd5524abf019711997e58ed00e009f82b0840ed1379ee76b"
62
62
  }