You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The JSDoc for certain functions in the cesium\packages\engine\Source\Scene\SceneTransforms.js have JSDoc that don't completely describe the possible return values.
The affected functions are: SceneTransforms.worldToWindowCoordinates SceneTransforms.wgs84ToWindowCoordinates SceneTransforms.worldToDrawingBufferCoordinates SceneTransforms.wgs84ToDrawingBufferCoordinates
Each of these functions have JSDoc describing their return types as some variation of the following:
@returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
It is noted that each of these functions can potentially return an undefined value, but this possibility is not encoded in the type definition of the @return. Including the undefined value as a union with the successful return type is a potential resolution to this: @return {Cartesian2|undefined}.
The typescript signatures of these functions are built from the JSDoc, so when building typescript definitions from the source, the signatures of these functions end up not accurately describing the potential for failure that they have. Any consumers of cesium that are accessing these function might end up with unexpected crashes because of it.
Reproduction steps
Run the script to build typescript definitions: npm run build-ts
Inspect cesium\packages\engine\index.d.ts and notice that the type declarations for the above functions do not correctly reflect the implementations
Sandcastle example
No response
Environment
Browser: N/A
CesiumJS Version: cbd13cee0959d2de6e01f355dd1cd73342467102
Operating System: Windows 11 Pro
The text was updated successfully, but these errors were encountered:
sudo-jaa
changed the title
Some SceneTransforms functionsdo not correctly reflect implementation
Some SceneTransforms functions do not correctly reflect implementation
Jun 12, 2024
sudo-jaa
changed the title
Some SceneTransforms functions do not correctly reflect implementation
Some SceneTransforms functions docs do not correctly reflect implementation
Jun 13, 2024
What happened?
The JSDoc for certain functions in the
cesium\packages\engine\Source\Scene\SceneTransforms.js
have JSDoc that don't completely describe the possible return values.The affected functions are:
SceneTransforms.worldToWindowCoordinates
SceneTransforms.wgs84ToWindowCoordinates
SceneTransforms.worldToDrawingBufferCoordinates
SceneTransforms.wgs84ToDrawingBufferCoordinates
Each of these functions have JSDoc describing their return types as some variation of the following:
It is noted that each of these functions can potentially return an
undefined
value, but this possibility is not encoded in the type definition of the@return
. Including theundefined
value as a union with the successful return type is a potential resolution to this:@return {Cartesian2|undefined}
.The typescript signatures of these functions are built from the JSDoc, so when building typescript definitions from the source, the signatures of these functions end up not accurately describing the potential for failure that they have. Any consumers of cesium that are accessing these function might end up with unexpected crashes because of it.
Reproduction steps
npm run build-ts
cesium\packages\engine\index.d.ts
and notice that the type declarations for the above functions do not correctly reflect the implementationsSandcastle example
No response
Environment
Browser: N/A
CesiumJS Version:
cbd13cee0959d2de6e01f355dd1cd73342467102
Operating System: Windows 11 Pro
The text was updated successfully, but these errors were encountered: