Guest User

Untitled

a guest
Aug 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. let x = { foo: { bar: "baz" } };
  2. console.log(x.foo!.bar);
  3.  
  4. const x: string = "foo";
  5. const y = x!.indexOf("f"); // <-- x is of type string; no need to assert non-null
  6.  
  7. This assertion is unnecessary since it does not change the type of the expression.
Add Comment
Please, Sign In to add comment