Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impicit return type is not checked in readonly-array #18

Closed
jonaskello opened this issue Apr 8, 2017 · 1 comment
Closed

Impicit return type is not checked in readonly-array #18

jonaskello opened this issue Apr 8, 2017 · 1 comment
Projects

Comments

@jonaskello
Copy link
Owner

if the function has return [1, 2, 3] without explicit return type that needs to be checked too.

@jonaskello jonaskello added the bug label Apr 8, 2017
@jonaskello jonaskello added this to TODO in Work Apr 8, 2017
@jonaskello jonaskello moved this from TODO to Doing in Work Apr 9, 2017
jonaskello added a commit that referenced this issue Apr 9, 2017
@jonaskello
Copy link
Owner Author

jonaskello commented Apr 9, 2017

Turns out this is quite hard to detect. It is easy in this case:

return [1, 2, 3];

But it gets harder if you have a return statement like this:

return [1, 2, 3] === [1, 2, 3];

To detect it properly we probably need to have full type-checking but that will slow down performance. Perhaps it is better to skip implicit return type checking and instead recommend that the this built-in rule is enabled:

"typedef": [true, "call-signature"]

That will ensure that all functions have an explicit return type and will avoid the problem of returning mutable things implicitly.

@jonaskello jonaskello moved this from Doing to Done in Work Apr 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Work
Done
Development

No branches or pull requests

1 participant