Skip to content

Commit c36883d

Browse files
refactor: use "import type" syntax
For some reason, "import { type A }" does not work in some cases: > node_modules/engine.io-client/build/esm/socket.d.ts:2:15 - error TS1005: ',' expected. > 2 import { type Packet, type BinaryType, RawData } from "engine.io-parser"; References: https://www.typescriptlang.org/docs/handbook/modules.html#importing-types
1 parent e2b39b6 commit c36883d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/socket.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ import { decode } from "./contrib/parseqs.js";
44
import { parse } from "./contrib/parseuri.js";
55
import debugModule from "debug"; // debug()
66
import { Emitter } from "@socket.io/component-emitter";
7-
import {
8-
protocol,
9-
type Packet,
10-
type BinaryType,
11-
type PacketType,
12-
RawData,
13-
} from "engine.io-parser";
7+
import { protocol } from "engine.io-parser";
8+
import type { Packet, BinaryType, PacketType, RawData } from "engine.io-parser";
149
import { CloseDetails, Transport } from "./transport.js";
1510

1611
const debug = debugModule("engine.io-client:socket"); // debug()

lib/transport.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { decodePacket, type Packet, type RawData } from "engine.io-parser";
1+
import { decodePacket } from "engine.io-parser";
2+
import type { Packet, RawData } from "engine.io-parser";
23
import { Emitter } from "@socket.io/component-emitter";
34
import { installTimerFunctions } from "./util.js";
45
import debugModule from "debug"; // debug()

0 commit comments

Comments
 (0)