@cqrs-ddd/untyped 0.4.0 → 0.4.2

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.
Files changed (2) hide show
  1. package/README.md +3 -65
  2. package/package.json +2 -2
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,71 +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
- Published as an ES module; a CommonJS application loads it with `require()`. Coming from
20
- 0.3.x, see [Upgrading from 0.3.x](https://github.com/aristoteliss/nestjs-pipeline#upgrading-from-03x).
21
-
22
- ## API
23
-
24
- ```typescript
25
- import { untyped } from '@cqrs-ddd/untyped';
26
-
27
- const scope = untyped(wrapper).scope; // unknown: narrow it before use
28
- if (typeof scope === 'number') {
29
- // ...
30
- }
31
- ```
32
-
33
- | Export | Signature | Description |
34
- | --- | --- | --- |
35
- | `untyped` | `<T>(value: T) => T & Record<string \| symbol, unknown>` | The same value, with undeclared properties typed `unknown` |
36
-
37
- It changes only the type; the value is returned as is.
38
-
39
- ## Examples
40
-
41
- Read a symbol-keyed property that a library sets on an object it hands you:
42
-
43
- ```typescript
44
- import { untyped } from '@cqrs-ddd/untyped';
45
-
46
- const TRACE = Symbol.for('app.trace');
47
-
48
- function traceOf(request: object): string | undefined {
49
- const trace = untyped(request)[TRACE];
50
- return typeof trace === 'string' ? trace : undefined;
51
- }
52
- ```
53
-
54
- Declared properties keep their types, so only the undeclared read needs narrowing:
55
-
56
- ```typescript
57
- import { untyped } from '@cqrs-ddd/untyped';
58
-
59
- interface Command {
60
- readonly id: string;
61
- }
62
-
63
- function describe(command: Command): string {
64
- const view = untyped(command);
65
- const source = view.source; // unknown
66
- return typeof source === 'string' ? `${view.id} from ${source}` : view.id; // view.id is string
67
- }
68
- ```
69
-
70
- ## Migrating from @nestjs-pipeline/core 0.1.x
71
-
72
- `untyped` was exported by `@nestjs-pipeline/core` 0.1.x and is no longer exported there
73
- in 0.2.0.
74
-
75
- ```typescript
76
- // Before (0.1.x)
77
- import { untyped } from '@nestjs-pipeline/core';
78
-
79
- // After (0.2.0)
80
- import { untyped } from '@cqrs-ddd/untyped';
81
- ```
82
-
83
- 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/).
84
22
 
85
23
  ## License
86
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cqrs-ddd/untyped",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
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",
@@ -13,7 +13,7 @@
13
13
  "url": "git+https://github.com/aristoteliss/nestjs-pipeline.git",
14
14
  "directory": "packages/untyped"
15
15
  },
16
- "homepage": "https://github.com/aristoteliss/nestjs-pipeline/tree/master/packages/untyped#readme",
16
+ "homepage": "https://aristoteliss.github.io/nestjs-pipeline/packages/cqrs-ddd/untyped/",
17
17
  "bugs": {
18
18
  "url": "https://github.com/aristoteliss/nestjs-pipeline/issues"
19
19
  },