Skip to content

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