7
sjwsjwsjw
76d

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

Comments
  • 1
    realise 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.
  • 0
    Depends 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.
  • 0
    Typescript 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.
  • 0
    Your type annotations are probably wrong, your IDE is correct that there's a problem, wrong about what the problem is.
  • 0
    Yeah, 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
  • 0
    That or docblocs are lying
  • 0
    Can‘t happen unless you use a retarded language.
  • 1
    @lorentz typescript is just a version of javascript that's lying to you.
Add Comment