Skip to content

Commit 67c58e9

Browse files
Tidy up some additional type errors
1 parent 4dc843e commit 67c58e9

3 files changed

Lines changed: 24 additions & 11 deletions

File tree

libs/envi/modeler/src/lib/helpers/build-node-json.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,17 @@ export function BuildNodeJSON(
9696
}
9797
base['envitask'] = envitask;
9898

99-
// get display name
100-
const info = registry.getTaskDetail(node.task_name as string);
101-
102-
// set display name of task
103-
if (info.structure.meta.readableName) {
104-
base['display_name'] = info.structure.meta.readableName;
99+
// check if we have a display name
100+
if (registry.hasTask(node.task_name as string)) {
101+
// get display name
102+
const info = registry.getTaskDetail(node.task_name as string);
103+
104+
// set display name of task
105+
if (info.structure.meta.readableName) {
106+
base['display_name'] = info.structure.meta.readableName;
107+
}
105108
}
109+
106110
break;
107111
}
108112

libs/vscode/server/src/lib/helpers/add-additional-search-paths.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import { existsSync } from 'fs';
1515
*/
1616
export function AddAdditionalSearchPaths(
1717
paths: IFolderRecursion,
18-
idlBin: string,
19-
) {
18+
idlBin?: string,
19+
): boolean {
2020
// add in our IDL folder
2121
paths[GetExtensionPath('idl/vscode/notebooks')] = true;
2222

@@ -25,6 +25,11 @@ export function AddAdditionalSearchPaths(
2525
paths[IDL_PACKAGE_DIR] = true;
2626
}
2727

28+
// return if we don't have a folder
29+
if (!idlBin) {
30+
return false;
31+
}
32+
2833
/** Load folders where custom content for ENVI lives */
2934
const enviPaths = LoadENVIPaths(idlBin);
3035

libs/vscode/server/src/lib/helpers/merge-config.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
IDL_PROBLEM_CODE_SHORTHAND_LOOKUP,
55
IDL_PROBLEM_CODES,
66
IDL_REVERSE_PROBLEM_CODE_ALIAS_LOOKUP,
7+
IDLProblemCode,
78
} from '@idl/types/problem-codes';
89
import { DEFAULT_IDL_EXTENSION_CONFIG } from '@idl/vscode/extension-config';
910
import { copy } from 'fast-copy';
@@ -14,10 +15,13 @@ import {
1415
WORKSPACE_FOLDER_CONFIGS,
1516
} from './track-workspace-config';
1617

18+
// type for ignore problem codes
19+
type IgnoreProblemCodes = { [key in IDLProblemCode]?: boolean };
20+
1721
/**
1822
* Track all problem codes that we want to filter out from being reported to the user
1923
*/
20-
export const IGNORE_PROBLEM_CODES: { [key: number]: boolean } = {};
24+
export const IGNORE_PROBLEM_CODES: IgnoreProblemCodes = {};
2125

2226
/**
2327
* Track cases where we exclude problem reporting
@@ -62,7 +66,7 @@ export function MergeConfig() {
6266
// empty problem codes in case we have new ones coming through
6367
const currentCodes = Object.keys(IGNORE_PROBLEM_CODES);
6468
for (let i = 0; i < currentCodes.length; i++) {
65-
delete IGNORE_PROBLEM_CODES[currentCodes[i]];
69+
delete IGNORE_PROBLEM_CODES[+currentCodes[i] as IDLProblemCode];
6670
}
6771

6872
// empty folders
@@ -104,7 +108,7 @@ export function MergeConfig() {
104108
true;
105109
}
106110
} else {
107-
IGNORE_PROBLEM_CODES[code] = true;
111+
IGNORE_PROBLEM_CODES[code as IDLProblemCode] = true;
108112
}
109113
}
110114

0 commit comments

Comments
 (0)