From cd1a6190f4b87ef8f02959a98d28a4dde9ea3e63 Mon Sep 17 00:00:00 2001 From: Thada Wangthammang Date: Sat, 18 May 2024 09:05:18 +0700 Subject: [PATCH] doc: add prerequisites --- docs/data-structure/literal-string.md | 6 +++++- docs/intro.md | 25 +++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/docs/data-structure/literal-string.md b/docs/data-structure/literal-string.md index cd0af96..4d4879b 100644 --- a/docs/data-structure/literal-string.md +++ b/docs/data-structure/literal-string.md @@ -1,3 +1,7 @@ # Literal String -In TypeScript, a literal string is a string that has a specific value. For example, the string `"hello"` is a literal string with the value `hello`. \ No newline at end of file +In TypeScript, a literal string is a string that has a specific value. For example, the string `"hello"` is a literal string with the value `hello`. + +## Prerequisites +- [Literal types are SO USEFUL in TS - Advanced TypeScript](https://www.youtube.com/watch?v=jxSh-RZTCws) by [Matt Pocock](https://x.com/mattpocockuk) +- [Literal Type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types) \ No newline at end of file diff --git a/docs/intro.md b/docs/intro.md index defe6c5..bbdeab4 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -2,8 +2,14 @@ outline: deep --- + + # Introduction +::: warning +This book is still in the draft phase. Please feel free to open an issue or submit a pull request on [GitHub](https://github.com/mildronize/type-safe-design-pattern) +::: + ::: info This book is more advanced than the TypeScript Handbook. It is intended for developers who are already familiar with TypeScript and are looking to improve their code quality and design. ::: @@ -12,8 +18,13 @@ This book is a collection of TypeScript best practices and design patterns. It i After examining the code of several well-known open-source projects such as Zod, tRPC, Hono, Elysia, and ts-odata-client. -## Recommended Reading -- [Type-Level Programming](https://type-level-typescript.com/) +## 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 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. ## Table of Contents @@ -31,3 +42,13 @@ After examining the code of several well-known open-source projects such as Zod, - Use function argument instead of plain object - Use function overload +## 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. + +Generics are a fundamental concept in TypeScript, so make sure you understand them. You can read the [Generics](https://www.typescriptlang.org/docs/handbook/2/generics.html) section of the TypeScript Handbook. + +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. + +## 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) \ No newline at end of file