Skip to content

Commit f4d0329

Browse files
author
Taras Mankovski
committed
Fix type annotations for npm packages in Deno
- Add explicit type imports for node:http (IncomingMessage, ServerResponse) - Add explicit FSWatcher type annotation for chokidar watcher These explicit types ensure consistent type checking across different Deno environments and caching states.
1 parent b1a80ab commit f4d0329

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

fx/request.test.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@ import { beforeEach, describe, it } from "@effectionx/bdd";
22
import { expect } from "@std/expect";
33

44
import { call, ensure, withResolvers } from "effection";
5-
import { createServer } from "node:http";
5+
import {
6+
createServer,
7+
type IncomingMessage,
8+
type ServerResponse,
9+
} from "node:http";
610
import { json, request } from "./request.ts";
711

812
// Ensure to run tests with --allow-net permission
913
describe("request() and json()", () => {
1014
let url: string;
1115
beforeEach(function* () {
12-
let server = createServer((_req, res) => {
13-
res.writeHead(200, { "Content-Type": "application/json" });
14-
res.end(JSON.stringify({ id: 1, title: "do things" }));
15-
});
16+
let server = createServer(
17+
(_req: IncomingMessage, res: ServerResponse) => {
18+
res.writeHead(200, { "Content-Type": "application/json" });
19+
res.end(JSON.stringify({ id: 1, title: "do things" }));
20+
},
21+
);
1622

1723
const ready = withResolvers<void>();
1824
server.listen(0, () => ready.resolve());

watch/watch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { exists } from "@std/fs";
22
import { join, relative } from "@std/path";
3-
import chokidar, { type EmitArgsWithName } from "chokidar";
3+
import chokidar, { type EmitArgsWithName, type FSWatcher } from "chokidar";
44
import {
55
call,
66
createChannel,
@@ -105,7 +105,7 @@ export function watch(options: WatchOptions): Stream<Start, never> {
105105

106106
let gitignored = yield* findIgnores(options.path);
107107

108-
let watcher = chokidar.watch(options.path, {
108+
let watcher: FSWatcher = chokidar.watch(options.path, {
109109
ignored: (path) => {
110110
let relpath = relative(options.path, path);
111111
let isGit = relpath === ".git" || relpath.startsWith(".git");

0 commit comments

Comments
 (0)