Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console.log not variadic #133

Closed
CharlesTaylor7 opened this issue Apr 13, 2024 · 2 comments
Closed

console.log not variadic #133

CharlesTaylor7 opened this issue Apr 13, 2024 · 2 comments
Labels
bug Something isn't working definitions Invalid/missing type definition

Comments

@CharlesTaylor7
Copy link
Contributor

CharlesTaylor7 commented Apr 13, 2024

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.

@kaleidawave kaleidawave changed the title Variadic function calls console.log not variadic Apr 14, 2024
@kaleidawave kaleidawave added bug Something isn't working definitions Invalid/missing type definition labels Apr 14, 2024
@kaleidawave
Copy link
Owner

kaleidawave commented Apr 14, 2024

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 🤷‍♂️

@kaleidawave
Copy link
Owner

This specific issue is fixed in #135

image

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working definitions Invalid/missing type definition
Projects
None yet
Development

No branches or pull requests

2 participants