File tree Expand file tree Collapse file tree 4 files changed +17
-8
lines changed
Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 77
88import { RedactableError } from "./errors" ;
99
10+ // Matches any type that is not an array. This is useful to help avoid
11+ // nested arrays, or for cases like createSingleSelectionCommand to avoid T
12+ // accidentally getting instantiated as DatabaseItem[] instead of DatabaseItem.
13+ export type NotArray =
14+ | string
15+ | bigint
16+ | number
17+ | boolean
18+ | ( object & {
19+ length ?: never ;
20+ } ) ;
21+
1022/**
1123 * This error is used to indicate a runtime failure of an exhaustivity check enforced at compile time.
1224 */
Original file line number Diff line number Diff line change @@ -3,14 +3,10 @@ import type {
33 TreeViewContextMultiSelectionCommandFunction ,
44 TreeViewContextSingleSelectionCommandFunction ,
55} from "../commands" ;
6+ import type { NotArray } from "../helpers-pure" ;
67import type { NotificationLogger } from "../logging" ;
78import { showAndLogErrorMessage } from "../logging" ;
89
9- // A hack to match types that are not an array, which is useful to help avoid
10- // misusing createSingleSelectionCommand, e.g. where T accidentally gets instantiated
11- // as DatabaseItem[] instead of DatabaseItem.
12- type NotArray = object & { length ?: never } ;
13-
1410// A way to get the type system to help assert that one type is a supertype of another.
1511type CreateSupertypeOf < Super , Sub extends Super > = Sub ;
1612
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { getOnDiskWorkspaceFolders } from "../common/vscode/workspace-folders";
88import type { LocalQueries } from "../local-queries" ;
99import { getQuickEvalContext , validateQueryPath } from "../run-queries-shared" ;
1010import type { LaunchConfig } from "./debug-protocol" ;
11+ import type { NotArray } from "../common/helpers-pure" ;
1112import { getErrorMessage } from "../common/helpers-pure" ;
1213import { showAndLogErrorMessage } from "../common/logging" ;
1314import { extLogger } from "../common/logging/vscode" ;
@@ -22,7 +23,7 @@ export interface QLDebugArgs {
2223 extensionPacks ?: string [ ] | string ;
2324 quickEval ?: boolean ;
2425 noDebug ?: boolean ;
25- additionalRunQueryArgs ?: Record < string , any > ;
26+ additionalRunQueryArgs ?: Record < string , unknown > ;
2627}
2728
2829/**
@@ -39,7 +40,7 @@ export type QLDebugConfiguration = DebugConfiguration & QLDebugArgs;
3940export type QLResolvedDebugConfiguration = DebugConfiguration & LaunchConfig ;
4041
4142/** If the specified value is a single element, then turn it into an array containing that element. */
42- function makeArray < T extends Exclude < any , any [ ] > > ( value : T | T [ ] ) : T [ ] {
43+ function makeArray < T extends NotArray > ( value : T | T [ ] ) : T [ ] {
4344 if ( Array . isArray ( value ) ) {
4445 return value ;
4546 } else {
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export interface LaunchConfig {
7171 /** Run the query without debugging it. */
7272 noDebug : boolean ;
7373 /** Undocumented: Additional arguments to be passed to the `runQuery` API on the query server. */
74- additionalRunQueryArgs : Record < string , any > ;
74+ additionalRunQueryArgs : Record < string , unknown > ;
7575}
7676
7777export interface LaunchRequest extends Request , DebugProtocol . LaunchRequest {
You can’t perform that action at this time.
0 commit comments