@battis/typescript-tricks 0.7.1 → 0.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @battis/typescript-tricks
2
2
 
3
+ ## 0.7.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 5e67cc8: OptionalProperty
8
+
9
+ ## 0.7.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 66ec81d: CoerceError without losing stack
14
+
3
15
  ## 0.7.1
4
16
 
5
17
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Coerce = Coerce;
4
- function FailedCoercion(u) {
4
+ function FailedCoercion() {
5
5
  throw new TypeError('Attempted coercion to a non-matching type');
6
6
  }
7
7
  function Coerce(u, isT, toT = (FailedCoercion)) {
@@ -12,5 +12,5 @@ function isError(error) {
12
12
  typeof error.message === 'string');
13
13
  }
14
14
  function CoerceError(error) {
15
- return (0, Coerce_js_1.Coerce)(error, isError, (e) => new Error(String(e)));
15
+ return (0, Coerce_js_1.Coerce)(error, isError, (e) => e);
16
16
  }
@@ -0,0 +1 @@
1
+ export type OptionalProperty<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './Forms';
6
6
  export * from './JSONValue';
7
7
  export * from './MethodNames';
8
8
  export * from './Mixin';
9
+ export * from './OptionalProperty';
9
10
  export * from './PropertyRequirements';
10
11
  export * from './Shorthand';
11
12
  export * from './StaticImplements';
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ __exportStar(require("./Forms"), exports);
22
22
  __exportStar(require("./JSONValue"), exports);
23
23
  __exportStar(require("./MethodNames"), exports);
24
24
  __exportStar(require("./Mixin"), exports);
25
+ __exportStar(require("./OptionalProperty"), exports);
25
26
  __exportStar(require("./PropertyRequirements"), exports);
26
27
  __exportStar(require("./Shorthand"), exports);
27
28
  __exportStar(require("./StaticImplements"), exports);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@battis/typescript-tricks",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "A handful of useful types and operators",
5
- "homepage": "https://github.com/battis/typescript-config/tree/main/packages/tricks#readme",
5
+ "homepage": "https://github.com/battis/typescript-config/tree/main/packages/typescript-tricks#readme",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/battis/typescript-config.git",
9
- "directory": "packages/tricks"
9
+ "directory": "packages/typescript-tricks"
10
10
  },
11
11
  "license": "GPL-3.0",
12
12
  "author": {