-
-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: get more specific with Instance types
- Loading branch information
Showing
13 changed files
with
50 additions
and
33 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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** @typedef {import('pixi.js').Container} Container */ | ||
/** @typedef {import('react').ReactElement} ReactElement */ | ||
|
||
/** @typedef {Container & ReactElement} ContainerElement */ | ||
export const ContainerElement = {}; |
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,13 +1,15 @@ | ||
/** @typedef {import('pixi.js').Container} Container */ | ||
|
||
/** @typedef {import('./ContainerElement.js').ContainerElement} ContainerElement */ | ||
/** @typedef {import('./EventHandlers.js').EventHandlers} EventHandlers */ | ||
/** @typedef {import('./InstanceState.js').InstanceState} InstanceState */ | ||
|
||
/** | ||
* @typedef {object} BaseInstance | ||
* @property {InstanceState} [__pixireact] | ||
* @property {boolean} [autoRemovedBeforeAppend] | ||
* @property {ContainerElement | ContainerElement[]} [children] | ||
* @property {(...args: any[]) => any} [draw] | ||
*/ | ||
|
||
/** @typedef {{ [key: string]: any } & Container & BaseInstance} Instance */ | ||
/** @typedef {ContainerElement & BaseInstance} Instance */ | ||
|
||
export const Instance = {}; |
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
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,4 +1,5 @@ | ||
/** @typedef {import('./Instance.js').Instance} Instance */ | ||
/** @typedef {import('./InstanceState.js').InstanceState} InstanceState */ | ||
|
||
/** @typedef {Omit<Instance, '__pixireact'> & object} MaybeInstance */ | ||
/** @typedef {import('./PartialBy.js').PartialBy<Instance, '__pixireact'>} MaybeInstance */ | ||
export const MaybeInstance = {}; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* @template T | ||
* @template {keyof T} K | ||
* @typedef {Omit<T, K> & Partial<Pick<T, K>>} PartialBy | ||
* @see https://stackoverflow.com/a/54178819 | ||
*/ | ||
export const PartialBy = {}; |