Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
tosensei8425294drealise that you can never fully trust anything. or anyone. not even yourself
welcome to the next level. you have now learned that there is no spoon...
...
or is there?
-
-
-
or maybe you just added the nullcheck in the wrong spot. -
kamen6917294dDepends on the language... if the IDE tells you that it can't be null, then that's most probably based on type inference, which in turn means there might be something wrong with your types.
-
lorentz15123294dTypescript is an approximation, even if the user never makes a false statement and the compiler options are set to their strictest possible values, the engine itself regularly infers and accepts overly narrow types that exclude possible values.
-
atheist9805294dYour type annotations are probably wrong, your IDE is correct that there's a problem, wrong about what the problem is.
-
Hazarth9484294dYeah, it's unlikely that the IDE would be wrong on this. It usually bases it's estimations on just the few lines in your local scope and global scope, so if it says it can't be null, then it really shouldn't be null unless something weird is going on. Is this a multithreaded application and are you accessing something that another thread can change in the meanwhile? Really weird if not, not impossible, just weird
reality: I saw null in the debugger here, causing the bug
add a null check
IDE: you don't need to check for null, this can't be null
what do you do when you can't trust the tools you work with
rant