Skip to content

Is it possible to override the automatically generated typescript definition #1962

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

Closed
GeorgeScrivener opened this issue Jan 16, 2020 · 1 comment
Labels

Comments

@GeorgeScrivener
Copy link

GeorgeScrivener commented Jan 16, 2020

Is there any way to override the automatically generated typescript definitions?

I have the following problem:

// Rust definition:
pub fn render(context: web_sys::CanvasRenderingContext2d)

// Automatically generated typescript definition:
render(context: any): void;

// Signature I want:
render(context: CanvasRenderingContext2D): void;

I had a look at typescript_custom_section but that doesn't seem to do what I need.

What work would be required to improve the typescript generation for web_sys code?

This appears to be similar to issues #1847 & #1691

@alexcrichton
Copy link
Contributor

Thanks for the report! I think this is a duplicate of #1691 so I'm gonna close in favor of that. Having the types for web-sys show up I think would unfortunately be pretty difficult, but may be worth pursuing as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants