{
  "id": "@typed/router/Parser#Parser.Optional",
  "canonicalId": "@typed/router/Parser#Parser.Optional",
  "symbol": {
    "id": "@typed/router/Parser#Parser.Optional",
    "packageName": "@typed/router",
    "moduleName": "Parser",
    "exportName": "Parser.Optional",
    "kind": "interface",
    "signatures": [
      "interface Optional<P extends Any> extends Parser<unknown> {\n    readonly return: InputOf<this> extends infer Input extends string ? Apply<P, Input> extends infer R ? [\n        R\n    ] extends [\n        never\n    ] ? readonly [\n        undefined,\n        Input\n    ] : R extends readonly [\n        infer Value,\n        infer Rest extends string\n    ] ? readonly [\n        Value,\n        Rest\n    ] : never : never : never;\n}"
    ],
    "summary": "Returns `undefined` and the original input when its parser fails.",
    "sections": {
      "Why": "Optional grammar does not consume input on the absent branch.",
      "Ownership and lifetime": "TypeScript instantiates `Optional` while parsing a string-literal input. Its present or absent\nresult and unchanged failure remainder exist only in the resulting type.",
      "Property: return": "Computes this type lambda's parse result for its current input.",
      "Property: return: Why": "The local type-function protocol evaluates each parser combinator through this member without a parallel runtime object.",
      "Property: return: Ownership and lifetime": "TypeScript evaluates `Optional.return` when the surrounding parser is applied; the associated result is erased and retains no input at runtime."
    },
    "examples": [],
    "relations": [],
    "source": {
      "file": "packages/router/src/Parser.ts",
      "line": 639
    },
    "since": "1.0.0",
    "category": "Parser composition"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/router/Parser#Parser.Optional",
    "packageName": "@typed/router",
    "packageVersion": "1.0.0-beta.7",
    "moduleName": "Parser",
    "consumerSpecifier": "@typed/router/Parser",
    "exportName": "Parser",
    "qualifiedName": "Parser.Optional",
    "declarationKey": "declaration:5f2593ba4690ac18da829ecd",
    "family": "interface",
    "signatures": [
      "interface Optional<P extends Any> extends Parser<unknown> {\n    readonly return: InputOf<this> extends infer Input extends string ? Apply<P, Input> extends infer R ? [\n        R\n    ] extends [\n        never\n    ] ? readonly [\n        undefined,\n        Input\n    ] : R extends readonly [\n        infer Value,\n        infer Rest extends string\n    ] ? readonly [\n        Value,\n        Rest\n    ] : never : never : never;\n}"
    ],
    "sourceSpans": [
      {
        "file": "packages/router/src/Parser.ts",
        "start": {
          "line": 639,
          "column": 3
        },
        "end": {
          "line": 662,
          "column": 4
        }
      },
      {
        "file": "packages/router/src/Parser.ts",
        "start": {
          "line": 653,
          "column": 5
        },
        "end": {
          "line": 661,
          "column": 15
        }
      }
    ],
    "aliases": [],
    "isAlias": false,
    "parentId": "@typed/router/Parser#Parser",
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:5f2593ba4690ac18da829ecd",
    "name": "Optional",
    "family": "interface",
    "facets": [
      {
        "family": "interface",
        "syntaxKind": "InterfaceDeclaration",
        "signatures": [
          "interface Optional<P extends Any> extends Parser<unknown> {\n    readonly return: InputOf<this> extends infer Input extends string ? Apply<P, Input> extends infer R ? [\n        R\n    ] extends [\n        never\n    ] ? readonly [\n        undefined,\n        Input\n    ] : R extends readonly [\n        infer Value,\n        infer Rest extends string\n    ] ? readonly [\n        Value,\n        Rest\n    ] : never : never : never;\n}"
        ],
        "typeParameters": [
          "P extends Any"
        ],
        "sourceSpans": [
          {
            "file": "packages/router/src/Parser.ts",
            "start": {
              "line": 639,
              "column": 3
            },
            "end": {
              "line": 662,
              "column": 4
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly return: InputOf<this> extends infer Input extends string ? Apply<P, Input> extends infer R ? [\n    R\n] extends [\n    never\n] ? readonly [\n    undefined,\n    Input\n] : R extends readonly [\n    infer Value,\n    infer Rest extends string\n] ? readonly [\n    Value,\n    Rest\n] : never : never : never;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Parser.ts",
            "start": {
              "line": 653,
              "column": 5
            },
            "end": {
              "line": 661,
              "column": 15
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      }
    ],
    "signatures": [
      "interface Optional<P extends Any> extends Parser<unknown> {\n    readonly return: InputOf<this> extends infer Input extends string ? Apply<P, Input> extends infer R ? [\n        R\n    ] extends [\n        never\n    ] ? readonly [\n        undefined,\n        Input\n    ] : R extends readonly [\n        infer Value,\n        infer Rest extends string\n    ] ? readonly [\n        Value,\n        Rest\n    ] : never : never : never;\n}"
    ],
    "typeParameters": [
      "P extends Any"
    ],
    "summary": "Returns `undefined` and the original input when its parser fails.",
    "sections": {
      "Why": "Optional grammar does not consume input on the absent branch.",
      "Ownership and lifetime": "TypeScript instantiates `Optional` while parsing a string-literal input. Its present or absent\nresult and unchanged failure remainder exist only in the resulting type.",
      "Property: return": "Computes this type lambda's parse result for its current input.",
      "Property: return: Why": "The local type-function protocol evaluates each parser combinator through this member without a parallel runtime object.",
      "Property: return: Ownership and lifetime": "TypeScript evaluates `Optional.return` when the surrounding parser is applied; the associated result is erased and retains no input at runtime."
    },
    "examples": [],
    "sourceSpans": [
      {
        "file": "packages/router/src/Parser.ts",
        "start": {
          "line": 639,
          "column": 3
        },
        "end": {
          "line": 662,
          "column": 4
        }
      },
      {
        "file": "packages/router/src/Parser.ts",
        "start": {
          "line": 653,
          "column": 5
        },
        "end": {
          "line": 661,
          "column": 15
        }
      }
    ],
    "since": "1.0.0",
    "category": "Parser composition"
  }
}
