Skip to content

parser: object destructuring in ambient module/namespace #5958

@DonIsaac

Description

@DonIsaac

This code should parse with no errors

declare module "foo" {
    let {a: x, b: x1}: {a: number, b: number}; // valid b/c ambient context
}

declare namespace Bar {
    let {a: x, b: x1}: {a: number, b: number}; // valid b/c ambient context
}

But it errors with

Error: Missing initializer in destructuring declaration

It looks like Context::Ambient is not getting updated correctly, even though it should be in parse_ts_declaration_statement

Metadata

Metadata

Assignees

Labels

A-parserArea - ParserC-bugCategory - Bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions