Comment

Comment by foepys

I don't get TypeScript's type system.

It is obviously very powerful and can model very complex type constraints.

But then you have stuff like this where it is not checking types as I would expect:

  interface Foo { bar: string; }
  const f = {bar: "foobar"} as Readonly<Foo>;
  function someFunc(): Foo {
    return f; // No error or warning, even with all strict flags enabled
  }
parent foepys 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton