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

errors with typescript 4.4 #9594

Closed
jacekkarczmarczyk opened this issue Aug 27, 2021 · 4 comments
Closed

errors with typescript 4.4 #9594

jacekkarczmarczyk opened this issue Aug 27, 2021 · 4 comments
Labels
type: bug type: types Typescript type changes
Milestone

Comments

@jacekkarczmarczyk
Copy link

Expected Behavior

no compilation errors

Current Behavior

ERROR in C:/cygwin64/home/PC/XXX/web/node_modules/chart.js/types/index.esm.d.ts(540,5):
540:5 Cannot find name 'OffscreenCanvasRenderingContext2D'.
    538 |   | string
    539 |   | CanvasRenderingContext2D
  > 540 |   | OffscreenCanvasRenderingContext2D
        |     ^
    541 |   | HTMLCanvasElement
    542 |   | OffscreenCanvas
    543 |   | { canvas: HTMLCanvasElement | OffscreenCanvas }
ERROR in C:/cygwin64/home/PC/XXX/web/node_modules/chart.js/types/index.esm.d.ts(542,5):
542:5 Cannot find name 'OffscreenCanvas'.
    540 |   | OffscreenCanvasRenderingContext2D
    541 |   | HTMLCanvasElement
  > 542 |   | OffscreenCanvas
        |     ^
    543 |   | { canvas: HTMLCanvasElement | OffscreenCanvas }
    544 |   | ArrayLike<CanvasRenderingContext2D | HTMLCanvasElement | OffscreenCanvas>;
    545 |
ERROR in C:/cygwin64/home/PC/XXX/web/node_modules/chart.js/types/index.esm.d.ts(543,35):
543:35 Cannot find name 'OffscreenCanvas'.
    541 |   | HTMLCanvasElement
    542 |   | OffscreenCanvas
  > 543 |   | { canvas: HTMLCanvasElement | OffscreenCanvas }
        |                                   ^
    544 |   | ArrayLike<CanvasRenderingContext2D | HTMLCanvasElement | OffscreenCanvas>;
    545 |
    546 | export declare enum UpdateModeEnum {
ERROR in C:/cygwin64/home/PC/XXX/web/node_modules/chart.js/types/index.esm.d.ts(544,62):
544:62 Cannot find name 'OffscreenCanvas'.
    542 |   | OffscreenCanvas
    543 |   | { canvas: HTMLCanvasElement | OffscreenCanvas }
  > 544 |   | ArrayLike<CanvasRenderingContext2D | HTMLCanvasElement | OffscreenCanvas>;
        |                                                              ^
    545 |
    546 | export declare enum UpdateModeEnum {
    547 |   resize = 'resize',
Version: typescript 4.4.2

Possible Solution

add @types/offscreencanvas maybe?

Steps to Reproduce

create a project with chart.js and typescript 4.4

Environment

  • Chart.js version: 3.5.1
  • Browser name and version: n/a
  • Link to your project: n/a
@etimberg etimberg added the type: types Typescript type changes label Sep 2, 2021
@ryanhuff
Copy link

ryanhuff commented Sep 2, 2021

I'm seeing this too. Any workarounds you've found?

@IceSentry
Copy link

Right now, I simply disabled typechecking of external libraries. It's far from ideal, but at least I can still compile and run my code

@etimberg
Copy link
Member

etimberg commented Sep 2, 2021

This was likely caused by microsoft/TypeScript#44684 which seems to have removed the OffscreenCanvasRenderingContext2D and OffscreenCanvas types because they're only available in Chrome.

@etimberg
Copy link
Member

Was resolved in #9617

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug type: types Typescript type changes
Projects
None yet
Development

No branches or pull requests

4 participants