rsuite / schema-typed

Schema for data modeling & validation
MIT License
198 stars 28 forks source link

ObjectType.shape is not a function #44

Open jbeckton opened 2 years ago

jbeckton commented 2 years ago

What version of schema-typed are you using?

2.0.2

Describe the Bug

schema_typed_1.ObjectType.shape is not a function

Expected Behavior

no type error

To Reproduce

I copied your first code example into an online editor to run it and the lib has a type error.

https://github.com/rsuite/schema-typed#getting-started

https://stackblitz.com/edit/typescript-z822z2

simonguo commented 2 years ago

hi @jbeckton There are errors in the example code in the documentation. Should be ObjectType().shape

-role: ObjectType.shape({
+role: ObjectType().shape({
  name: StringType().isRequired('Name required'),
  permissions: ArrayType().isRequired('Permissions required'),
})