Skip to content

Commit 8735e8f

Browse files
committed
fix: lint issue
1 parent b78fb6b commit 8735e8f

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
"start:dev": "tsx src/main.ts",
6262
"lint": "./node_modules/.bin/eslint .",
6363
"lint:fix": "./node_modules/.bin/eslint . --fix",
64-
"build": "tsc -b src",
65-
"build:watch": "tsc -b src -w",
64+
"build": "tsc",
65+
"build:watch": "tsc -w",
6666
"inspector": "npx @modelcontextprotocol/inspector dist/stdio.js",
6767
"test": "vitest run",
6868
"type-check": "tsc --noEmit",

src/examples/clientSse.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
1313
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
1414
import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';
1515
import dotenv from 'dotenv';
16-
import { EventSource } from 'eventsource';
16+
import { EventSource, EventSourceInit } from 'eventsource';
1717

1818
import { actorNameToToolName } from '../tools/utils.js';
1919

@@ -34,8 +34,19 @@ if (!process.env.APIFY_TOKEN) {
3434
process.exit(1);
3535
}
3636

37+
// Declare EventSource on globalThis if not available (needed for Node.js environment)
38+
declare global {
39+
var EventSource: {
40+
new(url: string, eventSourceInitDict?: EventSourceInit): EventSource;
41+
prototype: EventSource;
42+
CONNECTING: 0;
43+
OPEN: 1;
44+
CLOSED: 2;
45+
}; // eslint-disable-line no-var
46+
}
47+
3748
if (typeof globalThis.EventSource === 'undefined') {
38-
globalThis.EventSource = EventSource as unknown as typeof globalThis.EventSource;
49+
globalThis.EventSource = EventSource;
3950
}
4051

4152
async function main(): Promise<void> {

0 commit comments

Comments
 (0)