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

Typescript examples throws type errors. #88

Open
muningis opened this issue Jul 1, 2017 · 3 comments
Open

Typescript examples throws type errors. #88

muningis opened this issue Jul 1, 2017 · 3 comments

Comments

@muningis
Copy link

muningis commented Jul 1, 2017

Part 1:

userLocation.position.copy(userPose.position);
Argument of type 'Cartesian3' is not assignable to parameter of type 'Vector3'. Property 'set' is missing in type 'Cartesian3'.'

Since TypeCast doesn't help, gotta do this:

userLocation.position.copy(new Three.Vector3(
  userPose.position.x,
  userPose.position.y,
  userPose.position.z,
))

And then there's more errors for these:

boxGeoEntity.position.setValue(boxPos, defaultFrame)
boxGeoEntity.orientation.setValue(Argon.Cesium.Quaternion.IDENTITY)
message: 'Property 'setValue' does not exist on type 'PositionProperty'. Did you mean 'getValue'?'
message: 'Property 'setValue' does not exist on type 'Property'. Did you mean 'getValue'?'

Yes, I'm using types both for THREE.js and Argon.

@speigg
Copy link
Contributor

speigg commented Jul 1, 2017

You can cast to <any> to appease Typescript.

The better solution is to submit a PR to the types for threejs to relax the requirement for methods like "copy()", which really only care about certain properties on the passed object.

@muningis
Copy link
Author

muningis commented Jul 1, 2017

And what about setValue? According to Cesium's documentation there indeed is no setValue method.

Also, slightly off-topic, but https://docs.argonjs.io/code/1-geopose/ doesn't work nor on desktop nor on mobile.

@blairmacintyre
Copy link
Contributor

So the generic PositionPropert doesn't have a setValue. The subtypes (Constant, Interval, etc) have their own. These are probably Constant.

Fixing the typing errors on the examples has been "on the todo list" for a while, we'd welcome PR's that clean them up.

If you do, please work against the develop branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants