Skip to content

No support for rest paramaters #2291

Closed
@rfl890

Description

@rfl890

I have the following code:

export function add(...args: Uint32Array): i32 {
  return args.reduce((a, b) => a + b, 0)
}

I'm getting error "AS215: Optional parameter must have an initializer.":

image

When I try to add initializer:

export function add(...args = []: Uint32Array): i32 {
  return args.reduce((a, b) => a + b, 0)
}

Then I'm getting error "TS1048: A rest parameter cannot have an initializer":

image

Originally posted by @jerrygreen in #377 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions