diff --git a/eslint.config.mjs b/eslint.config.mjs index c349ec55..2657c51e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -12,6 +12,12 @@ export default [ { rules: { 'max-len': 0, + '@typescript-eslint/no-empty-object-type': [ + 0, + { + allowInterfaces: 'with-single-extends', + }, + ], }, }, { @@ -20,7 +26,6 @@ export default [ '*.test.tsx', ], rules: { - '@typescript-eslint/no-unused-expressions': 0, '@typescript-eslint/dot-notation': [ 0, { @@ -29,6 +34,7 @@ export default [ allowIndexSignaturePropertyAccess: true, }, ], + '@typescript-eslint/no-unused-expressions': 0, 'dot-notation': 0, }, }, diff --git a/src/global.ts b/src/global.ts index 9a1651fb..c0b27b88 100644 --- a/src/global.ts +++ b/src/global.ts @@ -1,4 +1,3 @@ -import { type NamespacedPixiElements } from './typedefs/NamespacedPixiElements'; import { type PixiElements } from './typedefs/PixiElements'; import type {} from 'react'; @@ -10,7 +9,7 @@ declare module 'react' // eslint-disable-next-line @typescript-eslint/no-namespace namespace JSX { - interface IntrinsicElements extends PixiElements, NamespacedPixiElements {} + interface IntrinsicElements extends PixiElements {} } } @@ -19,7 +18,7 @@ declare module 'react/jsx-runtime' // eslint-disable-next-line @typescript-eslint/no-namespace namespace JSX { - interface IntrinsicElements extends PixiElements, NamespacedPixiElements {} + interface IntrinsicElements extends PixiElements {} } } @@ -28,6 +27,6 @@ declare module 'react/jsx-dev-runtime' // eslint-disable-next-line @typescript-eslint/no-namespace namespace JSX { - interface IntrinsicElements extends PixiElements, NamespacedPixiElements {} + interface IntrinsicElements extends PixiElements {} } } diff --git a/src/index.ts b/src/index.ts index e8879a07..20bcff12 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,4 +18,6 @@ export { useExtend } from './hooks/useExtend'; export { useSuspenseAssets } from './hooks/useSuspenseAssets'; export { useTick } from './hooks/useTick'; export { type ApplicationRef } from './typedefs/ApplicationRef'; +export { type PixiElements } from './typedefs/PixiElements'; export { type PixiReactElementProps } from './typedefs/PixiReactNode'; +export { type UnprefixedPixiElements } from './typedefs/UnprefixedPixiElements'; diff --git a/src/typedefs/HostConfig.ts b/src/typedefs/HostConfig.ts index 97bf6b33..817c749a 100644 --- a/src/typedefs/HostConfig.ts +++ b/src/typedefs/HostConfig.ts @@ -2,7 +2,6 @@ import { type Container, type Filter, } from 'pixi.js'; -import { type NamespacedPixiElements } from './NamespacedPixiElements'; import { type PixiElements } from './PixiElements'; import { type PixiReactNode } from './PixiReactNode'; @@ -21,7 +20,7 @@ export interface HostConfig suspenseInstance: PixiReactNode; textInstance: PixiReactNode; timeoutHandle: number; - type: keyof PixiElements | keyof NamespacedPixiElements; + type: keyof PixiElements; updatePayload: object; transitionStatus: null, } diff --git a/src/typedefs/NamespacedPixiElements.ts b/src/typedefs/NamespacedPixiElements.ts deleted file mode 100644 index e413cefe..00000000 --- a/src/typedefs/NamespacedPixiElements.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { type PixiElements } from './PixiElements'; - -export type NamespacedPixiElements = { - [K in keyof PixiElements as `pixi${Capitalize}`]: PixiElements[K]; -}; diff --git a/src/typedefs/PixiElements.ts b/src/typedefs/PixiElements.ts index 72b908a1..de1992d8 100644 --- a/src/typedefs/PixiElements.ts +++ b/src/typedefs/PixiElements.ts @@ -1,10 +1,3 @@ -import { type NameOverrides } from '../constants/NameOverrides'; -import { type PixiComponents } from './PixiComponents'; -import { type PixiReactElementProps } from './PixiReactNode'; +import { type PrefixedPixiElements } from './PrefixedPixiElements'; -import type * as PIXI from 'pixi.js'; - -export type PixiElements = { - [K in PixiComponents as K extends keyof typeof NameOverrides ? typeof NameOverrides[K] : Uncapitalize]: - PixiReactElementProps; -}; +export interface PixiElements extends PrefixedPixiElements {} diff --git a/src/typedefs/PrefixedPixiElements.ts b/src/typedefs/PrefixedPixiElements.ts new file mode 100644 index 00000000..a9e0190a --- /dev/null +++ b/src/typedefs/PrefixedPixiElements.ts @@ -0,0 +1,5 @@ +import { type UnprefixedPixiElements } from './UnprefixedPixiElements'; + +export type PrefixedPixiElements = { + [K in keyof UnprefixedPixiElements as `pixi${Capitalize}`]: UnprefixedPixiElements[K]; +}; diff --git a/src/typedefs/UnprefixedPixiElements.ts b/src/typedefs/UnprefixedPixiElements.ts new file mode 100644 index 00000000..5529a566 --- /dev/null +++ b/src/typedefs/UnprefixedPixiElements.ts @@ -0,0 +1,10 @@ +import { type NameOverrides } from '../constants/NameOverrides'; +import { type PixiComponents } from './PixiComponents'; +import { type PixiReactElementProps } from './PixiReactNode'; + +import type * as PIXI from 'pixi.js'; + +export type UnprefixedPixiElements = { + [K in PixiComponents as K extends keyof typeof NameOverrides ? typeof NameOverrides[K] : Uncapitalize]: + PixiReactElementProps; +};