3 ms·
Great advice and works well in TypeScript as well. See https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates https://www.typesc
by knallfrosch 2y ago
Great advice and works well in TypeScript as well. See https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates https://www.typescriptlang.org/docs/handbook/advanced-types....
More than merely catching compiler errors, this also makes writing code faster by offering better auto-completion for new code.
- tossandthrow 2y agoThis is a super tool! But it still requires one to write good gates. For all projects of some. Size I would advice people to use Zod or the like (unless there are special circumstances such that external deps can not be used).
- epolanski 2y agoAnd if you want more power at the type level, use effect/schema https://github.com/effect-ts/effect/tree/main/packages/schema https://github.com/effect-ts/effect/tree/main/packages/schem...