You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
noImplicitAnyLet or some name, enforce type on implicit any let#381
I think from a code readability point of view, enforcing type declarations on uninitialized let variables is a no brainer. It documents the code giving context to how it intends to be used, and prevents weirdness from happening as a result of not type being enforced at the beginning.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Typescript has a noImplicitAny, but it for some weird reason doesn't error on code like so:
let x;The reasoning is that type inference will pick up the type as it's used.
microsoft/TypeScript#30899
Whatever the reason, eslint typescript lacks a rule to handle this, and some weird config that leverages
no-restricted-syntaxhttps://typescript-eslint.io/play/#ts=4.7.4&sourceType=module&showAST=es&code=PQKgUApgzgNglgOwC4AIEHsC0AnaTtwDGSEAJplAJ7ICGAHgFwoDaYKKARBNtuthwBo2KAN7D2HKBBgRifDkw4A1GgRoAjGQBFZMVTSRx0CZgGtEpFAF4UAchlJbAXRQA+FCrWaIOwnuwGfMyIcKg2CACuMDBODBhIABTBpAB0SJQADhAAggjxBkYITgCUguKcALbQUDQA5hAKnAAKvABucKQQKDQo6VndeehIBcYcwgC+YE5gIMBgYMDAKABCNKRgDihQ6FWeAIwA3GDbu6p71nZ7AEwAzLZHJxD7F9c3RwtLAOLo6Oubj54rkwoPhELUHjsnqorhdbACaDAIhB7vNFihvr8NhBUPDsDdYfDEcj3miMX9sVtIZ4ACwXepIADK0lkhmMCWKJK+P3JOKpqgArBdcfiAPx2VoIpEAeQQyJQTFsEqJABUAO7oe5AA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3QAacDUhFYASSSomyPAEEiATwphR6KQF8Q+oA
I think from a code readability point of view, enforcing type declarations on uninitialized
letvariables is a no brainer. It documents the code giving context to how it intends to be used, and prevents weirdness from happening as a result of not type being enforced at the beginning.All reactions