Skip to content

Allow users to pass null as an optional argument #24211

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
GulgDev opened this issue Apr 29, 2025 · 2 comments
Open

Allow users to pass null as an optional argument #24211

GulgDev opened this issue Apr 29, 2025 · 2 comments
Assignees
Labels

Comments

@GulgDev
Copy link

GulgDev commented Apr 29, 2025

Currently, optional types only allow undefined. Is it possible to register an optional type that allows null as well as undefined?

@sbc100
Copy link
Collaborator

sbc100 commented Apr 29, 2025

Can you elaborate a little more? Is this perhaps an issue with embind? Maybe the typescript bindings produced by emcc?

@GulgDev
Copy link
Author

GulgDev commented Apr 30, 2025

Bindings for std::optional only allow undefined to be passed from JS (passing null as an optional argument throws an error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants