Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Repl has "Unexpected token ','" when both await and second argument to dynamic import are used #47463

Copy link
Copy link
@Jamesernator

Description

@Jamesernator
Issue body actions

Version

v19.8.1

Platform

Linux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

repl

What steps will reproduce the bug?

Try in the repl:

> let packageJSON = await import("./package.json", { assert: { type: "json" } })

Uncaught SyntaxError: 
let packageJSON = await import("./package.json", { assert: { type: "json" } })
                                               ^

Unexpected token ','

How often does it reproduce? Is there a required condition?

This happens consistently, curiously the features seem to work separately but not together:

// Both of these are fine:
> let p = import("./package.json", { assert: { type: "json" } });
> let p = await import("./package.json"); // Runtime error due to missing second arg

What is the expected behavior? Why is that the expected behavior?

This should parse as it is perfectly valid syntax (and it works without await).

What do you see instead?

The error:

Uncaught SyntaxError: 
let packageJSON = await import("./package.json", { assert: { type: "json" } })
                                               ^

Unexpected token ','

Additional information

There was recently changes to the import assertions proposal to change assert to with (along with changes to affect runtime), but even with that the parsing of the above would be the same anyway.

mirek

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.