Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AST change proposal: Improve TSModuleDeclaration #6440

Closed
@fisker

Description

@fisker

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

ast-spec

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

Currently

module a.b {}
^^^^^^^^^^^^^ TSModuleDeclaration(a)
       ^      TSModuleDeclaration(a).id
         ^^^^ TSModuleDeclaration(b)
         ^    TSModuleDeclaration(b).id
           ^^ TSModuleBlock

Can we change it to

module a.b {}
^^^^^^^^^^^^^ TSModuleDeclaration
       ^^^    TSModuleDeclaration.id
           ^^ TSModuleBlock

?

Another problem is we parse the following code as the same ast

namespace a {}
module a {}

Prettier can't distinguish them without the original code. Failure detection

Maybe add TSNamespaceDeclaration or TSModuleDeclaration.namespace?

Fail

N/a

Pass

N/a

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions