deno
a384df01 - fix(publish): ignore unused type parameter diagnostics from fast check (#35017)

Commit
84 days ago
fix(publish): ignore unused type parameter diagnostics from fast check (#35017) ## Summary `deno publish` failed with `TS6205 [ERROR]: All type parameters are unused` on overloaded **generic** functions, while `deno check` reported no error — an inconsistency between the two type-checking paths. ```ts export function chain<R>(handler: Handler<R>): Handler<R>; export function chain<R, P>(middleware: Middleware<R, P>): Chain<R, P>; export function chain<R, P>( middleware: Handler<R> | Middleware<R, P>, ): Handler<R> | Chain<R, P> { ... } ``` ## Cause During publish, the public API is type-checked against the **fast check** output. Fast check strips the implementation body of an overloaded function and anonymizes its parameters (`param0?: any`). The generic type parameters declared on the implementation signature (`<R, P>`) are then used nowhere, so under `noUnusedParameters` / `noUnusedLocals` TypeScript reports `TS6205` ("All type parameters are unused"). `deno check` keeps the real body, so the type parameters are used there — hence the inconsistency. This is the same class of false positive that is already suppressed for unused value parameters (`TS6133`), which arises for exactly the same reason ("fast check not having function body implementations"). ## Fix Add `TS6205` to the diagnostics suppressed by `Diagnostic::include_when_remote()`, alongside the existing `TS6133` and `TS4114`. ## Test Adds `tests/specs/publish/overloaded_generics_unused_type_params` — a `publish --dry-run` of a package with `noUnusedParameters`/`noUnusedLocals` enabled and an overloaded generic function. Verified that the test fails before the fix (TS6205) and passes after. Closes #30285 Closes denoland/divybot#538 Co-authored-by: divybot <divybot@users.noreply.github.com> Co-authored-by: Divy Srivastava <me@littledivy.com>
Author
Parents
Loading