Skip to content

"module": "node16" gives contradictory error about import assertionsΒ #50653

Closed
@kidonng

Description

@kidonng

Bug Report

πŸ”Ž Search Terms

module node16 import assertions

πŸ•— Version & Regression Information

Happened in 4.8.2, also 4.7.4 and 4.8 beta in playground.

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

const file = "foo.json"
const test = await import(file, {assert: {type: 'json'}})
export {}

πŸ™ Actual behavior

Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.

πŸ™‚ Expected behavior

No error

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix 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