Register custom components in the PixiElements type catalogue
mainTo prevent TypeScript errors when using custom components, you must add them to the PixiElements interface via module augmentation. This allows the library's type system to recognize your custom elements.
// global.d.ts
import { type Viewport } from 'pixi-viewport';
import { type PixiReactElementProps } from '@pixi/react';
declare module '@pixi/react'
{
interface PixiElements
{
viewport: PixiReactElementProps<typeof Viewport>;
}
}