mirror of
https://github.com/penpot/penpot-mcp.git
synced 2026-04-25 11:18:37 +00:00
Fix type parameter issue
This commit is contained in:
parent
93e98f5e08
commit
ee1ee5317e
@ -1,6 +1,6 @@
|
||||
import {WebSocket, WebSocketServer} from "ws";
|
||||
import {PluginTask} from "./PluginTask";
|
||||
import {PluginTaskResponse} from "@penpot-mcp/common";
|
||||
import {PluginTaskResponse, PluginTaskResult} from "@penpot-mcp/common";
|
||||
|
||||
/**
|
||||
* Provides the connection to the Penpot MCP Plugin via WebSocket
|
||||
@ -97,7 +97,7 @@ export class PluginBridge {
|
||||
* @param task - The plugin task to execute
|
||||
* @throws Error if no plugin instances are connected or available
|
||||
*/
|
||||
public async executePluginTask<TResult>(task: PluginTask<any, TResult>): Promise<TResult> {
|
||||
public async executePluginTask<TResult extends PluginTaskResult<any>>(task: PluginTask<any, TResult>): Promise<TResult> {
|
||||
// Check if there are connected clients
|
||||
if (this.connectedClients.size === 0) {
|
||||
throw new Error(
|
||||
|
||||
@ -18,7 +18,7 @@ import { randomUUID } from "crypto";
|
||||
* @template TParams - The strongly-typed parameters for this task
|
||||
* @template TResult - The expected result type from task execution
|
||||
*/
|
||||
export abstract class PluginTask<TParams = any, TResult extends PluginTaskResult = PluginTaskResult> {
|
||||
export abstract class PluginTask<TParams = any, TResult extends PluginTaskResult<any> = PluginTaskResult<any>> {
|
||||
/**
|
||||
* Unique identifier for request/response correlation.
|
||||
*/
|
||||
|
||||
@ -7,7 +7,7 @@ import { PrintTextTaskParams, PluginTaskResult } from "@penpot-mcp/common";
|
||||
* This task instructs the plugin to create a text element
|
||||
* at the viewport center and select it.
|
||||
*/
|
||||
export class PrintTextPluginTask extends PluginTask<PrintTextTaskParams, PluginTaskResult> {
|
||||
export class PrintTextPluginTask extends PluginTask<PrintTextTaskParams, PluginTaskResult<any>> {
|
||||
/**
|
||||
* Creates a new print text task.
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user