Skip to content

Commit f02ab3b

Browse files
MickLdarrachequesne
authored andcommitted
fix(typings): fix the type of the "query" option (#1439)
Having type `Object` it was not possible to set values, e.g.: ```ts if (!this.socket.io.opts.query) { this.socket.io.opts.query = {}; } this.socket.io.opts.query.token = 'abc123'; ``` Results in error: > Element implicitly has an 'any' type because expression of type '"token"' can't be used to index type 'Object'.
1 parent be81a2c commit f02ab3b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function lookup(
6767
io = cache[id];
6868
}
6969
if (parsed.query && !opts.query) {
70-
opts.query = parsed.query;
70+
opts.query = parsed.queryKey;
7171
}
7272
return io.socket(parsed.path, opts);
7373
}

lib/manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface EngineOptions {
3232
/**
3333
* Any query parameters in our uri. Set from the URI passed when connecting
3434
*/
35-
query: Object;
35+
query: { [key: string]: string };
3636

3737
/**
3838
* `http.Agent` to use, defaults to `false` (NodeJS only)

lib/url.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type ParsedUrl = {
1818
query: string;
1919
anchor: string;
2020
pathNames: Array<string>;
21-
queryKey: Record<string, string>;
21+
queryKey: { [key: string]: string };
2222

2323
// Custom properties (not native to parseuri):
2424
id: string;

0 commit comments

Comments
 (0)