emscripten-core / emscripten-core/emscripten

Embind TSD should map `void` to `undefined`

Open
#20,565 0 comments 0 reactions 1 assignee Claimed by @brendandahl View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.