Skip to content

Exported namespace class suppresses TS1308 for await in computed member names#63712

Description

@mohsen1

馃攷 Search Terms

await, namespace, computed property, computed member, TS1308, export class, top-level await

馃晽 Version & Regression Information

This occurs in every version tested: 7.0.2 and 7.1.0-dev.20260802.1 (nightly). I reviewed the FAQ and searched open and closed issues.

馃捇 Code

declare const x: string;

namespace N {
  class A { [await x]() {} }        // TS1308
  export class B { [await x]() {} } // no error
}

export {};

馃檨 Actual behavior

export suppresses TS1308. The emitted await is inside the namespace's synchronous IIFE, producing invalid JavaScript.

馃檪 Expected behavior

Both computed names report TS1308.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions