News for hackers. Stuff that matters.
Re:Emerging JavaScript pattern: multiple return values by aurbano on Thursday October 29, 2020 @07:39AM (#24929413)
While the article does advocate for objects vs arrays for returning multiple values I wanted to address the second part of you comment.

It will work just fine in TypeScript, where you can define a "fixed size" array as a type:

    type Test = [number, string];
    const test: Test = [1, 'something'];
The second line will fail compilation if there's a different number of elements in that array, or if the types don't match.

There are no comments on this comment yet.