Overview
Enable TypeScript strict: true in tsconfig.json and resolve all resulting type errors across the codebase to enforce full type safety.
Background
The repository coding guidelines require TypeScript strict mode and prohibit any types. Currently, tsconfig.json sets "noImplicitAny": false and "strictBindCallApply": false, leaving several strict checks disabled. Enabling strict: true was deferred from PR #359 (dependency update / TypeScript 6.0 migration) as it is out of scope for that change.
Proposed Changes
"compilerOptions": {
+ "strict": true,
- "strictNullChecks": true,
- "noImplicitAny": false,
- "strictBindCallApply": false,
}
- Add
"strict": true to tsconfig.json (this supersedes the individual flags above).
- Fix all TypeScript errors surfaced by enabling strict mode across
src/**/*.ts and tests/**/*.ts.
Known hotspot: as any casts in ConnectionManager.test.ts (ex-#367)
tests/unit/services/ConnectionManager.test.ts contains approximately 40 occurrences of as any casts used to access private members of ConnectionManager (e.g., (manager as any).instanceInfo, (manager as any).schemaInfo, spying on doIntrospection, etc.).
Proposed solution for test as any
Define a small test-only interface (TestableConnectionManager) that declares the private fields and methods accessed in tests, then cast via unknown:
type TestableConnectionManager = {
doIntrospection: (instanceUrl: string) => Promise<void>;
instanceInfo: { version: string; tier: string } | null;
schemaInfo: { workItemWidgetTypes: unknown[] } | null;
introspectedInstanceUrl: string | null;
introspectionPromises: Map<string, Promise<void>>;
tokenScopeInfo: unknown;
client: unknown;
versionDetector: unknown;
schemaIntrospector: unknown;
isInitialized: boolean;
};
const managerInternal = manager as unknown as TestableConnectionManager;
Replace all (manager as any).* accesses with managerInternal.* and update spy targets accordingly.
Affected lines in ConnectionManager.test.ts
Known occurrences include lines 28, 121, 144, 171, 198, 225, 263–268, 279–284, 291, 301–303, 322–327, 330, 336–338, 344, 351–356, 359, 365, 380–382 (and others throughout the file).
References
/cc @polaz
Overview
Enable TypeScript
strict: trueintsconfig.jsonand resolve all resulting type errors across the codebase to enforce full type safety.Background
The repository coding guidelines require TypeScript strict mode and prohibit
anytypes. Currently,tsconfig.jsonsets"noImplicitAny": falseand"strictBindCallApply": false, leaving several strict checks disabled. Enablingstrict: truewas deferred from PR #359 (dependency update / TypeScript 6.0 migration) as it is out of scope for that change.Proposed Changes
"compilerOptions": { + "strict": true, - "strictNullChecks": true, - "noImplicitAny": false, - "strictBindCallApply": false, }"strict": truetotsconfig.json(this supersedes the individual flags above).src/**/*.tsandtests/**/*.ts.Known hotspot:
as anycasts in ConnectionManager.test.ts (ex-#367)tests/unit/services/ConnectionManager.test.tscontains approximately 40 occurrences ofas anycasts used to access private members ofConnectionManager(e.g.,(manager as any).instanceInfo,(manager as any).schemaInfo, spying ondoIntrospection, etc.).Proposed solution for test
as anyDefine a small test-only interface (
TestableConnectionManager) that declares the private fields and methods accessed in tests, then cast viaunknown:Replace all
(manager as any).*accesses withmanagerInternal.*and update spy targets accordingly.Affected lines in ConnectionManager.test.ts
Known occurrences include lines 28, 121, 144, 171, 198, 225, 263–268, 279–284, 291, 301–303, 322–327, 330, 336–338, 344, 351–356, 359, 365, 380–382 (and others throughout the file).
References
as anycasts in ConnectionManager.test.ts #367 (merged into this issue)/cc @polaz