A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Microsoft/TypeScript/issues/20568 below:

Unused type parameters should be checked by --noUnusedParameters, not --noUnusedLocals · Issue #20568 · microsoft/TypeScript · GitHub

I reviewed the compiler options for my project and decided to enable --noUnusedLocals but not --noUnusedParameters since the cost-benefit picture seems to be much better for --noUnusedLocals. However, I was surprised to get an error on a type alias that has an unused type parameter for documentation purposes. Since "type parameter" has "parameter" in the name, I expected it would be checked by --noUnusedParameters. I see that several issues have been filed related to the check for unused type parameters, but no one seemed to think it was odd that the check was under --noUnusedLocals.

The code change is very simple, and I'll be happy to prepare a pull request if you agree with the change. I suppose it's a breaking change if someone is using --noUnusedParameters and not --noUnusedLocals; that configuration seems unlikely.

TypeScript Version: current master (5e5b770)

Code

// Compile with --noUnusedLocals
type Oops<T> = number;

Expected behavior:
No errors.

Actual behavior:

unused-type-parameter.ts(1,11): error TS6133: 'T' is declared but its value is never read.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4