Skip to content

Accept bigint as value in BigIntLiteral #17367

@JLHwung

Description

@JLHwung

💻

  • Would you like to work on this feature?

What problem are you trying to solve?

The current BigIntLiteral stores a string representation of bigint. This is inconsistent with how other primitive literals are stored. For example, NumericLiteral stores the number as value.

Describe the solution you'd like

Add bigint: string property to BigIntLiteral to store the string representation. Change value: string to value: bigint. If a plugin depends on BigIntLiteral#value, they should switch to BigIntLiteral#bigint in Babel 8.

To smooth the transition, accept both string and bigint in the Babel 7 t.bigIntLiteral AST builder. In Babel the builder should only accept positive bigint.

Describe alternatives you've considered

N.A.

Documentation, Adoption, Migration Strategy

This feature is first suggested by @nicolo-ribaudo in #15801 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions