Skip to content

tsoniclang/aspnetcore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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/core

The 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 restore

This 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.json

bindings.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/aspnetcore@10.x

Development

Regenerate from sibling checkouts:

npm install
./__build/scripts/generate.sh

The 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.sh

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages