Skip to content

Commit

Permalink
feat: add license
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize committed May 18, 2024
1 parent fe57c2c commit 6004433
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 11 deletions.
5 changes: 5 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License

This work by Thada Wangthammang, @2024 is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
You may copy and redistribute the material in any medium or format for non-commercial purposes only, provided proper attribution is given, but you may not distribute any modified material.
For details, see the full license at https://creativecommons.org/licenses/by-nc-nd/4.0/
42 changes: 32 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
# book-type-safe-design-pattern
# Type-safe Design Pattern in Modern TypeScript

To install dependencies:
This book provide ready to use design pattern for type-safe approach in modern typescript
by Thada Wangthammang

```bash
bun install
```
## Table of Contents

To run:
- TypeScript Config
- Use strict
- Data Structure
- Use literal type rathen than string
- Use Record object rather than list/array
- Use Tuple rather than list/array
- Design Patterns
- Use builder pattern
- Use function argument instead of plain object
- Use function overload

```bash
bun run index.ts
```
## 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.

This project was created using `bun init` in bun v1.1.7. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
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.

## 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)

## License
This book is licensed under the [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/)
5 changes: 4 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ export default defineConfig({
],
},
],

footer: {
message: 'Content License under <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="blank">CC BY-NC-ND 4.0</a>',
copyright: 'Copyright © 2024-present Thada Wangthammang'
},
socialLinks: [
{
icon: "github",
Expand Down

0 comments on commit 6004433

Please sign in to comment.