Skip to content

bogus error "Parenthesized expression cannot be empty" #60007

@samualtnorman

Description

@samualtnorman

Version

v22.8.0

Platform

Linux samual-nixos 6.12.48 #1-NixOS SMP PREEMPT_DYNAMIC Fri Sep 19 14:35:52 UTC 2025 x86_64 GNU/Linux

Subsystem

Modules: TypeScript

What steps will reproduce the bug?

const foo = (): (void) => {}

Run node script.ts

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

this is perfectly valid type-strippable typescript so would expect : (void) is stripped away as expected and the script is interpreted as

const foo = ()         => {}

What do you see instead?

❯ node script.ts
node:internal/modules/run_main:107
    triggerUncaughtException(
    ^

file:///home/[… SNIP …]/script.ts:1
const foo = (): (void) => {}
            ^^

SyntaxError [ERR_INVALID_TYPESCRIPT_SYNTAX]: Parenthesized expression cannot be empty
    at parseTypeScript (node:internal/modules/typescript:72:36)
    at processTypeScriptCode (node:internal/modules/typescript:146:42)
    at stripTypeScriptModuleTypes (node:internal/modules/typescript:209:22)
    at ModuleLoader.<anonymous> (node:internal/modules/esm/translators:645:16)
    at #translate (node:internal/modules/esm/loader:575:20)
    at afterLoad (node:internal/modules/esm/loader:625:29)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:630:12)
    at #createModuleJob (node:internal/modules/esm/loader:654:36)
    at #getJobFromResolveResult (node:internal/modules/esm/loader:354:34)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:319:41) {
  code: 'ERR_INVALID_TYPESCRIPT_SYNTAX'
}

Node.js v24.8.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.strip-typesIssues or PRs related to strip-types support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions