Skip to content

Commit c237ba2

Browse files
committed
Added a section for bolt-on type safety libs
1 parent 0c9c0d4 commit c237ba2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

blog-post.md

+20
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,21 @@ Here's a function that makes a `POST` request:
279279

280280
This defines `D` where both `BodyType` and `ResponseType` are a `User`.
281281

282+
## Bolt-on solutions
283+
284+
I've shown how out of the box TypeScript isn't very safe and presented
285+
some techniques for making it safer.
286+
I also suggest hunting for third party libraries
287+
that seek to specifically address type safety, as there are quite a few.
288+
289+
One in particular,
290+
[io-ts](https://github.com/gcanti/io-ts)
291+
helps make `fetch()` and other common I/O patterns type safe.
292+
When working in
293+
[Redux](https://redux.js.org/),
294+
[`typesafe-actions`](https://github.com/piotrwitek/typesafe-actions)
295+
adds type safety to actions as well as reducers, for example.
296+
282297
## The case for any types
283298

284299
Hopefully by now I've convinced you not to build a TypeScript app
@@ -328,3 +343,8 @@ check out
328343
[axios](https://github.com/axios/axios).
329344
It supports TypeScript and is
330345
[designed for type safety](https://levelup.gitconnected.com/a-typescript-safe-api-82cc22c4f92d).
346+
347+
To go further, here is a
348+
[deep dive](https://basarat.gitbook.io/typescript/)
349+
into TypeScript that was written to address
350+
many common problems people run into when getting started.

0 commit comments

Comments
 (0)