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(...[1,2,3]); Parameter does not support spread operator. #15387

Closed
mishengqiang opened this issue Apr 26, 2017 · 5 comments
Closed
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Milestone

Comments

@mishengqiang
Copy link

TypeScript Version: 2.2.2

Code

console.log(...[1,2,3]);

Expected behavior:
I can use the spread operator and can compile it. As in the image below in Chrome DevTools.

image

Actual behavior:
Error Message: Supplied parameters do not match any signature of call target.

image

@saschanaz
Copy link
Contributor

saschanaz commented Apr 26, 2017

Function definition is strange, it should be as following on lib.d.ts:

interface Console {
  log(...data: any[]): void;
}

https://console.spec.whatwg.org/#idl-index

@mhegazy
Copy link
Contributor

mhegazy commented Apr 26, 2017

The general case is a duplicate of #15375 and #5296.

For this specific one, as noted by @saschanaz, a fix to lib.d.ts should do the trick. PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.

@mhegazy mhegazy added Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Bug A bug in TypeScript labels Apr 26, 2017
@mhegazy mhegazy added this to the Community milestone Apr 26, 2017
@mhegazy mhegazy added the Help Wanted You can do this label Apr 26, 2017
@alex3165
Copy link

@RyanCavanaugh RyanCavanaugh modified the milestones: Community, Backlog Mar 7, 2019
@jakebailey
Copy link
Member

console.log has been typed properly (as previously defined in this thread) for a super long time.

@saschanaz
Copy link
Contributor

🎉 for myself. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

6 participants