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.trace definition is invalid in /lib/lib.dom.d.ts #5433

Closed
wallride opened this issue Oct 28, 2015 · 8 comments
Closed

console.trace definition is invalid in /lib/lib.dom.d.ts #5433

wallride opened this issue Oct 28, 2015 · 8 comments
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@wallride
Copy link

console.trace(a,b,c,1,2,3) emits compilation error:

error TS2346: Supplied parameters do not match any signature of call target.

So, let's open the declaraion in /lib/lib.dom.d.ts:

interface Console {
    log(message?: any, ...optionalParams: any[]): void;
//  ......................
    trace(): void;
}

arguments should be the same as in log(message?: any, ...optionalParams: any[])

@mhegazy
Copy link
Contributor

mhegazy commented Oct 28, 2015

@wallride for now you can reopen the interface locally and define the missing signature as such:

interface Console {
    trace(...args: any[]): void;
}

@mhegazy mhegazy added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Oct 28, 2015
@mhegazy mhegazy added this to the TypeScript 1.8 milestone Oct 28, 2015
@wallride
Copy link
Author

@mhegazy, thanks for your reply! It was the first thing i've done. :) But transpiling via gulp-typescript still throws warnings. Though i've fixed every interface i could find.
Anyway, i supposed this issue would be useful for the typescript project.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 29, 2015

just out of curiosity, what are the errors you were getting from gulp?

@wallride
Copy link
Author

@mhegazy , oh just the same as i've written above.
Although i've optioned gulp-typescript to use TS from require('typescript'). And i've searched-and-replaced every d.ts file around typescript modules. Have no idea why it's still not satisfied. but errors don't block building process. so i move on.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 29, 2015

but you do not need to replace the definition in lib.d.ts, you can just augment it. so in one of your files, just add the new definition.. here is what i mean in the playground: http://www.typescriptlang.org/Playground#src=interface%20Console%20%7B%0D%0A%20%20%20%20trace(...args%3A%20any%5B%5D)%3A%20void%3B%0D%0A%7D%0D%0A%0D%0Aconsole.trace(%22message%22)%3B%20%2F%2F%20OK%0D%0A

@wallride
Copy link
Author

@mhegazy Yes, that is a some kind of solution. Thanks!
And declaration in lib.d.ts should be fixed anyway, i suppose :)

@mhegazy
Copy link
Contributor

mhegazy commented Oct 30, 2015

yup. the bug is open, should be fixed in TS1.8, but until then, no need to keep getting errors in your compilation.

@mhegazy
Copy link
Contributor

mhegazy commented Dec 8, 2015

PRs are welcomed. here is some documentation for adding new types to lib.d.ts: https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes

@mhegazy mhegazy added the Help Wanted You can do this label Dec 8, 2015
@mhegazy mhegazy modified the milestones: Community, TypeScript 1.8 Dec 8, 2015
@zhengbli zhengbli added Fixed A PR has been merged for this issue and removed Fixed in TSJS repo labels Jan 20, 2016
@mhegazy mhegazy modified the milestones: TypeScript 1.8, Community Jan 20, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

3 participants