Skip to content

Fix circular return type issue #26236

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

Merged
merged 12 commits into from
Aug 6, 2018
Merged

Fix circular return type issue #26236

merged 12 commits into from
Aug 6, 2018

Conversation

ahejlsberg
Copy link
Member

With this PR we consistently defer resolving signature return types such that our circularity detection logic can properly catch circular references in return types.

This PR also consolidates a bunch of ad hoc logic we had in place to determine whether a function has a declared or inferred return type. The correct way to determine that now is to use the getReturnTypeFromAnnotation function which returns the declared type or undefined if the type needs to be inferred from the body (using getReturnTypeFromBody). In the process of this consolidation I fixed several issues related to JSDoc @type annotations.

Fixes #26104.

# Conflicts:
#	tests/baselines/reference/recursiveResolveDeclaredMembers.types
#	tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.types
# Conflicts:
#	src/compiler/diagnosticMessages.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type alias circular reference does not error and causes implicit any
2 participants