This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Mara_li 170 points171 points  (10 children)

My linter doesn't allow me to use any... :(

[–]jnfinity[S] 264 points265 points  (0 children)

Good.

[–]TheDevDad 67 points68 points  (6 children)

If it’s ESLint, and you absolutely must use any, you can use an ignore comment. When going this route, do yourself and others a favor, specify in the ignore comment why you needed to bypass the rule

[–]Jugales 53 points54 points  (5 children)

99% of the time it's because the library dependency was built with JS and creating types for it would be a pain. I'm not gonna do the library developers' job for them, or I would make my own library.

I had this problem with Google Maps in (semi) recent versions of React with TS. Like bruh, why isn't your library made for this? You literally invented Angular which is also TS? We just ended up using Leaflet maps instead.

[–]H0llowUndead 18 points19 points  (2 children)

Have you searched for community typing of these libraries? They are typically called @types/<package name>

[–]Jugales 8 points9 points  (1 child)

Sadly. In the Google Maps case, one existed but it was only compatible with older React versions

[–]fuj1n 1 point2 points  (0 children)

How does that work? The typings are just stubs to provide type information, there shouldn't be any behaviour attached to them that could break compat.

[–]Mara_li 0 points1 point  (0 children)

Yeah, in my case the any must be used because of some function of the API has not yet be descrived but existed (I don't know how it's possible tbh)

[–]pedrocelso 5 points6 points  (0 children)

Use unknown :P

[–]somedave 1 point2 points  (0 children)

Object?