Skip to content

Commit 9a545ba

Browse files
authored
[libembind_gen.js] Add missing dependency. NFC (#24124)
Fixes: #24120
1 parent 9be7fb4 commit 9a545ba

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

src/lib/libembind_gen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ var LibraryEmbind = {
347347
out.push('\n};\n\n');
348348
}
349349
},
350-
$TsPrinter__deps: ['$OptionalType'],
350+
$TsPrinter__deps: ['$OptionalType', '$ClassDefinition'],
351351
$TsPrinter: class {
352352
constructor(definitions) {
353353
this.definitions = definitions;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <emscripten/bind.h>
2+
3+
using namespace emscripten;
4+
5+
int SOME_CONSTANT = 15;
6+
7+
EMSCRIPTEN_BINDINGS(Foo) {
8+
constant("SOME_CONSTANT", SOME_CONSTANT);
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// TypeScript bindings for emscripten-generated code. Automatically generated at compile time.
2+
interface WasmModule {
3+
}
4+
5+
interface EmbindModule {
6+
SOME_CONSTANT: number;
7+
}
8+
9+
export type MainModule = WasmModule & EmbindModule;

test/test_other.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3558,6 +3558,11 @@ def test_embind_tsgen_val(self):
35583558
'-lembind', '--emit-tsd', 'embind_tsgen_val.d.ts'])
35593559
self.assertExists('embind_tsgen_val.d.ts')
35603560

3561+
def test_embind_tsgen_constant_only(self):
3562+
self.run_process([EMCC, test_file('other/embind_tsgen_constant_only.cpp'),
3563+
'-lembind', '--emit-tsd', 'out.d.ts'])
3564+
self.assertFileContents(test_file('other/embind_tsgen_constant_only.d.ts'), read_file('out.d.ts'))
3565+
35613566
def test_embind_tsgen_bigint(self):
35623567
args = [EMXX, test_file('other/embind_tsgen_bigint.cpp'), '-lembind', '--emit-tsd', 'embind_tsgen_bigint.d.ts']
35633568
# Check that TypeScript generation fails when code contains bigints but their support is not enabled

0 commit comments

Comments
 (0)