| Summary: | [eslint] type-checked-consistent-return is incorrectly marking same return types | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Michael Rennie <Michael_Rennie> |
| Component: | JS Tools | Assignee: | Olivier Thomann <Olivier_Thomann> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | curtis.windatt.public, Olivier_Thomann, steve_northover |
| Version: | 11.0 | ||
| Target Milestone: | 12.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | 486577 | ||
| Bug Blocks: | |||
I think the current implementation is too naive. We should revert the previous commit. We would need to know the "real" type of each return if we can. Using typeof is not sufficient. Should be fixed with the work on Bug 486577 Fixed. |
Consider the following snippet: /** * @param {Number} one */ function foo(one) { if(one === 10) { return 0; } var two = one; return two; } The last return statement will be flagged saying: "Inconsistent return types: 'number', 'object'", but in fact, number is being returned in both cases.