Fix TypeScript compilation errors in common.ts#14551
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR resolves TypeScript strict compilation errors by fixing the import shape for the CommonJS which module and adding missing parameter type annotations so the project builds cleanly under noImplicitAny.
Changes:
- Switch
whichimport inExtension/src/common.tsto animport = require()form so it’s callable under the project’s TS module settings. - Add explicit types to callback/filter parameters to eliminate implicit-
anyerrors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Extension/src/common.ts | Fixes which import/call typing and annotates callback parameters to satisfy strict compilation. |
| Extension/.scripts/common.ts | Annotates a filter callback parameter to avoid implicit-any under strict settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Colengms
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix by Copilot with Claude Opus 4.8 in VS Code.
Summary
Fixes four TypeScript errors across two files that were breaking the build:
three in
src/common.tsand one in.scripts/common.ts. All were caused bymissing type information — an uncallable namespace import and several
implicitly-
anyparameters that violate the project'sstrictsettings.Errors fixed
1.
src/common.ts—whichis not callable (TS2349)whichAsyncinvoked thewhichmodule directly:which(name, ...). The modulewas imported with a namespace import:
@types/whichv2 declares the module usingexport = which, wherewhichis acallable function (CommonJS-style export). Under the current TypeScript rules, a
namespace-style import (
import * as) of anexport =value cannot be called orconstructed, because doing so would fail at runtime when
esModuleInteropis off(this project does not enable it). TypeScript surfaces this as "Type 'typeof
which' has no call signatures."
Fix: use an import-require binding, which maps directly onto the CommonJS
export =shape and is callable:2 & 3.
src/common.ts— implicitanycallback parameters (TS7006)The
whichcallback parameters had no annotations. Once the import was fixed sothe call resolves to a typed overload, the parameters were annotated to match the
@types/whichasync-first overload:4.
.scripts/common.ts— implicitanyfilter parameter (TS7006)The
unhandledRejectionhandler split a stack trace and filtered the lines, butthe filter callback parameter was untyped. Since
String.prototype.splitreturnsstring[], the parameter is annotated asstring:Why these surfaced
All four are
strict/noImplicitAnyviolations. The namespace-import issue isa correctness fix (the previous form would have thrown at runtime if it had
compiled); the rest are purely type annotations that restore proper inference
without changing any runtime behavior.
Testing
tscno longer reports errors in either file (verified — 0 errors).yarn run lintpasses.whichcall site is functionally identical,and the added annotations only describe existing values.