A set of basic types for Pave
- String
- Number
- Object
- Time
- Datetime
- Date
- Boolean
Simply include this in your package.json and then spread this into your Pave schema index to have pre-baked types ready to go, as shown below
// In your schema root
import types from 'pave-basic-types';
export default {
...types
}// ...or, if you prefer a selective choosing of the types provided by this package
import types from 'pave-basic-types';
const { string, boolean, ...etc } = types;
export default {
string,
boolean,
...etc
}
And now you have your basic scalar types defined
All errors thrown by values that don't fit types fit the same form;
Expected a value of type Type but was provided value Value
This is useful in the case that you'd like to implement your own wrapper error catching function, as you'll be able to predict the format of the caught error, and be able to do from there as you please.