Skip to content

Commit 36aad9b

Browse files
committed
Move global express args definition
This way tests that import the http utilities but not the routes won't error due to missing types.
1 parent 150513f commit 36aad9b

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/node/http.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,21 @@ import qs from "qs"
55
import safeCompare from "safe-compare"
66
import { HttpCode, HttpError } from "../common/http"
77
import { normalize, Options } from "../common/util"
8-
import { AuthType } from "./cli"
8+
import { AuthType, DefaultedArgs } from "./cli"
99
import { commit, rootPath } from "./constants"
10+
import { Heart } from "./heart"
1011
import { hash } from "./util"
1112

13+
declare global {
14+
// eslint-disable-next-line @typescript-eslint/no-namespace
15+
namespace Express {
16+
export interface Request {
17+
args: DefaultedArgs
18+
heart: Heart
19+
}
20+
}
21+
}
22+
1223
/**
1324
* Replace common variable strings in HTML templates.
1425
*/

src/node/routes/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ import * as _static from "./static"
2626
import * as update from "./update"
2727
import * as vscode from "./vscode"
2828

29-
declare global {
30-
// eslint-disable-next-line @typescript-eslint/no-namespace
31-
namespace Express {
32-
export interface Request {
33-
args: DefaultedArgs
34-
heart: Heart
35-
}
36-
}
37-
}
38-
3929
/**
4030
* Register all routes and middleware.
4131
*/

0 commit comments

Comments
 (0)