@cqrs-ddd/untyped 0.3.0 → 0.4.1

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 CHANGED
@@ -6,6 +6,8 @@ same value typed as `T & Record<string | symbol, unknown>`: declared properties
6
6
  their types, and every other property reads as `unknown`, so the caller must narrow it.
7
7
  It satisfies Biome's `noExplicitAny` without suppressing the rule.
8
8
 
9
+ **Documentation:** [guide](https://aristoteliss.github.io/nestjs-pipeline/packages/cqrs-ddd/untyped/) · [API reference](https://aristoteliss.github.io/nestjs-pipeline/api/cqrs-ddd/untyped/) · [all packages](https://aristoteliss.github.io/nestjs-pipeline/)
10
+
9
11
  ## Installation
10
12
 
11
13
  ```bash
@@ -16,68 +18,7 @@ pnpm add @cqrs-ddd/untyped
16
18
 
17
19
  Requires Node.js 22.12 or later. No dependencies, no framework.
18
20
 
19
- ## API
20
-
21
- ```typescript
22
- import { untyped } from '@cqrs-ddd/untyped';
23
-
24
- const scope = untyped(wrapper).scope; // unknown: narrow it before use
25
- if (typeof scope === 'number') {
26
- // ...
27
- }
28
- ```
29
-
30
- | Export | Signature | Description |
31
- | --- | --- | --- |
32
- | `untyped` | `<T>(value: T) => T & Record<string \| symbol, unknown>` | The same value, with undeclared properties typed `unknown` |
33
-
34
- It changes only the type; the value is returned as is.
35
-
36
- ## Examples
37
-
38
- Read a symbol-keyed property that a library sets on an object it hands you:
39
-
40
- ```typescript
41
- import { untyped } from '@cqrs-ddd/untyped';
42
-
43
- const TRACE = Symbol.for('app.trace');
44
-
45
- function traceOf(request: object): string | undefined {
46
- const trace = untyped(request)[TRACE];
47
- return typeof trace === 'string' ? trace : undefined;
48
- }
49
- ```
50
-
51
- Declared properties keep their types, so only the undeclared read needs narrowing:
52
-
53
- ```typescript
54
- import { untyped } from '@cqrs-ddd/untyped';
55
-
56
- interface Command {
57
- readonly id: string;
58
- }
59
-
60
- function describe(command: Command): string {
61
- const view = untyped(command);
62
- const source = view.source; // unknown
63
- return typeof source === 'string' ? `${view.id} from ${source}` : view.id; // view.id is string
64
- }
65
- ```
66
-
67
- ## Migrating from @nestjs-pipeline/core 0.1.x
68
-
69
- `untyped` was exported by `@nestjs-pipeline/core` 0.1.x and is no longer exported there
70
- in 0.2.0.
71
-
72
- ```typescript
73
- // Before (0.1.x)
74
- import { untyped } from '@nestjs-pipeline/core';
75
-
76
- // After (0.2.0)
77
- import { untyped } from '@cqrs-ddd/untyped';
78
- ```
79
-
80
- The signature is unchanged. Add `@cqrs-ddd/untyped` to your own `dependencies`.
21
+ Published as an ES module; a CommonJS application loads it with `require()`. Coming from 0.3.x, see [Upgrading from 0.3.x](https://aristoteliss.github.io/nestjs-pipeline/upgrading/from-0-3/).
81
22
 
82
23
  ## License
83
24
 
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { untyped } from './untyped';
1
+ export { untyped } from './untyped.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,3 @@
1
- "use strict";
2
1
  /* Copyright (C) 2026-present Aristotelis — see repository license. */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.untyped = void 0;
5
- var untyped_1 = require("./untyped");
6
- Object.defineProperty(exports, "untyped", { enumerable: true, get: function () { return untyped_1.untyped; } });
2
+ export { untyped } from './untyped.js';
7
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,sEAAsE;;;AAEtE,qCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
package/dist/untyped.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
1
  /* Copyright (C) 2026-present Aristotelis — see repository license. */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.untyped = untyped;
5
2
  /**
6
3
  * Type-safe replacement for `as any` when accessing dynamic or undeclared properties.
7
4
  *
@@ -12,7 +9,7 @@ exports.untyped = untyped;
12
9
  * @example
13
10
  * const scope = untyped(wrapper).scope; // unknown
14
11
  */
15
- function untyped(value) {
12
+ export function untyped(value) {
16
13
  return value;
17
14
  }
18
15
  //# sourceMappingURL=untyped.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"untyped.js","sourceRoot":"","sources":["../src/untyped.ts"],"names":[],"mappings":";AAAA,sEAAsE;;;AAEtE;;;;;;;;;GASG;AACH,iBAA2B,KAAQ;IACjC,OAAO,KAA6C,CAAC;AACvD,CAAC"}
1
+ {"version":3,"file":"untyped.js","sourceRoot":"","sources":["../src/untyped.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAI,KAAQ;IACjC,OAAO,KAA6C,CAAC;AACvD,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@cqrs-ddd/untyped",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "A typed replacement for `as any`: reads undeclared properties as unknown. No dependencies and no framework.",
5
5
  "author": "Aristotelis",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
+ "type": "module",
7
8
  "engines": {
8
9
  "node": ">=22.12.0"
9
10
  },
@@ -22,6 +23,13 @@
22
23
  "unknown",
23
24
  "no-explicit-any"
24
25
  ],
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
25
33
  "main": "dist/index.js",
26
34
  "types": "dist/index.d.ts",
27
35
  "files": [