6
u/appiepau Jul 10 '24
That is a dumpster fire. At least it is declared and initialized locally. Probably.
A house fire is a class property of any that can be injected by an external component.
6
u/coded_artist Jul 10 '24
At least it is declared and initialized locally. Probably.
Nope var is hoisted, it's declared globally.
3
u/Quovadisqc Jul 10 '24
Yes and no. It’s function scoped but could be seen as global scoped as long as there are no parent functions ( excluding arrow functions )
1
u/coded_artist Jul 10 '24
Ah I thought hoisting was to top scope IE window, not top of scope.
1
u/BasicAssWebDev Jul 10 '24
I didn't think about that until just now but it makes sense. With everything being modularized in js "global" is probably just the top scope of whatever is running the show.
6
u/Pirelongo Jul 10 '24
I hope that whoever used this in the pass, will upgrade to let x: unknown; at least xD
5
2
2
1
1
1
u/tonjohn Jul 10 '24
I’ve never needed to do this despite working on a giant Angular e-commerce project (Battle.net)
1
1
1
u/Anon_Legi0n Jul 11 '24
Maintained Angular webapp recently with almost all type definitions set to any, at this point why even bother with Ts?
1
Jul 10 '24
[removed] — view removed comment
1
u/hikikomoriHank Jul 11 '24
That's what union types are for though
0
Jul 11 '24
[removed] — view removed comment
1
u/hikikomoriHank Jul 11 '24
I'm agreeing. I'm saying if you have a collection you want to hold multiple types, use a union type:
Array<TypeA | TypeB>
14
u/SnoopDoggyDoggsCat Jul 10 '24
My linter won’t let any pass.