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

Error TS2304: Cannot find name 'Canvas2DContextAttributes'. #120

Open
jkaldon opened this issue Mar 12, 2019 · 9 comments
Open

Error TS2304: Cannot find name 'Canvas2DContextAttributes'. #120

jkaldon opened this issue Mar 12, 2019 · 9 comments

Comments

@jkaldon
Copy link

jkaldon commented Mar 12, 2019

Jake,

I was working on a personal project, Polychromasia, when I ran into the error below. I'm not sure how to address this problem cleanly. Do you have any suggestions?

Thanks,

  • Joshua

Canvasimo Error

@JakeSidSmith
Copy link
Owner

Hi, @jkaldon . Can I ask which version of TypeScript you are using, and can you share your tsconfig.json?

@JakeSidSmith
Copy link
Owner

Never mind, I can see them. XD It's early.

@JakeSidSmith
Copy link
Owner

So, it seems Canvas2DContextAttributes was removed from the standard typescript lib at some point. I'll have to look into this further.

If you add "skipLibCheck": true to your tsconfig.json you should avoid this error.

@JakeSidSmith
Copy link
Owner

Okay, seems it was renamed here: microsoft/TypeScript@ee25cde#diff-46fd87925e4552c166ec188712741c3fR5899

I'll try to update when I have some time. 🙂

@jkaldon
Copy link
Author

jkaldon commented Mar 12, 2019

Cool, thanks!

In case it matters, here's my project:
https://github.com/jkaldon/polychromasia-web

@JakeSidSmith
Copy link
Owner

Hey, @jkaldon . Thought I should probably give you an update:

I have fixed the issue, but I can't publish it as there's something wrong with the documentation generation at the moment. I'm looking into this, but I'm a bit stumped - seeking help from the community.

For now a better solution than skipping the lib check might be to add a global alias for the renamed type.

You should be able to put the following in a global type declaration:

type Canvas2DContextAttributes = CanvasRenderingContext2DSettings;

I haven't tried this myself, but in theory it should work nicely. If you're not sure how to do this I'd be happy to fork your repo and open a PR for you. 🙂

@jkaldon
Copy link
Author

jkaldon commented Apr 17, 2019

Thanks for the update, @JakeSidSmith . For now, I'm content with your skip lib check option until the real fix is possible. I'm not really in any rush.

@JakeSidSmith
Copy link
Owner

Just published 0.7.0 which should fix this issue. 😊

@JakeSidSmith
Copy link
Owner

You'll want to npm i canvasimo@0.7.0 as I've introduced some new bugs in 0.7.1 and 0.7.2. Oops.

Will be sorting those asap.

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

No branches or pull requests

2 participants