Skip to content

Commit

Permalink
docs: updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ncpa0cpl committed Jan 10, 2023
1 parent 230699d commit 938ac9e
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ both the runtime validation types and the TypeScript type definitions.
16. [Dict](#datatypedictdatatypes)
17. [SetOf](#datatypesetofdatatypes)
18. [Literal](#datatypeliteralstring--number--boolean)
19. [Enum](#datatypeenumenum)
20. [EnumMember](#datatypeenummemberenum-member)
21. [Custom](#datatypecustomfunction)
19. [InstanceOf](#datatypeinstanceofclass)
20. [Enum](#datatypeenumenum)
21. [EnumMember](#datatypeenummemberenum-member)
22. [Custom](#datatypecustomfunction)
4. [Utility Functions](#utility-functions)
1. [And](#and)
2. [Omit](#omit)
Expand Down Expand Up @@ -470,6 +471,19 @@ const baz = DataType.Literal(true);
type T2 = GetDataType<typeof baz>; // type T2 = true
```

#### DataType.InstanceOf(class)

will match any value that is an instance of the passed class and translate to
the `InstanceType` type of that class in TypeScript.

```ts
class FooBar {}

const foo = DataType.InstanceOf(FooBar);

type T = GetDataType<typeof foo>; // type T = InstanceType<typeof FooBar>
```

#### DataType.Enum(enum)

will match any value that belongs to an TypeScript enum and translate to that
Expand Down

0 comments on commit 938ac9e

Please sign in to comment.