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

Handle non-optional nullable type #72

Open
nrigaudiere opened this issue Sep 27, 2023 · 0 comments
Open

Handle non-optional nullable type #72

nrigaudiere opened this issue Sep 27, 2023 · 0 comments
Labels
feature New feature or request
Milestone

Comments

@nrigaudiere
Copy link
Member

Some Web APIs says “This parameter is not optional, but can be set to null”.

jsruntime does not support this for now:

  • a nullable parameter (ie. ?<Type>) is translated as an optional parameter
  • and if you remove the nullable modifier (ie. <Type>) a null value is not allowed

The easiest way to handle that would be to keep ?<Type> for optional parameter and create custom type for mandatory nullable parameter <NullableType>, eg. NullableNumber or NullableNode.

It’s a bit verbose but we can use a comptime function generator to help with that.

Maybe another solution is possible.

@francisbouvier francisbouvier added this to the Public Beta milestone Sep 28, 2023
@francisbouvier francisbouvier transferred this issue from another repository Sep 29, 2023
@francisbouvier francisbouvier added the feature New feature or request label Sep 29, 2023
@francisbouvier francisbouvier changed the title Handle non-optional nullable type in jsruntime Handle non-optional nullable type Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants