-
-
Save ochafik/bd727c3ea02c7409c7a365ec94b082af to your computer and use it in GitHub Desktop.
MCP TS Remove Passthrough Trick
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type RemovePassthrough<T> = T extends object | |
| ? T extends Array<infer U> | |
| ? Array<RemovePassthrough<U>> | |
| : T extends Function | |
| ? T | |
| : { | |
| [K in keyof T as string extends K ? never : K]: K extends "properties" ? T[K] : RemovePassthrough<T[K]>; | |
| } | |
| : T; | |
| export type ProgressToken = RemovePassthrough<Infer<typeof ProgressTokenSchema>>; | |
| export type Cursor = RemovePassthrough<Infer<typeof CursorSchema>>; | |
| export type Request = RemovePassthrough<Infer<typeof RequestSchema>>; | |
| export type RequestMeta = RemovePassthrough<Infer<typeof RequestMetaSchema>>; | |
| export type Notification = RemovePassthrough<Infer<typeof NotificationSchema>>; | |
| export type Result = RemovePassthrough<Infer<typeof ResultSchema>>; | |
| export type RequestId = RemovePassthrough<Infer<typeof RequestIdSchema>>; | |
| export type JSONRPCRequest = RemovePassthrough<Infer<typeof JSONRPCRequestSchema>>; | |
| export type JSONRPCNotification = RemovePassthrough<Infer<typeof JSONRPCNotificationSchema>>; | |
| export type JSONRPCResponse = RemovePassthrough<Infer<typeof JSONRPCResponseSchema>>; | |
| export type JSONRPCError = RemovePassthrough<Infer<typeof JSONRPCErrorSchema>>; | |
| export type JSONRPCMessage = RemovePassthrough<Infer<typeof JSONRPCMessageSchema>>; | |
| export type EmptyResult = RemovePassthrough<Infer<typeof EmptyResultSchema>>; | |
| export type CancelledNotification = RemovePassthrough<Infer<typeof CancelledNotificationSchema>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment