Skip to content

Commit 78fea09

Browse files
authored
[tsgen] Error out when using --emit-tsd with wasm only output. (#21742)
Fixes #21740
1 parent 7ca4979 commit 78fea09

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

test/test_other.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3307,6 +3307,11 @@ def test_emit_tsd(self):
33073307
cmd = shared.get_npm_cmd('tsc') + [test_file('other/test_tsd.ts'), '--noEmit']
33083308
shared.check_call(cmd)
33093309

3310+
def test_emit_tsd_wasm_only(self):
3311+
err = self.expect_fail([EMCC, test_file('other/test_emit_tsd.c'),
3312+
'--emit-tsd', 'test_emit_tsd_wasm_only.d.ts', '-o', 'out.wasm'])
3313+
self.assertContained('Wasm only output is not compatible --emit-tsd', err)
3314+
33103315
def test_emconfig(self):
33113316
output = self.run_process([emconfig, 'LLVM_ROOT'], stdout=PIPE).stdout.strip()
33123317
self.assertEqual(output, config.LLVM_ROOT)

tools/link.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,8 @@ def phase_linker_setup(options, state, newargs):
787787
settings.MODULARIZE = 1
788788

789789
if options.oformat in (OFormat.WASM, OFormat.BARE):
790+
if options.emit_tsd:
791+
exit_with_error('Wasm only output is not compatible --emit-tsd')
790792
# If the user asks directly for a wasm file then this *is* the target
791793
wasm_target = target
792794
elif settings.SINGLE_FILE or settings.WASM == 0:

0 commit comments

Comments
 (0)