Errors in the wrong places... ie, errors at type declarations, and top of stack...
- Lingua principale
- Rust
- Stelle
- 22.3k
- Fork
- 1.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Pretty difficult to replicate easily...
Here's an example of an error showing up at the Type declaration:
I've declared these type...
```
type RequestHandler = (request: Request) => Promise
type UserRequestHandler = (request: UserRequest) => Promise
```
Now, I know the mistake I made was I used a RequestHandler in place of a UserRequestHandler or vice versa in one of my lines of code, but instead I get an error saying:
```
src/framework/Controller.js:60
60: type RequestHandler = (request: Request) => Promise
^^^^^^^ Request. This type is incompatible with the expected param type of
61: type UserRequestHandler = (request: UserRequest) => Promise
^^^^^^^^^^^ UserRequest
```
This is obviously a significant issue completely unhelpful. In order to find the error, I have to dig through the code base for all usages of RequestHandler and UserRequestHandler and see where one was used in the place of the other.
An example of top of stack:
```
static many(ids: Array): Promise> {
return orm.many(this, ids) // do a bunch of stuff in there
}
```
This error is extremely odd, since at no point do we use Lodash.keys on this array, but this is the error we get:
```
src/models/Model.js:56
56: static many(ids: Array): Promise> {
^^^^^^ some string with unknown value. Property not found in
419: keys(object: T): Array<$Keys>;
^^^^^^^^ object literal. See lib: flow-typed/lodash.js:419
```
The most obvious conclusion is that our ids string array or some subsequent transformation of it ends up being used in lodash.keys(), but it isn't... at all...
This is happening pretty consistently throughout the codebase.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.