Skip to content

Commit

Permalink
chore(README): improve English
Browse files Browse the repository at this point in the history
  • Loading branch information
takagiy committed Jul 21, 2024
1 parent 1e466b6 commit 8f4eb0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# validated-extendable.js

Library that allows you to define classes extending zod schemas to avoid boilerplate code.
A library that allows you to define classes extending zod schemas to avoid boilerplate code.

[![npm version](https://badge.fury.io/js/validated-extendable.svg)](https://badge.fury.io/js/validated-extendable)
[![CI](https://github.com/takagiy/validated-extendable.js/actions/workflows/ci.yaml/badge.svg)](https://github.com/takagiy/validated-extendable.js/actions/workflows/ci.yaml)
Expand Down Expand Up @@ -39,7 +39,7 @@ class Person extends Validated(schema) {
}
}

/* A constructor typed based on the zod schema is created */
/* A constructor that is typed based on the zod schema is created */
// const person = new Person({ age: 25 }); // => Compile error: Property 'name' is missing in type '{ age: number; }' but required in type '{ name: string; age: number; }'.

/* Constructor will validate the input using the zod schema! */
Expand All @@ -59,7 +59,7 @@ Person.schema.parse({ name: "John", age: 25 }); // => { name: 'John', age: 25 }
import { ValidatedMutable } from "validated-extendable";
import { z } from "zod";

/* By default, all properties are readonly. You can use 'ValidatedMutable' instead of 'Validated' to make them mutable */
/* By default, all properties are readonly. To make them mutable, you can use 'ValidatedMutable' instead of 'Validated'. */
class Person extends ValidatedMutable(
z.object({
name: z.string().min(1),
Expand Down Expand Up @@ -100,9 +100,9 @@ console.log(age.value); // => 25

## Limitations

By default, the result type of the validation (other than primitive types) should not be a uninheritable type (e.g. tuple types and union types).
By default, the result type of the validation (other than primitive types) should not be an uninheritable type (e.g. tuple types and union types).

But you can use `wrapValue` option to wrap an uninheritable type with an object to make it inheritable (like primitive types are wrapped in above examples).
However, you can use the `wrapValue` option to wrap an uninheritable type within an object, making it inheritable (like primitive types are wrapped in above examples).

```typescript
import { Validated } from "validated-extendable";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "validated-extendable",
"version": "7.2.3",
"description": "Library that allows you to define classes extending zod schemas to avoid boilerplate code.",
"description": "A library that allows you to define classes extending zod schemas to avoid boilerplate code.",
"exports": {
".": {
"require": {
Expand Down

0 comments on commit 8f4eb0c

Please sign in to comment.