You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ The validation errors are detailed. Adapted from the brilliant work in `flow-run
16
16
-[typed-validators](#typed-validators)
17
17
-[Table of Contents](#table-of-contents)
18
18
-[Introduction](#introduction)
19
+
-[Limitations](#limitations)
19
20
-[Generating validators from type defs](#generating-validators-from-type-defs)
20
21
-[Before](#before)
21
22
-[Command](#command)
@@ -178,6 +179,18 @@ Actual Value: {
178
179
}
179
180
```
180
181
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
+
181
194
# Generating validators from type defs
182
195
183
196
This is now possible with [`gen-typed-validators`](https://github.com/jcoreio/gen-typed-validators)!
0 commit comments