Skip to content

Latest commit

 

History

History
32 lines (14 loc) · 568 Bytes

branded_types.md

File metadata and controls

32 lines (14 loc) · 568 Bytes

Blank

General idea

Hurdles to overcome

Hurdle 1

Forecast

Notes

https://basarat.gitbook.io/typescript/main-1/nominaltyping https://codemix.com/opaque-types-in-javascript/

twitter

https://twitter.com/mattpocockuk/status/1625173884885401600

Let's talk about branded types.

If I were building an app where security was critical, I'd use the crap out of them.

A Brand type lets you use a bit of 'nominal' typing inside TypeScript.

By declaring a unique symbol, 'brand', we can use this Brand type helper to create types with 'names'.