emscripten-core / emscripten-core/emscripten
Embind TSD should map `void` to `undefined`
Open
embind
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
In raw C/C++ -> JS FFI, `void` return is represented as `undefined`.
TypeScript definitions currently represent it as `void`, which is a distinct type which tells consumers "you must ignore the result type of this function, although it can be any type underneath". So you won't be able to return such result in contexts where specifically `undefined` is expected, because values might be incompatible.
TL;DR `void` should be turned into `undefined`.
Contributor guide
Assessment
This issue has not been assessed yet.