Skip to content

tsc fails with TS2416 #582

Closed
Closed
@DanDubinsky

Description

@DanDubinsky

Describe the bug
After installing @modelcontextprotocol/sdk I can't run a typescript build anymore

To Reproduce
Steps to reproduce the behavior:

  1. add the @modelcontextprotocol/sdk with yarn or npm and import it into a typescript file
  2. run npx tsc --build && npx tsc-alias
  3. Get a build error

Expected behavior
It should build properly

Logs
Here is the detailed error

../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts:59:15 - error TS2416: Property 'assertNotificationCapability' in type 'Server<RequestT, NotificationT, ResultT>' is not assignable to the same property in base type 'Protocol<ServerRequest | RequestT, ServerNotification | NotificationT, ServerResult | ResultT>'.
Type '(method: (import("/Users/dan/dev/backend-v3/node_modules/@modelcontextprotocol/sdk/dist/esm/types").ServerNotification | NotificationT)["method"]) => void' is not assignable to type '(method: (import("/Users/dan/dev/backend-v3/node_modules/@modelcontextprotocol/sdk/dist/esm/types").ServerNotification | NotificationT)["method"]) => void'. Two different types with this name exist, but they are unrelated.
Types of parameters 'method' and 'method' are incompatible.
Type '"notifications/cancelled" | "notifications/progress" | "notifications/resources/list_changed" | "notifications/resources/updated" | "notifications/prompts/list_changed" | "notifications/tools/list_changed" | "notifications/message" | NotificationT["method"]' is not assignable to type 'never'.
Type 'string' is not assignable to type 'never'.

59 protected assertNotificationCapability(method: (ServerNotification | NotificationT)["method"]): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions