funtypes
funtypes copied to clipboard
Runtime validation for static types
The changes from #17 (specifically, the placeholder-based parsing machinery introduced in 6e58e53) breaks a _bunch_ of stuff. - Placeholders don't preserve the prototype chain, so `instanceof` breaks - Placeholders are...
 I ran this complete example in Quokka to show the output inline.
#17 essentially transformed funtypes into codecs, able to both decode/parse and encode/serialise values. The existing `Static` type function allows us to derive the decoded/parsed type from a funtype. It would...
```typescript const someSchema = FT.Record({...}) const parsedObject = someSchema.parse(...) console.log(parsedObject.toString) // prints undefined ``` That's quite the unexpected behavior!
The behaviour of `Intersect` isn't always very intuitive when it comes to objects. The behaviour people want is often much closer to "spread". We should implement something similar to Zod's...
It would be useful to have a way to get a copy of an object with only selected fields or with some fields excluded. See https://github.com/vriad/zod#pick-and-omit for inspiration. Proposed API:...
There is currently no way to disallow additional properties on records. The closest you could get would be to Intersect the Record with a Dictionary that specifies the allowed fields....
Currently you can create an object with optional properties by using an Intersection of a `Record` and a `Partial`. This has a number of issues though: 1. It's not very...
I have purchased https://funtypes.dev with the intentention of having a small website for nicely formatted documentation of funtypes and related projects. It needs setting up with docusaurus 2 in this...
As someone coming from runtypes looking for a solution to https://github.com/pelotom/runtypes/issues/56, I found funtypes but it is unclear to me what exactly I'm getting along with a solution to that...