From 342dd332fe9b36dc49d49b98333fe913fa05df08 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sun, 2 Mar 2025 19:20:51 +0100 Subject: [PATCH 01/16] Update @effect/docgen to a specific PR version --- package.json | 2 +- pnpm-lock.yaml | 36 +++++++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 8faea8b4e38..9e0da55bd24 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@changesets/cli": "^2.27.7", "@edge-runtime/vm": "^4.0.0", "@effect/build-utils": "^0.7.7", - "@effect/docgen": "^0.5.2", + "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400", "@effect/eslint-plugin": "^0.2.0", "@effect/language-service": "^0.1.0", "@effect/vitest": "workspace:^", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a010ea7eba..1860064e805 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,8 +53,8 @@ importers: specifier: ^0.7.7 version: 0.7.7 '@effect/docgen': - specifier: ^0.5.2 - version: 0.5.2(tsx@4.17.0)(typescript@5.7.2) + specifier: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400 + version: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400(tsx@4.17.0)(typescript@5.7.2) '@effect/eslint-plugin': specifier: ^0.2.0 version: 0.2.0 @@ -1969,8 +1969,9 @@ packages: engines: {node: '>=16.17.1'} hasBin: true - '@effect/docgen@0.5.2': - resolution: {integrity: sha512-gqBxAhp58R18vT5+ORobWRQ/2MaF5vH0k1zggSct54J41k8TKF5mYIW1qG5tkOVCejet+8K5MKsWK3gzIkaoMw==} + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400': + resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400} + version: 0.5.2 engines: {node: '>=18.0.0'} hasBin: true peerDependencies: @@ -4792,6 +4793,11 @@ packages: engines: {node: 20 || >=22} hasBin: true + glob@11.0.1: + resolution: {integrity: sha512-zrQDm8XPnYEKawJScsnM0QzobJxlT/kHOOlRTio8IH/GrmxRE5fjllkzdaHclIuNjUQTJYH2xHNIGfdpJkDJUw==} + engines: {node: 20 || >=22} + hasBin: true + glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -6219,6 +6225,11 @@ packages: engines: {node: '>=14'} hasBin: true + prettier@3.5.2: + resolution: {integrity: sha512-lc6npv5PH7hVqozBR7lkBNOGXV9vMwROAPlumdBkX0wTbbzPu/U1hk5yL8p2pt4Xoc+2mkT8t/sow2YrV/M5qg==} + engines: {node: '>=14'} + hasBin: true + pretty-format@26.6.2: resolution: {integrity: sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==} engines: {node: '>= 10'} @@ -9408,12 +9419,12 @@ snapshots: '@effect/build-utils@0.7.7': {} - '@effect/docgen@0.5.2(tsx@4.17.0)(typescript@5.7.2)': + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400(tsx@4.17.0)(typescript@5.7.2)': dependencies: '@effect/markdown-toc': 0.1.0 doctrine: 3.0.0 - glob: 10.4.5 - prettier: 3.3.3 + glob: 11.0.1 + prettier: 3.5.2 tsx: 4.17.0 typescript: 5.7.2 @@ -12492,6 +12503,15 @@ snapshots: package-json-from-dist: 1.0.0 path-scurry: 2.0.0 + glob@11.0.1: + dependencies: + foreground-child: 3.2.1 + jackspeak: 4.0.1 + minimatch: 10.0.1 + minipass: 7.1.2 + package-json-from-dist: 1.0.0 + path-scurry: 2.0.0 + glob@7.2.3: dependencies: fs.realpath: 1.0.0 @@ -14157,6 +14177,8 @@ snapshots: prettier@3.3.3: {} + prettier@3.5.2: {} + pretty-format@26.6.2: dependencies: '@jest/types': 26.6.2 From b3ee82da57b8e97fd1cd6842ae6158b1ba874939 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Mon, 3 Mar 2025 08:02:20 +0100 Subject: [PATCH 02/16] Add missing `import * as assert from "node:assert"` to documentation examples --- packages/effect/src/Array.ts | 103 ++++++++++++++++++++++++ packages/effect/src/BigDecimal.ts | 30 +++++++ packages/effect/src/BigInt.ts | 27 +++++++ packages/effect/src/Boolean.ts | 12 +++ packages/effect/src/Brand.ts | 3 + packages/effect/src/Chunk.ts | 4 + packages/effect/src/Context.ts | 14 ++++ packages/effect/src/Cron.ts | 3 + packages/effect/src/Data.ts | 8 ++ packages/effect/src/DateTime.ts | 2 + packages/effect/src/Effect.ts | 4 + packages/effect/src/Either.ts | 20 +++++ packages/effect/src/Function.ts | 22 ++++- packages/effect/src/Iterable.ts | 9 +++ packages/effect/src/List.ts | 2 + packages/effect/src/Mailbox.ts | 1 + packages/effect/src/Number.ts | 22 +++++ packages/effect/src/Option.ts | 6 ++ packages/effect/src/Order.ts | 1 + packages/effect/src/Ordering.ts | 2 + packages/effect/src/Predicate.ts | 34 ++++++++ packages/effect/src/Random.ts | 1 + packages/effect/src/Record.ts | 28 +++++++ packages/effect/src/Redacted.ts | 3 + packages/effect/src/RegExp.ts | 2 + packages/effect/src/Schema.ts | 11 ++- packages/effect/src/Stream.ts | 4 + packages/effect/src/String.ts | 31 +++++++ packages/effect/src/Struct.ts | 6 ++ packages/effect/src/Symbol.ts | 1 + packages/effect/src/Trie.ts | 28 +++++++ packages/effect/src/Tuple.ts | 11 +++ packages/platform/src/HttpMethod.ts | 1 + packages/platform/src/UrlParams.ts | 1 + packages/typeclass/src/data/BigInt.ts | 5 ++ packages/typeclass/src/data/Number.ts | 8 ++ packages/typeclass/src/data/Ordering.ts | 2 + 37 files changed, 469 insertions(+), 3 deletions(-) diff --git a/packages/effect/src/Array.ts b/packages/effect/src/Array.ts index 0b280500ae5..231512af8df 100644 --- a/packages/effect/src/Array.ts +++ b/packages/effect/src/Array.ts @@ -48,6 +48,7 @@ export type NonEmptyArray = [A, ...Array] * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.make(1, 2, 3) @@ -66,6 +67,7 @@ export const make = >( * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.allocate(3) @@ -84,6 +86,7 @@ export const allocate = (n: number): Array => new Arra * * @example * ```ts + * import * as assert from "node:assert" * import { makeBy } from "effect/Array" * * assert.deepStrictEqual(makeBy(5, n => n * 2), [0, 2, 4, 6, 8]) @@ -109,6 +112,7 @@ export const makeBy: { * * @example * ```ts + * import * as assert from "node:assert" * import { range } from "effect/Array" * * assert.deepStrictEqual(range(1, 3), [1, 2, 3]) @@ -127,6 +131,7 @@ export const range = (start: number, end: number): NonEmptyArray => * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * assert.deepStrictEqual(Array.replicate("a", 3), ["a", "a", "a"]) @@ -147,6 +152,7 @@ export const replicate: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const set = new Set([1, 2, 3]) @@ -165,6 +171,7 @@ export const fromIterable = (collection: Iterable): Array => * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * assert.deepStrictEqual(Array.ensure("a"), ["a"]) @@ -184,6 +191,7 @@ export const ensure = (self: ReadonlyArray | A): Array => Array.isArray * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const x = { a: 1, b: 2, c: 3 } @@ -200,6 +208,7 @@ export const fromRecord: (self: Readonly>) => * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect" * * assert.deepStrictEqual(Array.fromOption(Option.some(1)), [1]) @@ -216,6 +225,7 @@ export const fromOption: (self: Option) => Array = O.toArray * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const match = Array.match({ @@ -256,6 +266,7 @@ export const match: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const matchLeft = Array.matchLeft({ @@ -296,6 +307,7 @@ export const matchLeft: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const matchRight = Array.matchRight({ @@ -339,6 +351,7 @@ export const matchRight: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const original = [2, 3, 4]; @@ -360,6 +373,7 @@ export const prepend: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const prefix = [0, 1]; @@ -388,6 +402,7 @@ export const prependAll: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const original = [1, 2, 3]; @@ -429,6 +444,7 @@ export const appendAll: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect"; * * const numbers = [1, 2, 3, 4] @@ -465,6 +481,7 @@ export const scan: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect"; * * const numbers = [1, 2, 3, 4] @@ -495,6 +512,7 @@ export const scanRight: { * * @example * ```ts + * import * as assert from "node:assert" * import { isArray } from "effect/Array" * * assert.deepStrictEqual(isArray(null), false); @@ -516,6 +534,7 @@ export const isArray: { * * @example * ```ts + * import * as assert from "node:assert" * import { isEmptyArray } from "effect/Array" * * assert.deepStrictEqual(isEmptyArray([]), true); @@ -534,6 +553,7 @@ export const isEmptyArray = (self: Array): self is [] => self.length === 0 * * @example * ```ts + * import * as assert from "node:assert" * import { isEmptyReadonlyArray } from "effect/Array" * * assert.deepStrictEqual(isEmptyReadonlyArray([]), true); @@ -554,6 +574,7 @@ export const isEmptyReadonlyArray: (self: ReadonlyArray) => self is readon * * @example * ```ts + * import * as assert from "node:assert" * import { isNonEmptyArray } from "effect/Array" * * assert.deepStrictEqual(isNonEmptyArray([]), false); @@ -574,6 +595,7 @@ export const isNonEmptyArray: (self: Array) => self is NonEmptyArray = * * @example * ```ts + * import * as assert from "node:assert" * import { isNonEmptyReadonlyArray } from "effect/Array" * * assert.deepStrictEqual(isNonEmptyReadonlyArray([]), false); @@ -634,6 +656,7 @@ export const unsafeGet: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect"; * * const result = Array.unprepend([1, 2, 3, 4]) @@ -652,6 +675,7 @@ export const unprepend = ( * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect"; * * const result = Array.unappend([1, 2, 3, 4]) @@ -678,6 +702,7 @@ export const head: (self: ReadonlyArray) => Option = get(0) * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.headNonEmpty([1, 2, 3, 4]) @@ -703,6 +728,7 @@ export const last = (self: ReadonlyArray): Option => * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.lastNonEmpty([1, 2, 3, 4]) @@ -730,6 +756,7 @@ export const tail = (self: Iterable): Option> => { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.tailNonEmpty([1, 2, 3, 4]) @@ -757,6 +784,7 @@ export const init = (self: Iterable): Option> => { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.initNonEmpty([1, 2, 3, 4]) @@ -775,6 +803,7 @@ export const initNonEmpty = (self: NonEmptyReadonlyArray): Array => sel * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -800,6 +829,7 @@ export const take: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -824,6 +854,7 @@ export const takeRight: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 3, 2, 4, 1, 2] @@ -901,6 +932,7 @@ export const span: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -926,6 +958,7 @@ export const drop: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -949,6 +982,7 @@ export const dropRight: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -973,6 +1007,7 @@ export const dropWhile: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect" * * const numbers = [5, 3, 8, 9] @@ -1002,6 +1037,7 @@ export const findFirstIndex: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect" * * const numbers = [1, 3, 8, 9] @@ -1031,6 +1067,7 @@ export const findLastIndex: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -1056,6 +1093,7 @@ export const findFirst: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -1100,6 +1138,7 @@ export const findLast: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect" * * const letters = ['a', 'b', 'c', 'e'] @@ -1128,6 +1167,7 @@ export const insertAt: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const letters = ['a', 'b', 'c', 'd'] @@ -1156,6 +1196,7 @@ export const replace: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect" * * const numbers = [1, 2, 3] @@ -1186,6 +1227,7 @@ export const replaceOption: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4] @@ -1217,6 +1259,7 @@ export const modify: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect" * * const numbers = [1, 2, 3, 4] @@ -1256,6 +1299,7 @@ export const modifyOption: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4] @@ -1285,6 +1329,7 @@ export const remove: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4] @@ -1326,6 +1371,7 @@ export const sort: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Order } from "effect" * * const strings = ["aaa", "b", "cc"] @@ -1361,6 +1407,7 @@ export const sortWith: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Order } from "effect" * * const users = [ @@ -1410,6 +1457,7 @@ export const sortBy = >( * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const array1 = [1, 2, 3] @@ -1437,6 +1485,7 @@ export const zip: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const array1 = [1, 2, 3] @@ -1472,6 +1521,7 @@ export const zipWith: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.unzip([[1, "a"], [2, "b"], [3, "c"]]) @@ -1504,6 +1554,7 @@ export const unzip: >( * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3] @@ -1540,6 +1591,7 @@ export const intersperse: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.modifyNonEmptyHead([1, 2, 3], n => n * 10) @@ -1564,6 +1616,7 @@ export const modifyNonEmptyHead: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.setNonEmptyHead([1, 2, 3], 10) @@ -1585,6 +1638,7 @@ export const setNonEmptyHead: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.modifyNonEmptyLast([1, 2, 3], n => n * 2) @@ -1607,6 +1661,7 @@ export const modifyNonEmptyLast: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.setNonEmptyLast([1, 2, 3], 4) @@ -1629,6 +1684,7 @@ export const setNonEmptyLast: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const letters = ['a', 'b', 'c', 'd'] @@ -1665,6 +1721,7 @@ export const rotate: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4] @@ -1697,6 +1754,7 @@ const _equivalence = Equal.equivalence() * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const letters = ['a', 'b', 'c', 'd'] @@ -1719,6 +1777,7 @@ export const contains: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -1770,6 +1829,7 @@ export const chop: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -1801,6 +1861,7 @@ export const splitAt: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.splitNonEmptyAt(["a", "b", "c", "d", "e"], 3) @@ -1825,6 +1886,7 @@ export const splitNonEmptyAt: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5, 6, 7, 8] @@ -1849,6 +1911,7 @@ export const split: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -1875,6 +1938,7 @@ export const splitWhere: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3] @@ -1897,6 +1961,7 @@ export const copy: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const arr = [1, 2, 3] @@ -1937,6 +2002,7 @@ export const pad: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3, 4, 5] @@ -1974,6 +2040,7 @@ export const chunksOf: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.groupWith(["a", "a", "b", "b", "b", "c", "a"], (x, y) => x === y) @@ -2010,6 +2077,7 @@ export const groupWith: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.group([1, 1, 2, 2, 2, 3, 1]) @@ -2029,6 +2097,7 @@ export const group: (self: NonEmptyReadonlyArray) => NonEmptyArray(isEquivalent: (self: A, that: A) => boolean) * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const array1 = [1, 2, 3] @@ -2195,6 +2268,7 @@ export const intersection: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const array1 = [1, 2, 3] @@ -2222,6 +2296,7 @@ export const differenceWith = (isEquivalent: (self: A, that: A) => boolean): * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const array1 = [1, 2, 3] @@ -2346,6 +2421,7 @@ export const flatMap: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect"; * * const nestedArrays = [[1, 2], [], [3, 4], [], [5, 6]] @@ -2367,6 +2443,7 @@ export const flatten: >>(self: S) => * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect"; * * const data = [1, 2, 3, 4, 5]; @@ -2404,6 +2481,7 @@ export const filterMap: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect"; * * const data = [2, 4, 5]; @@ -2442,6 +2520,7 @@ export const filterMapWhile: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Either } from "effect"; * * const data = [1, 2, 3, 4, 5] @@ -2485,6 +2564,7 @@ export const partitionMap: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Option } from "effect" * * assert.deepStrictEqual( @@ -2506,6 +2586,7 @@ export const getSomes: >, X = any>( * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Either } from "effect" * * assert.deepStrictEqual( @@ -2533,6 +2614,7 @@ export const getLefts = >>(self: T): Array>>( * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3] @@ -2667,6 +2751,7 @@ export const reduce: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3] @@ -2691,6 +2776,7 @@ export const reduceRight: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const isEven = (n: number) => n % 2 === 0 @@ -2736,6 +2822,7 @@ export const liftNullable = , B>( * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3] @@ -2767,6 +2854,7 @@ export const flatMapNullable: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Either } from "effect" * * const parseNumber = (s: string): Either.Either => @@ -2838,6 +2926,7 @@ export const some: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3] @@ -2866,6 +2955,7 @@ export const extend: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Order } from "effect" * * const min = Array.min([3, 1, 2], Order.number) @@ -2884,6 +2974,7 @@ export const min: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array, Order } from "effect" * * const max = Array.max([3, 1, 2], Order.number) @@ -2929,6 +3020,7 @@ export const getOrder: (O: Order.Order) => Order.Order> = * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers1 = [1, 2, 3] @@ -2968,6 +3060,7 @@ export const forEach: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 2, 3, 3, 3] @@ -3017,6 +3110,7 @@ export const dedupe = >( * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 1, 2, 2, 3, 3] @@ -3046,6 +3140,7 @@ export const dedupeAdjacentWith: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 1, 2, 2, 3, 3] @@ -3062,6 +3157,7 @@ export const dedupeAdjacent: (self: Iterable) => Array = dedupeAdjacent * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const strings = ["a", "b", "c"] @@ -3082,6 +3178,7 @@ export const join: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const numbers = [1, 2, 3] @@ -3123,6 +3220,7 @@ export const mapAccum: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const array1 = [1, 2] @@ -3148,6 +3246,7 @@ export const cartesianWith: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array } from "effect" * * const array1 = [1, 2] @@ -3191,6 +3290,7 @@ export const cartesian: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array as Arr, pipe } from "effect" * const doResult = pipe( * Arr.Do, @@ -3238,6 +3338,7 @@ export const Do: ReadonlyArray<{}> = of({}) * * @example * ```ts + * import * as assert from "node:assert" * import { Array as Arr, pipe } from "effect" * const doResult = pipe( * Arr.Do, @@ -3297,6 +3398,7 @@ export const bind: { * * @example * ```ts + * import * as assert from "node:assert" * import { Array as Arr, pipe } from "effect" * const doResult = pipe( * Arr.Do, @@ -3360,6 +3462,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { Array as Arr, pipe } from "effect" * const doResult = pipe( * Arr.Do, diff --git a/packages/effect/src/BigDecimal.ts b/packages/effect/src/BigDecimal.ts index 7f8672a0106..32dbdd2e648 100644 --- a/packages/effect/src/BigDecimal.ts +++ b/packages/effect/src/BigDecimal.ts @@ -136,6 +136,7 @@ const zero = unsafeMakeNormalized(bigint0, 0) * * @example * ```ts + * import * as assert from "node:assert" * import { normalize, make, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(normalize(unsafeFromString("123.00000")), normalize(make(123n, 0))) @@ -209,6 +210,7 @@ export const scale: { * * @example * ```ts + * import * as assert from "node:assert" * import { sum, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(sum(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("5")) @@ -248,6 +250,7 @@ export const sum: { * * @example * ```ts + * import * as assert from "node:assert" * import { multiply, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(multiply(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("6")) @@ -275,6 +278,7 @@ export const multiply: { * * @example * ```ts + * import * as assert from "node:assert" * import { subtract, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(subtract(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("-1")) @@ -387,6 +391,7 @@ export const roundTerminal = (n: bigint): bigint => { * * @example * ```ts + * import * as assert from "node:assert" * import { BigDecimal, Option } from "effect" * * assert.deepStrictEqual(BigDecimal.divide(BigDecimal.unsafeFromString("6"), BigDecimal.unsafeFromString("3")), Option.some(BigDecimal.unsafeFromString("2"))) @@ -430,6 +435,7 @@ export const divide: { * * @example * ```ts + * import * as assert from "node:assert" * import { unsafeDivide, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(unsafeDivide(unsafeFromString("6"), unsafeFromString("3")), unsafeFromString("2")) @@ -487,6 +493,7 @@ export const Order: order.Order = order.make((self, that) => { * * @example * ```ts + * import * as assert from "node:assert" * import { lessThan, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(lessThan(unsafeFromString("2"), unsafeFromString("3")), true) @@ -510,6 +517,7 @@ export const lessThan: { * * @example * ```ts + * import * as assert from "node:assert" * import { lessThanOrEqualTo, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(lessThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), true) @@ -533,6 +541,7 @@ export const lessThanOrEqualTo: { * * @example * ```ts + * import * as assert from "node:assert" * import { greaterThan, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(greaterThan(unsafeFromString("2"), unsafeFromString("3")), false) @@ -556,6 +565,7 @@ export const greaterThan: { * * @example * ```ts + * import * as assert from "node:assert" * import { greaterThanOrEqualTo, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(greaterThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), false) @@ -580,6 +590,7 @@ export const greaterThanOrEqualTo: { * * @example * ```ts + * import * as assert from "node:assert" * import { BigDecimal } from "effect" * * const between = BigDecimal.between({ @@ -619,6 +630,7 @@ export const between: { * * @example * ```ts + * import * as assert from "node:assert" * import { BigDecimal } from "effect" * * const clamp = BigDecimal.clamp({ @@ -653,6 +665,7 @@ export const clamp: { * * @example * ```ts + * import * as assert from "node:assert" * import { min, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(min(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("2")) @@ -674,6 +687,7 @@ export const min: { * * @example * ```ts + * import * as assert from "node:assert" * import { max, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(max(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("3")) @@ -694,6 +708,7 @@ export const max: { * * @example * ```ts + * import * as assert from "node:assert" * import { sign, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(sign(unsafeFromString("-5")), -1) @@ -713,6 +728,7 @@ export const sign = (n: BigDecimal): Ordering => n.value === bigint0 ? 0 : n.val * * @example * ```ts + * import * as assert from "node:assert" * import { abs, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(abs(unsafeFromString("-5")), unsafeFromString("5")) @@ -732,6 +748,7 @@ export const abs = (n: BigDecimal): BigDecimal => n.value < bigint0 ? make(-n.va * * @example * ```ts + * import * as assert from "node:assert" * import { negate, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(negate(unsafeFromString("3")), unsafeFromString("-3")) @@ -753,6 +770,7 @@ export const negate = (n: BigDecimal): BigDecimal => make(-n.value, n.scale) * * @example * ```ts + * import * as assert from "node:assert" * import { BigDecimal, Option } from "effect" * * assert.deepStrictEqual(BigDecimal.remainder(BigDecimal.unsafeFromString("2"), BigDecimal.unsafeFromString("2")), Option.some(BigDecimal.unsafeFromString("0"))) @@ -785,6 +803,7 @@ export const remainder: { * * @example * ```ts + * import * as assert from "node:assert" * import { unsafeRemainder, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(unsafeRemainder(unsafeFromString("2"), unsafeFromString("2")), unsafeFromString("0")) @@ -856,6 +875,7 @@ export const fromBigInt = (n: bigint): BigDecimal => make(n, 0) * * @example * ```ts + * import * as assert from "node:assert" * import { unsafeFromNumber, make } from "effect/BigDecimal" * * assert.deepStrictEqual(unsafeFromNumber(123), make(123n, 0)) @@ -897,6 +917,7 @@ export const fromNumber: (n: number) => BigDecimal = unsafeFromNumber * * @example * ```ts + * import * as assert from "node:assert" * import { BigDecimal, Option } from "effect" * * assert.deepStrictEqual(BigDecimal.safeFromNumber(123), Option.some(BigDecimal.make(123n, 0))) @@ -928,6 +949,7 @@ export const safeFromNumber = (n: number): Option.Option => { * * @example * ```ts + * import * as assert from "node:assert" * import { BigDecimal, Option } from "effect" * * assert.deepStrictEqual(BigDecimal.fromString("123"), Option.some(BigDecimal.make(123n, 0))) @@ -990,6 +1012,7 @@ export const fromString = (s: string): Option.Option => { * * @example * ```ts + * import * as assert from "node:assert" * import { unsafeFromString, make } from "effect/BigDecimal" * * assert.deepStrictEqual(unsafeFromString("123"), make(123n, 0)) @@ -1013,6 +1036,7 @@ export const unsafeFromString = (s: string): BigDecimal => * * @example * ```ts + * import * as assert from "node:assert" * import { format, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(format(unsafeFromString("-5")), "-5") @@ -1061,6 +1085,7 @@ export const format = (n: BigDecimal): string => { * * @example * ```ts + * import * as assert from "node:assert" * import { toExponential, make } from "effect/BigDecimal" * * assert.deepStrictEqual(toExponential(make(123456n, -5)), "1.23456e+10") @@ -1097,6 +1122,7 @@ export const toExponential = (n: BigDecimal): string => { * * @example * ```ts + * import * as assert from "node:assert" * import { unsafeToNumber, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(unsafeToNumber(unsafeFromString("123.456")), 123.456) @@ -1114,6 +1140,7 @@ export const unsafeToNumber = (n: BigDecimal): number => Number(format(n)) * * @example * ```ts + * import * as assert from "node:assert" * import { isInteger, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(isInteger(unsafeFromString("0")), true) @@ -1133,6 +1160,7 @@ export const isInteger = (n: BigDecimal): boolean => normalize(n).scale <= 0 * * @example * ```ts + * import * as assert from "node:assert" * import { isZero, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(isZero(unsafeFromString("0")), true) @@ -1151,6 +1179,7 @@ export const isZero = (n: BigDecimal): boolean => n.value === bigint0 * * @example * ```ts + * import * as assert from "node:assert" * import { isNegative, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(isNegative(unsafeFromString("-1")), true) @@ -1170,6 +1199,7 @@ export const isNegative = (n: BigDecimal): boolean => n.value < bigint0 * * @example * ```ts + * import * as assert from "node:assert" * import { isPositive, unsafeFromString } from "effect/BigDecimal" * * assert.deepStrictEqual(isPositive(unsafeFromString("-1")), false) diff --git a/packages/effect/src/BigInt.ts b/packages/effect/src/BigInt.ts index f0b82e02705..741f8803970 100644 --- a/packages/effect/src/BigInt.ts +++ b/packages/effect/src/BigInt.ts @@ -24,6 +24,7 @@ const bigint2 = BigInt(2) * * @example * ```ts + * import * as assert from "node:assert" * import { isBigInt } from "effect/BigInt" * * assert.deepStrictEqual(isBigInt(1n), true) @@ -43,6 +44,7 @@ export const isBigInt: (u: unknown) => u is bigint = predicate.isBigInt * * @example * ```ts + * import * as assert from "node:assert" * import { sum } from "effect/BigInt" * * assert.deepStrictEqual(sum(2n, 3n), 5n) @@ -64,6 +66,7 @@ export const sum: { * * @example * ```ts + * import * as assert from "node:assert" * import { multiply } from "effect/BigInt" * * assert.deepStrictEqual(multiply(2n, 3n), 6n) @@ -85,6 +88,7 @@ export const multiply: { * * @example * ```ts + * import * as assert from "node:assert" * import { subtract } from "effect/BigInt" * * assert.deepStrictEqual(subtract(2n, 3n), -1n) @@ -111,6 +115,7 @@ export const subtract: { * * @example * ```ts + * import * as assert from "node:assert" * import { BigInt, Option } from "effect" * * assert.deepStrictEqual(BigInt.divide(6n, 3n), Option.some(2n)) @@ -141,6 +146,7 @@ export const divide: { * * @example * ```ts + * import * as assert from "node:assert" * import { unsafeDivide } from "effect/BigInt" * * assert.deepStrictEqual(unsafeDivide(6n, 3n), 2n) @@ -162,6 +168,7 @@ export const unsafeDivide: { * * @example * ```ts + * import * as assert from "node:assert" * import { increment } from "effect/BigInt" * * assert.deepStrictEqual(increment(2n), 3n) @@ -179,6 +186,7 @@ export const increment = (n: bigint): bigint => n + bigint1 * * @example * ```ts + * import * as assert from "node:assert" * import { decrement } from "effect/BigInt" * * assert.deepStrictEqual(decrement(3n), 2n) @@ -209,6 +217,7 @@ export const Order: order.Order = order.bigint * * @example * ```ts + * import * as assert from "node:assert" * import { lessThan } from "effect/BigInt" * * assert.deepStrictEqual(lessThan(2n, 3n), true) @@ -232,6 +241,7 @@ export const lessThan: { * * @example * ```ts + * import * as assert from "node:assert" * import { lessThanOrEqualTo } from "effect/BigInt" * * assert.deepStrictEqual(lessThanOrEqualTo(2n, 3n), true) @@ -255,6 +265,7 @@ export const lessThanOrEqualTo: { * * @example * ```ts + * import * as assert from "node:assert" * import { greaterThan } from "effect/BigInt" * * assert.deepStrictEqual(greaterThan(2n, 3n), false) @@ -278,6 +289,7 @@ export const greaterThan: { * * @example * ```ts + * import * as assert from "node:assert" * import { greaterThanOrEqualTo } from "effect/BigInt" * * assert.deepStrictEqual(greaterThanOrEqualTo(2n, 3n), false) @@ -302,6 +314,7 @@ export const greaterThanOrEqualTo: { * * @example * ```ts + * import * as assert from "node:assert" * import { BigInt } from "effect" * * const between = BigInt.between({ minimum: 0n, maximum: 5n }) @@ -338,6 +351,7 @@ export const between: { * * @example * ```ts + * import * as assert from "node:assert" * import { BigInt } from "effect" * * const clamp = BigInt.clamp({ minimum: 1n, maximum: 5n }) @@ -368,6 +382,7 @@ export const clamp: { * * @example * ```ts + * import * as assert from "node:assert" * import { min } from "effect/BigInt" * * assert.deepStrictEqual(min(2n, 3n), 2n) @@ -388,6 +403,7 @@ export const min: { * * @example * ```ts + * import * as assert from "node:assert" * import { max } from "effect/BigInt" * * assert.deepStrictEqual(max(2n, 3n), 3n) @@ -407,6 +423,7 @@ export const max: { * * @example * ```ts + * import * as assert from "node:assert" * import { sign } from "effect/BigInt" * * assert.deepStrictEqual(sign(-5n), -1) @@ -426,6 +443,7 @@ export const sign = (n: bigint): Ordering => Order(n, bigint0) * * @example * ```ts + * import * as assert from "node:assert" * import { abs } from "effect/BigInt" * * assert.deepStrictEqual(abs(-5n), 5n) @@ -446,6 +464,7 @@ export const abs = (n: bigint): bigint => (n < bigint0 ? -n : n) * * @example * ```ts + * import * as assert from "node:assert" * import { gcd } from "effect/BigInt" * * assert.deepStrictEqual(gcd(2n, 3n), 1n) @@ -476,6 +495,7 @@ export const gcd: { * * @example * ```ts + * import * as assert from "node:assert" * import { lcm } from "effect/BigInt" * * assert.deepStrictEqual(lcm(2n, 3n), 6n) @@ -498,6 +518,7 @@ export const lcm: { * * @example * ```ts + * import * as assert from "node:assert" * import { unsafeSqrt } from "effect/BigInt" * * assert.deepStrictEqual(unsafeSqrt(4n), 2n) @@ -529,6 +550,7 @@ export const unsafeSqrt = (n: bigint): bigint => { * * @example * ```ts + * import * as assert from "node:assert" * import { BigInt, Option } from "effect" * * assert.deepStrictEqual(BigInt.sqrt(4n), Option.some(2n)) @@ -550,6 +572,7 @@ export const sqrt = (n: bigint): Option.Option => * * @example * ```ts + * import * as assert from "node:assert" * import { sumAll } from "effect/BigInt" * * assert.deepStrictEqual(sumAll([2n, 3n, 4n]), 9n) @@ -573,6 +596,7 @@ export const sumAll = (collection: Iterable): bigint => { * * @example * ```ts + * import * as assert from "node:assert" * import { multiplyAll } from "effect/BigInt" * * assert.deepStrictEqual(multiplyAll([2n, 3n, 4n]), 24n) @@ -603,6 +627,7 @@ export const multiplyAll = (collection: Iterable): bigint => { * * @example * ```ts + * import * as assert from "node:assert" * import { BigInt as BI, Option } from "effect" * * assert.deepStrictEqual(BI.toNumber(BigInt(42)), Option.some(42)) @@ -630,6 +655,7 @@ export const toNumber = (b: bigint): Option.Option => { * * @example * ```ts + * import * as assert from "node:assert" * import { BigInt as BI, Option } from "effect" * * assert.deepStrictEqual(BI.fromString("42"), Option.some(BigInt(42))) @@ -661,6 +687,7 @@ export const fromString = (s: string): Option.Option => { * * @example * ```ts + * import * as assert from "node:assert" * import { BigInt as BI, Option } from "effect" * * assert.deepStrictEqual(BI.fromNumber(42), Option.some(BigInt(42))) diff --git a/packages/effect/src/Boolean.ts b/packages/effect/src/Boolean.ts index f15df71367c..d508d064457 100644 --- a/packages/effect/src/Boolean.ts +++ b/packages/effect/src/Boolean.ts @@ -18,6 +18,7 @@ import * as predicate from "./Predicate.js" * * @example * ```ts + * import * as assert from "node:assert" * import { isBoolean } from "effect/Boolean" * * assert.deepStrictEqual(isBoolean(true), true) @@ -39,6 +40,7 @@ export const isBoolean: (input: unknown) => input is boolean = predicate.isBoole * * @example * ```ts + * import * as assert from "node:assert" * import { Boolean } from "effect" * * assert.deepStrictEqual(Boolean.match(true, { onFalse: () => "It's false!", onTrue: () => "It's true!" }), "It's true!") @@ -78,6 +80,7 @@ export const Order: order.Order = order.boolean * * @example * ```ts + * import * as assert from "node:assert" * import { not } from "effect/Boolean" * * assert.deepStrictEqual(not(true), false) @@ -94,6 +97,7 @@ export const not = (self: boolean): boolean => !self * * @example * ```ts + * import * as assert from "node:assert" * import { and } from "effect/Boolean" * * assert.deepStrictEqual(and(true, true), true) @@ -115,6 +119,7 @@ export const and: { * * @example * ```ts + * import * as assert from "node:assert" * import { nand } from "effect/Boolean" * * assert.deepStrictEqual(nand(true, true), false) @@ -136,6 +141,7 @@ export const nand: { * * @example * ```ts + * import * as assert from "node:assert" * import { or } from "effect/Boolean" * * assert.deepStrictEqual(or(true, true), true) @@ -157,6 +163,7 @@ export const or: { * * @example * ```ts + * import * as assert from "node:assert" * import { nor } from "effect/Boolean" * * assert.deepStrictEqual(nor(true, true), false) @@ -178,6 +185,7 @@ export const nor: { * * @example * ```ts + * import * as assert from "node:assert" * import { xor } from "effect/Boolean" * * assert.deepStrictEqual(xor(true, true), false) @@ -199,6 +207,7 @@ export const xor: { * * @example * ```ts + * import * as assert from "node:assert" * import { eqv } from "effect/Boolean" * * assert.deepStrictEqual(eqv(true, true), true) @@ -220,6 +229,7 @@ export const eqv: { * * @example * ```ts + * import * as assert from "node:assert" * import { implies } from "effect/Boolean" * * assert.deepStrictEqual(implies(true, true), true) @@ -243,6 +253,7 @@ export const implies: { * * @example * ```ts + * import * as assert from "node:assert" * import { every } from "effect/Boolean" * * assert.deepStrictEqual(every([true, true, true]), true) @@ -267,6 +278,7 @@ export const every = (collection: Iterable): boolean => { * * @example * ```ts + * import * as assert from "node:assert" * import { some } from "effect/Boolean" * * assert.deepStrictEqual(some([true, false, true]), true) diff --git a/packages/effect/src/Brand.ts b/packages/effect/src/Brand.ts index d3569a46916..6b0c96e3126 100644 --- a/packages/effect/src/Brand.ts +++ b/packages/effect/src/Brand.ts @@ -197,6 +197,7 @@ export const errors: (...errors: Array) => Brand.BrandErrors * * @example * ```ts + * import * as assert from "node:assert" * import { Brand } from "effect" * * type Int = number & Brand.Brand<"Int"> @@ -250,6 +251,7 @@ export function refined>( * * @example * ```ts + * import * as assert from "node:assert" * import { Brand } from "effect" * * type UserId = number & Brand.Brand<"UserId"> @@ -280,6 +282,7 @@ export const nominal = >(): Brand.Constructor< * * @example * ```ts + * import * as assert from "node:assert" * import { Brand } from "effect" * * type Int = number & Brand.Brand<"Int"> diff --git a/packages/effect/src/Chunk.ts b/packages/effect/src/Chunk.ts index d692fe4c447..17984455858 100644 --- a/packages/effect/src/Chunk.ts +++ b/packages/effect/src/Chunk.ts @@ -350,6 +350,7 @@ const reverseChunk = (self: Chunk): Chunk => { * * @example * ```ts + * import * as assert from "node:assert" * import { Chunk } from "effect" * * const numbers = Chunk.make(1, 2, 3) @@ -579,6 +580,7 @@ export const dropWhile: { * * @example * ```ts + * import * as assert from "node:assert" * import { Chunk } from "effect" * * assert.deepStrictEqual( @@ -605,6 +607,7 @@ export const prependAll: { * * @example * ```ts + * import * as assert from "node:assert" * import { Chunk } from "effect" * * assert.deepStrictEqual( @@ -917,6 +920,7 @@ export declare namespace Chunk { * * @example * ```ts + * import * as assert from "node:assert" * import { Chunk } from "effect" * * assert.deepStrictEqual( diff --git a/packages/effect/src/Context.ts b/packages/effect/src/Context.ts index ac39b77c618..ae9e278019c 100644 --- a/packages/effect/src/Context.ts +++ b/packages/effect/src/Context.ts @@ -146,6 +146,7 @@ export declare namespace Tag { * * @example * ```ts + * import * as assert from "node:assert" * import { Context } from "effect" * * assert.strictEqual(Context.GenericTag("PORT").key === Context.GenericTag("PORT").key, true) @@ -195,6 +196,7 @@ export const unsafeMake: (unsafeMap: Map) => Context input is Context = internal.i * * @example * ```ts + * import * as assert from "node:assert" * import { Context } from "effect" * * assert.strictEqual(Context.isTag(Context.GenericTag("Tag")), true) @@ -237,6 +240,7 @@ export const isReference: (u: unknown) => u is Reference = internal.is * * @example * ```ts + * import * as assert from "node:assert" * import { Context } from "effect" * * assert.strictEqual(Context.isContext(Context.empty()), true) @@ -252,6 +256,7 @@ export const empty: () => Context = internal.empty * * @example * ```ts + * import * as assert from "node:assert" * import { Context } from "effect" * * const Port = Context.GenericTag<{ PORT: number }>("Port") @@ -272,6 +277,7 @@ export const make: >(tag: T, service: Tag.Service) => * * @example * ```ts + * import * as assert from "node:assert" * import { Context, pipe } from "effect" * * const Port = Context.GenericTag<{ PORT: number }>("Port") @@ -310,6 +316,7 @@ export const add: { * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Context } from "effect" * * const Port = Context.GenericTag<{ PORT: number }>("Port") @@ -356,6 +363,7 @@ export const getOrElse: { * * @example * ```ts + * import * as assert from "node:assert" * import { Context } from "effect" * * const Port = Context.GenericTag<{ PORT: number }>("Port") @@ -384,6 +392,7 @@ export const unsafeGet: { * * @example * ```ts + * import * as assert from "node:assert" * import { Context, Option } from "effect" * * const Port = Context.GenericTag<{ PORT: number }>("Port") @@ -411,6 +420,7 @@ export const getOption: { * * @example * ```ts + * import * as assert from "node:assert" * import { Context } from "effect" * * const Port = Context.GenericTag<{ PORT: number }>("Port") @@ -439,6 +449,7 @@ export const merge: { * * @example * ```ts + * import * as assert from "node:assert" * import { Context } from "effect" * * const Port = Context.GenericTag<{ PORT: number }>("Port") @@ -470,6 +481,7 @@ export const mergeAll: >( * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Context, Option } from "effect" * * const Port = Context.GenericTag<{ PORT: number }>("Port") @@ -503,6 +515,7 @@ export const omit: >>( /** * @example * ```ts + * import * as assert from "node:assert" * import { Context, Layer } from "effect" * * class MyTag extends Context.Tag("MyTag")< @@ -531,6 +544,7 @@ export const Tag: (id: Id) => () => TagCla * @example * ```ts * // Title: Declaring a Tag with a default value + * import * as assert from "node:assert" * import { Context, Effect } from "effect" * * class SpecialNumber extends Context.Reference()( diff --git a/packages/effect/src/Cron.ts b/packages/effect/src/Cron.ts index f0663dadf44..47146f681ab 100644 --- a/packages/effect/src/Cron.ts +++ b/packages/effect/src/Cron.ts @@ -230,6 +230,7 @@ export const isParseError = (u: unknown): u is ParseError => hasProperty(u, Pars * * @example * ```ts + * import * as assert from "node:assert" * import { Cron, Either } from "effect" * * // At 04:00 on every day-of-month from 8 through 14. @@ -334,6 +335,7 @@ export const unsafeParse = (cron: string, tz?: DateTime.TimeZone | string): Cron * * @example * ```ts + * import * as assert from "node:assert" * import { Cron, Either } from "effect" * * const cron = Either.getOrThrow(Cron.parse("0 4 8-14 * *")) @@ -392,6 +394,7 @@ const daysInMonth = (date: Date): number => * * @example * ```ts + * import * as assert from "node:assert" * import { Cron, Either } from "effect" * * const after = new Date("2021-01-01 00:00:00") diff --git a/packages/effect/src/Data.ts b/packages/effect/src/Data.ts index 1656e54ba89..da3b309e28a 100644 --- a/packages/effect/src/Data.ts +++ b/packages/effect/src/Data.ts @@ -28,6 +28,7 @@ export declare namespace Case { /** * @example * ```ts + * import * as assert from "node:assert" * import { Data, Equal } from "effect" * * const alice = Data.struct({ name: "Alice", age: 30 }) @@ -56,6 +57,7 @@ export const unsafeStruct = >(as: A): { readonly [ /** * @example * ```ts + * import * as assert from "node:assert" * import { Data, Equal } from "effect" * * const alice = Data.tuple("Alice", 30) @@ -77,6 +79,7 @@ export const tuple = >(...as: As): Readonly => /** * @example * ```ts + * import * as assert from "node:assert" * import { Data, Equal } from "effect" * * const alice = Data.struct({ name: "Alice", age: 30 }) @@ -117,6 +120,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { Data, Equal } from "effect" * * interface Person { @@ -147,6 +151,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { Data } from "effect" * * interface Person { @@ -178,6 +183,7 @@ export const tagged = ( * * @example * ```ts + * import * as assert from "node:assert" * import { Data, Equal } from "effect" * * class Person extends Data.Class<{ readonly name: string }> {} @@ -205,6 +211,7 @@ export const Class: new = {}>( * * @example * ```ts + * import * as assert from "node:assert" * import { Data, Equal } from "effect" * * class Person extends Data.TaggedClass("Person")<{ readonly name: string }> {} @@ -249,6 +256,7 @@ export const Structural: new( * Create a tagged enum data type, which is a union of `Data` structs. * * ```ts + * import * as assert from "node:assert" * import { Data } from "effect" * * type HttpError = Data.TaggedEnum<{ diff --git a/packages/effect/src/DateTime.ts b/packages/effect/src/DateTime.ts index efe8166d22a..5adb48ef209 100644 --- a/packages/effect/src/DateTime.ts +++ b/packages/effect/src/DateTime.ts @@ -905,6 +905,7 @@ export const toPartsUtc: (self: DateTime) => DateTime.PartsWithWeekday = Interna * @category parts * @example * ```ts + * import * as assert from "node:assert" * import { DateTime } from "effect" * * const now = DateTime.unsafeMake({ year: 2024 }) @@ -926,6 +927,7 @@ export const getPartUtc: { * @category parts * @example * ```ts + * import * as assert from "node:assert" * import { DateTime } from "effect" * * const now = DateTime.unsafeMakeZoned({ year: 2024 }, { timeZone: "Europe/London" }) diff --git a/packages/effect/src/Effect.ts b/packages/effect/src/Effect.ts index 7c21403bfb3..aac441ea264 100644 --- a/packages/effect/src/Effect.ts +++ b/packages/effect/src/Effect.ts @@ -7657,6 +7657,7 @@ export const updateService: { * * @example * ```ts + * import * as assert from "node:assert" * import { Effect, pipe } from "effect" * * const result = pipe( @@ -7689,6 +7690,7 @@ export const Do: Effect<{}> = effect.Do * * @example * ```ts + * import * as assert from "node:assert" * import { Effect, pipe } from "effect" * * const result = pipe( @@ -7722,6 +7724,7 @@ export const bind: { * * @example * ```ts + * import * as assert from "node:assert" * import { Effect, Either, pipe } from "effect" * * const result = pipe( @@ -7805,6 +7808,7 @@ export const bindAll: { * * @example * ```ts + * import * as assert from "node:assert" * import { Effect, pipe } from "effect" * * const result = pipe( diff --git a/packages/effect/src/Either.ts b/packages/effect/src/Either.ts index 6b5d15ff6c6..d2fcd5f25ff 100644 --- a/packages/effect/src/Either.ts +++ b/packages/effect/src/Either.ts @@ -142,6 +142,7 @@ export const left: (left: L) => Either = either.left * * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual(Either.fromNullable(1, () => 'fallback'), Either.right(1)) @@ -163,6 +164,7 @@ export const fromNullable: { /** * @example * ```ts + * import * as assert from "node:assert" * import { Either, Option } from "effect" * * assert.deepStrictEqual(Either.fromOption(Option.some(1), () => 'error'), Either.right(1)) @@ -224,6 +226,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual(Either.isEither(Either.right(1)), true) @@ -243,6 +246,7 @@ export const isEither: (input: unknown) => input is Either = e * * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual(Either.isLeft(Either.right(1)), false) @@ -261,6 +265,7 @@ export const isLeft: (self: Either) => self is Left = either.i * * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual(Either.isRight(Either.right(1)), true) @@ -277,6 +282,7 @@ export const isRight: (self: Either) => self is Right = either * * @example * ```ts + * import * as assert from "node:assert" * import { Either, Option } from "effect" * * assert.deepStrictEqual(Either.getRight(Either.right('ok')), Option.some('ok')) @@ -293,6 +299,7 @@ export const getRight: (self: Either) => Option = either.getRight * * @example * ```ts + * import * as assert from "node:assert" * import { Either, Option } from "effect" * * assert.deepStrictEqual(Either.getLeft(Either.right('ok')), Option.none()) @@ -381,6 +388,7 @@ export const map: { * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Either } from "effect" * * const onLeft = (strings: ReadonlyArray): string => `strings: ${strings.join(', ')}` @@ -422,6 +430,7 @@ export const match: { * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Either } from "effect" * * const isPositive = (n: number): boolean => n > 0 @@ -473,6 +482,7 @@ export const liftPredicate: { * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Either } from "effect" * * const isPositive = (n: number): boolean => n > 0 @@ -531,6 +541,7 @@ export const merge: (self: Either) => L | R = match({ * * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual(Either.getOrElse(Either.right(1), (error) => error + "!"), 1) @@ -551,6 +562,7 @@ export const getOrElse: { /** * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual(Either.getOrNull(Either.right(1)), 1) @@ -565,6 +577,7 @@ export const getOrNull: (self: Either) => R | null = getOrElse(const /** * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual(Either.getOrUndefined(Either.right(1)), 1) @@ -586,6 +599,7 @@ export const getOrUndefined: (self: Either) => R | undefined = getOr * * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual( @@ -619,6 +633,7 @@ export const getOrThrowWith: { * * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual(Either.getOrThrow(Either.right(1)), 1) @@ -731,6 +746,7 @@ export const ap: { * * @example * ```ts + * import * as assert from "node:assert" * import { Either } from "effect" * * assert.deepStrictEqual(Either.all([Either.right(1), Either.right(2)]), Either.right([1, 2])) @@ -828,6 +844,7 @@ export const gen: Gen.Gen> = (.. * * @example * ```ts + * import * as assert from "node:assert" * import { Either, pipe } from "effect" * * const result = pipe( @@ -860,6 +877,7 @@ export const Do: Either<{}> = right({}) * * @example * ```ts + * import * as assert from "node:assert" * import { Either, pipe } from "effect" * * const result = pipe( @@ -902,6 +920,7 @@ export const bind: { * * @example * ```ts + * import * as assert from "node:assert" * import { Either, pipe } from "effect" * * const result = pipe( @@ -950,6 +969,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { Either, pipe } from "effect" * * const result = pipe( diff --git a/packages/effect/src/Function.ts b/packages/effect/src/Function.ts index b6c19215f62..d2ffab82379 100644 --- a/packages/effect/src/Function.ts +++ b/packages/effect/src/Function.ts @@ -18,6 +18,7 @@ export interface FunctionTypeLambda extends TypeLambda { * * @example * ```ts + * import * as assert from "node:assert" * import { isFunction } from "effect/Predicate" * * assert.deepStrictEqual(isFunction(isFunction), true) @@ -49,6 +50,7 @@ export const isFunction = (input: unknown): input is Function => typeof input == * * @example * ```ts + * import * as assert from "node:assert" * import { dual, pipe } from "effect/Function" * * // Exampe using arity to determine data-first or data-last style @@ -158,6 +160,7 @@ export const dual: { * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, apply } from "effect/Function" * import { length } from "effect/String" * @@ -173,6 +176,7 @@ export const apply = (a: A) => (self: (a: A) => B): B => self(a) * * @example * ```ts + * import * as assert from "node:assert" * import { LazyArg, constant } from "effect/Function" * * const constNull: LazyArg = constant(null) @@ -187,6 +191,7 @@ export interface LazyArg { /** * @example * ```ts + * import * as assert from "node:assert" * import { FunctionN } from "effect/Function" * * const sum: FunctionN<[number, number], number> = (a, b) => a + b @@ -205,6 +210,7 @@ export interface FunctionN, B> { * * @example * ```ts + * import * as assert from "node:assert" * import { identity } from "effect/Function" * * assert.deepStrictEqual(identity(5), 5) @@ -220,6 +226,7 @@ export const identity = (a: A): A => a * * @example * ```ts + * import * as assert from "node:assert" * import { satisfies } from "effect/Function" * * const test1 = satisfies()(5 as const) @@ -242,6 +249,7 @@ export const satisfies = () => (b: B) => b * * @example * ```ts + * import * as assert from "node:assert" * import { unsafeCoerce, identity } from "effect/Function" * * assert.deepStrictEqual(unsafeCoerce, identity) @@ -261,6 +269,7 @@ export const unsafeCoerce: (a: A) => B = identity as any * * @example * ```ts + * import * as assert from "node:assert" * import { constant } from "effect/Function" * * const constNull = constant(null) @@ -278,6 +287,7 @@ export const constant = (value: A): LazyArg => () => value * * @example * ```ts + * import * as assert from "node:assert" * import { constTrue } from "effect/Function" * * assert.deepStrictEqual(constTrue(), true) @@ -292,6 +302,7 @@ export const constTrue: LazyArg = constant(true) * * @example * ```ts + * import * as assert from "node:assert" * import { constFalse } from "effect/Function" * * assert.deepStrictEqual(constFalse(), false) @@ -306,6 +317,7 @@ export const constFalse: LazyArg = constant(false) * * @example * ```ts + * import * as assert from "node:assert" * import { constNull } from "effect/Function" * * assert.deepStrictEqual(constNull(), null) @@ -320,6 +332,7 @@ export const constNull: LazyArg = constant(null) * * @example * ```ts + * import * as assert from "node:assert" * import { constUndefined } from "effect/Function" * * assert.deepStrictEqual(constUndefined(), undefined) @@ -334,6 +347,7 @@ export const constUndefined: LazyArg = constant(undefined) * * @example * ```ts + * import * as assert from "node:assert" * import { constVoid } from "effect/Function" * * assert.deepStrictEqual(constVoid(), undefined) @@ -350,6 +364,7 @@ export const constVoid: LazyArg = constUndefined * * @example * ```ts + * import * as assert from "node:assert" * import { flip } from "effect/Function" * * const f = (a: number) => (b: string) => a - b.length @@ -374,6 +389,7 @@ export const flip = , B extends Array, C>( * * @example * ```ts + * import * as assert from "node:assert" * import { compose } from "effect/Function" * * const increment = (n: number) => n + 1; @@ -402,10 +418,11 @@ export const absurd = (_: never): A => { } /** - * Creates a tupled version of this function: instead of `n` arguments, it accepts a single tuple argument. + * Creates a version of this function: instead of `n` arguments, it accepts a single tuple argument. * * @example * ```ts + * import * as assert from "node:assert" * import { tupled } from "effect/Function" * * const sumTupled = tupled((x: number, y: number): number => x + y) @@ -422,6 +439,7 @@ export const tupled = , B>(f: (...a: A) => B): * * @example * ```ts + * import * as assert from "node:assert" * import { untupled } from "effect/Function" * * const getFirst = untupled((tuple: [A, B]): A => tuple[0]) @@ -996,6 +1014,7 @@ export function pipe( * * @example * ```ts + * import * as assert from "node:assert" * import { flow } from "effect/Function" * * const len = (s: string): number => s.length @@ -1191,6 +1210,7 @@ export const hole: () => T = unsafeCoerce(absurd) * * @example * ```ts + * import * as assert from "node:assert" * import { SK } from "effect/Function"; * * assert.deepStrictEqual(SK(0, "hello"), "hello") diff --git a/packages/effect/src/Iterable.ts b/packages/effect/src/Iterable.ts index 81f197d1950..acf0e1a0c0a 100644 --- a/packages/effect/src/Iterable.ts +++ b/packages/effect/src/Iterable.ts @@ -25,6 +25,7 @@ import type { NoInfer } from "./Types.js" * * @example * ```ts + * import * as assert from "node:assert" * import { makeBy } from "effect/Iterable" * * assert.deepStrictEqual(Array.from(makeBy(n => n * 2, { length: 5 })), [0, 2, 4, 6, 8]) @@ -59,6 +60,7 @@ export const makeBy = (f: (i: number) => A, options?: { * * @example * ```ts + * import * as assert from "node:assert" * import { range } from "effect/Iterable" * * assert.deepStrictEqual(Array.from(range(1, 3)), [1, 2, 3]) @@ -83,6 +85,7 @@ export const range = (start: number, end?: number): Iterable => { * * @example * ```ts + * import * as assert from "node:assert" * import { replicate } from "effect/Iterable" * * assert.deepStrictEqual(Array.from(replicate("a", 3)), ["a", "a", "a"]) @@ -103,6 +106,7 @@ export const replicate: { * * @example * ```ts + * import * as assert from "node:assert" * import { fromRecord } from "effect/Iterable" * * const x = { a: 1, b: 2, c: 3 } @@ -138,6 +142,7 @@ export const prepend: { * * @example * ```ts + * import * as assert from "node:assert" * import { Iterable } from "effect" * * assert.deepStrictEqual( @@ -236,6 +241,7 @@ export const scan: { * * @example * ```ts + * import * as assert from "node:assert" * import { isEmpty } from "effect/Iterable" * * assert.deepStrictEqual(isEmpty([]), true); @@ -832,6 +838,7 @@ export const filterMapWhile: { * * @example * ```ts + * import * as assert from "node:assert" * import { Iterable, Option } from "effect" * * assert.deepStrictEqual( @@ -850,6 +857,7 @@ export const getSomes: (self: Iterable>) => Iterable = filterMap * * @example * ```ts + * import * as assert from "node:assert" * import { Iterable, Either } from "effect" * * assert.deepStrictEqual( @@ -868,6 +876,7 @@ export const getLefts = (self: Iterable>): Iterable => fil * * @example * ```ts + * import * as assert from "node:assert" * import { Iterable, Either } from "effect" * * assert.deepStrictEqual( diff --git a/packages/effect/src/List.ts b/packages/effect/src/List.ts index 0ff771622cd..528a8992742 100644 --- a/packages/effect/src/List.ts +++ b/packages/effect/src/List.ts @@ -326,6 +326,7 @@ export const append: { * * @example * ```ts + * import * as assert from "node:assert" * import { List } from "effect" * * assert.deepStrictEqual( @@ -361,6 +362,7 @@ export const prepend: { * * @example * ```ts + * import * as assert from "node:assert" * import { List } from "effect" * * assert.deepStrictEqual( diff --git a/packages/effect/src/Mailbox.ts b/packages/effect/src/Mailbox.ts index d2d71b29bbd..972fbf50cd4 100644 --- a/packages/effect/src/Mailbox.ts +++ b/packages/effect/src/Mailbox.ts @@ -179,6 +179,7 @@ export interface ReadonlyMailbox * @category constructors * @example * ```ts + * import * as assert from "node:assert" * import { Effect, Mailbox } from "effect" * * Effect.gen(function*() { diff --git a/packages/effect/src/Number.ts b/packages/effect/src/Number.ts index 4ad347f469d..02f7b1d90db 100644 --- a/packages/effect/src/Number.ts +++ b/packages/effect/src/Number.ts @@ -20,6 +20,7 @@ import * as predicate from "./Predicate.js" * * @example * ```ts + * import * as assert from "node:assert" * import { isNumber } from "effect/Number" * * assert.deepStrictEqual(isNumber(2), true) @@ -39,6 +40,7 @@ export const isNumber: (input: unknown) => input is number = predicate.isNumber * * @example * ```ts + * import * as assert from "node:assert" * import { sum } from "effect/Number" * * assert.deepStrictEqual(sum(2, 3), 5) @@ -60,6 +62,7 @@ export const sum: { * * @example * ```ts + * import * as assert from "node:assert" * import { multiply } from "effect/Number" * * assert.deepStrictEqual(multiply(2, 3), 6) @@ -81,6 +84,7 @@ export const multiply: { * * @example * ```ts + * import * as assert from "node:assert" * import { subtract } from "effect/Number" * * assert.deepStrictEqual(subtract(2, 3), -1) @@ -102,6 +106,7 @@ export const subtract: { * * @example * ```ts + * import * as assert from "node:assert" * import { Number, Option } from "effect" * * assert.deepStrictEqual(Number.divide(6, 3), Option.some(2)) @@ -129,6 +134,7 @@ export const divide: { * * @example * ```ts + * import * as assert from "node:assert" * import { unsafeDivide } from "effect/Number" * * assert.deepStrictEqual(unsafeDivide(6, 3), 2) @@ -149,6 +155,7 @@ export const unsafeDivide: { * * @example * ```ts + * import * as assert from "node:assert" * import { increment } from "effect/Number" * * assert.deepStrictEqual(increment(2), 3) @@ -166,6 +173,7 @@ export const increment = (n: number): number => n + 1 * * @example * ```ts + * import * as assert from "node:assert" * import { decrement } from "effect/Number" * * assert.deepStrictEqual(decrement(3), 2) @@ -196,6 +204,7 @@ export const Order: order.Order = order.number * * @example * ```ts + * import * as assert from "node:assert" * import { lessThan } from "effect/Number" * * assert.deepStrictEqual(lessThan(2, 3), true) @@ -219,6 +228,7 @@ export const lessThan: { * * @example * ```ts + * import * as assert from "node:assert" * import { lessThanOrEqualTo } from "effect/Number" * * assert.deepStrictEqual(lessThanOrEqualTo(2, 3), true) @@ -242,6 +252,7 @@ export const lessThanOrEqualTo: { * * @example * ```ts + * import * as assert from "node:assert" * import { greaterThan } from "effect/Number" * * assert.deepStrictEqual(greaterThan(2, 3), false) @@ -265,6 +276,7 @@ export const greaterThan: { * * @example * ```ts + * import * as assert from "node:assert" * import { greaterThanOrEqualTo } from "effect/Number" * * assert.deepStrictEqual(greaterThanOrEqualTo(2, 3), false) @@ -289,6 +301,7 @@ export const greaterThanOrEqualTo: { * * @example * ```ts + * import * as assert from "node:assert" * import { Number } from "effect" * * const between = Number.between({ minimum: 0, maximum: 5 }) @@ -325,6 +338,7 @@ export const between: { * * @example * ```ts + * import * as assert from "node:assert" * import { Number } from "effect" * * const clamp = Number.clamp({ minimum: 1, maximum: 5 }) @@ -355,6 +369,7 @@ export const clamp: { * * @example * ```ts + * import * as assert from "node:assert" * import { min } from "effect/Number" * * assert.deepStrictEqual(min(2, 3), 2) @@ -375,6 +390,7 @@ export const min: { * * @example * ```ts + * import * as assert from "node:assert" * import { max } from "effect/Number" * * assert.deepStrictEqual(max(2, 3), 3) @@ -394,6 +410,7 @@ export const max: { * * @example * ```ts + * import * as assert from "node:assert" * import { sign } from "effect/Number" * * assert.deepStrictEqual(sign(-5), -1) @@ -413,6 +430,7 @@ export const sign = (n: number): Ordering => Order(n, 0) * * @example * ```ts + * import * as assert from "node:assert" * import { sumAll } from "effect/Number" * * assert.deepStrictEqual(sumAll([2, 3, 4]), 9) @@ -436,6 +454,7 @@ export const sumAll = (collection: Iterable): number => { * * @example * ```ts + * import * as assert from "node:assert" * import { multiplyAll } from "effect/Number" * * assert.deepStrictEqual(multiplyAll([2, 3, 4]), 24) @@ -465,6 +484,7 @@ export const multiplyAll = (collection: Iterable): number => { * * @example * ```ts + * import * as assert from "node:assert" * import { remainder } from "effect/Number" * * assert.deepStrictEqual(remainder(2, 2), 0) @@ -495,6 +515,7 @@ export const remainder: { * * @example * ```ts + * import * as assert from "node:assert" * import { nextPow2 } from "effect/Number" * * assert.deepStrictEqual(nextPow2(5), 8) @@ -543,6 +564,7 @@ export const parse = (s: string): Option => { * * @example * ```ts + * import * as assert from "node:assert" * import { round } from "effect/Number" * * assert.deepStrictEqual(round(1.1234, 2), 1.12) diff --git a/packages/effect/src/Option.ts b/packages/effect/src/Option.ts index ad6aefec07e..add150fed71 100644 --- a/packages/effect/src/Option.ts +++ b/packages/effect/src/Option.ts @@ -836,6 +836,7 @@ export const liftThrowable = , B>( * * @example * ```ts + * import * as assert from "node:assert" * import { Option } from "effect" * * assert.deepStrictEqual( @@ -873,6 +874,7 @@ export const getOrThrowWith: { * * @example * ```ts + * import * as assert from "node:assert" * import { Option } from "effect" * * assert.deepStrictEqual(Option.getOrThrow(Option.some(1)), 1) @@ -1956,6 +1958,7 @@ export const exists: { * * @example * ```ts + * import * as assert from "node:assert" * import { Option, pipe } from "effect" * * const result = pipe( @@ -2006,6 +2009,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { Option, pipe } from "effect" * * const result = pipe( @@ -2041,6 +2045,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { Option, pipe } from "effect" * * const result = pipe( @@ -2085,6 +2090,7 @@ export const bind: { * * @example * ```ts + * import * as assert from "node:assert" * import { Option, pipe } from "effect" * * const result = pipe( diff --git a/packages/effect/src/Order.ts b/packages/effect/src/Order.ts index 5f8a7139696..c4cce409092 100644 --- a/packages/effect/src/Order.ts +++ b/packages/effect/src/Order.ts @@ -319,6 +319,7 @@ export const max = (O: Order): { * * @example * ```ts + * import * as assert from "node:assert" * import { Order, Number } from "effect" * * const clamp = Order.clamp(Number.Order)({ minimum: 1, maximum: 5 }) diff --git a/packages/effect/src/Ordering.ts b/packages/effect/src/Ordering.ts index 0d4dc6ec49d..377b3df3aba 100644 --- a/packages/effect/src/Ordering.ts +++ b/packages/effect/src/Ordering.ts @@ -17,6 +17,7 @@ export type Ordering = -1 | 0 | 1 * * @example * ```ts + * import * as assert from "node:assert" * import { reverse } from "effect/Ordering" * * assert.deepStrictEqual(reverse(1), -1) @@ -38,6 +39,7 @@ export const reverse = (o: Ordering): Ordering => (o === -1 ? 1 : o === 1 ? -1 : * * @example * ```ts + * import * as assert from "node:assert" * import { Ordering } from "effect" * import { constant } from "effect/Function" * diff --git a/packages/effect/src/Predicate.ts b/packages/effect/src/Predicate.ts index 201847b09b6..ce763a22aed 100644 --- a/packages/effect/src/Predicate.ts +++ b/packages/effect/src/Predicate.ts @@ -76,6 +76,7 @@ export declare namespace Refinement { * * @example * ```ts + * import * as assert from "node:assert" * import { Predicate, Number } from "effect" * * const minLength3 = Predicate.mapInput(Number.greaterThan(2), (s: string) => s.length) @@ -104,6 +105,7 @@ export const mapInput: { * * @example * ```ts + * import * as assert from "node:assert" * import { isTupleOf } from "effect/Predicate" * * assert.deepStrictEqual(isTupleOf([1, 2, 3], 3), true); @@ -135,6 +137,7 @@ export const isTupleOf: { * * @example * ```ts + * import * as assert from "node:assert" * import { isTupleOfAtLeast } from "effect/Predicate" * * assert.deepStrictEqual(isTupleOfAtLeast([1, 2, 3], 3), true); @@ -163,6 +166,7 @@ export const isTupleOfAtLeast: { * * @example * ```ts + * import * as assert from "node:assert" * import { isTruthy } from "effect/Predicate" * * assert.deepStrictEqual(isTruthy(1), true) @@ -182,6 +186,7 @@ export const isTruthy = (input: unknown) => !!input * * @example * ```ts + * import * as assert from "node:assert" * import { isSet } from "effect/Predicate" * * assert.deepStrictEqual(isSet(new Set([1, 2])), true) @@ -203,6 +208,7 @@ export const isSet = (input: unknown): input is Set => input instanceof * * @example * ```ts + * import * as assert from "node:assert" * import { isMap } from "effect/Predicate" * * assert.deepStrictEqual(isMap(new Map()), true) @@ -223,6 +229,7 @@ export const isMap = (input: unknown): input is Map => input i * * @example * ```ts + * import * as assert from "node:assert" * import { isString } from "effect/Predicate" * * assert.deepStrictEqual(isString("a"), true) @@ -242,6 +249,7 @@ export const isString = (input: unknown): input is string => typeof input === "s * * @example * ```ts + * import * as assert from "node:assert" * import { isNumber } from "effect/Predicate" * * assert.deepStrictEqual(isNumber(2), true) @@ -261,6 +269,7 @@ export const isNumber = (input: unknown): input is number => typeof input === "n * * @example * ```ts + * import * as assert from "node:assert" * import { isBoolean } from "effect/Predicate" * * assert.deepStrictEqual(isBoolean(true), true) @@ -280,6 +289,7 @@ export const isBoolean = (input: unknown): input is boolean => typeof input === * * @example * ```ts + * import * as assert from "node:assert" * import { isBigInt } from "effect/Predicate" * * assert.deepStrictEqual(isBigInt(1n), true) @@ -299,6 +309,7 @@ export const isBigInt = (input: unknown): input is bigint => typeof input === "b * * @example * ```ts + * import * as assert from "node:assert" * import { isSymbol } from "effect/Predicate" * * assert.deepStrictEqual(isSymbol(Symbol.for("a")), true) @@ -318,6 +329,7 @@ export const isSymbol = (input: unknown): input is symbol => typeof input === "s * * @example * ```ts + * import * as assert from "node:assert" * import { isFunction } from "effect/Predicate" * * assert.deepStrictEqual(isFunction(isFunction), true) @@ -337,6 +349,7 @@ export const isFunction: (input: unknown) => input is Function = isFunction_ * * @example * ```ts + * import * as assert from "node:assert" * import { isUndefined } from "effect/Predicate" * * assert.deepStrictEqual(isUndefined(undefined), true) @@ -357,6 +370,7 @@ export const isUndefined = (input: unknown): input is undefined => input === und * * @example * ```ts + * import * as assert from "node:assert" * import { isNotUndefined } from "effect/Predicate" * * assert.deepStrictEqual(isNotUndefined(null), true) @@ -377,6 +391,7 @@ export const isNotUndefined = (input: A): input is Exclude => i * * @example * ```ts + * import * as assert from "node:assert" * import { isNull } from "effect/Predicate" * * assert.deepStrictEqual(isNull(null), true) @@ -397,6 +412,7 @@ export const isNull = (input: unknown): input is null => input === null * * @example * ```ts + * import * as assert from "node:assert" * import { isNotNull } from "effect/Predicate" * * assert.deepStrictEqual(isNotNull(undefined), true) @@ -417,6 +433,7 @@ export const isNotNull = (input: A): input is Exclude => input !== n * * @example * ```ts + * import * as assert from "node:assert" * import { isNever } from "effect/Predicate" * * assert.deepStrictEqual(isNever(null), false) @@ -437,6 +454,7 @@ export const isNever: (input: unknown) => input is never = (_: unknown): _ is ne * * @example * ```ts + * import * as assert from "node:assert" * import { isUnknown } from "effect/Predicate" * * assert.deepStrictEqual(isUnknown(null), true) @@ -462,6 +480,7 @@ export const isRecordOrArray = (input: unknown): input is { [x: PropertyKey]: un * * @example * ```ts + * import * as assert from "node:assert" * import { isObject } from "effect/Predicate" * * assert.deepStrictEqual(isObject({}), true) @@ -502,6 +521,7 @@ export const hasProperty: { * * @example * ```ts + * import * as assert from "node:assert" * import { isTagged } from "effect/Predicate" * * assert.deepStrictEqual(isTagged(1, "a"), false) @@ -530,6 +550,7 @@ export const isTagged: { * * @example * ```ts + * import * as assert from "node:assert" * import { isNullable } from "effect/Predicate" * * assert.deepStrictEqual(isNullable(null), true) @@ -551,6 +572,7 @@ export const isNullable = (input: A): input is Extract = * * @example * ```ts + * import * as assert from "node:assert" * import { isNotNullable } from "effect/Predicate" * * assert.deepStrictEqual(isNotNullable({}), true) @@ -572,6 +594,7 @@ export const isNotNullable = (input: A): input is NonNullable => input !== * * @example * ```ts + * import * as assert from "node:assert" * import { isError } from "effect/Predicate" * * assert.deepStrictEqual(isError(new Error()), true) @@ -592,6 +615,7 @@ export const isError = (input: unknown): input is Error => input instanceof Erro * * @example * ```ts + * import * as assert from "node:assert" * import { isUint8Array } from "effect/Predicate" * * assert.deepStrictEqual(isUint8Array(new Uint8Array()), true) @@ -612,6 +636,7 @@ export const isUint8Array = (input: unknown): input is Uint8Array => input insta * * @example * ```ts + * import * as assert from "node:assert" * import { isDate } from "effect/Predicate" * * assert.deepStrictEqual(isDate(new Date()), true) @@ -632,6 +657,7 @@ export const isDate = (input: unknown): input is Date => input instanceof Date * * @example * ```ts + * import * as assert from "node:assert" * import { isIterable } from "effect/Predicate" * * assert.deepStrictEqual(isIterable([]), true) @@ -653,6 +679,7 @@ export const isIterable = (input: unknown): input is Iterable => hasPro * * @example * ```ts + * import * as assert from "node:assert" * import { isRecord } from "effect/Predicate" * * assert.deepStrictEqual(isRecord({}), true) @@ -678,6 +705,7 @@ export const isRecord = (input: unknown): input is { [x: string | symbol]: unkno * * @example * ```ts + * import * as assert from "node:assert" * import { isReadonlyRecord } from "effect/Predicate" * * assert.deepStrictEqual(isReadonlyRecord({}), true) @@ -703,6 +731,7 @@ export const isReadonlyRecord: ( * * @example * ```ts + * import * as assert from "node:assert" * import { isPromise } from "effect/Predicate" * * assert.deepStrictEqual(isPromise({}), false) @@ -732,6 +761,7 @@ export const isPromiseLike = ( * * @example * ```ts + * import * as assert from "node:assert" * import { Predicate } from "effect" * * assert.deepStrictEqual(Predicate.isRegExp(/a/), true) @@ -857,6 +887,7 @@ export const struct: { * * @example * ```ts + * import * as assert from "node:assert" * import { Predicate, Number } from "effect" * * const isPositive = Predicate.not(Number.lessThan(0)) @@ -879,6 +910,7 @@ export const not = (self: Predicate): Predicate => (a) => !self(a) * * @example * ```ts + * import * as assert from "node:assert" * import { Predicate, Number } from "effect" * * const nonZero = Predicate.or(Number.lessThan(0), Number.greaterThan(0)) @@ -906,6 +938,7 @@ export const or: { * * @example * ```ts + * import * as assert from "node:assert" * import { Predicate } from "effect" * * const minLength = (n: number) => (s: string) => s.length >= n @@ -969,6 +1002,7 @@ export const eqv: { * * @example * ```ts + * import * as assert from "node:assert" * import { Predicate } from "effect" * * type Triple = { diff --git a/packages/effect/src/Random.ts b/packages/effect/src/Random.ts index c74d1e17b06..9a95c24483b 100644 --- a/packages/effect/src/Random.ts +++ b/packages/effect/src/Random.ts @@ -158,6 +158,7 @@ export const Random: Context.Tag = internal.randomTag * * @example * ```ts + * import * as assert from "node:assert" * import { Effect, Random } from "effect" * * const random1 = Random.make("myseed") diff --git a/packages/effect/src/Record.ts b/packages/effect/src/Record.ts index cd382fea53e..7477b119422 100644 --- a/packages/effect/src/Record.ts +++ b/packages/effect/src/Record.ts @@ -70,6 +70,7 @@ export const empty = (): Record< * * @example * ```ts + * import * as assert from "node:assert" * import { isEmptyRecord } from "effect/Record" * * assert.deepStrictEqual(isEmptyRecord({}), true); @@ -89,6 +90,7 @@ export const isEmptyRecord = (self: Record): self is * * @example * ```ts + * import * as assert from "node:assert" * import { isEmptyReadonlyRecord } from "effect/Record" * * assert.deepStrictEqual(isEmptyReadonlyRecord({}), true); @@ -111,6 +113,7 @@ export const isEmptyReadonlyRecord: ( * * @example * ```ts + * import * as assert from "node:assert" * import { fromIterableWith } from "effect/Record" * * const input = [1, 2, 3, 4] @@ -155,6 +158,7 @@ export const fromIterableWith: { * * @example * ```ts + * import * as assert from "node:assert" * import { fromIterableBy } from "effect/Record" * * const users = [ @@ -189,6 +193,7 @@ export const fromIterableBy = ( * * @example * ```ts + * import * as assert from "node:assert" * import { fromEntries } from "effect/Record" * * const input: Array<[string, number]> = [["a", 1], ["b", 2]] @@ -211,6 +216,7 @@ export const fromEntries: ( * * @example * ```ts + * import * as assert from "node:assert" * import { collect } from "effect/Record" * * const x = { a: 1, b: 2, c: 3 } @@ -241,6 +247,7 @@ export const collect: { * * @example * ```ts + * import * as assert from "node:assert" * import { toEntries } from "effect/Record" * * const x = { a: 1, b: 2, c: 3 } @@ -262,6 +269,7 @@ export const toEntries: (self: ReadonlyRecord) => Arr * * @example * ```ts + * import * as assert from "node:assert" * import { size } from "effect/Record"; * * assert.deepStrictEqual(size({ a: "a", b: 1, c: true }), 3); @@ -279,6 +287,7 @@ export const size = (self: ReadonlyRecord): number => * * @example * ```ts + * import * as assert from "node:assert" * import { empty, has } from "effect/Record" * * assert.deepStrictEqual(has({ a: 1, b: 2 }, "a"), true); @@ -311,6 +320,7 @@ export const has: { * * @example * ```ts + * import * as assert from "node:assert" * import { Record as R, Option } from "effect" * * const person: Record = { name: "John Doe", age: 35 } @@ -340,6 +350,7 @@ export const get: { * * @example * ```ts + * import * as assert from "node:assert" * import { Record as R } from "effect" * * const f = (x: number) => x * 2 @@ -382,6 +393,7 @@ export const modify: { * * @example * ```ts + * import * as assert from "node:assert" * import { Record as R, Option } from "effect" * * const f = (x: number) => x * 2 @@ -431,6 +443,7 @@ export const modifyOption: { * * @example * ```ts + * import * as assert from "node:assert" * import { Record, Option } from "effect" * * assert.deepStrictEqual( @@ -470,6 +483,7 @@ export const replaceOption: { * * @example * ```ts + * import * as assert from "node:assert" * import { remove } from "effect/Record" * * assert.deepStrictEqual(remove({ a: 1, b: 2 }, "a"), { b: 2 }) @@ -502,6 +516,7 @@ export const remove: { * * @example * ```ts + * import * as assert from "node:assert" * import { Record as R, Option } from "effect" * * assert.deepStrictEqual(R.pop({ a: 1, b: 2 }, "a"), Option.some([1, { b: 2 }])) @@ -533,6 +548,7 @@ export const pop: { * * @example * ```ts + * import * as assert from "node:assert" * import { map } from "effect/Record" * * const f = (n: number) => `-${n}` @@ -566,6 +582,7 @@ export const map: { * * @example * ```ts + * import * as assert from "node:assert" * import { mapKeys } from "effect/Record" * * assert.deepStrictEqual(mapKeys({ a: 3, b: 5 }, (key) => key.toUpperCase()), { A: 3, B: 5 }) @@ -602,6 +619,7 @@ export const mapKeys: { * * @example * ```ts + * import * as assert from "node:assert" * import { mapEntries } from "effect/Record" * * assert.deepStrictEqual(mapEntries({ a: 3, b: 5 }, (a, key) => [key.toUpperCase(), a + 1]), { A: 4, B: 6 }) @@ -642,6 +660,7 @@ export const mapEntries: { * * @example * ```ts + * import * as assert from "node:assert" * import { Record, Option } from "effect" * * const x = { a: 1, b: 2, c: 3 } @@ -684,6 +703,7 @@ export const filterMap: { * * @example * ```ts + * import * as assert from "node:assert" * import { filter } from "effect/Record" * * const x = { a: 1, b: 2, c: 3, d: 4 } @@ -731,6 +751,7 @@ export const filter: { * * @example * ```ts + * import * as assert from "node:assert" * import { Record, Option } from "effect" * * assert.deepStrictEqual( @@ -753,6 +774,7 @@ export const getSomes: ( * * @example * ```ts + * import * as assert from "node:assert" * import { Record, Either } from "effect" * * assert.deepStrictEqual( @@ -783,6 +805,7 @@ export const getLefts = ( * * @example * ```ts + * import * as assert from "node:assert" * import { Record, Either } from "effect" * * assert.deepStrictEqual( @@ -816,6 +839,7 @@ export const getRights = ( * * @example * ```ts + * import * as assert from "node:assert" * import { Record, Either } from "effect" * * const x = { a: 1, b: 2, c: 3 } @@ -864,6 +888,7 @@ export const partitionMap: { * * @example * ```ts + * import * as assert from "node:assert" * import { Record, Either } from "effect" * * assert.deepStrictEqual( @@ -887,6 +912,7 @@ export const separate: ( * * @example * ```ts + * import * as assert from "node:assert" * import { partition } from "effect/Record" * * assert.deepStrictEqual( @@ -968,6 +994,7 @@ export const values = (self: ReadonlyRecord): Array(value: A) => Redacted = redacted_.make * * @example * ```ts + * import * as assert from "node:assert" * import { Redacted } from "effect" * * const API_KEY = Redacted.make("1234567890") @@ -99,6 +100,7 @@ export const value: (self: Redacted) => A = redacted_.value * * @example * ```ts + * import * as assert from "node:assert" * import { Redacted } from "effect" * * const API_KEY = Redacted.make("1234567890") @@ -122,6 +124,7 @@ export const unsafeWipe: (self: Redacted) => boolean = redacted_.unsafeWip * * @example * ```ts + * import * as assert from "node:assert" * import { Redacted, Equivalence } from "effect" * * const API_KEY1 = Redacted.make("1234567890") diff --git a/packages/effect/src/RegExp.ts b/packages/effect/src/RegExp.ts index 0b8d273ff2e..6177ce3f397 100644 --- a/packages/effect/src/RegExp.ts +++ b/packages/effect/src/RegExp.ts @@ -12,6 +12,7 @@ import * as predicate from "./Predicate.js" * * @example * ```ts + * import * as assert from "node:assert" * import { RegExp } from "effect" * * assert.deepStrictEqual(RegExp.isRegExp(/a/), true) @@ -28,6 +29,7 @@ export const isRegExp: (input: unknown) => input is RegExp = predicate.isRegExp * * @example * ```ts + * import * as assert from "node:assert" * import { RegExp } from "effect" * * assert.deepStrictEqual(RegExp.escape("a*b"), "a\\*b") diff --git a/packages/effect/src/Schema.ts b/packages/effect/src/Schema.ts index 4d7679084da..07591353ccb 100644 --- a/packages/effect/src/Schema.ts +++ b/packages/effect/src/Schema.ts @@ -716,8 +716,8 @@ export function Literal>( * * @example * ```ts - * import * as Schema from "effect/Schema" - * import { Either } from "effect" + * import * as assert from "node:assert" + * import { Either, Schema } from "effect" * * const schema = Schema.Literal("a", "b", "c").pipe(Schema.pickLiteral("a", "b")) * @@ -2931,6 +2931,7 @@ export interface tag extends PropertySignature<":" * * @example * ```ts + * import * as assert from "node:assert" * import { Schema } from "effect" * * const User = Schema.Struct({ @@ -2962,6 +2963,7 @@ export type TaggedStruct(self: Stream) => Stream<[A, number * * @example * ```ts + * import * as assert from "node:assert" * import { Chunk, Effect, pipe, Stream } from "effect" * * const result = pipe( @@ -6201,6 +6202,7 @@ export const Do: Stream<{}> = internal.Do * * @example * ```ts + * import * as assert from "node:assert" * import { Chunk, Effect, pipe, Stream } from "effect" * * const result = pipe( @@ -6275,6 +6277,7 @@ export const bindEffect: { * * @example * ```ts + * import * as assert from "node:assert" * import { Chunk, Effect, pipe, Stream } from "effect" * * const result = pipe( @@ -6324,6 +6327,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { Chunk, Effect, pipe, Stream } from "effect" * * const result = pipe( diff --git a/packages/effect/src/String.ts b/packages/effect/src/String.ts index ce8e0e424c9..3cb09dfdf60 100644 --- a/packages/effect/src/String.ts +++ b/packages/effect/src/String.ts @@ -24,6 +24,7 @@ import * as predicate from "./Predicate.js" * * @example * ```ts + * import * as assert from "node:assert" * import { String } from "effect" * * assert.deepStrictEqual(String.isString("a"), true) @@ -74,6 +75,7 @@ export const concat: { /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe('a', String.toUpperCase), 'A') @@ -86,6 +88,7 @@ export const toUpperCase = (self: S): Uppercase => self.toU /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe('A', String.toLowerCase), 'a') @@ -98,6 +101,7 @@ export const toLowerCase = (self: T): Lowercase => self.toL /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe('abc', String.capitalize), 'Abc') @@ -114,6 +118,7 @@ export const capitalize = (self: T): Capitalize => { /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe('ABC', String.uncapitalize), 'aBC') @@ -130,6 +135,7 @@ export const uncapitalize = (self: T): Uncapitalize => { /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe('abc', String.replace('b', 'd')), 'adc') @@ -148,6 +154,7 @@ export type Trim = TrimEnd> /** * @example * ```ts + * import * as assert from "node:assert" * import { String } from "effect" * * assert.deepStrictEqual(String.trim(' a '), 'a') @@ -165,6 +172,7 @@ export type TrimStart = A extends `${" " | "\n" | "\t" | "\r"} /** * @example * ```ts + * import * as assert from "node:assert" * import { String } from "effect" * * assert.deepStrictEqual(String.trimStart(' a '), 'a ') @@ -182,6 +190,7 @@ export type TrimEnd = A extends `${infer B}${" " | "\n" | "\t" /** * @example * ```ts + * import * as assert from "node:assert" * import { String } from "effect" * * assert.deepStrictEqual(String.trimEnd(' a '), ' a') @@ -194,6 +203,7 @@ export const trimEnd = (self: A): TrimEnd => self.trimEnd() /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe('abcd', String.slice(1, 3)), 'bc') @@ -208,6 +218,7 @@ export const slice = (start?: number, end?: number) => (self: string): string => * * @example * ```ts + * import * as assert from "node:assert" * import { String } from "effect" * * assert.deepStrictEqual(String.isEmpty(''), true) @@ -230,6 +241,7 @@ export const isNonEmpty = (self: string): boolean => self.length > 0 * * @example * ```ts + * import * as assert from "node:assert" * import { String } from "effect" * * assert.deepStrictEqual(String.length('abc'), 3) @@ -242,6 +254,7 @@ export const length = (self: string): number => self.length /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe('abc', String.split('')), ['a', 'b', 'c']) @@ -282,6 +295,7 @@ export const endsWith = (searchString: string, position?: number) => (self: stri /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String, Option } from "effect" * * assert.deepStrictEqual(pipe("abc", String.charCodeAt(1)), Option.some(98)) @@ -302,6 +316,7 @@ export const charCodeAt: { /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String, Option } from "effect" * * assert.deepStrictEqual(pipe("abcd", String.substring(1)), "bcd") @@ -315,6 +330,7 @@ export const substring = (start: number, end?: number) => (self: string): string /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String, Option } from "effect" * * assert.deepStrictEqual(pipe("abc", String.at(1)), Option.some("b")) @@ -331,6 +347,7 @@ export const at: { /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String, Option } from "effect" * * assert.deepStrictEqual(pipe("abc", String.charAt(1)), Option.some("b")) @@ -350,6 +367,7 @@ export const charAt: { /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String, Option } from "effect" * * assert.deepStrictEqual(pipe("abc", String.codePointAt(1)), Option.some(98)) @@ -365,6 +383,7 @@ export const codePointAt: { /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String, Option } from "effect" * * assert.deepStrictEqual(pipe("abbbc", String.indexOf("b")), Option.some(1)) @@ -378,6 +397,7 @@ export const indexOf = (searchString: string) => (self: string): Option.Option (self: string): Option.Opti /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe("a", String.localeCompare("b")), -1) @@ -423,6 +444,7 @@ export const matchAll = (regexp: RegExp) => (self: string): IterableIterator (self: stri /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe("a", String.padEnd(5)), "a ") @@ -454,6 +477,7 @@ export const padEnd = (maxLength: number, fillString?: string) => (self: string) /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe("a", String.padStart(5)), " a") @@ -468,6 +492,7 @@ export const padStart = (maxLength: number, fillString?: string) => (self: strin /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe("a", String.repeat(5)), "aaaaa") @@ -480,6 +505,7 @@ export const repeat = (count: number) => (self: string): string => self.repeat(c /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * assert.deepStrictEqual(pipe("ababb", String.replaceAll("b", "c")), "acacc") @@ -494,6 +520,7 @@ export const replaceAll = (searchValue: string | RegExp, replaceValue: string) = /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String, Option } from "effect" * * assert.deepStrictEqual(pipe("ababb", String.search("b")), Option.some(1)) @@ -515,6 +542,7 @@ export const search: { /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * const str = "\u0130" @@ -529,6 +557,7 @@ export const toLocaleLowerCase = (locale?: string | Array) => (self: str /** * @example * ```ts + * import * as assert from "node:assert" * import { pipe, String } from "effect" * * const str = "i\u0307" @@ -552,6 +581,7 @@ export const toLocaleUpperCase = (locale?: string | Array) => (self: str * * @example * ```ts + * import * as assert from "node:assert" * import { String } from "effect" * * assert.deepStrictEqual(String.takeLeft("Hello World", 5), "Hello") @@ -576,6 +606,7 @@ export const takeLeft: { * * @example * ```ts + * import * as assert from "node:assert" * import { String } from "effect" * * assert.deepStrictEqual(String.takeRight("Hello World", 5), "World") diff --git a/packages/effect/src/Struct.ts b/packages/effect/src/Struct.ts index 7d3e3b92d22..f943329d6c2 100644 --- a/packages/effect/src/Struct.ts +++ b/packages/effect/src/Struct.ts @@ -15,6 +15,7 @@ import type { MatchRecord, Simplify } from "./Types.js" * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Struct } from "effect" * * assert.deepStrictEqual(pipe({ a: "a", b: 1, c: true }, Struct.pick("a", "b")), { a: "a", b: 1 }) @@ -51,6 +52,7 @@ export const pick: { * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Struct } from "effect" * * assert.deepStrictEqual(pipe({ a: "a", b: 1, c: true }, Struct.omit("c")), { a: "a", b: 1 }) @@ -86,6 +88,7 @@ export const omit: { * * @example * ```ts + * import * as assert from "node:assert" * import { Struct, String, Number } from "effect" * * const PersonEquivalence = Struct.getEquivalence({ @@ -139,6 +142,7 @@ type PartialTransform = { * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Struct } from "effect" * * assert.deepStrictEqual( @@ -177,6 +181,7 @@ export const evolve: { * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Struct } from "effect" * * const value = pipe({ a: 1, b: 2 }, Struct.get("a")) @@ -195,6 +200,7 @@ export const get = * * @example * ```ts + * import * as assert from "node:assert" * import { Struct } from "effect" * * const symbol: unique symbol = Symbol() diff --git a/packages/effect/src/Symbol.ts b/packages/effect/src/Symbol.ts index 5b58b2162b7..94e030ce088 100644 --- a/packages/effect/src/Symbol.ts +++ b/packages/effect/src/Symbol.ts @@ -12,6 +12,7 @@ import * as predicate from "./Predicate.js" * * @example * ```ts + * import * as assert from "node:assert" * import { Predicate } from "effect" * * assert.deepStrictEqual(Predicate.isSymbol(Symbol.for("a")), true) diff --git a/packages/effect/src/Trie.ts b/packages/effect/src/Trie.ts index 2e8c19984c4..1f3ef8e203f 100644 --- a/packages/effect/src/Trie.ts +++ b/packages/effect/src/Trie.ts @@ -45,6 +45,7 @@ export interface Trie extends Iterable<[string, Value]>, Equal, Pipea * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal } from "effect" * * const trie = Trie.empty() @@ -63,6 +64,7 @@ export const empty: () => Trie = TR.empty * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal } from "effect" * * const iterable: Array = [["call", 0], ["me", 1], ["mind", 2], ["mid", 3]] @@ -83,6 +85,7 @@ export const fromIterable: (entries: Iterable) => Trie< * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal } from "effect" * * const trie = Trie.make(["ca", 0], ["me", 1]) @@ -103,6 +106,7 @@ export const make: >( * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie1 = Trie.empty().pipe( @@ -133,6 +137,7 @@ export const insert: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -157,6 +162,7 @@ export const keys: (self: Trie) => IterableIterator = TR.keys * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -181,6 +187,7 @@ export const values: (self: Trie) => IterableIterator = TR.values * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -204,6 +211,7 @@ export const entries: (self: Trie) => IterableIterator<[string, V]> = TR.e * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -226,6 +234,7 @@ export const toEntries = (self: Trie): Array<[string, V]> => Array.from(en * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -253,6 +262,7 @@ export const keysWithPrefix: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -282,6 +292,7 @@ export const valuesWithPrefix: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -309,6 +320,7 @@ export const entriesWithPrefix: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -336,6 +348,7 @@ export const toEntriesWithPrefix: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Option } from "effect" * * const trie = Trie.empty().pipe( @@ -363,6 +376,7 @@ export const longestPrefixOf: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -383,6 +397,7 @@ export const size: (self: Trie) => number = TR.size * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Option } from "effect" * * const trie = Trie.empty().pipe( @@ -415,6 +430,7 @@ export const get: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -447,6 +463,7 @@ export const has: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty() @@ -469,6 +486,7 @@ export const isEmpty: (self: Trie) => boolean = TR.isEmpty * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -492,6 +510,7 @@ export const unsafeGet: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Option } from "effect" * * const trie = Trie.empty().pipe( @@ -522,6 +541,7 @@ export const remove: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * const trie = Trie.empty().pipe( @@ -563,6 +583,7 @@ export const reduce: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal } from "effect" * * const trie = Trie.empty().pipe( @@ -600,6 +621,7 @@ export const map: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal } from "effect" * * const trie = Trie.empty().pipe( @@ -637,6 +659,7 @@ export const filter: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal, Option } from "effect" * * const trie = Trie.empty().pipe( @@ -674,6 +697,7 @@ export const filterMap: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal, Option } from "effect" * * const trie = Trie.empty>().pipe( @@ -700,6 +724,7 @@ export const compact: (self: Trie>) => Trie = TR.compact * * @example * ```ts + * import * as assert from "node:assert" * import { Trie } from "effect" * * let value = 0 @@ -729,6 +754,7 @@ export const forEach: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal, Option } from "effect" * * const trie = Trie.empty().pipe( @@ -755,6 +781,7 @@ export const modify: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal } from "effect" * * const trie = Trie.empty().pipe( @@ -782,6 +809,7 @@ export const removeMany: { * * @example * ```ts + * import * as assert from "node:assert" * import { Trie, Equal } from "effect" * * const trie = Trie.empty().pipe( diff --git a/packages/effect/src/Tuple.ts b/packages/effect/src/Tuple.ts index 696b73d8ddd..b74dbbae736 100644 --- a/packages/effect/src/Tuple.ts +++ b/packages/effect/src/Tuple.ts @@ -24,6 +24,7 @@ export interface TupleTypeLambda extends TypeLambda { * * @example * ```ts + * import * as assert from "node:assert" * import { make } from "effect/Tuple" * * assert.deepStrictEqual(make(1, 'hello', true), [1, 'hello', true]) @@ -41,6 +42,7 @@ export const make = >(...elements: A): A => element * * @example * ```ts + * import * as assert from "node:assert" * import { getFirst } from "effect/Tuple" * * assert.deepStrictEqual(getFirst(["hello", 42]), "hello") @@ -58,6 +60,7 @@ export const getFirst = (self: readonly [L, R]): L => self[0] * * @example * ```ts + * import * as assert from "node:assert" * import { getSecond } from "effect/Tuple" * * assert.deepStrictEqual(getSecond(["hello", 42]), 42) @@ -76,6 +79,7 @@ export const getSecond = (self: readonly [L, R]): R => self[1] * * @example * ```ts + * import * as assert from "node:assert" * import { pipe, Tuple } from "effect" * * const result = pipe( @@ -113,6 +117,7 @@ export const map: { * * @example * ```ts + * import * as assert from "node:assert" * import { mapBoth } from "effect/Tuple" * * assert.deepStrictEqual( @@ -152,6 +157,7 @@ export const mapBoth: { * * @example * ```ts + * import * as assert from "node:assert" * import { mapFirst } from "effect/Tuple" * * assert.deepStrictEqual( @@ -176,6 +182,7 @@ export const mapFirst: { * * @example * ```ts + * import * as assert from "node:assert" * import { mapSecond } from "effect/Tuple" * * assert.deepStrictEqual( @@ -199,6 +206,7 @@ export const mapSecond: { * * @example * ```ts + * import * as assert from "node:assert" * import { swap } from "effect/Tuple" * * assert.deepStrictEqual(swap(["hello", 42]), [42, "hello"]) @@ -253,6 +261,7 @@ export const appendElement: { * * @example * ```ts + * import * as assert from "node:assert" * import { Tuple } from "effect" * * assert.deepStrictEqual(Tuple.at([1, 'hello', true], 1), 'hello') @@ -277,6 +286,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { isTupleOf } from "effect/Tuple" * * assert.deepStrictEqual(isTupleOf([1, 2, 3], 3), true); @@ -304,6 +314,7 @@ export { * * @example * ```ts + * import * as assert from "node:assert" * import { isTupleOfAtLeast } from "effect/Tuple" * * assert.deepStrictEqual(isTupleOfAtLeast([1, 2, 3], 3), true); diff --git a/packages/platform/src/HttpMethod.ts b/packages/platform/src/HttpMethod.ts index 5dead135970..0f082893257 100644 --- a/packages/platform/src/HttpMethod.ts +++ b/packages/platform/src/HttpMethod.ts @@ -46,6 +46,7 @@ export const all: ReadonlySet = new Set(["GET", "POST", "PUT", "DELE * * @example * ```ts + * import * as assert from "node:assert" * import { HttpMethod } from "@effect/platform" * * assert.deepStrictEqual(HttpMethod.isHttpMethod("GET"), true) diff --git a/packages/platform/src/UrlParams.ts b/packages/platform/src/UrlParams.ts index f558ec2e987..cb245ac3bb2 100644 --- a/packages/platform/src/UrlParams.ts +++ b/packages/platform/src/UrlParams.ts @@ -217,6 +217,7 @@ const baseUrl = (): string | undefined => { * * @example * ```ts + * import * as assert from "node:assert" * import { UrlParams } from "@effect/platform" * * const urlParams = UrlParams.fromInput({ a: 1, b: true, c: "string", e: [1, 2, 3] }) diff --git a/packages/typeclass/src/data/BigInt.ts b/packages/typeclass/src/data/BigInt.ts index be7104865e0..500e4dbde53 100644 --- a/packages/typeclass/src/data/BigInt.ts +++ b/packages/typeclass/src/data/BigInt.ts @@ -11,6 +11,7 @@ import * as semigroup from "../Semigroup.js" * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupSum } from "@effect/typeclass/data/BigInt" * * assert.deepStrictEqual(SemigroupSum.combine(2n, 3n), 5n) @@ -51,6 +52,7 @@ export const SemigroupMultiply: semigroup.Semigroup = semigroup.make( * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupMin } from "@effect/typeclass/data/BigInt" * * assert.deepStrictEqual(SemigroupMin.combine(2n, 3n), 2n) @@ -66,6 +68,7 @@ export const SemigroupMin: semigroup.Semigroup = semigroup.min(Order) * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupMax } from "@effect/typeclass/data/BigInt" * * assert.deepStrictEqual(SemigroupMax.combine(2n, 3n), 3n) @@ -83,6 +86,7 @@ export const SemigroupMax: semigroup.Semigroup = semigroup.max(Order) * * @example * ```ts + * import * as assert from "node:assert" * import { MonoidSum } from "@effect/typeclass/data/BigInt" * * assert.deepStrictEqual(MonoidSum.combine(2n, 3n), 5n) @@ -104,6 +108,7 @@ export const MonoidSum: monoid.Monoid = monoid.fromSemigroup( * * @example * ```ts + * import * as assert from "node:assert" * import { MonoidMultiply } from "@effect/typeclass/data/BigInt" * * assert.deepStrictEqual(MonoidMultiply.combine(2n, 3n), 6n) diff --git a/packages/typeclass/src/data/Number.ts b/packages/typeclass/src/data/Number.ts index 62da7b24eb1..a5c88e66606 100644 --- a/packages/typeclass/src/data/Number.ts +++ b/packages/typeclass/src/data/Number.ts @@ -21,6 +21,7 @@ export const Bounded: bounded.Bounded = { * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupSum } from "@effect/typeclass/data/Number" * * assert.deepStrictEqual(SemigroupSum.combine(2, 3), 5) @@ -36,6 +37,7 @@ export const SemigroupSum: semigroup.Semigroup = semigroup.make((self, t * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupMultiply } from "@effect/typeclass/data/Number" * * assert.deepStrictEqual(SemigroupMultiply.combine(2, 3), 6) @@ -66,6 +68,7 @@ export const SemigroupMultiply: semigroup.Semigroup = semigroup.make( * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupMin } from "@effect/typeclass/data/Number" * * assert.deepStrictEqual(SemigroupMin.combine(2, 3), 2) @@ -81,6 +84,7 @@ export const SemigroupMin: semigroup.Semigroup = semigroup.min(Number.Or * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupMax } from "@effect/typeclass/data/Number" * * assert.deepStrictEqual(SemigroupMax.combine(2, 3), 3) @@ -98,6 +102,7 @@ export const SemigroupMax: semigroup.Semigroup = semigroup.max(Number.Or * * @example * ```ts + * import * as assert from "node:assert" * import { MonoidSum } from "@effect/typeclass/data/Number" * * assert.deepStrictEqual(MonoidSum.combine(2, 3), 5) @@ -116,6 +121,7 @@ export const MonoidSum: monoid.Monoid = monoid.fromSemigroup(SemigroupSu * * @example * ```ts + * import * as assert from "node:assert" * import { MonoidMultiply } from "@effect/typeclass/data/Number" * * assert.deepStrictEqual(MonoidMultiply.combine(2, 3), 6) @@ -134,6 +140,7 @@ export const MonoidMultiply: monoid.Monoid = monoid.fromSemigroup(Semigr * * @example * ```ts + * import * as assert from "node:assert" * import { MonoidMin } from "@effect/typeclass/data/Number" * * assert.deepStrictEqual(MonoidMin.combine(2, 3), 2) @@ -152,6 +159,7 @@ export const MonoidMin: monoid.Monoid = bounded.min(Bounded) * * @example * ```ts + * import * as assert from "node:assert" * import { MonoidMax } from "@effect/typeclass/data/Number" * * assert.deepStrictEqual(MonoidMax.combine(2, 3), 3) diff --git a/packages/typeclass/src/data/Ordering.ts b/packages/typeclass/src/data/Ordering.ts index 936f72b2d74..31e85e234fb 100644 --- a/packages/typeclass/src/data/Ordering.ts +++ b/packages/typeclass/src/data/Ordering.ts @@ -10,6 +10,7 @@ import * as semigroup from "../Semigroup.js" * * @example * ```ts + * import * as assert from "node:assert" * import { Semigroup } from "@effect/typeclass/data/Ordering" * * assert.deepStrictEqual(Semigroup.combine(0, -1), -1) @@ -43,6 +44,7 @@ export const Semigroup: semigroup.Semigroup = semigroup.make( * * @example * ```ts + * import * as assert from "node:assert" * import { Monoid } from "@effect/typeclass/data/Ordering" * * assert.deepStrictEqual(Monoid.combine(Monoid.empty, -1), -1) From 39c5169e477f3357a9207bb158d2c2f0e42d4bae Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Mon, 3 Mar 2025 08:49:04 +0100 Subject: [PATCH 03/16] Removing `@param` descriptions that simply repeat the parameter name --- packages/effect/src/Array.ts | 12 --- packages/effect/src/BigDecimal.ts | 89 ------------------ packages/effect/src/BigInt.ts | 71 -------------- packages/effect/src/Boolean.ts | 10 -- packages/effect/src/Brand.ts | 3 - packages/effect/src/Channel.ts | 2 - packages/effect/src/Config.ts | 2 - packages/effect/src/Context.ts | 24 ----- packages/effect/src/Cron.ts | 25 +---- packages/effect/src/Either.ts | 23 ----- packages/effect/src/Function.ts | 26 +----- packages/effect/src/HashMap.ts | 3 - packages/effect/src/Iterable.ts | 2 - packages/effect/src/Logger.ts | 2 - packages/effect/src/ManagedRuntime.ts | 2 - packages/effect/src/Metric.ts | 18 ++-- packages/effect/src/Number.ts | 61 ------------ packages/effect/src/Ordering.ts | 7 -- packages/effect/src/Predicate.ts | 75 --------------- packages/effect/src/Random.ts | 2 - packages/effect/src/RcMap.ts | 7 +- packages/effect/src/Record.ts | 107 ---------------------- packages/effect/src/RegExp.ts | 2 - packages/effect/src/STM.ts | 4 +- packages/effect/src/Schema.ts | 9 -- packages/effect/src/SchemaAST.ts | 2 - packages/effect/src/Sink.ts | 8 +- packages/effect/src/Stream.ts | 31 ++++--- packages/effect/src/String.ts | 2 - packages/effect/src/Symbol.ts | 2 - packages/effect/src/Tuple.ts | 30 ------ packages/effect/src/Utils.ts | 16 ++-- packages/platform/src/HttpMethod.ts | 2 - packages/typeclass/src/Applicative.ts | 3 - packages/typeclass/src/SemiApplicative.ts | 6 -- packages/typeclass/src/Semigroup.ts | 7 +- 36 files changed, 55 insertions(+), 642 deletions(-) diff --git a/packages/effect/src/Array.ts b/packages/effect/src/Array.ts index 231512af8df..abb9bcf2351 100644 --- a/packages/effect/src/Array.ts +++ b/packages/effect/src/Array.ts @@ -187,8 +187,6 @@ export const ensure = (self: ReadonlyArray | A): Array => Array.isArray /** * Takes a record and returns an array of tuples containing its keys and values. * - * @param self - The record to transform. - * * @example * ```ts * import * as assert from "node:assert" @@ -508,8 +506,6 @@ export const scanRight: { /** * Determine if `unknown` is an Array. * - * @param self - The value to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -530,8 +526,6 @@ export const isArray: { /** * Determine if an `Array` is empty narrowing down the type to `[]`. * - * @param self - The `Array` to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -549,8 +543,6 @@ export const isEmptyArray = (self: Array): self is [] => self.length === 0 /** * Determine if a `ReadonlyArray` is empty narrowing down the type to `readonly []`. * - * @param self - The `ReadonlyArray` to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -570,8 +562,6 @@ export const isEmptyReadonlyArray: (self: ReadonlyArray) => self is readon * * An `Array` is considered to be a `NonEmptyArray` if it contains at least one element. * - * @param self - The `Array` to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -591,8 +581,6 @@ export const isNonEmptyArray: (self: Array) => self is NonEmptyArray = * * A `ReadonlyArray` is considered to be a `NonEmptyReadonlyArray` if it contains at least one element. * - * @param self - The `ReadonlyArray` to check. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/BigDecimal.ts b/packages/effect/src/BigDecimal.ts index 32dbdd2e648..121c633dab8 100644 --- a/packages/effect/src/BigDecimal.ts +++ b/packages/effect/src/BigDecimal.ts @@ -86,8 +86,6 @@ const BigDecimalProto: Omit = { /** * Checks if a given value is a `BigDecimal`. * - * @param u - The value to check. - * * @since 2.0.0 * @category guards */ @@ -96,9 +94,6 @@ export const isBigDecimal = (u: unknown): u is BigDecimal => hasProperty(u, Type /** * Creates a `BigDecimal` from a `bigint` value and a scale. * - * @param value - The `bigint` value to create a `BigDecimal` from. - * @param scale - The scale of the `BigDecimal`. - * * @since 2.0.0 * @category constructors */ @@ -132,8 +127,6 @@ const zero = unsafeMakeNormalized(bigint0, 0) /** * Normalizes a given `BigDecimal` by removing trailing zeros. * - * @param self - The `BigDecimal` to normalize. - * * @example * ```ts * import * as assert from "node:assert" @@ -181,9 +174,6 @@ export const normalize = (self: BigDecimal): BigDecimal => { * If the given scale is smaller than the current scale, the value will be rounded down to * the nearest integer. * - * @param self - The `BigDecimal` to scale. - * @param scale - The scale to scale to. - * * @since 2.0.0 * @category scaling */ @@ -205,9 +195,6 @@ export const scale: { /** * Provides an addition operation on `BigDecimal`s. * - * @param self - The first operand. - * @param that - The second operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -245,9 +232,6 @@ export const sum: { /** * Provides a multiplication operation on `BigDecimal`s. * - * @param self - The first operand. - * @param that - The second operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -273,9 +257,6 @@ export const multiply: { /** * Provides a subtraction operation on `BigDecimal`s. * - * @param self - The first operand. - * @param that - The second operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -386,9 +367,6 @@ export const roundTerminal = (n: bigint): bigint => { * * If the divisor is `0`, the result will be `None`. * - * @param self - The dividend operand. - * @param that - The divisor operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -430,9 +408,6 @@ export const divide: { * * Throws a `RangeError` if the divisor is `0`. * - * @param self - The dividend operand. - * @param that - The divisor operand.as - * * @example * ```ts * import * as assert from "node:assert" @@ -488,9 +463,6 @@ export const Order: order.Order = order.make((self, that) => { /** * Returns `true` if the first argument is less than the second, otherwise `false`. * - * @param self - The first argument. - * @param that - The second argument. - * * @example * ```ts * import * as assert from "node:assert" @@ -512,9 +484,6 @@ export const lessThan: { /** * Checks if a given `BigDecimal` is less than or equal to the provided one. * - * @param self - The first `BigDecimal` to compare with. - * @param that - The second `BigDecimal` to compare with. - * * @example * ```ts * import * as assert from "node:assert" @@ -536,9 +505,6 @@ export const lessThanOrEqualTo: { /** * Returns `true` if the first argument is greater than the second, otherwise `false`. * - * @param self - The first argument. - * @param that - The second argument. - * * @example * ```ts * import * as assert from "node:assert" @@ -560,9 +526,6 @@ export const greaterThan: { /** * Checks if a given `BigDecimal` is greater than or equal to the provided one. * - * @param self - The first `BigDecimal` to compare with. - * @param that - The second `BigDecimal` to compare with. - * * @example * ```ts * import * as assert from "node:assert" @@ -584,10 +547,6 @@ export const greaterThanOrEqualTo: { /** * Checks if a `BigDecimal` is between a `minimum` and `maximum` value (inclusive). * - * @param self - The `number` to check. - * @param minimum - The `minimum` value to check. - * @param maximum - The `maximum` value to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -624,10 +583,6 @@ export const between: { * - If the `BigDecimal` is greater than the `maximum` value, the function returns the `maximum` value. * - Otherwise, it returns the original `BigDecimal`. * - * @param self - The `BigDecimal` to be clamped. - * @param minimum - The lower end of the range. - * @param maximum - The upper end of the range. - * * @example * ```ts * import * as assert from "node:assert" @@ -660,9 +615,6 @@ export const clamp: { /** * Returns the minimum between two `BigDecimal`s. * - * @param self - The first `BigDecimal`. - * @param that - The second `BigDecimal`. - * * @example * ```ts * import * as assert from "node:assert" @@ -682,9 +634,6 @@ export const min: { /** * Returns the maximum between two `BigDecimal`s. * - * @param self - The first `BigDecimal`. - * @param that - The second `BigDecimal`. - * * @example * ```ts * import * as assert from "node:assert" @@ -704,8 +653,6 @@ export const max: { /** * Determines the sign of a given `BigDecimal`. * - * @param n - The `BigDecimal` to determine the sign of. - * * @example * ```ts * import * as assert from "node:assert" @@ -724,8 +671,6 @@ export const sign = (n: BigDecimal): Ordering => n.value === bigint0 ? 0 : n.val /** * Determines the absolute value of a given `BigDecimal`. * - * @param n - The `BigDecimal` to determine the absolute value of. - * * @example * ```ts * import * as assert from "node:assert" @@ -744,8 +689,6 @@ export const abs = (n: BigDecimal): BigDecimal => n.value < bigint0 ? make(-n.va /** * Provides a negate operation on `BigDecimal`s. * - * @param n - The `BigDecimal` to negate. - * * @example * ```ts * import * as assert from "node:assert" @@ -765,9 +708,6 @@ export const negate = (n: BigDecimal): BigDecimal => make(-n.value, n.scale) * * If the divisor is `0`, the result will be `None`. * - * @param self - The dividend. - * @param divisor - The divisor. - * * @example * ```ts * import * as assert from "node:assert" @@ -798,9 +738,6 @@ export const remainder: { * * Throws a `RangeError` if the divisor is `0`. * - * @param self - The dividend. - * @param divisor - The divisor. - * * @example * ```ts * import * as assert from "node:assert" @@ -856,8 +793,6 @@ export const equals: { /** * Creates a `BigDecimal` from a `bigint` value. * - * @param value - The `bigint` value to create a `BigDecimal` from. - * * @since 2.0.0 * @category constructors */ @@ -871,8 +806,6 @@ export const fromBigInt = (n: bigint): BigDecimal => make(n, 0) * * Throws a `RangeError` if the number is not finite (`NaN`, `+Infinity` or `-Infinity`). * - * @param value - The `number` value to create a `BigDecimal` from. - * * @example * ```ts * import * as assert from "node:assert" @@ -896,8 +829,6 @@ export const unsafeFromNumber = (n: number): BigDecimal => * * Throws a `RangeError` if the number is not finite (`NaN`, `+Infinity` or `-Infinity`). * - * @param value - The `number` value to create a `BigDecimal` from. - * * @since 2.0.0 * @category constructors * @deprecated Use {@link unsafeFromNumber} instead. @@ -913,8 +844,6 @@ export const fromNumber: (n: number) => BigDecimal = unsafeFromNumber * * Returns `None` if the number is not finite (`NaN`, `+Infinity` or `-Infinity`). * - * @param n - The `number` value to create a `BigDecimal` from. - * * @example * ```ts * import * as assert from "node:assert" @@ -945,8 +874,6 @@ export const safeFromNumber = (n: number): Option.Option => { /** * Parses a numerical `string` into a `BigDecimal`. * - * @param s - The `string` to parse. - * * @example * ```ts * import * as assert from "node:assert" @@ -1008,8 +935,6 @@ export const fromString = (s: string): Option.Option => { /** * Parses a numerical `string` into a `BigDecimal`. * - * @param s - The `string` to parse. - * * @example * ```ts * import * as assert from "node:assert" @@ -1032,8 +957,6 @@ export const unsafeFromString = (s: string): BigDecimal => * If the scale of the `BigDecimal` is greater than or equal to 16, the `BigDecimal` will * be formatted in scientific notation. * - * @param n - The `BigDecimal` to format. - * * @example * ```ts * import * as assert from "node:assert" @@ -1081,8 +1004,6 @@ export const format = (n: BigDecimal): string => { /** * Formats a given `BigDecimal` as a `string` in scientific notation. * - * @param n - The `BigDecimal` to format. - * * @example * ```ts * import * as assert from "node:assert" @@ -1118,8 +1039,6 @@ export const toExponential = (n: BigDecimal): string => { * * This function will produce incorrect results if the `BigDecimal` exceeds the 64-bit range of a `number`. * - * @param n - The `BigDecimal` to convert. - * * @example * ```ts * import * as assert from "node:assert" @@ -1136,8 +1055,6 @@ export const unsafeToNumber = (n: BigDecimal): number => Number(format(n)) /** * Checks if a given `BigDecimal` is an integer. * - * @param n - The `BigDecimal` to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -1156,8 +1073,6 @@ export const isInteger = (n: BigDecimal): boolean => normalize(n).scale <= 0 /** * Checks if a given `BigDecimal` is `0`. * - * @param n - The `BigDecimal` to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -1175,8 +1090,6 @@ export const isZero = (n: BigDecimal): boolean => n.value === bigint0 /** * Checks if a given `BigDecimal` is negative. * - * @param n - The `BigDecimal` to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -1195,8 +1108,6 @@ export const isNegative = (n: BigDecimal): boolean => n.value < bigint0 /** * Checks if a given `BigDecimal` is positive. * - * @param n - The `BigDecimal` to check. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/BigInt.ts b/packages/effect/src/BigInt.ts index 741f8803970..21c71188524 100644 --- a/packages/effect/src/BigInt.ts +++ b/packages/effect/src/BigInt.ts @@ -20,8 +20,6 @@ const bigint2 = BigInt(2) /** * Tests if a value is a `bigint`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -39,9 +37,6 @@ export const isBigInt: (u: unknown) => u is bigint = predicate.isBigInt /** * Provides an addition operation on `bigint`s. * - * @param self - The first operand. - * @param that - The second operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -61,9 +56,6 @@ export const sum: { /** * Provides a multiplication operation on `bigint`s. * - * @param self - The first operand. - * @param that - The second operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -83,9 +75,6 @@ export const multiply: { /** * Provides a subtraction operation on `bigint`s. * - * @param self - The first operand. - * @param that - The second operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -110,9 +99,6 @@ export const subtract: { * * Returns `None` if the divisor is `0n`. * - * @param self - The dividend operand. - * @param that - The divisor operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -141,9 +127,6 @@ export const divide: { * * Throws a `RangeError` if the divisor is `0n`. * - * @param self - The dividend operand. - * @param that - The divisor operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -164,8 +147,6 @@ export const unsafeDivide: { /** * Returns the result of adding `1n` to a given number. * - * @param n - A `bigint` to be incremented. - * * @example * ```ts * import * as assert from "node:assert" @@ -182,8 +163,6 @@ export const increment = (n: bigint): bigint => n + bigint1 /** * Decrements a number by `1n`. * - * @param n - A `bigint` to be decremented. - * * @example * ```ts * import * as assert from "node:assert" @@ -212,9 +191,6 @@ export const Order: order.Order = order.bigint /** * Returns `true` if the first argument is less than the second, otherwise `false`. * - * @param self - The first argument. - * @param that - The second argument. - * * @example * ```ts * import * as assert from "node:assert" @@ -236,9 +212,6 @@ export const lessThan: { /** * Returns a function that checks if a given `bigint` is less than or equal to the provided one. * - * @param self - The first `bigint` to compare with. - * @param that - The second `bigint` to compare with. - * * @example * ```ts * import * as assert from "node:assert" @@ -260,9 +233,6 @@ export const lessThanOrEqualTo: { /** * Returns `true` if the first argument is greater than the second, otherwise `false`. * - * @param self - The first argument. - * @param that - The second argument. - * * @example * ```ts * import * as assert from "node:assert" @@ -284,9 +254,6 @@ export const greaterThan: { /** * Returns a function that checks if a given `bigint` is greater than or equal to the provided one. * - * @param self - The first `bigint` to compare with. - * @param that - The second `bigint` to compare with. - * * @example * ```ts * import * as assert from "node:assert" @@ -308,10 +275,6 @@ export const greaterThanOrEqualTo: { /** * Checks if a `bigint` is between a `minimum` and `maximum` value (inclusive). * - * @param self - The `number` to check. - * @param minimum - The `minimum` value to check. - * @param maximum - The `maximum` value to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -345,10 +308,6 @@ export const between: { * - If the `bigint` is greater than the `maximum` value, the function returns the `maximum` value. * - Otherwise, it returns the original `bigint`. * - * @param self - The `bigint` to be clamped. - * @param minimum - The lower end of the range. - * @param maximum - The upper end of the range. - * * @example * ```ts * import * as assert from "node:assert" @@ -377,9 +336,6 @@ export const clamp: { /** * Returns the minimum between two `bigint`s. * - * @param self - The first `bigint`. - * @param that - The second `bigint`. - * * @example * ```ts * import * as assert from "node:assert" @@ -398,9 +354,6 @@ export const min: { /** * Returns the maximum between two `bigint`s. * - * @param self - The first `bigint`. - * @param that - The second `bigint`. - * * @example * ```ts * import * as assert from "node:assert" @@ -419,8 +372,6 @@ export const max: { /** * Determines the sign of a given `bigint`. * - * @param n - The `bigint` to determine the sign of. - * * @example * ```ts * import * as assert from "node:assert" @@ -439,8 +390,6 @@ export const sign = (n: bigint): Ordering => Order(n, bigint0) /** * Determines the absolute value of a given `bigint`. * - * @param n - The `bigint` to determine the absolute value of. - * * @example * ```ts * import * as assert from "node:assert" @@ -459,9 +408,6 @@ export const abs = (n: bigint): bigint => (n < bigint0 ? -n : n) /** * Determines the greatest common divisor of two `bigint`s. * - * @param a - The first `bigint`. - * @param b - The second `bigint`. - * * @example * ```ts * import * as assert from "node:assert" @@ -490,9 +436,6 @@ export const gcd: { /** * Determines the least common multiple of two `bigint`s. * - * @param a - The first `bigint`. - * @param b - The second `bigint`. - * * @example * ```ts * import * as assert from "node:assert" @@ -514,8 +457,6 @@ export const lcm: { /** * Determines the square root of a given `bigint` unsafely. Throws if the given `bigint` is negative. * - * @param n - The `bigint` to determine the square root of. - * * @example * ```ts * import * as assert from "node:assert" @@ -546,8 +487,6 @@ export const unsafeSqrt = (n: bigint): bigint => { /** * Determines the square root of a given `bigint` safely. Returns `none` if the given `bigint` is negative. * - * @param n - The `bigint` to determine the square root of. - * * @example * ```ts * import * as assert from "node:assert" @@ -568,8 +507,6 @@ export const sqrt = (n: bigint): Option.Option => /** * Takes an `Iterable` of `bigint`s and returns their sum as a single `bigint * - * @param collection - The collection of `bigint`s to sum. - * * @example * ```ts * import * as assert from "node:assert" @@ -592,8 +529,6 @@ export const sumAll = (collection: Iterable): bigint => { /** * Takes an `Iterable` of `bigint`s and returns their multiplication as a single `number`. * - * @param collection - The collection of `bigint`s to multiply. - * * @example * ```ts * import * as assert from "node:assert" @@ -623,8 +558,6 @@ export const multiplyAll = (collection: Iterable): bigint => { * and `Number.MIN_SAFE_INTEGER`), it returns `Option.none()`. Otherwise, it converts the `bigint` * to a number and returns `Option.some(number)`. * - * @param b - The `bigint` to be converted to a `number`. - * * @example * ```ts * import * as assert from "node:assert" @@ -651,8 +584,6 @@ export const toNumber = (b: bigint): Option.Option => { * If the string is empty or contains characters that cannot be converted into a `bigint`, * it returns `Option.none()`, otherwise, it returns `Option.some(bigint)`. * - * @param s - The string to be converted to a `bigint`. - * * @example * ```ts * import * as assert from "node:assert" @@ -683,8 +614,6 @@ export const fromString = (s: string): Option.Option => { * and `Number.MIN_SAFE_INTEGER`), it returns `Option.none()`. Otherwise, it attempts to * convert the number to a `bigint` and returns `Option.some(bigint)`. * - * @param n - The number to be converted to a `bigint`. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Boolean.ts b/packages/effect/src/Boolean.ts index d508d064457..52964335b9e 100644 --- a/packages/effect/src/Boolean.ts +++ b/packages/effect/src/Boolean.ts @@ -14,8 +14,6 @@ import * as predicate from "./Predicate.js" /** * Tests if a value is a `boolean`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -34,10 +32,6 @@ export const isBoolean: (input: unknown) => input is boolean = predicate.isBoole * This function returns the result of either of the given functions depending on the value of the boolean parameter. * It is useful when you have to run one of two functions depending on the boolean value. * - * @param value - the boolean value that decides which function will be executed. - * @param onFalse - a lazy evaluation function that will be executed when the `value` is `false`. - * @param onTrue - a lazy evaluation function that will be executed when the `value` is `true`. - * * @example * ```ts * import * as assert from "node:assert" @@ -249,8 +243,6 @@ export const implies: { /** * This utility function is used to check if all the elements in a collection of boolean values are `true`. * - * @param collection - An iterable collection of booleans. - * * @example * ```ts * import * as assert from "node:assert" @@ -274,8 +266,6 @@ export const every = (collection: Iterable): boolean => { /** * This utility function is used to check if at least one of the elements in a collection of boolean values is `true`. * - * @param collection - An iterable collection of booleans. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Brand.ts b/packages/effect/src/Brand.ts index 6b0c96e3126..a29563e8a60 100644 --- a/packages/effect/src/Brand.ts +++ b/packages/effect/src/Brand.ts @@ -192,9 +192,6 @@ export const errors: (...errors: Array) => Brand.BrandErrors * If you don't want to perform any validation but only distinguish between two values of the same type but with different meanings, * see {@link nominal}. * - * @param refinement - The refinement predicate to apply to the unbranded value. - * @param onFailure - Takes the unbranded value that did not pass the `refinement` predicate and returns a `BrandErrors`. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Channel.ts b/packages/effect/src/Channel.ts index 0d4758d3db3..3b934287f6c 100644 --- a/packages/effect/src/Channel.ts +++ b/packages/effect/src/Channel.ts @@ -1436,8 +1436,6 @@ export const mergeAllWith: ( * happens if there are more than the given maximum number of channels gets * created. See `Channel.mergeAll`. * - * @param n The maximum number of channels to merge. - * @param f The function that creates a new channel from each emitted element. * @since 2.0.0 * @category mapping */ diff --git a/packages/effect/src/Config.ts b/packages/effect/src/Config.ts index 3efe92bf260..78df4b05a8b 100644 --- a/packages/effect/src/Config.ts +++ b/packages/effect/src/Config.ts @@ -218,8 +218,6 @@ export const duration: (name?: string) => Config = internal.d * use `isConfig` to check the type of a value before using it as an * argument to a function that expects an `Config` value. * - * @param u - The value to check for being a `Config` value. - * * @returns `true` if the specified value is a `Config` value, `false` * otherwise. * diff --git a/packages/effect/src/Context.ts b/packages/effect/src/Context.ts index ae9e278019c..33a1be48367 100644 --- a/packages/effect/src/Context.ts +++ b/packages/effect/src/Context.ts @@ -142,8 +142,6 @@ export declare namespace Tag { /** * Creates a new `Tag` instance with an optional key parameter. * - * @param key - A key that will be used to compare tags. - * * @example * ```ts * import * as assert from "node:assert" @@ -192,8 +190,6 @@ export const unsafeMake: (unsafeMap: Map) => Context input is Context = internal.i /** * Checks if the provided argument is a `Tag`. * - * @param input - The value to be checked if it is a `Tag`. - * * @example * ```ts * import * as assert from "node:assert" @@ -228,7 +222,6 @@ export const isTag: (input: unknown) => input is Tag = internal.isTag /** * Checks if the provided argument is a `Reference`. * - * @param input - The value to be checked if it is a `Reference`. * @since 3.11.0 * @category guards * @experimental @@ -311,9 +304,6 @@ export const add: { /** * Get a service from the context that corresponds to the given tag. * - * @param self - The `Context` to search for the service. - * @param tag - The `Tag` of the service to retrieve. - * * @example * ```ts * import * as assert from "node:assert" @@ -358,9 +348,6 @@ export const getOrElse: { * * For a safer version see {@link getOption}. * - * @param self - The `Context` to search for the service. - * @param tag - The `Tag` of the service to retrieve. - * * @example * ```ts * import * as assert from "node:assert" @@ -387,9 +374,6 @@ export const unsafeGet: { * Get the value associated with the specified tag from the context wrapped in an `Option` object. If the tag is not * found, the `Option` object will be `None`. * - * @param self - The `Context` to search for the service. - * @param tag - The `Tag` of the service to retrieve. - * * @example * ```ts * import * as assert from "node:assert" @@ -415,9 +399,6 @@ export const getOption: { /** * Merges two `Context`s, returning a new `Context` containing the services of both. * - * @param self - The first `Context` to merge. - * @param that - The second `Context` to merge. - * * @example * ```ts * import * as assert from "node:assert" @@ -445,8 +426,6 @@ export const merge: { /** * Merges any number of `Context`s, returning a new `Context` containing the services of all. * - * @param ctxs - The `Context`s to merge. - * * @example * ```ts * import * as assert from "node:assert" @@ -476,9 +455,6 @@ export const mergeAll: >( /** * Returns a new `Context` that contains only the specified services. * - * @param self - The `Context` to prune services from. - * @param tags - The list of `Tag`s to be included in the new `Context`. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Cron.ts b/packages/effect/src/Cron.ts index 47146f681ab..5eef47f0c83 100644 --- a/packages/effect/src/Cron.ts +++ b/packages/effect/src/Cron.ts @@ -106,8 +106,6 @@ const CronProto = { /** * Checks if a given value is a `Cron` instance. * - * @param u - The value to check. - * * @since 2.0.0 * @category guards */ @@ -116,8 +114,6 @@ export const isCron = (u: unknown): u is Cron => hasProperty(u, TypeId) /** * Creates a `Cron` instance. * - * @param constraints - The cron constraints. - * * @since 2.0.0 * @category constructors */ @@ -216,8 +212,6 @@ export class ParseError extends Data.TaggedError("CronParseError")<{ /** * Returns `true` if the specified value is an `ParseError`, `false` otherwise. * - * @param u - The value to check. - * * @since 2.0.0 * @category guards */ @@ -226,8 +220,6 @@ export const isParseError = (u: unknown): u is ParseError => hasProperty(u, Pars /** * Parses a cron expression into a `Cron` instance. * - * @param cron - The cron expression to parse. - * * @example * ```ts * import * as assert from "node:assert" @@ -330,9 +322,6 @@ export const unsafeParse = (cron: string, tz?: DateTime.TimeZone | string): Cron * * @throws `IllegalArgumentException` if the given `DateTime.Input` is invalid. * - * @param cron - The `Cron` instance. - * @param date - The `Date` to check against. - * * @example * ```ts * import * as assert from "node:assert" @@ -402,14 +391,11 @@ const daysInMonth = (date: Date): number => * assert.deepStrictEqual(Cron.next(cron, after), new Date("2021-01-08 04:00:00")) * ``` * - * @param cron - The `Cron` instance. - * @param now - The `Date` to start searching from. - * * @since 2.0.0 */ -export const next = (cron: Cron, now?: DateTime.DateTime.Input): Date => { +export const next = (cron: Cron, startFrom?: DateTime.DateTime.Input): Date => { const tz = Option.getOrUndefined(cron.tz) - const zoned = dateTime.unsafeMakeZoned(now ?? new Date(), { + const zoned = dateTime.unsafeMakeZoned(startFrom ?? new Date(), { timeZone: tz }) @@ -532,14 +518,11 @@ export const next = (cron: Cron, now?: DateTime.DateTime.Input): Date => { /** * Returns an `IterableIterator` which yields the sequence of `Date`s that match the `Cron` instance. * - * @param cron - The `Cron` instance. - * @param now - The `Date` to start searching from. - * * @since 2.0.0 */ -export const sequence = function*(cron: Cron, now?: DateTime.DateTime.Input): IterableIterator { +export const sequence = function*(cron: Cron, startFrom?: DateTime.DateTime.Input): IterableIterator { while (true) { - yield now = next(cron, now) + yield startFrom = next(cron, startFrom) } } diff --git a/packages/effect/src/Either.ts b/packages/effect/src/Either.ts index d2fcd5f25ff..8fc7a1dbb91 100644 --- a/packages/effect/src/Either.ts +++ b/packages/effect/src/Either.ts @@ -222,8 +222,6 @@ export { /** * Tests if a value is a `Either`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -242,8 +240,6 @@ export const isEither: (input: unknown) => input is Either = e /** * Determine if a `Either` is a `Left`. * - * @param self - The `Either` to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -261,8 +257,6 @@ export const isLeft: (self: Either) => self is Left = either.i /** * Determine if a `Either` is a `Right`. * - * @param self - The `Either` to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -349,9 +343,6 @@ export const mapBoth: { /** * Maps the `Left` side of an `Either` value to a new `Either` value. * - * @param self - The input `Either` value to map. - * @param f - A transformation function to apply to the `Left` value of the input `Either`. - * * @category mapping * @since 2.0.0 */ @@ -367,9 +358,6 @@ export const mapLeft: { /** * Maps the `Right` side of an `Either` value to a new `Either` value. * - * @param self - An `Either` to map - * @param f - The function to map over the value of the `Either` - * * @category mapping * @since 2.0.0 */ @@ -426,8 +414,6 @@ export const match: { * Transforms a `Predicate` function into a `Right` of the input value if the predicate returns `true` * or `Left` of the result of the provided function if the predicate returns false * - * @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean. - * * @example * ```ts * import * as assert from "node:assert" @@ -594,9 +580,6 @@ export const getOrUndefined: (self: Either) => R | undefined = getOr * * If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}. * - * @param self - The `Either` to extract the value from. - * @param onLeft - A function that will be called if the `Either` is `Left`. It returns the error to be thrown. - * * @example * ```ts * import * as assert from "node:assert" @@ -628,7 +611,6 @@ export const getOrThrowWith: { * * The thrown error is a default error. To configure the error thrown, see {@link getOrThrowWith}. * - * @param self - The `Either` to extract the value from. * @throws `Error("getOrThrow called on a Left")` * * @example @@ -650,9 +632,6 @@ export const getOrThrow: (self: Either) => R = getOrThrowWith(() => /** * Returns `self` if it is a `Right` or `that` otherwise. * - * @param self - The input `Either` value to check and potentially return. - * @param that - A function that takes the error value from `self` (if it's a `Left`) and returns a new `Either` value. - * * @category error handling * @since 2.0.0 */ @@ -742,8 +721,6 @@ export const ap: { * - If a struct is supplied, then the returned `Either` will contain a struct with the same keys. * - If an iterable is supplied, then the returned `Either` will contain an array. * - * @param fields - the struct of `Either`s to be sequenced. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Function.ts b/packages/effect/src/Function.ts index d2ffab82379..45e73264f8b 100644 --- a/packages/effect/src/Function.ts +++ b/packages/effect/src/Function.ts @@ -14,8 +14,6 @@ export interface FunctionTypeLambda extends TypeLambda { /** * Tests if a value is a `function`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -43,10 +41,9 @@ export const isFunction = (input: unknown): input is Function => typeof input == * takes an optional argument, you can use a predicate to determine if the * function is being used in a data-first or data-last style. * - * @param arity - Either the arity of the uncurried function or a predicate - * which determines if the function is being used in a data-first - * or data-last style. - * @param body - The definition of the uncurried function. + * You can pass either the arity of the uncurried function or a predicate + * which determines if the function is being used in a data-first or + * data-last style. * * @example * ```ts @@ -155,9 +152,6 @@ export const dual: { /** * Apply a function to a given value. * - * @param a - The value that the function will be applied to. - * @param self - The function to be applied to a value. - * * @example * ```ts * import * as assert from "node:assert" @@ -206,8 +200,6 @@ export interface FunctionN, B> { /** * The identity function, i.e. A function that returns its input argument. * - * @param a - The input argument. - * * @example * ```ts * import * as assert from "node:assert" @@ -245,8 +237,6 @@ export const satisfies = () => (b: B) => b /** * Casts the result to the specified type. * - * @param a - The value to be casted to the target type. - * * @example * ```ts * import * as assert from "node:assert" @@ -265,8 +255,6 @@ export const unsafeCoerce: (a: A) => B = identity as any * This is useful when you want to pass a value to a higher-order function (a function that takes another function as its argument) * and want that inner function to always use the same value, no matter how many times it is called. * - * @param value - The constant value to be returned. - * * @example * ```ts * import * as assert from "node:assert" @@ -360,8 +348,6 @@ export const constVoid: LazyArg = constUndefined /** * Reverses the order of arguments for a curried function. * - * @param f - A curried function that takes multiple arguments. - * * @example * ```ts * import * as assert from "node:assert" @@ -384,9 +370,6 @@ export const flip = , B extends Array, C>( * Composes two functions, `ab` and `bc` into a single function that takes in an argument `a` of type `A` and returns a result of type `C`. * The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`. * - * @param ab - A function that maps from `A` to `B`. - * @param bc - A function that maps from `B` to `C`. - * * @example * ```ts * import * as assert from "node:assert" @@ -1205,9 +1188,6 @@ export const hole: () => T = unsafeCoerce(absurd) * * This function is useful for discarding the first argument passed to it and returning the second argument. * - * @param _ - The first argument to be discarded. - * @param b - The second argument to be returned. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/HashMap.ts b/packages/effect/src/HashMap.ts index d07c649c8f3..c138bb7f1b6 100644 --- a/packages/effect/src/HashMap.ts +++ b/packages/effect/src/HashMap.ts @@ -454,9 +454,6 @@ export const findFirst: { /** * Checks if any entry in a hashmap meets a specific condition. * - * @param self - The hashmap to check. - * @param predicate - The condition to test entries (value, key). - * * @since 3.13.0 * @category elements */ diff --git a/packages/effect/src/Iterable.ts b/packages/effect/src/Iterable.ts index acf0e1a0c0a..420e1db2e57 100644 --- a/packages/effect/src/Iterable.ts +++ b/packages/effect/src/Iterable.ts @@ -102,8 +102,6 @@ export const replicate: { /** * Takes a record and returns an Iterable of tuples containing its keys and values. * - * @param self - The record to transform. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Logger.ts b/packages/effect/src/Logger.ts index fbcea113825..1a73d0d9820 100644 --- a/packages/effect/src/Logger.ts +++ b/packages/effect/src/Logger.ts @@ -194,8 +194,6 @@ export const map: { * Creates a batched logger that groups log messages together and processes them * in intervals. * - * @param window - The time window in which to batch log messages. - * * @example * ```ts * import { Console, Effect, Logger } from "effect" diff --git a/packages/effect/src/ManagedRuntime.ts b/packages/effect/src/ManagedRuntime.ts index c002f38794d..97e4a46ae07 100644 --- a/packages/effect/src/ManagedRuntime.ts +++ b/packages/effect/src/ManagedRuntime.ts @@ -25,8 +25,6 @@ export type TypeId = typeof TypeId /** * Checks if the provided argument is a `ManagedRuntime`. * - * @param input - The value to be checked if it is a `ManagedRuntime`. - * @since 3.9.0 * @category guards */ diff --git a/packages/effect/src/Metric.ts b/packages/effect/src/Metric.ts index d8a63328e34..948e4f18a36 100644 --- a/packages/effect/src/Metric.ts +++ b/packages/effect/src/Metric.ts @@ -160,8 +160,8 @@ export const mapInput: { * Represents a Counter metric that tracks cumulative numerical values over time. * Counters can be incremented and decremented and provide a running total of changes. * - * @param name - The name of the counter metric. - * @param options - An optional configuration for the counter: + * **Options** + * * - description - A description of the counter. * - bigint - Indicates if the counter uses 'bigint' data type. * - incremental - Set to 'true' for a counter that only increases. With this configuration, Effect ensures that non-incremental updates have no impact on the counter, making it exclusively suitable for counting upwards. @@ -206,9 +206,6 @@ export const counter: { * Creates a Frequency metric to count occurrences of events. * Frequency metrics are used to count the number of times specific events or incidents occur. * - * @param name - The name of the Frequency metric. - * @param description - An optional description of the Frequency metric. - * * @example * ```ts * import { Metric } from "effect" @@ -254,8 +251,8 @@ export const fromMetricKey: > * Represents a Gauge metric that tracks and reports a single numerical value at a specific moment. * Gauges are suitable for metrics that represent instantaneous values, such as memory usage or CPU load. * - * @param name - The name of the gauge metric. - * @param options - An optional configuration for the gauge: + * **Options** + * * - description - A description of the gauge metric. * - bigint - Indicates if the counter uses 'bigint' data type. * @@ -291,10 +288,6 @@ export const gauge: { * Represents a Histogram metric that records observations in specified value boundaries. * Histogram metrics are useful for measuring the distribution of values within a range. * - * @param name - The name of the histogram metric. - * @param boundaries - The boundaries for defining the histogram's value ranges. - * @param description - A description of the histogram metric. - * * @example * ```ts * import { Metric, MetricBoundaries } from "effect" @@ -407,7 +400,8 @@ export const sync: (evaluate: LazyArg) => Metric = * Creates a Summary metric that records observations and calculates quantiles. * Summary metrics provide statistical information about a set of values, including quantiles. * - * @param options - An object with configuration options for the Summary metric: + * **Options** + * * - name - The name of the Summary metric. * - maxAge - The maximum age of observations to retain. * - maxSize - The maximum number of observations to keep. diff --git a/packages/effect/src/Number.ts b/packages/effect/src/Number.ts index 02f7b1d90db..f6109e1ce31 100644 --- a/packages/effect/src/Number.ts +++ b/packages/effect/src/Number.ts @@ -16,8 +16,6 @@ import * as predicate from "./Predicate.js" /** * Tests if a value is a `number`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -35,9 +33,6 @@ export const isNumber: (input: unknown) => input is number = predicate.isNumber /** * Provides an addition operation on `number`s. * - * @param self - The first operand. - * @param that - The second operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -57,9 +52,6 @@ export const sum: { /** * Provides a multiplication operation on `number`s. * - * @param self - The first operand. - * @param that - The second operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -79,9 +71,6 @@ export const multiply: { /** * Provides a subtraction operation on `number`s. * - * @param self - The first operand. - * @param that - The second operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -101,9 +90,6 @@ export const subtract: { /** * Provides a division operation on `number`s. * - * @param self - The dividend operand. - * @param that - The divisor operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -129,9 +115,6 @@ export const divide: { * * Throws a `RangeError` if the divisor is `0`. * - * @param self - The dividend operand. - * @param that - The divisor operand. - * * @example * ```ts * import * as assert from "node:assert" @@ -151,8 +134,6 @@ export const unsafeDivide: { /** * Returns the result of adding `1` to a given number. * - * @param n - A `number` to be incremented. - * * @example * ```ts * import * as assert from "node:assert" @@ -169,8 +150,6 @@ export const increment = (n: number): number => n + 1 /** * Decrements a number by `1`. * - * @param n - A `number` to be decremented. - * * @example * ```ts * import * as assert from "node:assert" @@ -199,9 +178,6 @@ export const Order: order.Order = order.number /** * Returns `true` if the first argument is less than the second, otherwise `false`. * - * @param self - The first argument. - * @param that - The second argument. - * * @example * ```ts * import * as assert from "node:assert" @@ -223,9 +199,6 @@ export const lessThan: { /** * Returns a function that checks if a given `number` is less than or equal to the provided one. * - * @param self - The first `number` to compare with. - * @param that - The second `number` to compare with. - * * @example * ```ts * import * as assert from "node:assert" @@ -247,9 +220,6 @@ export const lessThanOrEqualTo: { /** * Returns `true` if the first argument is greater than the second, otherwise `false`. * - * @param self - The first argument. - * @param that - The second argument. - * * @example * ```ts * import * as assert from "node:assert" @@ -271,9 +241,6 @@ export const greaterThan: { /** * Returns a function that checks if a given `number` is greater than or equal to the provided one. * - * @param self - The first `number` to compare with. - * @param that - The second `number` to compare with. - * * @example * ```ts * import * as assert from "node:assert" @@ -295,10 +262,6 @@ export const greaterThanOrEqualTo: { /** * Checks if a `number` is between a `minimum` and `maximum` value (inclusive). * - * @param self - The `number` to check. - * @param minimum - The `minimum` value to check. - * @param maximum - The `maximum` value to check. - * * @example * ```ts * import * as assert from "node:assert" @@ -332,10 +295,6 @@ export const between: { * - If the `number` is greater than the `maximum` value, the function returns the `maximum` value. * - Otherwise, it returns the original `number`. * - * @param self - The `number` to be clamped. - * @param minimum - The lower end of the range. - * @param maximum - The upper end of the range. - * * @example * ```ts * import * as assert from "node:assert" @@ -364,9 +323,6 @@ export const clamp: { /** * Returns the minimum between two `number`s. * - * @param self - The first `number`. - * @param that - The second `number`. - * * @example * ```ts * import * as assert from "node:assert" @@ -385,9 +341,6 @@ export const min: { /** * Returns the maximum between two `number`s. * - * @param self - The first `number`. - * @param that - The second `number`. - * * @example * ```ts * import * as assert from "node:assert" @@ -406,8 +359,6 @@ export const max: { /** * Determines the sign of a given `number`. * - * @param n - The `number` to determine the sign of. - * * @example * ```ts * import * as assert from "node:assert" @@ -426,8 +377,6 @@ export const sign = (n: number): Ordering => Order(n, 0) /** * Takes an `Iterable` of `number`s and returns their sum as a single `number`. * - * @param collection - The collection of `number`s to sum. - * * @example * ```ts * import * as assert from "node:assert" @@ -450,8 +399,6 @@ export const sumAll = (collection: Iterable): number => { /** * Takes an `Iterable` of `number`s and returns their multiplication as a single `number`. * - * @param collection - The collection of `number`s to multiply. - * * @example * ```ts * import * as assert from "node:assert" @@ -479,9 +426,6 @@ export const multiplyAll = (collection: Iterable): number => { * * It always takes the sign of the dividend. * - * @param self - The dividend. - * @param divisor - The divisor. - * * @example * ```ts * import * as assert from "node:assert" @@ -511,8 +455,6 @@ export const remainder: { /** * Returns the next power of 2 from the given number. * - * @param self - The number to find the next power of 2 from. - * * @example * ```ts * import * as assert from "node:assert" @@ -559,9 +501,6 @@ export const parse = (s: string): Option => { /** * Returns the number rounded with the given precision. * - * @param self - The number to round - * @param precision - The precision - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Ordering.ts b/packages/effect/src/Ordering.ts index 377b3df3aba..73f88123a89 100644 --- a/packages/effect/src/Ordering.ts +++ b/packages/effect/src/Ordering.ts @@ -13,8 +13,6 @@ export type Ordering = -1 | 0 | 1 /** * Inverts the ordering of the input `Ordering`. * - * @param o - The input `Ordering`. - * * @example * ```ts * import * as assert from "node:assert" @@ -32,11 +30,6 @@ export const reverse = (o: Ordering): Ordering => (o === -1 ? 1 : o === 1 ? -1 : /** * Depending on the `Ordering` parameter given to it, returns a value produced by one of the 3 functions provided as parameters. * - * @param self - The `Ordering` parameter to match against. - * @param onLessThan - A function that will be called if the `Ordering` parameter is `-1`. - * @param onEqual - A function that will be called if the `Ordering` parameter is `0`. - * @param onGreaterThan - A function that will be called if the `Ordering` parameter is `1`. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Predicate.ts b/packages/effect/src/Predicate.ts index ce763a22aed..ba4cc0a78f8 100644 --- a/packages/effect/src/Predicate.ts +++ b/packages/effect/src/Predicate.ts @@ -71,9 +71,6 @@ export declare namespace Refinement { /** * Given a `Predicate` returns a `Predicate` * - * @param self - the `Predicate` to be transformed to `Predicate`. - * @param f - a function to transform `B` to `A`. - * * @example * ```ts * import * as assert from "node:assert" @@ -100,9 +97,6 @@ export const mapInput: { * * An `Array` is considered to be a `TupleOf` if its length is exactly `N`. * - * @param self - The `Array` to check. - * @param n - The exact number of elements that the `Array` should have to be considered a `TupleOf`. - * * @example * ```ts * import * as assert from "node:assert" @@ -132,9 +126,6 @@ export const isTupleOf: { * * An `Array` is considered to be a `TupleOfAtLeast` if its length is at least `N`. * - * @param self - The `Array` to check. - * @param n - The minimum number of elements that the `Array` should have to be considered a `TupleOfAtLeast`. - * * @example * ```ts * import * as assert from "node:assert" @@ -162,8 +153,6 @@ export const isTupleOfAtLeast: { /** * Tests if a value is `truthy`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -182,8 +171,6 @@ export const isTruthy = (input: unknown) => !!input /** * Tests if a value is a `Set`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -204,8 +191,6 @@ export const isSet = (input: unknown): input is Set => input instanceof /** * Tests if a value is a `Map`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -225,8 +210,6 @@ export const isMap = (input: unknown): input is Map => input i /** * Tests if a value is a `string`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -245,8 +228,6 @@ export const isString = (input: unknown): input is string => typeof input === "s /** * Tests if a value is a `number`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -265,8 +246,6 @@ export const isNumber = (input: unknown): input is number => typeof input === "n /** * Tests if a value is a `boolean`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -285,8 +264,6 @@ export const isBoolean = (input: unknown): input is boolean => typeof input === /** * Tests if a value is a `bigint`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -305,8 +282,6 @@ export const isBigInt = (input: unknown): input is bigint => typeof input === "b /** * Tests if a value is a `symbol`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -325,8 +300,6 @@ export const isSymbol = (input: unknown): input is symbol => typeof input === "s /** * Tests if a value is a `function`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -345,8 +318,6 @@ export const isFunction: (input: unknown) => input is Function = isFunction_ /** * Tests if a value is `undefined`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -366,8 +337,6 @@ export const isUndefined = (input: unknown): input is undefined => input === und /** * Tests if a value is not `undefined`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -387,8 +356,6 @@ export const isNotUndefined = (input: A): input is Exclude => i /** * Tests if a value is `null`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -408,8 +375,6 @@ export const isNull = (input: unknown): input is null => input === null /** * Tests if a value is not `null`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -429,8 +394,6 @@ export const isNotNull = (input: A): input is Exclude => input !== n /** * A guard that always fails. * - * @param _ - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -450,8 +413,6 @@ export const isNever: (input: unknown) => input is never = (_: unknown): _ is ne /** * A guard that always succeeds. * - * @param _ - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -476,8 +437,6 @@ export const isRecordOrArray = (input: unknown): input is { [x: PropertyKey]: un /** * Tests if a value is an `object`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -498,9 +457,6 @@ export const isObject = (input: unknown): input is object => isRecordOrArray(inp /** * Checks whether a value is an `object` containing a specified property key. * - * @param property - The field to check within the object. - * @param self - The value to examine. - * * @category guards * @since 2.0.0 */ @@ -516,9 +472,6 @@ export const hasProperty: { /** * Tests if a value is an `object` with a property `_tag` that matches the given tag. * - * @param input - The value to test. - * @param tag - The tag to test for. - * * @example * ```ts * import * as assert from "node:assert" @@ -546,8 +499,6 @@ export const isTagged: { /** * A guard that succeeds when the input is `null` or `undefined`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -568,8 +519,6 @@ export const isNullable = (input: A): input is Extract = /** * A guard that succeeds when the input is not `null` or `undefined`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -590,8 +539,6 @@ export const isNotNullable = (input: A): input is NonNullable => input !== /** * A guard that succeeds when the input is an `Error`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -611,8 +558,6 @@ export const isError = (input: unknown): input is Error => input instanceof Erro /** * A guard that succeeds when the input is a `Uint8Array`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -632,8 +577,6 @@ export const isUint8Array = (input: unknown): input is Uint8Array => input insta /** * A guard that succeeds when the input is a `Date`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -653,8 +596,6 @@ export const isDate = (input: unknown): input is Date => input instanceof Date /** * A guard that succeeds when the input is an `Iterable`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -675,8 +616,6 @@ export const isIterable = (input: unknown): input is Iterable => hasPro /** * A guard that succeeds when the input is a record. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -701,8 +640,6 @@ export const isRecord = (input: unknown): input is { [x: string | symbol]: unkno /** * A guard that succeeds when the input is a readonly record. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -727,8 +664,6 @@ export const isReadonlyRecord: ( /** * A guard that succeeds when the input is a Promise. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -757,8 +692,6 @@ export const isPromiseLike = ( /** * Tests if a value is a `RegExp`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" @@ -883,8 +816,6 @@ export const struct: { /** * Negates the result of a given predicate. * - * @param self - A predicate. - * * @example * ```ts * import * as assert from "node:assert" @@ -905,9 +836,6 @@ export const not = (self: Predicate): Predicate => (a) => !self(a) /** * Combines two predicates into a new predicate that returns `true` if at least one of the predicates returns `true`. * - * @param self - A predicate. - * @param that - A predicate. - * * @example * ```ts * import * as assert from "node:assert" @@ -933,9 +861,6 @@ export const or: { /** * Combines two predicates into a new predicate that returns `true` if both of the predicates returns `true`. * - * @param self - A predicate. - * @param that - A predicate. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Random.ts b/packages/effect/src/Random.ts index 9a95c24483b..923af0a0b62 100644 --- a/packages/effect/src/Random.ts +++ b/packages/effect/src/Random.ts @@ -154,8 +154,6 @@ export const Random: Context.Tag = internal.randomTag * - Generating random UI data for visual tests. * - Creating data that needs to change daily but remain the same throughout a single day, such as using a date as the seed. * - * @param seed - The seed value used to initialize the generator. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/RcMap.ts b/packages/effect/src/RcMap.ts index 71061963918..71beef15a01 100644 --- a/packages/effect/src/RcMap.ts +++ b/packages/effect/src/RcMap.ts @@ -52,10 +52,13 @@ export declare namespace RcMap { * * Complex keys can extend `Equal` and `Hash` to allow lookups by value. * + * **Options** + * + * - `capacity`: The maximum number of resources that can be held in the map. + * - `idleTimeToLive`: When the reference count reaches zero, the resource will be released after this duration. + * * @since 3.5.0 * @category models - * @param capacity The maximum number of resources that can be held in the map. - * @param idleTimeToLive When the reference count reaches zero, the resource will be released after this duration. * @example * ```ts * import { Effect, RcMap } from "effect" diff --git a/packages/effect/src/Record.ts b/packages/effect/src/Record.ts index 7477b119422..201d6f6ca32 100644 --- a/packages/effect/src/Record.ts +++ b/packages/effect/src/Record.ts @@ -66,8 +66,6 @@ export const empty = (): Record< /** * Determine if a record is empty. * - * @param self - record to test for emptiness. - * * @example * ```ts * import * as assert from "node:assert" @@ -86,8 +84,6 @@ export const isEmptyRecord = (self: Record): self is /** * Determine if a record is empty. * - * @param self - record to test for emptiness. - * * @example * ```ts * import * as assert from "node:assert" @@ -108,9 +104,6 @@ export const isEmptyReadonlyRecord: ( * Takes an iterable and a projection function and returns a record. * The projection function maps each value of the iterable to a tuple of a key and a value, which is then added to the resulting record. * - * @param self - An iterable of values to be mapped to a record. - * @param f - A projection function that maps values of the iterable to a tuple of a key and a value. - * * @example * ```ts * import * as assert from "node:assert" @@ -153,9 +146,6 @@ export const fromIterableWith: { /** * Creates a new record from an iterable, utilizing the provided function to determine the key for each element. * - * @param items - An iterable containing elements. - * @param f - A function that extracts the key for each element. - * * @example * ```ts * import * as assert from "node:assert" @@ -189,8 +179,6 @@ export const fromIterableBy = ( * If there are conflicting keys when using `fromEntries`, the last occurrence of the key/value pair will overwrite the * previous ones. So the resulting record will only have the value of the last occurrence of each key. * - * @param self - The iterable of key-value pairs. - * * @example * ```ts * import * as assert from "node:assert" @@ -211,9 +199,6 @@ export const fromEntries: ( /** * Transforms the values of a record into an `Array` with a custom mapping function. * - * @param self - The record to transform. - * @param f - The custom mapping function to apply to each key/value of the record. - * * @example * ```ts * import * as assert from "node:assert" @@ -243,8 +228,6 @@ export const collect: { /** * Takes a record and returns an array of tuples containing its keys and values. * - * @param self - The record to transform. - * * @example * ```ts * import * as assert from "node:assert" @@ -265,8 +248,6 @@ export const toEntries: (self: ReadonlyRecord) => Arr /** * Returns the number of key/value pairs in a record. * - * @param self - A record to calculate the number of key/value pairs in. - * * @example * ```ts * import * as assert from "node:assert" @@ -282,9 +263,6 @@ export const size = (self: ReadonlyRecord): number => /** * Check if a given `key` exists in a record. * - * @param self - the record to look in. - * @param key - the key to look for in the record. - * * @example * ```ts * import * as assert from "node:assert" @@ -315,9 +293,6 @@ export const has: { /** * Retrieve a value at a particular key from a record, returning it wrapped in an `Option`. * - * @param self - The record to retrieve value from. - * @param key - Key to retrieve from record. - * * @example * ```ts * import * as assert from "node:assert" @@ -344,10 +319,6 @@ export const get: { * Apply a function to the element at the specified key, creating a new record. * If the key does not exist, the record is returned unchanged. * - * @param self - The record to be updated. - * @param key - The key of the element to modify. - * @param f - The function to apply to the element. - * * @example * ```ts * import * as assert from "node:assert" @@ -387,10 +358,6 @@ export const modify: { * Apply a function to the element at the specified key, creating a new record, * or return `None` if the key doesn't exist. * - * @param self - The record to be updated. - * @param key - The key of the element to modify. - * @param f - The function to apply to the element. - * * @example * ```ts * import * as assert from "node:assert" @@ -437,10 +404,6 @@ export const modifyOption: { /** * Replaces a value in the record with the new value passed as parameter. * - * @param self - The record to be updated. - * @param key - The key to search for in the record. - * @param b - The new value to replace the existing value with. - * * @example * ```ts * import * as assert from "node:assert" @@ -478,9 +441,6 @@ export const replaceOption: { * If the given key exists in the record, returns a new record with the key removed, * otherwise returns a copy of the original record. * - * @param self - the record to remove the key from. - * @param key - the key to remove from the record. - * * @example * ```ts * import * as assert from "node:assert" @@ -511,9 +471,6 @@ export const remove: { * of a tuple with the value and the record with the removed property. * If the key is not present, returns `O.none`. * - * @param self - The input record. - * @param key - The key of the property to retrieve. - * * @example * ```ts * import * as assert from "node:assert" @@ -543,9 +500,6 @@ export const pop: { /** * Maps a record into another record by applying a transformation function to each of its values. * - * @param self - The record to be mapped. - * @param f - A transformation function that will be applied to each of the values in the record. - * * @example * ```ts * import * as assert from "node:assert" @@ -655,9 +609,6 @@ export const mapEntries: { * Transforms a record into a record by applying the function `f` to each key and value in the original record. * If the function returns `Some`, the key-value pair is included in the output record. * - * @param self - The input record. - * @param f - The transformation function. - * * @example * ```ts * import * as assert from "node:assert" @@ -698,9 +649,6 @@ export const filterMap: { /** * Selects properties from a record whose values match the given predicate. * - * @param self - The record to filter. - * @param predicate - A function that returns a `boolean` value to determine if the entry should be included in the new record. - * * @example * ```ts * import * as assert from "node:assert" @@ -747,8 +695,6 @@ export const filter: { /** * Given a record with `Option` values, returns a new record containing only the `Some` values, preserving the original keys. * - * @param self - A record with `Option` values. - * * @example * ```ts * import * as assert from "node:assert" @@ -834,9 +780,6 @@ export const getRights = ( /** * Partitions the elements of a record into two groups: those that match a predicate, and those that don't. * - * @param self - The record to partition. - * @param f - The predicate function to apply to each element. - * * @example * ```ts * import * as assert from "node:assert" @@ -884,8 +827,6 @@ export const partitionMap: { * Partitions a record of `Either` values into two separate records, * one with the `Left` values and one with the `Right` values. * - * @param self - the record to partition. - * * @example * ```ts * import * as assert from "node:assert" @@ -907,9 +848,6 @@ export const separate: ( /** * Partitions a record into two separate records based on the result of a predicate function. * - * @param self - The input record to partition. - * @param predicate - The partitioning function to determine the partitioning of each value of the record. - * * @example * ```ts * import * as assert from "node:assert" @@ -969,8 +907,6 @@ export const partition: { /** * Retrieve the keys of a given record as an array. * - * @param self - The object for which you want to get the keys. - * * @since 2.0.0 */ export const keys = (self: ReadonlyRecord): Array => @@ -979,8 +915,6 @@ export const keys = (self: ReadonlyRecord): /** * Retrieve the values of a given record as an array. * - * @param self - The object for which you want to get the values. - * * @since 2.0.0 */ export const values = (self: ReadonlyRecord): Array => collect(self, (_, a) => a) @@ -988,10 +922,6 @@ export const values = (self: ReadonlyRecord): Array(equivalence: Equivalence): { @@ -1082,9 +1004,6 @@ export const isSubrecordBy = (equivalence: Equivalence): { * Check if one record is a subrecord of another, meaning it contains all the keys and values found in the second record. * This comparison uses default equality checks (`Equal.equivalence()`). * - * @param self - The first record to check. - * @param that - The second record to compare against. - * * @since 2.0.0 */ export const isSubrecord: { @@ -1095,10 +1014,6 @@ export const isSubrecord: { /** * Reduce a record to a single value by combining its entries with a specified function. * - * @param self - The record to reduce. - * @param zero - The initial value of the accumulator. - * @param f - The function to combine entries (accumulator, value, key). - * * @category folding * @since 2.0.0 */ @@ -1126,9 +1041,6 @@ export const reduce: { /** * Check if all entries in a record meet a specific condition. * - * @param self - The record to check. - * @param predicate - The condition to test entries (value, key). - * * @since 2.0.0 */ export const every: { @@ -1159,9 +1071,6 @@ export const every: { /** * Check if any entry in a record meets a specific condition. * - * @param self - The record to check. - * @param predicate - The condition to test entries (value, key). - * * @since 2.0.0 */ export const some: { @@ -1182,10 +1091,6 @@ export const some: { /** * Merge two records, preserving entries that exist in either of the records. * - * @param self - The first record. - * @param that - The second record to combine with the first. - * @param combine - A function to specify how to merge entries with the same key. - * * @since 2.0.0 */ export const union: { @@ -1231,10 +1136,6 @@ export const union: { /** * Merge two records, retaining only the entries that exist in both records. * - * @param self - The first record. - * @param that - The second record to merge with the first. - * @param combine - A function to specify how to merge entries with the same key. - * * @since 2.0.0 */ export const intersection: { @@ -1270,9 +1171,6 @@ export const intersection: { /** * Merge two records, preserving only the entries that are unique to each record. * - * @param self - The first record. - * @param that - The second record to compare with the first. - * * @since 2.0.0 */ export const difference: { @@ -1310,8 +1208,6 @@ export const difference: { /** * Create an `Equivalence` for records using the provided `Equivalence` for values. * - * @param equivalence - An `Equivalence` for the values contained in the records. - * * @category instances * @since 2.0.0 */ @@ -1325,9 +1221,6 @@ export const getEquivalence = ( /** * Create a non-empty record from a single element. * - * @param key - The key for the element. - * @param value - The value associated with the key. - * * @category constructors * @since 2.0.0 */ diff --git a/packages/effect/src/RegExp.ts b/packages/effect/src/RegExp.ts index 6177ce3f397..9ee5a584cea 100644 --- a/packages/effect/src/RegExp.ts +++ b/packages/effect/src/RegExp.ts @@ -8,8 +8,6 @@ import * as predicate from "./Predicate.js" /** * Tests if a value is a `RegExp`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/STM.ts b/packages/effect/src/STM.ts index fd122834a6d..67158b486c3 100644 --- a/packages/effect/src/STM.ts +++ b/packages/effect/src/STM.ts @@ -1973,9 +1973,7 @@ export const zipWith: { * iterable will be executed in sequence, and the first one that succeeds * will determine the outcome of the resulting `STM` value. * - * @param effects - The iterable of `STM` values to evaluate. - * - * @returns A new `STM` value that represents the first successful + * Returns a new `STM` value that represents the first successful * `STM` value in the iterable, or a failed `STM` value if all of the * `STM` values in the iterable fail. * diff --git a/packages/effect/src/Schema.ts b/packages/effect/src/Schema.ts index 07591353ccb..535d282d9aa 100644 --- a/packages/effect/src/Schema.ts +++ b/packages/effect/src/Schema.ts @@ -3140,9 +3140,6 @@ function makeBrandClass( * Schema + B -> Schema> * ``` * - * @param self - The input schema to be combined with the brand. - * @param brand - The brand to apply. - * * @example * ```ts * import * as Schema from "effect/Schema" @@ -3223,8 +3220,6 @@ export interface mutable extends /** * Creates a new schema with shallow mutability applied to its properties. * - * @param schema - The original schema to make properties mutable (shallowly). - * * @category combinators * @since 3.10.0 */ @@ -4019,10 +4014,6 @@ export function transformLiterals< * This API is useful when you want to add a property to your schema which doesn't describe the shape of the input, * but rather maps to another schema, for example when you want to add a discriminant to a simple union. * - * @param self - The input schema. - * @param key - The name of the property to add to the schema. - * @param value - The value of the property to add to the schema. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/SchemaAST.ts b/packages/effect/src/SchemaAST.ts index fd58d6c70e4..6f35353dea7 100644 --- a/packages/effect/src/SchemaAST.ts +++ b/packages/effect/src/SchemaAST.ts @@ -2513,8 +2513,6 @@ export const required = (ast: AST): AST => { /** * Creates a new AST with shallow mutability applied to its properties. * - * @param ast - The original AST to make properties mutable (shallowly). - * * @since 3.10.0 */ export const mutable = (ast: AST): AST => { diff --git a/packages/effect/src/Sink.ts b/packages/effect/src/Sink.ts index a024ad87fe1..70272aca6e5 100644 --- a/packages/effect/src/Sink.ts +++ b/packages/effect/src/Sink.ts @@ -995,7 +995,9 @@ export const fromEffect: (effect: Effect.Effect) => Sink( /** * Create a sink which enqueues each element into the specified queue. * - * @param shutdown If `true`, the queue will be shutdown after the sink is evaluated (defaults to `false`) + * If the `shutdown` parameter is `true`, the queue will be shutdown after the + * sink is evaluated (defaults to `false`). + * * @since 2.0.0 * @category constructors */ diff --git a/packages/effect/src/Stream.ts b/packages/effect/src/Stream.ts index 7f15688b0b6..ac4c66b0bac 100644 --- a/packages/effect/src/Stream.ts +++ b/packages/effect/src/Stream.ts @@ -247,10 +247,8 @@ export const aggregate: { } = internal.aggregate /** - * Like `aggregateWithinEither`, but only returns the `Right` results. + * Like {@link aggregateWithinEither}, but only returns the `Right` results. * - * @param sink A `Sink` used to perform the aggregation. - * @param schedule A `Schedule` used to signal when to stop the aggregation. * @since 2.0.0 * @category utils */ @@ -278,8 +276,6 @@ export const aggregateWithin: { * Aggregated elements will be fed into the schedule to determine the delays * between pulls. * - * @param sink A `Sink` used to perform the aggregation. - * @param schedule A `Schedule` used to signal when to stop the aggregation. * @since 2.0.0 * @category utils */ @@ -1954,7 +1950,10 @@ export const fromChunk: (chunk: Chunk.Chunk) => Stream = internal.fromC /** * Creates a stream from a subscription to a `PubSub`. * - * @param shutdown If `true`, the `PubSub` will be shutdown after the stream is evaluated (defaults to `false`) + * **Options** + * + * - `shutdown`: If `true`, the `PubSub` will be shutdown after the stream is evaluated (defaults to `false`) + * * @since 2.0.0 * @category constructors */ @@ -1972,7 +1971,10 @@ export const fromChunkPubSub: { /** * Creates a stream from a `Queue` of values. * - * @param shutdown If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`) + * **Options** + * + * - `shutdown`: If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`) + * * @since 2.0.0 * @category constructors */ @@ -2034,7 +2036,10 @@ export const fromEffectOption: (effect: Effect.Effect( /** * Creates a stream from a queue of values * - * @param maxChunkSize The maximum number of queued elements to put in one chunk in the stream - * @param shutdown If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`) + * **Options** + * + * - `maxChunkSize`: The maximum number of queued elements to put in one chunk in the stream + * - `shutdown`: If `true`, the queue will be shutdown after the stream is evaluated (defaults to `false`) + * * @since 2.0.0 * @category constructors */ @@ -2182,7 +2190,6 @@ export const fromReadableStream: { * * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader. * - * @param allocSize Controls the size of the underlying `ArrayBuffer` (defaults to `4096`). * @since 2.0.0 * @category constructors */ @@ -2198,6 +2205,7 @@ export const fromReadableStreamByob: { ( evaluate: LazyArg>, onError: (error: unknown) => E, + /** Controls the size of the underlying `ArrayBuffer` (defaults to `4096`) */ allocSize?: number ): Stream } = internal.fromReadableStreamByob @@ -4059,7 +4067,6 @@ export const repeatWith: { * The schedule is reset as soon as the first element passes through the * stream again. * - * @param schedule A `Schedule` receiving as input the errors of the stream. * @since 2.0.0 * @category utils */ diff --git a/packages/effect/src/String.ts b/packages/effect/src/String.ts index 3cb09dfdf60..3d9e819fa6c 100644 --- a/packages/effect/src/String.ts +++ b/packages/effect/src/String.ts @@ -20,8 +20,6 @@ import * as predicate from "./Predicate.js" /** * Tests if a value is a `string`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Symbol.ts b/packages/effect/src/Symbol.ts index 94e030ce088..eaf452743b6 100644 --- a/packages/effect/src/Symbol.ts +++ b/packages/effect/src/Symbol.ts @@ -8,8 +8,6 @@ import * as predicate from "./Predicate.js" /** * Tests if a value is a `symbol`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Tuple.ts b/packages/effect/src/Tuple.ts index b74dbbae736..26097064154 100644 --- a/packages/effect/src/Tuple.ts +++ b/packages/effect/src/Tuple.ts @@ -20,8 +20,6 @@ export interface TupleTypeLambda extends TypeLambda { /** * Constructs a new tuple from the provided values. * - * @param elements - The list of elements to create the tuple from. - * * @example * ```ts * import * as assert from "node:assert" @@ -38,8 +36,6 @@ export const make = >(...elements: A): A => element /** * Return the first element of a tuple. * - * @param self - A tuple of length `2`. - * * @example * ```ts * import * as assert from "node:assert" @@ -56,8 +52,6 @@ export const getFirst = (self: readonly [L, R]): L => self[0] /** * Return the second element of a tuple. * - * @param self - A tuple of length `2`. - * * @example * ```ts * import * as assert from "node:assert" @@ -74,9 +68,6 @@ export const getSecond = (self: readonly [L, R]): R => self[1] /** * Transforms each element of tuple using the given function, treating tuple homomorphically * - * @param self - A tuple. - * @param f - The function to transform elements of the tuple. - * * @example * ```ts * import * as assert from "node:assert" @@ -111,10 +102,6 @@ export const map: { /** * Transforms both elements of a tuple using the given functions. * - * @param self - A tuple of length `2`. - * @param f - The function to transform the first element of the tuple. - * @param g - The function to transform the second element of the tuple. - * * @example * ```ts * import * as assert from "node:assert" @@ -152,9 +139,6 @@ export const mapBoth: { /** * Transforms the first component of a tuple using a given function. * - * @param self - A tuple of length `2`. - * @param f - The function to transform the first element of the tuple. - * * @example * ```ts * import * as assert from "node:assert" @@ -177,9 +161,6 @@ export const mapFirst: { /** * Transforms the second component of a tuple using a given function. * - * @param self - A tuple of length `2`. - * @param f - The function to transform the second element of the tuple. - * * @example * ```ts * import * as assert from "node:assert" @@ -202,8 +183,6 @@ export const mapSecond: { /** * Swaps the two elements of a tuple. * - * @param self - A tuple of length `2`. - * * @example * ```ts * import * as assert from "node:assert" @@ -256,9 +235,6 @@ export const appendElement: { /** * Retrieves the element at a specified index from a tuple. * - * @param self - A tuple from which to retrieve the element. - * @param index - The index of the element to retrieve. - * * @example * ```ts * import * as assert from "node:assert" @@ -281,9 +257,6 @@ export { * * An `Array` is considered to be a `TupleOf` if its length is exactly `N`. * - * @param self - The `Array` to check. - * @param n - The exact number of elements that the `Array` should have to be considered a `TupleOf`. - * * @example * ```ts * import * as assert from "node:assert" @@ -309,9 +282,6 @@ export { * * An `Array` is considered to be a `TupleOfAtLeast` if its length is at least `N`. * - * @param self - The `Array` to check. - * @param n - The minimum number of elements that the `Array` should have to be considered a `TupleOfAtLeast`. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/effect/src/Utils.ts b/packages/effect/src/Utils.ts index 53b297dcc70..bc94d9927a1 100644 --- a/packages/effect/src/Utils.ts +++ b/packages/effect/src/Utils.ts @@ -519,7 +519,7 @@ export class PCGRandom { /** * Creates an instance of PCGRandom. * - * @param seed - The low 32 bits of the seed (0 is used for high 32 bits). + * - `seed` - The low 32 bits of the seed (0 is used for high 32 bits). * * @memberOf PCGRandom */ @@ -527,9 +527,9 @@ export class PCGRandom { /** * Creates an instance of PCGRandom. * - * @param seedHi - The high 32 bits of the seed. - * @param seedLo - The low 32 bits of the seed. - * @param inc - The low 32 bits of the incrementer (0 is used for high 32 bits). + * - `seedHi` - The high 32 bits of the seed. + * - `seedLo` - The low 32 bits of the seed. + * - `inc` - The low 32 bits of the incrementer (0 is used for high 32 bits). * * @memberOf PCGRandom */ @@ -537,10 +537,10 @@ export class PCGRandom { /** * Creates an instance of PCGRandom. * - * @param seedHi - The high 32 bits of the seed. - * @param seedLo - The low 32 bits of the seed. - * @param incHi - The high 32 bits of the incrementer. - * @param incLo - The low 32 bits of the incrementer. + * - `seedHi` - The high 32 bits of the seed. + * - `seedLo` - The low 32 bits of the seed. + * - `incHi` - The high 32 bits of the incrementer. + * - `incLo` - The low 32 bits of the incrementer. * * @memberOf PCGRandom */ diff --git a/packages/platform/src/HttpMethod.ts b/packages/platform/src/HttpMethod.ts index 0f082893257..7d82297b191 100644 --- a/packages/platform/src/HttpMethod.ts +++ b/packages/platform/src/HttpMethod.ts @@ -42,8 +42,6 @@ export const all: ReadonlySet = new Set(["GET", "POST", "PUT", "DELE /** * Tests if a value is a `HttpMethod`. * - * @param input - The value to test. - * * @example * ```ts * import * as assert from "node:assert" diff --git a/packages/typeclass/src/Applicative.ts b/packages/typeclass/src/Applicative.ts index 9918a1d8289..27b561a1383 100644 --- a/packages/typeclass/src/Applicative.ts +++ b/packages/typeclass/src/Applicative.ts @@ -20,9 +20,6 @@ export interface Applicative extends SemiApplicative, P * - `combine` is provided by {@link semiApplicative.getSemigroup}. * - `empty` is `F.of(M.empty)` * - * @param F - The `Applicative` instance for `F`. - * @param M - The `Monoid` instance for `A`. - * * @since 0.24.0 */ export const getMonoid = diff --git a/packages/typeclass/src/SemiApplicative.ts b/packages/typeclass/src/SemiApplicative.ts index d514870f17b..8f381cface6 100644 --- a/packages/typeclass/src/SemiApplicative.ts +++ b/packages/typeclass/src/SemiApplicative.ts @@ -30,10 +30,6 @@ export const getSemigroup = /** * Zips two `F` values together using a provided function, returning a new `F` of the result. * - * @param self - The left-hand side of the zip operation - * @param that - The right-hand side of the zip operation - * @param f - The function used to combine the values of the two `Option`s - * * @since 0.24.0 */ export const zipWith = (F: SemiApplicative): { @@ -112,8 +108,6 @@ export const zipRight = (F: SemiApplicative): { /** * Lifts a binary function into `F`. * - * @param f - The function to lift. - * * @category lifting * @since 0.24.0 */ diff --git a/packages/typeclass/src/Semigroup.ts b/packages/typeclass/src/Semigroup.ts index 31cbc01a442..e77d25e3ce3 100644 --- a/packages/typeclass/src/Semigroup.ts +++ b/packages/typeclass/src/Semigroup.ts @@ -27,7 +27,9 @@ export interface SemigroupTypeLambda extends TypeLambda { } /** - * @param combineMany - Useful when `combineMany` can be optimised + * The `combineMany` parameter is optional and defaults to a standard + * implementation. You can provide a custom implementation when performance + * optimizations are possible. * * @category constructors * @since 0.24.0 @@ -88,9 +90,6 @@ export const reverse = (S: Semigroup): Semigroup => * It is interesting to note that there is no equivalent API in the `Monoid` module. This is because the value `empty`, * which is required for the `Monoid` interface, cannot exist. * - * @param S - The `Semigroup` instance. - * @param separator - The separator value. - * * @since 0.24.0 */ export const intercalate: { From 28d867358e24c8f9acb07928b7c5e11c8ab3f32b Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Mon, 3 Mar 2025 09:05:35 +0100 Subject: [PATCH 04/16] Reorder @throws documentation comments --- packages/effect/src/Cron.ts | 10 +++++----- packages/effect/src/Duration.ts | 4 ++-- packages/effect/src/Either.ts | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/effect/src/Cron.ts b/packages/effect/src/Cron.ts index 5eef47f0c83..99569d56a4f 100644 --- a/packages/effect/src/Cron.ts +++ b/packages/effect/src/Cron.ts @@ -320,8 +320,6 @@ export const unsafeParse = (cron: string, tz?: DateTime.TimeZone | string): Cron /** * Checks if a given `Date` falls within an active `Cron` time window. * - * @throws `IllegalArgumentException` if the given `DateTime.Input` is invalid. - * * @example * ```ts * import * as assert from "node:assert" @@ -332,6 +330,8 @@ export const unsafeParse = (cron: string, tz?: DateTime.TimeZone | string): Cron * assert.deepStrictEqual(Cron.match(cron, new Date("2021-01-08 05:00:00")), false) * ``` * + * @throws `IllegalArgumentException` if the given `DateTime.Input` is invalid. + * * @since 2.0.0 */ export const match = (cron: Cron, date: DateTime.DateTime.Input): boolean => { @@ -378,9 +378,6 @@ const daysInMonth = (date: Date): number => * * Uses the current time as a starting point if no value is provided for `now`. * - * @throws `IllegalArgumentException` if the given `DateTime.Input` is invalid. - * @throws `Error` if the next run date cannot be found within 10,000 iterations. - * * @example * ```ts * import * as assert from "node:assert" @@ -391,6 +388,9 @@ const daysInMonth = (date: Date): number => * assert.deepStrictEqual(Cron.next(cron, after), new Date("2021-01-08 04:00:00")) * ``` * + * @throws `IllegalArgumentException` if the given `DateTime.Input` is invalid. + * @throws `Error` if the next run date cannot be found within 10,000 iterations. + * * @since 2.0.0 */ export const next = (cron: Cron, startFrom?: DateTime.DateTime.Input): Date => { diff --git a/packages/effect/src/Duration.ts b/packages/effect/src/Duration.ts index 56add65bdca..886313dd4e0 100644 --- a/packages/effect/src/Duration.ts +++ b/packages/effect/src/Duration.ts @@ -861,8 +861,6 @@ export const format = (self: DurationInput): string => { * * Milliseconds and nanoseconds are expressed as fractional seconds. * - * @throws `RangeError` If the duration is not finite. - * * @example * ```ts * import { Duration } from "effect" @@ -872,6 +870,8 @@ export const format = (self: DurationInput): string => { * Duration.unsafeFormatIso(Duration.millis(1500)) // => "PT1.5S" * ``` * + * @throws `RangeError` If the duration is not finite. + * * @since 3.13.0 * @category conversions */ diff --git a/packages/effect/src/Either.ts b/packages/effect/src/Either.ts index 8fc7a1dbb91..6ad0a011db7 100644 --- a/packages/effect/src/Either.ts +++ b/packages/effect/src/Either.ts @@ -611,8 +611,6 @@ export const getOrThrowWith: { * * The thrown error is a default error. To configure the error thrown, see {@link getOrThrowWith}. * - * @throws `Error("getOrThrow called on a Left")` - * * @example * ```ts * import * as assert from "node:assert" @@ -622,6 +620,8 @@ export const getOrThrowWith: { * assert.throws(() => Either.getOrThrow(Either.left("error"))) * ``` * + * @throws `Error("getOrThrow called on a Left")` + * * @category getters * @since 2.0.0 */ From 8c6645be9a578d80da3e3ec2e4ca0108dcbd8f75 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Mon, 3 Mar 2025 11:46:31 +0100 Subject: [PATCH 05/16] Update documentation code examples with `skip-type-checking` and import simplifications --- package.json | 2 +- packages/effect/src/Array.ts | 2 +- packages/effect/src/Effect.ts | 18 ++++++++++-------- packages/effect/src/Equivalence.ts | 2 +- packages/effect/src/Function.ts | 6 +++--- packages/effect/src/Pool.ts | 2 +- packages/effect/src/Predicate.ts | 4 ++-- packages/effect/src/STM.ts | 4 ++-- packages/effect/src/Schedule.ts | 14 +++++++------- packages/effect/src/Sink.ts | 16 ++++++++-------- packages/effect/src/Stream.ts | 16 +++------------- packages/effect/src/TestClock.ts | 3 ++- pnpm-lock.yaml | 10 +++++----- 13 files changed, 46 insertions(+), 53 deletions(-) diff --git a/package.json b/package.json index 9e0da55bd24..ad03a224f97 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@changesets/cli": "^2.27.7", "@edge-runtime/vm": "^4.0.0", "@effect/build-utils": "^0.7.7", - "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400", + "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2", "@effect/eslint-plugin": "^0.2.0", "@effect/language-service": "^0.1.0", "@effect/vitest": "workspace:^", diff --git a/packages/effect/src/Array.ts b/packages/effect/src/Array.ts index abb9bcf2351..90afb09844a 100644 --- a/packages/effect/src/Array.ts +++ b/packages/effect/src/Array.ts @@ -1982,7 +1982,7 @@ export const pad: { * the `Iterable`. Note that `chunksOf(n)([])` is `[]`, not `[[]]`. This is intentional, and is consistent with a recursive * definition of `chunksOf`; it satisfies the property that * - * ```ts + * ```ts skip-type-checking * chunksOf(n)(xs).concat(chunksOf(n)(ys)) == chunksOf(n)(xs.concat(ys))) * ``` * diff --git a/packages/effect/src/Effect.ts b/packages/effect/src/Effect.ts index aac441ea264..0921c6cd663 100644 --- a/packages/effect/src/Effect.ts +++ b/packages/effect/src/Effect.ts @@ -591,7 +591,7 @@ export const once: (self: Effect) => Effect * * For instance, if the input is a tuple: * - * ```ts + * ```ts skip-type-checking * // ┌─── a tuple of effects * // ▼ * Effect.all([effect1, effect2, ...]) @@ -5029,7 +5029,7 @@ export const flipWith: { * * **Syntax** * - * ```ts + * ```ts skip-type-checking * const mappedEffect = pipe(myEffect, Effect.map(transformation)) * // or * const mappedEffect = Effect.map(myEffect, transformation) @@ -8603,7 +8603,8 @@ export const whenRef: { * operations that depend on previous results. * * **Syntax** - * ```ts + * + * ```ts skip-type-checking * const flatMappedEffect = pipe(myEffect, Effect.flatMap(transformation)) * // or * const flatMappedEffect = Effect.flatMap(myEffect, transformation) @@ -8668,7 +8669,8 @@ export const flatMap: { * first. * * **Syntax** - * ```ts + * + * ```ts skip-type-checking * const transformedEffect = pipe(myEffect, Effect.andThen(anotherEffect)) * // or * const transformedEffect = Effect.andThen(myEffect, anotherEffect) @@ -9058,13 +9060,13 @@ export const raceAll: >( * * If you want a quicker return, you can disconnect the interrupt signal for both effects. Instead of calling: * - * ```ts + * ```ts skip-type-checking * Effect.raceFirst(task1, task2) * ``` * * You can use: * - * ```ts + * ```ts skip-type-checking * Effect.raceFirst(Effect.disconnect(task1), Effect.disconnect(task2)) * ``` * @@ -9689,7 +9691,7 @@ export const forever: (self: Effect) => Effect = * This function provides a way to implement effectful loops, similar to a * `while` loop in JavaScript. * - * ```ts + * ```ts skip-type-checking * let result = initial * * while (options.while(result)) { @@ -9764,7 +9766,7 @@ export const iterate: { * iterating as long as the `while` condition evaluates to `true`, similar to a * `while` loop in JavaScript. * - * ```ts + * ```ts skip-type-checking * let state = initial * const result = [] * diff --git a/packages/effect/src/Equivalence.ts b/packages/effect/src/Equivalence.ts index f203095d08b..dfb6a11ddf2 100644 --- a/packages/effect/src/Equivalence.ts +++ b/packages/effect/src/Equivalence.ts @@ -177,7 +177,7 @@ export const productMany = ( /** * Similar to `Promise.all` but operates on `Equivalence`s. * - * ``` + * ```ts skip-type-checking * [Equivalence, Equivalence, ...] -> Equivalence<[A, B, ...]> * ``` * diff --git a/packages/effect/src/Function.ts b/packages/effect/src/Function.ts index 45e73264f8b..c95a2d33e1a 100644 --- a/packages/effect/src/Function.ts +++ b/packages/effect/src/Function.ts @@ -442,13 +442,13 @@ export const untupled = , B>(f: (a: A) => B): ( * This is useful in combination with data-last functions as a simulation of * methods: * - * ```ts + * ```ts skip-type-checking * as.map(f).filter(g) * ``` * * becomes: * - * ```ts + * ```ts skip-type-checking * import { pipe, Array } from "effect" * * pipe(as, Array.map(f), Array.filter(g)) @@ -461,7 +461,7 @@ export const untupled = , B>(f: (a: A) => B): ( * passes it as the input to the next function in the pipeline. This enables us * to build complex transformations by chaining multiple functions together. * - * ```ts + * ```ts skip-type-checking * import { pipe } from "effect" * * const result = pipe(input, func1, func2, ..., funcN) diff --git a/packages/effect/src/Pool.ts b/packages/effect/src/Pool.ts index fd705d28c9c..1e0ccf3494e 100644 --- a/packages/effect/src/Pool.ts +++ b/packages/effect/src/Pool.ts @@ -145,7 +145,7 @@ export const make: ( * * By default, the `timeToLiveStrategy` is set to "usage". * - * ```ts + * ```ts skip-type-checking * import { createConnection } from "mysql2"; * import { Duration, Effect, Pool } from "effect" * diff --git a/packages/effect/src/Predicate.ts b/packages/effect/src/Predicate.ts index ba4cc0a78f8..0875d06c595 100644 --- a/packages/effect/src/Predicate.ts +++ b/packages/effect/src/Predicate.ts @@ -765,7 +765,7 @@ export const productMany = ( /** * Similar to `Promise.all` but operates on `Predicate`s. * - * ``` + * ```ts skip-type-checking * [Refinement, Refinement, ...] -> Refinement<[A, C, ...], [B, D, ...]> * [Predicate, Predicate, ...] -> Predicate<[A, B, ...]> * [Refinement, Predicate, ...] -> Refinement<[A, C, ...], [B, C, ...]> @@ -784,7 +784,7 @@ export const tuple: { } = (...elements: ReadonlyArray) => all(elements) as any /** - * ``` + * ```ts skip-type-checking * { ab: Refinement; cd: Refinement, ... } -> Refinement<{ ab: A; cd: C; ... }, { ab: B; cd: D; ... }> * { a: Predicate; b: Predicate, ... } -> Predicate<{ a: A; b: B; ... }> * { ab: Refinement; c: Predicate, ... } -> Refinement<{ ab: A; c: C; ... }, { ab: B; c: С; ... }> diff --git a/packages/effect/src/STM.ts b/packages/effect/src/STM.ts index 67158b486c3..1eb382530c9 100644 --- a/packages/effect/src/STM.ts +++ b/packages/effect/src/STM.ts @@ -1166,7 +1166,7 @@ export const isSuccess: (self: STM) => STM * Iterates with the specified transactional function. The moral equivalent * of: * - * ```ts + * ```ts skip-type-checking * const s = initial * * while (cont(s)) { @@ -1191,7 +1191,7 @@ export const iterate: ( * Loops with the specified transactional function, collecting the results * into a list. The moral equivalent of: * - * ```ts + * ```ts skip-type-checking * const as = [] * let s = initial * diff --git a/packages/effect/src/Schedule.ts b/packages/effect/src/Schedule.ts index f8c4fa4325d..62df9e63284 100644 --- a/packages/effect/src/Schedule.ts +++ b/packages/effect/src/Schedule.ts @@ -48,11 +48,11 @@ export type ScheduleDriverTypeId = typeof ScheduleDriverTypeId * * The `Schedule` type is structured as follows: * - * ```text - * ┌─── The type of output produced by the schedule - * │ ┌─── The type of input consumed by the schedule - * │ │ ┌─── Additional requirements for the schedule - * ▼ ▼ ▼ + * ```ts skip-type-checking + * // ┌─── The type of output produced by the schedule + * // │ ┌─── The type of input consumed by the schedule + * // │ │ ┌─── Additional requirements for the schedule + * // ▼ ▼ ▼ * Schedule * ``` * @@ -1034,7 +1034,7 @@ export const fibonacci: (one: Duration.DurationInput) => Schedule( ) => Sink = internal.foldUntilEffect /** - * Creates a sink that folds elements of type `In` into a structure of type - * `S`, until `max` worth of elements (determined by the `costFn`) have been - * folded. + * Creates a sink that folds elements of type `In` into a structure of type `S`, + * until `max` worth of elements (determined by the `costFn`) have been folded. * - * @note - * Elements that have an individual cost larger than `max` will force the - * sink to cross the `max` cost. See `Sink.foldWeightedDecompose` for a - * variant that can handle these cases. + * **Note** + * + * Elements that have an individual cost larger than `max` will force the sink + * to cross the `max` cost. See `Sink.foldWeightedDecompose` for a variant + * that can handle these cases. * * @since 2.0.0 * @category constructors @@ -813,7 +813,7 @@ export const foldWeighted: ( * The `decompose` function will be used for decomposing elements that cause * an `S` aggregate to cross `max` into smaller elements. For example: * - * ```ts + * ```ts skip-type-checking * pipe( * Stream.make(1, 5, 1), * Stream.transduce( diff --git a/packages/effect/src/Stream.ts b/packages/effect/src/Stream.ts index ac4c66b0bac..1eefc002b27 100644 --- a/packages/effect/src/Stream.ts +++ b/packages/effect/src/Stream.ts @@ -1841,12 +1841,6 @@ export const flattenEffect: { /** * Unwraps `Exit` values that also signify end-of-stream by failing with `None`. * - * For `Exit` values that do not signal end-of-stream, prefer: - * - * ```ts - * stream.mapZIO(ZIO.done(_)) - * ``` - * * @since 2.0.0 * @category sequencing */ @@ -2314,9 +2308,7 @@ export const groupBy: { * stream of words: * * ```ts - * import * as GroupBy from "./GroupBy" - * import * as Stream from "./Stream" - * import { pipe } from "./Function" + * import { pipe, GroupBy, Stream } from "effect" * * pipe( * Stream.fromIterable(["hello", "world", "hi", "holla"]), @@ -4618,8 +4610,7 @@ export const scopedWith: (f: (scope: Scope.Scope) => Effect.Effect=16.17.1'} hasBin: true - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400': - resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400} + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2': + resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2} version: 0.5.2 engines: {node: '>=18.0.0'} hasBin: true @@ -9419,7 +9419,7 @@ snapshots: '@effect/build-utils@0.7.7': {} - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@cef8400(tsx@4.17.0)(typescript@5.7.2)': + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2(tsx@4.17.0)(typescript@5.7.2)': dependencies: '@effect/markdown-toc': 0.1.0 doctrine: 3.0.0 From 4525b9b499a8515110fe00c21aaca691f8d951dd Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Mon, 3 Mar 2025 12:18:41 +0100 Subject: [PATCH 06/16] Update docgen configurations and add missing assert imports --- package.json | 2 +- packages/cli/docgen.json | 20 ++-------- packages/effect/src/Function.ts | 40 ++++++++++---------- packages/platform-node/src/NodeHttpServer.ts | 1 + packages/platform/src/HttpApiBuilder.ts | 2 +- packages/platform/src/UrlParams.ts | 1 + packages/printer/docgen.json | 25 +++--------- packages/printer/src/Doc.ts | 37 ++++++++++++++++++ packages/printer/src/DocTree.ts | 1 + packages/printer/src/Layout.ts | 2 + packages/typeclass/docgen.json | 19 +++------- packages/typeclass/src/data/Boolean.ts | 4 ++ packages/typeclass/src/data/Record.ts | 3 ++ 13 files changed, 86 insertions(+), 71 deletions(-) diff --git a/package.json b/package.json index ad03a224f97..dae656df489 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "check-recursive": "pnpm --recursive exec tsc -b tsconfig.json", "lint": "eslint \"**/{src,test,examples,scripts,dtslint}/**/*.{ts,mjs}\"", "lint-fix": "pnpm lint --fix", - "docgen": "pnpm --recursive --parallel exec docgen && node scripts/docs.mjs", + "docgen": "pnpm --recursive exec docgen && node scripts/docs.mjs", "test-types": "tstyche", "changeset-version": "changeset version && node scripts/version.mjs", "changeset-publish": "pnpm codemod && pnpm build && TEST_DIST= pnpm vitest && changeset publish" diff --git a/packages/cli/docgen.json b/packages/cli/docgen.json index dffc506f60d..19c67e93de3 100644 --- a/packages/cli/docgen.json +++ b/packages/cli/docgen.json @@ -8,26 +8,12 @@ "moduleResolution": "Bundler", "module": "ES2022", "target": "ES2022", - "lib": ["ES2022", "DOM"], + "lib": ["ES2022", "DOM", "DOM.Iterable"], "paths": { "effect": ["../../../effect/src/index.js"], "effect/*": ["../../../effect/src/*.js"], - "@effect/platform": ["../../../platform/src/index.js"], - "@effect/platform/*": ["../../../platform/src/*.js"], - "@effect/platform-node": ["../../../platform-node/src/index.js"], - "@effect/platform-node/*": ["../../../platform-node/src/*.js"], - "@effect/platform-node-shared": [ - "../../../platform-node-shared/src/index.js" - ], - "@effect/platform-node-shared/*": [ - "../../../platform-node-shared/src/*.js" - ], - "@effect/printer": ["../../../printer/src/index.js"], - "@effect/printer/*": ["../../../printer/src/*.js"], - "@effect/printer-ansi": ["../../../printer-ansi/src/index.js"], - "@effect/printer-ansi/*": ["../../../printer-ansi/src/*.js"], - "@effect/typeclass": ["../../../typeclass/src/index.js"], - "@effect/typeclass/*": ["../../../typeclass/src/*.js"] + "@effect/cli": ["../../../cli/src/index.js"], + "@effect/cli/*": ["../../../cli/src/*.js"] } } } diff --git a/packages/effect/src/Function.ts b/packages/effect/src/Function.ts index c95a2d33e1a..7e488a37842 100644 --- a/packages/effect/src/Function.ts +++ b/packages/effect/src/Function.ts @@ -437,23 +437,6 @@ export const untupled = , B>(f: (a: A) => B): ( /** * Pipes the value of an expression into a pipeline of functions. * - * **When to Use** - * - * This is useful in combination with data-last functions as a simulation of - * methods: - * - * ```ts skip-type-checking - * as.map(f).filter(g) - * ``` - * - * becomes: - * - * ```ts skip-type-checking - * import { pipe, Array } from "effect" - * - * pipe(as, Array.map(f), Array.filter(g)) - * ``` - * * **Details** * * The `pipe` function is a utility that allows us to compose functions in a @@ -474,7 +457,7 @@ export const untupled = , B>(f: (a: A) => B): ( * * Here's an illustration of how `pipe` works: * - * ```text + * ``` * ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐ ┌────────┐ * │ input │───►│ func1 │───►│ func2 │───►│ ... │───►│ funcN │───►│ result │ * └───────┘ └───────┘ └───────┘ └───────┘ └───────┘ └────────┘ @@ -483,9 +466,26 @@ export const untupled = , B>(f: (a: A) => B): ( * It's important to note that functions passed to `pipe` must have a **single * argument** because they are only called with a single argument. * - * @example + * **When to Use** + * + * This is useful in combination with data-last functions as a simulation of + * methods: + * + * ```ts skip-type-checking + * as.map(f).filter(g) + * ``` + * + * becomes: + * + * ```ts skip-type-checking + * import { pipe, Array } from "effect" + * + * pipe(as, Array.map(f), Array.filter(g)) + * ``` + * + * **Example** (Chaining Arithmetic Operations) + * * ```ts - * // Example: Chaining Arithmetic Operations * import { pipe } from "effect" * * // Define simple arithmetic operations diff --git a/packages/platform-node/src/NodeHttpServer.ts b/packages/platform-node/src/NodeHttpServer.ts index 1f0a6dc937c..d1767f54208 100644 --- a/packages/platform-node/src/NodeHttpServer.ts +++ b/packages/platform-node/src/NodeHttpServer.ts @@ -92,6 +92,7 @@ export const layerConfig: ( * * @example * ```ts + * import * as assert from "node:assert" * import { HttpClient, HttpRouter, HttpServer } from "@effect/platform" * import { NodeHttpServer } from "@effect/platform-node" * import { Effect } from "effect" diff --git a/packages/platform/src/HttpApiBuilder.ts b/packages/platform/src/HttpApiBuilder.ts index e248cdf0530..b685c1bb58f 100644 --- a/packages/platform/src/HttpApiBuilder.ts +++ b/packages/platform/src/HttpApiBuilder.ts @@ -1021,7 +1021,7 @@ export const securityDecode = * * You can use this api before returning a response from an endpoint handler. * - * ```ts + * ```ts skip-type-checking * handlers.handle( * "authenticate", * (_) => HttpApiBuilder.securitySetCookie(security, "secret123") diff --git a/packages/platform/src/UrlParams.ts b/packages/platform/src/UrlParams.ts index cb245ac3bb2..528f7d81a4a 100644 --- a/packages/platform/src/UrlParams.ts +++ b/packages/platform/src/UrlParams.ts @@ -272,6 +272,7 @@ export const schemaJson = (schema: Schema.Schema, options?: Pa * * @example * ```ts + * import * as assert from "node:assert" * import { Effect, Schema } from "effect" * import { UrlParams } from "@effect/platform" * diff --git a/packages/printer/docgen.json b/packages/printer/docgen.json index aae10eb9d6e..1834654487a 100644 --- a/packages/printer/docgen.json +++ b/packages/printer/docgen.json @@ -1,8 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", - "exclude": [ - "src/internal/**/*.ts" - ], + "exclude": ["src/internal/**/*.ts"], "examplesCompilerOptions": { "noEmit": true, "strict": true, @@ -10,23 +8,12 @@ "moduleResolution": "Bundler", "module": "ES2022", "target": "ES2022", - "lib": [ - "ES2022", - "DOM" - ], + "lib": ["ES2022", "DOM", "DOM.Iterable"], "paths": { - "effect": [ - "../../../effect/src/index.js" - ], - "effect/*": [ - "../../../effect/src/*.js" - ], - "@effect/typeclass": [ - "../../../typeclass/src/index.js" - ], - "@effect/typeclass/*": [ - "../../../typeclass/src/*.js" - ] + "effect": ["../../../effect/src/index.js"], + "effect/*": ["../../../effect/src/*.js"], + "@effect/printer": ["../../../printer/src/index.js"], + "@effect/printer/*": ["../../../printer/src/*.js"] } } } diff --git a/packages/printer/src/Doc.ts b/packages/printer/src/Doc.ts index 4ab88fa59b8..a285424ca42 100644 --- a/packages/printer/src/Doc.ts +++ b/packages/printer/src/Doc.ts @@ -473,6 +473,7 @@ export const string: (str: string) => Doc = internal.string * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -516,6 +517,7 @@ export const fail: Doc = internal.fail * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -549,6 +551,7 @@ export const line: Doc = internal.line * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -582,6 +585,7 @@ export const lineBreak: Doc = internal.lineBreak * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -626,6 +630,7 @@ export const softLine: Doc = internal.softLine * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -669,6 +674,7 @@ export const softLineBreak: Doc = internal.softLineBreak * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -871,6 +877,7 @@ export const cat: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -910,6 +917,7 @@ export const cats: (docs: Iterable>) => Doc = internal.cats * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -942,6 +950,7 @@ export const catWithLine: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -979,6 +988,7 @@ export const catWithLineBreak: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -1019,6 +1029,7 @@ export const catWithSoftLine: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -1059,6 +1070,7 @@ export const catWithSoftLineBreak: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * @@ -1087,6 +1099,7 @@ export const catWithSpace: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * @@ -1118,6 +1131,7 @@ export const concatWith: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -1144,6 +1158,7 @@ export const vcat: (docs: Iterable>) => Doc = internal.vcat * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -1187,6 +1202,7 @@ export const fillCat: (docs: Iterable>) => Doc = internal.fillCat * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * * const doc: Doc.Doc = Doc.hsep(Doc.words("lorem ipsum dolor sit amet")) @@ -1226,6 +1242,7 @@ export const hsep: (docs: Iterable>) => Doc = internal.hsep * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -1290,6 +1307,7 @@ export const fillSep: (docs: Iterable>) => Doc = internal.fillSep * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -1339,6 +1357,7 @@ export const seps: (docs: Iterable>) => Doc = internal.seps * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -1435,6 +1454,7 @@ export const group: (self: Doc) => Doc = internal.group * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -1477,6 +1497,7 @@ export const column: (react: (position: number) => Doc) => Doc = intern * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -1508,6 +1529,7 @@ export const nesting: (react: (level: number) => Doc) => Doc = internal * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -1552,6 +1574,7 @@ export const width: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -1612,6 +1635,7 @@ export const pageWidth: (react: (pageWidth: PageWidth) => Doc) => Doc = * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -1648,6 +1672,7 @@ export const nest: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -1700,6 +1725,7 @@ export const align: (self: Doc) => Doc = internal.align * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -1736,6 +1762,7 @@ export const hang: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -1778,6 +1805,7 @@ export const indent: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -1833,6 +1861,7 @@ export const encloseSep: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * * const doc = Doc.list( @@ -1858,6 +1887,7 @@ export const list: (docs: Iterable>) => Doc = internal.list * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * * const doc = Doc.tupled( @@ -1889,6 +1919,7 @@ export const tupled: (docs: Iterable>) => Doc = internal.tupled * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -1939,6 +1970,7 @@ export const fill: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -2200,6 +2232,7 @@ export const Invariant: invariant.Invariant = internal.Invariant * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * @@ -2276,6 +2309,7 @@ export const curlyBraced: (self: Doc) => Doc = internal.curlyBraced * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * * const doc = Doc.squareBracketed(Doc.doubleQuoted(Doc.spaces(5))) @@ -2303,6 +2337,7 @@ export const textSpaces: (n: number) => string = internal.textSpaces * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * * const doc = Doc.tupled(Doc.words("lorem ipsum dolor")) @@ -2326,6 +2361,7 @@ export const words: (s: string, char?: string) => ReadonlyArray> = in * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as String from "effect/String" * @@ -2362,6 +2398,7 @@ export const reflow: (s: string, char?: string) => Doc = internal.reflow * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" diff --git a/packages/printer/src/DocTree.ts b/packages/printer/src/DocTree.ts index 86a33a4e9e9..7766e4fe0f1 100644 --- a/packages/printer/src/DocTree.ts +++ b/packages/printer/src/DocTree.ts @@ -297,6 +297,7 @@ export const foldMap: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import * as DocTree from "@effect/printer/DocTree" * import * as Layout from "@effect/printer/Layout" diff --git a/packages/printer/src/Layout.ts b/packages/printer/src/Layout.ts index 088a03d039b..adab24c6a54 100644 --- a/packages/printer/src/Layout.ts +++ b/packages/printer/src/Layout.ts @@ -93,6 +93,7 @@ export const wadlerLeijen: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import { pipe } from "effect/Function" * import * as String from "effect/String" @@ -162,6 +163,7 @@ export const pretty: { * * @example * ```ts + * import * as assert from "node:assert" * import * as Doc from "@effect/printer/Doc" * import type * as DocStream from "@effect/printer/DocStream" * import * as Layout from "@effect/printer/Layout" diff --git a/packages/typeclass/docgen.json b/packages/typeclass/docgen.json index af59e3a42fe..05c4022684c 100644 --- a/packages/typeclass/docgen.json +++ b/packages/typeclass/docgen.json @@ -1,8 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", - "exclude": [ - "src/internal/**/*.ts" - ], + "exclude": ["src/internal/**/*.ts"], "examplesCompilerOptions": { "noEmit": true, "strict": true, @@ -10,17 +8,12 @@ "moduleResolution": "Bundler", "module": "ES2022", "target": "ES2022", - "lib": [ - "ES2022", - "DOM" - ], + "lib": ["ES2022", "DOM", "DOM.Iterable"], "paths": { - "effect": [ - "../../../effect/src/index.js" - ], - "effect/*": [ - "../../../effect/src/*.js" - ] + "effect": ["../../../effect/src/index.js"], + "effect/*": ["../../../effect/src/*.js"], + "@effect/typeclass": ["../../../typeclass/src/index.js"], + "@effect/typeclass/*": ["../../../typeclass/src/*.js"] } } } diff --git a/packages/typeclass/src/data/Boolean.ts b/packages/typeclass/src/data/Boolean.ts index f7b508428c2..f8ba51eb0d1 100644 --- a/packages/typeclass/src/data/Boolean.ts +++ b/packages/typeclass/src/data/Boolean.ts @@ -9,6 +9,7 @@ import * as semigroup from "../Semigroup.js" * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupEvery } from "@effect/typeclass/data/Boolean" * * assert.deepStrictEqual(SemigroupEvery.combine(true, true), true) @@ -40,6 +41,7 @@ export const SemigroupEvery: semigroup.Semigroup = semigroup.make( * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupSome } from "@effect/typeclass/data/Boolean" * * assert.deepStrictEqual(SemigroupSome.combine(true, true), true) @@ -71,6 +73,7 @@ export const SemigroupSome: semigroup.Semigroup = semigroup.make( * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupXor } from "@effect/typeclass/data/Boolean" * * assert.deepStrictEqual(SemigroupXor.combine(true, true), false) @@ -89,6 +92,7 @@ export const SemigroupXor: semigroup.Semigroup = semigroup.make((self, * * @example * ```ts + * import * as assert from "node:assert" * import { SemigroupEqv } from "@effect/typeclass/data/Boolean" * * assert.deepStrictEqual(SemigroupEqv.combine(true, true), true) diff --git a/packages/typeclass/src/data/Record.ts b/packages/typeclass/src/data/Record.ts index 491a99a3438..3b4d1dd4386 100644 --- a/packages/typeclass/src/data/Record.ts +++ b/packages/typeclass/src/data/Record.ts @@ -215,6 +215,7 @@ export const TraversableFilterable = getTraversableFilterable() * * @example * ```ts + * import * as assert from "node:assert" * import * as NumberInstances from "@effect/typeclass/data/Number" * import { getSemigroupUnion } from "@effect/typeclass/data/Record" * @@ -239,6 +240,7 @@ export const getSemigroupUnion: ( * * @example * ```ts + * import * as assert from "node:assert" * import * as NumberInstances from "@effect/typeclass/data/Number" * import { getMonoidUnion } from "@effect/typeclass/data/Record" * @@ -264,6 +266,7 @@ export const getMonoidUnion: ( * * @example * ```ts + * import * as assert from "node:assert" * import * as NumberInstances from "@effect/typeclass/data/Number" * import { getSemigroupIntersection } from "@effect/typeclass/data/Record" * From fa9e2ea87216a93a82b4f59a897438f4d67705e1 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Mon, 3 Mar 2025 16:25:22 +0100 Subject: [PATCH 07/16] update docgen --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index dae656df489..95031956777 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@changesets/cli": "^2.27.7", "@edge-runtime/vm": "^4.0.0", "@effect/build-utils": "^0.7.7", - "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2", + "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c", "@effect/eslint-plugin": "^0.2.0", "@effect/language-service": "^0.1.0", "@effect/vitest": "workspace:^", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fce1682c1e0..cf88b160aca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,8 +53,8 @@ importers: specifier: ^0.7.7 version: 0.7.7 '@effect/docgen': - specifier: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2 - version: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2(tsx@4.17.0)(typescript@5.7.2) + specifier: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c + version: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c(tsx@4.17.0)(typescript@5.7.2) '@effect/eslint-plugin': specifier: ^0.2.0 version: 0.2.0 @@ -1969,8 +1969,8 @@ packages: engines: {node: '>=16.17.1'} hasBin: true - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2': - resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2} + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c': + resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c} version: 0.5.2 engines: {node: '>=18.0.0'} hasBin: true @@ -9419,7 +9419,7 @@ snapshots: '@effect/build-utils@0.7.7': {} - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@c73aeb2(tsx@4.17.0)(typescript@5.7.2)': + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c(tsx@4.17.0)(typescript@5.7.2)': dependencies: '@effect/markdown-toc': 0.1.0 doctrine: 3.0.0 From 1463a0f5114fe4b4caa9882eeb4558bed265f276 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Thu, 6 Mar 2025 16:23:23 +0100 Subject: [PATCH 08/16] Array --- packages/effect/src/Array.ts | 1017 ++++++++++++++++------------------ 1 file changed, 479 insertions(+), 538 deletions(-) diff --git a/packages/effect/src/Array.ts b/packages/effect/src/Array.ts index 90afb09844a..7d6107f7436 100644 --- a/packages/effect/src/Array.ts +++ b/packages/effect/src/Array.ts @@ -46,13 +46,13 @@ export type NonEmptyArray = [A, ...Array] /** * Builds a `NonEmptyArray` from an non-empty collection of elements. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.make(1, 2, 3) - * assert.deepStrictEqual(result, [1, 2, 3]) + * console.log(result) // [1, 2, 3] * ``` * * @category constructors @@ -65,13 +65,13 @@ export const make = >( /** * Creates a new `Array` of the specified length. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.allocate(3) - * assert.deepStrictEqual(result.length, 3) + * console.log(result) // [ <3 empty items> ] * ``` * * @category constructors @@ -84,12 +84,13 @@ export const allocate = (n: number): Array => new Arra * * **Note**. `n` is normalized to an integer >= 1. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { makeBy } from "effect/Array" * - * assert.deepStrictEqual(makeBy(5, n => n * 2), [0, 2, 4, 6, 8]) + * const result = makeBy(5, n => n * 2) + * console.log(result) // [0, 2, 4, 6, 8] * ``` * * @category constructors @@ -110,12 +111,13 @@ export const makeBy: { /** * Return a `NonEmptyArray` containing a range of integers, including both endpoints. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { range } from "effect/Array" * - * assert.deepStrictEqual(range(1, 3), [1, 2, 3]) + * const result = range(1, 3) + * console.log(result) // [1, 2, 3] * ``` * * @category constructors @@ -129,12 +131,13 @@ export const range = (start: number, end: number): NonEmptyArray => * * **Note**. `n` is normalized to an integer >= 1. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * assert.deepStrictEqual(Array.replicate("a", 3), ["a", "a", "a"]) + * const result = Array.replicate("a", 3) + * console.log(result) // ["a", "a", "a"] * ``` * * @category constructors @@ -150,14 +153,13 @@ export const replicate: { * If the input is already an array, it returns the input as-is. * Otherwise, it converts the iterable collection to an array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const set = new Set([1, 2, 3]) - * const result = Array.fromIterable(set) - * assert.deepStrictEqual(result, [1, 2, 3]) + * const result = Array.fromIterable(new Set([1, 2, 3])) + * console.log(result) // [1, 2, 3] * ``` * * @category constructors @@ -169,14 +171,14 @@ export const fromIterable = (collection: Iterable): Array => /** * Creates a new `Array` from a value that might not be an iterable. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * assert.deepStrictEqual(Array.ensure("a"), ["a"]) - * assert.deepStrictEqual(Array.ensure(["a"]), ["a"]) - * assert.deepStrictEqual(Array.ensure(["a", "b", "c"]), ["a", "b", "c"]) + * console.log(Array.ensure("a")) // ["a"] + * console.log(Array.ensure(["a"])) // ["a"] + * console.log(Array.ensure(["a", "b", "c"])) // ["a", "b", "c"] * ``` * * @category constructors @@ -187,13 +189,13 @@ export const ensure = (self: ReadonlyArray | A): Array => Array.isArray /** * Takes a record and returns an array of tuples containing its keys and values. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const x = { a: 1, b: 2, c: 3 } - * assert.deepStrictEqual(Array.fromRecord(x), [["a", 1], ["b", 2], ["c", 3]]) + * const result = Array.fromRecord({ a: 1, b: 2, c: 3 }) + * console.log(result) // [["a", 1], ["b", 2], ["c", 3]] * ``` * * @category conversions @@ -204,13 +206,13 @@ export const fromRecord: (self: Readonly>) => /** * Converts an `Option` to an array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array, Option } from "effect" * - * assert.deepStrictEqual(Array.fromOption(Option.some(1)), [1]) - * assert.deepStrictEqual(Array.fromOption(Option.none()), []) + * console.log(Array.fromOption(Option.some(1))) // [1] + * console.log(Array.fromOption(Option.none())) // [] * ``` * * @category conversions @@ -221,17 +223,17 @@ export const fromOption: (self: Option) => Array = O.toArray /** * Matches the elements of an array, applying functions to cases of empty and non-empty arrays. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const match = Array.match({ * onEmpty: () => "empty", * onNonEmpty: ([head, ...tail]) => `head: ${head}, tail: ${tail.length}` * }) - * assert.deepStrictEqual(match([]), "empty") - * assert.deepStrictEqual(match([1, 2, 3]), "head: 1, tail: 2") + * console.log(match([])) // "empty" + * console.log(match([1, 2, 3])) // "head: 1, tail: 2" * ``` * * @category pattern matching @@ -262,17 +264,17 @@ export const match: { /** * Matches the elements of an array from the left, applying functions to cases of empty and non-empty arrays. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const matchLeft = Array.matchLeft({ * onEmpty: () => "empty", * onNonEmpty: (head, tail) => `head: ${head}, tail: ${tail.length}` * }) - * assert.deepStrictEqual(matchLeft([]), "empty") - * assert.deepStrictEqual(matchLeft([1, 2, 3]), "head: 1, tail: 2") + * console.log(matchLeft([])) // "empty" + * console.log(matchLeft([1, 2, 3])) // "head: 1, tail: 2" * ``` * * @category pattern matching @@ -303,17 +305,17 @@ export const matchLeft: { /** * Matches the elements of an array from the right, applying functions to cases of empty and non-empty arrays. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const matchRight = Array.matchRight({ * onEmpty: () => "empty", * onNonEmpty: (init, last) => `init: ${init.length}, last: ${last}` * }) - * assert.deepStrictEqual(matchRight([]), "empty") - * assert.deepStrictEqual(matchRight([1, 2, 3]), "init: 2, last: 3") + * console.log(matchRight([])) // "empty" + * console.log(matchRight([1, 2, 3])) // "init: 2, last: 3" * ``` * * @category pattern matching @@ -347,14 +349,13 @@ export const matchRight: { /** * Prepend an element to the front of an `Iterable`, creating a new `NonEmptyArray`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const original = [2, 3, 4]; - * const result = Array.prepend(original, 1); - * assert.deepStrictEqual(result, [1, 2, 3, 4]); + * const result = Array.prepend([2, 3, 4], 1) + * console.log(result) // [1, 2, 3, 4] * ``` * * @category concatenating @@ -369,15 +370,13 @@ export const prepend: { * Prepends the specified prefix array (or iterable) to the beginning of the specified array (or iterable). * If either array is non-empty, the result is also a non-empty array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const prefix = [0, 1]; - * const array = [2, 3]; - * const result = Array.prependAll(array, prefix); - * assert.deepStrictEqual(result, [0, 1, 2, 3]); + * const result = Array.prependAll([2, 3], [0, 1]) + * console.log(result) // [0, 1, 2, 3] * ``` * * @category concatenating @@ -398,14 +397,13 @@ export const prependAll: { /** * Append an element to the end of an `Iterable`, creating a new `NonEmptyArray`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const original = [1, 2, 3]; - * const result = Array.append(original, 4); - * assert.deepStrictEqual(result, [1, 2, 3, 4]); + * const result = Array.append([1, 2, 3], 4); + * console.log(result) // [1, 2, 3, 4] * ``` * * @category concatenating @@ -440,14 +438,13 @@ export const appendAll: { * each intermediate result in an array. Useful for tracking the progression of * a value through a series of transformations. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect"; * - * const numbers = [1, 2, 3, 4] - * const result = Array.scan(numbers, 0, (acc, value) => acc + value) - * assert.deepStrictEqual(result, [0, 1, 3, 6, 10]) + * const result = Array.scan([1, 2, 3, 4], 0, (acc, value) => acc + value) + * console.log(result) // [0, 1, 3, 6, 10] * * // Explanation: * // This function starts with the initial value (0 in this case) @@ -477,14 +474,13 @@ export const scan: { * each intermediate result in an array. Useful for tracking the progression of * a value through a series of transformations. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect"; * - * const numbers = [1, 2, 3, 4] - * const result = Array.scanRight(numbers, 0, (acc, value) => acc + value) - * assert.deepStrictEqual(result, [10, 9, 7, 4, 0]) + * const result = Array.scanRight([1, 2, 3, 4], 0, (acc, value) => acc + value) + * console.log(result) // [10, 9, 7, 4, 0] * ``` * * @category folding @@ -506,13 +502,13 @@ export const scanRight: { /** * Determine if `unknown` is an Array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { isArray } from "effect/Array" + * import { Array } from "effect" * - * assert.deepStrictEqual(isArray(null), false); - * assert.deepStrictEqual(isArray([1, 2, 3]), true); + * console.log(Array.isArray(null)) // false + * console.log(Array.isArray([1, 2, 3])) // true * ``` * * @category guards @@ -526,13 +522,13 @@ export const isArray: { /** * Determine if an `Array` is empty narrowing down the type to `[]`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { isEmptyArray } from "effect/Array" + * import { Array } from "effect" * - * assert.deepStrictEqual(isEmptyArray([]), true); - * assert.deepStrictEqual(isEmptyArray([1, 2, 3]), false); + * console.log(Array.isEmptyArray([])) // true + * console.log(Array.isEmptyArray([1, 2, 3])) // false * ``` * * @category guards @@ -543,13 +539,13 @@ export const isEmptyArray = (self: Array): self is [] => self.length === 0 /** * Determine if a `ReadonlyArray` is empty narrowing down the type to `readonly []`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { isEmptyReadonlyArray } from "effect/Array" + * import { Array } from "effect" * - * assert.deepStrictEqual(isEmptyReadonlyArray([]), true); - * assert.deepStrictEqual(isEmptyReadonlyArray([1, 2, 3]), false); + * console.log(Array.isEmptyReadonlyArray([])) // true + * console.log(Array.isEmptyReadonlyArray([1, 2, 3])) // false * ``` * * @category guards @@ -562,13 +558,13 @@ export const isEmptyReadonlyArray: (self: ReadonlyArray) => self is readon * * An `Array` is considered to be a `NonEmptyArray` if it contains at least one element. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { isNonEmptyArray } from "effect/Array" + * import { Array } from "effect" * - * assert.deepStrictEqual(isNonEmptyArray([]), false); - * assert.deepStrictEqual(isNonEmptyArray([1, 2, 3]), true); + * console.log(Array.isNonEmptyArray([])) // false + * console.log(Array.isNonEmptyArray([1, 2, 3])) // true * ``` * * @category guards @@ -581,13 +577,13 @@ export const isNonEmptyArray: (self: Array) => self is NonEmptyArray = * * A `ReadonlyArray` is considered to be a `NonEmptyReadonlyArray` if it contains at least one element. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { isNonEmptyReadonlyArray } from "effect/Array" + * import { Array } from "effect" * - * assert.deepStrictEqual(isNonEmptyReadonlyArray([]), false); - * assert.deepStrictEqual(isNonEmptyReadonlyArray([1, 2, 3]), true); + * console.log(Array.isNonEmptyReadonlyArray([])) // false + * console.log(Array.isNonEmptyReadonlyArray([1, 2, 3])) // true * ``` * * @category guards @@ -642,13 +638,13 @@ export const unsafeGet: { /** * Return a tuple containing the first element, and a new `Array` of the remaining elements, if any. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect"; * * const result = Array.unprepend([1, 2, 3, 4]) - * assert.deepStrictEqual(result, [1, [2, 3, 4]]) + * console.log(result) // [1, [2, 3, 4]] * ``` * * @category splitting @@ -661,13 +657,13 @@ export const unprepend = ( /** * Return a tuple containing a copy of the `NonEmptyReadonlyArray` without its last element, and that last element. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect"; * * const result = Array.unappend([1, 2, 3, 4]) - * assert.deepStrictEqual(result, [[1, 2, 3], 4]) + * console.log(result) // [[1, 2, 3], 4] * ``` * * @category splitting @@ -688,13 +684,13 @@ export const head: (self: ReadonlyArray) => Option = get(0) /** * Get the first element of a non empty array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.headNonEmpty([1, 2, 3, 4]) - * assert.deepStrictEqual(result, 1) + * console.log(result) // 1 * ``` * * @category getters @@ -714,13 +710,13 @@ export const last = (self: ReadonlyArray): Option => /** * Get the last element of a non empty array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.lastNonEmpty([1, 2, 3, 4]) - * assert.deepStrictEqual(result, 4) + * console.log(result) // 4 * ``` * * @category getters @@ -742,13 +738,13 @@ export const tail = (self: Iterable): Option> => { /** * Get all but the first element of a `NonEmptyReadonlyArray`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.tailNonEmpty([1, 2, 3, 4]) - * assert.deepStrictEqual(result, [2, 3, 4]) + * console.log(result) // [2, 3, 4] * ``` * * @category getters @@ -770,13 +766,13 @@ export const init = (self: Iterable): Option> => { /** * Get all but the last element of a non empty array, creating a new array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.initNonEmpty([1, 2, 3, 4]) - * assert.deepStrictEqual(result, [1, 2, 3]) + * console.log(result) // [1, 2, 3] * ``` * * @category getters @@ -789,14 +785,13 @@ export const initNonEmpty = (self: NonEmptyReadonlyArray): Array => sel * * **Note**. `n` is normalized to a non negative integer. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.take(numbers, 3) - * assert.deepStrictEqual(result, [1, 2, 3]) + * const result = Array.take([1, 2, 3, 4, 5], 3) + * console.log(result) // [1, 2, 3] * ``` * * @category getters @@ -815,14 +810,13 @@ export const take: { * * **Note**. `n` is normalized to a non negative integer. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.takeRight(numbers, 3) - * assert.deepStrictEqual(result, [3, 4, 5]) + * const result = Array.takeRight([1, 2, 3, 4, 5], 3) + * console.log(result) // [3, 4, 5] * ``` * * @category getters @@ -840,14 +834,13 @@ export const takeRight: { /** * Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 3, 2, 4, 1, 2] - * const result = Array.takeWhile(numbers, x => x < 4) - * assert.deepStrictEqual(result, [1, 3, 2]) + * const result = Array.takeWhile([1, 3, 2, 4, 1, 2], x => x < 4) + * console.log(result) // [1, 3, 2] * * // Explanation: * // - The function starts with the first element (`1`), which is less than `4`, so it adds `1` to the result. @@ -918,14 +911,13 @@ export const span: { * * **Note**. `n` is normalized to a non negative integer. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.drop(numbers, 2) - * assert.deepStrictEqual(result, [3, 4, 5]) + * const result = Array.drop([1, 2, 3, 4, 5], 2) + * console.log(result) // [3, 4, 5] * ``` * * @category getters @@ -944,14 +936,13 @@ export const drop: { * * **Note**. `n` is normalized to a non negative integer. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.dropRight(numbers, 2) - * assert.deepStrictEqual(result, [1, 2, 3]) + * const result = Array.dropRight([1, 2, 3, 4, 5], 2) + * console.log(result) // [1, 2, 3] * ``` * * @category getters @@ -968,14 +959,13 @@ export const dropRight: { /** * Remove the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.dropWhile(numbers, x => x < 4) - * assert.deepStrictEqual(result, [4, 5]) + * const result = Array.dropWhile([1, 2, 3, 4, 5], x => x < 4) + * console.log(result) // [4, 5] * ``` * * @category getters @@ -993,14 +983,13 @@ export const dropWhile: { /** * Return the first index for which a predicate holds. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Option } from "effect" + * import { Array } from "effect" * - * const numbers = [5, 3, 8, 9] - * const result = Array.findFirstIndex(numbers, x => x > 5) - * assert.deepStrictEqual(result, Option.some(2)) + * const result = Array.findFirstIndex([5, 3, 8, 9], x => x > 5) + * console.log(result) // Option.some(2) * ``` * * @category elements @@ -1023,14 +1012,13 @@ export const findFirstIndex: { /** * Return the last index for which a predicate holds. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Option } from "effect" + * import { Array } from "effect" * - * const numbers = [1, 3, 8, 9] - * const result = Array.findLastIndex(numbers, x => x < 5) - * assert.deepStrictEqual(result, Option.some(1)) + * const result = Array.findLastIndex([1, 3, 8, 9], x => x < 5) + * console.log(result) // Option.some(1) * ``` * * @category elements @@ -1053,14 +1041,13 @@ export const findLastIndex: { * Returns the first element that satisfies the specified * predicate, or `None` if no such element exists. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Option } from "effect" + * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.findFirst(numbers, x => x > 3) - * assert.deepStrictEqual(result, Option.some(4)) + * const result = Array.findFirst([1, 2, 3, 4, 5], x => x > 3) + * console.log(result) // Option.some(4) * ``` * * @category elements @@ -1079,14 +1066,13 @@ export const findFirst: { * Finds the last element in an iterable collection that satisfies the given predicate or refinement. * Returns an `Option` containing the found element, or `Option.none` if no element matches. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Option } from "effect" + * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.findLast(numbers, n => n % 2 === 0) - * assert.deepStrictEqual(result, Option.some(4)) + * const result = Array.findLast([1, 2, 3, 4, 5], n => n % 2 === 0) + * console.log(result) // Option.some(4) * ``` * * @category elements @@ -1124,14 +1110,13 @@ export const findLast: { * Insert an element at the specified index, creating a new `NonEmptyArray`, * or return `None` if the index is out of bounds. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Option } from "effect" + * import { Array } from "effect" * - * const letters = ['a', 'b', 'c', 'e'] - * const result = Array.insertAt(letters, 3, 'd') - * assert.deepStrictEqual(result, Option.some(['a', 'b', 'c', 'd', 'e'])) + * const result = Array.insertAt(['a', 'b', 'c', 'e'], 3, 'd') + * console.log(result) // Option.some(['a', 'b', 'c', 'd', 'e']) * ``` * * @since 2.0.0 @@ -1153,14 +1138,13 @@ export const insertAt: { * Change the element at the specified index, creating a new `Array`, * or return a copy of the input if the index is out of bounds. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const letters = ['a', 'b', 'c', 'd'] - * const result = Array.replace(letters, 1, 'z') - * assert.deepStrictEqual(result, ['a', 'z', 'c', 'd']) + * const result = Array.replace(['a', 'b', 'c', 'd'], 1, 'z') + * console.log(result) // ['a', 'z', 'c', 'd'] * ``` * * @since 2.0.0 @@ -1182,14 +1166,13 @@ export const replace: { /** * Replaces an element in an array with the given value, returning an option of the updated array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Option } from "effect" + * import { Array } from "effect" * - * const numbers = [1, 2, 3] - * const result = Array.replaceOption(numbers, 1, 4) - * assert.deepStrictEqual(result, Option.some([1, 4, 3])) + * const result = Array.replaceOption([1, 2, 3], 1, 4) + * console.log(result) // Option.some([1, 4, 3]) * ``` * * @since 2.0.0 @@ -1213,14 +1196,13 @@ export const replaceOption: { * Apply a function to the element at the specified index, creating a new `Array`, * or return a copy of the input if the index is out of bounds. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4] - * const result = Array.modify(numbers, 2, (n) => n * 2) - * assert.deepStrictEqual(result, [1, 2, 6, 4]) + * const result = Array.modify([1, 2, 3, 4], 2, (n) => n * 2) + * console.log(result) // [1, 2, 6, 4] * ``` * * @since 2.0.0 @@ -1245,17 +1227,17 @@ export const modify: { * Apply a function to the element at the specified index, creating a new `Array`, * or return `None` if the index is out of bounds. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Option } from "effect" + * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4] - * const result = Array.modifyOption(numbers, 2, (n) => n * 2) - * assert.deepStrictEqual(result, Option.some([1, 2, 6, 4])) + * const input = [1, 2, 3, 4] + * const result = Array.modifyOption(input, 2, (n) => n * 2) + * console.log(result) // Option.some([1, 2, 6, 4]) * - * const outOfBoundsResult = Array.modifyOption(numbers, 5, (n) => n * 2) - * assert.deepStrictEqual(outOfBoundsResult, Option.none()) + * const outOfBoundsResult = Array.modifyOption(input, 5, (n) => n * 2) + * console.log(outOfBoundsResult) // Option.none() * ``` * * @since 2.0.0 @@ -1285,17 +1267,17 @@ export const modifyOption: { * Delete the element at the specified index, creating a new `Array`, * or return a copy of the input if the index is out of bounds. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4] - * const result = Array.remove(numbers, 2) - * assert.deepStrictEqual(result, [1, 2, 4]) + * const input = [1, 2, 3, 4] + * const result = Array.remove(input, 2) + * console.log(result) // [1, 2, 4] * - * const outOfBoundsResult = Array.remove(numbers, 5) - * assert.deepStrictEqual(outOfBoundsResult, [1, 2, 3, 4]) + * const outOfBoundsResult = Array.remove(input, 5) + * console.log(outOfBoundsResult) // [1, 2, 3, 4] * ``` * * @since 2.0.0 @@ -1315,14 +1297,13 @@ export const remove: { /** * Reverse an `Iterable`, creating a new `Array`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4] - * const result = Array.reverse(numbers) - * assert.deepStrictEqual(result, [4, 3, 2, 1]) + * const result = Array.reverse([1, 2, 3, 4]) + * console.log(result) // [4, 3, 2, 1] * ``` * * @category elements @@ -1357,14 +1338,13 @@ export const sort: { * function transforms the elements into a value that can be compared, and the * order defines how those values should be sorted. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array, Order } from "effect" * - * const strings = ["aaa", "b", "cc"] - * const result = Array.sortWith(strings, (s) => s.length, Order.number) - * assert.deepStrictEqual(result, ["b", "cc", "aaa"]) + * const result = Array.sortWith(["aaa", "b", "cc"], (s) => s.length, Order.number) + * console.log(result) // ["b", "cc", "aaa"] * * // Explanation: * // The array of strings is sorted based on their lengths. The mapping function `(s) => s.length` @@ -1393,10 +1373,10 @@ export const sortWith: { * orders. The elements are compared using the first order in `orders`, then the * second order if the first comparison is equal, and so on. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Order } from "effect" + * import { Array, Order, pipe } from "effect" * * const users = [ * { name: "Alice", age: 30 }, @@ -1404,16 +1384,20 @@ export const sortWith: { * { name: "Charlie", age: 30 } * ] * - * const result = Array.sortBy( - * Order.mapInput(Order.number, (user: (typeof users)[number]) => user.age), - * Order.mapInput(Order.string, (user: (typeof users)[number]) => user.name) - * )(users) + * const result = pipe( + * users, + * Array.sortBy( + * Order.mapInput(Order.number, (user: (typeof users)[number]) => user.age), + * Order.mapInput(Order.string, (user: (typeof users)[number]) => user.name) + * ) + * ) * - * assert.deepStrictEqual(result, [ - * { name: "Bob", age: 25 }, - * { name: "Alice", age: 30 }, - * { name: "Charlie", age: 30 } - * ]) + * console.log(result) + * // [ + * // { name: "Bob", age: 25 }, + * // { name: "Alice", age: 30 }, + * // { name: "Charlie", age: 30 } + * // ] * * // Explanation: * // The array of users is sorted first by age in ascending order. When ages are equal, @@ -1443,15 +1427,13 @@ export const sortBy = >( * If one input `Iterable` is short, excess elements of the * longer `Iterable` are discarded. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const array1 = [1, 2, 3] - * const array2 = ['a', 'b'] - * const result = Array.zip(array1, array2) - * assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']]) + * const result = Array.zip([1, 2, 3], ['a', 'b']) + * console.log(result) // [[1, 'a'], [2, 'b']] * ``` * * @category zipping @@ -1471,15 +1453,13 @@ export const zip: { * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one * input `Iterable` is short, excess elements of the longer `Iterable` are discarded. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const array1 = [1, 2, 3] - * const array2 = [4, 5, 6] - * const result = Array.zipWith(array1, array2, (a, b) => a + b) - * assert.deepStrictEqual(result, [5, 7, 9]) + * const result = Array.zipWith([1, 2, 3], [4, 5, 6], (a, b) => a + b) + * console.log(result) // [5, 7, 9] * ``` * * @category zipping @@ -1507,13 +1487,13 @@ export const zipWith: { /** * This function is the inverse of `zip`. Takes an `Iterable` of pairs and return two corresponding `Array`s. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.unzip([[1, "a"], [2, "b"], [3, "c"]]) - * assert.deepStrictEqual(result, [[1, 2, 3], ['a', 'b', 'c']]) + * console.log(result) // [[1, 2, 3], ['a', 'b', 'c']] * ``` * * @since 2.0.0 @@ -1540,14 +1520,13 @@ export const unzip: >( * Places an element in between members of an `Iterable`. * If the input is a non-empty array, the result is also a non-empty array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3] - * const result = Array.intersperse(numbers, 0) - * assert.deepStrictEqual(result, [1, 0, 2, 0, 3]) + * const result = Array.intersperse([1, 2, 3], 0) + * console.log(result) // [1, 0, 2, 0, 3] * ``` * * @since 2.0.0 @@ -1577,13 +1556,13 @@ export const intersperse: { /** * Apply a function to the head, creating a new `NonEmptyReadonlyArray`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.modifyNonEmptyHead([1, 2, 3], n => n * 10) - * assert.deepStrictEqual(result, [10, 2, 3]) + * console.log(result) // [10, 2, 3] * ``` * * @since 2.0.0 @@ -1602,13 +1581,13 @@ export const modifyNonEmptyHead: { /** * Change the head, creating a new `NonEmptyReadonlyArray`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.setNonEmptyHead([1, 2, 3], 10) - * assert.deepStrictEqual(result, [10, 2, 3]) + * console.log(result) // [10, 2, 3] * ``` * * @since 2.0.0 @@ -1624,13 +1603,13 @@ export const setNonEmptyHead: { /** * Apply a function to the last element, creating a new `NonEmptyReadonlyArray`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.modifyNonEmptyLast([1, 2, 3], n => n * 2) - * assert.deepStrictEqual(result, [1, 2, 6]) + * console.log(result) // [1, 2, 6] * ``` * * @since 2.0.0 @@ -1647,13 +1626,13 @@ export const modifyNonEmptyLast: { /** * Change the last element, creating a new `NonEmptyReadonlyArray`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.setNonEmptyLast([1, 2, 3], 4) - * assert.deepStrictEqual(result, [1, 2, 4]) + * console.log(result) // [1, 2, 4] * ``` * * @since 2.0.0 @@ -1670,14 +1649,13 @@ export const setNonEmptyLast: { * Rotate an `Iterable` by `n` steps. * If the input is a non-empty array, the result is also a non-empty array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const letters = ['a', 'b', 'c', 'd'] - * const result = Array.rotate(letters, 2) - * assert.deepStrictEqual(result, ['c', 'd', 'a', 'b']) + * const result = Array.rotate(['a', 'b', 'c', 'd'], 2) + * console.log(result) // ['c', 'd', 'a', 'b'] * ``` * * @since 2.0.0 @@ -1707,16 +1685,15 @@ export const rotate: { /** * Returns a function that checks if a `ReadonlyArray` contains a given value using a provided `isEquivalent` function. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array } from "effect" + * import { Array, pipe } from "effect" * - * const numbers = [1, 2, 3, 4] * const isEquivalent = (a: number, b: number) => a === b * const containsNumber = Array.containsWith(isEquivalent) - * const result = containsNumber(3)(numbers) - * assert.deepStrictEqual(result, true) + * const result = pipe([1, 2, 3, 4], containsNumber(3)) + * console.log(result) // true * ``` * * @category elements @@ -1740,14 +1717,13 @@ const _equivalence = Equal.equivalence() /** * Returns a function that checks if a `ReadonlyArray` contains a given value using the default `Equivalence`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array } from "effect" + * import { Array, pipe } from "effect" * - * const letters = ['a', 'b', 'c', 'd'] - * const result = Array.contains('c')(letters) - * assert.deepStrictEqual(result, true) + * const result = pipe(['a', 'b', 'c', 'd'], Array.contains('c')) + * console.log(result) // true * ``` * * @category elements @@ -1763,14 +1739,13 @@ export const contains: { * `Iterable`. Typically chop is called with some function that will consume an initial prefix of the `Iterable` and produce a * value and the rest of the `Array`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.chop(numbers, (as): [number, Array] => [as[0] * 2, as.slice(1)]) - * assert.deepStrictEqual(result, [2, 4, 6, 8, 10]) + * const result = Array.chop([1, 2, 3, 4, 5], (as): [number, Array] => [as[0] * 2, as.slice(1)]) + * console.log(result) // [2, 4, 6, 8, 10] * * // Explanation: * // The `chopFunction` takes the first element of the array, doubles it, and then returns it along with the rest of the array. @@ -1815,14 +1790,13 @@ export const chop: { * Splits an `Iterable` into two segments, with the first segment containing a maximum of `n` elements. * The value of `n` can be `0`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.splitAt(numbers, 3) - * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]]) + * const result = Array.splitAt([1, 2, 3, 4, 5], 3) + * console.log(result) // [[1, 2, 3], [4, 5]] * ``` * * @category splitting @@ -1847,13 +1821,13 @@ export const splitAt: { * Splits a `NonEmptyReadonlyArray` into two segments, with the first segment containing a maximum of `n` elements. * The value of `n` must be `>= 1`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.splitNonEmptyAt(["a", "b", "c", "d", "e"], 3) - * assert.deepStrictEqual(result, [["a", "b", "c"], ["d", "e"]]) + * console.log(result) // [["a", "b", "c"], ["d", "e"]] * ``` * * @category splitting @@ -1872,14 +1846,13 @@ export const splitNonEmptyAt: { /** * Splits this iterable into `n` equally sized arrays. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5, 6, 7, 8] - * const result = Array.split(numbers, 3) - * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5, 6], [7, 8]]) + * const result = Array.split([1, 2, 3, 4, 5, 6, 7, 8], 3) + * console.log(result) // [[1, 2, 3], [4, 5, 6], [7, 8]] * ``` * * @since 2.0.0 @@ -1897,14 +1870,13 @@ export const split: { * Splits this iterable on the first element that matches this predicate. * Returns a tuple containing two arrays: the first one is before the match, and the second one is from the match onward. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.splitWhere(numbers, n => n > 3) - * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]]) + * const result = Array.splitWhere([1, 2, 3, 4, 5], n => n > 3) + * console.log(result) // [[1, 2, 3], [4, 5]] * ``` * * @category splitting @@ -1924,14 +1896,13 @@ export const splitWhere: { /** * Copies an array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3] - * const copy = Array.copy(numbers) - * assert.deepStrictEqual(copy, [1, 2, 3]) + * const result = Array.copy([1, 2, 3]) + * console.log(result) // [1, 2, 3] * ``` * * @since 2.0.0 @@ -1947,14 +1918,13 @@ export const copy: { * If `array` is longer than `n`, the returned array will be a slice of `array` containing the `n` first elements of `array`. * If `n` is less than or equal to 0, the returned array will be an empty array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const arr = [1, 2, 3] - * const result = Array.pad(arr, 6, 0) - * assert.deepStrictEqual(result, [1, 2, 3, 0, 0, 0]) + * const result = Array.pad([1, 2, 3], 6, 0) + * console.log(result) // [1, 2, 3, 0, 0, 0] * ``` * * @since 3.8.4 @@ -1988,14 +1958,13 @@ export const pad: { * * whenever `n` evenly divides the length of `self`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3, 4, 5] - * const result = Array.chunksOf(numbers, 2) - * assert.deepStrictEqual(result, [[1, 2], [3, 4], [5]]) + * const result = Array.chunksOf([1, 2, 3, 4, 5], 2) + * console.log(result) // [[1, 2], [3, 4], [5]] * * // Explanation: * // The `chunksOf` function takes an array of numbers `[1, 2, 3, 4, 5]` and a number `2`. @@ -2026,13 +1995,13 @@ export const chunksOf: { /** * Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s using the provided `isEquivalent` function. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.groupWith(["a", "a", "b", "b", "b", "c", "a"], (x, y) => x === y) - * assert.deepStrictEqual(result, [["a", "a"], ["b", "b", "b"], ["c"], ["a"]]) + * console.log(result) // [["a", "a"], ["b", "b", "b"], ["c"], ["a"]] * ``` * * @category grouping @@ -2063,13 +2032,13 @@ export const groupWith: { /** * Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const result = Array.group([1, 1, 2, 2, 2, 3, 1]) - * assert.deepStrictEqual(result, [[1, 1], [2, 2, 2], [3], [1]]) + * console.log(result) // [[1, 1], [2, 2, 2], [3], [1]] * ``` * * @category grouping @@ -2083,9 +2052,9 @@ export const group: (self: NonEmptyReadonlyArray) => NonEmptyArray(self: NonEmptyReadonlyArray) => NonEmptyArray person.group) - * assert.deepStrictEqual(result, { - * A: [{ name: "Alice", group: "A" }, { name: "Charlie", group: "A" }], - * B: [{ name: "Bob", group: "B" }] - * }) + * console.log(result) + * // { + * // A: [{ name: "Alice", group: "A" }, { name: "Charlie", group: "A" }], + * // B: [{ name: "Bob", group: "B" }] + * // } * ``` * * @category grouping @@ -2130,15 +2101,13 @@ export const groupBy: { /** * Calculates the union of two arrays using the provided equivalence relation. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const array1 = [1, 2] - * const array2 = [2, 3] - * const union = Array.unionWith(array1, array2, (a, b) => a === b) - * assert.deepStrictEqual(union, [1, 2, 3]) + * const union = Array.unionWith([1, 2], [2, 3], (a, b) => a === b) + * console.log(union) // [1, 2, 3] * ``` * * @since 2.0.0 @@ -2175,15 +2144,13 @@ export const unionWith: { /** * Creates a union of two arrays, removing duplicates. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const array1 = [1, 2] - * const array2 = [2, 3] - * const result = Array.union(array1, array2) - * assert.deepStrictEqual(result, [1, 2, 3]) + * const result = Array.union([1, 2], [2, 3]) + * console.log(result) // [1, 2, 3] * ``` * * @since 2.0.0 @@ -2203,16 +2170,16 @@ export const union: { * Creates an `Array` of unique values that are included in all given `Iterable`s using the provided `isEquivalent` function. * The order and references of result values are determined by the first `Iterable`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }] * const array2 = [{ id: 3 }, { id: 4 }, { id: 1 }] * const isEquivalent = (a: { id: number }, b: { id: number }) => a.id === b.id * const result = Array.intersectionWith(isEquivalent)(array2)(array1) - * assert.deepStrictEqual(result, [{ id: 1 }, { id: 3 }]) + * console.log(result) // [{ id: 1 }, { id: 3 }] * ``` * * @since 2.0.0 @@ -2232,15 +2199,13 @@ export const intersectionWith = (isEquivalent: (self: A, that: A) => boolean) * Creates an `Array` of unique values that are included in all given `Iterable`s. * The order and references of result values are determined by the first `Iterable`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const array1 = [1, 2, 3] - * const array2 = [3, 4, 1] - * const result = Array.intersection(array1, array2) - * assert.deepStrictEqual(result, [1, 3]) + * const result = Array.intersection([1, 2, 3], [3, 4, 1]) + * console.log(result) // [1, 3] * ``` * * @since 2.0.0 @@ -2254,15 +2219,15 @@ export const intersection: { * Creates a `Array` of values not included in the other given `Iterable` using the provided `isEquivalent` function. * The order and references of result values are determined by the first `Iterable`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const array1 = [1, 2, 3] * const array2 = [2, 3, 4] * const difference = Array.differenceWith((a, b) => a === b)(array1, array2) - * assert.deepStrictEqual(difference, [1]) + * console.log(difference) // [1] * ``` * * @since 2.0.0 @@ -2282,15 +2247,13 @@ export const differenceWith = (isEquivalent: (self: A, that: A) => boolean): * Creates a `Array` of values not included in the other given `Iterable`. * The order and references of result values are determined by the first `Iterable`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const array1 = [1, 2, 3] - * const array2 = [2, 3, 4] - * const difference = Array.difference(array1, array2) - * assert.deepStrictEqual(difference, [1]) + * const difference = Array.difference([1, 2, 3], [2, 3, 4]) + * console.log(difference) // [1] * ``` * * @since 2.0.0 @@ -2407,15 +2370,13 @@ export const flatMap: { * from each nested array. This function ensures that the structure of nested * arrays is collapsed into a single, flat array. * - * @example - * ```ts - * import * as assert from "node:assert" - * import { Array } from "effect"; + * **Example** * - * const nestedArrays = [[1, 2], [], [3, 4], [], [5, 6]] - * const result = Array.flatten(nestedArrays) + * ```ts + * import { Array } from "effect" * - * assert.deepStrictEqual(result, [1, 2, 3, 4, 5, 6]); + * const result = Array.flatten([[1, 2], [], [3, 4], [], [5, 6]]) + * console.log(result) // [1, 2, 3, 4, 5, 6] * ``` * * @category sequencing @@ -2429,16 +2390,15 @@ export const flatten: >>(self: S) => * Applies a function to each element of the `Iterable` and filters based on the result, keeping the transformed values where the function returns `Some`. * This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Option } from "effect"; + * import { Array, Option } from "effect" * - * const data = [1, 2, 3, 4, 5]; - * const evenSquares = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none(); - * const result = Array.filterMap(data, evenSquares); + * const evenSquares = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none() * - * assert.deepStrictEqual(result, [4, 16]); + * const result = Array.filterMap([1, 2, 3, 4, 5], evenSquares); + * console.log(result) // [4, 16] * ``` * * @category filtering @@ -2467,16 +2427,15 @@ export const filterMap: { * This method combines filtering and mapping in a single pass, and short-circuits, i.e., stops processing, as soon as the function returns `None`. * This is useful when you need to transform an array but only up to the point where a certain condition holds true. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" - * import { Array, Option } from "effect"; + * import { Array, Option } from "effect" * - * const data = [2, 4, 5]; - * const toSquareTillOdd = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none(); - * const result = Array.filterMapWhile(data, toSquareTillOdd); + * const toSquareTillOdd = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none() * - * assert.deepStrictEqual(result, [4, 16]); + * const result = Array.filterMapWhile([2, 4, 5], toSquareTillOdd) + * console.log(result) // [4, 16] * ``` * * @category filtering @@ -2506,21 +2465,21 @@ export const filterMapWhile: { * and you want to separate these types into different collections. For instance, separating validation results * into successes and failures. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array, Either } from "effect"; * - * const data = [1, 2, 3, 4, 5] * const isEven = (x: number) => x % 2 === 0 - * const partitioned = Array.partitionMap(data, x => + * + * const result = Array.partitionMap([1, 2, 3, 4, 5], x => * isEven(x) ? Either.right(x) : Either.left(x) * ) - * - * assert.deepStrictEqual(partitioned, [ - * [1, 3, 5], - * [2, 4] - * ]) + * console.log(result) + * // [ + * // [1, 3, 5], + * // [2, 4] + * // ] * ``` * * @category filtering @@ -2550,15 +2509,13 @@ export const partitionMap: { /** * Retrieves the `Some` values from an `Iterable` of `Option`s, collecting them into an array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array, Option } from "effect" * - * assert.deepStrictEqual( - * Array.getSomes([Option.some(1), Option.none(), Option.some(2)]), - * [1, 2] - * ) + * const result = Array.getSomes([Option.some(1), Option.none(), Option.some(2)]) + * console.log(result) // [1, 2] * ``` * * @category filtering @@ -2572,15 +2529,13 @@ export const getSomes: >, X = any>( /** * Retrieves the `Left` values from an `Iterable` of `Either`s, collecting them into an array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array, Either } from "effect" * - * assert.deepStrictEqual( - * Array.getLefts([Either.right(1), Either.left("err"), Either.right(2)]), - * ["err"] - * ) + * const result = Array.getLefts([Either.right(1), Either.left("err"), Either.right(2)]) + * console.log(result) // ["err"] * ``` * * @category filtering @@ -2600,15 +2555,13 @@ export const getLefts = >>(self: T): Array n % 2 === 0) - * - * assert.deepStrictEqual(result, [[1, 3], [2, 4]]) + * const result = Array.partition([1, 2, 3, 4], n => n % 2 === 0) + * console.log(result) // [[1, 3], [2, 4]] * ``` * * @category filtering @@ -2712,14 +2662,13 @@ export const separate: >>( /** * Reduces an array from the left. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3] - * const result = Array.reduce(numbers, 0, (acc, n) => acc + n) - * assert.deepStrictEqual(result, 6) + * const result = Array.reduce([1, 2, 3], 0, (acc, n) => acc + n) + * console.log(result) // 6 * ``` * * @category folding @@ -2737,14 +2686,13 @@ export const reduce: { /** * Reduces an array from the right. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3] - * const result = Array.reduceRight(numbers, 0, (acc, n) => acc + n) - * assert.deepStrictEqual(result, 6) + * const result = Array.reduceRight([1, 2, 3], 0, (acc, n) => acc + n) + * console.log(result) // 6 * ``` * * @category folding @@ -2762,15 +2710,15 @@ export const reduceRight: { /** * Lifts a predicate into an array. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const isEven = (n: number) => n % 2 === 0 * const to = Array.liftPredicate(isEven) - * assert.deepStrictEqual(to(1), []) - * assert.deepStrictEqual(to(2), [2]) + * console.log(to(1)) // [] + * console.log(to(2)) // [2] * ``` * * @category lifting @@ -2808,14 +2756,13 @@ export const liftNullable = , B>( /** * Maps over an array and flattens the result, removing null and undefined values. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3] - * const result = Array.flatMapNullable(numbers, n => (n % 2 === 0 ? null : n)) - * assert.deepStrictEqual(result, [1, 3]) + * const result = Array.flatMapNullable([1, 2, 3], n => (n % 2 === 0 ? null : n)) + * console.log(result) // [1, 3] * * // Explanation: * // The array of numbers [1, 2, 3] is mapped with a function that returns null for even numbers @@ -2840,9 +2787,9 @@ export const flatMapNullable: { * If the `Either` is a left, it returns an empty array. * If the `Either` is a right, it returns an array with the right value. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array, Either } from "effect" * * const parseNumber = (s: string): Either.Either => @@ -2851,10 +2798,10 @@ export const flatMapNullable: { * const liftedParseNumber = Array.liftEither(parseNumber) * * const result1 = liftedParseNumber("42") - * assert.deepStrictEqual(result1, [42]) + * console.log(result1) // [42] * * const result2 = liftedParseNumber("not a number") - * assert.deepStrictEqual(result2, []) + * console.log(result2) // [] * * // Explanation: * // The function parseNumber is lifted to return an array. @@ -2912,14 +2859,13 @@ export const some: { /** * Extends an array with a function that maps each subarray to a value. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3] - * const result = Array.extend(numbers, as => as.length) - * assert.deepStrictEqual(result, [3, 2, 1]) + * const result = Array.extend([1, 2, 3], as => as.length) + * console.log(result) // [3, 2, 1] * * // Explanation: * // The function maps each subarray starting from each element to its length. @@ -2941,13 +2887,13 @@ export const extend: { /** * Finds the minimum element in an array based on a comparator. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array, Order } from "effect" * - * const min = Array.min([3, 1, 2], Order.number) - * assert.deepStrictEqual(min, 1) + * const result = Array.min([3, 1, 2], Order.number) + * console.log(result) // 1 * ``` * * @since 2.0.0 @@ -2960,13 +2906,13 @@ export const min: { /** * Finds the maximum element in an array based on a comparator. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array, Order } from "effect" * - * const max = Array.max([3, 1, 2], Order.number) - * assert.deepStrictEqual(max, 3) + * const result = Array.max([3, 1, 2], Order.number) + * console.log(result) // 3 * ``` * * @since 2.0.0 @@ -3006,15 +2952,13 @@ export const getOrder: (O: Order.Order) => Order.Order> = /** * Creates an equivalence relation for arrays. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers1 = [1, 2, 3] - * const numbers2 = [1, 2, 3] * const eq = Array.getEquivalence((a, b) => a === b) - * assert.deepStrictEqual(eq(numbers1, numbers2), true) + * console.log(eq([1, 2, 3], [1, 2, 3])) // true * ``` * * @category instances @@ -3027,12 +2971,12 @@ export const getEquivalence: ( /** * Performs a side-effect for each element of the `Iterable`. * - * @example + * **Example** + * * ```ts * import { Array } from "effect" * - * const numbers = [1, 2, 3] - * Array.forEach(numbers, n => console.log(n)) // 1, 2, 3 + * Array.forEach([1, 2, 3], n => console.log(n)) // 1, 2, 3 * ``` * * @since 2.0.0 @@ -3046,14 +2990,13 @@ export const forEach: { * Remove duplicates from an `Iterable` using the provided `isEquivalent` function, * preserving the order of the first occurrence of each element. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 2, 3, 3, 3] - * const unique = Array.dedupeWith(numbers, (a, b) => a === b) - * assert.deepStrictEqual(unique, [1, 2, 3]) + * const result = Array.dedupeWith([1, 2, 2, 3, 3, 3], (a, b) => a === b) + * console.log(result) // [1, 2, 3] * ``` * * @since 2.0.0 @@ -3096,14 +3039,13 @@ export const dedupe = >( /** * Deduplicates adjacent elements that are identical using the provided `isEquivalent` function. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 1, 2, 2, 3, 3] - * const unique = Array.dedupeAdjacentWith(numbers, (a, b) => a === b) - * assert.deepStrictEqual(unique, [1, 2, 3]) + * const result = Array.dedupeAdjacentWith([1, 1, 2, 2, 3, 3], (a, b) => a === b) + * console.log(result) // [1, 2, 3] * ``` * * @since 2.0.0 @@ -3126,14 +3068,13 @@ export const dedupeAdjacentWith: { /** * Deduplicates adjacent elements that are identical. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 1, 2, 2, 3, 3] - * const unique = Array.dedupeAdjacent(numbers) - * assert.deepStrictEqual(unique, [1, 2, 3]) + * const result = Array.dedupeAdjacent([1, 1, 2, 2, 3, 3]) + * console.log(result) // [1, 2, 3] * ``` * * @since 2.0.0 @@ -3143,14 +3084,14 @@ export const dedupeAdjacent: (self: Iterable) => Array = dedupeAdjacent /** * Joins the elements together with "sep" in the middle. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * * const strings = ["a", "b", "c"] * const joined = Array.join(strings, "-") - * assert.deepStrictEqual(joined, "a-b-c") + * console.log(joined) // "a-b-c" * ``` * * @since 2.0.0 @@ -3164,14 +3105,13 @@ export const join: { /** * Statefully maps over the chunk, producing new elements of type `B`. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const numbers = [1, 2, 3] - * const result = Array.mapAccum(numbers, 0, (acc, n) => [acc + n, acc + n]) - * assert.deepStrictEqual(result, [6, [1, 3, 6]]) + * const result = Array.mapAccum([1, 2, 3], 0, (acc, n) => [acc + n, acc + n]) + * console.log(result) // [6, [1, 3, 6]] * ``` * * @since 2.0.0 @@ -3206,15 +3146,13 @@ export const mapAccum: { /** * Zips this chunk crosswise with the specified chunk using the specified combiner. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const array1 = [1, 2] - * const array2 = ["a", "b"] - * const product = Array.cartesianWith(array1, array2, (a, b) => `${a}-${b}`) - * assert.deepStrictEqual(product, ["1-a", "1-b", "2-a", "2-b"]) + * const result = Array.cartesianWith([1, 2], ["a", "b"], (a, b) => `${a}-${b}`) + * console.log(result) // ["1-a", "1-b", "2-a", "2-b"] * ``` * * @since 2.0.0 @@ -3232,15 +3170,13 @@ export const cartesianWith: { /** * Zips this chunk crosswise with the specified chunk. * - * @example + * **Example** + * * ```ts - * import * as assert from "node:assert" * import { Array } from "effect" * - * const array1 = [1, 2] - * const array2 = ["a", "b"] - * const product = Array.cartesian(array1, array2) - * assert.deepStrictEqual(product, [[1, "a"], [1, "b"], [2, "a"], [2, "b"]]) + * const result = Array.cartesian([1, 2], ["a", "b"]) + * console.log(result) // [[1, "a"], [1, "b"], [2, "a"], [2, "b"]] * ``` * * @since 2.0.0 @@ -3272,22 +3208,19 @@ export const cartesian: { * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope * - * @see {@link bindTo} - * @see {@link bind} - * @see {@link let_ let} + * **Example** * - * @example * ```ts - * import * as assert from "node:assert" - * import { Array as Arr, pipe } from "effect" + * import { Array, pipe } from "effect" + * * const doResult = pipe( - * Arr.Do, - * Arr.bind("x", () => [1, 3, 5]), - * Arr.bind("y", () => [2, 4, 6]), - * Arr.filter(({ x, y }) => x < y), // condition - * Arr.map(({ x, y }) => [x, y] as const) // transformation + * Array.Do, + * Array.bind("x", () => [1, 3, 5]), + * Array.bind("y", () => [2, 4, 6]), + * Array.filter(({ x, y }) => x < y), // condition + * Array.map(({ x, y }) => [x, y] as const) // transformation * ) - * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]]) + * console.log(doResult) // [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]] * * // equivalent * const x = [1, 3, 5], @@ -3301,6 +3234,10 @@ export const cartesian: { * } * ``` * + * @see {@link bindTo} + * @see {@link bind} + * @see {@link let_ let} + * * @category do notation * @since 3.2.0 */ @@ -3320,22 +3257,19 @@ export const Do: ReadonlyArray<{}> = of({}) * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope * - * @see {@link bindTo} - * @see {@link Do} - * @see {@link let_ let} + * **Example** * - * @example * ```ts - * import * as assert from "node:assert" - * import { Array as Arr, pipe } from "effect" + * import { Array, pipe } from "effect" + * * const doResult = pipe( - * Arr.Do, - * Arr.bind("x", () => [1, 3, 5]), - * Arr.bind("y", () => [2, 4, 6]), - * Arr.filter(({ x, y }) => x < y), // condition - * Arr.map(({ x, y }) => [x, y] as const) // transformation + * Array.Do, + * Array.bind("x", () => [1, 3, 5]), + * Array.bind("y", () => [2, 4, 6]), + * Array.filter(({ x, y }) => x < y), // condition + * Array.map(({ x, y }) => [x, y] as const) // transformation * ) - * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]]) + * console.log(doResult) // [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]] * * // equivalent * const x = [1, 3, 5], @@ -3349,6 +3283,10 @@ export const Do: ReadonlyArray<{}> = of({}) * } * ``` * + * @see {@link bindTo} + * @see {@link Do} + * @see {@link let_ let} + * * @category do notation * @since 3.2.0 */ @@ -3380,22 +3318,19 @@ export const bind: { * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope * - * @see {@link bindTo} - * @see {@link Do} - * @see {@link let_ let} + * **Example** * - * @example * ```ts - * import * as assert from "node:assert" - * import { Array as Arr, pipe } from "effect" + * import { Array, pipe } from "effect" + * * const doResult = pipe( - * Arr.Do, - * Arr.bind("x", () => [1, 3, 5]), - * Arr.bind("y", () => [2, 4, 6]), - * Arr.filter(({ x, y }) => x < y), // condition - * Arr.map(({ x, y }) => [x, y] as const) // transformation + * Array.Do, + * Array.bind("x", () => [1, 3, 5]), + * Array.bind("y", () => [2, 4, 6]), + * Array.filter(({ x, y }) => x < y), // condition + * Array.map(({ x, y }) => [x, y] as const) // transformation * ) - * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]]) + * console.log(doResult) // [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]] * * // equivalent * const x = [1, 3, 5], @@ -3409,6 +3344,10 @@ export const bind: { * } * ``` * + * @see {@link bindTo} + * @see {@link Do} + * @see {@link let_ let} + * * @category do notation * @since 3.2.0 */ @@ -3444,22 +3383,19 @@ export { * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope * - * @see {@link bindTo} - * @see {@link bind} - * @see {@link Do} + * **Example** * - * @example * ```ts - * import * as assert from "node:assert" - * import { Array as Arr, pipe } from "effect" + * import { Array, pipe } from "effect" + * * const doResult = pipe( - * Arr.Do, - * Arr.bind("x", () => [1, 3, 5]), - * Arr.bind("y", () => [2, 4, 6]), - * Arr.filter(({ x, y }) => x < y), // condition - * Arr.map(({ x, y }) => [x, y] as const) // transformation + * Array.Do, + * Array.bind("x", () => [1, 3, 5]), + * Array.bind("y", () => [2, 4, 6]), + * Array.filter(({ x, y }) => x < y), // condition + * Array.map(({ x, y }) => [x, y] as const) // transformation * ) - * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]]) + * console.log(doResult) // [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]] * * // equivalent * const x = [1, 3, 5], @@ -3473,6 +3409,11 @@ export { * } * * ``` + * + * @see {@link bindTo} + * @see {@link bind} + * @see {@link Do} + * * @category do notation * @since 3.2.0 */ From b158daf992ba0df74e34b1908965928f6d8eee39 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sat, 8 Mar 2025 17:53:39 +0100 Subject: [PATCH 09/16] last docgen --- package.json | 2 +- packages/cli/src/Options.ts | 6 +- packages/cli/src/Prompt.ts | 3 +- packages/effect/docgen.json | 1 + packages/effect/src/BigDecimal.ts | 3 +- packages/effect/src/Effect.ts | 153 +++++++++++++++++++++--------- packages/effect/src/Schema.ts | 8 +- pnpm-lock.yaml | 23 ++--- 8 files changed, 136 insertions(+), 63 deletions(-) diff --git a/package.json b/package.json index 95031956777..56849067e5e 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@changesets/cli": "^2.27.7", "@edge-runtime/vm": "^4.0.0", "@effect/build-utils": "^0.7.7", - "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c", + "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7", "@effect/eslint-plugin": "^0.2.0", "@effect/language-service": "^0.1.0", "@effect/vitest": "workspace:^", diff --git a/packages/cli/src/Options.ts b/packages/cli/src/Options.ts index c95ec483aa4..4a01a4a8f8d 100644 --- a/packages/cli/src/Options.ts +++ b/packages/cli/src/Options.ts @@ -153,7 +153,8 @@ export const boolean: (name: string, options?: Options.BooleanOptionsConfig) => * Constructs command-line `Options` that represent a choice between several * inputs. The input will be mapped to it's associated value during parsing. * - * @example + * **Example** + * * ```ts * import * as Options from "@effect/cli/Options" * @@ -175,7 +176,8 @@ export const choice: >( * Constructs command-line `Options` that represent a choice between several * inputs. The input will be mapped to it's associated value during parsing. * - * @example + * **Example** + * * ```ts * import * as Options from "@effect/cli/Options" * import * as Data from "effect/Data" diff --git a/packages/cli/src/Prompt.ts b/packages/cli/src/Prompt.ts index a015536b5eb..5f32ae6e69f 100644 --- a/packages/cli/src/Prompt.ts +++ b/packages/cli/src/Prompt.ts @@ -516,7 +516,8 @@ export declare namespace All { * Supports either a tuple / iterable of prompts or a record / struct of prompts * as an argument. * - * @example + * **Example** + * * ```ts * import * as Prompt from "@effect/cli/Prompt" * import * as NodeContext from "@effect/platform-node/NodeContext" diff --git a/packages/effect/docgen.json b/packages/effect/docgen.json index 5c4b0455272..5b90f6a55ad 100644 --- a/packages/effect/docgen.json +++ b/packages/effect/docgen.json @@ -1,6 +1,7 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", "exclude": ["src/internal/**/*.ts"], + "srcLink": "https://github.com/Effect-TS/effect/blob/main/packages/effect/src/", "examplesCompilerOptions": { "noEmit": true, "strict": true, diff --git a/packages/effect/src/BigDecimal.ts b/packages/effect/src/BigDecimal.ts index 121c633dab8..efed5a51676 100644 --- a/packages/effect/src/BigDecimal.ts +++ b/packages/effect/src/BigDecimal.ts @@ -127,7 +127,8 @@ const zero = unsafeMakeNormalized(bigint0, 0) /** * Normalizes a given `BigDecimal` by removing trailing zeros. * - * @example + * **Example** + * * ```ts * import * as assert from "node:assert" * import { normalize, make, unsafeFromString } from "effect/BigDecimal" diff --git a/packages/effect/src/Effect.ts b/packages/effect/src/Effect.ts index 0921c6cd663..56d2b0644ba 100644 --- a/packages/effect/src/Effect.ts +++ b/packages/effect/src/Effect.ts @@ -13850,77 +13850,140 @@ export namespace fn { } /** - * Creates a function that returns an Effect, which includes a stack trace - * with relevant location information if an error occurs and is automatically - * traced with a span pointing to the call site. + * The `Effect.fn` function allows you to create traced functions that return an + * effect. It provides two key features: * - * The name passed as the first argument is used as a span. + * - **Stack traces with location details** if an error occurs. + * - **Automatic span creation** for tracing when a span name is provided. * - * The name is optional; if not provided, the span won't be added, but the stack trace will still be present. + * If a span name is passed as the first argument, the function's execution is + * tracked using that name. If no name is provided, stack tracing still works, + * but spans are not created. * - * The function can be created using either a generator function that can yield - * effects or a normal function that returns an effect. + * A function can be defined using either: * - * `Effect.fn` also acts as a `pipe` function, allowing you to create a pipeline - * after the function definition using the effect returned by the generator - * function as the starting value of the pipeline. + * - A generator function, allowing the use of `yield*` for effect composition. + * - A regular function that returns an `Effect`. * - * @see {@link fnUntraced} for a version of this function that doesn't add a span. + * **Example** (Creating a Traced Function with a Span Name) * - * @example * ```ts - * // Title: Creating a traced function with a generator function * import { Effect } from "effect" * - * const logExample = Effect.fn("logExample")( // Definition location: 4 - * function*(n: N) { - * yield* Effect.annotateCurrentSpan("n", n) - * console.log(`got: ${n}`) - * yield* Effect.fail(new Error()) // Raise location: 8 - * } - * ) + * const myfunc = Effect.fn("myspan")(function* (n: N) { + * yield* Effect.annotateCurrentSpan("n", n) // Attach metadata to the span + * console.log(`got: ${n}`) + * yield* Effect.fail(new Error("Boom!")) // Simulate failure + * }) * - * // Effect.runFork( - * // logExample(100).pipe( // Call location: 13 - * // Effect.catchAllCause(Effect.logError) - * // ) - * // ) + * Effect.runFork(myfunc(100).pipe(Effect.catchAllCause(Effect.logError))) * // Output: * // got: 100 - * // timestamp=... level=ERROR fiber=#0 cause="Error: An error has occurred - * // at (/.../index.ts:8:24) <= Raise location - * // at logExample (/.../index.ts:4:27) <= Definition location - * // at logExample (/.../index.ts:13:3)" <= Call location + * // timestamp=... level=ERROR fiber=#0 cause="Error: Boom! + * // at (/.../index.ts:6:22) <= Raise location + * // at myspan (/.../index.ts:3:23) <= Definition location + * // at myspan (/.../index.ts:9:16)" <= Call location * ``` * - * @example - * ```ts - * // Title: Creating a traced function with a function + * `Effect.fn` automatically creates spans. The spans capture information about + * the function execution, including metadata and error details. + * + * **Example** (Exporting Spans to the Console) + * + * ```ts skip-type-checking * import { Effect } from "effect" + * import { NodeSdk } from "@effect/opentelemetry" + * import { + * ConsoleSpanExporter, + * BatchSpanProcessor + * } from "@opentelemetry/sdk-trace-base" + * + * const myfunc = Effect.fn("myspan")(function* (n: N) { + * yield* Effect.annotateCurrentSpan("n", n) + * console.log(`got: ${n}`) + * yield* Effect.fail(new Error("Boom!")) + * }) * - * const logExample = Effect.fn("logExample")( - * function(n: number) { - * console.log(`got: ${n}`) - * return Effect.fail(new Error(`An error has occurred`)) - * } - * ) + * const program = myfunc(100) + * + * const NodeSdkLive = NodeSdk.layer(() => ({ + * resource: { serviceName: "example" }, + * // Export span data to the console + * spanProcessor: new BatchSpanProcessor(new ConsoleSpanExporter()) + * })) + * + * Effect.runFork(program.pipe(Effect.provide(NodeSdkLive))) + * // Output: + * // got: 100 + * // { + * // resource: { + * // attributes: { + * // 'service.name': 'example', + * // 'telemetry.sdk.language': 'nodejs', + * // 'telemetry.sdk.name': '@effect/opentelemetry', + * // 'telemetry.sdk.version': '1.30.1' + * // } + * // }, + * // instrumentationScope: { name: 'example', version: undefined, schemaUrl: undefined }, + * // traceId: '22801570119e57a6e2aacda3dec9665b', + * // parentId: undefined, + * // traceState: undefined, + * // name: 'myspan', + * // id: '7af530c1e01bc0cb', + * // kind: 0, + * // timestamp: 1741182277518402.2, + * // duration: 4300.416, + * // attributes: { + * // n: 100, + * // 'code.stacktrace': 'at (/.../index.ts:8:23)\n' + + * // 'at (/.../index.ts:14:17)' + * // }, + * // status: { code: 2, message: 'Boom!' }, + * // events: [ + * // { + * // name: 'exception', + * // attributes: { + * // 'exception.type': 'Error', + * // 'exception.message': 'Boom!', + * // 'exception.stacktrace': 'Error: Boom!\n' + + * // ' at (/.../index.ts:11:22)\n' + + * // ' at myspan (/.../index.ts:8:23)\n' + + * // ' at myspan (/.../index.ts:14:17)' + * // }, + * // time: [ 1741182277, 522702583 ], + * // droppedAttributesCount: 0 + * // } + * // ], + * // links: [] + * // } * ``` * - * @example + * `Effect.fn` also acts as a pipe function, allowing you to create a pipeline + * after the function definition using the effect returned by the generator + * function as the starting value of the pipeline. + * + * **Example** (Creating a Traced Function with a Delay) + * * ```ts - * // Title: Creating a traced function and a pipeline * import { Effect } from "effect" * - * const logExample = Effect.fn("logExample")( - * function(n: number) { + * const myfunc = Effect.fn( + * function* (n: number) { * console.log(`got: ${n}`) - * return Effect.fail(new Error(`An error has occurred`)) + * yield* Effect.fail(new Error("Boom!")) * }, - * // Add a delay to the effect - * Effect.delay("1 second") + * // You can access both the created effect and the original arguments + * (effect, n) => Effect.delay(effect, `${n / 100} seconds`) * ) + * + * Effect.runFork(myfunc(100).pipe(Effect.catchAllCause(Effect.logError))) + * // Output: + * // got: 100 + * // timestamp=... level=ERROR fiber=#0 cause="Error: Boom! (<= after 1 second) * ``` * + * @see {@link fnUntraced} for a version of this function that doesn't add a span. + * * @since 3.11.0 * @category Tracing */ diff --git a/packages/effect/src/Schema.ts b/packages/effect/src/Schema.ts index 535d282d9aa..0bb7d50671f 100644 --- a/packages/effect/src/Schema.ts +++ b/packages/effect/src/Schema.ts @@ -3416,17 +3416,21 @@ export interface extend extend /** * Extends a schema with another schema. * - * Not all extensions are supported, and their support depends on the nature of the involved schemas. + * Not all extensions are supported, and their support depends on the nature of + * the involved schemas. * * Possible extensions include: * - `Schema.String` with another `Schema.String` refinement or a string literal * - `Schema.Number` with another `Schema.Number` refinement or a number literal - * - `Schema.Boolean` with another `Schema.Boolean` refinement or a boolean literal + * - `Schema.Boolean` with another `Schema.Boolean` refinement or a boolean + * literal * - A struct with another struct where overlapping fields support extension * - A struct with in index signature * - A struct with a union of supported schemas * - A refinement of a struct with a supported schema * - A suspend of a struct with a supported schema + * - A transformation between structs where the “from” and “to” sides have no + * overlapping fields with the target struct * * @example * ```ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cf88b160aca..945f7588f57 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,8 +53,8 @@ importers: specifier: ^0.7.7 version: 0.7.7 '@effect/docgen': - specifier: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c - version: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c(tsx@4.17.0)(typescript@5.7.2) + specifier: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7 + version: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7(tsx@4.17.0)(typescript@5.7.2) '@effect/eslint-plugin': specifier: ^0.2.0 version: 0.2.0 @@ -1969,14 +1969,14 @@ packages: engines: {node: '>=16.17.1'} hasBin: true - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c': - resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c} + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7': + resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7} version: 0.5.2 engines: {node: '>=18.0.0'} hasBin: true peerDependencies: - tsx: ^4.1.0 - typescript: ^5.2.2 + tsx: ^4.19.3 + typescript: ^5.8.2 '@effect/eslint-plugin@0.2.0': resolution: {integrity: sha512-PC/hEDGctYGYIjZyhM6kbD4FyHxLgoYNoQNjGkCXcFEzi71vQc3PJKe2JnCgzcUDvr/Nc2qgTVU4ONYwjHzQGA==} @@ -6225,8 +6225,8 @@ packages: engines: {node: '>=14'} hasBin: true - prettier@3.5.2: - resolution: {integrity: sha512-lc6npv5PH7hVqozBR7lkBNOGXV9vMwROAPlumdBkX0wTbbzPu/U1hk5yL8p2pt4Xoc+2mkT8t/sow2YrV/M5qg==} + prettier@3.5.3: + resolution: {integrity: sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==} engines: {node: '>=14'} hasBin: true @@ -9419,12 +9419,13 @@ snapshots: '@effect/build-utils@0.7.7': {} - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3e08a6c(tsx@4.17.0)(typescript@5.7.2)': + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7(tsx@4.17.0)(typescript@5.7.2)': dependencies: + '@babel/code-frame': 7.26.2 '@effect/markdown-toc': 0.1.0 doctrine: 3.0.0 glob: 11.0.1 - prettier: 3.5.2 + prettier: 3.5.3 tsx: 4.17.0 typescript: 5.7.2 @@ -14177,7 +14178,7 @@ snapshots: prettier@3.3.3: {} - prettier@3.5.2: {} + prettier@3.5.3: {} pretty-format@26.6.2: dependencies: From 27bd6b05d268b6e03d3012283333561069dcd175 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sat, 8 Mar 2025 19:14:03 +0100 Subject: [PATCH 10/16] Update docgen to latest PR version and adjust source link --- package.json | 2 +- packages/effect/docgen.json | 2 +- pnpm-lock.yaml | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 56849067e5e..5aa6a8e0396 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@changesets/cli": "^2.27.7", "@edge-runtime/vm": "^4.0.0", "@effect/build-utils": "^0.7.7", - "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7", + "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9", "@effect/eslint-plugin": "^0.2.0", "@effect/language-service": "^0.1.0", "@effect/vitest": "workspace:^", diff --git a/packages/effect/docgen.json b/packages/effect/docgen.json index 5b90f6a55ad..4ae72f91073 100644 --- a/packages/effect/docgen.json +++ b/packages/effect/docgen.json @@ -1,7 +1,7 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", "exclude": ["src/internal/**/*.ts"], - "srcLink": "https://github.com/Effect-TS/effect/blob/main/packages/effect/src/", + "srcLink": "https://github.com/Effect-TS/effect/tree/next-docgen/packages/effect/src/", "examplesCompilerOptions": { "noEmit": true, "strict": true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 945f7588f57..3b782f6a291 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,8 +53,8 @@ importers: specifier: ^0.7.7 version: 0.7.7 '@effect/docgen': - specifier: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7 - version: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7(tsx@4.17.0)(typescript@5.7.2) + specifier: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9 + version: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9(tsx@4.17.0)(typescript@5.7.2) '@effect/eslint-plugin': specifier: ^0.2.0 version: 0.2.0 @@ -1969,8 +1969,8 @@ packages: engines: {node: '>=16.17.1'} hasBin: true - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7': - resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7} + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9': + resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9} version: 0.5.2 engines: {node: '>=18.0.0'} hasBin: true @@ -9419,7 +9419,7 @@ snapshots: '@effect/build-utils@0.7.7': {} - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@3a451b7(tsx@4.17.0)(typescript@5.7.2)': + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9(tsx@4.17.0)(typescript@5.7.2)': dependencies: '@babel/code-frame': 7.26.2 '@effect/markdown-toc': 0.1.0 From 961a25618f28734c7b8e1fbb27556c44db919a07 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sun, 9 Mar 2025 16:27:22 +0100 Subject: [PATCH 11/16] Bump @effect/docgen to latest PR version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 5aa6a8e0396..995b6e42f9b 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@changesets/cli": "^2.27.7", "@edge-runtime/vm": "^4.0.0", "@effect/build-utils": "^0.7.7", - "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9", + "@effect/docgen": "https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@bdf507c", "@effect/eslint-plugin": "^0.2.0", "@effect/language-service": "^0.1.0", "@effect/vitest": "workspace:^", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3b782f6a291..fa6f29147a1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,8 +53,8 @@ importers: specifier: ^0.7.7 version: 0.7.7 '@effect/docgen': - specifier: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9 - version: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9(tsx@4.17.0)(typescript@5.7.2) + specifier: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@bdf507c + version: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@bdf507c(tsx@4.17.0)(typescript@5.7.2) '@effect/eslint-plugin': specifier: ^0.2.0 version: 0.2.0 @@ -1969,8 +1969,8 @@ packages: engines: {node: '>=16.17.1'} hasBin: true - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9': - resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9} + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@bdf507c': + resolution: {tarball: https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@bdf507c} version: 0.5.2 engines: {node: '>=18.0.0'} hasBin: true @@ -9419,7 +9419,7 @@ snapshots: '@effect/build-utils@0.7.7': {} - '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@073cbb9(tsx@4.17.0)(typescript@5.7.2)': + '@effect/docgen@https://pkg.pr.new/Effect-TS/docgen/@effect/docgen@bdf507c(tsx@4.17.0)(typescript@5.7.2)': dependencies: '@babel/code-frame': 7.26.2 '@effect/markdown-toc': 0.1.0 From 4e118e9744e80834f8b477ebd88a13aa8957c340 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sun, 9 Mar 2025 16:50:10 +0100 Subject: [PATCH 12/16] Update docgen.json configurations to use main branch source links --- packages/ai/ai/docgen.json | 1 + packages/ai/anthropic/docgen.json | 1 + packages/ai/openai/docgen.json | 1 + packages/cli/docgen.json | 1 + packages/cluster-browser/docgen.json | 1 + packages/cluster-node/docgen.json | 1 + packages/cluster-workflow/docgen.json | 1 + packages/cluster/docgen.json | 1 + packages/effect/docgen.json | 2 +- packages/experimental/docgen.json | 5 +++++ packages/opentelemetry/docgen.json | 1 + packages/platform-browser/docgen.json | 1 + packages/platform-bun/docgen.json | 1 + packages/platform-node-shared/docgen.json | 1 + packages/platform-node/docgen.json | 1 + packages/platform/docgen.json | 1 + packages/printer-ansi/docgen.json | 1 + packages/printer/docgen.json | 1 + packages/rpc-http/docgen.json | 1 + packages/rpc/docgen.json | 1 + packages/sql-clickhouse/docgen.json | 1 + packages/sql-d1/docgen.json | 1 + packages/sql-drizzle/docgen.json | 1 + packages/sql-kysely/docgen.json | 1 + packages/sql-libsql/docgen.json | 1 + packages/sql-mssql/docgen.json | 1 + packages/sql-mysql2/docgen.json | 1 + packages/sql-pg/docgen.json | 1 + packages/sql-sqlite-bun/docgen.json | 1 + packages/sql-sqlite-do/docgen.json | 1 + packages/sql-sqlite-node/docgen.json | 1 + packages/sql-sqlite-react-native/docgen.json | 1 + packages/sql-sqlite-wasm/docgen.json | 1 + packages/sql/docgen.json | 1 + packages/typeclass/docgen.json | 1 + packages/vitest/docgen.json | 1 + 36 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 packages/experimental/docgen.json diff --git a/packages/ai/ai/docgen.json b/packages/ai/ai/docgen.json index 2525a365953..05473aa2f46 100644 --- a/packages/ai/ai/docgen.json +++ b/packages/ai/ai/docgen.json @@ -1,6 +1,7 @@ { "$schema": "../../../node_modules/@effect/docgen/schema.json", "exclude": ["src/internal/**/*.ts"], + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/ai/ai/src/", "examplesCompilerOptions": { "noEmit": true, "strict": true, diff --git a/packages/ai/anthropic/docgen.json b/packages/ai/anthropic/docgen.json index cec803cfd7d..47d7a669c09 100644 --- a/packages/ai/anthropic/docgen.json +++ b/packages/ai/anthropic/docgen.json @@ -1,6 +1,7 @@ { "$schema": "../../../node_modules/@effect/docgen/schema.json", "exclude": ["src/Generated.ts", "src/internal/**/*.ts"], + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/ai/anthropic/src/", "examplesCompilerOptions": { "noEmit": true, "strict": true, diff --git a/packages/ai/openai/docgen.json b/packages/ai/openai/docgen.json index 5fa5696a713..bd1bd8000e2 100644 --- a/packages/ai/openai/docgen.json +++ b/packages/ai/openai/docgen.json @@ -1,6 +1,7 @@ { "$schema": "../../../node_modules/@effect/docgen/schema.json", "exclude": ["src/Generated.ts", "src/internal/**/*.ts"], + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/ai/openai/src/", "examplesCompilerOptions": { "noEmit": true, "strict": true, diff --git a/packages/cli/docgen.json b/packages/cli/docgen.json index 19c67e93de3..c354ad3a89d 100644 --- a/packages/cli/docgen.json +++ b/packages/cli/docgen.json @@ -1,6 +1,7 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", "exclude": ["src/internal/**/*.ts"], + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/cli/src/", "examplesCompilerOptions": { "noEmit": true, "strict": true, diff --git a/packages/cluster-browser/docgen.json b/packages/cluster-browser/docgen.json index f980a32f522..e161d05ac3e 100644 --- a/packages/cluster-browser/docgen.json +++ b/packages/cluster-browser/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/cluster-browser/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/cluster-node/docgen.json b/packages/cluster-node/docgen.json index f980a32f522..b437ce438ff 100644 --- a/packages/cluster-node/docgen.json +++ b/packages/cluster-node/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/cluster-node/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/cluster-workflow/docgen.json b/packages/cluster-workflow/docgen.json index f980a32f522..98c6178ea58 100644 --- a/packages/cluster-workflow/docgen.json +++ b/packages/cluster-workflow/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/cluster-workflow/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/cluster/docgen.json b/packages/cluster/docgen.json index f980a32f522..81dbcf2e242 100644 --- a/packages/cluster/docgen.json +++ b/packages/cluster/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/cluster/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/effect/docgen.json b/packages/effect/docgen.json index 4ae72f91073..db2c73e9f7c 100644 --- a/packages/effect/docgen.json +++ b/packages/effect/docgen.json @@ -1,7 +1,7 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", "exclude": ["src/internal/**/*.ts"], - "srcLink": "https://github.com/Effect-TS/effect/tree/next-docgen/packages/effect/src/", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/effect/src/", "examplesCompilerOptions": { "noEmit": true, "strict": true, diff --git a/packages/experimental/docgen.json b/packages/experimental/docgen.json new file mode 100644 index 00000000000..e684c3e2c50 --- /dev/null +++ b/packages/experimental/docgen.json @@ -0,0 +1,5 @@ +{ + "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/experimental/src/", + "exclude": ["src/internal/**/*.ts"] +} diff --git a/packages/opentelemetry/docgen.json b/packages/opentelemetry/docgen.json index f980a32f522..e1ab57fc6f8 100644 --- a/packages/opentelemetry/docgen.json +++ b/packages/opentelemetry/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/opentelemetry/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/platform-browser/docgen.json b/packages/platform-browser/docgen.json index f980a32f522..a3533704040 100644 --- a/packages/platform-browser/docgen.json +++ b/packages/platform-browser/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform-browser/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/platform-bun/docgen.json b/packages/platform-bun/docgen.json index eb4f9983fa3..6d0200410f0 100644 --- a/packages/platform-bun/docgen.json +++ b/packages/platform-bun/docgen.json @@ -1,4 +1,5 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform-bun/src/", "exclude": ["src/internal/**/*.ts"] } diff --git a/packages/platform-node-shared/docgen.json b/packages/platform-node-shared/docgen.json index f980a32f522..da9c0ef34d7 100644 --- a/packages/platform-node-shared/docgen.json +++ b/packages/platform-node-shared/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform-node-shared/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/platform-node/docgen.json b/packages/platform-node/docgen.json index 800dd656175..06620a29456 100644 --- a/packages/platform-node/docgen.json +++ b/packages/platform-node/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform-node/src/", "exclude": ["src/internal/**/*.ts"], "examplesCompilerOptions": { "noEmit": true, diff --git a/packages/platform/docgen.json b/packages/platform/docgen.json index 42c17df2c03..b744135cad6 100644 --- a/packages/platform/docgen.json +++ b/packages/platform/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform/src/", "exclude": ["src/internal/**/*.ts"], "examplesCompilerOptions": { "noEmit": true, diff --git a/packages/printer-ansi/docgen.json b/packages/printer-ansi/docgen.json index aae10eb9d6e..a38368f4036 100644 --- a/packages/printer-ansi/docgen.json +++ b/packages/printer-ansi/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/printer-ansi/src/", "exclude": [ "src/internal/**/*.ts" ], diff --git a/packages/printer/docgen.json b/packages/printer/docgen.json index 1834654487a..809be75be43 100644 --- a/packages/printer/docgen.json +++ b/packages/printer/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/printer/src/", "exclude": ["src/internal/**/*.ts"], "examplesCompilerOptions": { "noEmit": true, diff --git a/packages/rpc-http/docgen.json b/packages/rpc-http/docgen.json index f980a32f522..93188b0ddac 100644 --- a/packages/rpc-http/docgen.json +++ b/packages/rpc-http/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/rpc-http/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/rpc/docgen.json b/packages/rpc/docgen.json index f980a32f522..8aa3b0fb60a 100644 --- a/packages/rpc/docgen.json +++ b/packages/rpc/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/rpc/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-clickhouse/docgen.json b/packages/sql-clickhouse/docgen.json index f980a32f522..7927fe0ea64 100644 --- a/packages/sql-clickhouse/docgen.json +++ b/packages/sql-clickhouse/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-clickhouse/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-d1/docgen.json b/packages/sql-d1/docgen.json index f980a32f522..58bfb926e6c 100644 --- a/packages/sql-d1/docgen.json +++ b/packages/sql-d1/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-d1/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-drizzle/docgen.json b/packages/sql-drizzle/docgen.json index f980a32f522..daa79a796e6 100644 --- a/packages/sql-drizzle/docgen.json +++ b/packages/sql-drizzle/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-drizzle/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-kysely/docgen.json b/packages/sql-kysely/docgen.json index f980a32f522..3f8f2d4a849 100644 --- a/packages/sql-kysely/docgen.json +++ b/packages/sql-kysely/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-kysely/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-libsql/docgen.json b/packages/sql-libsql/docgen.json index f980a32f522..99d38b1779d 100644 --- a/packages/sql-libsql/docgen.json +++ b/packages/sql-libsql/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-libsql/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-mssql/docgen.json b/packages/sql-mssql/docgen.json index f980a32f522..e87b0e3021e 100644 --- a/packages/sql-mssql/docgen.json +++ b/packages/sql-mssql/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-mssql/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-mysql2/docgen.json b/packages/sql-mysql2/docgen.json index f980a32f522..c7449c2b6a2 100644 --- a/packages/sql-mysql2/docgen.json +++ b/packages/sql-mysql2/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-mysql2/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-pg/docgen.json b/packages/sql-pg/docgen.json index f980a32f522..215487e77aa 100644 --- a/packages/sql-pg/docgen.json +++ b/packages/sql-pg/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-pg/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-sqlite-bun/docgen.json b/packages/sql-sqlite-bun/docgen.json index f980a32f522..2756c7b75d3 100644 --- a/packages/sql-sqlite-bun/docgen.json +++ b/packages/sql-sqlite-bun/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-sqlite-bun/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-sqlite-do/docgen.json b/packages/sql-sqlite-do/docgen.json index f980a32f522..bb5a5f199ae 100644 --- a/packages/sql-sqlite-do/docgen.json +++ b/packages/sql-sqlite-do/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-sqlite-do/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-sqlite-node/docgen.json b/packages/sql-sqlite-node/docgen.json index f980a32f522..a249985e536 100644 --- a/packages/sql-sqlite-node/docgen.json +++ b/packages/sql-sqlite-node/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-sqlite-node/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-sqlite-react-native/docgen.json b/packages/sql-sqlite-react-native/docgen.json index f980a32f522..22b2469da96 100644 --- a/packages/sql-sqlite-react-native/docgen.json +++ b/packages/sql-sqlite-react-native/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-sqlite-react-native/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql-sqlite-wasm/docgen.json b/packages/sql-sqlite-wasm/docgen.json index f980a32f522..299269544ae 100644 --- a/packages/sql-sqlite-wasm/docgen.json +++ b/packages/sql-sqlite-wasm/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql-sqlite-wasm/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/sql/docgen.json b/packages/sql/docgen.json index f980a32f522..e5bd31dc415 100644 --- a/packages/sql/docgen.json +++ b/packages/sql/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/src/", "exclude": [ "src/internal/**/*.ts" ] diff --git a/packages/typeclass/docgen.json b/packages/typeclass/docgen.json index 05c4022684c..24222878f1b 100644 --- a/packages/typeclass/docgen.json +++ b/packages/typeclass/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/typeclass/src/", "exclude": ["src/internal/**/*.ts"], "examplesCompilerOptions": { "noEmit": true, diff --git a/packages/vitest/docgen.json b/packages/vitest/docgen.json index b3d56de262a..8e38dcde772 100644 --- a/packages/vitest/docgen.json +++ b/packages/vitest/docgen.json @@ -1,5 +1,6 @@ { "$schema": "../../node_modules/@effect/docgen/schema.json", + "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/vitest/src/", "exclude": [ "src/internal.ts" ], From 222477911874ad72965e85548e8deb82b96442a9 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sun, 9 Mar 2025 17:01:58 +0100 Subject: [PATCH 13/16] Remove redundant comment in Config documentation --- packages/effect/src/Config.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/effect/src/Config.ts b/packages/effect/src/Config.ts index 78df4b05a8b..12fbe449cd4 100644 --- a/packages/effect/src/Config.ts +++ b/packages/effect/src/Config.ts @@ -218,9 +218,6 @@ export const duration: (name?: string) => Config = internal.d * use `isConfig` to check the type of a value before using it as an * argument to a function that expects an `Config` value. * - * @returns `true` if the specified value is a `Config` value, `false` - * otherwise. - * * @since 2.0.0 * @category refinements */ From 43575f467c9cb80f5c5dc0b74042b8db5ce03c2c Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sun, 9 Mar 2025 17:48:26 +0100 Subject: [PATCH 14/16] Add @effect/typeclass paths to docgen.json configuration --- packages/printer/docgen.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/printer/docgen.json b/packages/printer/docgen.json index 809be75be43..365cc068ab5 100644 --- a/packages/printer/docgen.json +++ b/packages/printer/docgen.json @@ -14,7 +14,9 @@ "effect": ["../../../effect/src/index.js"], "effect/*": ["../../../effect/src/*.js"], "@effect/printer": ["../../../printer/src/index.js"], - "@effect/printer/*": ["../../../printer/src/*.js"] + "@effect/printer/*": ["../../../printer/src/*.js"], + "@effect/typeclass": ["../../../typeclass/src/index.js"], + "@effect/typeclass/*": ["../../../typeclass/src/*.js"] } } } From 21a744bab15384ac4fc70b79ab7e35847a544539 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sun, 9 Mar 2025 17:58:05 +0100 Subject: [PATCH 15/16] Simplify import statements in Prompt documentation example --- packages/cli/src/Prompt.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/cli/src/Prompt.ts b/packages/cli/src/Prompt.ts index 5f32ae6e69f..a130f9860d0 100644 --- a/packages/cli/src/Prompt.ts +++ b/packages/cli/src/Prompt.ts @@ -520,8 +520,6 @@ export declare namespace All { * * ```ts * import * as Prompt from "@effect/cli/Prompt" - * import * as NodeContext from "@effect/platform-node/NodeContext" - * import * as Runtime from "@effect/platform-node/NodeRuntime" * import * as Effect from "effect/Effect" * * const username = Prompt.text({ From 6b848c309623920eadf42fbe1533fa3f83632d19 Mon Sep 17 00:00:00 2001 From: Giulio Canti Date: Sun, 9 Mar 2025 18:05:24 +0100 Subject: [PATCH 16/16] fix cli docgen.json --- packages/cli/docgen.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/cli/docgen.json b/packages/cli/docgen.json index c354ad3a89d..56425adfd1b 100644 --- a/packages/cli/docgen.json +++ b/packages/cli/docgen.json @@ -13,6 +13,22 @@ "paths": { "effect": ["../../../effect/src/index.js"], "effect/*": ["../../../effect/src/*.js"], + "@effect/platform": ["../../../platform/src/index.js"], + "@effect/platform/*": ["../../../platform/src/*.js"], + "@effect/platform-node": ["../../../platform-node/src/index.js"], + "@effect/platform-node/*": ["../../../platform-node/src/*.js"], + "@effect/platform-node-shared": [ + "../../../platform-node-shared/src/index.js" + ], + "@effect/platform-node-shared/*": [ + "../../../platform-node-shared/src/*.js" + ], + "@effect/printer": ["../../../printer/src/index.js"], + "@effect/printer/*": ["../../../printer/src/*.js"], + "@effect/printer-ansi": ["../../../printer-ansi/src/index.js"], + "@effect/printer-ansi/*": ["../../../printer-ansi/src/*.js"], + "@effect/typeclass": ["../../../typeclass/src/index.js"], + "@effect/typeclass/*": ["../../../typeclass/src/*.js"], "@effect/cli": ["../../../cli/src/index.js"], "@effect/cli/*": ["../../../cli/src/*.js"] }