You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* style: auto formatting
* build: version bump typescript v7.
* build: add `types` to tsconfig to explicitly include type modules.
From Node v6, you have to explicitly include type modules, otherwise they will not be added globally to the project like `process` for Node, and module imports will error like `Cannot find name 'node:fs'`.
- Added `types` array to tsconfig and included the `node` and `vscode` modules to fix import and usage errors.
Ref: http://typescriptlang.org/tsconfig/#types
* build: change TypeScript compiler to use `es2025` spec and types.
* fix: ts 7.0 type errors.
Fixed TS 7.0 errors by ensuring:
- Variables don't have `undefined` or `null` values before accessing them and providing fallback values if they are undefined with the null coalescing operator (??) and conditional ternary operator (? .. : .. ).
- Values from methods are satisfying their expected return types using the `as` keyword and generic typed method calls.
- Object keys aren't accessed if the object itself is `undefined` with the optional chaining operator (?.) and proper undefined type guards and conditionals.
- `reconstructRegex` util function infers the correct type from the passed `obj` param.
- Error stack logging has a fallback of the error message in case the stack is null/undefined.
- `convertMapToReversedObject` util function has properly typed `result` instead of implicit `any` type and changed the reverse object mapping to mutate the existing array instead of rebuilding a new one on every iteration.
* fix: ts null error for `packageJsonData`.
- Changed type of `packageJsonData` property to allow it to be `null`.
- Moved the null check from the `constructor` to the `setExtensionData` method, and use the check to narrow the type and assert that it's not null/falsy, and return early if it is. Using a local variable instead of accessing the property directly ensures TS doesn't keep spitting out null possibility errors.
* fix: ts error `outputChannel` property has no initializer in a constructor.
- Fixed the TS error "Property 'outputChannel' has no initializer and is not definitely assigned in the constructor." in Logger by adding a `constructor` and initialise the output channel inside it.
* remove: the redundant `setupOutputChannel` method in Logger.
- Removed the now redundant `setupOutputChannel` Logger method and it's references, this is because the output channel is now setup in the `constructor` so we have no need for this method now.
- Removed the redundant `outputChannel` property null check in `showChannel` method since it's never null as it's initialised in `constructor`.
* fix: make `edit` param required in `CommandRegistration` interface.
- Reverted the `edit` param in the `handleSingleLineBlock` Configuration method back to be required instead of optional because it otherwise insinuates the method can work without the `edit` param which is not true. It must have the param set to work. Also removed the optional chaining operator on the `edit.insert` call. The TS error that the optional operators fixed will return:
"Type '(textEditor: TextEditor, edit: TextEditorEdit) => void' is not assignable to type '(textEditor: TextEditor, edit?: TextEditorEdit | undefined) => void'.
Types of parameters 'edit' and 'edit' are incompatible.
Type 'TextEditorEdit | undefined' is not assignable to type 'TextEditorEdit'.
Type 'undefined' is not assignable to type 'TextEditorEdit'."
- Fixed the returning TS error above by making the `edit` param required instead of optional in the `handler` function in `CommandRegistration` interface, which the `handleSingleLineBlock` method has to satisfy.
* fix: handling of missing error messages in `validateDevEnvVariables`.
If an error code was caught but isn't listed in the messages map, then the `errorMsg` in `validateDevEnvVariables` utils function would return something like "ENOTDIR: undefined: ...".
- Fixed by adding a fallback to the `UKNOWN` entry when an error code is not mapped.
0 commit comments