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

fix: support for generic functions #2159

Open
wants to merge 3 commits into
base: next
Choose a base branch
from

Conversation

arthurfiorette
Copy link
Collaborator

@arthurfiorette arthurfiorette commented Jan 23, 2025

Previously, functions like:

function fn<A>(a: A) {
  return { a }
}

const result = fn(1)
//             ^ throws 

would throw even when not in use because it would parse the function without a reference to each parameter on their respective call, since A is generic but in the case of fn(1), A is number.

I added some extra security checks to avoid undefined errors being thrown without extra information about the actual node.

📦 Published PR as canary version: 2.3.1--canary.2159.782ac82.0

✨ Test out this PR locally via:

npm install [email protected]
# or 
yarn add [email protected]

@arthurfiorette arthurfiorette self-assigned this Jan 23, 2025
@arthurfiorette
Copy link
Collaborator Author

Probably continuation of #1978

Copy link
Member

@domoritz domoritz left a comment

Choose a reason for hiding this comment

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

Tests are failing but overall looks reasonable.

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.

2 participants