gcanti / newtype-ts

Implementation of newtypes in TypeScript
https://gcanti.github.io/newtype-ts/
MIT License
582 stars 14 forks source link

Explain why branded types replaces newtype #23

Closed steida closed 4 years ago

steida commented 4 years ago

As I understand, branded type replaces newtype, except in the case where we explicitly don't want downgradeability to the base type, which is very rare (string token to not be considered to be string for security purposes).

https://github.com/gcanti/io-ts-types/issues/111

steida commented 4 years ago

I believe this awesome lib should be deprecated or io-ts should be mentioned at least.

@gcanti I can send PR.

gcanti commented 4 years ago

I believe this awesome lib should be deprecated

Some people prefer newtypes over branded types

See also https://github.com/gcanti/io-ts-types/issues/111