Skip to content

Commit

Permalink
doc: update intro
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize committed May 18, 2024
1 parent cd1a619 commit 084f86b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,22 @@ After examining the code of several well-known open-source projects such as Zod,

## Author Talk

I am currently writing a new E-book. Please follow and support!This book is for advanced TypeScript users (not suitable for beginners, it might be overwhelming).The title of the book is "Type-safe Design Pattern in Modern TypeScript." Not every Design Pattern can be made Type-safe, but I have compiled frequently used Design Patterns in Modern TypeScript Libraries.Disclaimer:
I am currently writing a new E-book. Please follow and support!This book is for advanced TypeScript users (not suitable for beginners, it might be overwhelming). The title of the book is **"Type-safe Design Pattern in Modern TypeScript."** Not every Design Pattern can be made Type-safe, but I have compiled frequently used Design Patterns in Modern TypeScript Libraries.Disclaimer:

I did not create these Design Patterns. I learned from various Modern TypeScript Open Source projects, including famous ones like Zod, tRPC, Hono, elysia, and many others, as well as writing the Nammtham Framework. This process has helped me distill commonly used patterns.P.S. The image is not the book cover; it was generated by AI.
P.S.2. The book is still in the draft phase, but you can see a rough outline.
P.S.3. I would love to hear feedback from the community because I haven't seen anyone write about this yet, and even Western authors haven't covered it.
Moreover, I have not seen any books or articles that cover these topics. I hope this book will help you improve your TypeScript code quality and design. I will publish the book on Leanpub. I will update the progress on X (Twitter). Please follow me on X (Twitter) [@mildronize](https://x.com/mildronize). I've been working on this book for a while, and I hope to finish it soon. I would love to hear feedback from the community because at that time when I'm writing, I haven't seen anyone write about this yet.

## Table of Contents

- TypeScript Config
- Use strict
- Data Structure
- Literal
- Tuple
- Record Object
- Use [literal type](./data-structure/literal-string.md) rathen than string
- Use [Record object](./data-structure/record-object.md) rather than list/array
- Use [Tuple](./data-structure/tuple.md) rather than list/array
- Design Patterns
- Use literal instead of string
- Use object rather than list/array
- Use tuple rather than list/array
- Use builder pattern
- Use function argument instead of plain object
- Use function overload
- Use [builder pattern](./design-patterns/builder-pattern.md)
- Use [function argument](./design-patterns/function-argument.md) instead of plain object
- Use [function overload](./design-patterns/function-overload.md)

## Prerequisites
Please make sure you have a good understanding of TypeScript before reading this book. If you are new to TypeScript, I recommend reading the [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/intro.html) first.
Expand All @@ -50,5 +45,11 @@ Generics are a fundamental concept in TypeScript, so make sure you understand th
After that, make sure you have understand type-level programming. You can read the [Type-Level Programming](https://type-level-typescript.com/) book.
There are many free chapters available. However, I recommend buying the book to support the author.

## Disclaimer

I did not create these design patterns. I learned from various modern TypeScript open-source projects, including famous ones like Zod, tRPC, Hono, Elysia, and many others, as well as writing the [Nammtham](https://nammatham.thaitype.dev/) (Azure Functions Framework). This process has helped me distill commonly used patterns.

The type-safe design patterns is not suitable for every project. It is intended for projects that require high code quality and design. Make sure to evaluate whether these patterns are suitable for your project before using them.

## Contributing
If you have any suggestions or feedback, please feel free to open an issue or submit a pull request on [GitHub](https://github.com/mildronize/type-safe-design-pattern)

0 comments on commit 084f86b

Please sign in to comment.