Skip to content

Add types via JSDoc #40

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Add types via JSDoc #40

wants to merge 1 commit into from

Conversation

chawes13
Copy link
Contributor

Work in progress branch to add types to this library (via JSDoc). First iteration will for the most part just be geared toward generating types from existing comments. Subsequent PRs can add enhanced custom types (e.g., things like SliceSelector) and even possibly generics (if we're feeling wild)

@chawes13 chawes13 requested a review from josiasds September 14, 2023 19:12
@chawes13 chawes13 marked this pull request as draft September 14, 2023 19:12
}

/**
* @ignore
Copy link
Contributor Author

@chawes13 chawes13 Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ignore stops the typedef from getting added to docs.md

@chawes13
Copy link
Contributor Author

@josiasds Initial commit with essentially the unchanged code from my demo earlier today. Give it a spin and let me know what you think!

Copy link

@josiasds josiasds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still learning the JSDoc syntax but it makes sense to me.


/**
* @ignore
* @callback SliceSelector

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the difference between using a @callback tag vs a @typedef. Are both valid options for SliceSelector?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typdef doesn't work for functions 😭 .

Refer to https://github.com/LaunchPadLab/client-template/pull/436 for more details. It's a little over my head 😆 😅

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I just re-read the docs.
I thought they were using @typedef to type functions, but it was actually the function params being typed with @typedef. Functions should use @callback.

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

Successfully merging this pull request may close these issues.

2 participants