removing-typescript-suppressions

Replaces @ts-expect-error and @ts-ignore directives with minimal type-safe fixes.

2.0k|679|Updated Jun 13, 2024
One-click install
npx skills add https://github.com/Comfy-Org/ComfyUI_frontend --skill removing-typescript-suppressions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: removing-typescript-suppressions
Source: https://github.com/Comfy-Org/ComfyUI_frontend/tree/main/.agents/skills/removing-typescript-suppressions
Command: npx skills add https://github.com/Comfy-Org/ComfyUI_frontend --skill removing-typescript-suppressions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeScript codebases accumulate @ts-expect-error and @ts-ignore comments that hide real type errors, making refactors risky and masking contract mismatches. This Skill removes those suppressions by repairing the underlying type contract instead of silencing the compiler.

Core Features & Use Cases

  • Scoped Suppression Removal: Uses git diff against a base ref to target only suppressions introduced by the change under review, avoiding unrelated legacy cleanup.
  • Root-Cause Type Repair: Traces each error to its source type, runtime owner, and consumers, then applies a prioritized fix ladder: correct source types, control-flow narrowing, existing domain types, or unknown with runtime narrowing.
  • Repair Pattern Library: Provides concrete patterns for optional browser globals, nullable factory returns, value-or-factory unions, callback payloads in page.evaluate, test globals, and serialization boundaries.
  • Use Case: During code review of a pull request in the ComfyUI frontend, run this Skill to eliminate newly added @ts-expect-error comments, run pnpm typecheck and focused Vitest or Playwright tests, and verify the final diff contains zero suppressions.

Quick Start

Remove the TypeScript suppressions introduced by my current branch and fix the underlying type errors without using any or type assertions.

Frequently Asked Questions about removing-typescript-suppressions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove @ts-expect-error comments without breaking the build?

Remove the suppression, run the narrowest typecheck that owns the file, and fix the root cause by correcting source types or adding control-flow narrowing. Avoid replacing it with any, type assertions, or wider optional types that merely hide the mismatch.

How to fix TypeScript errors instead of using @ts-ignore?

Trace the failing value to its source type and runtime owner, then prefer fixes in order: correct types at the source, control-flow narrowing, an existing domain or generated API type, or unknown with runtime narrowing at genuine compatibility boundaries.

Should I use @ts-expect-error or @ts-ignore in TypeScript?

Neither should be added permanently; both suppress compiler diagnostics. The exception is a deliberate suppression testing that a compiler error occurs, where the error itself is the behavior under test and must be preserved.

How do I handle nullable return types like LiteGraph createNode?

Guard the nullable result before dereferencing, for example checking if (!node?.widgets?.length) return early. Use optional chaining only when a missing value and an empty value behave identically; otherwise throw a useful error.

When is it acceptable to use unknown instead of any in TypeScript?

Use unknown at genuine compatibility boundaries such as JSON or browser data, then validate the full nested shape with runtime narrowing before assigning a domain type. A result type annotation alone does not validate untyped data.