Skip to content

feat: support infer function parameter type from initial value #2283

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

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

Conversation

Frezc
Copy link

@Frezc Frezc commented Jun 19, 2025

fix #2272

}),
false,
);
}

function getParameterName(node: ts.BindingName, index: number) {
if (node.parent) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (node.parent) {
if (node.parent && node.pos !== -1) {

Programatically created nodes don't have text information.

Copy link
Author

Choose a reason for hiding this comment

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

I don't get why the condition node.pos !== -1 should be added. node.parent should not be sufficient?

alexchexes added a commit to alexchexes/ts-json-schema-generator that referenced this pull request Jun 23, 2025
…argument default

- Work on inferring still in progress, arg with type function is not handled; + see the existing vega#2283
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.

Function parameters without declared types will result in an error: Invalid value used as weak map key
2 participants