Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

return-undefined: various bug fixes #3298

Merged
merged 2 commits into from Oct 20, 2017
Merged

return-undefined: various bug fixes #3298

merged 2 commits into from Oct 20, 2017

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented Oct 7, 2017

PR checklist

Overview of change:

[bugfix] return-undefined fixed regressions: once again allows anything if return type is any
Fixes: #2812
[bugfix] return-undefined declared return type takes precedence over contextual type
[bugfix] return-undefined handles union return types in async functions
Fixes: #3234

Is there anything you'd like reviewers to focus on?

CHANGELOG.md entry:

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge when ready. let's include this in 5.8.0.

@@ -93,11 +93,13 @@ export function someAncestor(node: ts.Node, predicate: (n: ts.Node) => boolean):
return predicate(node) || (node.parent !== undefined && someAncestor(node.parent, predicate));
}

export function ancestorWhere<T extends ts.Node>(node: ts.Node, predicate: (n: ts.Node) => boolean): ts.Node | undefined {
export function ancestorWhere<T extends ts.Node>(node: ts.Node, predicate: (n: ts.Node) => n is T): T | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, I like the type guard. do we still need the other non-type-guard function signature?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it there to avoid breaking custom rules that might use this exported API.

@ajafff ajafff merged commit cc3d19d into palantir:master Oct 20, 2017
@ajafff ajafff deleted the bugfix/return-undefined branch October 20, 2017 07:34
HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

return-undefined false positive with async function return-undefined false positive
2 participants