Skip to content

Commit 8bb93bb

Browse files
committed
docs(README.md): add limitations section
1 parent 76d295f commit 8bb93bb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The validation errors are detailed. Adapted from the brilliant work in `flow-run
1616
- [typed-validators](#typed-validators)
1717
- [Table of Contents](#table-of-contents)
1818
- [Introduction](#introduction)
19+
- [Limitations](#limitations)
1920
- [Generating validators from type defs](#generating-validators-from-type-defs)
2021
- [Before](#before)
2122
- [Command](#command)
@@ -178,6 +179,18 @@ Actual Value: {
178179
}
179180
```
180181

182+
# Limitations
183+
184+
- Flow seems to suck at fully resolving `t.ExtractType<...>` for deeply nested object types. Past a certain level of complexity
185+
it seems to give up and use `any` for some object-valued properties. That's why I created [`gen-typed-validators`](https://github.com/jcoreio/gen-typed-validators),
186+
so that you can control the type definitions and generate `typed-validators` from them.
187+
- Generic types aren't supported. I may add support for it in the future if I'm confident I can make a robust implementation.
188+
- Function types aren't supported. You can use `t.instanceOf(() => Function)`, but Flow treats the `Function` type as `any`. I may add `t.function()` in the future, but
189+
it won't validate argument or return types, because those can't be determined from function instances at runtime.
190+
- The goal is to support a subset of types common to TS and Flow well, rather than support every possible complex derived type
191+
you can make. (That's what `babel-plugin-flow-runtime` basically tried to do, and it was too ambitious. I created this so that I could
192+
stop using it.)
193+
181194
# Generating validators from type defs
182195

183196
This is now possible with [`gen-typed-validators`](https://github.com/jcoreio/gen-typed-validators)!

0 commit comments

Comments
 (0)