Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

improve typeof-compare error message to contain the failing word and a suggestion #2066

Closed
HamletDRC opened this issue Jan 18, 2017 · 2 comments · Fixed by #3286
Closed

improve typeof-compare error message to contain the failing word and a suggestion #2066

HamletDRC opened this issue Jan 18, 2017 · 2 comments · Fixed by #3286

Comments

@HamletDRC
Copy link
Contributor

The typeof-compare error message is a static string that does not give the user a hint of what went wrong.

It would be better to include the offending word in the error message.

Additionally, it is quite simple to also print out what the word should most likely be by calculating the distance to the closest match. The microsoft rule for the same behavior does this: https://github.com/Microsoft/tslint-microsoft-contrib/blob/master/src/validTypeofRule.ts

@mohsen1
Copy link
Contributor

mohsen1 commented Jan 18, 2017

See #2046

It's likely that the rule get deprecated

@ajafff
Copy link
Contributor

ajafff commented Jan 18, 2017

@mohsen1 I'd recommend not to deprecate this rule. This one does not need the type checker.

But I'm also ok with tslint deprecating the rule, as long as the equivalent is still available in microsoft-tslint-contrib

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants