Property fov & aspect does not exist on type 'Camera' for Typescript #1483
Unanswered
nazrinnoorzan
asked this question in
Q&A
Replies: 1 comment
-
Using typescript, the following worked for me, adding a type definition when retrieving the camera from useThree: const { camera }: { camera: THREE.PerspectiveCamera } = useThree(); Or you write it like this: const { camera } = useThree();
const perspectiveCamera = camera as THREE.PerspectiveCamera; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Why I got error when I want to change the state.camera fov & aspect inside Typescript? See screenshot below.
It says
Property 'fov' does not exist on type 'Camera'.
Property 'fov' does not exist on type 'OrthographicCamera'.ts(2339)
Property 'aspect' does not exist on type 'Camera'.
Property 'aspect' does not exist on type 'OrthographicCamera'.ts(2339)
But if I console.log state.camera, I do see the fov & aspect properties.
Beta Was this translation helpful? Give feedback.
All reactions