{
  "id": "@typed/fx#RefArray.last",
  "canonicalId": "@typed/fx/RefArray#last",
  "symbol": {
    "id": "@typed/fx#RefArray.last",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "RefArray.last",
    "kind": "constant",
    "signatures": [
      "export declare const last: <A, E, R>(ref: RefArray<A, E, R>) => RefSubject.Filtered<A, E, R>;"
    ],
    "summary": "Gets the last element of a `RefArray` as a `Filtered`.",
    "sections": {
      "Why": "Models the possibly absent result of last as Filtered state, so absence stays explicit while\nlater source versions can make a value available.",
      "Ownership and lifetime": "The last view retains no independent value. Its Effect read fails with NoSuchElement\nwhile absent; the observing Scope owns and finalizes its Fx subscription."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as RefArray from \"@typed/fx/RefArray\"\n\nconst program = Effect.gen(function* () {\n  const items = yield* RefArray.make([1, 2, 3, 4, 5])\n\n  const last = RefArray.last(items)\n  const value = yield* last\n  console.log(value) // 5\n\n  // If array becomes empty, Filtered will fail\n  yield* RefArray.set(items, [])\n  // yield* last would fail with NoSuchElementError\n})"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/RefSubject/RefArray.ts",
      "line": 824
    },
    "since": "1.18.0",
    "category": "Optional queries"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#RefArray.last",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "RefArray",
    "qualifiedName": "RefArray.last",
    "declarationKey": "declaration:ae6f466dcddea1c45d4668d0",
    "family": "variable",
    "signatures": [
      "export declare const last: <A, E, R>(ref: RefArray<A, E, R>) => RefSubject.Filtered<A, E, R>;"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/RefSubject/RefArray.ts",
        "start": {
          "line": 824,
          "column": 14
        },
        "end": {
          "line": 825,
          "column": 48
        }
      }
    ],
    "aliases": [
      "@typed/fx/RefArray#last"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#RefArray",
    "static": false,
    "importedFrom": "declaration:ae6f466dcddea1c45d4668d0"
  },
  "declaration": {
    "declarationKey": "declaration:ae6f466dcddea1c45d4668d0",
    "name": "last",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const last: <A, E, R>(ref: RefArray<A, E, R>) => RefSubject.Filtered<A, E, R>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/RefSubject/RefArray.ts",
            "start": {
              "line": 824,
              "column": 14
            },
            "end": {
              "line": 825,
              "column": 48
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const last: <A, E, R>(ref: RefArray<A, E, R>) => RefSubject.Filtered<A, E, R>;"
    ],
    "typeParameters": [],
    "summary": "Gets the last element of a `RefArray` as a `Filtered`.",
    "sections": {
      "Why": "Models the possibly absent result of last as Filtered state, so absence stays explicit while\nlater source versions can make a value available.",
      "Ownership and lifetime": "The last view retains no independent value. Its Effect read fails with NoSuchElement\nwhile absent; the observing Scope owns and finalizes its Fx subscription."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as RefArray from \"@typed/fx/RefArray\"\n\nconst program = Effect.gen(function* () {\n  const items = yield* RefArray.make([1, 2, 3, 4, 5])\n\n  const last = RefArray.last(items)\n  const value = yield* last\n  console.log(value) // 5\n\n  // If array becomes empty, Filtered will fail\n  yield* RefArray.set(items, [])\n  // yield* last would fail with NoSuchElementError\n})"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/RefSubject/RefArray.ts",
        "start": {
          "line": 824,
          "column": 14
        },
        "end": {
          "line": 825,
          "column": 48
        }
      }
    ],
    "since": "1.18.0",
    "category": "Optional queries"
  }
}
