@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 +8 -0
- package/lib/types/assert-never.d.ts +8 -0
- package/lib/types/assert-never.d.ts.map +1 -0
- package/lib/types/brand.d.ts +7 -0
- package/lib/types/brand.d.ts.map +1 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/index.d.ts.map +1 -0
- package/package.json +28 -0
- package/src/assert-never.ts +11 -0
- package/src/brand.ts +4 -0
- package/src/index.ts +6 -0
package/README.md
ADDED
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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