@jakubmazanec/ts-utils 3.0.18 → 3.0.19-unstable.975f0f32

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.
@@ -2,6 +2,7 @@
2
2
  * A subclass of `Error` that indicates an assertion failure.
3
3
  */
4
4
  export declare class AssertionError extends Error {
5
+ name: string;
5
6
  /**
6
7
  * @param message Message added to the default error message
7
8
  */
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  export class AssertionError extends Error {
3
+ name = "AssertionError";
3
4
  /**
4
5
  * @param message Message added to the default error message
5
6
  */
6
7
  constructor(message) {
7
8
  super(`Wrong assertion encountered${message ? `: "${message}"` : ""}!`);
8
- this.name = "AssertionError";
9
9
  }
10
10
  }
11
11
  export function assert(condition, errorMessage) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../source/utils/assert.ts"],
4
- "sourcesContent": ["/**\n * A subclass of `Error` that indicates an assertion failure.\n */\nexport class AssertionError extends Error {\n /**\n * @param message Message added to the default error message\n */\n constructor(message?: string) {\n super(`Wrong assertion encountered${message ? `: \"${message}\"` : ''}!`);\n\n this.name = 'AssertionError';\n }\n}\n\n/**\n * A function that throws {@link AssertionError} (with optional message defined with `errorMessage`) if\n * `condition` is falsy.\n * You can use it to narrow types:\n *\n * ```TypeScript\n * interface Foo {\n * kind: 'Foo';\n * }\n *\n * interface Bar {\n * kind: 'Bar';\n * }\n *\n * declare const foobar: Foo | Bar;\n *\n * assert(is<Foo>(foobar, foobar.kind === 'Foo'));\n *\n * // `typeof foobar` is now `Foo`\n * ```\n *\n * @param condition Condition we're asserting isn't falsy\n * @param errorMessage Message for the `AssertionError`\n */\nexport function assert(condition: unknown, errorMessage?: string): asserts condition {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions -- we don't mind here\n if (!condition) {\n throw new AssertionError(errorMessage);\n }\n}\n"],
5
- "mappings": ";AAGO,aAAM,uBAAuB,MAAM;AAAA;AAAA;AAAA;AAAA,EAIxC,YAAY,SAAkB;AAC5B,UAAM,8BAA8B,UAAU,MAAM,OAAO,MAAM,EAAE,GAAG;AAEtE,SAAK,OAAO;AAAA,EACd;AACF;AA0BO,gBAAS,OAAO,WAAoB,cAA0C;AAEnF,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,eAAe,YAAY;AAAA,EACvC;AACF;",
4
+ "sourcesContent": ["/**\n * A subclass of `Error` that indicates an assertion failure.\n */\nexport class AssertionError extends Error {\n override name = 'AssertionError';\n\n /**\n * @param message Message added to the default error message\n */\n constructor(message?: string) {\n super(`Wrong assertion encountered${message ? `: \"${message}\"` : ''}!`);\n }\n}\n\n/**\n * A function that throws {@link AssertionError} (with optional message defined with `errorMessage`) if\n * `condition` is falsy.\n * You can use it to narrow types:\n *\n * ```TypeScript\n * interface Foo {\n * kind: 'Foo';\n * }\n *\n * interface Bar {\n * kind: 'Bar';\n * }\n *\n * declare const foobar: Foo | Bar;\n *\n * assert(is<Foo>(foobar, foobar.kind === 'Foo'));\n *\n * // `typeof foobar` is now `Foo`\n * ```\n *\n * @param condition Condition we're asserting isn't falsy\n * @param errorMessage Message for the `AssertionError`\n */\nexport function assert(condition: unknown, errorMessage?: string): asserts condition {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions -- we don't mind here\n if (!condition) {\n throw new AssertionError(errorMessage);\n }\n}\n"],
5
+ "mappings": ";AAGO,aAAM,uBAAuB,MAAM;AAAA,EAC/B,OAAO;AAAA;AAAA;AAAA;AAAA,EAKhB,YAAY,SAAkB;AAC5B,UAAM,8BAA8B,UAAU,MAAM,OAAO,MAAM,EAAE,GAAG;AAAA,EACxE;AACF;AA0BO,gBAAS,OAAO,WAAoB,cAA0C;AAEnF,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,eAAe,YAAY;AAAA,EACvC;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jakubmazanec/ts-utils",
3
- "version": "3.0.18",
3
+ "version": "3.0.19-unstable.975f0f32",
4
4
  "description": "Collection of TypeScript types and utilities.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,14 +27,14 @@
27
27
  "typecheck": "tsc --project tsconfig.typecheck.json"
28
28
  },
29
29
  "devDependencies": {
30
- "@jakubmazanec/eslint-config": "^4.1.0",
30
+ "@jakubmazanec/eslint-config": "5.0.0-unstable.975f0f32",
31
31
  "@types/lodash": "^4.17.21",
32
32
  "@types/node": "^24.0.4",
33
33
  "@vitest/coverage-v8": "^4.0.14",
34
34
  "concurrently": "^9.2.1",
35
35
  "del-cli": "^7.0.0",
36
36
  "esbuild": "^0.27.0",
37
- "eslint": "^9.33.0",
37
+ "eslint": "^9.39.4",
38
38
  "lodash": "^4.17.21",
39
39
  "prettier": "^3.7.3",
40
40
  "prettier-plugin-packagejson": "^2.5.20",
@@ -2,13 +2,13 @@
2
2
  * A subclass of `Error` that indicates an assertion failure.
3
3
  */
4
4
  export class AssertionError extends Error {
5
+ override name = 'AssertionError';
6
+
5
7
  /**
6
8
  * @param message Message added to the default error message
7
9
  */
8
10
  constructor(message?: string) {
9
11
  super(`Wrong assertion encountered${message ? `: "${message}"` : ''}!`);
10
-
11
- this.name = 'AssertionError';
12
12
  }
13
13
  }
14
14