Skip to content

Support rest parameters #377

Closed
Closed
@LiaoPeng

Description

@LiaoPeng

I hope that variable parameters supported.

When I compiled the below codes.

function sum(...args: i32[]): i32 {
    let total: i32 = 0;
    for (let index = 0; index < args.length; index ++) {
        total += args[index];
    }
    return total;

}
assert(sum(1, 2, 3) == 6);

I got the errors.

ERROR TS2554: Expected 1 arguments, but got 3.

btw, the online studio was unavailable.

ERROR: Entry file 'main.ts' not found.

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