question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API Extractor cannot find name OffscreenCanvas

See original GitHub issue

Hi, I’m trying to publish a TypeScript library npm package that includes Pixi, and Microsoft API Extractor is failing OffscreenCanvas

build:types
> tsc -p ./tsconfig.json --outDir build --declaration true && api-extractor run

node_modules/@pixi/core/index.d.ts:1543:45 - error TS2304: Cannot find name 'OffscreenCanvas'.

1543     static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement;
                                                 ~~~~~~~~~~~~~~~

node_modules/@pixi/text/index.d.ts:272:41 - error TS2304: Cannot find name 'OffscreenCanvas'.

272     static _canvas: HTMLCanvasElement | OffscreenCanvas;
                                            ~~~~~~~~~~~~~~~

node_modules/@pixi/text/index.d.ts:273:49 - error TS2304: Cannot find name 'OffscreenCanvasRenderingContext2D'.

273     static _context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@pixi/text/index.d.ts:300:105 - error TS2304: Cannot find name 'OffscreenCanvas'.

300     static measureText(text: string, style: TextStyle, wordWrap?: boolean, canvas?: HTMLCanvasElement | OffscreenCanvas): TextMetrics_2;
                                                                                                            ~~~~~~~~~~~~~~~

Think there’s some movement with offscreen canvas, maybe this has already been addressed.

FYI, or please advise if this seems in error.

Environment

  • pixi.js: 6.2.2
  • tslib: 2.3.1
  • TypeScript: 4.5.5
  • @microsoft/api-extractor: 7.19.4
  • OS & Version: macOS Monterey, Apple M1 Pro

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
bigtimebuddycommented, Feb 17, 2022

I’ve stubbed my toe on this too. If you add @types/offscreencanvas to your project it should fix. But we should add this as a dependency.

1reaction
kevincentiuscommented, May 10, 2022

I did now, thanks! It is here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript Cannot find offscreencanvas - Stack Overflow
As per my comment to your question. This seems to be a TypeScript version problem, but the version in your package.json seems to...
Read more >
Invoking API Extractor
The simplest way to invoke API Extractor is via the command-line. 1. Configure the TypeScript compiler for your project. For this tutorial, suppose...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Preview the new type of phishing-resistant credential that makes signing in to websites safer and easier. Available through Safari's WebAuthn platform ...
Read more >
cannot find name offscreencanvas, error ts2304
Method 1: Checking if OffscreenCanvas exists: The typeof operator is used to return a string of the type of the operand. The OffscreenCanvas...
Read more >
@vladmandic/face-api - npm Package Health Analysis | Snyk
Learn more about @vladmandic/face-api: package health score, popularity, ... period of the last 12 months, excluding weekends and known missing data points.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found