From 6fe397343e92d2dfe08c086f44d00288f5d839dc Mon Sep 17 00:00:00 2001 From: Trezy Date: Mon, 3 Jun 2024 10:49:28 -0500 Subject: [PATCH] fix: add better error handling for unavailable components --- src/helpers/createInstance.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/helpers/createInstance.js b/src/helpers/createInstance.js index dd331e7b..a4e4ed9e 100644 --- a/src/helpers/createInstance.js +++ b/src/helpers/createInstance.js @@ -19,6 +19,13 @@ export function createInstance(type, props) // Get the class from an imported Pixi.js namespace const TARGET = /** @type {new (...args: any[]) => any} */ (catalogue[name]); + if (!TARGET) + { + throw new Error( + `@react/pixi: ${name} is not part of the PIXI namespace! Did you forget to extend?`, + ); + } + let instance; // Create instance