@tsonic/tsbindgen 0.7.51 → 0.7.53

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
@@ -10,6 +10,7 @@ tsbindgen generates TypeScript declaration files (`.d.ts`) from .NET assemblies
10
10
  - **Zero TypeScript errors** - Output validates cleanly with `tsc --strict`
11
11
  - **Nullable reference types** - NRT support for output positions (returns, properties, fields)
12
12
  - **CLR primitives** - Numeric type aliases (`int`, `long`, `decimal`, etc.) via `@tsonic/core`
13
+ - **Broad CLR object safety** - `System.Object` projects to TypeScript `unknown`, and value-type constraints project to `NonNullable<unknown>`
13
14
  - **CLR-faithful names** - No casing transforms; member names match the CLR surface
14
15
  - **Generic type preservation** - Full generic type parameter support with constraints
15
16
  - **Unified bindings manifest** - CLR-specific information lives in `<Namespace>/bindings.json` (no metadata sidecars)
@@ -42,12 +43,14 @@ dotnet build src/tsbindgen/tsbindgen.csproj
42
43
  ### Generate BCL declarations
43
44
 
44
45
  ```bash
46
+ DOTNET_RUNTIME=$(dirname "$(dotnet --list-runtimes | awk '/Microsoft.NETCore.App 10\\./ { print $3; exit }')")
47
+
45
48
  # Via npm
46
- npx tsbindgen generate -d ~/.dotnet/shared/Microsoft.NETCore.App/10.0.0 -o ./output
49
+ npx tsbindgen generate -d "$DOTNET_RUNTIME" -o ./output
47
50
 
48
51
  # Via dotnet (from source)
49
52
  dotnet run --project src/tsbindgen/tsbindgen.csproj -- \
50
- generate -d ~/.dotnet/shared/Microsoft.NETCore.App/10.0.0 -o ./output
53
+ generate -d "$DOTNET_RUNTIME" -o ./output
51
54
  ```
52
55
 
53
56
  ### Generate for a custom assembly
@@ -113,6 +116,8 @@ npx tsbindgen generate -a ./MyLibrary.dll -d $DOTNET_RUNTIME -o ./my-lib \
113
116
  Machine-readable dependency resolution for one or more seed assemblies. Useful for:
114
117
  - Debugging missing dependencies before generation
115
118
  - Tooling integrations (e.g. build systems) that need deterministic closure resolution
119
+ - Source builds and tests that should resolve the installed .NET runtime without
120
+ assuming a fixed install directory
116
121
 
117
122
  ```bash
118
123
  # Standard SDK/runtime installs usually work with no extra ref dirs
@@ -124,6 +129,16 @@ npx tsbindgen resolve-closure \
124
129
  --ref-dir ./libs
125
130
  ```
126
131
 
132
+ ## .NET runtime discovery
133
+
134
+ Repo-local test scripts discover the installed `Microsoft.NETCore.App` runtime
135
+ through `dotnet --list-runtimes`. Set `DOTNET_RUNTIME` to override the runtime
136
+ assembly directory explicitly.
137
+
138
+ Surface-manifest validation is tied to the runtime assembly version. If the
139
+ runtime version and baseline manifest do not match, the validator reports that
140
+ version mismatch directly.
141
+
127
142
  ### Examples
128
143
 
129
144
  ```bash
@@ -244,6 +259,12 @@ CLR primitive types map to type aliases from `@tsonic/core`:
244
259
  | `System.Boolean` | `bool` (branded) |
245
260
  | `System.String` | `string` |
246
261
  | `System.Char` | `char` (branded) |
262
+ | `System.Object` | `unknown` |
263
+ | `System.ValueType` constraint | `NonNullable<unknown>` |
264
+
265
+ `unknown` is intentional: it is the TypeScript boundary type for a broad CLR
266
+ object slot. Generated packages do not import a package-specific catch-all value
267
+ type for `System.Object`; callers narrow or adapt broad values explicitly.
247
268
 
248
269
  ### Generic Types
249
270
 
package/lib/tsbindgen.dll CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsonic/tsbindgen",
3
- "version": "0.7.51",
3
+ "version": "0.7.53",
4
4
  "description": "Generate TypeScript declarations from .NET assemblies",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,9 +18,7 @@
18
18
  "README.md"
19
19
  ],
20
20
  "scripts": {
21
- "build": "dotnet publish src/tsbindgen/tsbindgen.csproj -c Release -o lib/",
22
- "prepack": "npm run build",
23
- "prepublishOnly": "npm run build"
21
+ "build": "dotnet publish src/tsbindgen/tsbindgen.csproj -c Release -o lib/"
24
22
  },
25
23
  "keywords": [
26
24
  "tsonic",
package/lib/tsbindgen DELETED
Binary file
package/lib/tsbindgen.pdb DELETED
Binary file