Skip to main content

2D · guides · Core Concepts

On this page

Using PixiJS with TypeScript

PixiJS supports WebGPU, so its type declarations depend on the WebGPU types. Where those come from depends on your TypeScript version.

TypeScript 5​

TypeScript 5 has no WebGPU types built in, so PixiJS adds @webgpu/types for you. No additional setup required.

TypeScript 6 and 7​

TypeScript 6 and 7 build the WebGPU types into the "dom" library, but some releases leave parts out, such as GPUTextureUsage. Use @types/web, which has the full set, in place of "dom". Remove @webgpu/types from types if it's there, since it conflicts with the built-in types.

npm install --save-dev @types/web
{
"compilerOptions": {
"lib": ["esnext"],
"types": ["@types/web"]
}
}