kaleidawave/ezno

`console.log` not variadic

Closed this issue · 2 comments

Checking

console.log("a", "b")

Yields an excess argument error.

But, console.log() is variadic though, so I would want this to work.


I'd be happy to work on this, but I'm not sure how builtin function declarations are handled.

Hey, that is correct and a bug!

Rest parameters / variadic functions and calling them has been implemented / is currently supported

You can see the calling implementation here

if self.parameters.parameters.len() < arguments.len() {


The issue is currently because Console is typed incorrectly:

declare class Console {
@InputOutput
log(msg: any): void;
}
declare const console: Console;

I think console.log was one of the first functions I added checking for and it was only a while later I added variadic functions. And thus I must have missed updating the definition

This is similar to #118 issue (which I left a comment on the status of reusing TypeScripts lib.d.ts definition). I have opened #121 which describes how I want to implement it (although it is not quite ready / waiting on some other things).

Unsure whether I should start doing #121 manually or wait for more checking features to be implemented 🤷‍♂️

This specific issue is fixed in #135

image

Of course hopefully #121 should wipe out this category of built in mismatches