Skip to content

Commit

Permalink
fix: typescript issues (#794)
Browse files Browse the repository at this point in the history
* fix: added TresControl type anf dixed minor type issues

* fix: export VectorFlexibleParams types
  • Loading branch information
alvarosabu authored Aug 1, 2024
1 parent e638946 commit eecf608
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/composables/useTresContextProvider/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useFps, useMemory, useRafFn } from '@vueuse/core'
import { computed, inject, onUnmounted, provide, readonly, ref, shallowRef } from 'vue'
import type { Camera, EventDispatcher, WebGLRenderer } from 'three'
import type { Camera, WebGLRenderer } from 'three'
import { Raycaster } from 'three'
import type { ComputedRef, DeepReadonly, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef } from 'vue'
import { calculateMemoryUsage } from '../../utils/perf'
import { useCamera } from '../useCamera'
import type { UseRendererOptions } from '../useRenderer'
import { useRenderer } from '../useRenderer'
import { extend } from '../../core/catalogue'
import type { EmitEventFn, TresObject, TresScene } from '../../types'
import type { EmitEventFn, TresControl, TresObject, TresScene } from '../../types'

import { type TresEventManager, useTresEventManager } from '../useTresEventManager'
import useSizes, { type SizesType } from '../useSizes'
Expand Down Expand Up @@ -54,7 +54,7 @@ export interface TresContext {
extend: (objects: any) => void
camera: ComputedRef<Camera | undefined>
cameras: DeepReadonly<Ref<Camera[]>>
controls: Ref<(EventDispatcher & { enabled: boolean }) | null>
controls: TresControl | null
renderer: ShallowRef<WebGLRenderer>
raycaster: ShallowRef<Raycaster>
perf: PerformanceState
Expand Down
2 changes: 1 addition & 1 deletion src/devtools/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export function registerTresDevtools(app: DevtoolsApp, tres: TresContext) {
object: Object.entries(instance)
.map(([key, value]) => {
if (key === 'children') {
return { key, value: value.filter(child => child.type !== 'HightlightMesh') }
return { key, value: value.filter((child: { type: string }) => child.type !== 'HightlightMesh') }
}
return { key, value, editable: true }
})
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ export {
templateCompilerOptions,
dispose,
}

export type { VectorFlexibleParams } from './utils/normalize'
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export type TresColorArray = typeof THREE.Color | [color: THREE.ColorRepresentat
export type TresLayers = THREE.Layers | Parameters<THREE.Layers['set']>[0]
export type TresQuaternion = THREE.Quaternion | Parameters<THREE.Quaternion['set']>
export type TresEuler = THREE.Euler
export type TresControl = THREE.EventDispatcher & { enabled: boolean }

type WithMathProps<P> = { [K in keyof P]: P[K] extends MathRepresentation | THREE.Euler ? MathType<P[K]> : P[K] }

Expand Down

0 comments on commit eecf608

Please sign in to comment.