Skip to content

Commit 7491eb9

Browse files
authored
Merge pull request #11 from seriousme/types-to-devDeps
Types to dev deps
2 parents 6828664 + f4fade7 commit 7491eb9

7 files changed

Lines changed: 27 additions & 21 deletions

File tree

‎client/ConnectionState.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const ConnectionState = {
2+
offline: "offline",
3+
connecting: "connecting",
4+
connected: "connected",
5+
disconnecting: "disconnecting",
6+
disconnected: "disconnected",
7+
} as const;
8+
9+
export type TConnectionState =
10+
(typeof ConnectionState)[keyof typeof ConnectionState];

‎client/context.ts‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,8 @@ import {
1818
} from "./deps.ts";
1919

2020
import { handlePacket } from "./handlers/handlePacket.ts";
21-
22-
export const ConnectionState = {
23-
offline: "offline",
24-
connecting: "connecting",
25-
connected: "connected",
26-
disconnecting: "disconnecting",
27-
disconnected: "disconnected",
28-
} as const;
29-
30-
export type TConnectionState =
31-
typeof ConnectionState[keyof typeof ConnectionState];
21+
import type { TConnectionState } from "./ConnectionState.ts";
22+
import { ConnectionState } from "./ConnectionState.ts";
3223

3324
export class Context {
3425
mqttConn?: MqttConn;

‎client/handlers/handleConnack.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ConnectionState, type Context } from "../context.ts";
1+
import type { Context } from "../context.ts";
2+
import { ConnectionState } from "../ConnectionState.ts";
23
import { AuthenticationResultByNumber, type ConnackPacket } from "../deps.ts";
34

45
export async function handleConnack(packet: ConnackPacket, ctx: Context) {

‎client/handlers/handlePacket.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ConnectionState, type Context } from "../context.ts";
1+
import type { Context } from "../context.ts";
2+
import { ConnectionState } from "../ConnectionState.ts";
23
import { handleConnack } from "./handleConnack.ts";
34
import { handlePublish } from "./handlePublish.ts";
45
import { handlePuback } from "./handlePuback.ts";

‎deno/README.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ deno run -A bin/mqtt.ts
5959

6060
Opifex is also available on [JSR.io](https://jsr.io/@seriousme/opifex).
6161

62-
# Platform Native
63-
This folder also contains code to run the server using Deno
64-
sockets instead of NodeJS sockets. You can modify the import statements in the
65-
demoServer/client to use these instead.
62+
# Platform Native
63+
64+
This folder also contains code to run the server using Deno sockets instead of
65+
NodeJS sockets. You can modify the import statements in the demoServer/client to
66+
use these instead.

‎package-lock.json‎

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"engines": {
3030
"node": ">=22.6.0"
3131
},
32-
"dependencies": {
32+
"devDependencies": {
3333
"@types/node": "^22.8.6"
3434
}
3535
}

0 commit comments

Comments
 (0)