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

defaultValue.EMPTY_OBJECT missing from documentation and Typescript #11326

Open
angrycat9000 opened this issue Jun 1, 2023 · 5 comments
Open
Labels

Comments

@angrycat9000
Copy link
Contributor

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.

/**
* A frozen empty object that can be used as the default value for options passed as
* an object literal.
* @type {object}
* @memberof defaultValue
*/
defaultValue.EMPTY_OBJECT = Object.freeze({});

Screenshot of doc for defaultValue
image

Generated type definition for defaultValue

export function defaultValue(a: any, b: any): any;
@anpaulan
Copy link

Hi @ggetz could I take on this issue?

@ggetz
Copy link
Contributor

ggetz commented Aug 26, 2024

@anpaulan Sure! I think the strategy here is to deprecate defaultValue.EMPTY_OBJECT and create a new standalone constant.

@angrycat9000
Copy link
Contributor Author

angrycat9000 commented Aug 26, 2024

@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

@ggetz
Copy link
Contributor

ggetz commented Aug 26, 2024

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 #11455.

IIUC that would fix the type definition, but is not a solution for the documentation. Am I missing something?

@angrycat9000
Copy link
Contributor Author

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.

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

No branches or pull requests

3 participants