@mohou/values 1.0.20

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/README.md ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ status: locked
3
+ updated: 2026-09-16
4
+ ---
5
+
6
+ Role: `values`.
7
+
8
+ `assertNever` marks an unreachable closed-union branch.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Mark an unreachable closed-union branch.
3
+ * @param value - impossible value; an unhandled typed variant fails at the call site.
4
+ * @param context - optional switch-site label included in the failure message.
5
+ * @returns never; a runtime value that escaped its type always throws.
6
+ */
7
+ export declare function assertNever(value: never, context?: string): never;
8
+ //# sourceMappingURL=assert-never.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-never.d.ts","sourceRoot":"","sources":["../../src/assert-never.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAIjE"}
@@ -0,0 +1,7 @@
1
+ declare const brand: unique symbol;
2
+ /** A string admitted at one boundary and not re-parsed by the callee. */
3
+ export type Branded<B extends string> = string & {
4
+ readonly [brand]: B;
5
+ };
6
+ export {};
7
+ //# sourceMappingURL=brand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../src/brand.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,EAAE,OAAO,MAAM,CAAA;AAElC,yEAAyE;AACzE,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA"}
@@ -0,0 +1,5 @@
1
+ /** Closed-union helpers. @module @mohou/values */
2
+ export declare const packageId: "@mohou/values";
3
+ export { assertNever } from './assert-never.ts';
4
+ export type { Branded } from './brand.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD,eAAO,MAAM,SAAS,EAAG,eAAwB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@mohou/values",
3
+ "version": "1.0.20",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": "^22.19.0 || >=24.0.0"
8
+ },
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "files": [
13
+ "src",
14
+ "lib/types",
15
+ "README.md",
16
+ "!**/*.tsbuildinfo"
17
+ ],
18
+ "main": "./src/index.ts",
19
+ "types": "./lib/types/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./lib/types/index.d.ts",
23
+ "default": "./src/index.ts"
24
+ },
25
+ "./src/*": "./src/*",
26
+ "./package.json": "./package.json"
27
+ }
28
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Mark an unreachable closed-union branch.
3
+ * @param value - impossible value; an unhandled typed variant fails at the call site.
4
+ * @param context - optional switch-site label included in the failure message.
5
+ * @returns never; a runtime value that escaped its type always throws.
6
+ */
7
+ export function assertNever(value: never, context?: string): never {
8
+ const rendered = JSON.stringify(value)
9
+ const label = context === undefined ? '' : ` in ${context}`
10
+ throw new Error(`unreachable variant${label}: ${rendered}`)
11
+ }
package/src/brand.ts ADDED
@@ -0,0 +1,4 @@
1
+ declare const brand: unique symbol
2
+
3
+ /** A string admitted at one boundary and not re-parsed by the callee. */
4
+ export type Branded<B extends string> = string & { readonly [brand]: B }
package/src/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ /** Closed-union helpers. @module @mohou/values */
2
+
3
+ export const packageId = '@mohou/values' as const
4
+
5
+ export { assertNever } from './assert-never.ts'
6
+ export type { Branded } from './brand.ts'