diff --git a/packages/fiber/src/three-types.ts b/packages/fiber/src/three-types.ts index ede2fe761a..6b0a56405c 100644 --- a/packages/fiber/src/three-types.ts +++ b/packages/fiber/src/three-types.ts @@ -6,22 +6,21 @@ import type { Args, EventHandlers, InstanceProps, ConstructorRepresentation } fr import type { Overwrite, Mutable } from './core/utils' export interface MathRepresentation { - set(...args: any[]): any + set(...args: number[]): any } export interface VectorRepresentation extends MathRepresentation { setScalar(value: number): any } +export type MathTypes = MathRepresentation | THREE.Euler | THREE.Color -export type MathType = T extends THREE.Color +export type MathType = T extends THREE.Color ? Args | THREE.ColorRepresentation : T extends VectorRepresentation | THREE.Layers | THREE.Euler ? T | Parameters | number : T | Parameters export type MathProps

= { - [K in keyof P as P[K] extends MathRepresentation ? K : never]: P[K] extends MathRepresentation - ? MathType - : never + [K in keyof P as P[K] extends MathTypes ? K : never]: P[K] extends MathTypes ? MathType : never } export type Vector2 = MathType diff --git a/packages/fiber/tests/__snapshots__/index.test.tsx.snap b/packages/fiber/tests/__snapshots__/index.test.tsx.snap index 946c1613f4..13d237b30a 100644 --- a/packages/fiber/tests/__snapshots__/index.test.tsx.snap +++ b/packages/fiber/tests/__snapshots__/index.test.tsx.snap @@ -40,6 +40,7 @@ Array [ "MathProps", "MathRepresentation", "MathType", + "MathTypes", "Matrix3", "Matrix4", "ObjectMap",