Skip to content

Commit

Permalink
Wrap JSDoc @example tags with a TypeScript fence, closes Effect-TS#4002
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti authored Nov 27, 2024
1 parent 24b4dba commit 944025b
Show file tree
Hide file tree
Showing 78 changed files with 2,038 additions and 184 deletions.
13 changes: 13 additions & 0 deletions .changeset/green-years-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@effect/platform-node": patch
"@effect/experimental": patch
"@effect/typeclass": patch
"@effect/platform": patch
"@effect/printer": patch
"effect": patch
"@effect/sql-pg": patch
"@effect/cli": patch
"@effect/sql": patch
---

Wrap JSDoc @example tags with a TypeScript fence, closes #4002
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ Output:

Output:

```
````
*
* @example
* ```ts
* import { Effect } from "effect"
*
* console.log(Effect.runSyncExit(Effect.succeed(1)))
Expand All @@ -122,8 +123,9 @@ Output:
* // _tag: "Success",
* // value: 1
* // }
* ```
*
```
````

By using this utility, you can save time and maintain consistency in your JSDoc comments, especially for complex examples.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@changesets/cli": "^2.27.7",
"@edge-runtime/vm": "^4.0.0",
"@effect/build-utils": "^0.7.7",
"@effect/docgen": "^0.4.4",
"@effect/docgen": "^0.5.1",
"@effect/dtslint": "^0.1.2",
"@effect/eslint-plugin": "^0.2.0",
"@effect/language-service": "^0.1.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ export const boolean: (name: string, options?: Options.BooleanOptionsConfig) =>
* inputs. The input will be mapped to it's associated value during parsing.
*
* @example
* ```ts
* import * as Options from "@effect/cli/Options"
*
* export const animal: Options.Options<"dog" | "cat"> = Options.choice(
* "animal",
* ["dog", "cat"]
* )
* ```
*
* @since 1.0.0
* @category constructors
Expand All @@ -174,6 +176,7 @@ export const choice: <A extends string, C extends ReadonlyArray<A>>(
* inputs. The input will be mapped to it's associated value during parsing.
*
* @example
* ```ts
* import * as Options from "@effect/cli/Options"
* import * as Data from "effect/Data"
*
Expand All @@ -195,6 +198,7 @@ export const choice: <A extends string, C extends ReadonlyArray<A>>(
* ["dog", Dog()],
* ["cat", Cat()],
* ])
* ```
*
* @since 1.0.0
* @category constructors
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/Prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ export declare namespace All {
* as an argument.
*
* @example
* ```ts
* import * as Prompt from "@effect/cli/Prompt"
* import * as NodeContext from "@effect/platform-node/NodeContext"
* import * as Runtime from "@effect/platform-node/NodeRuntime"
Expand All @@ -537,6 +538,7 @@ export declare namespace All {
* const allWithTuple = Prompt.all([username, password])
*
* const allWithRecord = Prompt.all({ username, password })
* ```
*
* @since 1.0.0
* @category collecting & elements
Expand Down
Loading

0 comments on commit 944025b

Please sign in to comment.