Skip to content

fill out JSDocs with examples#1141

Open
jbolda wants to merge 7 commits intov4-1-alphafrom
jsdoc-examples
Open

fill out JSDocs with examples#1141
jbolda wants to merge 7 commits intov4-1-alphafrom
jsdoc-examples

Conversation

@jbolda
Copy link
Copy Markdown
Member

@jbolda jbolda commented Mar 18, 2026

Motivation

Filling out the JSDocs a bit more. These show up both on the website, but also in IDEs.

Closes #1139.

Approach

Fix a few broken bits, and add more examples.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 18, 2026

Open in StackBlitz

npm i https://pkg.pr.new/effection@1141

commit: b78d574

Co-authored-by: Taras Mankovski <tarasm@gmail.com>
Copy link
Copy Markdown
Member

@cowboyd cowboyd left a comment

Choose a reason for hiding this comment

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

There are some where I'm not so sure we need examples. Or if we do have them, they should be very, very concise.

Comment on lines +87 to +100
* function useValue() {
* return resource(function* (provide: Provide<number>) {
* yield* provide(42);
* });
* }
*
* console.log(yield* useValue()); // 42
*
* // alternatively, the preferred pattern is
* function useValue() {
* return resource<number>(function* (provide) {
* yield* provide(42);
* });
* }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This example doesn't provide much. A resource is about acquisition and release and so any example should demonstrate those two things. A connection pool maybe?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I was trying not to complicate it too much, but I see the point. The main intent was for folks that land on this API page trying to understand what the value of provide is.
https://frontside.com/effection/api/v4/Provide/

Is it valid to have an expectation that they arrive there having already looked at the value of using a resource? Maybe just a simple comment or something saying as such?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think they will most likely arrive by hovering on a parameter resource() so could definitely be like "what is this?"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I updated it. What do you think of this?

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.

3 participants