defaultValue.EMPTY_OBJECT missing from documentation and Typescript
defaultValue.EMPTY_OBJECT has JSDoc and is not explicitly marked as private. However it does not show up in either the generated documentation or the type definitions.
https://github.com/CesiumGS/cesium/blob/b2d169d75e8c9e5cf6cda018f802cc18a860ebc1/packages/engine/Source/Core/defaultValue.js#L21-L27
Screenshot of doc for defaultValue
Generated type definition for defaultValue
export function defaultValue(a: any, b: any): any;
Hi @ggetz could I take on this issue?
@anpaulan Sure! I think the strategy here is to deprecate defaultValue.EMPTY_OBJECT and create a new standalone constant.
@ggetz is there a reason besides typings that you would want to depreate defaultValue.EMPTY_OBJECT?
Typescript has call signatures that would let us correctly describe the existing typing. Though this might not be constructable through JSDoc notation. In that case we could just edit the generated typescript definition to use. That is what we ended up doing for defined
Thanks for the input @angrycat9000! While call signatures would work for TypeScript definitions, there's no defined way to do them with JSDoc.
In that case we could just edit the generated typescript definition to use. That is what we ended up doing for https://github.com/CesiumGS/cesium/pull/11455.
IIUC that would fix the type definition, but is not a solution for the documentation. Am I missing something?
IIUC that would fix the type definition, but is not a solution for the documentation. Am I missing something?
Ah I forgot that this was not in the documenation at all (as opposed to just not typed correctly).
I think the current API design is good for usage, because it associates the EMPTY_OBJECT closely with the intended usage as a default value. But not sure how to fix the documentation part besides creating an contant that isn't attached to a function.
This was addressed by https://github.com/CesiumGS/cesium/pull/12507
EMPTY_OBJECT has moved from defaultValue.EMPTY_OBJECT to Frozen.EMPTY_OBJECT which now shows up in documentation and the TS types. If there are issues with the actual typings when using in TS please open a new issue and we can take a look at changes.