Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: typescript issues #794

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: added TresControl type anf dixed minor type issues
  • Loading branch information
alvarosabu committed Jul 31, 2024
commit 0c640daba67cbae026da05b73a7801d427b403cc
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
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