Skip to content

TS 4.1 should support require with nested binding patterns #40143

Closed
@sandersn

Description

@sandersn

prettier uses nested binding patterns to import multiple things from "namespaces":

Code

const {
  builders: {
    concat,
    join
  },
  utils: {
    nub,
    intercalate
  }
} = require('../document')

(Identifier names have been changed to make fun of Haskell.)

Expected behavior:

nub :: Eq a => [a] -> [a]

Actual behavior:

error "Module '../document' has no exported member 'nub'.", and nub: any.

This worked before switching const x = require to create real aliases, and needs to work afterwards.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptExperience EnhancementNoncontroversial enhancementsFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions