A quick tip on TypeScript's non-null assertion operator (!). When TypeScript can't infer that a variable has been initialized (e.g., assigned inside a separate function), it raises a 'used before being assigned' error. Appending ! to the variable tells the compiler to treat it as non-null/non-undefined, resolving the error without changing runtime behavior.

1m read timeFrom playfulprogramming.com
Post cover image

Sort: