@tsonic/aspnetcore
v10.0.45
Published
TypeScript type definitions for Microsoft.AspNetCore.App shared framework for .NET 10
Maintainers
Readme
@tsonic/aspnetcore
TypeScript declarations and CLR binding metadata for Microsoft.AspNetCore.App on .NET 10.
@tsonic/aspnetcore is a generated binding package. It exposes ASP.NET Core
namespace modules to Tsonic while the compiled program references the real
ASP.NET Core shared framework.
Install
npm install @tsonic/aspnetcore @tsonic/dotnet @tsonic/coreThe package peers against the matching .NET-major @tsonic/dotnet,
@tsonic/core, and @tsonic/microsoft-extensions packages.
Use with Tsonic
Add the framework reference and bind it to this type package:
tsonic add framework Microsoft.AspNetCore.App @tsonic/aspnetcore
tsonic restoreThis records the shared-framework reference in tsonic.workspace.json and
uses the published binding package for TypeScript and compiler metadata.
Imports
Import ASP.NET Core namespaces through explicit ESM subpaths:
import { WebApplication } from "@tsonic/aspnetcore/Microsoft.AspNetCore.Builder.js";
import { HttpContext } from "@tsonic/aspnetcore/Microsoft.AspNetCore.Http.js";Minimal API example
import { WebApplication } from "@tsonic/aspnetcore/Microsoft.AspNetCore.Builder.js";
import type { ExtensionMethods } from "@tsonic/aspnetcore/Microsoft.AspNetCore.Builder.js";
export function main(): void {
const builder = WebApplication.CreateBuilder();
const app = builder.Build() as ExtensionMethods<WebApplication>;
app.MapGet("/", () => "hello");
app.Run("http://localhost:8080");
}Package shape
The package contains generated namespace facades, ESM stubs, and bindings.json
files:
@tsonic/aspnetcore/
Microsoft.AspNetCore.Builder.d.ts
Microsoft.AspNetCore.Builder.js
Microsoft.AspNetCore.Builder/
bindings.json
internal/index.d.ts
__internal/extensions/index.d.ts
families.jsonbindings.json is compiler metadata, not user-authored configuration. It
preserves CLR identity, overload families, receiver style, extension methods,
generic constraints, and nullable semantics for Tsonic.
Broad CLR values
Generated CLR object slots are represented with TypeScript unknown, not a
package-specific catch-all value. This keeps ASP.NET Core APIs faithful to CLR
metadata while forcing user code to narrow broad values explicitly before it
uses them. Value-type constraints are represented with NonNullable<unknown>.
Versioning
This repo is versioned by .NET major:
- .NET 10 → npm:
@tsonic/[email protected]
Development
Regenerate from sibling checkouts:
npm install
./__build/scripts/generate.shThe generation script requires:
- .NET 10 SDK/runtime
../tsbindgen../dotnet../microsoft-extensions
For a system .NET install, set DOTNET_HOME and DOTNET_VERSION:
DOTNET_HOME=/usr/lib/dotnet DOTNET_VERSION=<installed-10-runtime-version> ./__build/scripts/generate.shLicense
MIT
