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

TraversedJSONPathBuilder.$castTo and .$notNull should return TraversedJSONPathBuilder instead of JSONPathBuilder? #1138

Closed
cassus opened this issue Sep 5, 2024 · 1 comment · Fixed by #1139
Labels
api Related to library's API bug Something isn't working typescript Related to Typescript

Comments

@cassus
Copy link
Contributor

cassus commented Sep 5, 2024

Hi,

TraversedJSONPathBuilder.as typechecks correctly:

eb
  .ref("healthScaleStepJson.healthScaleStepJson", "->>")
  .key("id")
  .as("formComponentId"),

TraversedJSONPathBuilder.$castTo typechecks correctly:

eb
  .ref("healthScaleStepJson.healthScaleStepJson", "->>")
  .key("id")
  .$castTo<FormComponentId>()

But when .$castTo and .as is combined it's a type error

eb
  .ref("healthScaleStepJson.healthScaleStepJson", "->>")
  .key("id")
  .$castTo<FormComponentId>()
  .as("formComponentId"), // <--- Property 'as' does not exist on type 'JSONPathBuilder

My guess is that this could be fixed if TraversedJSONPathBuilder.$castTo (and .$notNull which is very similar) returned TraversedJSONPathBuilder instead of JSONPathBuilder.

@igalklebanov
Copy link
Member

Hey 👋

Yeah, your assumption seems correct.

@igalklebanov igalklebanov added bug Something isn't working api Related to library's API typescript Related to Typescript labels Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to library's API bug Something isn't working typescript Related to Typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants