pmed / v8pp

Bind C++ functions and classes into V8 JavaScript engine
http://pmed.github.io/v8pp/
Other
901 stars 121 forks source link

Enhance Support for std::optional and Empty std::variant #214

Open MangelSpec opened 4 months ago

MangelSpec commented 4 months ago

This pull request introduces mapping for std::optional return types and parameters, providing a more seamless integration with TypeScript's optional parameters. The new mapping reflects the following TypeScript optional parameter syntax:

var: type | undefined
type? var

In addition, this commit extends std::variant support to include std::monostate, which is treated as an undefined value.

pmed commented 3 months ago

Hi @MangelSpec

wow, thank you for adding this new featur, it looks really handy!

Maybe you have also a couple of use cases that may be added as test cases in test/test_convert.cpp?

I'm going to merge this PR right after fixing failing CI build, that isn’t green now on the master branch.