New version converts `any` to `{}` too aggressively
See original GitHub issueFor code like this:
import {EventEmitter} from 'events';
interface MyData {
foo: string;
}
class Foo extends EventEmitter {
on(event: 'mydata', listener: (data: MyData) => void): this;
on(event: string, listener: (...args: any[]) => void): this {
return super.on(event, listener);
}
}
, gts fix
converts ...args: any[]
to ...args: {}[]
, which makes the specialized on()
method (for ‘mydata’) not compatible with the implementation and makes the build fail. I think this must be left as any[]
because the super class (EventEmitter
)'s type is any[]
.
That also brings another problem where the linter complains about {}[]
, saying that
Array type using ‘T[]’ is forbidden for non-simple types. Use’Array<T>’ instead.
Which forces me to write Array<{}>
, which is harder to read than {}[]
or any[]
. It surprises me that it says {}
is of a non-simple type.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
What Is a Good Conversion Rate? It's Higher Than You Think!
What is a good conversion rate? Conversion is a key element in your paid search strategy. In this post, you'll learn a step-by-step, ......
Read more >Windows 11 prep: How to convert MBR hard drive partitions to ...
Converting an MBR partition to a UEFI partition is accomplished with the help of a simple utility in Windows 10 called MBR2GPT.exe, which...
Read more >E-book conversion — calibre 6.10.0 documentation
This document will refer mainly to the conversion settings as found in the conversion dialog, pictured below. All these settings are also available...
Read more >Converting Client Modpack Versions To Server Version
Looking to host your favorite modpack on a server but the modpack doesn't have a server version? Learn how to convert client side...
Read more >Convert a Word or PDF form or quiz to Microsoft Forms
You can import and convert your existing Word or PDF surveys or quizzes, on your local hard ... Forms page with New Form,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m +1 on this approach - having the lint rule is ok, breaking all of my code when I run
fix
isn’t.Agree with @calebegg. The
no-any
rule should not have a fixer.I propose that we implement our own
no-any-google
rule that jettisons the fixer and use that instead. Or convince upstream to do it.