Comment

Comment by cageface

For example in Typescript, you can specify whether a parameter is allowed to be null in the signature of a function. If you do the compiler will make sure that you don't accidentally pass a null value to that function.

  function foo(x: number) {
    return x + 1;
  }

  let y = null;
  foo(y); // compiler will flag this
parent cageface 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton