beginners-typescript-tutorial icon indicating copy to clipboard operation
beginners-typescript-tutorial copied to clipboard

Encouraging `unknown` type introduction before narrowing

Open thierrymarianne opened this issue 10 months ago • 0 comments

Hi!

In the spirit of providing alternate solutions for exercice 13 (entitled catch-blocks), does it make sense to encourage possible introduction of

  • unknown type
  • guard clause for case when e variable inheriting from Error class so that it is handled as expected (with expectation provided by test assertion),
  • guard clause for case when e variable does not inherit from Error class?

thierrymarianne avatar Apr 04 '24 08:04 thierrymarianne