From harness-claude
Enables strict TypeScript mode in tsconfig.json including strictNullChecks and exactOptionalPropertyTypes, with fixes for errors like noImplicitAny and strictPropertyInitialization. For new projects, migrations, or type debugging.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Enable and satisfy strict TypeScript checks including strictNullChecks and exactOptionalPropertyTypes
Provides 2025 TypeScript strict mode tsconfig.json recommendations, explains strict flags like noUncheckedIndexedAccess, moduleResolution (Bundler vs NodeNext), verbatimModuleSyntax. Use for new projects or stricter type safety migrations.
Provides TypeScript strict mode expertise for type safety using generics, inference, guards, and avoiding 'any'. Guides creation via patterns, diagnosis via sharp edges, review via validations. Activates on type errors or strict mentions.
Enforces TypeScript type safety rules including strict mode, no 'any', discriminated unions, and 'unknown' with type guards. Use when writing, reviewing types, or refactoring TS code.
Share bugs, ideas, or general feedback.
Enable and satisfy strict TypeScript checks including strictNullChecks and exactOptionalPropertyTypes
strict: true in tsconfig.json — this activates all strict flags at once:{
"compilerOptions": {
"strict": true
}
}
What strict: true enables:
strictNullChecks — null and undefined are not assignable to other typesstrictFunctionTypes — function parameter types are checked contravariantlystrictBindCallApply — bind, call, apply are fully typedstrictPropertyInitialization — class properties must be initializednoImplicitAny — untyped variables/parameters are errors, not anynoImplicitThis — this must have a type in function bodiesalwaysStrict — emits "use strict" in every fileuseUnknownInCatchVariables — catch variables are unknown, not anyHandle strictNullChecks — the most impactful flag. Check for null before accessing:
function getUser(id: string): User | null {
/* ... */
}
const user = getUser('123');
// user.name; // Error: Object is possibly 'null'
if (user) {
user.name; // OK — narrowed to User
}
noImplicitAny — add explicit types where inference fails:// Error: Parameter 'item' implicitly has an 'any' type
function process(item) {
/* ... */
}
// Fixed
function process(item: unknown) {
/* ... */
}
strictPropertyInitialization — initialize class properties:class Service {
// Error: Property 'db' has no initializer
private db: Database;
// Fix 1: Initialize in constructor
constructor(db: Database) {
this.db = db;
}
// Fix 2: Definite assignment assertion (use sparingly)
private db!: Database;
}
useUnknownInCatchVariables:try {
await fetchData();
} catch (error) {
// error is 'unknown', not 'any'
if (error instanceof Error) {
console.log(error.message);
}
}
strict: true:{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noPropertyAccessFromIndexSignature": true
}
}
noUncheckedIndexedAccess — index signatures include undefined:const map: Record<string, string> = { a: 'hello' };
// Without flag: map['b'] is string
// With flag: map['b'] is string | undefined
{
"compilerOptions": {
"strict": false,
"strictNullChecks": true,
"noImplicitAny": true
}
}
Fix errors per flag before enabling the next.
Strict mode catches entire categories of bugs at compile time: null dereferences, implicit any types, uninitialized properties, and unsafe function calls. The upfront cost of fixing strict errors pays back quickly in reduced runtime bugs.
noUncheckedIndexedAccess is not included in strict: true but is one of the most valuable additional flags. It forces you to handle the case where an array index or object key might not exist, preventing undefined is not a function errors.
exactOptionalPropertyTypes distinguishes between "property is missing" and "property is undefined". With this flag, { name?: string } means the property may be absent, but if present it must be a string (not undefined).
Strict migration strategy:
strict: true and count the errorsstrict and enable flags individually: noImplicitAny first (most errors), then strictNullChecks, then the rest// @ts-expect-error temporarily for errors you cannot fix immediately — track them with a lint ruleTrade-offs:
strictNullChecks causes the most migration pain — but prevents the most common runtime error (null dereference)noUncheckedIndexedAccess adds | undefined to every index access — use non-null assertion (!) or destructuring with defaults for known-safe accesseshttps://typescriptlang.org/tsconfig#strict