Skip to content

Commit 8e52cf1

Browse files
authored
fix: correct type exporting issues (#625)
* fix: correct type exporting issues * chore: fix lint
1 parent 1650b34 commit 8e52cf1

File tree

8 files changed

+32
-31
lines changed

8 files changed

+32
-31
lines changed

components.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './dist/components/index.js'
1+
export * from './dist/src/components/index.js'

composables.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './dist/composables/index.js'
1+
export * from './dist/src/composables/index.js'

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
"import": "./dist/tres.js"
2222
},
2323
"./components": {
24-
"types": "./dist/components/index.d.ts"
24+
"types": "./dist/src/components/index.d.ts"
2525
},
2626
"./composables": {
27-
"types": "./dist/composables/index.d.ts"
27+
"types": "./dist/src/composables/index.d.ts"
2828
},
2929
"./types": {
30-
"types": "./dist/types/index.d.ts"
30+
"types": "./dist/src/types/index.d.ts"
3131
},
3232
"./utils": {
33-
"types": "./dist/utils/index.d.ts"
33+
"types": "./dist/src/utils/index.d.ts"
3434
},
3535
"./*": "./*"
3636
},

src/composables/useLoader/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { isArray } from '@alvarosabu/utils'
2-
import type { Object3D } from 'three'
2+
import type { Loader, Object3D } from 'three'
33
import { useLogger } from '../useLogger'
44

5-
export interface TresLoader<T> extends THREE.Loader {
5+
export interface TresLoader<T> extends Loader {
66
load(
77
url: string,
88
onLoad?: (result: T) => void,

src/composables/useRaycaster/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Vector2 } from 'three'
2-
import type { Object3D, type Intersection } from 'three'
2+
import type { Object3D, Intersection, Object3DEventMap } from 'three'
33
import type { Ref } from 'vue'
44
import { computed, onUnmounted } from 'vue'
55
import type { EventHook } from '@vueuse/core'
66
import { createEventHook, useElementBounding, usePointer } from '@vueuse/core'
77

88
import { type TresContext } from '../useTresContextProvider'
99

10-
export type Intersects = Intersection<THREE.Object3D<THREE.Event>>[]
10+
export type Intersects = Intersection<Object3D<Object3DEventMap>>[]
1111
interface PointerMoveEventPayload {
1212
intersects?: Intersects
1313
event: PointerEvent
@@ -19,7 +19,7 @@ interface PointerClickEventPayload {
1919
}
2020

2121
export const useRaycaster = (
22-
objects: Ref<THREE.Object3D[]>,
22+
objects: Ref<Object3D[]>,
2323
{ renderer, camera, raycaster }: Pick<TresContext, 'renderer' | 'camera' | 'raycaster'>,
2424
) => {
2525
// having a separate computed makes useElementBounding work

src/composables/useSeek/index.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Scene, Object3D } from 'three'
12
import { useLogger } from '../useLogger'
23

34
/**
@@ -7,10 +8,10 @@ import { useLogger } from '../useLogger'
78
* @interface UseSeekReturn
89
*/
910
export interface UseSeekReturn {
10-
seek: (parent: THREE.Scene | THREE.Object3D, property: string, value: string) => THREE.Object3D | null
11-
seekByName: (parent: THREE.Scene | THREE.Object3D, value: string) => THREE.Object3D | null
12-
seekAll: (parent: THREE.Scene | THREE.Object3D, property: string, value: string) => THREE.Object3D[]
13-
seekAllByName: (parent: THREE.Scene | THREE.Object3D, value: string) => THREE.Object3D[]
11+
seek: (parent: Scene | Object3D, property: string, value: string) => Object3D | null
12+
seekByName: (parent: Scene | Object3D, value: string) => Object3D | null
13+
seekAll: (parent: Scene | Object3D, property: string, value: string) => Object3D[]
14+
seekAllByName: (parent: Scene | Object3D, value: string) => Object3D[]
1415
}
1516

1617
/**
@@ -25,13 +26,13 @@ export function useSeek(): UseSeekReturn {
2526
/**
2627
* Returns a child object of the parent given a property
2728
*
28-
* @param {(THREE.Scene | THREE.Object3D)} parent
29+
* @param {(Scene | Object3D)} parent
2930
* @param {string} property
3031
* @param {string} value
31-
* @return {*} {(THREE.Object3D | null)}
32+
* @return {*} {(Object3D | null)}
3233
*/
33-
function seek(parent: THREE.Scene | THREE.Object3D, property: string, value: string): THREE.Object3D | null {
34-
let foundChild: THREE.Object3D | null = null
34+
function seek(parent: Scene | Object3D, property: string, value: string): Object3D | null {
35+
let foundChild: Object3D | null = null
3536

3637
parent.traverse((child) => {
3738
if ((child as any)[property] === value) {
@@ -49,13 +50,13 @@ export function useSeek(): UseSeekReturn {
4950
/**
5051
* Returns an array of child objects of the parent given a property
5152
*
52-
* @param {(THREE.Scene | THREE.Object3D)} parent
53+
* @param {(Scene | Object3D)} parent
5354
* @param {string} property
5455
* @param {string} value
55-
* @return {*} {(THREE.Object3D[])}
56+
* @return {*} {(Object3D[])}
5657
*/
57-
function seekAll(parent: THREE.Scene | THREE.Object3D, property: string, value: string): THREE.Object3D[] {
58-
const foundChildren: THREE.Object3D[] = []
58+
function seekAll(parent: Scene | Object3D, property: string, value: string): Object3D[] {
59+
const foundChildren: Object3D[] = []
5960

6061
parent.traverse((child) => {
6162
if ((child as any)[property].includes(value)) {
@@ -73,22 +74,22 @@ export function useSeek(): UseSeekReturn {
7374
/**
7475
* Returns a child object of the parent given a child.name
7576
*
76-
* @param {(THREE.Scene | THREE.Object3D)} parent
77+
* @param {(Scene | Object3D)} parent
7778
* @param {string} value
78-
* @return {*} {(THREE.Object3D | null)}
79+
* @return {*} {(Object3D | null)}
7980
*/
80-
function seekByName(parent: THREE.Scene | THREE.Object3D, value: string): THREE.Object3D | null {
81+
function seekByName(parent: Scene | Object3D, value: string): Object3D | null {
8182
return seek(parent, 'name', value)
8283
}
8384

8485
/**
8586
* Returns an array of child objects of the parent given a child.name
8687
*
87-
* @param {(THREE.Scene | THREE.Object3D)} parent
88+
* @param {(Scene | Object3D)} parent
8889
* @param {string} value
89-
* @return {*} {(THREE.Object3D[])}
90+
* @return {*} {(Object3D[])}
9091
*/
91-
function seekAllByName(parent: THREE.Scene | THREE.Object3D, value: string): THREE.Object3D[] {
92+
function seekAllByName(parent: Scene | Object3D, value: string): Object3D[] {
9293
return seekAll(parent, 'name', value)
9394
}
9495

types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './dist/types/index.js'
1+
export * from './dist/src/types/index.js'

utils.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './dist/utils/index.js'
1+
export * from './dist/src/utils/index.js'

0 commit comments

Comments
 (0)