typescript-sdk/.changeset/fix-transport-exact-optional-property-types.md
Konstantin Konstantinov 0fb8406d83
v2: codemod iterations, canonical zod schema exports from sdk-shared (#2354)
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
2026-06-25 19:42:44 +01:00

573 B

@modelcontextprotocol/core-internal
patch

Add explicit | undefined to optional properties on the Transport interface and TransportSendOptions (onclose, onerror, onmessage, sessionId, setProtocolVersion, setSupportedProtocolVersions, onresumptiontoken).

This fixes TS2420 errors for consumers using exactOptionalPropertyTypes: true without skipLibCheck, where the emitted .d.ts for implementing classes included | undefined but the interface did not.

Workaround for older SDK versions: enable skipLibCheck: true in your tsconfig.