@tsonic/dotnet-pure
Version:
TypeScript type definitions for .NET 10 BCL (Base Class Library) - CLR naming
95 lines (72 loc) • 4.22 kB
TypeScript
// Generated by tsbindgen - Architecture
// Namespace: System.Net.ServerSentEvents
// Assembly: System.Net.ServerSentEvents
// Branded primitive types are sourced from @tsonic/types
import type { sbyte, byte, short, ushort, int, uint, long, ulong, int128, uint128, half, float, double, decimal, nint, nuint, char } from '@tsonic/types';
// Import types from other namespaces
import type { IBufferWriter_1 } from "../../System.Buffers/internal/index.js";
import type { IAsyncEnumerable_1, IEnumerable_1 } from "../../System.Collections.Generic/internal/index.js";
import type { Stream } from "../../System.IO/internal/index.js";
import type { MethodInfo } from "../../System.Reflection/internal/index.js";
import * as System_Runtime_Serialization_Internal from "../../System.Runtime.Serialization/internal/index.js";
import type { ISerializable, SerializationInfo, StreamingContext } from "../../System.Runtime.Serialization/internal/index.js";
import type { Task } from "../../System.Threading.Tasks/internal/index.js";
import type { CancellationToken } from "../../System.Threading/internal/index.js";
import * as System_Internal from "../../System/internal/index.js";
import type { Action_2, AsyncCallback, Boolean as ClrBoolean, Byte, Delegate, IAsyncResult, ICloneable, Int32, IntPtr, MulticastDelegate, Nullable_1, Object as ClrObject, ReadOnlySpan_1, String as ClrString, TimeSpan, Type, ValueType, Void } from "../../System/internal/index.js";
// CLROf<T> - Maps ergonomic primitives to their CLR types for generic constraints
// This utility is used ONLY in generic type arguments to satisfy CLR interface constraints
// Value positions (parameters, return types) use lowercase primitives for ergonomics
export type CLROf<T> =
T extends sbyte ? System_Internal.SByte :
T extends short ? System_Internal.Int16 :
T extends int ? System_Internal.Int32 :
T extends long ? System_Internal.Int64 :
T extends int128 ? System_Internal.Int128 :
T extends nint ? System_Internal.IntPtr :
T extends byte ? System_Internal.Byte :
T extends ushort ? System_Internal.UInt16 :
T extends uint ? System_Internal.UInt32 :
T extends ulong ? System_Internal.UInt64 :
T extends uint128 ? System_Internal.UInt128 :
T extends nuint ? System_Internal.UIntPtr :
T extends half ? System_Internal.Half :
T extends float ? System_Internal.Single :
T extends double ? System_Internal.Double :
T extends decimal ? System_Internal.Decimal :
T extends char ? System_Internal.Char :
T extends boolean ? System_Internal.Boolean :
T extends string ? System_Internal.String :
T; // Identity fallback for non-primitive types
export type SseItemParser_1<T> = (eventType: string, data: ReadOnlySpan_1<CLROf<byte>>) => T;
export interface SseItem_1$instance<T> {
readonly Data: T;
EventId: string;
readonly EventType: string;
ReconnectionInterval: Nullable_1<TimeSpan>;
}
export const SseItem_1: {
new<T>(data: T, eventType: string): SseItem_1$instance<T>;
};
export type SseItem_1<T> = SseItem_1$instance<T>;
export interface SseParser_1$instance<T> {
readonly LastEventId: string;
readonly ReconnectionInterval: TimeSpan;
Enumerate(): IEnumerable_1<SseItem_1<T>>;
EnumerateAsync(cancellationToken?: CancellationToken): IAsyncEnumerable_1<SseItem_1<T>>;
}
export const SseParser_1: {
new<T>(): SseParser_1$instance<T>;
};
export type SseParser_1<T> = SseParser_1$instance<T>;
export abstract class SseFormatter$instance {
static WriteAsync<T>(source: IAsyncEnumerable_1<SseItem_1<T>>, destination: Stream, itemFormatter: Action_2<SseItem_1<T>, IBufferWriter_1<CLROf<byte>>>, cancellationToken?: CancellationToken): Task;
static WriteAsync(source: IAsyncEnumerable_1<SseItem_1<CLROf<string>>>, destination: Stream, cancellationToken?: CancellationToken): Task;
}
export type SseFormatter = SseFormatter$instance;
export abstract class SseParser$instance {
static readonly EventTypeDefault: string;
static Create<T>(sseStream: Stream, itemParser: SseItemParser_1<T>): SseParser_1<T>;
static Create(sseStream: Stream): SseParser_1<CLROf<string>>;
}
export type SseParser = SseParser$instance;