-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #561 from pixijs/fix-constructor-options
fix: Remove union types from ConstructorOptions
- Loading branch information
Showing
2 changed files
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import { type GraphicsContext, type Texture } from 'pixi.js'; | ||
import { type ConstructorOverrides } from './ConstructorOverrides'; | ||
|
||
type ConstructorOptionExcludes = GraphicsContext | Texture; | ||
|
||
/** | ||
* We're adding a specific options type overrides for some components because their deprecated overloads get in the way. | ||
* @see https://github.com/pixijs/pixi-react/issues/500 | ||
*/ | ||
export type ConstructorOptions<T extends new (...args: any[]) => any> = | ||
Extract<ConstructorOverrides, { 0: T }> extends [T, infer R] | ||
? unknown extends R | ||
? ConstructorParameters<T>[0] | ||
? NonNullable<Exclude<ConstructorParameters<T>[0], ConstructorOptionExcludes>> | ||
: R | ||
: unknown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters