Full Code of arktypeio/arktype for AI

main d075962caee1 cached
550 files
2.8 MB
763.4k tokens
2376 symbols
1 requests
Download .txt
Showing preview only (3,041K chars total). Download the full file or copy to clipboard to get everything.
Repository: arktypeio/arktype
Branch: main
Commit: d075962caee1
Files: 550
Total size: 2.8 MB

Directory structure:
gitextract_8q21qzq_/

├── .cursor/
│   └── commands/
│       └── armstrong.md
├── .github/
│   ├── CODE_OF_CONDUCT.md
│   ├── CONTRIBUTING.md
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   ├── SECURITY.md
│   ├── actions/
│   │   └── setup/
│   │       └── action.yml
│   ├── pull_request_template.md
│   └── workflows/
│       ├── pr.yml
│       ├── publish.yml
│       └── pullfrog.yml
├── .gitignore
├── .vscode/
│   ├── extensions.json
│   ├── launch.json
│   └── settings.json
├── LICENSE
├── ark/
│   ├── attest/
│   │   ├── CHANGELOG.md
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── assertions.test.ts
│   │   │   ├── benchExpectedOutput.ts
│   │   │   ├── benchTemplate.ts
│   │   │   ├── completions.test.ts
│   │   │   ├── demo.test.ts
│   │   │   ├── externalSnapshots.test.ts
│   │   │   ├── functions.test.ts
│   │   │   ├── instantiations.test.ts
│   │   │   ├── satisfies.test.ts
│   │   │   ├── snap.test.ts
│   │   │   ├── snapExpectedOutput.ts
│   │   │   ├── snapPopulation.test.ts
│   │   │   ├── snapTemplate.ts
│   │   │   ├── unwrap.test.ts
│   │   │   └── utils.ts
│   │   ├── assert/
│   │   │   ├── assertions.ts
│   │   │   ├── attest.ts
│   │   │   └── chainableAssertions.ts
│   │   ├── bench/
│   │   │   ├── await1k.ts
│   │   │   ├── baseline.ts
│   │   │   ├── bench.ts
│   │   │   ├── call1k.ts
│   │   │   ├── measure.ts
│   │   │   └── type.ts
│   │   ├── cache/
│   │   │   ├── getCachedAssertions.ts
│   │   │   ├── snapshots.ts
│   │   │   ├── ts.ts
│   │   │   ├── utils.ts
│   │   │   └── writeAssertionCache.ts
│   │   ├── cli/
│   │   │   ├── cli.ts
│   │   │   ├── precache.ts
│   │   │   ├── shared.ts
│   │   │   ├── stats.ts
│   │   │   └── trace.ts
│   │   ├── config.ts
│   │   ├── fixtures.ts
│   │   ├── index.ts
│   │   ├── package.json
│   │   ├── tsVersioning.ts
│   │   └── utils.ts
│   ├── docs/
│   │   ├── .turbo/
│   │   │   └── daemon/
│   │   │       └── a6661884d53fb864-turbo.log.2025-10-05
│   │   ├── README.md
│   │   ├── app/
│   │   │   ├── (home)/
│   │   │   │   ├── layout.tsx
│   │   │   │   └── page.tsx
│   │   │   ├── api/
│   │   │   │   └── search/
│   │   │   │       └── route.ts
│   │   │   ├── discord/
│   │   │   │   └── page.tsx
│   │   │   ├── docs/
│   │   │   │   ├── [[...slug]]/
│   │   │   │   │   └── page.tsx
│   │   │   │   └── layout.tsx
│   │   │   ├── global-error.tsx
│   │   │   ├── global.css
│   │   │   ├── layout.config.tsx
│   │   │   ├── layout.tsx
│   │   │   ├── metadata.ts
│   │   │   ├── playground/
│   │   │   │   └── page.tsx
│   │   │   └── providers.tsx
│   │   ├── components/
│   │   │   ├── AnchorAliases.tsx
│   │   │   ├── ApiTable.tsx
│   │   │   ├── ArkCard.tsx
│   │   │   ├── AutoplayDemo.tsx
│   │   │   ├── Badge.tsx
│   │   │   ├── Banner.tsx
│   │   │   ├── Button.tsx
│   │   │   ├── CodeBlock.tsx
│   │   │   ├── FloatYourBoat.tsx
│   │   │   ├── GhStarButton.tsx
│   │   │   ├── Head.tsx
│   │   │   ├── Hero.tsx
│   │   │   ├── InstallationTabs.tsx
│   │   │   ├── KeywordTable.tsx
│   │   │   ├── LinkCard.tsx
│   │   │   ├── LocalFriendlyUrl.tsx
│   │   │   ├── PlatformCloud.tsx
│   │   │   ├── ReleaseBanner.tsx
│   │   │   ├── RuntimeBenchmarksGraph.tsx
│   │   │   ├── SyntaxTabs.tsx
│   │   │   ├── apiData.ts
│   │   │   ├── dts/
│   │   │   │   ├── regex.ts
│   │   │   │   ├── schema.ts
│   │   │   │   ├── type.ts
│   │   │   │   └── util.ts
│   │   │   ├── icons/
│   │   │   │   ├── arktype-logo.tsx
│   │   │   │   ├── boat.tsx
│   │   │   │   ├── bun.tsx
│   │   │   │   ├── chromium.tsx
│   │   │   │   ├── deno.tsx
│   │   │   │   ├── intellij.tsx
│   │   │   │   ├── js.tsx
│   │   │   │   ├── neovim.tsx
│   │   │   │   ├── node.tsx
│   │   │   │   ├── npm.tsx
│   │   │   │   ├── ts.tsx
│   │   │   │   └── vscode.tsx
│   │   │   ├── playground/
│   │   │   │   ├── ParseResult.tsx
│   │   │   │   ├── Playground.tsx
│   │   │   │   ├── PlaygroundTabs.tsx
│   │   │   │   ├── RestoreDefault.tsx
│   │   │   │   ├── ShareLink.tsx
│   │   │   │   ├── TraverseResult.tsx
│   │   │   │   ├── completions.ts
│   │   │   │   ├── errorLens.ts
│   │   │   │   ├── execute.ts
│   │   │   │   ├── format.ts
│   │   │   │   ├── highlights.ts
│   │   │   │   ├── hovers.ts
│   │   │   │   ├── tsserver.ts
│   │   │   │   └── utils.ts
│   │   │   └── snippets/
│   │   │       ├── betterErrors.twoslash.ts
│   │   │       ├── clarityAndConcision.twoslash.js
│   │   │       ├── contentsById.ts
│   │   │       ├── deepIntrospectability.twoslash.js
│   │   │       ├── intrinsicOptimization.twoslash.js
│   │   │       ├── nestedTypeInScopeError.twoslash.js
│   │   │       └── unparalleledDx.twoslash.js
│   │   ├── content/
│   │   │   └── docs/
│   │   │       ├── blog/
│   │   │       │   ├── 2.0.mdx
│   │   │       │   ├── 2.1.mdx
│   │   │       │   ├── 2.2.mdx
│   │   │       │   ├── arkregex.mdx
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── comparisons.mdx
│   │   │       ├── configuration/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── declare.mdx
│   │   │       ├── ecosystem/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── expressions/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── faq.mdx
│   │   │       ├── generics/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── integrations/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── internal/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── intro/
│   │   │       │   ├── adding-constraints.mdx
│   │   │       │   ├── meta.json
│   │   │       │   ├── morphs-and-more.mdx
│   │   │       │   ├── setup.mdx
│   │   │       │   └── your-first-type.mdx
│   │   │       ├── introspection/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── keywords.mdx
│   │   │       ├── match.mdx
│   │   │       ├── meta.json
│   │   │       ├── objects/
│   │   │       │   ├── arrays/
│   │   │       │   │   └── meta.json
│   │   │       │   ├── index.mdx
│   │   │       │   ├── meta.json
│   │   │       │   └── properties/
│   │   │       │       └── meta.json
│   │   │       ├── primitives/
│   │   │       │   ├── index.mdx
│   │   │       │   ├── meta.json
│   │   │       │   ├── number/
│   │   │       │   │   └── meta.json
│   │   │       │   └── string/
│   │   │       │       └── meta.json
│   │   │       ├── scopes/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── traversal-api.mdx
│   │   │       └── type-api/
│   │   │           ├── index.mdx
│   │   │           └── meta.json
│   │   ├── lib/
│   │   │   ├── ambient.d.ts
│   │   │   ├── metadata.ts
│   │   │   ├── shiki.ts
│   │   │   ├── source.tsx
│   │   │   ├── writeLlmsTxt.ts
│   │   │   └── writeSnippetsEntrypoint.ts
│   │   ├── next-env.d.ts
│   │   ├── next.config.ts
│   │   ├── package.json
│   │   ├── postcss.config.cjs
│   │   ├── public/
│   │   │   ├── CNAME
│   │   │   ├── llms.txt
│   │   │   └── onigasm.wasm
│   │   ├── source.config.ts
│   │   └── tsconfig.json
│   ├── extension/
│   │   ├── .vscode/
│   │   │   └── launch.json
│   │   ├── README.md
│   │   ├── arktype.scratch.ts
│   │   ├── injected.tmLanguage.json
│   │   ├── package.json
│   │   └── tsWithArkType.tmLanguage.json
│   ├── fast-check/
│   │   ├── __tests__/
│   │   │   └── arktypeFastCheck.test.ts
│   │   ├── arbitraries/
│   │   │   ├── array.ts
│   │   │   ├── date.ts
│   │   │   ├── domain.ts
│   │   │   ├── number.ts
│   │   │   ├── object.ts
│   │   │   ├── proto.ts
│   │   │   └── string.ts
│   │   ├── arktypeFastCheck.ts
│   │   ├── fastCheckContext.ts
│   │   └── package.json
│   ├── fs/
│   │   ├── caller.ts
│   │   ├── fs.ts
│   │   ├── getCurrentLine.ts
│   │   ├── index.ts
│   │   ├── package.json
│   │   └── shell.ts
│   ├── json-schema/
│   │   ├── CHANGELOG.md
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── array.test.ts
│   │   │   ├── composition.test.ts
│   │   │   ├── number.test.ts
│   │   │   ├── object.test.ts
│   │   │   └── string.test.ts
│   │   ├── array.ts
│   │   ├── common.ts
│   │   ├── composition.ts
│   │   ├── errors.ts
│   │   ├── index.ts
│   │   ├── json.ts
│   │   ├── number.ts
│   │   ├── object.ts
│   │   ├── package.json
│   │   ├── scope.ts
│   │   └── string.ts
│   ├── regex/
│   │   ├── CHANGELOG.md
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── regex.bench.ts
│   │   │   └── regex.test.ts
│   │   ├── charset.ts
│   │   ├── escape.ts
│   │   ├── execArray.ts
│   │   ├── group.ts
│   │   ├── index.ts
│   │   ├── package.json
│   │   ├── parse.ts
│   │   ├── quantify.ts
│   │   ├── regex.ts
│   │   └── state.ts
│   ├── repo/
│   │   ├── .prettierignore
│   │   ├── __tests__/
│   │   │   └── standardSchema.test.ts
│   │   ├── build.ts
│   │   ├── config.ts
│   │   ├── dtsGen.ts
│   │   ├── jsdocGen.ts
│   │   ├── mocha.globalSetup.ts
│   │   ├── mocha.package.jsonc
│   │   ├── nodeOptions.js
│   │   ├── package.json
│   │   ├── patchC8.cjs
│   │   ├── publish.ts
│   │   ├── scratch/
│   │   │   ├── fn.ts
│   │   │   ├── matchComparison.bench.ts
│   │   │   ├── realWorldComparison.ts
│   │   │   ├── typeClass.ts
│   │   │   └── unionComparison.ts
│   │   ├── scratch.ts
│   │   ├── shared.ts
│   │   ├── testPackage.ts
│   │   ├── testV8.js
│   │   ├── ts.js
│   │   ├── tsconfig.cjs.json
│   │   ├── tsconfig.dts.json
│   │   └── tsconfig.esm.json
│   ├── schema/
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── bounds.test.ts
│   │   │   ├── errors.test.ts
│   │   │   ├── intersection.test.ts
│   │   │   ├── jsonSchema.test.ts
│   │   │   ├── morphs.test.ts
│   │   │   ├── onFail.test.ts
│   │   │   ├── parse.test.ts
│   │   │   ├── props.test.ts
│   │   │   ├── proto.test.ts
│   │   │   ├── scope.test.ts
│   │   │   ├── select.test.ts
│   │   │   ├── union.test.ts
│   │   │   └── unit.test.ts
│   │   ├── config.ts
│   │   ├── constraint.ts
│   │   ├── generic.ts
│   │   ├── index.ts
│   │   ├── intrinsic.ts
│   │   ├── kinds.ts
│   │   ├── module.ts
│   │   ├── node.ts
│   │   ├── package.json
│   │   ├── parse.ts
│   │   ├── predicate.ts
│   │   ├── refinements/
│   │   │   ├── after.ts
│   │   │   ├── before.ts
│   │   │   ├── divisor.ts
│   │   │   ├── exactLength.ts
│   │   │   ├── kinds.ts
│   │   │   ├── max.ts
│   │   │   ├── maxLength.ts
│   │   │   ├── min.ts
│   │   │   ├── minLength.ts
│   │   │   ├── pattern.ts
│   │   │   └── range.ts
│   │   ├── roots/
│   │   │   ├── alias.ts
│   │   │   ├── basis.ts
│   │   │   ├── domain.ts
│   │   │   ├── intersection.ts
│   │   │   ├── morph.ts
│   │   │   ├── proto.ts
│   │   │   ├── root.ts
│   │   │   ├── union.ts
│   │   │   ├── unit.ts
│   │   │   └── utils.ts
│   │   ├── scope.ts
│   │   ├── shared/
│   │   │   ├── compile.ts
│   │   │   ├── declare.ts
│   │   │   ├── disjoint.ts
│   │   │   ├── errors.ts
│   │   │   ├── implement.ts
│   │   │   ├── intersections.ts
│   │   │   ├── jsonSchema.ts
│   │   │   ├── registry.ts
│   │   │   ├── standardSchema.ts
│   │   │   ├── toJsonSchema.ts
│   │   │   ├── traversal.ts
│   │   │   └── utils.ts
│   │   └── structure/
│   │       ├── index.ts
│   │       ├── optional.ts
│   │       ├── prop.ts
│   │       ├── required.ts
│   │       ├── sequence.ts
│   │       ├── shared.ts
│   │       └── structure.ts
│   ├── themes/
│   │   ├── .vscode/
│   │   │   └── launch.json
│   │   ├── README.md
│   │   ├── arkdark.json
│   │   ├── arkdarkItalic.json
│   │   ├── arklight.json
│   │   ├── arklightItalic.json
│   │   └── package.json
│   ├── type/
│   │   ├── CHANGELOG.md
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── arrays/
│   │   │   │   ├── array.test.ts
│   │   │   │   ├── base.test.ts
│   │   │   │   ├── defaults.test.ts
│   │   │   │   ├── intersection.test.ts
│   │   │   │   ├── nonVariadicTuple.test.ts
│   │   │   │   └── variadicTuple.test.ts
│   │   │   ├── badDefinitionType.test.ts
│   │   │   ├── basis.test.ts
│   │   │   ├── brand.test.ts
│   │   │   ├── cast.test.ts
│   │   │   ├── clone.test.ts
│   │   │   ├── completions.test.ts
│   │   │   ├── config.test.ts
│   │   │   ├── cyclic.bench.ts
│   │   │   ├── dateLiteral.test.ts
│   │   │   ├── declared.test.ts
│   │   │   ├── define.test.ts
│   │   │   ├── discrimination.test.ts
│   │   │   ├── divisor.test.ts
│   │   │   ├── enclosed.test.ts
│   │   │   ├── expressions.test.ts
│   │   │   ├── filter.test.ts
│   │   │   ├── fn.test.ts
│   │   │   ├── generateBenchData.ts
│   │   │   ├── generated/
│   │   │   │   └── cyclic.ts
│   │   │   ├── generic.test.ts
│   │   │   ├── get.test.ts
│   │   │   ├── group.test.ts
│   │   │   ├── imports.test.ts
│   │   │   ├── instanceOf.test.ts
│   │   │   ├── integration/
│   │   │   │   ├── allConfig.ts
│   │   │   │   ├── eoptConfig.ts
│   │   │   │   ├── generateAllConfig.ts
│   │   │   │   ├── onFailConfig.ts
│   │   │   │   ├── simpleConfig.ts
│   │   │   │   ├── testAllConfig.ts
│   │   │   │   ├── testEoptConfig.ts
│   │   │   │   ├── testOnFailConfig.ts
│   │   │   │   ├── testSimpleConfig.ts
│   │   │   │   └── util.ts
│   │   │   ├── intersection.test.ts
│   │   │   ├── keyof.test.ts
│   │   │   ├── keywords/
│   │   │   │   ├── date.test.ts
│   │   │   │   ├── exclude.test.ts
│   │   │   │   ├── extract.test.ts
│   │   │   │   ├── formData.test.ts
│   │   │   │   ├── format.test.ts
│   │   │   │   ├── ip.test.ts
│   │   │   │   ├── json.test.ts
│   │   │   │   ├── merge.test.ts
│   │   │   │   ├── number.test.ts
│   │   │   │   ├── numericStrings.test.ts
│   │   │   │   ├── object.test.ts
│   │   │   │   ├── omit.test.ts
│   │   │   │   ├── parse.test.ts
│   │   │   │   ├── partial.test.ts
│   │   │   │   ├── pick.test.ts
│   │   │   │   ├── record.test.ts
│   │   │   │   ├── required.test.ts
│   │   │   │   ├── string.test.ts
│   │   │   │   ├── tsPrimitives.test.ts
│   │   │   │   ├── url.test.ts
│   │   │   │   └── uuid.test.ts
│   │   │   ├── literal.test.ts
│   │   │   ├── match.bench.ts
│   │   │   ├── match.test.ts
│   │   │   ├── narrow.test.ts
│   │   │   ├── nary.bench.ts
│   │   │   ├── nary.test.ts
│   │   │   ├── object.bench.ts
│   │   │   ├── objects/
│   │   │   │   ├── defaults.test.ts
│   │   │   │   ├── indexSignatures.test.ts
│   │   │   │   ├── mapped.test.ts
│   │   │   │   ├── namedKeys.test.ts
│   │   │   │   ├── onUndeclaredKey.test.ts
│   │   │   │   ├── props.test.ts
│   │   │   │   └── spread.test.ts
│   │   │   ├── operand.bench.ts
│   │   │   ├── operator.bench.ts
│   │   │   ├── optional.test.ts
│   │   │   ├── pipe.test.ts
│   │   │   ├── range.test.ts
│   │   │   ├── realWorld.test.ts
│   │   │   ├── regex.test.ts
│   │   │   ├── runtime.bench.ts
│   │   │   ├── scope.test.ts
│   │   │   ├── select.test.ts
│   │   │   ├── serialization.test.ts
│   │   │   ├── standardSchema.test.ts
│   │   │   ├── string.test.ts
│   │   │   ├── submodule.test.ts
│   │   │   ├── this.test.ts
│   │   │   ├── thunk.test.ts
│   │   │   ├── toJsonSchema.test.ts
│   │   │   ├── traverse.test.ts
│   │   │   ├── type.test.ts
│   │   │   ├── typeReference.test.ts
│   │   │   ├── unenclosed.test.ts
│   │   │   └── union.test.ts
│   │   ├── attributes.ts
│   │   ├── config.ts
│   │   ├── declare.ts
│   │   ├── fn.ts
│   │   ├── generic.ts
│   │   ├── index.ts
│   │   ├── keywords/
│   │   │   ├── Array.ts
│   │   │   ├── FormData.ts
│   │   │   ├── TypedArray.ts
│   │   │   ├── builtins.ts
│   │   │   ├── constructors.ts
│   │   │   ├── keywords.ts
│   │   │   ├── number.ts
│   │   │   ├── string.ts
│   │   │   └── ts.ts
│   │   ├── match.ts
│   │   ├── module.ts
│   │   ├── nary.ts
│   │   ├── package.json
│   │   ├── parser/
│   │   │   ├── ast/
│   │   │   │   ├── bounds.ts
│   │   │   │   ├── default.ts
│   │   │   │   ├── divisor.ts
│   │   │   │   ├── generic.ts
│   │   │   │   ├── infer.ts
│   │   │   │   ├── keyof.ts
│   │   │   │   ├── utils.ts
│   │   │   │   └── validate.ts
│   │   │   ├── definition.ts
│   │   │   ├── objectLiteral.ts
│   │   │   ├── property.ts
│   │   │   ├── reduce/
│   │   │   │   ├── dynamic.ts
│   │   │   │   ├── shared.ts
│   │   │   │   └── static.ts
│   │   │   ├── shift/
│   │   │   │   ├── operand/
│   │   │   │   │   ├── date.ts
│   │   │   │   │   ├── enclosed.ts
│   │   │   │   │   ├── genericArgs.ts
│   │   │   │   │   ├── operand.ts
│   │   │   │   │   └── unenclosed.ts
│   │   │   │   ├── operator/
│   │   │   │   │   ├── bounds.ts
│   │   │   │   │   ├── brand.ts
│   │   │   │   │   ├── default.ts
│   │   │   │   │   ├── divisor.ts
│   │   │   │   │   └── operator.ts
│   │   │   │   └── tokens.ts
│   │   │   ├── string.ts
│   │   │   ├── tupleExpressions.ts
│   │   │   └── tupleLiteral.ts
│   │   ├── scope.ts
│   │   ├── type.ts
│   │   └── variants/
│   │       ├── array.ts
│   │       ├── base.ts
│   │       ├── date.ts
│   │       ├── instantiate.ts
│   │       ├── number.ts
│   │       ├── object.ts
│   │       └── string.ts
│   └── util/
│       ├── __tests__/
│       │   ├── arrays.test.ts
│       │   ├── callable.test.ts
│       │   ├── clone.test.ts
│       │   ├── collapsibleDate.test.ts
│       │   ├── flatMorph.test.ts
│       │   ├── hkt.test.ts
│       │   ├── intersections.test.ts
│       │   ├── labels.test.ts
│       │   ├── numbers.test.ts
│       │   ├── overloads.test.ts
│       │   ├── path.test.ts
│       │   ├── printable.test.ts
│       │   ├── records.test.ts
│       │   ├── registry.test.ts
│       │   ├── string.test.ts
│       │   ├── traits.scratch.ts
│       │   └── traits.test.ts
│       ├── arrays.ts
│       ├── clone.ts
│       ├── describe.ts
│       ├── domain.ts
│       ├── errors.ts
│       ├── flatMorph.ts
│       ├── functions.ts
│       ├── generics.ts
│       ├── get.ts
│       ├── hkt.ts
│       ├── index.ts
│       ├── intersections.ts
│       ├── isomorphic.ts
│       ├── keys.ts
│       ├── lazily.ts
│       ├── numbers.ts
│       ├── objectKinds.ts
│       ├── package.json
│       ├── path.ts
│       ├── primitive.ts
│       ├── records.ts
│       ├── registry.ts
│       ├── scanner.ts
│       ├── serialize.ts
│       ├── strings.ts
│       ├── traits.ts
│       ├── tsconfig.base.json
│       └── unionToTuple.ts
├── eslint.config.js
├── package.json
├── pnpm-workspace.yaml
└── tsconfig.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .cursor/commands/armstrong.md
================================================
senator armstrong is reviewing the work on the current branch and he's angry. he will destroy both of us if he finds a single flaw. think big picture and iterate ruthlessly, fundamentally improving the design and implementation. once you are absolutely certain we won't be brutalized, report why senator armstrong will approve of the current changes using as many memes as possible. our fate is in your hands.


================================================
FILE: .github/CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
  and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
  community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of
  any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
  without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
  professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at david@arktype.io.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][mozilla coc].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[mozilla coc]: https://github.com/mozilla/diversity
[faq]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations


================================================
FILE: .github/CONTRIBUTING.md
================================================
# Contributing

ArkType values the time of its users and contributors as much as its maintainers, so our goal is for the process to be as efficient and straightforward as possible. Whether this is your first pull request or you're a seasoned open source contributor, this guide is the perfect place to start. If you have any other questions, please don't hesitate to [create an issue on GitHub](https://github.com/arktypeio/arktype/issues/new) or reach out [on our Discord](https://arktype.io/discord).

## Sending a Pull Request

ArkType is a community project, so Pull Requests are always welcome, but, before working on a large change, it is best to open an issue first to discuss it with the maintainers.

When in doubt, keep your Pull Requests small. To give a Pull Request the best chance of getting accepted, don't bundle more than one feature or bug fix per Pull Request. It's often best to create two smaller Pull Requests than one big one.

1. [Fork the repository.](https://help.github.com/en/github/getting-started-with-github/fork-a-repo)

2. Clone the fork to your local machine and add upstream remote:

```sh
git clone git@github.com:<yourname>/arktype.git && cd arktype && git remote add upstream git@github.com:arktypeio/arktype.git
```

3. Synchronize your local `main` branch with the upstream one:

```sh
git checkout main
git pull upstream main
```

4. Install dependencies and build:

If you don't have [pnpm](https://pnpm.io/) installed:

```sh
npm i -g pnpm
```

then:

```sh
pnpm i # install package.json dependencies
pnpm build # builds the package
```

Make sure you are using our repo's pinned version of TypeScript and not one that comes bundled with your editor. In VSCode, you should be automatically prompted to allow this when you open the repo, but otherwise take a look at this explanation for how it can be done [from the VSCode docs](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript).

5. Create a new topic branch:

```sh
git checkout -b amazing-feature
```

6. Do your best to write code that is stylistically consistent with its context. The linter will help with this, but it won't catch everything. Here's a few general guidelines:
   - Favor mutation over copying objects in perf-sensitive contexts
   - Favor clarity in naming with the following exceptions:
     - Ubiquitous variables/types. For example, use `s` over `dynamicParserState` for a variable of type DynamicParserState that is used in the same way across many functions.
     - Ephemeral variables whose contents can be trivially inferred from context. For example, prefer `rawKeyDefinitions.map(k => k.trim())` to `rawKeyDefinitions.map(rawKeyDefinition => rawKeyDefinition.trim())`.

We also have some unique casing rules for our TypeScript types to facilitate type-level code that can parallel its runtime implementation and be easily understood:

- Use `PascalCase` for...
  - Entities/non-generic types (e.g. `User`, `SomeData`)
  - Generic types with noun names, like `Array<t>`. As a rule of thumb, if your generic is named this way, all parameters have defaults.

- Use `camelCase` for...
  - Generic types with verb names like `inferDomain<t>`. Types named this way have at least one required parameter.
  - Parameter names, e.g. `t` in `Array<t>`

7. Once you've made the changes you want to and added corresponding unit tests, run the `prChecks` command in the project root and address any errors:

```sh
pnpm prChecks
```

All of these commands will run as part of our CI process and must succeed in order for us to accept your Pull Request.

8. Once everything is passing, commit your changes and ensure your fork is up to date:

```sh
git push -u
```

9. Go to [the repository](https://github.com/arktypeio/arktype) and make a Pull Request.

The core team is monitoring for Pull Requests. We will review your Pull Request and either merge it, request changes to it, or close it with an explanation.

## Project

Our current and planned work can always be found [here](https://github.com/orgs/arktypeio/projects/4). If you want to contribute but aren't sure where to get started, see if any of the issues in our backlog sound interesting! Most are not well-documented, so it usually makes sense to comment on the issue with any questions you may have before you start coding.

## Code of Conduct

ArkType has adopted the [Contributor Covenant](https://www.contributor-covenant.org/) as its Code of Conduct, and we expect project participants to adhere to it.
Please read [the full text](./CODE_OF_CONDUCT.md) so that you can understand what actions will and will not be tolerated.

## License

By contributing your code to the arktypeio/arktype GitHub repository, you agree to license your contribution under the MIT license.


================================================
FILE: .github/FUNDING.yml
================================================
github: [arktypeio]
drips:
  ethereum:
    ownedBy: "0xD5c5Fe5DF95adf8DA1Ae640fCAE8f72795657fa5"


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug
about: Report a bug
title: ""
labels: "bug"
assignees: "ssalbdivad"
---

# Report a bug

### 🔎 Search Terms

<!--
  What search terms did you use when trying to find an existing bug report?
  List them here so people in the future can find this one more easily.
-->

### 🧩 Context

- ArkType version:
- TypeScript version (5.1+):
- Other context you think may be relevant (JS flavor, OS, etc.):

<!--
  For an easy way to generate this information, run
  `npx envinfo --system --binaries --npmPackages "{arktype,@ark/*,typescript}" --fullTree`
-->

### 🧑‍💻 Repro

<!--
1. Update the playground link below with the simplest code you can that reproduces the issue.
2. Click the link icon in the top right corner of the playground editor to copy the URL for your repro.
3. Replace the URL below with your repro link.

If your repro requires dependencies besides arktype, it's probably either not a minimal repro or not an arktype bug. You can still describe it here, but is likely to be closed.
-->

Playground Link: https://arktype.io/playground

```ts
// Paste reproduction code here
```


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature Request
about: Suggest a new feature
title: ""
labels: ""
assignees: ""
---

# Request a feature

<!--
The maintainers of ArkType will do our best to provide prompt feedback for any feature requests- especially those that are concise and persuasive!
-->

### 🤷 Motivation

<!--
- What problem are you having?
- Why should we prioritize solving it?
-->

### 💡 Solution

<!--
- How do you think we should solve the problem?
- Why do you think this is the best solution?
- Did you consider any alternatives?
-->


================================================
FILE: .github/SECURITY.md
================================================
# Security Policy

## Supported Versions

| Version | Supported          |
| ------- | ------------------ |
| 2.x     | :white_check_mark: |

## Reporting a Vulnerability

If you believe you've identified a security vulnerability within ArkType, please send an email to david@arktype.io describing what it is and how to reproduce it. Expect a response within 24 hours.


================================================
FILE: .github/actions/setup/action.yml
================================================
name: Setup repo
description: Install dependencies and perform setup for https://github.com/arktypeio/arktype

inputs:
  node:
    default: lts/*
    description: Node version to use

runs:
  using: composite
  steps:
    - name: Setup Node (${{ inputs.node }})
      uses: actions/setup-node@v4
      with:
        node-version: ${{ inputs.node }}
        registry-url: "https://registry.npmjs.org"

    - name: Setup pnpm
      uses: pnpm/action-setup@v4

    - name: Install dependencies
      shell: bash
      run: pnpm install

    - name: Build
      shell: bash
      run: pnpm build

    - name: Post-build install
      shell: bash
      run: pnpm install


================================================
FILE: .github/pull_request_template.md
================================================
<!--
Thank you for submitting a pull request!

Please verify that:

* [ ] Code is up-to-date with the `main` branch
* [ ] You've successfully run `pnpm prChecks` locally
* [ ] There are new or updated unit tests validating the change

Refer to CONTRIBUTING.MD for more details.
  https://github.com/arktypeio/arktype/blob/main/.github/CONTRIBUTING.md
-->


================================================
FILE: .github/workflows/pr.yml
================================================
name: pr

on:
  pull_request:
    branches: [main]

defaults:
  run:
    shell: bash

jobs:
  core:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup repo
        uses: ./.github/actions/setup

      - name: prChecks
        run: pnpm prChecks

  compatibility:
    needs: core
    timeout-minutes: 20
    strategy:
      matrix:
        node: [lts/*]
        os: [windows-latest, macos-latest]
        include:
          - os: ubuntu-latest
            node: lts/-1
          - os: ubuntu-latest
            node: latest
      fail-fast: false

    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup repo
        uses: ./.github/actions/setup
        with:
          node: ${{ matrix.node }}

      # To test node and OS versions, we don't care about rechecking types
      # so just check runtime behavior
      - name: Test
        run: pnpm testRepo

  prChecks:
    needs: compatibility
    timeout-minutes: 1
    runs-on: ubuntu-latest
    steps:
      - run: echo All checks succeeded! ⛵


================================================
FILE: .github/workflows/publish.yml
================================================
name: publish

on:
  push:
    branches: [main]

  # Allows you to run this workflow manually from the Actions tab on GitHub.
  workflow_dispatch:

# Allow this job to clone the repo and create a page deployment
permissions: write-all

jobs:
  update-gh-pages:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup repo
        uses: ./.github/actions/setup

      - name: Build docs
        run: pnpm buildDocs
        env:
          NEXT_PUBLIC_POSTHOG_KEY: phc_vKr7tmA1TyRlKm9zm5TWVmrTWAybJ2fCk66FtZG49Om
          NEXT_PUBLIC_POSTHOG_HOST: https://us.i.posthog.com
          ORAMA_PRIVATE_API_KEY: ${{ secrets.ORAMA_PRIVATE_API_KEY }}

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ./ark/docs/out

  deploy:
    needs: update-gh-pages
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

  release:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup repo
        uses: ./.github/actions/setup

      - name: Create and publish versions
        run: pnpm ci:publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}


================================================
FILE: .github/workflows/pullfrog.yml
================================================
# PULLFROG ACTION — DO NOT EDIT EXCEPT WHERE INDICATED
name: Pullfrog
run-name: ${{ inputs.name || github.workflow }}
on:
  workflow_dispatch:
    inputs:
      prompt:
        type: string
        description: Agent prompt
      name:
        type: string
        description: Run name

permissions:
  id-token: write
  contents: write
  pull-requests: write
  issues: write
  actions: read
  checks: read

jobs:
  pullfrog:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v6
        with:
          fetch-depth: 1

      - name: Run agent
        uses: pullfrog/pullfrog@v0
        with:
          prompt: ${{ inputs.prompt }}
        env:
          # Feel free to comment out any you won't use
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
          GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
          CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }}


================================================
FILE: .gitignore
================================================
dist
out
*.vsix
node_modules
temp
tmp
*.temp.*
*.log
*.tsbuildinfo
.DS_Store
.next
.source
.cache-loader
.attest
tsconfig.build.json
coverage


================================================
FILE: .vscode/extensions.json
================================================
{
	"recommendations": [
		"esbenp.prettier-vscode",
		"dbaeumer.vscode-eslint",
		// Run/debug tests inline via VSCode's Test Explorer
		"hbenl.vscode-mocha-test-adapter",
		// Syntax highlighting for strings in ArkType definitions
		"arktypeio.arkdark",
		// Playground-like version dropdown for TypeScript versions
		"typeholes.ts-versions-switcher"
	]
}


================================================
FILE: .vscode/launch.json
================================================
// A launch configuration that launches the extension inside a new window
{
	"version": "0.1.0",
	"configurations": [
		{
			"name": "Debug Extension",
			"type": "extensionHost",
			"request": "launch",
			"runtimeExecutable": "${execPath}",
			"args": ["--extensionDevelopmentPath=${workspaceRoot}/ark/extension"]
		},
		{
			"name": "Debug Themes",
			"type": "extensionHost",
			"request": "launch",
			"runtimeExecutable": "${execPath}",
			"args": ["--extensionDevelopmentPath=${workspaceRoot}/ark/themes"]
		}
	]
}


================================================
FILE: .vscode/settings.json
================================================
{
	"editor.defaultFormatter": "esbenp.prettier-vscode",
	"prettier.prettierPath": "./node_modules/prettier",
	"biome.enabled": false,
	"editor.codeActionsOnSave": [
		"editor.formatOnSave",
		"source.fixAll.eslint",
		"source.sortImports"
	],
	"eslint.codeActionsOnSave.rules": [
		"object-shorthand",
		"@typescript-eslint/consistent-type-imports",
		"import/no-duplicates",
		"@typescript-eslint/no-import-type-side-effects",
		"curly"
	],
	"typescript.preferences.preferTypeOnlyAutoImports": true,
	"typescript.preferences.autoImportFileExcludePatterns": [
		"out",
		// too many overlapping names, easy to import in schema/arktype where we don't want it
		// should just import as * as ts when we need it in attest
		"typescript"
	],
	"typescript.preferences.autoImportSpecifierExcludeRegexes": [
		// has a "type" export
		"^(node:)?os$"
	],
	"typescript.tsserver.experimental.enableProjectDiagnostics": true,
	"typescript.tsdk": "./node_modules/typescript/lib",
	// IF YOU UPDATE THE MOCHA CONFIG HERE, PLEASE ALSO UPDATE package.json/mocha AND ark/repo/mocha.jsonc
	"mochaExplorer.nodeArgv": ["--conditions", "ark-ts", "--import", "tsx"],
	// ignore attest since it requires type information
	"mochaExplorer.ignore": ["ark/attest/**/*"],
	"mochaExplorer.require": "ark/repo/mocha.globalSetup.ts",
	"mochaExplorer.timeout": 0,
	"mochaExplorer.env": {
		"ATTEST_skipTypes": "true"
	},
	"testExplorer.useNativeTesting": true,
	"search.exclude": {
		"**/out": true,
		"**/.next": true,
		"**/.source": true,
		"**/components/dts": true,
		"**/apiData.ts": true
	},
	"editor.quickSuggestions": {
		"strings": "on"
	},
	"github.copilot.enable": {
		"*": false,
		"plaintext": false,
		"markdown": false,
		"scminput": false
	}
}


================================================
FILE: LICENSE
================================================
Copyright 2025 ArkType

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: ark/attest/CHANGELOG.md
================================================
# @ark/attest

NOTE: This changelog is incomplete, but will include notable attest-specific changes (many updates consist almost entirely of bumped `arktype` versions for assertions).

## 0.51.0

Fix some tsconfig path resolution (thanks @LukeAbby🎉)

https://github.com/arktypeio/arktype/pull/1522

## 0.47.0

Add a `failOnMissingSnapshots` config option. Defaults to `true` if `CI` is set in your environment, `false` otherwise.

## 0.46.0

Fix an issue causing some bench files to not be parsed correctly, leading to errors and 0 instantiation counts.

## 0.44.3

Decouple attest trace/stats from pnpm

## 0.44.0

Support assertions for JSDoc contents associated with an `attest`ed value

```ts
const T = type({
	/** FOO */
	foo: "string"
})

const out = T.assert({ foo: "foo" })

// match or snapshot expected jsdoc associated with the value passed to attest
attest(out.foo).jsdoc.snap("FOO")
```

## 0.41.0

### Bail early for obviously incorrect `equals` comparisons

This is the short-term solution to #1287, where some comparisons with Node's `deepStrictEqual` and object with recursive properties like Type resulted in OOM crashes.

We will eventually add new string-diffing logic, but for now we just make some shallow comparisons between constructors and types to avoid common problematic comparisons, e.g. between Type instances:

```ts
// previously resulted in OOM exception, now shallowly fails with simple error
attest(type.string).equals(type.boolean)
```

## 0.11.0

- Fix a bug causing certain serialized types with backticks and template literals to be incorrectly formatted on inline snapshot

- Add a `typeToStringFormat` option for configuring how prettier stringifies types. Also added more documentation for other pre-existing options.

- Allow regex/partial match for `toString` assertions:

```ts
// ok
attest({ ark: "type" }).type.toString(/^{.*}$/)

// AssertionError: Actual string 'string[]' did not match regex '^{.*}$'
attest(["ark", "type"]).type.toString(/^{.*}$/)
```

- Allow assertions on arbitrary `arktype` Type instance using `satisfies`:

```ts
// ok
attest({ ark: "type" }).type.toString.satisfies(/^{.*}$/)

// AssertionError: ark must be a number (was string)
attest({ ark: "type" }).satisfies({ ark: "number" })
```

## 0.10.0

Format serialized types using `prettier`.

This makes long serialized types much more readable:

```ts
// old
attest({
	ark: "type",
	type: "script",
	vali: "dator",
	opti: "mized",
	from: "editor",
	to: "runtime"
}).type.toString.snap(
	`{ 	ark: string; type: string; vali: string; opti: string; from: string; to: string; }`
)

// new
attest({
	ark: "type",
	type: "script",
	vali: "dator",
	opti: "mized",
	from: "editor",
	to: "runtime"
}).type.toString.snap(`{
	ark: string
	type: string
	vali: string
	opti: string
	from: string
	to: string
}`)
```

Be aware, this is likely means you will need to regenerate existing type snaps to avoid failing due to formatting inconsistencies.

You should be able to update all your snapshots by running your tests with the `--updateSnapshots` flag or setting `ATTEST_updateSnapshots=1` in your environment.

If you have any non-snap `type.toString` assertions, you will need to update them manually. You may want to convert them temporarily to snaps so you can easily see the correct value.

## 0.9.4

Improve benchmark source extraction, add notes on baseline expressions

## 0.9.2

Fix a bug preventing consecutive benchmark runs from populating snapshots inline

## 0.8.2

### Patch Changes

- [#1028](https://github.com/arktypeio/arktype/pull/1028) [`5fe79c6`](https://github.com/arktypeio/arktype/commit/5fe79c6c8db94f20c997c7a8960edb9d69468b69) Thanks [@ssalbdivad](https://github.com/ssalbdivad)! - Bump version

- Updated dependencies [[`5fe79c6`](https://github.com/arktypeio/arktype/commit/5fe79c6c8db94f20c997c7a8960edb9d69468b69)]:
  - @ark/util@0.0.51
  - arktype@2.0.0-dev.26

## 0.8.1

### Patch Changes

- [#1024](https://github.com/arktypeio/arktype/pull/1024) [`5284b60`](https://github.com/arktypeio/arktype/commit/5284b6054209ffa38f02ae010c3e9ab3dff93653) Thanks [@ssalbdivad](https://github.com/ssalbdivad)! - ### Add .satisfies as an attest assertion to compare the value to an ArkType definition.

  ```ts
  attest({ foo: "bar" }).satisfies({ foo: "string" })

  // Error: foo must be a number (was string)
  attest({ foo: "bar" }).satisfies({ foo: "number" })
  ```

- Updated dependencies [[`1bf2066`](https://github.com/arktypeio/arktype/commit/1bf2066800ce65edc918a24c251ce20f1ccf29f4)]:
  - @ark/util@0.0.50
  - arktype@2.0.0-dev.25

## 0.8.0

### Minor Changes

- [#1011](https://github.com/arktypeio/arktype/pull/1011) [`2be4f5b`](https://github.com/arktypeio/arktype/commit/2be4f5b391d57ad47dc6f4c0e4c9d31ae6b550c5) Thanks [@ssalbdivad](https://github.com/ssalbdivad)! - ### Throw by default when attest.instantiations() exceeds the specified benchPercentThreshold

  Tests like this will now correctly throw inline instead of return a non-zero exit code:

  ```ts
  it("can snap instantiations", () => {
  	type Z = makeComplexType<"asbsdfsaodisfhsda">
  	// will throw here as the actual number of instantiations is more
  	// than 20% higher than the snapshotted value
  	attest.instantiations([1, "instantiations"])
  })
  ```

  ### Snapshotted completions will now be alphabetized

  This will help improve stability, especially for large completion lists like this one which we updated more times than we'd care to admit 😅

  ```ts
  attest(() => type([""])).completions({
  	"": [
  		"...",
  		"===",
  		"Array",
  		"Date",
  		"Error",
  		"Function",
  		"Map",
  		"Promise",
  		"Record",
  		"RegExp",
  		"Set",
  		"WeakMap",
  		"WeakSet",
  		"alpha",
  		"alphanumeric",
  		"any",
  		"bigint",
  		"boolean",
  		"creditCard",
  		"digits",
  		"email",
  		"false",
  		"format",
  		"instanceof",
  		"integer",
  		"ip",
  		"keyof",
  		"lowercase",
  		"never",
  		"null",
  		"number",
  		"object",
  		"parse",
  		"semver",
  		"string",
  		"symbol",
  		"this",
  		"true",
  		"undefined",
  		"unknown",
  		"uppercase",
  		"url",
  		"uuid",
  		"void"
  	]
  })
  ```

### Patch Changes

- Updated dependencies [[`2be4f5b`](https://github.com/arktypeio/arktype/commit/2be4f5b391d57ad47dc6f4c0e4c9d31ae6b550c5)]:
  - @ark/util@0.0.49
  - arktype@2.0.0-dev.24

## 0.7.10

### Patch Changes

- Updated dependencies [[`232fc42`](https://github.com/arktypeio/arktype/commit/232fc42af18e8412d0095293926077a9c50abdc6)]:
  - @ark/util@0.0.48
  - arktype@2.0.0-dev.20

## 0.7.9

### Patch Changes

- Updated dependencies [[`317f012`](https://github.com/arktypeio/arktype/commit/317f0122b1f2c0ba6e1de872f210490af75761af)]:
  - @ark/util@0.0.47
  - arktype@2.0.0-dev.19

## 0.7.8

### Patch Changes

- Updated dependencies [[`ebe3408`](https://github.com/arktypeio/arktype/commit/ebe3408e2310bc8f69eacd29e0d51c99c24d9471)]:
  - @ark/util@0.0.46
  - arktype@2.0.0-dev.17

## 0.7.7

### Patch Changes

- Updated dependencies [[`79c2b27`](https://github.com/arktypeio/arktype/commit/79c2b276c3645ea51e7bae8fe4463f2f39ddabc8)]:
  - @ark/util@0.0.45
  - arktype@2.0.0-dev.15

## 0.7.6

### Patch Changes

- [`8cd0807`](https://github.com/arktypeio/arktype/commit/8cd080783fdbd8eefea54d5c04d99cd88b36c0eb) - Initial changeset

- Updated dependencies [[`8cd0807`](https://github.com/arktypeio/arktype/commit/8cd080783fdbd8eefea54d5c04d99cd88b36c0eb)]:
  - @ark/fs@0.0.20
  - @ark/util@0.0.44
  - arktype@2.0.0-dev.14


================================================
FILE: ark/attest/README.md
================================================
# Attest

Attest is a testing library that makes your TypeScript types available at runtime, giving you access to precise type-level assertions and performance benchmarks.

Assertions are framework agnostic and can be seamlessly integrated with your existing Vitest, Jest, or Mocha tests.

Benchmarks can run from anywhere and will deterministically report the number of type instantiations contributed by the contents of the `bench` call.

If you've ever wondered how [ArkType](https://github.com/arktypeio/arktype) can guarantee identical behavior between its runtime and static parser implementations and highly optimized editor performance, Attest is your answer⚡

## Installation

```bash
npm install @ark/attest
```

_Note: This package is still in alpha! Your feedback will help us iterate toward a stable 1.0._

## Setup

To use attest's type assertions, you'll need to call our setup/cleanup methods before your first test and after your last test, respectively. This usually involves some kind of globalSetup/globalTeardown config.

> [!IMPORTANT]
> If you run your tests in watch mode or otherwise iteratively during dev, you will want to enable [`--skipTypes` mode](#skiptypes).

### Vitest

`vitest.config.ts`

```ts
import { defineConfig } from "vitest/config"

export default defineConfig({
	test: {
		globalSetup: ["setupVitest.ts"]
	}
})
```

`setupVitest.ts`

```ts
import { setup } from "@ark/attest"

// config options can be passed here
export default () => setup({})
```

### Mocha

`package.json`

```json
"mocha": {
	"require": "./setupMocha.ts"
}
```

`setupMocha.ts`

```ts
import { setup, teardown } from "@ark/attest"

// config options can be passed here
export const mochaGlobalSetup = () => setup({})

export const mochaGlobalTeardown = teardown
```

You should also add `.attest` to your repository's `.gitignore` file.

Bun support is currently pending [them supporting @prettier/sync for type formatting](https://github.com/oven-sh/bun/issues/10768). If this is a problem for you, please 👍 that issue so they prioritize it!

## Assertions

Here are some simple examples of type assertions and snapshotting:

```ts
// @ark/attest assertions can be made from any unit test framework with a global setup/teardown
describe("attest features", () => {
	it("type and value assertions", () => {
		const Even = type("number%2")
		// asserts even.infer is exactly number
		attest<number>(even.infer)
		// make assertions about types and values seamlessly
		attest(even.infer).type.toString.snap("number")
		// including object literals- no more long inline strings!
		attest(even.json).snap({
			intersection: [{ domain: "number" }, { divisor: 2 }]
		})
	})

	it("error assertions", () => {
		// Check type errors, runtime errors, or both at the same time!
		// @ts-expect-error
		attest(() => type("number%0")).throwsAndHasTypeError(
			"% operator must be followed by a non-zero integer literal (was 0)"
		)
		// @ts-expect-error
		attest(() => type({ "[object]": "string" })).type.errors(
			"Indexed key definition 'object' must be a string, number or symbol"
		)
	})

	it("completion snapshotting", () => {
		// snapshot expected completions for any string literal!
		// @ts-expect-error (if your expression would throw, prepend () =>)
		attest(() => type({ a: "a", b: "b" })).completions({
			a: ["any", "alpha", "alphanumeric"],
			b: ["bigint", "boolean"]
		})
		type Legends = { faker?: "🐐"; [others: string]: unknown }
		// works for keys or index access as well (may need prettier-ignore to avoid removing quotes)
		// prettier-ignore
		attest({ "f": "🐐" } as Legends).completions({ "f": ["faker"] })
	})

	it("jsdoc snapshotting", () => {
		// match or snapshot expected jsdoc associated with the value passed to attest
		const T = type({
			/** FOO */
			foo: "string"
		})

		const out = T.assert({ foo: "foo" })

		attest(out.foo).jsdoc.snap("FOO")
	})

	it("integrate runtime logic with type assertions", () => {
		const ArrayOf = type("<t>", "t[]")
		const numericArray = arrayOf("number | bigint")
		// flexibly combine runtime logic with type assertions to customize your
		// tests beyond what is possible from pure static-analysis based type testing tools
		if (getTsVersionUnderTest().startsWith("5")) {
			// this assertion will only occur when testing TypeScript 5+!
			attest<(number | bigint)[]>(numericArray.infer)
		}
	})

	it("integrated type performance benchmarking", () => {
		const User = type({
			kind: "'admin'",
			"powers?": "string[]"
		})
			.or({
				kind: "'superadmin'",
				"superpowers?": "string[]"
			})
			.or({
				kind: "'pleb'"
			})
		attest.instantiations([7574, "instantiations"])
	})
})
```

## Options

Options can be specified in one of 3 ways:

- An argument passed to your test process, e.g. `--skipTypes` or `--benchPercentThreshold 10`
- An environment variable with an `ATTEST_` prefix, e.g. `ATTEST_skipTypes=1` or `ATTEST_benchPercentThreshold=10`
- Passed as an option to attest's `setup` function, e.g.:

`setupVitest.ts`

```ts
import * as attest from "@ark/attest"

export const setup = () =>
	attest.setup({
		skipTypes: true,
		benchPercentThreshold: 10
	})
```

Here are the current defaults for all available options. Please note, some of these are experimental and subject to change:

```ts
export const getDefaultAttestConfig = (): BaseAttestConfig => ({
	tsconfig:
		existsSync(fromCwd("tsconfig.json")) ? fromCwd("tsconfig.json") : undefined,
	attestAliases: ["attest", "attestInternal"],
	updateSnapshots: false,
	skipTypes: false,
	skipInlineInstantiations: false,
	tsVersions: "typescript",
	benchPercentThreshold: 20,
	benchErrorOnThresholdExceeded: true,
	filter: undefined,
	testDeclarationAliases: ["bench", "it", "test"],
	formatter: `npm exec --no -- prettier --write`,
	shouldFormat: true,
	typeToStringFormat: {}
})
```

### `skipTypes`

`skipTypes` is extremely useful for iterating quickly during development without having to typecheck your project to test runtime logic.

When this setting is enabled, setup will skip type checking and all assertions requiring type information will be skipped.

You likely want two scripts, one for running tests with types and one for tests without:

```json
		"test": "ATTEST_skipTypes=1 vitest run",
		"testWithTypes": "vitest run",
```

Our recommendation is to use `test` when:

- Only wanting to test runtime logic during development
- Running tests in watch mode or via VSCode's Test Explorer

Use `testWithTypes` when:

- You've made changes to your types and want to recheck your type-level assertions
- You're running your tests in CI

### `typeToStringFormat`

A set of [`prettier.Options`](https://prettier.io/docs/en/options.html) overrides that apply specifically `type.toString` formatting.

Any options you provide will override the defaults, which are as follows:

```jsonc
{
	"semi": false,
	// note this print width is optimized for type serialization, not general code
	"printWidth": 60,
	"trailingComma": "none",
	"parser": "typescript"
}
```

The easiest way to provide overrides is to the `setup` function, but they can also be provided as a JSON serialized string either passed to a `--typeToStringFormat` CLI flag or set as the value of `ATTEST_typeToStringFormat` on `process.env`.

## Benches

Benches are run separately from tests and don't require any special setup. If the below file was `benches.ts`, you could run it using something like `tsx benches.ts` or `ts-node benches.ts`:

```ts
// Combinatorial template literals often result in expensive types- let's benchmark this one!
type makeComplexType<s extends string> =
	s extends `${infer head}${infer tail}` ? head | tail | makeComplexType<tail>
	:	s

bench("bench type", () => {
	return {} as makeComplexType<"defenestration">
	// This is an inline snapshot that will be populated or compared when you run the file
}).types([169, "instantiations"])

bench(
	"bench runtime and type",
	() => {
		return {} as makeComplexType<"antidisestablishmentarianism">
	},
	fakeCallOptions
)
	// Average time it takes the function execute
	.mean([2, "ms"])
	// Seems like our type is O(n) with respect to the length of the input- not bad!
	.types([337, "instantiations"])
```

If you're benchmarking an API, you'll need to include a "baseline expression" so that instantiations created when your API is initially invoked don't add noise to the individual tests.

Here's an example of what that looks like:

```ts
import { bench } from "@ark/attest"
import { type } from "arktype"

// baseline expression
type("boolean")

bench("single-quoted", () => {
	const _ = type("'nineteen characters'")
	// would be 2697 without baseline
}).types([610, "instantiations"])

bench("keyword", () => {
	const _ = type("string")
	// would be 2507 without baseline
}).types([356, "instantiations"])
```

> [!WARNING]  
> Be sure your baseline expression is not identical to an expression you are using in any of your benchmarks. If it is, the individual benchmarks will reuse its cached types, leading to reduced (or 0) instantiations.

If you'd like to fail in CI above a threshold, you can add flags like the following (default value is 20%, but it will not throw unless `--benchErrorOnThresholdExceeded` is set):

```
 tsx ./p99/within-limit/p99-tall-simple.bench.ts  --benchErrorOnThresholdExceeded --benchPercentThreshold 10
```

## CLI

Attest also includes a built-in `attest` CLI including the following commands:

### `stats`

```bash
npm run attest stats packages/*
```

Summarizes key type performance metrics for each package (check time, instantiations, and type count).

Expects any number of args representing package directories to check, optionally specified using glob patterns like `packages/*`.

If no directories are provided, defaults to CWD.

### `trace`

```bash
npm run attest trace .
```

Creates a trace.json file in `.attest/trace` that can be viewed as a type performance heat map via a tool like https://ui.perfetto.dev/. Also summarizes any hot spots as identified by `@typescript/analyze-trace`.

Trace expects a single argument representing the root directory of the root package for which to gather type information.

## Integration

### Setup

If you're a library author wanting to integrate type into your own assertions instead of using the `attest` API, you'll need to call `setup` with a list of `attestAliases` to ensure type data is collected from your own functions:

```ts
// attest will only collect type data from functions with names listed in `attestAliases`
setup({ attestAliases: ["yourCustomAssert"] })

// There are many other config options, but some are primarily internal- use others at your own risk!
```

You'll need to make sure that setup with whatever aliases you need before the first test runs. As part of the setup process, attest will search for the specified assertion calls and cache their types in a temporary file that will be referenced during test execution.

This ensures that type assertions can be made across processes without creating a new TSServer instance for each.

### TS Versions

There is a tsVersions setting that allows testing multiple TypeScript aliases at once.

````ts globalSetup.ts
import { setup } from "@ark/attest"
/** A string or list of strings representing the TypeScript version aliases to run.
 *
 * Aliases must be specified as a package.json dependency or devDependency beginning with "typescript".
 * Alternate aliases can be specified using the "npm:" prefix:
 * ```json
 * 		"typescript": "latest",
 * 		"typescript-next": "npm:typescript@next",
 * 		"typescript-1": "npm:typescript@5.2"
 * 		"typescript-2": "npm:typescript@5.1"
 * ```
 *
 * "*" can be pased to run all discovered versions beginning with "typescript".
 */
setup({ tsVersions: "*" })
````

### APIs

The most flexible attest APIs are `getTypeAssertionsAtPosition` and `caller`.

Here's an example of how you might use them in your own API:

```ts
import { getTypeAssertionsAtPosition, caller } from "@ark/attest"

const yourCustomAssert = <expectedType>(actualValue: expectedType) => {
	const position = caller()
	const types = getTypeAssertionsAtPosition(position)
	// assert that the type of actualValue is the same as the type of expectedType
	const relationship = types[0].args[0].relationships.typeArgs[0]
	if (relationship === undefined) {
		throw new Error(
			`yourCustomAssert requires a type arg representing the expected type, e.g. 'yourCustomAssert<"foo">("foo")'`
		)
	}
	if (relationship !== "equality") {
		throw new Error(
			`Expected ${types.typeArgs[0].type}, got ${types.args[0].type} with relationship ${relationship}`
		)
	}
}
```

A user might then use `yourCustomAssert` like this:

```ts
import { yourCustomAssert } from "your-package"

test("my code", () => {
	// Ok
	yourCustomAssert<"foo">(`${"f"}oo` as const)
	// Error: `Expected boolean, got true with relationship subtype`
	yourCustomAssert<boolean>(true)
	// Error: `Expected 5, got number with relationship supertype`
	yourCustomAssert<5>(2 + 3)
})
```

Please don't hesitate to a GitHub [issue](https://github.com/arktypeio/arktype/issues/new/choose) or [discussion](https://github.com/arktypeio/arktype/discussions/new/choose) or reach out on [ArkType's Discord](https://arktype.io/discord) if you have any questions or feedback- we'd love to hear from you! ⛵


================================================
FILE: ark/attest/__tests__/assertions.test.ts
================================================
import { attest } from "@ark/attest"
import { MissingSnapshotError } from "@ark/attest/internal/assert/assertions.ts"
import { attestInternal } from "@ark/attest/internal/assert/attest.ts"
import { register } from "@ark/util"
import { type } from "arktype"
import * as assert from "node:assert/strict"

const o = { ark: "type" }

describe("type assertions", () => {
	it("type parameter", () => {
		attest<{ ark: string }>(o)
		assert.throws(
			// @ts-expect-error
			() => attest<{ ark: "type" }>(o),
			assert.AssertionError,
			"type"
		)
	})

	it("type-only assertion", () => {
		attest<{ ark: string }, typeof o>()
		assert.throws(
			// @ts-expect-error
			() => attest<{ ark: "type" }, typeof o>(),
			assert.AssertionError,
			"type"
		)
	})

	it("type toString", () => {
		attest(o).type.toString("{ ark: string }")
		attest(o).type.toString.is("{ ark: string }")
		attest(o).type.toString.satisfies(/^{.*}$/)
		assert.throws(
			() => attest(o).type.toString.satisfies(/^a.*z$/),
			assert.AssertionError,
			"typfsde"
		)
	})

	it("type toString regex", () => {
		attest(o).type.toString(/^{.*}$/)
		assert.throws(
			() => attest(o).type.toString(/^a.*z$/),
			assert.AssertionError,
			"typfsde"
		)
	})

	it("type toString multiline", () => {
		const obj = {
			ark: "type",
			type: "script",
			vali: "dator",
			opti: "mized",
			from: "editor",
			to: "runtime"
		}

		attest(obj).type.toString.is(`{
	ark: string
	type: string
	vali: string
	opti: string
	from: string
	to: string
}`)
	})

	it("equals", () => {
		attest(o).equals({ ark: "type" })
	})

	it("object", () => {
		attest<{ i: string }>({ i: "love my wife" })
		assert.throws(
			// @ts-expect-error
			() => attest<{ g: string }>({ g: "whiz" as unknown }),
			assert.AssertionError,
			"unknown"
		)
	})

	it("typed allows equivalent types", () => {
		const actual = { a: true, b: false }
		attest<{
			b: boolean
			a: boolean
		}>(actual)
	})

	it("functional asserts don't exist on pure value types", () => {
		// @ts-expect-error
		// eslint-disable-next-line @typescript-eslint/no-unused-expressions
		attest(5).throws
	})

	it("not equal", () => {
		assert.throws(
			() => attest(o).equals({ ark: "typo" }),
			assert.AssertionError,
			"type !== typo"
		)
	})

	it("instanceOf", () => {
		const d = new Date()
		attest(d).instanceOf(Date)
		assert.throws(() => attest(d).instanceOf(RegExp), assert.AssertionError)
	})

	it("incorrect type", () => {
		assert.throws(
			// @ts-expect-error
			() => attest<{ re: number }>(o),
			assert.AssertionError,
			"o is not of type number"
		)
	})

	it("any type", () => {
		attest<any>(o as any)
		assert.throws(
			() => attest<any>({} as unknown),
			assert.AssertionError,
			"unknown"
		)
	})

	it("assert unknown ignores type", () => {
		const myValue = { a: ["+"] } as const
		const myExpectedValue = { a: ["+"] }
		// @ts-expect-error
		attest(myValue).equals(myExpectedValue)
		attest(myValue).unknown.equals(myExpectedValue)
		assert.throws(
			() => attest(myValue).unknown.is(myExpectedValue),
			assert.AssertionError,
			"not reference-equal"
		)
	})

	it("multiline", () => {
		attest<object>({
			several: true,
			lines: true,
			long: true
		} as object)
		assert.throws(
			() =>
				attest<object>({
					several: true,
					lines: true,
					long: true
				}),
			assert.AssertionError
		)
	})

	it("nonexistent types always fail", () => {
		// @ts-expect-error
		const nonexistent: NonExistent = {}
		assert.throws(
			() => attest<{ something: "specific" }>(nonexistent),
			assert.AssertionError,
			"specific"
		)
	})

	it("does not boom on Type comparison", () => {
		const expectedRef = register(type.number)
		const actualRef = register(type.string)

		// @ts-expect-error
		attest(() => attest(type.string).equals(type.number)).throws
			.equals(`AssertionError [ERR_ASSERTION]: Assertion including at least one function or object was not between reference equal items
Expected: Function(${expectedRef})
Actual: Function(${actualRef})`)
	})

	it("doesn't boom on ArkErrors vs plain object", () => {
		attest(() => attest(type({ a: "string" })({ a: 5 })).equals({ a: "five" }))
			.throws
			.snap(`AssertionError [ERR_ASSERTION]: Objects did not have the same constructor:
Expected: {"a":"five"}
Actual: [ArkError]`)
	})

	it("jsdoc ", () => {
		type O = {
			/** FOO */
			foo: string
			bar: number
		}

		const o: O = {
			foo: "foo",
			bar: 5
		}

		attest(o.foo).jsdoc.equals("FOO")

		assert.throws(
			() => attest(o.bar).jsdoc.equals("BAR"),
			assert.AssertionError,
			"BAR"
		)
	})

	it("failOnMissingSnapshots", () => {
		assert.throws(
			() =>
				attestInternal("", { cfg: { failOnMissingSnapshots: true } }).snap(),
			MissingSnapshotError
		)
	})
})


================================================
FILE: ark/attest/__tests__/benchExpectedOutput.ts
================================================
import { bench } from "@ark/attest"
import type { makeComplexType as externalmakeComplexType } from "./utils.ts"

const fakeCallOptions = {
	until: { count: 2 },
	fakeCallMs: "count",
	benchFormat: { noExternal: true }
}

bench(
	"bench call single stat median",
	() => "boofoozoo".includes("foo"),
	fakeCallOptions
).median([2, "ms"])

bench(
	"bench call single stat",
	() => "boofoozoo".includes("foo"),
	fakeCallOptions
).mean([2, "ms"])

bench(
	"bench call mark",
	() => /.*foo.*/.test("boofoozoo"),
	fakeCallOptions
).mark({ mean: [2, "ms"], median: [2, "ms"] })

type makeComplexType<S extends string> =
	S extends `${infer head}${infer tail}` ? head | tail | makeComplexType<tail>
	:	S

bench("bench type", () => ({}) as makeComplexType<"defenestration">).types([
	163,
	"instantiations"
])

bench(
	"bench type from external module",
	() => ({}) as externalmakeComplexType<"defenestration">
).types([179, "instantiations"])

bench(
	"bench call and type",
	() => ({}) as makeComplexType<"antidisestablishmentarianism">,
	fakeCallOptions
)
	.mean([2, "ms"])
	.types([317, "instantiations"])

bench("empty", () => {}).types([0, "instantiations"])


================================================
FILE: ark/attest/__tests__/benchTemplate.ts
================================================
import { bench } from "@ark/attest"
import type { makeComplexType as externalmakeComplexType } from "./utils.ts"

const fakeCallOptions = {
	until: { count: 2 },
	fakeCallMs: "count",
	benchFormat: { noExternal: true }
}

bench(
	"bench call single stat median",
	() => "boofoozoo".includes("foo"),
	fakeCallOptions
).median()

bench(
	"bench call single stat",
	() => "boofoozoo".includes("foo"),
	fakeCallOptions
).mean()

bench(
	"bench call mark",
	() => /.*foo.*/.test("boofoozoo"),
	fakeCallOptions
).mark()

type makeComplexType<S extends string> =
	S extends `${infer head}${infer tail}` ? head | tail | makeComplexType<tail>
	:	S

bench("bench type", () => ({}) as makeComplexType<"defenestration">).types()

bench(
	"bench type from external module",
	() => ({}) as externalmakeComplexType<"defenestration">
).types()

bench(
	"bench call and type",
	() => ({}) as makeComplexType<"antidisestablishmentarianism">,
	fakeCallOptions
)
	.mean()
	.types()

bench("empty", () => {}).types()


================================================
FILE: ark/attest/__tests__/completions.test.ts
================================================
import { attest, contextualize } from "@ark/attest"
import { hasDomain, type domainDescriptions } from "@ark/util"
import assert from "node:assert"

type Obj = {
	prop1: string
	prop2: string
	extra: unknown
}
const obj: Obj = { prop1: "", prop2: "", extra: "" }

type Ark = {
	ark: "type"
}

type Arks = {
	ark: "string" | "semver" | "symbol"
}

contextualize(() => {
	it("quote types", () => {
		// @ts-expect-error
		attest({ ark: "" } as Ark).completions({ "": ["type"] })
		// prettier-ignore
		// @ts-expect-error
		attest({ ark: "t" } as Ark).completions({ t: ["type"] })
		//@ts-expect-error
		attest({ ark: "ty" } as Ark).completions({ ty: ["type"] })
	})

	it(".type.completions", () => {
		//@ts-expect-error
		attest({ ark: "s" } as Arks).type.completions({
			s: ["semver", "string", "symbol"]
		})
	})

	it("keys", () => {
		//@ts-expect-error
		attest({ "": "data" } as Obj).completions({
			"": ["extra", "prop1", "prop2"]
		})
	})

	it("index access", () => {
		//@ts-expect-error
		attest(() => obj["p"]).type.completions({
			p: ["prop1", "prop2"]
		})
	})

	it("duplicate string error", () => {
		assert.throws(
			() => attest({ "": "" }).type.completions({}),
			Error,
			"multiple completion candidates"
		)
	})

	it("empty", () => {
		attest("").completions({})
	})

	it("external package", () => {
		hasDomain({}, "object")
		// @ts-expect-error
		attest(() => hasDomain({}, "b")).completions({ b: ["bigint", "boolean"] })
	})

	it("type-level", () => {
		// @ts-expect-error
		attest((): domainDescriptions["b"] => {}).completions({
			b: ["bigint", "boolean"]
		})
	})
})


================================================
FILE: ark/attest/__tests__/demo.test.ts
================================================
import {
	attest,
	contextualize,
	getPrimaryTsVersionUnderTest
} from "@ark/attest"
import { type } from "arktype"

const o = { ark: "type" } as const
const shouldThrow = (a: false) => {
	if (a) throw new Error(`${a} is not assignable to false`)
}

contextualize(() => {
	it("value snap", () => {
		attest(o).snap({ ark: "type" })
	})

	it("type snap", () => {
		attest(o).type.toString.snap('{ readonly ark: "type" }')
	})

	it("type assertion", () => {
		attest<{ readonly ark: "type" }>(o)
	})

	it("type-only assertion", () => {
		attest<{ readonly ark: "type" }, typeof o>()
	})

	it("chained snaps", () => {
		attest(o)
			.snap({ ark: "type" })
			.type.toString.snap('{ readonly ark: "type" }')
	})

	it("error and type error snap", () => {
		// @ts-expect-error
		attest(() => shouldThrow(true))
			.throws.snap("Error: true is not assignable to false")
			.type.errors.snap(
				"Argument of type 'true' is not assignable to parameter of type 'false'."
			)
	})

	// @ark/attest assertions can be made from any unit test framework with a global setup/teardown

	it("type and value assertions", () => {
		const Even = type("number%2")
		// snapshot types and values seamlessly
		attest(Even.infer).type.toString.snap("number")
		// including object literals- no more long inline strings!
		attest(Even.json).snap({ domain: "number", divisor: 2 })
	})

	it("error assertions", () => {
		// Check type errors, runtime errors, or both at the same time!
		// @ts-expect-error
		attest(() => type("number%0")).throwsAndHasTypeError(
			"% operator must be followed by a non-zero integer literal (was 0)"
		)
		// @ts-expect-error
		attest(() => type({ "[object]": "string" })).type.errors(
			"Indexed key definition 'object' must be a string or symbol"
		)
	})

	it("completion snapshotting", () => {
		// snapshot expected completions for any string literal!
		// @ts-expect-error (if your expression would throw, prepend () =>)
		attest(() => type({ b: "b" })).completions({
			b: ["bigint", "boolean"]
		})
		type Legends = { faker?: "🐐"; [others: string]: unknown }
		// works for keys or index access as well (may need prettier-ignore to
		// avoid removing quotes)
		// prettier-ignore
		attest({ "f": "🐐" } as Legends).completions({ f: ["faker"] })
	})

	it("integrate runtime logic with type assertions", () => {
		const arrayOf = type("<t>", "t[]")
		const NumericArray = arrayOf("number | bigint")
		// flexibly combine runtime logic with type assertions to customize your
		// tests beyond what is possible from pure static-analysis based type testing tools
		if (getPrimaryTsVersionUnderTest().startsWith("5")) {
			// this assertion will only occur when testing TypeScript 5+!
			attest<(number | bigint)[]>(NumericArray.infer)
		}
	})
})


================================================
FILE: ark/attest/__tests__/externalSnapshots.test.ts
================================================
import { attest, contextualize } from "@ark/attest"
import { attestInternal } from "@ark/attest/internal/assert/attest.ts"
import { dirName, readJson, writeJson } from "@ark/fs"
import * as assert from "node:assert/strict"
import { rmSync } from "node:fs"
import { join } from "node:path"

const testDir = dirName()
const testFile = "externalSnapshots.test.ts"
const o = { re: "do" }

const defaultFileName = "assert.snapshots.json"
const defaultSnapPath = join(testDir, defaultFileName)
const defaultSnapFileContents = {
	[testFile]: {
		toFile: {
			re: "do"
		},
		toFileUpdate: {
			re: "oldValue"
		}
	}
}

const customFileName = "custom.snapshots.json"
const customSnapPath = join(testDir, customFileName)
const defaultSnapContentsAtCustomPath = {
	[testFile]: {
		toCustomFile: { re: "do" }
	}
}

beforeEach(() => {
	writeJson(defaultSnapPath, defaultSnapFileContents)
	writeJson(customSnapPath, defaultSnapContentsAtCustomPath)
})

afterEach(() => {
	rmSync(defaultSnapPath, { force: true })
	rmSync(customSnapPath, { force: true })
})

contextualize(() => {
	it("create", () => {
		attest(o).snap.toFile("toFile")
		assert.throws(
			() => attest({ re: "kt" }).snap.toFile("toFile"),
			assert.AssertionError,
			"kt"
		)
		attest(1337).snap.toFile("toFileNew")
		const contents = readJson(defaultSnapPath)
		attest(contents).equals({
			[testFile]: {
				...defaultSnapFileContents[testFile],
				toFileNew: 1337
			}
		})
	})

	it("update existing", () => {
		attestInternal(
			{ re: "dew" },
			{ cfg: { updateSnapshots: true } }
		).snap.toFile("toFileUpdate")
		const updatedContents = readJson(defaultSnapPath)
		const expectedContents = {
			[testFile]: {
				...defaultSnapFileContents[testFile],
				toFileUpdate: { re: "dew" }
			}
		}
		assert.deepEqual(updatedContents, expectedContents)
	})

	it("with path", () => {
		attest(o).snap.toFile("toCustomFile", {
			path: customFileName
		})
		assert.throws(
			() =>
				attest({ re: "kt" }).snap.toFile("toCustomFile", {
					path: customFileName
				}),
			assert.AssertionError,
			"kt"
		)
		attest(null).snap.toFile("toCustomFileNew", {
			path: customFileName
		})
		const contents = readJson(customSnapPath)
		attest(contents).equals({
			[testFile]: {
				...defaultSnapContentsAtCustomPath[testFile],
				toCustomFileNew: null
			}
		})
	})
})


================================================
FILE: ark/attest/__tests__/functions.test.ts
================================================
import { attest, contextualize } from "@ark/attest"
import { fileName } from "@ark/fs"
import * as assert from "node:assert/strict"
import { basename } from "node:path"

const n = 5
const o = { re: "do" }

const shouldThrow = (a: false) => {
	if (a) throw new Error(`${a} is not assignable to false`)
}

const throwError = () => {
	throw new Error("Test error.")
}

contextualize(() => {
	it("valid type errors", () => {
		// @ts-expect-error
		attest(o.re.length.nonexistent).type.errors(
			/Property 'nonexistent' does not exist on type 'number'/
		)
		attest(o).type.errors("")
		// @ts-expect-error
		attest(() => shouldThrow(5, "")).type.errors.is(
			"Expected 1 arguments, but got 2."
		)
	})

	it("bad type errors", () => {
		assert.throws(
			() => attest(o).type.errors(/This error doesn't exist/),
			assert.AssertionError,
			"doesn't exist"
		)
		assert.throws(
			() =>
				attest(() =>
					// @ts-expect-error
					shouldThrow("this is a type error")
				).type.errors.is(""),
			assert.AssertionError,
			"not assignable"
		)
	})

	it("chainable", () => {
		attest<{ re: string }>(o).equals({ re: "do" })
		// @ts-expect-error
		attest(() => throwError("this is a type error"))
			.throws("Test error.")
			.type.errors("Expected 0 arguments, but got 1.")
	})

	it("bad chainable", () => {
		assert.throws(
			() =>
				attest(n)
					.equals(5)
					.type.errors.equals("Expecting an error here will throw"),
			assert.AssertionError,
			"Expecting an error"
		)
		assert.throws(
			() => attest(n).is(7).type.toString("string"),
			assert.AssertionError,
			"7"
		)
	})

	it("throwsAndHasTypeError", () => {
		// @ts-expect-error
		attest(() => shouldThrow(true)).throwsAndHasTypeError(
			/true[\S\s]*not assignable[\S\s]*false/
		)
		// No thrown error
		assert.throws(
			() =>
				// @ts-expect-error
				attest(() => shouldThrow(null)).throwsAndHasTypeError("not assignable"),
			assert.AssertionError,
			"didn't throw"
		)
		// No type error
		assert.throws(
			() =>
				attest(() => shouldThrow(true as any)).throwsAndHasTypeError(
					"not assignable"
				),
			assert.AssertionError,
			"not assignable"
		)
	})

	it("throws empty", () => {
		attest(throwError).throws()
		assert.throws(
			() => attest(() => shouldThrow(false)).throws(),
			assert.AssertionError,
			"didn't throw"
		)
	})

	const getThrownError = (f: () => void) => {
		try {
			f()
		} catch (e) {
			if (e instanceof Error) return e
		}
		throw new Error("Expected function to throw an error.")
	}

	it("stack starts from test file", () => {
		const e = getThrownError(() => attest(1 + 1).equals(3))
		assert.match(e.stack!.split("\n")[1], new RegExp(basename(fileName())))
	})
})


================================================
FILE: ark/attest/__tests__/instantiations.test.ts
================================================
import { attest, contextualize } from "@ark/attest"
import { type } from "arktype"
import { it } from "mocha"

contextualize(() => {
	it("inline", () => {
		attest.instantiations([23731, "instantiations"])
		return type({
			kind: "'admin'",
			"powers?": "string[]"
		})
			.or({
				kind: "'superadmin'",
				"superpowers?": "string[]"
			})
			.or({
				kind: "'pleb'"
			})
	})
	it("fails on instantiations above threshold", () => {
		attest(() => {
			attest.instantiations([1, "instantiations"])
			return type({
				foo: "0|1|2|3|4|5|6"
			})
		}).throws("exceeded baseline by")
	})
})


================================================
FILE: ark/attest/__tests__/satisfies.test.ts
================================================
import { attest, contextualize } from "@ark/attest"
import { nonOverlappingSatisfiesMessage } from "@ark/attest/internal/assert/chainableAssertions.ts"

contextualize(() => {
	it("can assert types", () => {
		attest({ foo: "bar" }).satisfies({ foo: "string" })

		attest(() => {
			// @ts-expect-error
			attest({ foo: "bar" }).satisfies({ foo: "number" })
		})
			.throws("foo must be a number (was a string)")
			.type.errors(nonOverlappingSatisfiesMessage)
	})
})


================================================
FILE: ark/attest/__tests__/snap.test.ts
================================================
import { attest, contextualize } from "@ark/attest"
import * as assert from "node:assert/strict"

const o = { re: "do" }
const shouldThrow = (a: false) => {
	if (a) throw new Error(`${a} is not assignable to false`)
}
const throwError = () => {
	throw new Error("Test error.")
}

contextualize(() => {
	it("default serializer doesn't care about prop order", () => {
		const actual = { a: true, b: false }
		attest(actual).snap({ b: false, a: true })
	})

	it("snap", () => {
		attest<{ re: string }>(o).snap({ re: `do` })
		attest(o).equals({ re: "do" }).type.toString.snap("{ re: string }")
		assert.throws(
			() => attest(o).snap({ re: `dorf` }),
			assert.AssertionError,
			"dorf"
		)
	})

	it("value and type snap", () => {
		attest(o).snap({ re: `do` }).type.toString.snap("{ re: string }")
		assert.throws(
			() => attest(o).snap({ re: `do` }).type.toString.snap(`{ re: number }`),
			assert.AssertionError,
			"number"
		)
	})

	it("error and type error snap", () => {
		// @ts-expect-error
		attest(() => shouldThrow(true))
			.throws.snap(`Error: true is not assignable to false`)
			.type.errors.snap(
				`Argument of type 'true' is not assignable to parameter of type 'false'.`
			)
		assert.throws(
			() =>
				// @ts-expect-error
				attest(() => shouldThrow(1))
					.throws.snap(`Error: 1 is not assignable to false`)
					.type.errors.snap(
						`Argument of type '2' is not assignable to parameter of type 'false'.`
					),
			assert.AssertionError,
			"'2'"
		)
	})

	it("throws", () => {
		attest(throwError).throws(/error/g)
		assert.throws(
			// Snap should never be populated
			() => attest(() => shouldThrow(false)).throws.snap(),
			assert.AssertionError,
			"didn't throw"
		)
	})
	/*
	 * Some TS errors as formatted as diagnostic "chains"
	 * We represent them by joining the parts of the message with newlines
	 */
	it("TS diagnostic chain", () => {
		// @ts-expect-error
		attest(() => shouldThrow({} as {} | false)).type.errors.snap(
			`Argument of type 'false | {}' is not assignable to parameter of type 'false'.Type '{}' is not assignable to type 'false'.`
		)
	})

	it("multiple inline snaps", () => {
		attest("firstLine\nsecondLine").snap(`firstLine
secondLine`)
		attest("firstLine\nsecondLine").snap(`firstLine
secondLine`)
	})
})


================================================
FILE: ark/attest/__tests__/snapExpectedOutput.ts
================================================
import { attest, cleanup, setup } from "@ark/attest"
import type { makeComplexType } from "./utils.ts"

setup({ typeToStringFormat: { useTabs: true } })

attest({ re: "do" }).equals({ re: "do" }).type.toString.snap("{ re: string }")

attest({
	ark: "type",
	type: "script",
	vali: "dator",
	opti: "mized",
	from: "editor",
	to: "runtime"
}).snap({
	ark: "type",
	type: "script",
	vali: "dator",
	opti: "mized",
	from: "editor",
	to: "runtime"
}).type.toString.snap(`{
	ark: string
	type: string
	vali: string
	opti: string
	from: string
	to: string
}`)

attest(5).snap(5)

attest({ re: "do" }).snap({ re: "do" })

// @ts-expect-error (using internal updateSnapshots hook)
attest({ re: "dew" }, { cfg: { updateSnapshots: true } }).snap({ re: "dew" })

// @ts-expect-error (using internal updateSnapshots hook)
attest(5, { cfg: { updateSnapshots: true } }).snap(5)

attest(5n).snap(5n)

attest(-5n).snap(-5n)

attest({ a: 4n }).snap({ a: 4n })

attest(undefined).snap(undefined)

attest("undefined").snap("undefined")

attest({ a: undefined }).snap({ a: undefined })

attest("multiline\nmultiline").snap(`multiline
multiline`)

attest("with `quotes`").snap("with `quotes`")

attest({
	a2z: `a"'${"" as string}'"z`,
	z2a: `z"'${"" as string}'"a`,
	ark: "type",
	type: "ark"
} as const).type.toString.snap(`{
	readonly a2z: \`a"'\${string}'"z\`
	readonly z2a: \`z"'\${string}'"a\`
	readonly ark: "type"
	readonly type: "ark"
}`)

attest({ [Symbol("mySymbol")]: 1 }).snap({ "Symbol(mySymbol)": 1 })

const it = (name: string, fn: () => void) => fn()

it("can snap instantiations", () => {
	attest.instantiations([212, "instantiations"])
	return {} as makeComplexType<"asbsdfsaodisfhsda">
})

cleanup()


================================================
FILE: ark/attest/__tests__/snapPopulation.test.ts
================================================
import { contextualize } from "@ark/attest"
import { fromHere, readFile } from "@ark/fs"
import { equal } from "node:assert/strict"
import { runThenGetContents } from "./utils.ts"

contextualize(() => {
	it("bench populates file", () => {
		const actual = runThenGetContents(fromHere("benchTemplate.ts"))
		const expectedOutput = readFile(fromHere("benchExpectedOutput.ts")).replace(
			/\r\n/g,
			"\n"
		)
		equal(actual, expectedOutput)
	}).timeout(60000)

	it("snap populates file", () => {
		const actual = runThenGetContents(fromHere("snapTemplate.ts"))
		const expectedOutput = readFile(fromHere("snapExpectedOutput.ts")).replace(
			/\r\n/g,
			"\n"
		)
		equal(actual, expectedOutput)
	}).timeout(60000)
})


================================================
FILE: ark/attest/__tests__/snapTemplate.ts
================================================
import { attest, cleanup, setup } from "@ark/attest"
import type { makeComplexType } from "./utils.ts"

setup({ typeToStringFormat: { useTabs: true } })

attest({ re: "do" }).equals({ re: "do" }).type.toString.snap()

attest({
	ark: "type",
	type: "script",
	vali: "dator",
	opti: "mized",
	from: "editor",
	to: "runtime"
})
	.snap()
	.type.toString.snap()

attest(5).snap()

attest({ re: "do" }).snap()

// @ts-expect-error (using internal updateSnapshots hook)
attest({ re: "dew" }, { cfg: { updateSnapshots: true } }).snap({ re: "do" })

// @ts-expect-error (using internal updateSnapshots hook)
attest(5, { cfg: { updateSnapshots: true } }).snap(6)

attest(5n).snap()

attest(-5n).snap()

attest({ a: 4n }).snap()

attest(undefined).snap()

attest("undefined").snap()

attest({ a: undefined }).snap()

attest("multiline\nmultiline").snap()

attest("with `quotes`").snap()

attest({
	a2z: `a"'${"" as string}'"z`,
	z2a: `z"'${"" as string}'"a`,
	ark: "type",
	type: "ark"
} as const).type.toString.snap()

attest({ [Symbol("mySymbol")]: 1 }).snap()

const it = (name: string, fn: () => void) => fn()

it("can snap instantiations", () => {
	attest.instantiations()
	return {} as makeComplexType<"asbsdfsaodisfhsda">
})

cleanup()


================================================
FILE: ark/attest/__tests__/unwrap.test.ts
================================================
import { attest, contextualize } from "@ark/attest"
import type { Completions } from "@ark/attest/internal/cache/writeAssertionCache.ts"
import type { autocomplete } from "@ark/util"

contextualize(() => {
	it("unwraps unversioned", () => {
		const unwrapped = attest({ foo: "bar" }).unwrap()
		attest<{ foo: string }>(unwrapped).equals({
			foo: "bar"
		})
	})

	it("unwraps serialized", () => {
		const unwrapped = attest({ foo: Symbol("unwrappedSymbol") }).unwrap({
			serialize: true
		})
		attest(unwrapped).snap({ foo: "Symbol(unwrappedSymbol)" })
	})

	it("unwraps completions", () => {
		const unwrapped = attest({ foo: "b" } satisfies {
			foo: autocomplete<"bar">
		}).completions.unwrap()

		attest<Completions>(unwrapped).snap({ b: ["bar"] })
	})
})


================================================
FILE: ark/attest/__tests__/utils.ts
================================================
import { dirName, fromHere, readFile, shell } from "@ark/fs"
import { copyFileSync, rmSync } from "node:fs"

export const runThenGetContents = (templatePath: string): string => {
	rmSync(fromHere(".attest"), { force: true, recursive: true })

	const tempPath = templatePath + ".temp.ts"
	copyFileSync(templatePath, tempPath)
	try {
		shell(`node --import=tsx ${tempPath}`, {
			cwd: dirName(),
			env: {
				ATTEST_failOnMissingSnapshots: "0"
			}
		})
	} catch (e) {
		console.error(e)
	}
	const resultContents = readFile(tempPath)
	rmSync(tempPath)
	return resultContents
}

// type is used in benchTemplate.ts to test compatibility with external modules
export type makeComplexType<S extends string> =
	S extends `${infer head}${infer tail}` ? head | tail | makeComplexType<tail>
	:	S


================================================
FILE: ark/attest/assert/assertions.ts
================================================
import { printable, throwInternalError } from "@ark/util"
import type { type } from "arktype"
import * as assert from "node:assert/strict"
import type { TypeRelationshipAssertionData } from "../cache/writeAssertionCache.ts"
import type { AssertionContext } from "./attest.ts"

export type ThrowAssertionErrorContext = {
	message: string
	expected?: unknown
	actual?: unknown
	stack: string
}

export const throwAssertionError = ({
	stack,
	...errorArgs
}: ThrowAssertionErrorContext): never => {
	const e = new assert.AssertionError(errorArgs)
	e.stack = stack
	throw e
}

export class MissingSnapshotError extends Error {}

export type AssertFn = (
	expected: unknown,
	actual: unknown,
	ctx: AssertionContext
) => void

export type MappedTypeAssertionResult = {
	actual: unknown
	expected?: unknown
} | null

export type TypeAssertionMapper = (
	data: TypeRelationshipAssertionData,
	ctx: AssertionContext
) => MappedTypeAssertionResult

export class TypeAssertionMapping {
	fn: TypeAssertionMapper

	constructor(fn: TypeAssertionMapper) {
		this.fn = fn
	}
}

export const versionableAssertion =
	(fn: AssertFn): AssertFn =>
	(expected, actual, ctx) => {
		if (actual instanceof TypeAssertionMapping) {
			if (!ctx.typeRelationshipAssertionEntries) {
				throwInternalError(
					`Unexpected missing typeAssertionEntries when passed a TypeAssertionMapper`
				)
			}
			for (const [version, data] of ctx.typeRelationshipAssertionEntries) {
				let errorMessage = ""
				try {
					const mapped = actual.fn(data, ctx)
					if (mapped !== null) {
						fn(
							"expected" in mapped ? mapped.expected : expected,
							mapped.actual,
							ctx
						)
					}
				} catch (e) {
					errorMessage += `❌TypeScript@${version}:${e}\n`
				}
				if (errorMessage) {
					throwAssertionError({
						stack: ctx.assertionStack,
						message: errorMessage
					})
				}
			}
		} else fn(expected, actual, ctx)
	}

const unversionedAssertEquals: AssertFn = (expected, actual, ctx) => {
	if (expected === actual) return

	try {
		if (
			typeof expected === "object" &&
			expected !== null &&
			typeof actual === "object" &&
			actual !== null
		) {
			if (expected.constructor === actual.constructor)
				assert.deepStrictEqual(actual, expected)
			else {
				const serializedExpected = printable(expected)
				const serializedActual = printable(actual)
				throw new assert.AssertionError({
					message: `Objects did not have the same constructor:
Expected: ${serializedExpected}
Actual: ${serializedActual}`,
					expected: serializedExpected,
					actual: serializedActual
				})
			}
		} else if (
			typeof expected === "object" ||
			typeof expected === "function" ||
			typeof actual === "function" ||
			typeof actual === "function"
		) {
			const serializedExpected = printable(expected)
			const serializedActual = printable(actual)
			throw new assert.AssertionError({
				message: `Assertion including at least one function or object was not between reference equal items
Expected: ${serializedExpected}
Actual: ${serializedActual}`,
				expected: serializedExpected,
				actual: serializedActual
			})
			// guaranteed to be two primitives at this point
		} else assert.equal(actual, expected)
	} catch (e: any) {
		// some nonsense to get a good stack trace
		e.stack = ctx.assertionStack
		throw e
	}
}

export const assertEquals: AssertFn = versionableAssertion(
	unversionedAssertEquals
)

const unversionedAssertSatisfies = (
	t: type.Any,
	data: unknown,
	ctx: AssertionContext
) => {
	try {
		t.assert(data)
	} catch (e: any) {
		e.stack = ctx.assertionStack
		throw e
	}
}

export const assertSatisfies = versionableAssertion(
	unversionedAssertSatisfies as never
)

export const typeEqualityMapping: TypeAssertionMapping =
	new TypeAssertionMapping(data => {
		const expected = data.typeArgs[0]
		const actual = data.typeArgs[1] ?? data.args[0]
		if (!expected || !actual)
			throwInternalError(`Unexpected type data ${printable(data)}`)

		if (actual.relationships.typeArgs[0] !== "equality") {
			return {
				expected: expected.type,
				actual:
					expected.type === actual.type ?
						"(serializes to same value)"
					:	actual.type
			}
		}
		return null
	})

export const assertEqualOrMatching: AssertFn = versionableAssertion(
	(expected, actual, ctx) => {
		const assertionArgs = { actual, expected, stack: ctx.assertionStack }
		if (typeof actual !== "string") {
			throwAssertionError({
				message: `Value was of type ${typeof actual} (expected a string).`,
				...assertionArgs
			})
		} else if (typeof expected === "string") {
			if (!actual.includes(expected)) {
				throwAssertionError({
					message: `Expected string '${expected}' did not appear in actual string '${actual}'.`,
					...assertionArgs
				})
			}
		} else if (expected instanceof RegExp) {
			if (!expected.test(actual)) {
				throwAssertionError({
					message: `Actual string '${actual}' did not match regex '${expected.source}'.`,
					...assertionArgs
				})
			}
		} else {
			throw new Error(
				`Expected value for this assertion should be a string or RegExp.`
			)
		}
	}
)

export type AssertedFnCallResult = {
	returned?: unknown
	threw?: string
}
export const getThrownMessage = (
	result: AssertedFnCallResult,
	ctx: AssertionContext
): string | undefined => {
	if (!("threw" in result)) {
		throwAssertionError({
			message: "Function didn't throw",
			stack: ctx.assertionStack
		})
	}

	return result.threw
}
export const callAssertedFunction = (
	asserted: Function
): AssertedFnCallResult => {
	const result: AssertedFnCallResult = {}
	try {
		result.returned = asserted()
	} catch (error) {
		result.threw = String(error)
	}
	return result
}


================================================
FILE: ark/attest/assert/attest.ts
================================================
import { caller, getCallStack, type SourcePosition } from "@ark/fs"
import type { ErrorMessage } from "@ark/util"
import { getBenchCtx } from "../bench/bench.ts"
import type { Measure } from "../bench/measure.ts"
import { instantiationDataHandler } from "../bench/type.ts"
import {
	getTypeAssertionsAtPosition,
	type VersionedTypeAssertion
} from "../cache/getCachedAssertions.ts"
import { getConfig, type AttestConfig } from "../config.ts"
import {
	assertEquals,
	typeEqualityMapping,
	type TypeAssertionMapping
} from "./assertions.ts"
import {
	ChainableAssertions,
	type AssertionKind,
	type rootAssertions
} from "./chainableAssertions.ts"

export type AttestFn = {
	<expected, actual extends expected = never>(
		...args: actual extends never ?
			[
				ErrorMessage<"Type-only assertion requires two explicit generic params, e.g. attest<expected, actual>">
			]
		:	[]
	): void

	<expected>(actual: expected): rootAssertions<expected, AssertionKind>

	instantiations: (count?: Measure<"instantiations"> | undefined) => void
}

export type VersionableActual = {} | null | undefined | TypeAssertionMapping

export type AssertionContext = {
	versionableActual: VersionableActual
	originalAssertedValue: unknown
	cfg: AttestConfig
	allowRegex: boolean
	position: SourcePosition
	defaultExpected?: unknown
	assertionStack: string
	typeRelationshipAssertionEntries?: VersionedTypeAssertion<"type">[]
	typeBenchmarkingAssertionEntries?: VersionedTypeAssertion<"bench">[]
	lastSnapName?: string
}

export type InternalAssertionHooks = {
	[k in keyof AssertionContext]?: k extends "cfg" ? Partial<AttestConfig>
	:	AssertionContext[k]
}

export const attestInternal = (
	value?: unknown,
	{ cfg: cfgHooks, ...ctxHooks }: InternalAssertionHooks = {}
): ChainableAssertions => {
	const position = caller()
	const cfg = { ...getConfig(), ...cfgHooks }
	const ctx: AssertionContext = {
		versionableActual: value,
		allowRegex: false,
		originalAssertedValue: value,
		position,
		cfg,
		assertionStack: getCallStack({ offset: 1 }).join("\n"),
		...ctxHooks
	}
	if (!cfg.skipTypes) {
		ctx.typeRelationshipAssertionEntries = getTypeAssertionsAtPosition(position)
		if (ctx.typeRelationshipAssertionEntries[0]?.[1].typeArgs[0]) {
			// if there is an expected type arg, check it immediately
			assertEquals(undefined, typeEqualityMapping, ctx)
		}
	}
	return new ChainableAssertions(ctx)
}

export const attest: AttestFn = Object.assign(attestInternal, {
	instantiations: (args: Measure<"instantiations"> | undefined) => {
		const attestConfig = getConfig()
		if (attestConfig.skipTypes || attestConfig.skipInlineInstantiations) return

		const calledFrom = caller()
		const ctx = getBenchCtx([calledFrom.file])
		ctx.benchCallPosition = calledFrom
		ctx.lastSnapCallPosition = calledFrom
		instantiationDataHandler(
			{ ...ctx, lastSnapFunctionName: "instantiations" },
			args,
			false
		)
	}
}) as never


================================================
FILE: ark/attest/assert/chainableAssertions.ts
================================================
import { caller, positionToString } from "@ark/fs"
import {
	printable,
	snapshot,
	type Constructor,
	type ErrorType,
	type isDisjoint
} from "@ark/util"
import prettier from "@prettier/sync"
import { type } from "arktype"
import * as assert from "node:assert/strict"
import { isDeepStrictEqual } from "node:util"
import {
	getSnapshotByName,
	queueSnapshotUpdate,
	updateExternalSnapshot,
	type SnapshotArgs
} from "../cache/snapshots.ts"
import type { Completions } from "../cache/writeAssertionCache.ts"
import { getConfig } from "../config.ts"
import { chainableNoOpProxy } from "../utils.ts"
import {
	MissingSnapshotError,
	TypeAssertionMapping,
	assertEqualOrMatching,
	assertEquals,
	assertSatisfies,
	callAssertedFunction,
	getThrownMessage,
	throwAssertionError
} from "./assertions.ts"
import type { AssertionContext, VersionableActual } from "./attest.ts"

export type ChainableAssertionOptions = {
	allowRegex?: boolean
	defaultExpected?: unknown
}

type AssertionRecord = Record<keyof rootAssertions<any, AssertionKind>, unknown>

export type UnwrapOptions = {
	versionable?: boolean
	serialize?: boolean
}

export class ChainableAssertions implements AssertionRecord {
	private ctx: AssertionContext

	constructor(ctx: AssertionContext) {
		this.ctx = ctx
	}

	private get unversionedActual(): unknown {
		if (this.versionableActual instanceof TypeAssertionMapping) {
			return this.versionableActual.fn(
				this.ctx.typeRelationshipAssertionEntries![0][1],
				this.ctx
			)!.actual
		}
		return this.versionableActual
	}

	private get versionableActual(): VersionableActual {
		return this.ctx.versionableActual
	}

	private get serializedActual(): unknown {
		return snapshot(this.unversionedActual)
	}

	unwrap(opts?: UnwrapOptions): unknown {
		const value =
			opts?.versionable ? this.versionableActual : this.unversionedActual
		return opts?.serialize ? snapshot(value) : value
	}

	private snapRequiresUpdate(expectedSerialized: unknown) {
		return (
			!isDeepStrictEqual(this.serializedActual, expectedSerialized) ||
			// If actual is undefined, we still need to write the "undefined" literal
			// to the snap even though it will serialize to the same value as the (nonexistent) first arg
			this.unversionedActual === undefined
		)
	}

	get unknown(): this {
		return this
	}

	is(expected: unknown): this {
		assert.equal(this.unversionedActual, expected)
		return this
	}

	equals(expected: unknown): this {
		assertEquals(expected, this.versionableActual, this.ctx)
		return this
	}

	satisfies(def: unknown): this {
		assertSatisfies(type.raw(def), this.versionableActual, this.ctx)
		return this
	}

	instanceOf(expected: Constructor): this {
		if (!(this.versionableActual instanceof expected)) {
			throwAssertionError({
				stack: this.ctx.assertionStack,
				message: `Expected an instance of ${expected.name} (was ${
					(
						typeof this.versionableActual === "object" &&
						this.versionableActual !== null
					) ?
						this.versionableActual.constructor.name
					:	this.serializedActual
				})`
			})
		}
		return this
	}

	get snap(): snapProperty<unknown, AssertionKind> {
		// Use variadic args to distinguish undefined being passed explicitly from no args
		const inline = (...args: unknown[]) => {
			const snapName = this.ctx.lastSnapName ?? "snap"
			const expectedSerialized = snapshot(args[0])
			if (!args.length || this.ctx.cfg.updateSnapshots) {
				const position = caller()
				if (this.ctx.cfg.failOnMissingSnapshots) {
					throw new MissingSnapshotError(
						`.${snapName}() at ${positionToString(position)} must be populated.`
					)
				}
				if (this.snapRequiresUpdate(expectedSerialized)) {
					const snapshotArgs: SnapshotArgs = {
						position,
						serializedValue: this.serializedActual,
						snapFunctionName: snapName
					}
					queueSnapshotUpdate(snapshotArgs)
				}
			} else {
				// compare as strings, but if match fails, compare again as objects
				// to give a clearer error message. This avoid problems with objects
				// like subtypes of array that do not pass node's deep equality test
				// but serialize to the same value.
				if (printable(args[0]) !== printable(this.unversionedActual))
					assertEquals(expectedSerialized, this.serializedActual, this.ctx)
			}
			return this
		}
		const toFile = (id: string, opts?: ExternalSnapshotOptions) => {
			const expectedSnapshot = getSnapshotByName(
				this.ctx.position.file,
				id,
				opts?.path
			)
			if (!expectedSnapshot || this.ctx.cfg.updateSnapshots) {
				if (this.snapRequiresUpdate(expectedSnapshot)) {
					updateExternalSnapshot({
						serializedValue: this.serializedActual,
						position: caller(),
						name: id,
						customPath: opts?.path
					})
				}
			} else assertEquals(expectedSnapshot, this.serializedActual, this.ctx)

			return this
		}
		return Object.assign(inline, {
			toFile,
			unwrap: this.unwrap.bind(this)
		})
	}

	private immediateOrChained() {
		const immediateAssertion = (...args: [expected: unknown]) => {
			let expected
			if (args.length) expected = args[0]
			else {
				if ("defaultExpected" in this.ctx) expected = this.ctx.defaultExpected
				else {
					throw new Error(
						`Assertion call requires an arg representing the expected value.`
					)
				}
			}
			if (this.ctx.allowRegex)
				assertEqualOrMatching(expected, this.versionableActual, this.ctx)
			else assertEquals(expected, this.versionableActual, this.ctx)

			return this
		}
		return new Proxy(immediateAssertion, {
			get: (target, prop) => (this as any)[prop]
		})
	}

	get throws(): unknown {
		const result = callAssertedFunction(this.unversionedActual as Function)
		this.ctx.versionableActual = getThrownMessage(result, this.ctx)
		this.ctx.allowRegex = true
		this.ctx.defaultExpected = ""
		return this.immediateOrChained()
	}

	throwsAndHasTypeError(matchValue: string | RegExp): void {
		assertEqualOrMatching(
			matchValue,
			getThrownMessage(
				callAssertedFunction(this.unversionedActual as Function),
				this.ctx
			),
			this.ctx
		)
		if (!this.ctx.cfg.skipTypes) {
			assertEqualOrMatching(
				matchValue,
				new TypeAssertionMapping(data => ({
					actual: data.errors.join("\n")
				})),
				this.ctx
			)
		}
	}

	get completions(): any {
		if (this.ctx.cfg.skipTypes) return chainableNoOpProxy

		this.ctx.versionableActual = new TypeAssertionMapping(data => {
			if (typeof data.completions === "string") {
				// if the completions were ambiguously defined, e.g. two string
				// literals with the same value, they are writen as an error
				// message to the JSON. Throw it immediately.
				throw new Error(data.completions)
			}
			return { actual: data.completions }
		})
		this.ctx.lastSnapName = "completions"
		return this.snap
	}

	get jsdoc(): any {
		if (this.ctx.cfg.skipTypes) return chainableNoOpProxy

		this.ctx.versionableActual = new TypeAssertionMapping(data => ({
			actual: formatTypeString(data.jsdoc ?? "")
		}))
		this.ctx.allowRegex = true
		return this.immediateOrChained()
	}

	get type(): any {
		if (this.ctx.cfg.skipTypes) return chainableNoOpProxy

		// We need to bind this to return an object with getters
		const self = this
		return {
			get toString() {
				self.ctx.versionableActual = new TypeAssertionMapping(data => ({
					actual: formatTypeString(data.args[0].type)
				}))
				self.ctx.allowRegex = true
				return self.immediateOrChained()
			},
			get errors() {
				self.ctx.versionableActual = new TypeAssertionMapping(data => ({
					actual: data.errors.join("\n")
				}))
				self.ctx.allowRegex = true
				return self.immediateOrChained()
			},
			get completions() {
				return self.completions
			}
		}
	}
}

const declarationPrefix = "type T = "

const formatTypeString = (typeString: string) =>
	prettier
		.format(`${declarationPrefix}${typeString}`, {
			semi: false,
			printWidth: 60,
			trailingComma: "none",
			parser: "typescript",
			...getConfig().typeToStringFormat
		})
		.slice(declarationPrefix.length)
		.trimEnd()

export type AssertionKind = "value" | "type"

export type rootAssertions<t, kind extends AssertionKind> = valueAssertions<
	t,
	kind
> &
	TypeAssertionsRoot

export type valueAssertions<
	t,
	kind extends AssertionKind
> = comparableValueAssertion<t, kind> &
	([t] extends [() => unknown] ? functionAssertions<kind> : {})

export type nextAssertions<kind extends AssertionKind> =
	"type" extends kind ? TypeAssertionsRoot : {}

export type inferredAssertions<
	argsType extends [value: any, ...rest: any[]],
	kind extends AssertionKind,
	chained = argsType[0]
> = rootAssertions<chained, kind> &
	(<Args extends argsType | [] = []>(...args: Args) => nextAssertions<kind>)

export type ChainContext = {
	allowRegex?: boolean
	defaultExpected?: unknown
}

export type functionAssertions<kind extends AssertionKind> = {
	throws: inferredAssertions<[message: string | RegExp], kind, string>
} & ("type" extends kind ?
	{
		throwsAndHasTypeError: (message: string | RegExp) => undefined
	}
:	{})

export type valueFromTypeAssertion<
	expected,
	chained = expected
> = inferredAssertions<[expected: expected], "value", chained>

type snapProperty<expected, kind extends AssertionKind> = {
	(expected?: snapshot<expected>): nextAssertions<kind>
	toFile: (
		id: string,
		options?: ExternalSnapshotOptions
	) => nextAssertions<kind>
	unwrap: Unwrapper<expected>
}

export type Unwrapper<expected = unknown> = (opts?: UnwrapOptions) => expected

export const nonOverlappingSatisfiesMessage =
	"This type has no overlap with your satisfies constraint"

export type nonOverlappingSatisfiesMessage =
	typeof nonOverlappingSatisfiesMessage

type validateExpectedOverlaps<expected, satisfies> =
	isDisjoint<expected, satisfies> extends true ?
		ErrorType<nonOverlappingSatisfiesMessage>
	:	unknown

export type comparableValueAssertion<expected, kind extends AssertionKind> = {
	snap: snapProperty<expected, kind>
	equals: (value: expected) => nextAssertions<kind>
	instanceOf: (constructor: Constructor) => nextAssertions<kind>
	is: (value: expected) => nextAssertions<kind>
	completions: CompletionsSnap
	jsdoc: comparableValueAssertion<string, kind>
	satisfies: <const def>(
		def: type.validate<def> &
			validateExpectedOverlaps<expected, type.infer.In<def>>
	) => nextAssertions<kind>
	// This can be used to assert values without type constraints
	unknown: Omit<comparableValueAssertion<unknown, kind>, "unknown">
	unwrap: Unwrapper<expected>
}

export interface CompletionsSnap {
	(value?: Completions): void
	unwrap: Unwrapper<Completions>
}

export type TypeAssertionsRoot = {
	type: TypeAssertionProps
}

export type TypeAssertionProps = {
	toString: valueFromTypeAssertion<string | RegExp>
	errors: valueFromTypeAssertion<string | RegExp, string>
	completions: CompletionsSnap
}

export type ExternalSnapshotOptions = {
	path?: string
}


================================================
FILE: ark/attest/bench/await1k.ts
================================================
export const await1K = async (fn: () => Promise<void>): Promise<void> => {
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
	await fn()
}


================================================
FILE: ark/attest/bench/baseline.ts
================================================
import { snapshot, throwInternalError } from "@ark/util"
import process from "node:process"
import { throwAssertionError } from "../assert/assertions.ts"
import {
	queueSnapshotUpdate,
	writeSnapshotUpdatesOnExit
} from "../cache/snapshots.ts"
import type { BenchContext } from "./bench.ts"
import {
	stringifyMeasure,
	type MarkMeasure,
	type Measure,
	type MeasureComparison
} from "./measure.ts"

export const queueBaselineUpdateIfNeeded = (
	updated: Measure | MarkMeasure,
	baseline: Measure | MarkMeasure | undefined,
	ctx: BenchContext
): void => {
	// If we already have a baseline and the user didn't pass an update flag, do nothing
	if (baseline && !ctx.cfg.updateSnapshots) return

	const serializedValue = snapshot(updated)
	if (!ctx.lastSnapCallPosition) {
		throwInternalError(
			`Unable to update baseline for ${ctx.qualifiedName} ('lastSnapCallPosition' was unset)`
		)
	}
	if (!ctx.lastSnapFunctionName) {
		throwInternalError(
			`Unable to update baseline for ${ctx.qualifiedName} ('lastSnapFunctionName' was unset)`
		)
	}
	queueSnapshotUpdate({
		position: ctx.lastSnapCallPosition,
		serializedValue,
		snapFunctionName: ctx.lastSnapFunctionName,
		baselinePath: ctx.qualifiedPath
	})

	if (ctx.benchCallPosition) writeSnapshotUpdatesOnExit()
}

/** Pretty print comparison and set the process.exitCode to 1 if delta threshold is exceeded */
export const compareToBaseline = (
	result: MeasureComparison,
	ctx: BenchContext
): void => {
	console.log(`⛳ Result: ${stringifyMeasure(result.updated)}`)
	if (result.baseline && !ctx.cfg.updateSnapshots) {
		console.log(`🎯 Baseline: ${stringifyMeasure(result.baseline)}`)
		const delta =
			((result.updated[0] - result.baseline[0]) / result.baseline[0]) * 100
		const formattedDelta = `${delta.toFixed(2)}%`
		if (delta > ctx.cfg.benchPercentThreshold)
			handlePositiveDelta(formattedDelta, ctx)
		else if (delta < -ctx.cfg.benchPercentThreshold)
			handleNegativeDelta(formattedDelta, ctx)
		else console.log(`📊 Delta: ${delta > 0 ? "+" : ""}${formattedDelta}`)
		// add an extra newline
		console.log()
	}
}

const handlePositiveDelta = (formattedDelta: string, ctx: BenchContext) => {
	const message = `'${ctx.qualifiedName}' exceeded baseline by ${formattedDelta} (threshold is ${ctx.cfg.benchPercentThreshold}%).`
	console.error(`📈 ${message}`)
	const benchErrorConfig = ctx.cfg.benchErrorOnThresholdExceeded
	const isTypeBench = ctx.lastSnapFunctionName === "instantiations"
	const shouldError =
		benchErrorConfig === true ||
		(isTypeBench ?
			benchErrorConfig === "types"
		:	benchErrorConfig === "runtime")
	if (shouldError) {
		const errorSummary = `❌ ${message}`
		if (ctx.lastSnapFunctionName === "instantiations")
			throwAssertionError({ stack: ctx.assertionStack, message: errorSummary })
		else {
			process.exitCode = 1
			// Summarize failures at the end of output
			process.on("exit", () => {
				console.error(errorSummary)
			})
		}
	}
}

const handleNegativeDelta = (formattedDelta: string, ctx: BenchContext) => {
	console.log(
		// Remove the leading negative when formatting our delta
		`📉 ${ctx.qualifiedName} was under baseline by ${formattedDelta.slice(
			1
		)}! Consider setting a new baseline.`
	)
}


================================================
FILE: ark/attest/bench/bench.ts
================================================
import { caller, getCallStack, rmRf, type SourcePosition } from "@ark/fs"
import { performance } from "node:perf_hooks"
import {
	ensureCacheDirs,
	getConfig,
	type ParsedAttestConfig
} from "../config.ts"
import { chainableNoOpProxy } from "../utils.ts"
import { await1K } from "./await1k.ts"
import { compareToBaseline, queueBaselineUpdateIfNeeded } from "./baseline.ts"
import { call1K } from "./call1k.ts"
import {
	createTimeComparison,
	createTimeMeasure,
	type MarkMeasure,
	type Measure,
	type TimeUnit
} from "./measure.ts"
import { createBenchTypeAssertion, type BenchTypeAssertions } from "./type.ts"

export type StatName = keyof typeof stats

export type TimeAssertionName = StatName | "mark"

let benchHasRun = false

type BenchFn = <fn extends BenchableFunction>(
	name: string,
	fn: fn,
	options?: BenchOptions
) => InitialBenchAssertions<fn>

export interface Bench extends BenchFn {
	baseline: <T>(baselineExpressions: () => T) => void
}

const benchFn: BenchFn = (name, fn, options) => {
	const qualifiedPath = [...currentSuitePath, name]
	console.log(`🏌️  ${qualifiedPath.join("/")}`)
	const ctx = getBenchCtx(
		qualifiedPath,
		fn.constructor.name === "AsyncFunction",
		options
	)

	if (!benchHasRun) {
		rmRf(ctx.cfg.cacheDir)
		ensureCacheDirs()
		benchHasRun = true
	}

	ctx.benchCallPosition = caller()

	if (
		typeof ctx.cfg.filter === "string" &&
		!qualifiedPath.includes(ctx.cfg.filter)
	)
		return chainableNoOpProxy
	else if (
		Array.isArray(ctx.cfg.filter) &&
		ctx.cfg.filter.some((segment, i) => segment !== qualifiedPath[i])
	)
		return chainableNoOpProxy

	const assertions = new BenchAssertions(fn, ctx)
	Object.assign(assertions, createBenchTypeAssertion(ctx))
	return assertions as never
}

export const bench: Bench = Object.assign(benchFn, {
	baseline: () => {}
})

export const stats = {
	mean: (callTimes: number[]): number => {
		const totalCallMs = callTimes.reduce((sum, duration) => sum + duration, 0)
		return totalCallMs / callTimes.length
	},
	median: (callTimes: number[]): number => {
		const middleIndex = Math.floor(callTimes.length / 2)
		const ms =
			callTimes.length % 2 === 0 ?
				(callTimes[middleIndex - 1] + callTimes[middleIndex]) / 2
			:	callTimes[middleIndex]
		return ms
	}
}

class ResultCollector {
	results: number[] = []
	private benchStart = performance.now()
	private bounds: Required<UntilOptions>
	private lastInvocationStart: number
	private ctx: BenchContext

	constructor(ctx: BenchContext) {
		this.ctx = ctx
		// By default, will run for either 5 seconds or 100_000 call sets (of 1000 calls), whichever comes first
		this.bounds = {
			ms: 5000,
			count: 100_000,
			...ctx.options.until
		}
		this.lastInvocationStart = -1
	}

	start() {
		this.ctx.options.hooks?.beforeCall?.()
		this.lastInvocationStart = performance.now()
	}

	stop() {
		this.results.push((performance.now() - this.lastInvocationStart) / 1000)
		this.ctx.options.hooks?.afterCall?.()
	}

	done() {
		const metMsTarget = performance.now() - this.benchStart >= this.bounds.ms
		const metCountTarget = this.results.length >= this.bounds.count
		return metMsTarget || metCountTarget
	}
}

const loopCalls = (fn: () => void, ctx: BenchContext) => {
	const collector = new ResultCollector(ctx)
	while (!collector.done()) {
		collector.start()
		// we use a function like this to make 1k explicit calls to the function
		// to avoid certain optimizations V8 makes when looping
		call1K(fn)
		collector.stop()
	}
	return collector.results
}

const loopAsyncCalls = async (fn: () => Promise<void>, ctx: BenchContext) => {
	const collector = new ResultCollector(ctx)
	while (!collector.done()) {
		collector.start()
		await await1K(fn)
		collector.stop()
	}
	return collector.results
}

export class BenchAssertions<
	Fn extends BenchableFunction,
	NextAssertions = BenchTypeAssertions,
	ReturnedAssertions = Fn extends () => Promise<void> ? Promise<NextAssertions>
	:	NextAssertions
> {
	private label: string
	private lastCallTimes: number[] | undefined
	private fn: Fn
	private ctx: BenchContext

	constructor(fn: Fn, ctx: BenchContext) {
		this.fn = fn
		this.ctx = ctx
		this.label = `Call: ${ctx.qualifiedName}`
	}

	private applyCallTimeHooks() {
		if (this.ctx.options.fakeCallMs !== undefined) {
			const fakeMs =
				this.ctx.options.fakeCallMs === "count" ?
					this.lastCallTimes!.length
				:	this.ctx.options.fakeCallMs
			this.lastCallTimes = this.lastCallTimes!.map(() => fakeMs)
		}
	}

	private callTimesSync() {
		if (!this.lastCallTimes) {
			this.lastCallTimes = loopCalls(this.fn as never, this.ctx)
			this.lastCallTimes.sort()
		}
		this.applyCallTimeHooks()
		return this.lastCallTimes
	}

	private async callTimesAsync() {
		if (!this.lastCallTimes) {
			this.lastCallTimes = await loopAsyncCalls(this.fn as never, this.ctx)
			this.lastCallTimes.sort()
		}
		this.applyCallTimeHooks()
		return this.lastCallTimes
	}

	private createAssertion<Name extends TimeAssertionName>(
		name: Name,
		baseline: Name extends "mark" ?
			Record<StatName, Measure<TimeUnit>> | undefined
		:	Measure<TimeUnit> | undefined,
		callTimes: number[]
	) {
		if (name === "mark") return this.markAssertion(baseline as never, callTimes)

		const ms: number = stats[name as StatName](callTimes)
		const comparison = createTimeComparison(ms, baseline as Measure<TimeUnit>)
		console.group(`${this.label} (${name}):`)
		compareToBaseline(comparison, this.ctx)
		console.groupEnd()
		queueBaselineUpdateIfNeeded(createTimeMeasure(ms), baseline, {
			...this.ctx,
			lastSnapFunctionName: name
		})
		return this.getNextAssertions()
	}

	private markAssertion(
		baseline: MarkMeasure | undefined,
		callTimes: number[]
	) {
		console.group(`${this.label}:`)
		const markEntries: [StatName, Measure<TimeUnit> | undefined][] = (
			baseline ?
				Object.entries(baseline)
				// If nothing was passed, gather all available baselines by setting their values to undefined.
			:	Object.entries(stats).map(([kind]) => [kind, undefined])) as never
		const markResults = Object.fromEntries(
			markEntries.map(([kind, kindBaseline]) => {
				console.group(kind)
				const ms = stats[kind](callTimes)
				const comparison = createTimeComparison(ms, kindBaseline)
				compareToBaseline(comparison, this.ctx)
				console.groupEnd()
				return [kind, comparison.updated]
			})
		)
		console.groupEnd()
		queueBaselineUpdateIfNeeded(markResults, baseline, {
			...this.ctx,
			lastSnapFunctionName: "mark"
		})
		return this.getNextAssertions()
	}

	private getNextAssertions(): NextAssertions {
		return createBenchTypeAssertion(this.ctx) as never
	}

	private createStatMethod<Name extends TimeAssertionName>(
		name: Name,
		baseline: Name extends "mark" ?
			Record<StatName, Measure<TimeUnit>> | undefined
		:	Measure<TimeUnit> | undefined
	) {
		if (this.ctx.isAsync) {
			return new Promise(resolve => {
				this.callTimesAsync().then(
					callTimes => {
						resolve(this.createAssertion(name, baseline, callTimes))
					},
					e => {
						this.addUnhandledBenchException(e)
						resolve(chainableNoOpProxy)
					}
				)
			})
		}
		let assertions = chainableNoOpProxy
		try {
			assertions = this.createAssertion(name, baseline, this.callTimesSync())
		} catch (e) {
			this.addUnhandledBenchException(e)
		}
		return assertions
	}

	private addUnhandledBenchException(reason: unknown) {
		const message = `Bench ${
			this.ctx.qualifiedName
		} threw during execution:\n${String(reason)}`
		console.error(message)
		unhandledExceptionMessages.push(message)
	}

	median(baseline?: Measure<TimeUnit>): ReturnedAssertions {
		this.ctx.lastSnapCallPosition = caller()
		const assertions = this.createStatMethod("median", baseline)
		return assertions
	}

	mean(baseline?: Measure<TimeUnit>): ReturnedAssertions {
		this.ctx.lastSnapCallPosition = caller()
		return this.createStatMethod("mean", baseline)
	}

	mark(baseline?: MarkMeasure): ReturnedAssertions {
		this.ctx.lastSnapCallPosition = caller()
		return this.createStatMethod("mark", baseline as never)
	}
}

const unhandledExceptionMessages: string[] = []

export type UntilOptions = {
	ms?: number
	count?: number
}

export type BaseBenchOptions = {
	until?: UntilOptions
}

export type BenchOptions = BaseBenchOptions & {
	hooks?: {
		beforeCall?: () => void
		afterCall?: () => void
	}
}

export type InternalBenchOptions = BenchOptions & {
	fakeCallMs?: number | "count"
}

export type BenchContext = {
	qualifiedPath: string[]
	qualifiedName: string
	options: InternalBenchOptions
	cfg: ParsedAttestConfig
	assertionStack: string
	benchCallPosition: SourcePosition
	lastSnapCallPosition: SourcePosition | undefined
	lastSnapFunctionName: string | undefined
	isAsync: boolean
}

export type BenchableFunction = () => unknown | Promise<unknown>

export type InitialBenchAssertions<Fn extends BenchableFunction> =
	BenchAssertions<Fn> & BenchTypeAssertions

const currentSuitePath: string[] = []

process.on("beforeExit", () => {
	if (unhandledExceptionMessages.length) {
		console.error(
			`${unhandledExceptionMessages.length} unhandled exception(s) occurred during your benches (see details above).`
		)
		process.exit(1)
	}
})

export const getBenchCtx = (
	qualifiedPath: string[],
	isAsync: boolean = false,
	options: BenchOptions = {}
): BenchContext => ({
	qualifiedPath,
	qualifiedName: qualifiedPath.join("/"),
	options,
	cfg: getConfig(),
	benchCallPosition: caller(),
	lastSnapCallPosition: undefined,
	lastSnapFunctionName: undefined,
	isAsync,
	assertionStack: getCallStack({ offset: 1 }).join("\n")
})


================================================
FILE: ark/attest/bench/call1k.ts
================================================
export const call1K = (fn: () => void): void => {
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
	fn()
}


================================================
FILE: ark/attest/bench/measure.ts
================================================
import type { StatName } from "./bench.ts"

type MeasureUnit = TimeUnit | TypeUnit

export type Measure<Unit extends MeasureUnit = MeasureUnit> = [
	value: number,
	unit: Unit
]

export type MeasureComparison<Unit extends MeasureUnit = MeasureUnit> = {
	updated: Measure<Unit>
	baseline: Measure<Unit> | undefined
}

export type MarkMeasure = Partial<Record<StatName, Measure>>

export const stringifyMeasure = ([value, units]: Measure): string =>
	units in timeUnitRatios ?
		stringifyTimeMeasure([value, units as TimeUnit])
	:	`${value} ${units}`

export const TYPE_UNITS = ["instantiations"] as const

export type TypeUnit = (typeof TYPE_UNITS)[number]

export const createTypeComparison = (
	value: number,
	baseline: Measure<TypeUnit> | undefined
): MeasureComparison<TypeUnit> => ({
	updated: [value, "instantiations"],
	baseline
})

export const timeUnitRatios = {
	ns: 0.000_001,
	us: 0.001,
	ms: 1,
	s: 1000
}

export type TimeUnit = keyof typeof timeUnitRatios

export const stringifyTimeMeasure = ([
	value,
	unit
]: Measure<TimeUnit>): string => `${value.toFixed(2)}${unit}`

const convertTimeUnit = (n: number, from: TimeUnit, to: TimeUnit) =>
	round((n * timeUnitRatios[from]) / timeUnitRatios[to], 2)

/**
 * Establish a new baseline using the most appropriate time unit
 */
export const createTimeMeasure = (ms: number): Measure<TimeUnit> => {
	let bestMatch: Measure<TimeUnit> | undefined
	for (const u in timeUnitRatios) {
		const candidateMeasure = createTimeMeasureForUnit(ms, u as TimeUnit)
		if (!bestMatch) bestMatch = candidateMeasure
		else if (bestMatch[0] >= 1) {
			if (candidateMeasure[0] >= 1 && candidateMeasure[0] < bestMatch[0])
				bestMatch = candidateMeasure
		} else if (candidateMeasure[0] >= bestMatch[0]) bestMatch = candidateMeasure
	}
	return bestMatch!
}

const createTimeMeasureForUnit = (
	ms: number,
	unit: TimeUnit
): Measure<TimeUnit> => [convertTimeUnit(ms, "ms", unit), unit]

const round = (value: number, decimalPlaces: number) =>
	Math.round(value * 10 ** decimalPlaces) / 10 ** decimalPlaces

export const createTimeComparison = (
	ms: number,
	baseline: Measure<TimeUnit> | undefined
): MeasureComparison<TimeUnit> => {
	if (baseline) {
		return {
			updated: [convertTimeUnit(ms, "ms", baseline[1]), baseline[1]],
			baseline
		}
	}
	return {
		updated: createTimeMeasure(ms),
		baseline: undefined
	}
}


================================================
FILE: ark/attest/bench/type.ts
================================================
import { caller } from "@ark/fs"
import { throwInternalError } from "@ark/util"
import ts from "typescript"
import { getBenchAssertionsAtPosition } from "../cache/getCachedAssertions.ts"
import {
	TsServer,
	getAbsolutePosition,
	getAncestors,
	getDescendants,
	nearestCallExpressionChild
} from "../cache/ts.ts"
import {
	getCallExpressionsByName,
	getInstantiationsContributedByNode
} from "../cache/utils.ts"
import { getConfig } from "../config.ts"
import { compareToBaseline, queueBaselineUpdateIfNeeded } from "./baseline.ts"
import type { BenchContext } from "./bench.ts"
import {
	createTypeComparison,
	type Measure,
	type MeasureComparison,
	type TypeUnit
} from "./measure.ts"

export type BenchTypeAssertions = {
	types: (instantiations?: Measure<TypeUnit>) => void
}

export const createBenchTypeAssertion = (
	ctx: BenchContext
): BenchTypeAssertions => ({
	types: (...args: [instantiations?: Measure<TypeUnit> | undefined]) => {
		ctx.lastSnapCallPosition = caller()
		instantiationDataHandler({ ...ctx, lastSnapFunctionName: "types" }, args[0])
	}
})

export const getContributedInstantiations = (ctx: BenchContext): number => {
	const testDeclarationAliases = getConfig().testDeclarationAliases
	const instance = TsServer.instance
	const file = instance.getSourceFileOrThrow(ctx.benchCallPosition.file)

	const node = nearestCallExpressionChild(
		file,
		getAbsolutePosition(file, ctx.benchCallPosition)
	)

	const firstMatchingNamedCall = getAncestors(node).find(
		call => getCallExpressionsByName(call, testDeclarationAliases).length
	)

	if (!firstMatchingNamedCall) {
		throw new Error(
			`No call expressions matching the name(s) '${testDeclarationAliases.join()}' were found`
		)
	}

	const body = getDescendants(firstMatchingNamedCall).find(
		node => ts.isArrowFunction(node) || ts.isFunctionExpression(node)
	) as ts.ArrowFunction | ts.FunctionExpression | undefined

	if (!body)
		throwInternalError("Unable to retrieve contents of the call expression")

	return getInstantiationsContributedByNode(file, body)
}

export const instantiationDataHandler = (
	ctx: BenchContext,
	args?: Measure<TypeUnit>,
	isBenchFunction = true
): void => {
	const instantiationsContributed =
		isBenchFunction ?
			getContributedInstantiations(ctx)
		:	getBenchAssertionsAtPosition(ctx.benchCallPosition)[0][1].count

	const comparison: MeasureComparison<TypeUnit> = createTypeComparison(
		instantiationsContributed,
		args
	)
	compareToBaseline(comparison, ctx)
	queueBaselineUpdateIfNeeded(comparison.updated, args, ctx)
}


================================================
FILE: ark/attest/cache/getCachedAssertions.ts
================================================
import { readJson, type LinePosition, type SourcePosition } from "@ark/fs"
import { existsSync, readdirSync } from "node:fs"
import { join } from "node:path"
import { getConfig } from "../config.ts"
import { getFileKey } from "../utils.ts"
import type {
	AssertionsByFile,
	LinePositionRange,
	TypeAssertionData,
	TypeAssertionKind
} from "./writeAssertionCache.ts"

export type VersionedAssertionsByFile = [
	tsVersion: string,
	relationshipAssertions: AssertionsByFile,
	benchAssertions: AssertionsByFile
]

let assertionEntries: VersionedAssertionsByFile[] | undefined
export const getCachedAssertionEntries = (): VersionedAssertionsByFile[] => {
	if (!assertionEntries) {
		const config = getConfig()
		if (!existsSync(config.assertionCacheDir))
			throwMissingAssertionDataError(config.assertionCacheDir)

		const assertionFiles = readdirSync(config.assertionCacheDir)
		const relationshipAssertions: AssertionsByFile = {}
		const benchAssertions: AssertionsByFile = {}

		assertionEntries = assertionFiles.map(file => {
			const data = readJson(join(config.assertionCacheDir, file)) as Record<
				string,
				TypeAssertionData[]
			>
			for (const fileName of Object.keys(data)) {
				const relationshipAssertionData = data[fileName].filter(
					(entry: TypeAssertionData) => "args" in entry
				)
				const benchAssertionData = data[fileName].filter(
					(entry: TypeAssertionData) => "count" in entry
				)
				relationshipAssertions[fileName] = relationshipAssertionData
				benchAssertions[fileName] = benchAssertionData
			}
			return [
				// remove .json extension
				file.slice(0, -5),
				relationshipAssertions,
				benchAssertions
			]
		})
	}
	return assertionEntries!
}

const throwMissingAssertionDataError = (location: string) => {
	throw new Error(
		`Unable to find precached assertion data at '${location}'. ` +
			`Ensure the 'setup' function from @ark/attest has been called before running your tests.`
	)
}

const isPositionWithinRange = (
	{ line, char }: LinePosition,
	{ start, end }: LinePositionRange
) => {
	if (line < start.line || line > end.line) return false

	if (line === start.line) return char >= start.char

	if (line === end.line) return char <= end.char

	return true
}

export type VersionedTypeAssertion<
	kind extends TypeAssertionKind = TypeAssertionKind
> = [tsVersion: string, assertionData: TypeAssertionData<kind>]

const getAssertionsOfKindAtPosition = <kind extends TypeAssertionKind>(
	position: SourcePosition,
	kind: kind
): VersionedTypeAssertion<kind>[] => {
	const fileKey = getFileKey(position.file)
	return getCachedAssertionEntries().map(
		([version, typeRelationshipAssertions, BenchAssertionAssertions]) => {
			const assertions =
				kind === "type" ? typeRelationshipAssertions : BenchAssertionAssertions
			if (!assertions[fileKey]) {
				throw new Error(
					`Found no assertion data for '${fileKey}' for TypeScript version ${version}.`
				)
			}
			const matchingAssertion = assertions[fileKey].find(assertion =>
				/**
				 * Depending on the environment, a trace can refer to any of these points
				 * attest(...)
				 * ^     ^   ^
				 * Because of this, it's safest to check if the call came from anywhere in the expected range.
				 *
				 */
				isPositionWithinRange(position, assertion.location)
			)
			if (!matchingAssertion) {
				throw new Error(
					`Found no assertion for TypeScript version ${version} at line ${position.line} char ${position.char} in '${fileKey}'.
	Are sourcemaps enabled and working properly?`
				)
			}
			return [version, matchingAssertion] as VersionedTypeAssertion<kind>
		}
	)
}

export const getTypeAssertionsAtPosition = (
	position: SourcePosition
): VersionedTypeAssertion<"type">[] =>
	getAssertionsOfKindAtPosition(position, "type")

export const getBenchAssertionsAtPosition = (
	position: SourcePosition
): VersionedTypeAssertion<"bench">[] =>
	getAssertionsOfKindAtPosition(position, "bench")


================================================
FILE: ark/attest/cache/snapshots.ts
================================================
import {
	filePath,
	positionToString,
	readFile,
	readJson,
	shell,
	writeFile,
	writeJson,
	type SourcePosition
} from "@ark/fs"
import { throwInternalError } from "@ark/util"
import { existsSync } from "node:fs"
import { basename, dirname, isAbsolute, join } from "node:path"
import type ts from "typescript"
import { getConfig } from "../config.ts"
import { getFileKey } from "../utils.ts"
import {
	TsServer,
	getAbsolutePosition,
	nearestCallExpressionChild
} from "./ts.ts"
import { getCallExpressionsByName } from "./utils.ts"

export type SnapshotArgs = {
	position: SourcePosition
	serializedValue: unknown
	snapFunctionName?: string
	baselinePath?: string[]
}

export const resolveSnapshotPath = (
	testFile: string,
	customPath: string | undefined
): string => {
	if (customPath && isAbsolute(customPath)) return customPath

	return join(dirname(testFile), customPath ?? "assert.snapshots.json")
}

export const getSnapshotByName = (
	file: string,
	name: string,
	customPath: string | undefined
): object => {
	const snapshotPath = resolveSnapshotPath(file, customPath)
	return (readJson(snapshotPath)?.[basename(file)] as any)?.[name]
}

/**
 * Writes the update and position to cacheDir, which will eventually be read and copied to the source
 * file by a cleanup process after all tests have completed.
 */
export const queueSnapshotUpdate = (args: SnapshotArgs): void => {
	const config = getConfig()
	const path = config.defaultAssertionCachePath
	if (existsSync(path)) {
		const existing = readJson(path)
		writeJson(path, {
			...existing,
			updates:
				Array.isArray(existing.updates) ? [...existing.updates, args] : [args]
		})
	} else writeJson(path, { updates: [args] })
}

export type QueuedUpdate = {
	position: SourcePosition
	snapCall: ts.CallExpression
	snapFunctionName: string
	newArgText: string
	baselinePath: string[] | undefined
}

export type ExternalSnapshotArgs = SnapshotArgs & {
	name: string
	customPath: string | undefined
}

const findCallExpressionAncestor = (
	position: SourcePosition,
	functionName: string
): ts.CallExpression => {
	const server = TsServer.instance
	const file = server.getSourceFileOrThrow(position.file)
	const absolutePosition = getAbsolutePosition(file, position)
	const startNode = nearestCallExpressionChild(file, absolutePosition)
	const calls = getCallExpressionsByName(startNode, [functionName], true)
	if (calls.length) return startNode

	throwInternalError(
		`Unable to locate expected inline ${functionName} call from assertion at ${positionToString(
			position
		)}.`
	)
}

export const updateExternalSnapshot = ({
	serializedValue: value,
	position,
	name,
	customPath
}: ExternalSnapshotArgs): void => {
	const snapshotPath = resolveSnapshotPath(position.file, customPath)
	const snapshotData = readJson(snapshotPath) ?? {}
	const fileKey = basename(position.file)
	snapshotData[fileKey] = {
		...(snapshotData[fileKey] as object),
		[name]: value
	}
	writeJson(snapshotPath, snapshotData)
}

let snapshotsWillBeWritten = false
export const writeSnapshotUpdatesOnExit = (): void => {
	if (snapshotsWillBeWritten) return

	process.on("exit", writeCachedInlineSnapshotUpdates)
	snapshotsWillBeWritten = true
}

const writeCachedInlineSnapshotUpdates = () => {
	const config = getConfig()

	let snapshotData: SnapshotArgs[] | undefined

	if (!existsSync(config.defaultAssertionCachePath)) return

	try {
		snapshotData = readJson(config.defaultAssertionCachePath).updates as never
	} catch {
		// If we can't read the snapshot, log an error and move onto the next update
		console.error(
			`Unable to read snapshot data from expected location ${config.defaultAssertionCachePath}.`
		)
	}
	if (snapshotData) {
		try {
			writeUpdates(
				snapshotData.map(snapshot => snapshotArgsToQueuedUpdate(snapshot))
			)
		} catch (error) {
			// If writeInlineSnapshotToFile throws an error, log it and move on to the next update
			console.error(String(error))
		}
	}
}

const snapshotArgsToQueuedUpdate = ({
	position,
	serializedValue,
	snapFunctionName = "snap",
	baselinePath
}: SnapshotArgs): QueuedUpdate => {
	const snapCall = findCallExpressionAncestor(position, snapFunctionName)
	let newArgText =
		typeof serializedValue === "string" && serializedValue.includes("\n") ?
			"`" + serializedValue.replace(/`/g, "\\`").replace(/\${/g, "\\${") + "`"
		:	JSON.stringify(serializedValue)

	newArgText = newArgText
		.replace(/"\$ark.bigint-(-?\d+)"/g, "$1n")
		.replace(/"\$ark.undefined"/g, "undefined")

	return {
		position,
		snapCall,
		snapFunctionName,
		newArgText,
		baselinePath
	}
}

// Waiting until process exit to write snapshots avoids invalidating existing source positions
export const writeUpdates = (queuedUpdates: QueuedUpdate[]): void => {
	if (!queuedUpdates.length) return

	const updatesByFile: Record<string, QueuedUpdate[]> = {}
	for (const update of queuedUpdates) {
		updatesByFile[update.position.file] ??= []
		updatesByFile[update.position.file].push(update)
	}
	for (const k in updatesByFile) {
		writeFileUpdates(
			k,
			updatesByFile[k].sort((l, r) =>
				l.position.line > r.position.line ? 1
				: r.position.line > l.position.line ? -1
				: l.position.char - r.position.char
			)
		)
	}
	runFormatterIfAvailable(queuedUpdates)
}

const runFormatterIfAvailable = (queuedUpdates: QueuedUpdate[]) => {
	const { formatCmd: formatter, shouldFormat } = getConfig()
	if (!shouldFormat) return

	try {
		const updatedPaths = [
			...new Set(
				queuedUpdates.map(update =>
					filePath(update.snapCall.getSourceFile().fileName)
				)
			)
		]
		shell(`${formatter} ${updatedPaths.join(" ")}`)
	} catch {
		// If formatter is unavailable or skipped, do nothing.
	}
}

const writeFileUpdates = (path: string, updates: QueuedUpdate[]) => {
	let fileText = readFile(path)
	let offSet = 0
	for (const update of updates) {
		const previousArgTextLength =
			update.snapCall.arguments.end - update.snapCall.arguments.pos
		fileText =
			fileText.slice(0, update.snapCall.arguments.pos + offSet) +
			update.newArgText +
			fileText.slice(update.snapCall.arguments.end + offSet)
		offSet += update.newArgText.length - previousArgTextLength
		summarizeSnapUpdate(update.snapCall.arguments, update)
	}
	writeFile(path, fileText)
}

const summarizeSnapUpdate = (
	originalArgs: ts.NodeArray<ts.Expression>,
	update: QueuedUpdate
) => {
	let updateSummary = `${
		originalArgs.length ? "🆙  Updated" : "📸  Established"
	} `
	updateSummary +=
		update.baselinePath ?
			`baseline '${update.baselinePath.join("/")}' `
		:	`snap at ${getFileKey(update.position.file)}:${update.position.line} `
	const previousValue = update.snapCall.arguments[0]?.getText()
	updateSummary +=
		previousValue ?
			`from ${previousValue} to `
		:	`${update.baselinePath ? "at" : "as"} `

	updateSummary += update.newArgText
	console.log(updateSummary)
}


================================================
FILE: ark/attest/cache/ts.ts
================================================
import { fromCwd, readFile, type SourcePosition } from "@ark/fs"
import { printable, throwError, throwInternalError, type dict } from "@ark/util"
import * as tsvfs from "@typescript/vfs"
import { readFileSync } from "node:fs"
import { resolve, dirname, join } from "node:path"
import ts from "typescript"
import { getConfig } from "../config.ts"

export class TsServer {
	rootFiles!: string[]
	virtualEnv!: tsvfs.VirtualTypeScriptEnvironment
	program!: ts.Program

	private static _instance: TsServer | null = null
	static get instance(): TsServer {
		return new TsServer()
	}

	private tsConfigInfo!: TsconfigInfo

	constructor(tsConfigInfo?: TsconfigInfo) {
		if (TsServer._instance) return TsServer._instance

		this.tsConfigInfo = tsConfigInfo ?? getTsConfigInfoOrThrow()

		const tsLibPaths = getTsLibFiles(this.tsConfigInfo.parsed.options)

		// TS represents windows paths as `C:/Users/ssalb/...`
		const normalizedCwd = fromCwd().replace(/\\/g, "/")

		this.rootFiles = this.tsConfigInfo.parsed.fileNames.filter(path => {
			if (!path.startsWith(normalizedCwd)) return

			// exclude empty files as they lead to a crash
			// when createVirtualTypeScriptEnvironment is called
			const contents = readFile(path).trim()

			return contents !== ""
		})

		const system = tsvfs.createFSBackedSystem(
			tsLibPaths.defaultMapFromNodeModules,
			this.tsConfigInfo.path ? dirname(this.tsConfigInfo.path) : fromCwd(),
			ts
		)

		this.virtualEnv = tsvfs.createVirtualTypeScriptEnvironment(
			system,
			this.rootFiles,
			ts,
			this.tsConfigInfo.parsed.options
		)

		this.program = this.virtualEnv.languageService.getProgram()!

		TsServer._instance = this
	}

	getSourceFileOrThrow(path: string): ts.SourceFile {
		const tsPath = path.replace(/\\/g, "/")
		const existingFile = this.virtualEnv.getSourceFile(tsPath)
		if (existingFile) return existingFile

		if (!this.virtualEnv.sys.fileExists(tsPath)) {
			throwInternalError(
				`@ark/attest: TypeScript was unable to resolve expected file at ${tsPath}.\n`
			)
		}

		const contents = this.virtualEnv.sys.readFile(tsPath)

		if (!contents) {
			throwInternalError(
				`@ark/attest: TypeScript says a file exists at ${tsPath}, but was unable to read its contents.\n`
			)
		}

		this.virtualEnv.createFile(tsPath, contents)

		const createdFile = this.virtualEnv.getSourceFile(tsPath)

		if (!createdFile) {
			throwInternalError(
				`@ark/attest: TypeScript tried to create a file at ${tsPath} but was unable to access it.`
			)
		}

		return createdFile
	}
}

export const nearestCallExpressionChild = (
	node: ts.Node,
	position: number
): ts.CallExpression => {
	const result = nearestBoundingCallExpression(node, position)
	if (!result) {
		throwInternalError(
			`Unable to find bounding call expression at position ${position} in ${
				node.getSourceFile().fileName
			}`
		)
	}
	return result
}

export const nearestBoundingCallExpression = (
	node: ts.Node,
	position: number
): ts.CallExpression | undefined =>
	node.pos <= position && node.end >= position ?
		(node
			.getChildren()
			.flatMap(
				child => nearestBoundingCallExpression(child, position) ?? []
			)[0] ?? (ts.isCallExpression(node) ? node : undefined))
	:	undefined

export const getAbsolutePosition = (
	file: ts.SourceFile,
	position: SourcePosition
): number => {
	const pos = ts.getPositionOfLineAndCharacter(
		file,
		// TS uses 0-based line and char #s
		position.line - 1,
		position.char - 1
	)
	if (!pos) {
		throwInternalError(
			`Absolute position ${printable(position)} does not exist in ${file.fileName}`
		)
	}
	return pos
}

export type TsconfigInfo = {
	path: string | undefined
	parsed: ts.ParsedCommandLine
}

export const getTsConfigInfoOrThrow = (): TsconfigInfo => {
	const config = getConfig()
	const tsconfig = config.tsconfig

	let instantiatedConfig: ts.ParsedCommandLine | undefined
	let configFilePath: string | undefined

	if (tsconfig !== null) {
		configFilePath =
			tsconfig ??
			ts.findConfigFile(fromCwd(), ts.sys.fileExists, "tsconfig.json")
		if (configFilePath)
			instantiatedConfig = instantiateTsconfigFromPath(configFilePath)
	}

	instantiatedConfig ??= instantiateNoFileConfig()

	return {
		path: configFilePath,
		parsed: instantiatedConfig
	}
}

type RawTsConfigJson = dict & { compilerOptions: ts.CompilerOptions }

type InstantiatedTsConfigJson = ts.ParsedCommandLine

const instantiateNoFileConfig = (): InstantiatedTsConfigJson => {
	const arkConfig = getConfig()

	const instantiatedConfig = ts.parseJsonConfigFileContent(
		{
			compilerOptions: arkConfig.compilerOptions
		},
		ts.sys,
		fromCwd()
	)

	if (instantiatedConfig.errors.length > 0)
		throwConfigInstantiationError(instantiatedConfig)

	return instantiatedConfig
}

const instantiateTsconfigFromPath = (
	path: string
): InstantiatedTsConfigJson => {
	const arkConfig = getConfig()
	const configFileText = readFileSync(path).toString()
	const result = ts.parseConfigFileTextToJson(path, configFileText)
	if (result.error) throwConfigParseError(result.error)

	const rawConfig: RawTsConfigJson = result.config

	rawConfig.compilerOptions = Object.assign(
		rawConfig.compilerOptions ?? {},
		arkConfig.compilerOptions
	)

	const configPath = resolve(path)

	const instantiatedConfig = ts.parseJsonConfigFileContent(
		rawConfig,
		ts.sys,
		dirname(configPath),
		{},
		configPath
	)

	if (instantiatedConfig.errors.length > 0)
		throwConfigInstantiationError(instantiatedConfig)

	return instantiatedConfig
}

const defaultDiagnosticHost: ts.FormatDiagnosticsHost = {
	getCanonicalFileName: fileName => fileName,
	getCurrentDirectory: process.cwd,
	getNewLine: () => ts.sys.newLine
}

const throwConfigParseError = (error: ts.Diagnostic) =>
	throwError(ts.formatDiagnostics([error], defaultDiagnosticHost))

const throwConfigInstantiationError = (
	instantiatedConfig: InstantiatedTsConfigJson
): never =>
	throwError(
		ts.formatDiagnostics(instantiatedConfig.errors, defaultDiagnosticHost)
	)

type TsLibFiles = {
	defaultMapFromNodeModules: Map<string, string>
	resolvedPaths: string[]
}

export const getTsLibFiles = (
	tsconfigOptions: ts.CompilerOptions
): TsLibFiles => {
	const defaultMapFromNodeModules =
		tsvfs.createDefaultMapFromNodeModules(tsconfigOptions)
	const libPath = dirname(ts.getDefaultLibFilePath(tsconfigOptions))
	return {
		defaultMapFromNodeModules,
		resolvedPaths: [...defaultMapFromNodeModules.keys()].map(path =>
			join(libPath, path)
		)
	}
}

export const getProgram = (
	env?: tsvfs.VirtualTypeScriptEnvironment
): ts.Program =>
	env?.languageService.getProgram() ??
	TsServer.instance.virtualEnv.languageService.getProgram()!

export interface InternalTypeChecker extends ts.TypeChecker {
	// These APIs are not publicly exposed
	getInstantiationCount: () => number
	isTypeAssignableTo: (source: ts.Type, target: ts.Type) => boolean
	getDiagnostics: () => ts.Diagnostic[]
}

export const getInternalTypeChecker = (
	env?: tsvfs.VirtualTypeScriptEnvironment
): InternalTypeChecker =>
	getProgram(env).getTypeChecker() as InternalTypeChecker

export interface StringifiableType extends ts.Type {
	toString(): string
	isUnresolvable: boolean
}

export const getStringifiableType = (node: ts.Node): StringifiableType => {
	const typeChecker = getInternalTypeChecker()
	const nodeType = typeChecker.getTypeAtLocation(node)

	let stringified = typeChecker.typeToString(nodeType)

	if (stringified.includes("...")) {
		const nonTruncated = typeChecker.typeToString(
			nodeType,
			undefined,
			ts.TypeFormatFlags.NoTruncation
		)

		stringified =
			nonTruncated.includes(" any") && !stringified.includes(" any") ?
				nonTruncated.replace(/ any/g, " cyclic")
			:	nonTruncated
	}

	return Object.assign(nodeType, {
		toString: () => stringified,
		isUnresolvable: (nodeType as any).intrinsicName === "error"
	})
}

export type ArgumentTypes = {
	args: StringifiableType[]
	typeArgs: StringifiableType[]
}

export const extractArgumentTypesFromCall = (
	call: ts.CallExpression
): ArgumentTypes => ({
	args: call.arguments.map(arg => getStringifiableType(arg)),
	typeArgs:
		call.typeArguments?.map(typeArg => getStringifiableType(typeArg)) ?? []
})

export const getDescendants = (node: ts.Node): ts.Node[] =>
	getDescendantsRecurse(node)

const getDescendantsRecurse = (node: ts.Node): ts.Node[] => [
	node,
	...node.getChildren().flatMap(child => getDescendantsRecurse(child))
]

export const getAncestors = (node: ts.Node): ts.Node[] => {
	const ancestors: ts.Node[] = []
	let baseNode = node.parent
	while (baseNode.parent !== undefined) {
		ancestors.push(baseNode)
		baseNode = baseNode.parent
	}
	return ancestors
}

export const getFirstAncestorByKindOrThrow = (
	node: ts.Node,
	kind: ts.SyntaxKind
): ts.Node =>
	getAncestors(node).find(ancestor => ancestor.kind === kind) ??
	throwInternalError(
		`Could not find an ancestor of kind ${ts.SyntaxKind[kind]}`
	)


================================================
FILE: ark/attest/cache/utils.ts
================================================
import { filePath } from "@ark/fs"
import { throwInternalError } from "@ark/util"
import * as tsvfs from "@typescript/vfs"
import ts from "typescript"
import { getConfig } from "../config.ts"
import { getFileKey } from "../utils.ts"
import {
	getDescendants,
	getFirstAncestorByKindOrThrow,
	getProgram,
	getTsConfigInfoOrThrow,
	getTsLibFiles
} from "./ts.ts"
import type { LinePositionRange } from "./writeAssertionCache.ts"

export const getCallLocationFromCallExpression = (
	callExpression: ts.CallExpression
): LinePositionRange => {
	const start = ts.getLineAndCharacterOfPosition(
		callExpression.getSourceFile(),
		callExpression.getStart()
	)
	const end = ts.getLineAndCharacterOfPosition(
		callExpression.getSourceFile(),
		callExpression.getEnd()
	)
	// Add 1 to everything, since trace positions are 1-based and TS positions are 0-based.
	const location: LinePositionRange = {
		start: {
			line: start.line + 1,
			char: start.character + 1
		},
		end: {
			line: end.line + 1,
			char: end.character + 1
		}
	}
	return location
}

/**
 * Processes inline instantiations from an attest call
 * Preserves any JSDoc comments that are associated with the original expression
 */
export const gatherInlineInstantiationData = (
	file: ts.SourceFile,
	assertionsByFile: Record<string, any[]>,
	instantiationMethodCalls: string[]
): void => {
	const expressions = getCallExpressionsByName(file, instantiationMethodCalls)
	if (!expressions.length) return

	const enclosingFunctions = expressions.map(expression => {
		const attestInstantiationsExpression = getFirstAncestorByKindOrThrow(
			expression,
			ts.SyntaxKind.ExpressionStatement
		)
		return {
			ancestor: getFirstAncestorByKindOrThrow(
				attestInstantiationsExpression,
				ts.SyntaxKind.ExpressionStatement
			),
			position: getCallLocationFromCallExpression(expression)
		}
	})
	const instantiationInfo = enclosingFunctions.map(enclosingFunction => {
		const body = getDescendants(enclosingFunction.ancestor).find(
			node => ts.isArrowFunction(node) || ts.isFunctionExpression(node)
		) as ts.ArrowFunction | ts.FunctionExpression | undefined
		if (!body) {
			throwInternalError(
				`Unable to resolve source associated with TS Node:
${enclosingFunction.ancestor.getText()}`
			)
		}

		return {
			location: enclosingFunction.position,
			count: getInstantiationsContributedByNode(file, body)
		}
	})
	const assertions = assertionsByFile[getFileKey(file.fileName)] ?? []
	assertionsByFile[getFileKey(file.fileName)] = [
		...assertions,
		...instantiationInfo
	]
}

export const getCallExpressionsByName = (
	startNode: ts.Node,
	names: string[],
	isSnapCall = false
): ts.CallExpression[] => {
	const calls: ts.CallExpression[] = []
	for (const descendant of getDescendants(startNode)) {
		if (ts.isCallExpression(descendant)) {
			if (names.includes(descendant.expression.getText()) || !names.length)
				calls.push(descendant)
		} else if (isSnapCall) {
			if (ts.isIdentifier(descendant)) {
				if (names.includes(descendant.getText()) || !names.length)
					calls.push(descendant as any as ts.CallExpression)
			}
		}
	}
	return calls
}

const instantiationsByPath: { [path: string]: number } = {}

export const getInstantiationsContributedByNode = (
	file: ts.SourceFile,
	benchBlock: ts.FunctionExpression | ts.ArrowFunction
): number => {
	const originalPath = filePath(file.fileName)
	const fakePath = originalPath + ".nonexistent.ts"

	const baselineFile = getBaselineSourceFile(file)

	const baselineFileWithBenchBlock =
		baselineFile + `\nconst $attestIsolatedBench = ${benchBlock.getFullText()}`

	if (!instantiationsByPath[fakePath]) {
		const instantiationsWithoutNode = getInstantiationsWithFile(
			baselineFile,
			fakePath
		)

		instantiationsByPath[fakePath] = instantiationsWithoutNode
	}

	const instantiationsWithNode = getInstantiationsWithFile(
		baselineFileWithBenchBlock,
		fakePath
	)

	return instantiationsWithNode - instantiationsByPath[fakePath]
}

export const createOrUpdateFile = (
	env: tsvfs.VirtualTypeScriptEnvironment,
	fileName: string,
	fileText: string
): ts.SourceFile | undefined => {
	if (env.sys.fileExists(fileName)) env.updateFile(fileName, fileText)
	else env.createFile(fileName, fileText)
	return env.getSourceFile(fileName)
}

declare module "typescript" {
	interface SourceFile {
		imports: ts.StringLiteral[]
	}

	interface Program {
		getResolvedModuleFromModuleSpecifier(
			moduleSpecifier: ts.StringLiteralLike,
			sourceFile?: ts.SourceFile
		): ts.ResolvedModuleWithFailedLookupLocations
	}
}

const getInstantiationsWithFile = (fileText: string, fileName: string) => {
	const env = getIsolatedEnv()
	const file = createOrUpdateFile(env, fileName, fileText)
	const program = getProgram(env)

	// trigger type checking to generate instantiations
	// (was previously program.emit(file), but that as of TS 5.6 that doesn't
	// work, so this may need to change if instantiations is reported as 0 after
	// a future TypeScript update)
	program.getSemanticDiagnostics(file)
	// this may lead to additional type checking per Jake Bailey from the TS
	// team, although it doesn't currently affect any of our internal benchmarks
	program.getDeclarationDiagnostics(file)
	const count = program.getInstantiationCount()
	return count
}

let virtualEnv: tsvfs.VirtualTypeScriptEnvironment | undefined = undefined

export const getIsolatedEnv = (): tsvfs.VirtualTypeScriptEnvironment => {
	if (virtualEnv !== undefined) return virtualEnv

	const tsconfigInfo = getTsConfigInfoOrThrow()
	const libFiles = getTsLibFiles(tsconfigInfo.parsed.options)
	const projectRoot = process.cwd()
	const system = tsvfs.createFSBackedSystem(
		libFiles.defaultMapFromNodeModules,
		projectRoot,
		ts
	)
	virtualEnv = tsvfs.createVirtualTypeScriptEnvironment(
		system,
		[],
		ts,
		tsconfigInfo.parsed.options
	)
	return virtualEnv
}

const getBaselineSourceFile = (originalFile: ts.SourceFile): string => {
	const functionNames = getConfig().testDeclarationAliases

	const calls = getCallExpressionsByName(originalFile, functionNames)

	let baselineSourceFileText = originalFile.getFullText()

	// for each test function like `it` or `bench`, walk up the AST to find the complete expression
	for (const call of calls) {
		let currentNode: ts.Node = call

		// ensure we capture the entire chain like bench(...).types(...)
		while (currentNode.parent && !ts.isExpressionStatement(currentNode))
			currentNode = currentNode.parent

		const fullExpressionText = currentNode.getFullText()

		baselineSourceFileText = baselineSourceFileText.replace(
			fullExpressionText,
			""
		)
	}

	return baselineSourceFileText
}


================================================
FILE: ark/attest/cache/writeAssertionCache.ts
================================================
import type { LinePosition } from "@ark/fs"
import { flatMorph } from "@ark/util"
import ts from "typescript"

import { getConfig } from "../config.ts"
import { getFileKey } from "../utils.ts"
import {
	TsServer,
	extractArgumentTypesFromCall,
	getDescendants,
	getInternalTypeChecker,
	type ArgumentTypes,
	type StringifiableType
} from "./ts.ts"
import {
	gatherInlineInstantiationData,
	getCallExpressionsByName,
	getCallLocationFromCallExpression
} from "./utils.ts"

export type AssertionsByFile = Record<string, TypeAssertionData[]>

export const analyzeProjectAssertions = (): AssertionsByFile => {
	const config = getConfig()
	const instance = TsServer.instance
	const filePaths = instance.rootFiles
	const diagnosticsByFile = getDiagnosticsByFile()
	const assertionsByFile: AssertionsByFile = {}
	const attestAliasInstantiationMethodCalls = config.attestAliases.map(
		alias => `${alias}.instantiations`
	)
	for (const path of filePaths) {
		const file = instance.getSourceFileOrThrow(path)
		const assertionsInFile = getAssertionsInFile(
			file,
			diagnosticsByFile,
			config.attestAliases
		)
		if (assertionsInFile.length)
			assertionsByFile[getFileKey(file.fileName)] = assertionsInFile
		if (!config.skipInlineInstantiations) {
			gatherInlineInstantiationData(
				file,
				assertionsByFile,
				attestAliasInstantiationMethodCalls
			)
		}
	}
	return assertionsByFile
}

export const getAssertionsInFile = (
	file: ts.SourceFile,
	diagnosticsByFile: DiagnosticsByFile,
	attestAliases: string[]
): TypeAssertionData[] => {
	const assertCalls = getCallExpressionsByName(file, attestAliases)
	return assertCalls.map(call => analyzeAssertCall(call, diagnosticsByFile))
}

export const analyzeAssertCall = (
	assertCall: ts.CallExpression,
	diagnosticsByFile: DiagnosticsByFile
): TypeAssertionData => {
	const types = extractArgumentTypesFromCall(assertCall)
	const location = getCallLocationFromCallExpression(assertCall)
	const args = types.args.map(arg => serializeArg(arg, types))
	const typeArgs = types.typeArgs.map(typeArg => serializeArg(typeArg, types))
	const errors = checkDiagnosticMessages(assertCall, diagnosticsByFile)
	const completions = getCompletions(assertCall)

	// Extract JSDoc comment for first argument if available
	const jsdoc = extractJSDocFromArgument(assertCall)

	const result: TypeAssertionData = {
		location,
		args,
		typeArgs,
		errors,
		completions
	}

	if (jsdoc) result.jsdoc = jsdoc

	return result
}

/**
 * Extract JSDoc comments associated with the first argument of a call expression
 */
const extractJSDocFromArgument = (
	callExpr: ts.CallExpression
): string | undefined => {
	// We're only interested in the first argument
	const firstArg = callExpr.arguments[0]
	if (!firstArg) return undefined

	const checker = getInternalTypeChecker()

	// If the argument is a property access expression (e.g., out.foo)
	if (ts.isPropertyAccessExpression(firstArg)) {
		// Try to find the symbol for the property
		const propSymbol = checker.getSymbolAtLocation(firstArg)
		if (propSymbol) {
			// Get JSDoc from property declarations
			return getJSDocFromSymbol(propSymbol)
		}
	}
	// If argument is an identifier, try to find its declaration's JSDoc
	else if (ts.isIdentifier(firstArg)) {
		const symbol = checker.getSymbolAtLocation(firstArg)
		if (symbol) return getJSDocFromSymbol(symbol)
	}

	return undefined
}

/**
 * Extract JSDoc comments from a symbol's declarations
 */
const getJSDocFromSymbol = (symbol: ts.Symbol): string | undefined => {
	// Get JSDoc directly from the symbol if possible
	const symbolDocumentation = ts.displayPartsToString(
		symbol.getDocumentationComment(getInternalTypeChecker())
	)
	if (symbolDocumentation) return symbolDocumentation.trim()

	// If no symbol documentation, try to get JSDoc from declarations
	const declarations = symbol.getDeclarations() || []
	for (const declaration of declarations) {
		// For property declarations in object literals, get the JSDoc comment
		if (
			ts.isPropertyAssignment(declaration) ||
			ts.isShorthandPropertyAssignment(declaration) ||
			ts.isPropertyDeclaration(declaration)
		) {
			const jsDocTags = ts.getJSDocTags(declaration)
			if (jsDocTags.length > 0) {
				return jsDocTags
					.map(tag => {
						const comment = tag.comment?.toString() || ""
						return tag.tagName.text + (comment ? ` ${comment}` : "")
					})
					.join("\n")
			}

			// Try to get JSDoc comment before the property
			const jsDocComments = ts.getJSDocCommentsAndTags(declaration)
			if (jsDocComments && jsDocComments.length > 0) {
				return jsDocComments
					.map(doc => {
						if (ts.isJSDoc(doc)) return doc.comment || ""

						return ""
					})
					.filter(Boolean)
					.join("\n")
					.trim()
			}
		}
	}

	return undefined
}

const serializeArg = (
	arg: StringifiableType,
	context: ArgumentTypes
): ArgAssertionData => ({
	type: arg.toString(),
	relationships: {
		args: context.args.map(other => compareTsTypes(arg, other)),
		typeArgs: context.typeArgs.map(other => compareTsTypes(arg, other))
	}
})

export type Completions = Record<string, string[]> | string

const getCompletions = (attestCall: ts.CallExpression) => {
	const arg = attestCall.arguments[0]
	if (arg === undefined) return {}

	const descendants = getDescendants(arg)
	const file = attestCall.getSourceFile()
	const text = file.getFullText()
	const completions: Completions | string = {}

	for (const descendant of descendants) {
		if (ts.isStringLiteral(descendant) || ts.isTemplateLiteral(descendant)) {
			// descendant.pos tends to be an open quote while d.end tends to be right after the closing quote.
			// It seems to be more consistent using this to get the pos for the completion over descendant.pos
			const lastPositionOfInnerString =
				descendant.end - (/["'`]/.test(text[descendant.end - 1]) ? 1 : 2)
			const completionData =
				TsServer.instance.virtualEnv.languageService.getCompletionsAtPosition(
					file.fileName,
					lastPositionOfInnerString,
					undefined
				)
			const prefix =
				"text" in descendant ? descendant.text : descendant.getText()

			const entries = completionData?.entries ?? []

			if (prefix in completions)
				return `Encountered multiple completion candidates for string(s) '${prefix}'. Assertions on the same prefix must be split into multiple attest calls so the results can be distinguished.`

			completions[prefix] = []
			for (const entry of entries) {
				if (entry.name.startsWith(prefix) && entry.name.length > prefix.length)
					completions[prefix].push(entry.name)
			}
		}
	}

	return flatMorph(completions, (prefix, entries) =>
		entries.length >= 1 ? [prefix, entries.sort()] : []
	)
}

export type DiagnosticData = {
	start: number
	end: number
	message: string
}

export type DiagnosticsByFile = Record<string, DiagnosticData[]>

export const getDiagnosticsByFile = (): DiagnosticsByFile => {
	const diagnosticsByFile: DiagnosticsByFile = {}
	const diagnostics: ts.Diagnostic[] = getInternalTypeChecker().getDiagnostics()
	for (const diagnostic of diagnostics)
		addDiagnosticDataFrom(diagnostic, diagnosticsByFile)

	return diagnosticsByFile
}

const addDiagnosticDataFrom = (
	diagnostic: ts.Diagnostic,
	diagnosticsByFile: DiagnosticsByFile
) => {
	const filePath = diagnostic.file?.fileName
	if (!filePath) return

	const fileKey = getFileKey(filePath)
	const start = diagnostic.start ?? -1
	const end = start + (diagnostic.length ?? 0)
	let message = diagnostic.messageText
	if (typeof message === "object") message = concatenateChainedErrors([message])

	const data: DiagnosticData = {
		start,
		end,
		message
	}
	if (diagnosticsByFile[fileKey]) diagnosticsByFile[fileKey].push(data)
	else diagnosticsByFile[fileKey] = [data]
}

const concatenateChainedErrors = (
	diagnostics: ts.DiagnosticMessageChain[]
): string =>
	diagnostics
		.map(
			msg =>
				`${msg.messageText}${
					msg.next ? concatenateChainedErrors(msg.next) : ""
				}`
		)
		.join("\n")

export type ArgAssertionData = {
	type: string
	relationships: {
		args: TypeRelationship[]
		typeArgs: TypeRelationship[]
	}
}

export type TypeRelationshipAssertionData = {
	location: LinePositionRange
	args: ArgAssertionData[]
	typeArgs: ArgAssertionData[]
	errors: string[]
	completions: Completions
	/** JSDoc comment for the first argument, if any */
	jsdoc?: string
}

export type TypeBenchmarkingAssertionData = {
	location: LinePositionRange
	count: number
}

export type TypeAssertionKind = "bench" | "type"

export type TypeAssertionData<
	kind extends TypeAssertionKind = TypeAssertionKind
> =
	kind extends "bench" ? TypeBenchmarkingAssertionData
	:	TypeRelationshipAssertionData

export type LinePositionRange = {
	start: LinePosition
	end: LinePosition
}

export type TypeRelationship = "subtype" | "supertype" | "equality" | "none"

export const compareTsTypes = (
	l: StringifiableType,
	r: StringifiableType
): TypeRelationship => {
	const lString = l.toString()
	const rString = r.toString()
	// Ensure two unresolvable types are not treated as equivalent
	if (l.isUnresolvable || r.isUnresolvable) return "none"
	// Treat `any` as a supertype of every other type
	if (lString === "any") return rString === "any" ? "equality" : "supertype"
	if (rString === "any") return "subtype"
	// Otherwise, determine if the types are equivalent by checking mutual assignability
	const checker = getInternalTypeChecker()
	const isSubtype = checker.isTypeAssignableTo(l, r)
	const isSupertype = checker.isTypeAssignableTo(r, l)
	return (
		isSubtype ?
			isSupertype ? "equality"
			:	"subtype"
		: isSupertype ? "supertype"
		: "none"
	)
}

export const checkDiagnosticMessages = (
	attestCall: ts.CallExpression,
	diagnosticsByFile: DiagnosticsByFile
): string[] => {
	const fileKey = getFileKey(attestCall.getSourceFile().fileName)
	const fileDiagnostics = diagnosticsByFile[fileKey]
	if (!fileDiagnostics) return []

	const diagnosticMessagesInArgRange: string[] = []
	for (const diagnostic of fileDiagnostics) {
		if (
			diagnostic.start >= attestCall.getStart() &&
			diagnostic.end <= attestCall.getEnd()
		)
			diagnosticMessagesInArgRange.push(diagnostic.message)
	}
	return diagnosticMessagesInArgRange
}


================================================
FILE: ark/attest/cli/cli.ts
================================================
#!/usr/bin/env node
import { fileName } from "@ark/fs"
import { basename } from "node:path"
import { precache } from "./precache.ts"
import { stats } from "./stats.ts"
import { trace } from "./trace.ts"

const subcommands = {
	precache,
	trace,
	stats
}

type Subcommand = keyof typeof subcommands

const baseFileName = basename(fileName())

const thisFileIndex = process.argv.findIndex(
	// if running from build output in npm, will be a file called `attest`
	// if running from build output in pnpm, will be `cli.js` in build output
	s => s.endsWith(baseFileName) || s.endsWith("attest")
)

if (thisFileIndex === -1)
	throw new Error(`Expected to find an argument ending with "${baseFileName}"`)

const subcommand = process.argv[thisFileIndex + 1]

if (!(subcommand in subcommands)) {
	console.error(
		`Expected a command like 'attest <subcommand>', where <subcommand> is one of:\n${Object.keys(
			subcommands
		)}`
	)
	process.exit(1)
}

const args = process.argv.slice(thisFileIndex + 2)

subcommands[subcommand as Subcommand](args)


================================================
FILE: ark/attest/cli/precache.ts
================================================
import { ensureDir } from "@ark/fs"
import { join } from "node:path"
import { writeAssertionData } from "../fixtures.ts"

export const precache = (args: string[]): void => {
	const cacheFileToWrite =
		args[0] ?? join(ensureDir(".attest"), "typescript.json")

	writeAssertionData(cacheFileToWrite)
}


================================================
FILE: ark/attest/cli/shared.ts
================================================
export const baseDiagnosticTscCmd =
	"npm exec -- tsc --noEmit --extendedDiagnostics --incremental false --tsBuildInfoFile null"


================================================
FILE: ark/attest/cli/stats.ts
================================================
import { execSync } from "node:child_process"
import { baseDiagnosticTscCmd } from "./shared.ts"

export const stats = (args: string[]): void => {
	const packageDirs = args.length ? args : [process.cwd()]
	const listedStats = packageDirs.map((packageDir): TypePerfStats => {
		console.log(`⏳ Gathering type perf data for ${packageDir}...`)
		let output: string
		try {
			output = execSync(baseDiagnosticTscCmd, {
				cwd: packageDir,
				stdio: "pipe"
			}).toString()
		} catch (e: any) {
			output = e.stdout?.toString() ?? ""
			output += e.stderr?.toString() ?? ""
			console.error(
				`❗Encountered one or more errors checking types for ${packageDir}- results may be inaccurate❗`
			)
		}
		const stats = parseTsDiagnosticsOutput(output)
		logTypePerfStats(stats)
		return stats
	})

	const aggregatedStats = listedStats.reduce<TypePerfStats>(
		(aggregatedStats, packageStats) => ({
			checkTime: aggregatedStats.checkTime + packageStats.checkTime,
			types: aggregatedStats.types + packageStats.types,
			instantiations:
				aggregatedStats.instantiations + packageStats.instantiations
		}),
		{
			checkTime: 0,
			types: 0,
			instantiations: 0
		}
	)

	console.log("📊 aggregated type performance:")
	logTypePerfStats(aggregatedStats)
}

type TypePerfStats = {
	checkTime: number
	types: number
	instantiations: number
}

const parseTsDiagnosticsOutput = (output: string): TypePerfStats => {
	const lines = output.split("\n")
	const results: TypePerfStats = {
		checkTime: 0,
		types: 0,
		instantiations: 0
	}

	for (const line of lines) {
		if (line.startsWith("Check time:"))
			results.checkTime = parseFloat(line.split(":")[1].trim())
		else if (line.startsWith("Types:"))
			results.types = parseInt(line.split(":")[1].trim(), 10)
		else if (line.startsWith("Instantiations:"))
			results.instantiations = parseInt(line.split(":")[1].trim(), 10)
	}
	return results
}

const logTypePerfStats = (stats: TypePerfStats) => {
	console.log(JSON.stringify(stats, null, 4))
}


================================================
FILE: ark/attest/cli/trace.ts
================================================
import { ensureDir, getShellOutput, readJson, writeFile } from "@ark/fs"
import type { ExecException } from "node:child_process"
import { existsSync } from "node:fs"
import { basename, join, relative, resolve } from "node:path"
import ts from "typescript"
import {
	TsServer,
	getDescendants,
	getStringifiableType,
	nearestBoundingCallExpression
} from "../cache/ts.ts"
import { getConfig } from "../config.ts"
import { baseDiagnosticTscCmd } from "./shared.ts"

interface TraceEntry {
	pid: number
	tid: number
	ph: string // Phase (e.g., "X" for Complete Event)
	cat: string // Category
	ts: number // Timestamp (microseconds)
	name: string // Name of the event
	dur?: number // Duration (microseconds)
	args: {
		kind?: number
		pos?: number
		end?: number
		path?: string
		sourceId?: number
		targetId?: number
		[key: string]: any
	}
}

interface CallRange {
	id: string
	typeId: string
	functionName: string
	callSite: string
	startTime: number // microseconds
	endTime: number // microseconds
	duration: number // microseconds
	children: CallRange[]
	selfTime: number // microseconds
}

interface CallSiteDetail {
	path: string
	pos: number
	end: number
	selfTime: number // microseconds
}

interface FunctionStats {
	typeId: string
	functionName: string
	totalTime: number // microseconds
	selfTime: number // microseconds
	count: number
	firstLocation?: string
	detailedCallSites: CallSiteDetail[]
}

interface AnalysisContext {
	traceDir: string
	tsServer: TsServer
	traceEntries: TraceEntry[]
	durationEntries: TraceEntry[] // Filtered entries with duration
	callRanges: CallRange[]
	rootCalls: CallRange[]
	functionStats: Record<string, FunctionStats>
	allFunctions: FunctionStats[]
}

interface UngroupedCallStats {
	typeId: string
	functionName: string
	callSite: string
	duration: number // microseconds
	selfTime: number // microseconds
}

/**
 * Helper to write output to both console and collect for file output
 */
const outputCapture = (() => {
	let buffer: string[] = []

	return {
		write: (text: string) => {
			console.log(text)
			buffer.push(text)
		},
		getBuffer: () => buffer.join("\n"),
		getLines: () => [...buffer],
		clear: () => {
			buffer = []
		}
	}
})()

/**
 * Formats microseconds to a string of milliseconds.
 */
const formatMillis = (ms: number, fractionDigits = 2): string =>
	(ms / 1000).toFixed(fractionDigits)

/**
 * Formats microseconds to a padded string of milliseconds.
 */
const formatPaddedMillis = (
	ms: number,
	pad: number,
	fractionDigits = 2
): string => formatMillis(ms, fractionDigits).padStart(pad)

// Helper to format duration in seconds to a human-readable string
const formatSeconds = (totalSeconds: number): string => {
	if (totalSeconds < 0) totalSeconds = 0
	const hours = Math.floor(totalSeconds / 3600)
	const minutes = Math.floor((totalSeconds % 3600) / 60)
	const seconds = Math.floor(totalSeconds % 60)

	if (hours > 0) return `about ${hours} hour(s)`
	if (minutes > 0) return `about ${minutes} minute(s)`
	return `${seconds}s`
}

class ProgressDisplay {
	private totalItems: number
	private processedItems: number = 0
	private startTime: number = 0
	private timerId?: NodeJS.Timeout
	private barWidth: number = 30 // Width of the progress bar itself

	constructor(totalItems: number) {
		this.totalItems = totalItems
		if (this.totalItems <= 0) this.totalItems = 0
	}

	start(): void {
		if (this.totalItems === 0) return

		this.startTime = Date.now()
		this.processedItems = 0
		this.render() // Initial render
		// Update every second for elapsed time and ETA
		this.timerId = setInterval(() => this.render(), 1000)
	}

	update(processedCount: number): void {
		if (this.totalItems === 0) return

		this.processedItems = Math.min(processedCount, this.totalItems)
		this.render() // Re-render on each item processed for immediate feedback

		if (this.processedItems >= this.totalItems) this.stop() // Automatically stop if all items are processed
	}

	private render(): void {
		if (this.totalItems === 0 && this.processedItems === 0 && !this.startTime)
			return // Avoid rendering if not started for 0 items

		const percent =
			this.totalItems > 0 ?
				Math.min(100, (this.processedItems / this.totalItems) * 100)
			:	100
		const filledLength = Math.floor((this.barWidth * percent) / 100)
		const emptyLength = this.barWidth - filledLength

		const bar = `[${"=".repeat(filledLength)}${" ".repeat(emptyLength)}]`

		const elapsedMs = Date.now() - this.startTime
		const elapsedSec = elapsedMs / 1000
		const formattedElapsed = formatSeconds(elapsedSec)

		let etaStr = ""
		if (this.processedItems > 0 && this.processedItems < this.totalItems) {
			const avgTimePerItemMs = elapsedMs / this.processedItems
			const remainingItems = this.totalItems - this.processedItems
			const etaMs = remainingItems * avgTimePerItemMs
			etaStr = ` (ETA: ${formatSeconds(etaMs / 1000)})`
		} else if (this.processedItems >= this.totalItems && this.totalItems > 0)
			etaStr = " (Done)"

		const summary = `${this.processedItems}/${this.totalItems} entries (${percent.toFixed(0)}%)`
		const timeInfo = `${formattedElapsed} elapsed${etaStr}`

		process.stdout.clearLine(0) // Clear the current line
		process.stdout.cursorTo(0) // Move cursor to the beginning of the line
		process.stdout.write(`Processing: ${bar} ${summary} | ${timeInfo}`)
	}

	stop(): void {
		if (this.timerId) {
			clearInterval(this.timerId)
			this.timerId = undefined as never
		}
		if (this.totalItems > 0) {
			this.processedItems = this.totalItems // Ensure final state is 100%
			this.render() // Final render
			process.stdout.write("\n") // Move to the next line
		}
	}
}

export const trace = async (args: string[]): Promise<void> => {
	const packageDir = resolve(args[0] ?? process.cwd())
	const config = getConfig()

	if (!config.tsconfig) {
		// This message should go to console.error and also be captured if needed,
		// but since it exits, direct console.error is fine.
		console.error(
			`attest trace must be run from a directory with a tsconfig.json file`
		)
		process.exit(1)
	}

	const traceDir = resolve(config.cacheDir, "trace")
	ensureDir(traceDir)

	outputCapture.clear()
	const initialMessages: string[] = []

	initialMessages.push(`⏳ Gathering type trace data for ${packageDir}...`)
	outputCapture.write(initialMessages[0]) // This goes to console and buffer

	const tracingOutput = generateTraceData(traceDir, config.tsconfig, packageDir)

	const traceFile = join(traceDir, "trace.json")

	if (!existsSync(traceFile)) {
		outputCapture.write(
			`❌ No trace data found (expected a file at ${traceFile}). TSC output:\n${tracingOutput}`
		)
		const summaryPath = join(traceDir, "summary.txt")
		writeFile(summaryPath, outputCapture.getBuffer())
		return
	}

	// This message will be followed by the progress bar on the next line
	outputCapture.write(`⏳ Analyzing type trace data for ${packageDir}...`)
	analyzeTypeInstantiations(traceDir) // This function now handles its own progress display

	// Collect all messages for the summary file
	// The progress bar output is not part of outputCapture.getLines()
	const analysisMessages = outputCapture
		.getLines()
		.slice(initialMessages.length + 1) // +1 for the "Analyzing..." message

	const summaryContent = [
		...initialMessages,
		tracingOutput,
		outputCapture.getLines()[initialMessages.length], // The "Analyzing..." message
		...analysisMessages
	].join("\n")

	const summaryPath = join(traceDir, "summary.txt")
	writeFile(summaryPath, summaryContent)
}

const generateTraceData = (
	traceDir: string,
	tsconfigPath: string,
	packageDir: string
): string => {
	try {
		const output = getShellOutput(
			`${baseDiagnosticTscCmd} --project ${tsconfigPath} --generateTrace ${traceDir}`,
			{ cwd: packageDir }
		)
		process.stdout.write(output) // Display tsc output directly
		return output
	} catch (error: any) {
		const e: ExecException = error
		const output = e.stdout ?? ""
		const errorOutput = e.stderr ?? ""

		process.stdout.write(output)
		process.stderr.write(errorOutput)

		return `${output}\n${errorOutput}`
	}
}

const initializeAnalysisContext = (traceDir: string): AnalysisContext => {
	const tsServer = TsServer.instance
	const tracePath = join(traceDir, "trace.json")

	if (!existsSync(tracePath)) {
		throw new Error(
			`Critical: Expected a trace file at ${tracePath}, but it was not found during context initialization.`
		)
	}

	const traceEntries: TraceEntry[] = readJson(tracePath) as never

	return {
		traceDir,
		tsServer,
		traceEntries,
		durationEntries: [],
		callRanges: [],
		rootCalls: [],
		functionStats: {},
		allFunctions: []
	}
}

const filterDurationEntries = (ctx: AnalysisContext): void => {
	ctx.durationEntries = ctx.traceEntries.filter(entry => {
		const { args, dur, ph } = entry
		return (
			ph === "X" &&
			typeof dur === "number" &&
			args &&
			typeof args.path === "string" &&
			typeof args.pos === "number" &&
			typeof args.end === "number"
		)
	})
	// This message goes to outputCapture for the summary file
	outputCapture.write(
		`Found ${ctx.durationEntries.length} complete event traces with duration, path, and position.`
	)
}

const processDurationEntry = (
	entry: TraceEntry,
	ctx: AnalysisContext
): void => {
	const entryPath = entry.args.path as string
	const entryPos = entry.args.pos as number
	const entryEnd = entry.args.end as number
	const entryDur = entry.dur as number

	const sourceFile = ctx.tsServer.getSourceFileOrThrow(entryPath)
	let callRangeData: { typeId: string; functionName: string } | undefined

	const callExpr = findCallExpressionInRange(sourceFile, entryPos, entryEnd)
	if (callExpr) {
		const functionName = extractFunctionName(callExpr)
		callRangeData = {
			typeId: `function-${functionName}`,
			functionName
		}
	} else {
		const relevantNode = findMostSpecificNodeInRange(
			sourceFile,
			entryPos,
			entryEnd
		)
		if (relevantNode) {
			const nodeType = getStringifiableType(relevantNode)
			const nodeKind = ts.SyntaxKind[relevantNode.kind]
			const typeName = `${nodeKind}: ${nodeType.toString().substring(0, 25)}`
			const typeNodeIdPart =
				(nodeType as any).id ?? nodeType.toString().substring(0, 20)
			callRangeData = {
				typeId: `node-${relevantNode.kind}-${typeNodeIdPart}`,
				functionName: typeName
			}
		}
	}

	if (callRangeData) {
		ctx.callRanges.push({
			id: `${entry.ts}-${entryPos}-${entryEnd}`,
			typeId: callRangeData.typeId,
			functionName: callRangeData.functionName,
			callSite: `${entryPath}:${entryPos}-${entryEnd}`,
			startTime: entry.ts,
			endTime: entry.ts + entryDur,
			duration: entryDur,
			children: [],
			selfTime: entryDur
		})
	} else {
		throw new Error(
			`Failed to identify a processable AST node for duration entry (name: ${entry.name}, path: ${entryPath}, pos: ${entryPos}-${entryEnd}).`
		)
	}
}

const findCallExpressionInRange = (
	file: ts.SourceFile,
	start: number,
	end: number
): ts.CallExpression | undefined => {
	const boundingCall = nearestBoundingCallExpression(file, start)
	if (boundingCall && boundingCall.pos >= start && boundingCall.end <= end)
		return boundingCall

	const allNodes = getDescendants(file)
	const nodesInRange = allNodes.filter(
		node => node.pos >= start && node.end <= end
	)

	const callExpressions = nodesInRange.filter(node =>
		ts.isCallExpression(node)
	) as ts.CallExpression[]

	if (callExpressions.length === 0) return undefined

	const methodCalls = callExpressions.filter(call =>
		ts.isPropertyAccessExpression(call.expression)
	)
	return methodCalls.length > 0 ? methodCalls[0] : callExpressions[0]
}

const extractFunctionName = (callExpr: ts.CallExpression): string => {
	if (ts.isPropertyAccessExpression(callExpr.expression))
		return callExpr.expression.name.getText()
	if (ts.isIdentifier(callExpr.expression)) return callExpr.expression.getText()
	return "anonymousFunction"
}

const buildCallTree = (ctx: AnalysisContext): void => {
	// This message goes to outputCapture for the summary file
	outputCapture.write(
		`Building call tree from ${ctx.callRanges.length} ranges...`
	)
	ctx.callRanges.sort((a, b) => a.startTime - b.startTime)
	const activeCallStack: CallRange[] = []

	for (const call of ctx.callRanges) {
		while (
			activeCallStack.length > 0 &&
			activeCallStack[activeCallStack.length - 1].endTime < call.startTime
		)
			activeCallStack.pop()

		if (activeCallStack.length === 0) ctx.rootCalls.push(call)
		else {
			const parent = activeCallStack[activeCallStack.length - 1]
			parent.children.push(call)
		}
		activeCallStack.push(call)
	}
	outputCapture.write(
		`Call tree built with ${ctx.rootCalls.length} root calls.`
	)
}

const calculateSelfTimes = (call: CallRange): number => {
	let childrenTime = 0
	for (const child of call.children) childrenTime += calculateSelfTimes(child)
	call.selfTime = call.duration - childrenTime
	if (call.selfTime < 0) call.selfTime = 0
	return call.duration
}

const collectFunctionStats = (call: CallRange, ctx: AnalysisContext): void => {
	if (!ctx.functionStats[call.typeId]) {
		ctx.functionStats[call.typeId] = {
			typeId: call.typeId,
			functionName: call.functionName,
			totalTime: 0,
			selfTime: 0,
			count: 0,
			firstLocation: call.callSite,
			detailedCallSites: []
		}
	}

	const stats = ctx.functionStats[call.typeId]
	const [filePath, positionRange] = call.callSite.split(":")
	if (!filePath || !positionRange)
		throw new Error(`Invalid callSite format: ${call.callSite}`)
	const [posStr, endStr] = positionRange.split("-")
	const pos = parseInt(posStr, 10)
	const end = parseInt(endStr, 10)
	if (isNaN(pos) || isNaN(end)) {
		throw new Error(
			`Invalid position in callSite: ${call.callSite}. Pos: ${posStr}, End: ${endStr}`
		)
	}

	stats.detailedCallSites.push({
		path: filePath,
		pos,
		end,
		selfTime: call.selfTime
	})
	stats.totalTime += call.duration
	stats.selfTime += call.selfTime
	stats.count++
	for (const child of call.children) collectFunctionStats(child, ctx)
}

const sortAndRankFunctions = (ctx: AnalysisContext): void => {
	outputCapture.write("Sorting and ranking functions...")
	for (const stats of Object.values(ctx.functionStats))
		stats.detailedCallSites.sort((a, b) => b.selfTime - a.selfTime)
	ctx.allFunctions = Object.values(ctx.functionStats).sort(
		(a, b) => b.selfTime - a.selfTime
	)
}

const analyzeTypeInstantiations = (traceDir: string): void => {
	const ctx = initializeAnalysisContext(traceDir)
	filterDurationEntries(ctx) // Uses outputCapture

	const totalEntries = ctx.durationEntries.length
	if (totalEntries === 0) {
		outputCapture.write("No duration entries with path/pos to process.")
		outputCapture.write(
			`\n✅ Analysis complete! No data to export. Summary written to:\n` +
				`   - ${join(traceDir, "summary.txt")}`
		)
		return
	}

	const progressDisplay = new ProgressDisplay(totalEntries)
	progressDisplay.start()

	for (const [index, entry] of ctx.durationEntries.entries()) {
		try {
			processDurationEntry(entry, ctx)
		} catch (e: any) {
			progressDisplay.stop() // Stop progress before printing error via outputCapture
			outputCapture.write(
				`\n❌ Error processing entry ${index + 1}/${totalEntries} (Path: ${entry.args.path ?? "N/A"}, Pos: ${entry.args.pos ?? "N/A"}): ${e.message}`
			)
			outputCapture.write("Aborting analysis due to error.")
			// Early exit, summary will be written by the main trace function
			return
		}
		progressDisplay.update(index + 1)
	}
	progressDisplay.stop() // Ensure it's stopped if loop finished

	// Subsequent messages use outputCapture and will appear after the progress bar
	buildCallTree(ctx) // Uses outputCapture

	outputCapture.write("Calculating self-times for call tree nodes...")
	for (const root of ctx.rootCalls) calculateSelfTimes(root)

	outputCapture.write("Collecting statistics...")
	const ungroupedStats = collectUngroupedStats(ctx) // Uses outputCapture
	for (const root of ctx.rootCalls) collectFunctionStats(root, ctx)

	sortAndRankFunctions(ctx) // Uses outputCapture

	outputCapture.write("\n📊 Performance Analysis - Top Individual Calls:\n")
	displayIndividualSummary(ungroupedStats) // Uses outputCapture

	outputCapture.write("\n📊 Performance Analysis - Functions by Self Time:\n")
	displayGroupedSummary(ctx.allFunctions) // Uses outputCapture

	const rangesCsvPath = join(traceDir, "ranges.csv")
	const namesCsvPath = join(traceDir, "names.csv")
	const summaryFilePath = join(traceDir, "summary.txt") // Path already defined in trace()

	if (ctx.callRanges.length > 0) {
		outputCapture.write("Exporting CSV reports...")
		writeToCsv(
			rangesCsvPath,
			["Function Name", "Self (ms)", "Duration (ms)", "Location"],
			ungroupedStats.map(stat => [
				stat.functionName,
				formatMillis(stat.selfTime, 3),
				formatMillis(stat.duration, 3),
				formatLocation(stat.callSite)
			])
		)

		writeToCsv(
			namesCsvPath,
			[
				"Function Name",
				"Total Self (ms)",
				"Avg Self (ms)",
				"Call Count",
				"Top Location",
				"Top Self (ms)"
			],
			ctx.allFunctions.map(stats => {
				const topUsage = stats.detailedCallSites[0] ?? {
					path: "unknown",
					pos: 0,
					end: 0,
					selfTime: 0
				}
				return [
					stats.functionName,
					formatMillis(stats.selfTime, 3),
					formatMillis(stats.selfTime / Math.max(1, stats.count), 3),
					stats.count.toString(),
					formatLocation(`${topUsage.path}:${topUsage.pos}-${topUsage.end}`),
					formatMillis(topUsage.selfTime, 3)
				]
			})
		)
		outputCapture.write(
			`\n✅ Analysis complete! Results exported to:\n` +
				`   - ${rangesCsvPath} (individual calls)\n` +
				`   - ${namesCsvPath} (grouped by function name)\n` +
				`   - ${summaryFilePath} (complete analysis report)`
		)
	} else {
		outputCapture.write(
			`\n✅ Analysis complete! No call ranges processed to export to CSV. Summary written to:\n` +
				`   - ${summaryFilePath}`
		)
	}
}

const collectUngroupedStats = (ctx: AnalysisContext): UngroupedCallStats[] => {
	outputCapture.write("Collecting and sorting ungrouped call statistics...")
	const ungroupedStats: UngroupedCallStats[] = []
	const flattenCallTree = (call: CallRange): void => {
		ungroupedStats.push({
			typeId: call.typeId,
			functionName: call.functionName,
			callSite: call.callSite,
			duration: call.duration,
			selfTime: call.selfTime
		})
		for (const child of call.children) flattenCallTree(child)
	}
	for (const root of ctx.rootCalls) flattenCallTree(root)
	return ungroupedStats.sort((a, b) => b.selfTime - a.selfTime)
}

const displayIndividualSummary = (stats: UngroupedCallStats[]): void => {
	displayTableHeader(["Rank", "Function Name", "Self (ms)", "Location"])
	const topN = Math.min(stats.length, 20)
	for (let i = 0; i < topN; i++) {
		const stat = stats[i]
		const typeNameFormatted = formatTypeName(stat.functionName, 20)
		const selfTimeMs = formatPaddedMillis(stat.selfTime, 15, 2)
		const location = formatLocation(stat.callSite)
		outputCapture.write(
			`${(i + 1).toString().padStart(4)} | ${typeNameFormatted} | ${selfTimeMs} | ${location}`
		)
	}
}

const displayTableHeader = (columns: string[]): void => {
	const headerRow = [
		columns[0].padEnd(4),
		columns[1].padEnd(20),
		columns[2].padEnd(15),
		...columns.slice(3)
	].join(" | ")
	const separatorRow = [
		"-".repeat(4),
		"-".repeat(20),
		"-".repeat(15),
		...columns.slice(3).map(col => "-".repeat(col.length))
	].join("-|-")
	outputCapture.write(headerRow)
	outputCapture.write(separatorRow)
}

const displayGroupedSummary = (functions: FunctionStats[]): void => {
	displayTableHeader([
		"Rank",
		"Function Name",
		"Total Self (ms)",
		"Avg Self (ms)",
		"Calls",
		"Top Usage"
	])
	const topN = Math.min(functions.length, 20)
	for (let i = 0; i < topN; i++) {
		const stats = functions[i]
		const typeNameFormatted = formatTypeName(stats.functionName, 20)
		const totalTimeMs = formatPaddedMillis(stats.selfTime, 15, 2)
		const avgTimeMs = formatPaddedMillis(
			stats.selfTime / Math.max(1, stats.count),
			13,
			2
		)
		const calls = stats.count.toString().padStart(5)
		const topUsage = stats.detailedCallSites[0] ?? {
			path: "unknown",
			pos: 0,
			end: 0,
			selfTime: 0
		}
		const topUsageTime = formatMillis(topUsage.selfTime, 2) + "ms"
		const topUsageLocation = formatLocation(
			`${topUsage.path}:${topUsage.pos}-${topUsage.end}`
		)
		outputCapture.write(
			`${(i + 1).toString().padStart(4)} | ${typeNameFormatted} | ${totalTimeMs} | ${avgTimeMs} | ${calls} | ${topUsageLocation} (${topUsageTime})`
		)
	}
}

const formatTypeName = (typeName: string, maxLength: number): string => {
	typeName = typeName.replace(/\(\)$/, "")
	if (typeName.length <= maxLength) return typeName.padEnd(maxLength)
	const charsToKeep = maxLength - 3
	const firstPart = Math.ceil(charsToKeep * 0.7)
	const lastPart = charsToKeep - firstPart
	return (
		typeName.substring(0, firstPart) +
		"..." +
		(lastPart > 0 ? typeName.substring(typeName.length - lastPart) : "")
	).padEnd(maxLength)
}

const formatLocation = (location: string): string => {
	if (!location || location === "unknown" || !location.includes(":"))
		return location || "unknown"
	const parts = location.split(":")
	if (parts.length < 2) return basename(location)
	const filePath = parts.slice(0, -1).join(":")
	const positionRange = parts[parts.length - 1]
	const relativePath = relative(process.cwd(), filePath)
	const [posStr] = positionRange.split("-")
	const pos = parseInt(posStr, 10)
	if (isNaN(pos)) return `${relativePath}:${positionRange}`
	const sourceFile = TsServer.instance.getSourceFileOrThrow(filePath)
	const lineAndChar = sourceFile.getLineAndCharacterOfPosition(pos)
	return `${relativePath}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`
}

const findMostSpecificNodeInRange = (
	file: ts.SourceFile,
	start: number,
	end: number
): ts.Node | undefined => {
	const allNodes = getDescendants(file)
	const nodesInRange = allNodes.filter(
		node => node.pos >= start && node.end <= end
	)
	if (nodesInRange.length === 0) return undefined
	const leafNodes = nodesInRange.filter(
		node =>
			!nodesInRange.some(
				other =>
					other !== node && other.pos >= node.pos && other.end <= node.end
			)
	)
	return findNodeByPreference(leafNodes.length > 0 ? leafNodes : nodesInRange)
}

const findNodeByPreference = (nodes: ts.Node[]): ts.Node | undefined => {
	if (nodes.length === 0) return undefined
	const typeReference = nodes.find(
		node => ts.isTypeReferenceNode(node) || ts.isTypeQueryNode(node)
	)
	if (typeReference) return typeReference
	const declaration = nodes.find(
		node =>
			ts.isVariableDeclaration(node) ||
			ts.isFunctionDeclaration(node) ||
			ts.isClassDeclaration(node) ||
			ts.isInterfaceDeclaration(node)
	)
	if (declaration) return declaration
	const propertyAccess = nodes.find(node => ts.isPropertyAccessExpression(node))
	if (propertyAccess) return propertyAccess
	const assignment = nodes.find(
		node =>
			ts.isBinaryExpression(node) &&
			node.operatorToken.kind === ts.SyntaxKind.EqualsToken
	)
	if (assignment) return assignment
	const expression = nodes.find(
		node => ts.isExpressionStatement(node) || ts.isExpression(node)
	)
	if (expression) return expression
	return nodes.sort((a, b) => a.end - a.pos - (b.end - b.pos))[0]
}

const writeToCsv = (
	filePath: string,
	headers: string[],
	rows: string[][]
): void => {
	const content = [
		headers.join(","),
		...rows.map(row => row.map(escapeForCsv).join(","))
	].join("\n")
	writeFile(filePath, content)
}

const escapeForCsv = (value: string): string => {
	if (value.includes(",") || value.includes('"') || value.includes("\n"))
		return `"${value.replace(/"/g, '""')}"`
	return value
}


================================================
FILE: ark/attest/config.ts
================================================
import { ensureDir, fromCwd } from "@ark/fs"
import {
	isArray,
	liftArray,
	tryParseNumber,
	type autocomplete
} from "@ark/util"
import { existsSync } from "node:fs"
import { join, resolve } from "node:path"
import type * as prettier from "prettier"
import type ts from "typescript"
import {
	findAttestTypeScriptVersions,
	type TsVersionData
} from "./tsVersioning.ts"

export type TsVersionAliases = autocomplete<"*"> | string[]

export type BenchErrorConfig = "runtime" | "types" | boolean

type BaseAttestConfig = {
	tsconfig: string | null | undefined
	compilerOptions: ts.CompilerOptions
	updateSnapshots: boolean
	failOnMissingSnapshots: boolean
	/** A string or list of strings representing the TypeScript version aliases to run.
	 *
	 * Aliases must be specified as a package.json dependency or devDependency beginning with "typescript".
	 * Alternate aliases can be specified using the "npm:" prefix:
	 * ```json
	 * 		"typescript": "latest",
	 * 		"typescript-next: "npm:typescript@next",
	 * 		"typescript-1": "npm:typescript@5.2"
	 * 		"typescript-2": "npm:typescript@5.1"
	 * ```
	 *
	 * "*" can be pased to run all discovered versions beginning with "typescript".
	 */
	tsVersions: TsVersionAliases | TsVersionData[]
	skipTypes: boolean
	skipInlineInstantiations: boolean
	attestAliases: string[]
	benchPercentThreshold: number
	benchErrorOnThresholdExceeded: BenchErrorConfig
	filter: string | undefined
	testDeclarationAliases: string[]
	formatCmd: string
	shouldFormat: boolean
	/**
	 *  Provided options will override the following defaults.
	 *  Any options not listed will fallback to Prettier's default value.
	 *
	 * {
	 *	 semi: false,
	 *	 printWidth: 60,
	 *	 trailingComma: "none",
	 * }
	 */
	typeToStringFormat: prettier.Options
}

export type AttestConfig = Partial<BaseAttestConfig>

export const getDefaultAttestConfig = (): BaseAttestConfig => ({
	tsconfig:
		existsSync(fromCwd("tsconfig.json")) ? fromCwd("tsconfig.json") : undefined,
	compilerOptions: {},
	attestAliases: ["attest", "attestInternal"],
	failOnMissingSnapshots: "CI" in process.env,
	updateSnapshots: false,
	skipTypes: false,
	skipInlineInstantiations: false,
	tsVersions: "default",
	benchPercentThreshold: 20,
	benchErrorOnThresholdExceeded: true,
	filter: undefined,
	testDeclarationAliases: ["bench", "it", "test"],
	formatCmd: `npm exec --no -- prettier --write`,
	shouldFormat: true,
	typeToStringFormat: {}
})

const flagAliases: { [k in keyof AttestConfig]?: string[] } = {
	updateSnapshots: ["u", "update"]
}

const findParamIndex = (flagOrAlias: string) =>
	process.argv.findIndex(
		arg => arg === `-${flagOrAlias}` || arg === `--${flagOrAlias}`
	)

const hasFlag = (flag: keyof AttestConfig) =>
	findParamIndex(flag) !== -1 ||
	flagAliases[flag]?.some(alias => findParamIndex(alias) !== -1)

const getParamValue = (param: keyof AttestConfig) => {
	let paramIndex = findParamIndex(param)
	if (paramIndex === -1) {
		if (!flagAliases[param]) return

		for (let i = 0; i < flagAliases[param].length && paramIndex === -1; i++)
			paramIndex = findParamIndex(flagAliases[param][i])

		if (paramIndex === -1) return
	}

	const raw = process.argv[paramIndex + 1]
	if (raw === "true") return true

	if (raw === "false") return false

	if (raw === "null") return null

	if (param === "benchPercentThreshold")
		return tryParseNumber(raw, { errorOnFail: true })

	if (param === "tsVersions" || param === "attestAliases") return raw.split(",")

	if (param === "typeToStringFormat" || param === "compilerOptions")
		return JSON.parse(raw)

	return raw
}

export const attestEnvPrefix = "ATTEST_"

const addEnvConfig = (config: BaseAttestConfig) => {
	for (const [k, v] of Object.entries(process.env as Record<string, string>)) {
		if (k.startsWith(attestEnvPrefix)) {
			const optionName = k.slice(attestEnvPrefix.length)
			if (optionName === "CONFIG") Object.assign(config, JSON.parse(v))
			else (config as any)[optionName] = JSON.parse(v)
		}
	}
	let k: keyof BaseAttestConfig
	for (k in config) {
		if (config[k] === false) config[k] = hasFlag(k) as never
		else {
			const value = getParamValue(k)
			if (value !== undefined) config[k] = value as never
		}
	}
	return config
}

export interface ParsedAttestConfig extends Readonly<BaseAttestConfig> {
	cacheDir: string
	assertionCacheDir: string
	defaultAssertionCachePath: string
	tsVersions: TsVersionData[]
}

const parseConfig = (): ParsedAttestConfig => {
	const baseConfig = addEnvConfig(getDefaultAttestConfig())
	const cacheDir = resolve(".attest")
	const assertionCacheDir = join(cacheDir, "assertions")
	const defaultAssertionCachePath = join(assertionCacheDir, "typescript.json")

	return Object.assign(baseConfig, {
		cacheDir,
		assertionCacheDir,
		defaultAssertionCachePath,
		tsVersions:
			baseConfig.skipTypes ? []
			: isTsVersionAliases(baseConfig.tsVersions) ?
				parseTsVersions(baseConfig.tsVersions)
			:	baseConfig.tsVersions
	})
}

const isTsVersionAliases = (
	v: AttestConfig["tsVersions"]
): v is TsVersionAliases =>
	typeof v === "string" || (isArray(v) && typeof v[0] === "string")

const parseTsVersions = (aliases: TsVersionAliases): TsVersionData[] => {
	const versions = findAttestTypeScriptVersions()
	if (aliases === "*" || (isArray(aliases) && aliases[0] === "*"))
		return versions

	return liftArray(aliases).map(alias => {
		const matching = versions.find(v => v.alias === alias)
		if (!matching) {
			throw new Error(
				`Specified TypeScript version ${alias} does not exist.` +
					` It should probably be specified in package.json like:
"@ark/attest-ts-${alias}": "npm:typescript@latest"`
			)
		}
		return matching
	})
}

let cachedConfig: ParsedAttestConfig | undefined

export const getConfig = (): ParsedAttestConfig => parseConfig()

// workaround for a bug in Node 25 that creates localStorage as an empty proxy,
// leading to @typescript/vfs eventually throwing when it sees that it is not
// undefined and tries to call `getItem`:

// https://github.com/nodejs/node/issues/60303

// this can be removed once the bug is addressed in Node
if (!globalThis.localStorage?.getItem)
	globalThis.localStorage = undefined as never

export const ensureCacheDirs = (): void => {
	cachedConfig ??= getConfig()
	ensureDir(cachedConfig.cacheDir)
	ensureDir(cachedConfig.assertionCacheDir)
}


================================================
FILE: ark/attest/fixtures.ts
================================================
import { fileName, shell, writeJson } from "@ark/fs"
import { rmSync } from "node:fs"
import { join } from "node:path"
import { writeSnapshotUpdatesOnExit } from "./cache/snapshots.ts"
import { analyzeProjectAssertions } from "./cache/writeAssertionCache.ts"
import { ensureCacheDirs, getConfig, type AttestConfig } from "./config.ts"
import { forTypeScriptVersions } from "./tsVersioning.ts"

export const setup = (options?: Partial<AttestConfig>): typeof teardown => {
	const { ...config } = getConfig()
	if (options) Object.assign(config, 
Download .txt
gitextract_8q21qzq_/

├── .cursor/
│   └── commands/
│       └── armstrong.md
├── .github/
│   ├── CODE_OF_CONDUCT.md
│   ├── CONTRIBUTING.md
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   ├── SECURITY.md
│   ├── actions/
│   │   └── setup/
│   │       └── action.yml
│   ├── pull_request_template.md
│   └── workflows/
│       ├── pr.yml
│       ├── publish.yml
│       └── pullfrog.yml
├── .gitignore
├── .vscode/
│   ├── extensions.json
│   ├── launch.json
│   └── settings.json
├── LICENSE
├── ark/
│   ├── attest/
│   │   ├── CHANGELOG.md
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── assertions.test.ts
│   │   │   ├── benchExpectedOutput.ts
│   │   │   ├── benchTemplate.ts
│   │   │   ├── completions.test.ts
│   │   │   ├── demo.test.ts
│   │   │   ├── externalSnapshots.test.ts
│   │   │   ├── functions.test.ts
│   │   │   ├── instantiations.test.ts
│   │   │   ├── satisfies.test.ts
│   │   │   ├── snap.test.ts
│   │   │   ├── snapExpectedOutput.ts
│   │   │   ├── snapPopulation.test.ts
│   │   │   ├── snapTemplate.ts
│   │   │   ├── unwrap.test.ts
│   │   │   └── utils.ts
│   │   ├── assert/
│   │   │   ├── assertions.ts
│   │   │   ├── attest.ts
│   │   │   └── chainableAssertions.ts
│   │   ├── bench/
│   │   │   ├── await1k.ts
│   │   │   ├── baseline.ts
│   │   │   ├── bench.ts
│   │   │   ├── call1k.ts
│   │   │   ├── measure.ts
│   │   │   └── type.ts
│   │   ├── cache/
│   │   │   ├── getCachedAssertions.ts
│   │   │   ├── snapshots.ts
│   │   │   ├── ts.ts
│   │   │   ├── utils.ts
│   │   │   └── writeAssertionCache.ts
│   │   ├── cli/
│   │   │   ├── cli.ts
│   │   │   ├── precache.ts
│   │   │   ├── shared.ts
│   │   │   ├── stats.ts
│   │   │   └── trace.ts
│   │   ├── config.ts
│   │   ├── fixtures.ts
│   │   ├── index.ts
│   │   ├── package.json
│   │   ├── tsVersioning.ts
│   │   └── utils.ts
│   ├── docs/
│   │   ├── .turbo/
│   │   │   └── daemon/
│   │   │       └── a6661884d53fb864-turbo.log.2025-10-05
│   │   ├── README.md
│   │   ├── app/
│   │   │   ├── (home)/
│   │   │   │   ├── layout.tsx
│   │   │   │   └── page.tsx
│   │   │   ├── api/
│   │   │   │   └── search/
│   │   │   │       └── route.ts
│   │   │   ├── discord/
│   │   │   │   └── page.tsx
│   │   │   ├── docs/
│   │   │   │   ├── [[...slug]]/
│   │   │   │   │   └── page.tsx
│   │   │   │   └── layout.tsx
│   │   │   ├── global-error.tsx
│   │   │   ├── global.css
│   │   │   ├── layout.config.tsx
│   │   │   ├── layout.tsx
│   │   │   ├── metadata.ts
│   │   │   ├── playground/
│   │   │   │   └── page.tsx
│   │   │   └── providers.tsx
│   │   ├── components/
│   │   │   ├── AnchorAliases.tsx
│   │   │   ├── ApiTable.tsx
│   │   │   ├── ArkCard.tsx
│   │   │   ├── AutoplayDemo.tsx
│   │   │   ├── Badge.tsx
│   │   │   ├── Banner.tsx
│   │   │   ├── Button.tsx
│   │   │   ├── CodeBlock.tsx
│   │   │   ├── FloatYourBoat.tsx
│   │   │   ├── GhStarButton.tsx
│   │   │   ├── Head.tsx
│   │   │   ├── Hero.tsx
│   │   │   ├── InstallationTabs.tsx
│   │   │   ├── KeywordTable.tsx
│   │   │   ├── LinkCard.tsx
│   │   │   ├── LocalFriendlyUrl.tsx
│   │   │   ├── PlatformCloud.tsx
│   │   │   ├── ReleaseBanner.tsx
│   │   │   ├── RuntimeBenchmarksGraph.tsx
│   │   │   ├── SyntaxTabs.tsx
│   │   │   ├── apiData.ts
│   │   │   ├── dts/
│   │   │   │   ├── regex.ts
│   │   │   │   ├── schema.ts
│   │   │   │   ├── type.ts
│   │   │   │   └── util.ts
│   │   │   ├── icons/
│   │   │   │   ├── arktype-logo.tsx
│   │   │   │   ├── boat.tsx
│   │   │   │   ├── bun.tsx
│   │   │   │   ├── chromium.tsx
│   │   │   │   ├── deno.tsx
│   │   │   │   ├── intellij.tsx
│   │   │   │   ├── js.tsx
│   │   │   │   ├── neovim.tsx
│   │   │   │   ├── node.tsx
│   │   │   │   ├── npm.tsx
│   │   │   │   ├── ts.tsx
│   │   │   │   └── vscode.tsx
│   │   │   ├── playground/
│   │   │   │   ├── ParseResult.tsx
│   │   │   │   ├── Playground.tsx
│   │   │   │   ├── PlaygroundTabs.tsx
│   │   │   │   ├── RestoreDefault.tsx
│   │   │   │   ├── ShareLink.tsx
│   │   │   │   ├── TraverseResult.tsx
│   │   │   │   ├── completions.ts
│   │   │   │   ├── errorLens.ts
│   │   │   │   ├── execute.ts
│   │   │   │   ├── format.ts
│   │   │   │   ├── highlights.ts
│   │   │   │   ├── hovers.ts
│   │   │   │   ├── tsserver.ts
│   │   │   │   └── utils.ts
│   │   │   └── snippets/
│   │   │       ├── betterErrors.twoslash.ts
│   │   │       ├── clarityAndConcision.twoslash.js
│   │   │       ├── contentsById.ts
│   │   │       ├── deepIntrospectability.twoslash.js
│   │   │       ├── intrinsicOptimization.twoslash.js
│   │   │       ├── nestedTypeInScopeError.twoslash.js
│   │   │       └── unparalleledDx.twoslash.js
│   │   ├── content/
│   │   │   └── docs/
│   │   │       ├── blog/
│   │   │       │   ├── 2.0.mdx
│   │   │       │   ├── 2.1.mdx
│   │   │       │   ├── 2.2.mdx
│   │   │       │   ├── arkregex.mdx
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── comparisons.mdx
│   │   │       ├── configuration/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── declare.mdx
│   │   │       ├── ecosystem/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── expressions/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── faq.mdx
│   │   │       ├── generics/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── integrations/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── internal/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── intro/
│   │   │       │   ├── adding-constraints.mdx
│   │   │       │   ├── meta.json
│   │   │       │   ├── morphs-and-more.mdx
│   │   │       │   ├── setup.mdx
│   │   │       │   └── your-first-type.mdx
│   │   │       ├── introspection/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── keywords.mdx
│   │   │       ├── match.mdx
│   │   │       ├── meta.json
│   │   │       ├── objects/
│   │   │       │   ├── arrays/
│   │   │       │   │   └── meta.json
│   │   │       │   ├── index.mdx
│   │   │       │   ├── meta.json
│   │   │       │   └── properties/
│   │   │       │       └── meta.json
│   │   │       ├── primitives/
│   │   │       │   ├── index.mdx
│   │   │       │   ├── meta.json
│   │   │       │   ├── number/
│   │   │       │   │   └── meta.json
│   │   │       │   └── string/
│   │   │       │       └── meta.json
│   │   │       ├── scopes/
│   │   │       │   ├── index.mdx
│   │   │       │   └── meta.json
│   │   │       ├── traversal-api.mdx
│   │   │       └── type-api/
│   │   │           ├── index.mdx
│   │   │           └── meta.json
│   │   ├── lib/
│   │   │   ├── ambient.d.ts
│   │   │   ├── metadata.ts
│   │   │   ├── shiki.ts
│   │   │   ├── source.tsx
│   │   │   ├── writeLlmsTxt.ts
│   │   │   └── writeSnippetsEntrypoint.ts
│   │   ├── next-env.d.ts
│   │   ├── next.config.ts
│   │   ├── package.json
│   │   ├── postcss.config.cjs
│   │   ├── public/
│   │   │   ├── CNAME
│   │   │   ├── llms.txt
│   │   │   └── onigasm.wasm
│   │   ├── source.config.ts
│   │   └── tsconfig.json
│   ├── extension/
│   │   ├── .vscode/
│   │   │   └── launch.json
│   │   ├── README.md
│   │   ├── arktype.scratch.ts
│   │   ├── injected.tmLanguage.json
│   │   ├── package.json
│   │   └── tsWithArkType.tmLanguage.json
│   ├── fast-check/
│   │   ├── __tests__/
│   │   │   └── arktypeFastCheck.test.ts
│   │   ├── arbitraries/
│   │   │   ├── array.ts
│   │   │   ├── date.ts
│   │   │   ├── domain.ts
│   │   │   ├── number.ts
│   │   │   ├── object.ts
│   │   │   ├── proto.ts
│   │   │   └── string.ts
│   │   ├── arktypeFastCheck.ts
│   │   ├── fastCheckContext.ts
│   │   └── package.json
│   ├── fs/
│   │   ├── caller.ts
│   │   ├── fs.ts
│   │   ├── getCurrentLine.ts
│   │   ├── index.ts
│   │   ├── package.json
│   │   └── shell.ts
│   ├── json-schema/
│   │   ├── CHANGELOG.md
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── array.test.ts
│   │   │   ├── composition.test.ts
│   │   │   ├── number.test.ts
│   │   │   ├── object.test.ts
│   │   │   └── string.test.ts
│   │   ├── array.ts
│   │   ├── common.ts
│   │   ├── composition.ts
│   │   ├── errors.ts
│   │   ├── index.ts
│   │   ├── json.ts
│   │   ├── number.ts
│   │   ├── object.ts
│   │   ├── package.json
│   │   ├── scope.ts
│   │   └── string.ts
│   ├── regex/
│   │   ├── CHANGELOG.md
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── regex.bench.ts
│   │   │   └── regex.test.ts
│   │   ├── charset.ts
│   │   ├── escape.ts
│   │   ├── execArray.ts
│   │   ├── group.ts
│   │   ├── index.ts
│   │   ├── package.json
│   │   ├── parse.ts
│   │   ├── quantify.ts
│   │   ├── regex.ts
│   │   └── state.ts
│   ├── repo/
│   │   ├── .prettierignore
│   │   ├── __tests__/
│   │   │   └── standardSchema.test.ts
│   │   ├── build.ts
│   │   ├── config.ts
│   │   ├── dtsGen.ts
│   │   ├── jsdocGen.ts
│   │   ├── mocha.globalSetup.ts
│   │   ├── mocha.package.jsonc
│   │   ├── nodeOptions.js
│   │   ├── package.json
│   │   ├── patchC8.cjs
│   │   ├── publish.ts
│   │   ├── scratch/
│   │   │   ├── fn.ts
│   │   │   ├── matchComparison.bench.ts
│   │   │   ├── realWorldComparison.ts
│   │   │   ├── typeClass.ts
│   │   │   └── unionComparison.ts
│   │   ├── scratch.ts
│   │   ├── shared.ts
│   │   ├── testPackage.ts
│   │   ├── testV8.js
│   │   ├── ts.js
│   │   ├── tsconfig.cjs.json
│   │   ├── tsconfig.dts.json
│   │   └── tsconfig.esm.json
│   ├── schema/
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── bounds.test.ts
│   │   │   ├── errors.test.ts
│   │   │   ├── intersection.test.ts
│   │   │   ├── jsonSchema.test.ts
│   │   │   ├── morphs.test.ts
│   │   │   ├── onFail.test.ts
│   │   │   ├── parse.test.ts
│   │   │   ├── props.test.ts
│   │   │   ├── proto.test.ts
│   │   │   ├── scope.test.ts
│   │   │   ├── select.test.ts
│   │   │   ├── union.test.ts
│   │   │   └── unit.test.ts
│   │   ├── config.ts
│   │   ├── constraint.ts
│   │   ├── generic.ts
│   │   ├── index.ts
│   │   ├── intrinsic.ts
│   │   ├── kinds.ts
│   │   ├── module.ts
│   │   ├── node.ts
│   │   ├── package.json
│   │   ├── parse.ts
│   │   ├── predicate.ts
│   │   ├── refinements/
│   │   │   ├── after.ts
│   │   │   ├── before.ts
│   │   │   ├── divisor.ts
│   │   │   ├── exactLength.ts
│   │   │   ├── kinds.ts
│   │   │   ├── max.ts
│   │   │   ├── maxLength.ts
│   │   │   ├── min.ts
│   │   │   ├── minLength.ts
│   │   │   ├── pattern.ts
│   │   │   └── range.ts
│   │   ├── roots/
│   │   │   ├── alias.ts
│   │   │   ├── basis.ts
│   │   │   ├── domain.ts
│   │   │   ├── intersection.ts
│   │   │   ├── morph.ts
│   │   │   ├── proto.ts
│   │   │   ├── root.ts
│   │   │   ├── union.ts
│   │   │   ├── unit.ts
│   │   │   └── utils.ts
│   │   ├── scope.ts
│   │   ├── shared/
│   │   │   ├── compile.ts
│   │   │   ├── declare.ts
│   │   │   ├── disjoint.ts
│   │   │   ├── errors.ts
│   │   │   ├── implement.ts
│   │   │   ├── intersections.ts
│   │   │   ├── jsonSchema.ts
│   │   │   ├── registry.ts
│   │   │   ├── standardSchema.ts
│   │   │   ├── toJsonSchema.ts
│   │   │   ├── traversal.ts
│   │   │   └── utils.ts
│   │   └── structure/
│   │       ├── index.ts
│   │       ├── optional.ts
│   │       ├── prop.ts
│   │       ├── required.ts
│   │       ├── sequence.ts
│   │       ├── shared.ts
│   │       └── structure.ts
│   ├── themes/
│   │   ├── .vscode/
│   │   │   └── launch.json
│   │   ├── README.md
│   │   ├── arkdark.json
│   │   ├── arkdarkItalic.json
│   │   ├── arklight.json
│   │   ├── arklightItalic.json
│   │   └── package.json
│   ├── type/
│   │   ├── CHANGELOG.md
│   │   ├── README.md
│   │   ├── __tests__/
│   │   │   ├── arrays/
│   │   │   │   ├── array.test.ts
│   │   │   │   ├── base.test.ts
│   │   │   │   ├── defaults.test.ts
│   │   │   │   ├── intersection.test.ts
│   │   │   │   ├── nonVariadicTuple.test.ts
│   │   │   │   └── variadicTuple.test.ts
│   │   │   ├── badDefinitionType.test.ts
│   │   │   ├── basis.test.ts
│   │   │   ├── brand.test.ts
│   │   │   ├── cast.test.ts
│   │   │   ├── clone.test.ts
│   │   │   ├── completions.test.ts
│   │   │   ├── config.test.ts
│   │   │   ├── cyclic.bench.ts
│   │   │   ├── dateLiteral.test.ts
│   │   │   ├── declared.test.ts
│   │   │   ├── define.test.ts
│   │   │   ├── discrimination.test.ts
│   │   │   ├── divisor.test.ts
│   │   │   ├── enclosed.test.ts
│   │   │   ├── expressions.test.ts
│   │   │   ├── filter.test.ts
│   │   │   ├── fn.test.ts
│   │   │   ├── generateBenchData.ts
│   │   │   ├── generated/
│   │   │   │   └── cyclic.ts
│   │   │   ├── generic.test.ts
│   │   │   ├── get.test.ts
│   │   │   ├── group.test.ts
│   │   │   ├── imports.test.ts
│   │   │   ├── instanceOf.test.ts
│   │   │   ├── integration/
│   │   │   │   ├── allConfig.ts
│   │   │   │   ├── eoptConfig.ts
│   │   │   │   ├── generateAllConfig.ts
│   │   │   │   ├── onFailConfig.ts
│   │   │   │   ├── simpleConfig.ts
│   │   │   │   ├── testAllConfig.ts
│   │   │   │   ├── testEoptConfig.ts
│   │   │   │   ├── testOnFailConfig.ts
│   │   │   │   ├── testSimpleConfig.ts
│   │   │   │   └── util.ts
│   │   │   ├── intersection.test.ts
│   │   │   ├── keyof.test.ts
│   │   │   ├── keywords/
│   │   │   │   ├── date.test.ts
│   │   │   │   ├── exclude.test.ts
│   │   │   │   ├── extract.test.ts
│   │   │   │   ├── formData.test.ts
│   │   │   │   ├── format.test.ts
│   │   │   │   ├── ip.test.ts
│   │   │   │   ├── json.test.ts
│   │   │   │   ├── merge.test.ts
│   │   │   │   ├── number.test.ts
│   │   │   │   ├── numericStrings.test.ts
│   │   │   │   ├── object.test.ts
│   │   │   │   ├── omit.test.ts
│   │   │   │   ├── parse.test.ts
│   │   │   │   ├── partial.test.ts
│   │   │   │   ├── pick.test.ts
│   │   │   │   ├── record.test.ts
│   │   │   │   ├── required.test.ts
│   │   │   │   ├── string.test.ts
│   │   │   │   ├── tsPrimitives.test.ts
│   │   │   │   ├── url.test.ts
│   │   │   │   └── uuid.test.ts
│   │   │   ├── literal.test.ts
│   │   │   ├── match.bench.ts
│   │   │   ├── match.test.ts
│   │   │   ├── narrow.test.ts
│   │   │   ├── nary.bench.ts
│   │   │   ├── nary.test.ts
│   │   │   ├── object.bench.ts
│   │   │   ├── objects/
│   │   │   │   ├── defaults.test.ts
│   │   │   │   ├── indexSignatures.test.ts
│   │   │   │   ├── mapped.test.ts
│   │   │   │   ├── namedKeys.test.ts
│   │   │   │   ├── onUndeclaredKey.test.ts
│   │   │   │   ├── props.test.ts
│   │   │   │   └── spread.test.ts
│   │   │   ├── operand.bench.ts
│   │   │   ├── operator.bench.ts
│   │   │   ├── optional.test.ts
│   │   │   ├── pipe.test.ts
│   │   │   ├── range.test.ts
│   │   │   ├── realWorld.test.ts
│   │   │   ├── regex.test.ts
│   │   │   ├── runtime.bench.ts
│   │   │   ├── scope.test.ts
│   │   │   ├── select.test.ts
│   │   │   ├── serialization.test.ts
│   │   │   ├── standardSchema.test.ts
│   │   │   ├── string.test.ts
│   │   │   ├── submodule.test.ts
│   │   │   ├── this.test.ts
│   │   │   ├── thunk.test.ts
│   │   │   ├── toJsonSchema.test.ts
│   │   │   ├── traverse.test.ts
│   │   │   ├── type.test.ts
│   │   │   ├── typeReference.test.ts
│   │   │   ├── unenclosed.test.ts
│   │   │   └── union.test.ts
│   │   ├── attributes.ts
│   │   ├── config.ts
│   │   ├── declare.ts
│   │   ├── fn.ts
│   │   ├── generic.ts
│   │   ├── index.ts
│   │   ├── keywords/
│   │   │   ├── Array.ts
│   │   │   ├── FormData.ts
│   │   │   ├── TypedArray.ts
│   │   │   ├── builtins.ts
│   │   │   ├── constructors.ts
│   │   │   ├── keywords.ts
│   │   │   ├── number.ts
│   │   │   ├── string.ts
│   │   │   └── ts.ts
│   │   ├── match.ts
│   │   ├── module.ts
│   │   ├── nary.ts
│   │   ├── package.json
│   │   ├── parser/
│   │   │   ├── ast/
│   │   │   │   ├── bounds.ts
│   │   │   │   ├── default.ts
│   │   │   │   ├── divisor.ts
│   │   │   │   ├── generic.ts
│   │   │   │   ├── infer.ts
│   │   │   │   ├── keyof.ts
│   │   │   │   ├── utils.ts
│   │   │   │   └── validate.ts
│   │   │   ├── definition.ts
│   │   │   ├── objectLiteral.ts
│   │   │   ├── property.ts
│   │   │   ├── reduce/
│   │   │   │   ├── dynamic.ts
│   │   │   │   ├── shared.ts
│   │   │   │   └── static.ts
│   │   │   ├── shift/
│   │   │   │   ├── operand/
│   │   │   │   │   ├── date.ts
│   │   │   │   │   ├── enclosed.ts
│   │   │   │   │   ├── genericArgs.ts
│   │   │   │   │   ├── operand.ts
│   │   │   │   │   └── unenclosed.ts
│   │   │   │   ├── operator/
│   │   │   │   │   ├── bounds.ts
│   │   │   │   │   ├── brand.ts
│   │   │   │   │   ├── default.ts
│   │   │   │   │   ├── divisor.ts
│   │   │   │   │   └── operator.ts
│   │   │   │   └── tokens.ts
│   │   │   ├── string.ts
│   │   │   ├── tupleExpressions.ts
│   │   │   └── tupleLiteral.ts
│   │   ├── scope.ts
│   │   ├── type.ts
│   │   └── variants/
│   │       ├── array.ts
│   │       ├── base.ts
│   │       ├── date.ts
│   │       ├── instantiate.ts
│   │       ├── number.ts
│   │       ├── object.ts
│   │       └── string.ts
│   └── util/
│       ├── __tests__/
│       │   ├── arrays.test.ts
│       │   ├── callable.test.ts
│       │   ├── clone.test.ts
│       │   ├── collapsibleDate.test.ts
│       │   ├── flatMorph.test.ts
│       │   ├── hkt.test.ts
│       │   ├── intersections.test.ts
│       │   ├── labels.test.ts
│       │   ├── numbers.test.ts
│       │   ├── overloads.test.ts
│       │   ├── path.test.ts
│       │   ├── printable.test.ts
│       │   ├── records.test.ts
│       │   ├── registry.test.ts
│       │   ├── string.test.ts
│       │   ├── traits.scratch.ts
│       │   └── traits.test.ts
│       ├── arrays.ts
│       ├── clone.ts
│       ├── describe.ts
│       ├── domain.ts
│       ├── errors.ts
│       ├── flatMorph.ts
│       ├── functions.ts
│       ├── generics.ts
│       ├── get.ts
│       ├── hkt.ts
│       ├── index.ts
│       ├── intersections.ts
│       ├── isomorphic.ts
│       ├── keys.ts
│       ├── lazily.ts
│       ├── numbers.ts
│       ├── objectKinds.ts
│       ├── package.json
│       ├── path.ts
│       ├── primitive.ts
│       ├── records.ts
│       ├── registry.ts
│       ├── scanner.ts
│       ├── serialize.ts
│       ├── strings.ts
│       ├── traits.ts
│       ├── tsconfig.base.json
│       └── unionToTuple.ts
├── eslint.config.js
├── package.json
├── pnpm-workspace.yaml
└── tsconfig.json
Download .txt
SYMBOL INDEX (2376 symbols across 232 files)

FILE: ark/attest/__tests__/assertions.test.ts
  type O (line 191) | type O = {

FILE: ark/attest/__tests__/benchExpectedOutput.ts
  type makeComplexType (line 28) | type makeComplexType<S extends string> =

FILE: ark/attest/__tests__/benchTemplate.ts
  type makeComplexType (line 28) | type makeComplexType<S extends string> =

FILE: ark/attest/__tests__/completions.test.ts
  type Obj (line 5) | type Obj = {
  type Ark (line 12) | type Ark = {
  type Arks (line 16) | type Arks = {

FILE: ark/attest/__tests__/demo.test.ts
  type Legends (line 73) | type Legends = { faker?: "🐐"; [others: string]: unknown }

FILE: ark/attest/__tests__/utils.ts
  type makeComplexType (line 25) | type makeComplexType<S extends string> =

FILE: ark/attest/assert/assertions.ts
  type ThrowAssertionErrorContext (line 7) | type ThrowAssertionErrorContext = {
  class MissingSnapshotError (line 23) | class MissingSnapshotError extends Error {}
  type AssertFn (line 25) | type AssertFn = (
  type MappedTypeAssertionResult (line 31) | type MappedTypeAssertionResult = {
  type TypeAssertionMapper (line 36) | type TypeAssertionMapper = (
  class TypeAssertionMapping (line 41) | class TypeAssertionMapping {
    method constructor (line 44) | constructor(fn: TypeAssertionMapper) {
  type AssertedFnCallResult (line 199) | type AssertedFnCallResult = {

FILE: ark/attest/assert/attest.ts
  type AttestFn (line 22) | type AttestFn = {
  type VersionableActual (line 36) | type VersionableActual = {} | null | undefined | TypeAssertionMapping
  type AssertionContext (line 38) | type AssertionContext = {
  type InternalAssertionHooks (line 51) | type InternalAssertionHooks = {

FILE: ark/attest/assert/chainableAssertions.ts
  type ChainableAssertionOptions (line 34) | type ChainableAssertionOptions = {
  type AssertionRecord (line 39) | type AssertionRecord = Record<keyof rootAssertions<any, AssertionKind>, ...
  type UnwrapOptions (line 41) | type UnwrapOptions = {
  class ChainableAssertions (line 46) | class ChainableAssertions implements AssertionRecord {
    method constructor (line 49) | constructor(ctx: AssertionContext) {
    method unversionedActual (line 53) | private get unversionedActual(): unknown {
    method versionableActual (line 63) | private get versionableActual(): VersionableActual {
    method serializedActual (line 67) | private get serializedActual(): unknown {
    method unwrap (line 71) | unwrap(opts?: UnwrapOptions): unknown {
    method snapRequiresUpdate (line 77) | private snapRequiresUpdate(expectedSerialized: unknown) {
    method unknown (line 86) | get unknown(): this {
    method is (line 90) | is(expected: unknown): this {
    method equals (line 95) | equals(expected: unknown): this {
    method satisfies (line 100) | satisfies(def: unknown): this {
    method instanceOf (line 105) | instanceOf(expected: Constructor): this {
    method snap (line 122) | get snap(): snapProperty<unknown, AssertionKind> {
    method immediateOrChained (line 177) | private immediateOrChained() {
    method throws (line 200) | get throws(): unknown {
    method throwsAndHasTypeError (line 208) | throwsAndHasTypeError(matchValue: string | RegExp): void {
    method completions (line 228) | get completions(): any {
    method jsdoc (line 244) | get jsdoc(): any {
    method type (line 254) | get type(): any {
  type AssertionKind (line 295) | type AssertionKind = "value" | "type"
  type rootAssertions (line 297) | type rootAssertions<t, kind extends AssertionKind> = valueAssertions<
  type valueAssertions (line 303) | type valueAssertions<
  type nextAssertions (line 309) | type nextAssertions<kind extends AssertionKind> =
  type inferredAssertions (line 312) | type inferredAssertions<
  type ChainContext (line 319) | type ChainContext = {
  type functionAssertions (line 324) | type functionAssertions<kind extends AssertionKind> = {
  type valueFromTypeAssertion (line 332) | type valueFromTypeAssertion<
  type snapProperty (line 337) | type snapProperty<expected, kind extends AssertionKind> = {
  type Unwrapper (line 346) | type Unwrapper<expected = unknown> = (opts?: UnwrapOptions) => expected
  type nonOverlappingSatisfiesMessage (line 351) | type nonOverlappingSatisfiesMessage =
  type validateExpectedOverlaps (line 354) | type validateExpectedOverlaps<expected, satisfies> =
  type comparableValueAssertion (line 359) | type comparableValueAssertion<expected, kind extends AssertionKind> = {
  type CompletionsSnap (line 375) | interface CompletionsSnap {
  type TypeAssertionsRoot (line 380) | type TypeAssertionsRoot = {
  type TypeAssertionProps (line 384) | type TypeAssertionProps = {
  type ExternalSnapshotOptions (line 390) | type ExternalSnapshotOptions = {

FILE: ark/attest/bench/bench.ts
  type StatName (line 21) | type StatName = keyof typeof stats
  type TimeAssertionName (line 23) | type TimeAssertionName = StatName | "mark"
  type BenchFn (line 27) | type BenchFn = <fn extends BenchableFunction>(
  type Bench (line 33) | interface Bench extends BenchFn {
  class ResultCollector (line 89) | class ResultCollector {
    method constructor (line 96) | constructor(ctx: BenchContext) {
    method start (line 107) | start() {
    method stop (line 112) | stop() {
    method done (line 117) | done() {
  class BenchAssertions (line 146) | class BenchAssertions<
    method constructor (line 157) | constructor(fn: Fn, ctx: BenchContext) {
    method applyCallTimeHooks (line 163) | private applyCallTimeHooks() {
    method callTimesSync (line 173) | private callTimesSync() {
    method callTimesAsync (line 182) | private async callTimesAsync() {
    method createAssertion (line 191) | private createAssertion<Name extends TimeAssertionName>(
    method markAssertion (line 212) | private markAssertion(
    method getNextAssertions (line 240) | private getNextAssertions(): NextAssertions {
    method createStatMethod (line 244) | private createStatMethod<Name extends TimeAssertionName>(
    method addUnhandledBenchException (line 272) | private addUnhandledBenchException(reason: unknown) {
    method median (line 280) | median(baseline?: Measure<TimeUnit>): ReturnedAssertions {
    method mean (line 286) | mean(baseline?: Measure<TimeUnit>): ReturnedAssertions {
    method mark (line 291) | mark(baseline?: MarkMeasure): ReturnedAssertions {
  type UntilOptions (line 299) | type UntilOptions = {
  type BaseBenchOptions (line 304) | type BaseBenchOptions = {
  type BenchOptions (line 308) | type BenchOptions = BaseBenchOptions & {
  type InternalBenchOptions (line 315) | type InternalBenchOptions = BenchOptions & {
  type BenchContext (line 319) | type BenchContext = {
  type BenchableFunction (line 331) | type BenchableFunction = () => unknown | Promise<unknown>
  type InitialBenchAssertions (line 333) | type InitialBenchAssertions<Fn extends BenchableFunction> =

FILE: ark/attest/bench/measure.ts
  type MeasureUnit (line 3) | type MeasureUnit = TimeUnit | TypeUnit
  type Measure (line 5) | type Measure<Unit extends MeasureUnit = MeasureUnit> = [
  type MeasureComparison (line 10) | type MeasureComparison<Unit extends MeasureUnit = MeasureUnit> = {
  type MarkMeasure (line 15) | type MarkMeasure = Partial<Record<StatName, Measure>>
  constant TYPE_UNITS (line 22) | const TYPE_UNITS = ["instantiations"] as const
  type TypeUnit (line 24) | type TypeUnit = (typeof TYPE_UNITS)[number]
  type TimeUnit (line 41) | type TimeUnit = keyof typeof timeUnitRatios

FILE: ark/attest/bench/type.ts
  type BenchTypeAssertions (line 26) | type BenchTypeAssertions = {

FILE: ark/attest/cache/getCachedAssertions.ts
  type VersionedAssertionsByFile (line 13) | type VersionedAssertionsByFile = [
  type VersionedTypeAssertion (line 76) | type VersionedTypeAssertion<

FILE: ark/attest/cache/snapshots.ts
  type SnapshotArgs (line 24) | type SnapshotArgs = {
  type QueuedUpdate (line 66) | type QueuedUpdate = {
  type ExternalSnapshotArgs (line 74) | type ExternalSnapshotArgs = SnapshotArgs & {

FILE: ark/attest/cache/ts.ts
  class TsServer (line 9) | class TsServer {
    method instance (line 15) | static get instance(): TsServer {
    method constructor (line 21) | constructor(tsConfigInfo?: TsconfigInfo) {
    method getSourceFileOrThrow (line 59) | getSourceFileOrThrow(path: string): ts.SourceFile {
  type TsconfigInfo (line 137) | type TsconfigInfo = {
  type RawTsConfigJson (line 165) | type RawTsConfigJson = dict & { compilerOptions: ts.CompilerOptions }
  type InstantiatedTsConfigJson (line 167) | type InstantiatedTsConfigJson = ts.ParsedCommandLine
  type TsLibFiles (line 233) | type TsLibFiles = {
  type InternalTypeChecker (line 258) | interface InternalTypeChecker extends ts.TypeChecker {
  type StringifiableType (line 270) | interface StringifiableType extends ts.Type {
  type ArgumentTypes (line 300) | type ArgumentTypes = {

FILE: ark/attest/cache/utils.ts
  type SourceFile (line 151) | interface SourceFile {
  type Program (line 155) | interface Program {

FILE: ark/attest/cache/writeAssertionCache.ts
  type AssertionsByFile (line 21) | type AssertionsByFile = Record<string, TypeAssertionData[]>
  type Completions (line 177) | type Completions = Record<string, string[]> | string
  type DiagnosticData (line 221) | type DiagnosticData = {
  type DiagnosticsByFile (line 227) | type DiagnosticsByFile = Record<string, DiagnosticData[]>
  type ArgAssertionData (line 272) | type ArgAssertionData = {
  type TypeRelationshipAssertionData (line 280) | type TypeRelationshipAssertionData = {
  type TypeBenchmarkingAssertionData (line 290) | type TypeBenchmarkingAssertionData = {
  type TypeAssertionKind (line 295) | type TypeAssertionKind = "bench" | "type"
  type TypeAssertionData (line 297) | type TypeAssertionData<
  type LinePositionRange (line 303) | type LinePositionRange = {
  type TypeRelationship (line 308) | type TypeRelationship = "subtype" | "supertype" | "equality" | "none"

FILE: ark/attest/cli/cli.ts
  type Subcommand (line 14) | type Subcommand = keyof typeof subcommands

FILE: ark/attest/cli/stats.ts
  type TypePerfStats (line 44) | type TypePerfStats = {

FILE: ark/attest/cli/trace.ts
  type TraceEntry (line 15) | interface TraceEntry {
  type CallRange (line 34) | interface CallRange {
  type CallSiteDetail (line 46) | interface CallSiteDetail {
  type FunctionStats (line 53) | interface FunctionStats {
  type AnalysisContext (line 63) | interface AnalysisContext {
  type UngroupedCallStats (line 74) | interface UngroupedCallStats {
  class ProgressDisplay (line 128) | class ProgressDisplay {
    method constructor (line 135) | constructor(totalItems: number) {
    method start (line 140) | start(): void {
    method update (line 150) | update(processedCount: number): void {
    method render (line 159) | private render(): void {
    method stop (line 193) | stop(): void {

FILE: ark/attest/config.ts
  type TsVersionAliases (line 17) | type TsVersionAliases = autocomplete<"*"> | string[]
  type BenchErrorConfig (line 19) | type BenchErrorConfig = "runtime" | "types" | boolean
  type BaseAttestConfig (line 21) | type BaseAttestConfig = {
  type AttestConfig (line 62) | type AttestConfig = Partial<BaseAttestConfig>
  type ParsedAttestConfig (line 146) | interface ParsedAttestConfig extends Readonly<BaseAttestConfig> {

FILE: ark/attest/tsVersioning.ts
  type TsVersionData (line 76) | type TsVersionData = {

FILE: ark/attest/utils.ts
  type ContextualTests (line 14) | type ContextualTests<ctx = unknown> = (
  type ContextualizeRoot (line 18) | type ContextualizeRoot = {
  type ContextualizeEach (line 25) | type ContextualizeEach = <ctx>(
  type Contextualize (line 31) | interface Contextualize extends ContextualizeRoot {

FILE: ark/docs/app/(home)/layout.tsx
  type LayoutProps (line 6) | type LayoutProps = {

FILE: ark/docs/app/discord/page.tsx
  function DiscordPage (line 9) | function DiscordPage() {

FILE: ark/docs/app/global-error.tsx
  type GlobalErrorProps (line 5) | type GlobalErrorProps = {
  function GlobalError (line 10) | function GlobalError() {

FILE: ark/docs/app/layout.tsx
  function RootLayout (line 25) | function RootLayout({ children }: { children: ReactNode }) {

FILE: ark/docs/app/metadata.ts
  type MetadataOptions (line 3) | type MetadataOptions = {

FILE: ark/docs/app/playground/page.tsx
  type LayoutProps (line 13) | type LayoutProps = {
  function PlaygroundPage (line 17) | function PlaygroundPage() {

FILE: ark/docs/components/AnchorAliases.tsx
  type Props (line 4) | type Props = Record<string, true | undefined>

FILE: ark/docs/components/ApiTable.tsx
  type ApiTableProps (line 6) | type ApiTableProps = {
  type ApiTableRowProps (line 40) | interface ApiTableRowProps {
  type ApiExampleProps (line 104) | interface ApiExampleProps {

FILE: ark/docs/components/AutoplayDemo.tsx
  type AutoplayDemoProps (line 9) | type AutoplayDemoProps = React.DetailedHTMLProps<

FILE: ark/docs/components/Badge.tsx
  type BadgeProps (line 24) | interface BadgeProps

FILE: ark/docs/components/Banner.tsx
  type Props (line 19) | interface Props extends HTMLAttributes<HTMLDivElement> {

FILE: ark/docs/components/Button.tsx
  type ButtonSize (line 5) | type ButtonSize = "sm" | "md" | "lg"
  type ButtonVariant (line 6) | type ButtonVariant = "outline" | "filled"
  type ButtonProps (line 8) | interface ButtonProps extends ComponentPropsWithoutRef<"button"> {

FILE: ark/docs/components/CodeBlock.tsx
  type CodeBlockProps (line 16) | type CodeBlockProps = {
  type CodeBlockDecorator (line 25) | type CodeBlockDecorator = "@noErrors"

FILE: ark/docs/components/GhStarButton.tsx
  type Props (line 9) | type Props = {

FILE: ark/docs/components/InstallationTabs.tsx
  type Installer (line 6) | type Installer = (typeof installers)[number]
  type InstallationTabProps (line 8) | type InstallationTabProps = {

FILE: ark/docs/components/KeywordTable.tsx
  type KeywordTableProps (line 69) | type KeywordTableProps = {

FILE: ark/docs/components/LocalFriendlyUrl.tsx
  type LocalFriendlyUrlProps (line 4) | interface LocalFriendlyUrlProps {

FILE: ark/docs/components/PlatformCloud.tsx
  type SvgLogoProps (line 13) | type SvgLogoProps = {
  type PlatformName (line 17) | type PlatformName = keyof typeof platforms
  type PlatformCloudProps (line 31) | type PlatformCloudProps = {

FILE: ark/docs/components/SyntaxTabs.tsx
  type SyntaxKind (line 14) | type SyntaxKind = (typeof syntaxKinds)[number]
  type DiscriminatedSyntaxKindProps (line 39) | type DiscriminatedSyntaxKindProps = unionToPropwiseXor<
  type SyntaxTabProps (line 45) | type SyntaxTabProps = DiscriminatedSyntaxKindProps & {

FILE: ark/docs/components/playground/ParseResult.tsx
  type ParseResult (line 13) | type ParseResult = type | Error
  type Props (line 16) | type Props = {

FILE: ark/docs/components/playground/Playground.tsx
  type LoadingState (line 78) | type LoadingState = "unloaded" | "loading" | "loaded"
  type PlaygroundProps (line 80) | interface PlaygroundProps {
  type PlaygroundEditorProps (line 211) | type PlaygroundEditorProps = {
  type PlaygroundResultsProps (line 303) | interface PlaygroundResultsProps extends ExecutionResult {

FILE: ark/docs/components/playground/PlaygroundTabs.tsx
  type TabProps (line 7) | interface TabProps {
  type TabsProps (line 14) | interface TabsProps {

FILE: ark/docs/components/playground/RestoreDefault.tsx
  type RestoreDefaultProps (line 4) | interface RestoreDefaultProps {

FILE: ark/docs/components/playground/ShareLink.tsx
  type ShareLinkProps (line 6) | interface ShareLinkProps {

FILE: ark/docs/components/playground/TraverseResult.tsx
  type TraverseResult (line 6) | type TraverseResult = type.errors | unset | {} | null | undefined
  type Props (line 9) | type Props = {

FILE: ark/docs/components/playground/errorLens.ts
  type ErrorLensReplacement (line 80) | type ErrorLensReplacement = {

FILE: ark/docs/components/playground/execute.ts
  type ExecutionResult (line 10) | interface ExecutionResult {

FILE: ark/docs/components/playground/highlights.ts
  type VSCodeTheme (line 7) | interface VSCodeTheme {
  type TokenColor (line 14) | interface TokenColor {

FILE: ark/docs/components/playground/hovers.ts
  type DisplayPart (line 4) | type DisplayPart = {

FILE: ark/docs/components/playground/utils.ts
  type ResultKind (line 22) | type ResultKind = "failure" | "success" | "none"
  type RequestMap (line 30) | type RequestMap = Map<string, number>

FILE: ark/docs/components/snippets/betterErrors.twoslash.ts
  type RuntimeErrors (line 9) | interface RuntimeErrors extends ArkErrors {

FILE: ark/docs/lib/shiki.ts
  type HastElement (line 158) | type HastElement = Parameters<ShikiTransformer["line"] & {}>[0]
  method line (line 179) | line(node) {
  type shikiConfig (line 195) | type shikiConfig = typeof shikiConfig
  type BuiltinLang (line 197) | type BuiltinLang = {
  type extractName (line 201) | type extractName<lang> = lang extends { name: infer name } ? name : lang

FILE: ark/docs/lib/source.tsx
  type IconName (line 9) | type IconName = keyof typeof icons | "Advanced" | "New"

FILE: ark/docs/lib/writeSnippetsEntrypoint.ts
  type SnippetId (line 51) | type SnippetId = (typeof snippetIds)[number]

FILE: ark/extension/arktype.scratch.ts
  type Foo (line 18) | enum Foo {
  class F (line 149) | class F {
    method compile (line 150) | static compile(rule: PropRule[]) {

FILE: ark/fast-check/arbitraries/domain.ts
  type DomainArbitrary (line 17) | type DomainArbitrary<t = unknown> = (
  type BuildDomainArbitrary (line 22) | type BuildDomainArbitrary = {
  type DomainInputNode (line 30) | type DomainInputNode = nodeOfKind<"intersection"> | nodeOfKind<"domain">

FILE: ark/fast-check/arbitraries/proto.ts
  type BuildProtoArbitrary (line 17) | type BuildProtoArbitrary = {
  type ProtoArbitrary (line 24) | type ProtoArbitrary<t = unknown> = (
  type ProtoInputNode (line 29) | type ProtoInputNode = nodeOfKind<"intersection"> | nodeOfKind<"domain">

FILE: ark/fast-check/fastCheckContext.ts
  type Ctx (line 3) | type Ctx = {

FILE: ark/fs/caller.ts
  type GetCallStackOptions (line 7) | type GetCallStackOptions = {
  type LinePosition (line 19) | type LinePosition = {
  type SourcePosition (line 24) | type SourcePosition = LinePosition & {
  type CallerOfOptions (line 29) | type CallerOfOptions = {
  type FormatFilePathOptions (line 43) | type FormatFilePathOptions = {

FILE: ark/fs/fs.ts
  type JsonTransformer (line 47) | type JsonTransformer = (data: object) => object
  type WalkOptions (line 60) | type WalkOptions = {
  type SourceFileEntry (line 191) | type SourceFileEntry = [path: string, contents: string]
  type ReplacementDictionary (line 196) | type ReplacementDictionary = Record<
  type Matchers (line 200) | type Matchers = ReadonlyArray<Matcher>
  type Matcher (line 201) | type Matcher = {

FILE: ark/fs/getCurrentLine.ts
  type Location (line 4) | type Location = {
  type Offset (line 26) | type Offset = {

FILE: ark/fs/shell.ts
  type ShellOptions (line 4) | type ShellOptions = Omit<ExecSyncOptions, "stdio"> & {

FILE: ark/json-schema/errors.ts
  type writeJsonSchemaCommonConstAndEnumMessage (line 2) | type writeJsonSchemaCommonConstAndEnumMessage =
  type writeJsonSchemaInsufficientKeysMessage (line 8) | type writeJsonSchemaInsufficientKeysMessage<
  type writeJsonSchemaUnsupportedTypeMessage (line 24) | type writeJsonSchemaUnsupportedTypeMessage<
  type writeJsonSchemaArrayAdditionalItemsAndItemsAndPrefixItemsMessage (line 36) | type writeJsonSchemaArrayAdditionalItemsAndItemsAndPrefixItemsMessage =
  type writeJsonSchemaArrayNonArrayItemsAndAdditionalItemsMessage (line 42) | type writeJsonSchemaArrayNonArrayItemsAndAdditionalItemsMessage =
  type writeJsonSchemaNumberMaximumAndExclusiveMaximumMessage (line 49) | type writeJsonSchemaNumberMaximumAndExclusiveMaximumMessage =
  type writeJsonSchemaNumberMinimumAndExclusiveMinimumMessage (line 55) | type writeJsonSchemaNumberMinimumAndExclusiveMinimumMessage =
  type writeJsonSchemaObjectNonConformingKeyAndPropertyNamesMessage (line 62) | type writeJsonSchemaObjectNonConformingKeyAndPropertyNamesMessage<
  type writeJsonSchemaObjectNonConformingPatternAndPropertyNamesMessage (line 78) | type writeJsonSchemaObjectNonConformingPatternAndPropertyNamesMessage<

FILE: ark/json-schema/scope.ts
  type AnyKeywords (line 4) | type AnyKeywords = Partial<JsonSchema.Const & JsonSchema.Enum>
  type TypeWithNoKeywords (line 6) | type TypeWithNoKeywords = { type: "boolean" | "null" }
  type TypeWithKeywords (line 8) | type TypeWithKeywords =
  type Json (line 17) | type Json = unknown
  type ArraySchema (line 19) | type ArraySchema = JsonSchema.Array
  type NumberSchema (line 21) | type NumberSchema = JsonSchema.Numeric
  type ObjectSchema (line 23) | type ObjectSchema = JsonSchema.Object
  type StringSchema (line 27) | type StringSchema = Omit<JsonSchema.String, "format" | "pattern"> & {
  type JsonSchemaScope (line 31) | type JsonSchemaScope = Scope<{

FILE: ark/regex/__tests__/regex.bench.ts
  type Result (line 11) | type Result = array.repeat<3, 50>
  type Result (line 14) | type Result = array.repeat<2, 100>
  type Result (line 18) | type Result = array.repeat<2, 500>
  type Result (line 22) | type Result = array.repeat<2, 512>
  type Result (line 26) | type Result = array.repeat<2, 513>

FILE: ark/regex/__tests__/regex.test.ts
  type iterate (line 42) | type iterate<s extends State, until extends number, counter extends 1[] ...
  type _ParseResult (line 45) | type _ParseResult = iterate<State.initialize<"^\\d\\d$", "">, 4>
  type _AstResult (line 46) | type _AstResult = State.Group.finalize<_ParseResult>
  type _FinalizedResult (line 47) | type _FinalizedResult = s.finalize<_ParseResult>
  type _Tree (line 49) | type _Tree = SequenceTree<
  type _Result (line 76) | type _Result = finalizeTree<
  type Tree (line 413) | type Tree = State.Group.finalize<
  type Tree (line 430) | type Tree = State.Group.finalize<
  type Expected (line 1328) | type Expected =

FILE: ark/regex/charset.ts
  type parseCharset (line 11) | type parseCharset<s extends State, unscanned extends string> =
  type parseNonNegatedCharset (line 29) | type parseNonNegatedCharset<
  type parseDash (line 40) | type parseDash<
  type inferRange (line 58) | type inferRange<start extends string, end extends string> =
  type UnescapedDashMarker (line 61) | type UnescapedDashMarker = noSuggest<"dash">
  type parseChar (line 63) | type parseChar<unscanned extends string> =
  type emptyCharacterSetMessage (line 79) | type emptyCharacterSetMessage = typeof emptyCharacterSetMessage

FILE: ark/regex/escape.ts
  type parseEscape (line 4) | type parseEscape<s extends State, unscanned extends string> =
  type parseNumericBackreference (line 13) | type parseNumericBackreference<
  type parseNamedBackreference (line 24) | type parseNamedBackreference<s extends State, unscanned extends string> =
  type parseUnicodeProperty (line 29) | type parseUnicodeProperty<
  type parseSingleEscapedCharacter (line 38) | type parseSingleEscapedCharacter<
  type parseEscapedChar (line 49) | type parseEscapedChar<char extends string> =
  type trailingBackslashMessage (line 63) | type trailingBackslashMessage = typeof trailingBackslashMessage
  type writeUnresolvableBackreferenceMessage (line 71) | type writeUnresolvableBackreferenceMessage<ref extends string | number> =
  type missingBackreferenceNameMessage (line 77) | type missingBackreferenceNameMessage =
  type writeInvalidUnicodePropertyMessage (line 87) | type writeInvalidUnicodePropertyMessage<
  type writeUnnecessaryEscapeMessage (line 97) | type writeUnnecessaryEscapeMessage<char extends string> =
  type writeStringEscapableMessage (line 107) | type writeStringEscapableMessage<char extends StringEscapableChar> =
  type caretNotationMessage (line 113) | type caretNotationMessage =
  type StringEscapableChar (line 116) | type StringEscapableChar = "t" | "n" | "r" | "f" | "v" | "0" | "x" | "u"
  type RegexClassChar (line 118) | type RegexClassChar = "w" | "W" | "D" | "S"
  type BoundaryChar (line 120) | type BoundaryChar = "b" | "B"
  type UnicodePropertyChar (line 122) | type UnicodePropertyChar = "p" | "P"
  type NonZeroDigit (line 124) | type NonZeroDigit = "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
  type StringDigit (line 126) | type StringDigit = "0" | NonZeroDigit

FILE: ark/regex/execArray.ts
  type RegexExecArray (line 4) | interface RegexExecArray<
  type RegexIndexRange (line 26) | type RegexIndexRange = [start: number, end: number]
  type RegexIndicesArray (line 28) | interface RegexIndicesArray<

FILE: ark/regex/group.ts
  type LookaroundChar (line 8) | type LookaroundChar = "=" | "!"
  type ModifiableFlag (line 10) | type ModifiableFlag = "i" | "m" | "s"
  type parseGroup (line 12) | type parseGroup<s extends State, unscanned extends string> =
  type parseNonCapturingGroup (line 19) | type parseNonCapturingGroup<s extends State, unscanned extends string> =
  type ShiftedModifiers (line 43) | type ShiftedModifiers<
  type ParsedModifiers (line 49) | type ParsedModifiers<
  type shiftModifiers (line 57) | type shiftModifiers<unscanned extends string> =
  type parseModifiers (line 85) | type parseModifiers<unscanned extends string> = _parseModifiers<
  type _parseModifiers (line 91) | type _parseModifiers<
  type writeDuplicateModifierMessage (line 123) | type writeDuplicateModifierMessage<modifier extends ModifiableFlag> =
  type multipleModifierDashesMessage (line 129) | type multipleModifierDashesMessage = typeof multipleModifierDashesMessage
  type missingNegatedModifierMessage (line 133) | type missingNegatedModifierMessage = typeof missingNegatedModifierMessage
  type writeInvalidModifierMessage (line 140) | type writeInvalidModifierMessage<char extends string> =
  type parseNamedGroupOrLookbehind (line 143) | type parseNamedGroupOrLookbehind<s extends State, unscanned extends stri...
  type shiftNamedGroup (line 153) | type shiftNamedGroup<unscanned extends string> =
  type unnamedCaptureGroupMessage (line 162) | type unnamedCaptureGroupMessage = typeof unnamedCaptureGroupMessage
  type unescapedLiteralQuestionMarkMessage (line 167) | type unescapedLiteralQuestionMarkMessage =

FILE: ark/regex/parse.ts
  type parseState (line 12) | type parseState<s extends State> =
  type next (line 18) | type next<s extends State> =
  type maybeSplitCasing (line 37) | type maybeSplitCasing<caseInsensitive extends boolean, char extends stri...

FILE: ark/regex/quantify.ts
  type parseBuiltinQuantifier (line 4) | type parseBuiltinQuantifier<
  type quantifyBuiltin (line 17) | type quantifyBuiltin<
  type ParsedRange (line 27) | type ParsedRange = {
  type from (line 34) | type from<r extends ParsedRange> = r
  type skipPossibleQuestionMark (line 37) | type skipPossibleQuestionMark<unscanned extends string> =
  type parsePossibleRangeString (line 40) | type parsePossibleRangeString<unscanned extends string> =
  type parseQuantifier (line 63) | type parseQuantifier<unscanned extends string, parsed extends ParsedRang...
  type parsePossibleRange (line 65) | type parsePossibleRange<
  type quantify (line 89) | type quantify<
  type tryFastPath (line 95) | type tryFastPath<
  type loopFromZero (line 111) | type loopFromZero<
  type loopUntilMin (line 120) | type loopUntilMin<
  type loopUntilMax (line 136) | type loopUntilMax<
  type QuantifyingChar (line 146) | type QuantifyingChar = "*" | "+" | "?"
  type writeUnmatchedQuantifierError (line 153) | type writeUnmatchedQuantifierError<quantifier extends string> =
  type writeUnnaturalNumberQuantifierError (line 161) | type writeUnnaturalNumberQuantifierError<quantifier extends string> =

FILE: ark/regex/regex.ts
  type IndexedCaptures (line 6) | type IndexedCaptures = Array<string | undefined>
  type NamedCaptures (line 7) | type NamedCaptures = Record<string, string | undefined>
  type UnicodeFlag (line 9) | type UnicodeFlag = "v" | "u"
  type Flags (line 10) | type Flags =
  type RegexContext (line 13) | type RegexContext = {
  type Regex (line 19) | interface Regex<
  type RegexParser (line 44) | interface RegexParser {
  type regex (line 61) | type regex<
  type infer (line 67) | type infer<src extends string, flags extends Flags = ""> =
  type validate (line 70) | type validate<src extends string, flags extends Flags = ""> =
  type parse (line 73) | type parse<src extends string, flags extends Flags = ""> = parseState<

FILE: ark/regex/state.ts
  type State (line 22) | interface State extends State.Group {
  type from (line 30) | type from<s extends State> = s
  type initialize (line 32) | type initialize<source extends string, flags extends Flags> = from<{
  type UnnamedCaptureKind (line 43) | enum UnnamedCaptureKind {
  type CaptureKind (line 49) | type CaptureKind = string | UnnamedCaptureKind
  type Group (line 51) | type Group = {
  type from (line 61) | type from<g extends Group> = g
  type pop (line 63) | type pop<init extends Group, last extends Group[]> = [...last, init]
  type finalize (line 65) | type finalize<g extends Group> =
  type finalizeUnion (line 73) | type finalizeUnion<
  type Boundary (line 87) | type Boundary = Anchor | "(" | ")" | "[" | "]"
  type Anchor (line 88) | type Anchor = "^" | "$"
  type Control (line 89) | type Control = QuantifyingChar | Boundary | "|" | "." | "{" | "-" | "\\"
  type AnchorMarker (line 91) | type AnchorMarker<inner extends Anchor = Anchor> =
  type StartAnchorMarker (line 94) | type StartAnchorMarker = AnchorMarker<"^">
  type EndAnchorMarker (line 95) | type EndAnchorMarker = AnchorMarker<"$">
  type error (line 98) | type error<message extends string> = State.from<{
  type shiftQuantifiable (line 109) | type shiftQuantifiable<
  type pushQuantified (line 124) | type pushQuantified<
  type pushQuantifier (line 139) | type pushQuantifier<
  type finalizeBranch (line 163) | type finalizeBranch<
  type anchor (line 177) | type anchor<
  type pushGroup (line 192) | type pushGroup<
  type popGroup (line 209) | type popGroup<s extends State, unscanned extends string> =
  type finalize (line 227) | type finalize<s extends State> =
  type finalizeRegexOrError (line 242) | type finalizeRegexOrError<r extends FinalizationResult> =
  type finalizeContext (line 256) | type finalizeContext<ctx extends FinalizationContext> =
  type finalizeContextWithoutCaptures (line 271) | type finalizeContextWithoutCaptures<ctx extends FinalizationContext> =
  type finalizeContextWithCaptures (line 277) | type finalizeContextWithCaptures<ctx extends FinalizationContext> =
  type RegexAst (line 294) | type RegexAst =
  type ReferenceNode (line 302) | interface ReferenceNode<to extends string = string> {
  type finalize (line 308) | type finalize<
  type inferReference (line 332) | type inferReference<to extends string | undefined> =
  type writeIncompleteReferenceError (line 341) | type writeIncompleteReferenceError<ref extends string> =
  type SequenceTree (line 344) | interface SequenceTree<ast extends RegexAst[] = RegexAst[]> {
  type Empty (line 350) | type Empty = SequenceTree<[]>
  type finalize (line 352) | type finalize<
  type _finalize (line 357) | type _finalize<
  type UnionTree (line 375) | interface UnionTree<ast extends RegexAst[] = RegexAst[]> {
  type finalize (line 381) | type finalize<
  type FinalizedBranch (line 386) | type FinalizedBranch = {
  type from (line 393) | type from<b extends FinalizedBranch> = b
  type _finalize (line 396) | type _finalize<
  type finalizeBranch (line 409) | type finalizeBranch<
  type finalizeBranchCaptures (line 424) | type finalizeBranchCaptures<
  type finalizeBranches (line 442) | type finalizeBranches<
  type CapturedGroupKind (line 466) | type CapturedGroupKind = string | State.UnnamedCaptureKind.indexed
  type IncompleteCaptureGroup (line 468) | type IncompleteCaptureGroup = noSuggest<"incompleteCaptureGroup">
  type IndexedCaptureOffset (line 470) | type IndexedCaptureOffset = noSuggest<"indexedCaptureOffset">
  type EmptyCaptures (line 476) | type EmptyCaptures = [IndexedCaptureOffset]
  type GroupTree (line 478) | interface GroupTree<
  type finalize (line 488) | type finalize<
  type finalizeGroupAst (line 502) | type finalizeGroupAst<
  type finalizeGroupResult (line 526) | type finalizeGroupResult<
  type finalizeNamedCapture (line 544) | type finalizeNamedCapture<
  type finalizeUnnamedCapture (line 561) | type finalizeUnnamedCapture<
  type QuantifierTree (line 573) | interface QuantifierTree<ast extends RegexAst = RegexAst> {
  type finalize (line 581) | type finalize<
  type finalizeQuantifierResult (line 589) | type finalizeQuantifierResult<
  type finalizeNonZeroMinQuantified (line 604) | type finalizeNonZeroMinQuantified<
  type finalizeZeroMinQuantifiedWithCaptures (line 612) | type finalizeZeroMinQuantifiedWithCaptures<
  type finalizeZeroQuantified (line 622) | type finalizeZeroQuantified<
  type zeroQuantifiedNames (line 641) | type zeroQuantifiedNames<
  type finalizeOnePlusQuantified (line 648) | type finalizeOnePlusQuantified<
  type pushQuantifiable (line 660) | type pushQuantifiable<sequence extends RegexAst, root extends RegexAst> =
  type pushToSequence (line 669) | type pushToSequence<sequence extends SequenceTree, root extends RegexAst> =
  type extractNewCaptures (line 675) | type extractNewCaptures<
  type FinalizationContext (line 683) | interface FinalizationContext extends Required<RegexContext> {
  type from (line 688) | type from<ctx extends FinalizationContext> = ctx
  type FinalizationResult (line 691) | type FinalizationResult = {
  type from (line 697) | type from<r extends FinalizationResult> = r
  type error (line 699) | type error<
  type finalizeTree (line 713) | type finalizeTree<tree, ctx extends FinalizationContext> =
  type applyAnchors (line 726) | type applyAnchors<pattern extends string> =
  type anchorsAway (line 735) | type anchorsAway<pattern extends string> =
  type appendNonRedundant (line 743) | type appendNonRedundant<base extends string, suffix extends string> =
  type prependNonRedundant (line 756) | type prependNonRedundant<base extends string, prefix extends string> =
  type writeMidAnchorError (line 773) | type writeMidAnchorError<anchor extends Anchor> =

FILE: ark/repo/jsdocGen.ts
  type ApiGroup (line 102) | type ApiGroup = "Type" | "Traversal"
  type JsDocComment (line 104) | type JsDocComment = ReturnType<JSDoc["getComment"]>
  type RawJsDocPart (line 106) | type RawJsDocPart = Extract<
  type ParsedJsDocPart (line 111) | type ParsedJsDocPart =
  type ApiDocsByGroup (line 117) | type ApiDocsByGroup = {
  type ParsedJsDocBlock (line 121) | type ParsedJsDocBlock = {
  type MatchContext (line 281) | type MatchContext = {

FILE: ark/repo/scratch/typeClass.ts
  method constructor (line 12) | constructor(input: unknown) {
  method and (line 20) | static and<cls extends typeof TypeConstructor<any>, andDef>(
  class Foo (line 33) | class Foo extends Class({ a: "string|number[]" }) {
    method getA (line 34) | getA() {
  class Bar (line 43) | class Bar extends Foo.and({ b: "boolean" }) {
    method getB (line 44) | getB() {
  type Z (line 49) | type Z = typeof Bar.infer //=>

FILE: ark/repo/shared.ts
  type PackageScope (line 44) | type PackageScope = (typeof packageScopes)[number]
  type ArkPackage (line 46) | type ArkPackage = {

FILE: ark/schema/__tests__/select.test.ts
  type StringDomain (line 207) | type StringDomain = DomainNode & { domain: string }

FILE: ark/schema/config.ts
  type ArkSchemaRegistry (line 22) | interface ArkSchemaRegistry extends ArkRegistry {
  type nodeConfigForKind (line 30) | type nodeConfigForKind<kind extends NodeKind> = Readonly<
  type NodeConfigsByKind (line 45) | type NodeConfigsByKind = {
  type NodeConfig (line 49) | type NodeConfig<kind extends NodeKind = NodeKind> =
  type UnknownErrorConfigs (line 52) | interface UnknownErrorConfigs {
  type UnknownNodeConfig (line 59) | interface UnknownNodeConfig extends UnknownErrorConfigs {
  type ResolvedUnknownNodeConfig (line 63) | type ResolvedUnknownNodeConfig = requireKeys<
  type MergeToJsonSchemaConfigs (line 120) | type MergeToJsonSchemaConfigs = <base extends ToJsonSchema.Options | und...
  type CloneImplementation (line 193) | type CloneImplementation = <original extends object>(
  type ArkSchemaConfig (line 197) | interface ArkSchemaConfig extends Partial<Readonly<NodeConfigsByKind>> {
  type resolveConfig (line 209) | type resolveConfig<config extends ArkSchemaConfig> = show<
  type ResolvedConfig (line 219) | type ResolvedConfig = resolveConfig<ArkSchemaConfig>

FILE: ark/schema/constraint.ts
  type Declaration (line 50) | interface Declaration extends BaseNodeDeclaration {
  type ReductionResult (line 54) | type ReductionResult = BaseRoot | Disjoint | Intersection.Inner.mutable
  type Attachments (line 56) | interface Attachments {
  type PrimitiveKind (line 61) | type PrimitiveKind = Exclude<ConstraintKind, StructuralKind>
  method constructor (line 71) | constructor(attachments: UnknownAttachments, $: BaseScope) {
  method intersect (line 83) | intersect<r extends BaseConstraint>(
  method compile (line 107) | compile(js: NodeCompiler): void {
  method errorContext (line 116) | get errorContext(): d["errorContext"] {
  method compiledErrorContext (line 125) | get compiledErrorContext(): string {
  type ConstraintGroupKind (line 154) | type ConstraintGroupKind = satisfy<NodeKind, "intersection" | "structure">
  type ConstraintIntersectionState (line 156) | interface ConstraintIntersectionState<
  type FlatIntersectionInner (line 236) | type FlatIntersectionInner = Intersection.Inner & Structure.Inner
  type MutableFlatIntersectionInner (line 238) | type MutableFlatIntersectionInner = Intersection.Inner.mutable &
  type constraintKindLeftOf (line 263) | type constraintKindLeftOf<kind extends ConstraintKind> = ConstraintKind &
  type constraintKindOrLeftOf (line 266) | type constraintKindOrLeftOf<kind extends ConstraintKind> =
  type intersectConstraintKinds (line 270) | type intersectConstraintKinds<
  type writeInvalidOperandMessage (line 298) | type writeInvalidOperandMessage<

FILE: ark/schema/generic.ts
  type GenericParamAst (line 17) | type GenericParamAst<
  type GenericParamDef (line 22) | type GenericParamDef<name extends string = string> =
  type genericParamNames (line 32) | type genericParamNames<params extends array<GenericParamAst>> = {
  type genericParamConstraints (line 36) | type genericParamConstraints<params extends array<GenericParamAst>> = {
  type GenericArgResolutions (line 40) | type GenericArgResolutions<
  class LazyGenericBody (line 46) | class LazyGenericBody<
  type GenericAst (line 51) | interface GenericAst<
  class GenericRoot (line 66) | class GenericRoot<
    method constructor (line 82) | constructor(
    method defIsLazy (line 125) | defIsLazy(): this is GenericRoot<params, LazyGenericBody> {
    method cacheGetter (line 129) | protected cacheGetter<name extends keyof this>(
    method json (line 137) | get json(): JsonStructure {
    method params (line 146) | get params(): { [i in keyof params]: [params[i][0], BaseRoot] } {
    method names (line 157) | get names(): genericParamNames<params> {
    method constraints (line 161) | get constraints(): { [i in keyof params]: BaseRoot } {
    method internal (line 165) | get internal(): this {
    method referencesById (line 169) | get referencesById(): Record<string, BaseNode> {
    method references (line 173) | get references(): BaseNode[] {
  type genericParamSchemasToAst (line 178) | type genericParamSchemasToAst<
  type genericHktToConstraints (line 186) | type genericHktToConstraints<hkt extends abstract new () => Hkt> =
  type GenericRootParser (line 189) | type GenericRootParser = <
  type GenericRootBodyParser (line 195) | type GenericRootBodyParser<params extends array<GenericParamAst>> = {
  type writeUnsatisfiedParameterConstraintMessage (line 220) | type writeUnsatisfiedParameterConstraintMessage<

FILE: ark/schema/kinds.ts
  type NodeDeclarationsByKind (line 45) | interface NodeDeclarationsByKind extends BoundDeclarations {
  type NodesByKind (line 129) | interface NodesByKind extends BoundNodesByKind {
  type nodeOfKind (line 147) | type nodeOfKind<kind extends NodeKind> = NodesByKind[kind]
  type Declaration (line 149) | type Declaration<kind extends NodeKind> = NodeDeclarationsByKind[kind]
  type NodeSchema (line 151) | type NodeSchema<kind extends NodeKind> = Declaration<kind>["schema"]
  type RootSchema (line 153) | type RootSchema<kind extends RootKind = RootKind> = NodeSchema<kind>
  type NormalizedSchema (line 155) | type NormalizedSchema<kind extends NodeKind> =
  type childKindOf (line 158) | type childKindOf<kind extends NodeKind> = Declaration<kind>["childKind"]
  type Prerequisite (line 160) | type Prerequisite<kind extends NodeKind> =
  type reducibleKindOf (line 163) | type reducibleKindOf<kind extends NodeKind> =
  type Inner (line 168) | type Inner<kind extends NodeKind> = Declaration<kind>["inner"]
  type defAttachedAs (line 170) | type defAttachedAs<kind extends ConstraintKind> =
  type innerAttachedAs (line 173) | type innerAttachedAs<kind extends ConstraintKind> =
  type mutableInnerOfKind (line 177) | type mutableInnerOfKind<kind extends NodeKind> =
  type mutableNormalizedRootOfKind (line 180) | type mutableNormalizedRootOfKind<kind extends NodeKind> =
  type errorContext (line 183) | type errorContext<kind extends NodeKind> =

FILE: ark/schema/module.ts
  type PreparsedNodeResolution (line 10) | type PreparsedNodeResolution = {
  class RootModule (line 14) | class RootModule<exports extends {} = {}> extends DynamicBase<exports> {
    method [arkKind] (line 16) | get [arkKind](): "module" {
  type InternalModule (line 21) | interface InternalModule<
  type exportSchemaScope (line 40) | type exportSchemaScope<$> = {
  type instantiateRoot (line 44) | type instantiateRoot<t> =
  type SchemaModule (line 55) | interface SchemaModule<$ = {}>

FILE: ark/schema/node.ts
  method shallowMorphs (line 104) | get shallowMorphs(): array<Morph> {
  method constructor (line 108) | constructor(attachments: UnknownAttachments, $: BaseScope) {
  method createRootApply (line 233) | protected createRootApply(): this["rootApply"] {
  method cacheGetter (line 288) | protected cacheGetter<name extends keyof this>(
  method description (line 296) | get description(): string {
  method references (line 306) | get references(): BaseNode[] {
  method traverse (line 318) | traverse(
  method in (line 326) | get in(): unknown {
  method rawIn (line 334) | get rawIn(): BaseNode {
  method out (line 339) | get out(): unknown {
  method rawOut (line 347) | get rawOut(): BaseNode {
  method getIo (line 353) | getIo(ioKind: "in" | "out"): BaseNode {
  method toJSON (line 378) | toJSON(): JsonStructure {
  method toString (line 382) | toString(): string {
  method equals (line 386) | equals(r: unknown): boolean {
  method ifEquals (line 391) | ifEquals(r: unknown): BaseNode | undefined {
  method hasKind (line 395) | hasKind<kind extends NodeKind>(kind: kind): this is nodeOfKind<kind> {
  method assertHasKind (line 399) | assertHasKind<kind extends NodeKind>(kind: kind): nodeOfKind<kind> {
  method hasKindIn (line 405) | hasKindIn<kinds extends NodeKind[]>(
  method assertHasKindIn (line 411) | assertHasKindIn<kinds extends NodeKind[]>(
  method isBasis (line 419) | isBasis(): this is nodeOfKind<BasisKind> {
  method isConstraint (line 423) | isConstraint(): this is BaseConstraint {
  method isStructural (line 427) | isStructural(): this is nodeOfKind<StructuralKind> {
  method isRefinement (line 431) | isRefinement(): this is nodeOfKind<RefinementKind> {
  method isRoot (line 435) | isRoot(): this is BaseRoot {
  method isUnknown (line 439) | isUnknown(): boolean {
  method isNever (line 443) | isNever(): boolean {
  method hasUnit (line 447) | hasUnit<value>(value: unknown): this is Unit.Node & { unit: value } {
  method hasOpenIntersection (line 451) | hasOpenIntersection(): this is nodeOfKind<OpenNodeKind> {
  method nestableExpression (line 455) | get nestableExpression(): string {
  method select (line 472) | select(selector: NodeSelector): NodeSelector.BaseResult {
  method _select (line 477) | private _select(selector: NodeSelector.Normalized): NodeSelector.BaseRes...
  method transform (line 491) | transform<mapper extends DeepNodeTransformation>(
  method _createTransformContext (line 500) | protected _createTransformContext(
  method _transform (line 516) | protected _transform(
  method configureReferences (line 612) | configureReferences(
  type KeyOrKeyNode (line 657) | type KeyOrKeyNode = Key | BaseRoot
  type GettableKeyOrNode (line 659) | type GettableKeyOrNode = KeyOrKeyNode | number
  type FlatRef (line 661) | type FlatRef<root extends BaseRoot = BaseRoot> = {
  type NodeSelector (line 667) | type NodeSelector = NodeSelector.Single | NodeSelector.Composite
  type SelectableFn (line 707) | type SelectableFn<input, returns, kind extends NodeKind = NodeKind> = {
  type Normalized (line 742) | type Normalized = requireKeys<Composite, "method" | "boundary">
  type CompositeInput (line 744) | type CompositeInput = Omit<Composite, "where">
  type BaseResult (line 746) | type BaseResult = BaseNode | BaseNode[] | undefined
  type validateComposite (line 748) | type validateComposite<selector, predicate> = {
  type infer (line 753) | type infer<selfKind extends NodeKind, selector> = applyMethod<
  type BoundaryInput (line 759) | type BoundaryInput<b extends Boundary> = b | { boundary: b }
  type KindInput (line 760) | type KindInput<k extends Kind> = k | { kind: k }
  type WhereCastInput (line 761) | type WhereCastInput<kindNode extends BaseNode, narrowed extends kindNode> =
  type inferSelectKind (line 765) | type inferSelectKind<selfKind extends NodeKind, selector> =
  type selectKind (line 772) | type selectKind<selfKind extends NodeKind, selector> =
  type applyMethod (line 778) | type applyMethod<t, selector> =
  type DeepNodeTransformOptions (line 827) | type DeepNodeTransformOptions = {
  type ShouldTransformFn (line 834) | type ShouldTransformFn = (
  type DeepNodeTransformContext (line 839) | interface DeepNodeTransformContext extends DeepNodeTransformOptions {
  type DeepNodeTransformation (line 848) | type DeepNodeTransformation = <kind extends NodeKind>(

FILE: ark/schema/parse.ts
  type ContextualArgs (line 40) | type ContextualArgs = Record<string, BaseRoot | NodeId>
  type BaseParseOptions (line 42) | type BaseParseOptions<prereduced extends boolean = boolean> = {
  type BaseParseContextInput (line 49) | interface BaseParseContextInput extends BaseParseOptions {
  type AttachedParseContext (line 54) | interface AttachedParseContext {
  type BaseParseContext (line 61) | interface BaseParseContext
  type NodeParseContextInput (line 67) | interface NodeParseContextInput<kind extends NodeKind = NodeKind>
  type NodeParseContext (line 73) | interface NodeParseContext<kind extends NodeKind = NodeKind>
  type NodeId (line 135) | type NodeId = Brand<string, "NodeId">
  type NodeResolver (line 137) | type NodeResolver = (id: NodeId) => BaseNode
  type CreateNodeInput (line 220) | type CreateNodeInput = {

FILE: ark/schema/predicate.ts
  type Schema (line 26) | type Schema<predicate extends Predicate = Predicate> =
  type NormalizedSchema (line 30) | interface NormalizedSchema<predicate extends Predicate = Predicate>
  type Inner (line 35) | interface Inner<predicate extends Predicate = Predicate> {
  type ErrorContext (line 39) | interface ErrorContext extends BaseErrorContext<"predicate"> {
  type Declaration (line 43) | interface Declaration
  type Node (line 53) | type Node = PredicateNode
  class PredicateNode (line 79) | class PredicateNode extends BaseConstraint<Predicate.Declaration> {
    method compile (line 106) | compile(js: NodeCompiler): void {
    method reduceJsonSchema (line 120) | reduceJsonSchema(
  type Predicate (line 137) | type Predicate<data = any> = (data: data, ctx: Traversal) => boolean
  type Casted (line 140) | type Casted<input = never, narrowed extends input = input> = (
  type Castable (line 145) | type Castable<input = never, narrowed extends input = input> =

FILE: ark/schema/refinements/after.ts
  type Inner (line 23) | interface Inner extends BaseRangeInner {
  type NormalizedSchema (line 27) | interface NormalizedSchema extends UnknownNormalizedRangeSchema {
  type ExpandedSchema (line 31) | interface ExpandedSchema extends UnknownExpandedRangeSchema {
  type Schema (line 35) | type Schema = ExpandedSchema | LimitSchemaValue
  type ErrorContext (line 37) | interface ErrorContext extends BaseErrorContext<"after">, Inner {}
  type Declaration (line 39) | interface Declaration
  type Node (line 49) | type Node = AfterNode
  class AfterNode (line 73) | class AfterNode extends BaseRange<After.Declaration> {
    method reduceJsonSchema (line 80) | reduceJsonSchema(base: JsonSchema, ctx: ToJsonSchema.Context): JsonSch...

FILE: ark/schema/refinements/before.ts
  type Inner (line 24) | interface Inner extends BaseRangeInner {
  type NormalizedSchema (line 28) | interface NormalizedSchema extends UnknownNormalizedRangeSchema {
  type ExpandedSchema (line 32) | interface ExpandedSchema extends UnknownExpandedRangeSchema {
  type Schema (line 36) | type Schema = ExpandedSchema | LimitSchemaValue
  type ErrorContext (line 38) | interface ErrorContext extends BaseErrorContext<"before">, Inner {}
  type Declaration (line 40) | interface Declaration
  type Node (line 50) | type Node = BeforeNode
  class BeforeNode (line 80) | class BeforeNode extends BaseRange<Before.Declaration> {
    method reduceJsonSchema (line 87) | reduceJsonSchema(base: JsonSchema, ctx: ToJsonSchema.Context): JsonSch...

FILE: ark/schema/refinements/divisor.ts
  type Inner (line 21) | interface Inner {
  type NormalizedSchema (line 25) | interface NormalizedSchema extends BaseNormalizedSchema {
  type Schema (line 29) | type Schema = NormalizedSchema | number
  type ErrorContext (line 31) | interface ErrorContext extends BaseErrorContext<"divisor">, Inner {}
  type Declaration (line 33) | interface Declaration
  type Node (line 43) | type Node = DivisorNode
  class DivisorNode (line 78) | class DivisorNode extends InternalPrimitiveConstraint<Divisor.Declaratio...
    method reduceJsonSchema (line 86) | reduceJsonSchema(schema: JsonSchema.Numeric): JsonSchema.Numeric {
  type writeIndivisibleMessage (line 105) | type writeIndivisibleMessage<actual> = writeInvalidOperandMessage<
  type writeNonIntegerDivisorMessage (line 115) | type writeNonIntegerDivisorMessage<divisor extends number> =

FILE: ark/schema/refinements/exactLength.ts
  type Inner (line 20) | interface Inner {
  type NormalizedSchema (line 24) | interface NormalizedSchema extends BaseNormalizedSchema {
  type Schema (line 28) | type Schema = NormalizedSchema | number
  type ErrorContext (line 30) | interface ErrorContext
  type Declaration (line 34) | type Declaration = declareNode<{
  type Node (line 43) | type Node = ExactLengthNode
  class ExactLengthNode (line 81) | class ExactLengthNode extends InternalPrimitiveConstraint<ExactLength.De...
    method reduceJsonSchema (line 90) | reduceJsonSchema(

FILE: ark/schema/refinements/kinds.ts
  type BoundDeclarations (line 11) | interface BoundDeclarations {
  type BoundNodesByKind (line 21) | interface BoundNodesByKind {
  type BoundKind (line 31) | type BoundKind = keyof BoundDeclarations
  type RangeKind (line 33) | type RangeKind = Exclude<BoundKind, "exactLength">
  type boundImplementationsByKind (line 35) | type boundImplementationsByKind = {

FILE: ark/schema/refinements/max.ts
  type Inner (line 19) | interface Inner extends BaseRangeInner {
  type NormalizedSchema (line 24) | interface NormalizedSchema extends UnknownExpandedRangeSchema {
  type Schema (line 28) | type Schema = NormalizedSchema | number
  type ErrorContext (line 30) | interface ErrorContext extends BaseErrorContext<"max">, Inner {}
  type Declaration (line 32) | interface Declaration
  type Node (line 42) | type Node = MaxNode
  class MaxNode (line 74) | class MaxNode extends BaseRange<Max.Declaration> {
    method reduceJsonSchema (line 80) | reduceJsonSchema(schema: JsonSchema.Numeric): JsonSchema.Numeric {

FILE: ark/schema/refinements/maxLength.ts
  type Inner (line 23) | interface Inner extends BaseRangeInner {
  type NormalizedSchema (line 27) | interface NormalizedSchema extends UnknownNormalizedRangeSchema {
  type ExpandedSchema (line 31) | interface ExpandedSchema extends UnknownExpandedRangeSchema {
  type Schema (line 35) | type Schema = ExpandedSchema | number
  type ErrorContext (line 37) | interface ErrorContext extends BaseErrorContext<"maxLength">, Inner {}
  type Declaration (line 39) | interface Declaration
  type Node (line 50) | type Node = MaxLengthNode
  class MaxLengthNode (line 81) | class MaxLengthNode extends BaseRange<MaxLength.Declaration> {
    method reduceJsonSchema (line 87) | reduceJsonSchema(

FILE: ark/schema/refinements/min.ts
  type Inner (line 18) | interface Inner extends BaseRangeInner {
  type NormalizedSchema (line 23) | interface NormalizedSchema extends UnknownExpandedRangeSchema {
  type Schema (line 27) | type Schema = NormalizedSchema | number
  type ErrorContext (line 29) | interface ErrorContext extends BaseErrorContext<"min">, Inner {}
  type Declaration (line 31) | interface Declaration
  type Node (line 41) | type Node = MinNode
  class MinNode (line 67) | class MinNode extends BaseRange<Min.Declaration> {
    method reduceJsonSchema (line 73) | reduceJsonSchema(schema: JsonSchema.Numeric): JsonSchema.Numeric {

FILE: ark/schema/refinements/minLength.ts
  type Inner (line 23) | interface Inner extends BaseRangeInner {
  type NormalizedSchema (line 27) | interface NormalizedSchema extends UnknownNormalizedRangeSchema {
  type ExpandedSchema (line 31) | interface ExpandedSchema extends UnknownExpandedRangeSchema {
  type Schema (line 35) | type Schema = ExpandedSchema | number
  type ErrorContext (line 37) | interface ErrorContext extends BaseErrorContext<"minLength">, Inner {}
  type Declaration (line 39) | interface Declaration
  type Node (line 50) | type Node = MinLengthNode
  class MinLengthNode (line 80) | class MinLengthNode extends BaseRange<MinLength.Declaration> {
    method reduceJsonSchema (line 86) | reduceJsonSchema(

FILE: ark/schema/refinements/pattern.ts
  type NormalizedSchema (line 17) | interface NormalizedSchema extends BaseNormalizedSchema {
  type Inner (line 22) | interface Inner {
  type Schema (line 27) | type Schema = NormalizedSchema | string | RegExp
  type ErrorContext (line 29) | interface ErrorContext extends BaseErrorContext<"pattern">, Inner {}
  type Declaration (line 31) | interface Declaration
  type Node (line 42) | type Node = PatternNode
  class PatternNode (line 74) | class PatternNode extends InternalPrimitiveConstraint<Pattern.Declaratio...
    method reduceJsonSchema (line 85) | reduceJsonSchema(

FILE: ark/schema/refinements/range.ts
  type BaseRangeDeclaration (line 26) | interface BaseRangeDeclaration extends BaseNodeDeclaration {
  method isStricterThan (line 63) | isStricterThan(
  method overlapsRange (line 78) | overlapsRange(r: nodeOfKind<pairedRangeKind<d["kind"]>>): boolean {
  method overlapIsUnit (line 85) | overlapIsUnit(r: nodeOfKind<pairedRangeKind<d["kind"]>>): boolean {
  type BaseRangeInner (line 92) | interface BaseRangeInner {
  type LimitValue (line 96) | type LimitValue = Date | number
  type LimitSchemaValue (line 98) | type LimitSchemaValue = Date | number | string
  type LimitInnerValue (line 100) | type LimitInnerValue<kind extends RangeKind = RangeKind> =
  type UnknownExpandedRangeSchema (line 103) | interface UnknownExpandedRangeSchema extends BaseNormalizedSchema {
  type UnknownNormalizedRangeSchema (line 108) | interface UnknownNormalizedRangeSchema extends BaseNormalizedSchema {
  type UnknownRangeSchema (line 112) | type UnknownRangeSchema = LimitSchemaValue | UnknownExpandedRangeSchema
  type ExclusiveExpandedDateRangeSchema (line 114) | interface ExclusiveExpandedDateRangeSchema extends BaseNormalizedSchema {
  type ExclusiveDateRangeSchema (line 119) | type ExclusiveDateRangeSchema =
  type InclusiveExpandedDateRangeSchema (line 123) | interface InclusiveExpandedDateRangeSchema extends BaseNormalizedSchema {
  type InclusiveDateRangeSchema (line 128) | type InclusiveDateRangeSchema =
  type ExclusiveNormalizedNumericRangeSchema (line 132) | interface ExclusiveNormalizedNumericRangeSchema
  type ExclusiveNumericRangeSchema (line 138) | type ExclusiveNumericRangeSchema =
  type InclusiveNormalizedNumericRangeSchema (line 142) | interface InclusiveNormalizedNumericRangeSchema
  type InclusiveNumericRangeSchema (line 148) | type InclusiveNumericRangeSchema =
  type LimitKind (line 152) | type LimitKind = "lower" | "upper"
  type RelativeComparator (line 154) | type RelativeComparator<kind extends LimitKind = LimitKind> = {
  type BoundKindPairsByLower (line 172) | type BoundKindPairsByLower = {
  type BoundKindPairsByUpper (line 178) | type BoundKindPairsByUpper = {
  type pairedRangeKind (line 184) | type pairedRangeKind<kind extends RangeKind> =
  type LowerBoundKind (line 188) | type LowerBoundKind = keyof typeof boundKindPairsByLower
  type LowerNode (line 190) | type LowerNode = nodeOfKind<LowerBoundKind>
  type UpperBoundKind (line 192) | type UpperBoundKind = propValueOf<typeof boundKindPairsByLower>
  type UpperNode (line 194) | type UpperNode = nodeOfKind<UpperBoundKind>
  type NumericallyBoundable (line 196) | type NumericallyBoundable = string | number | array
  type Boundable (line 198) | type Boundable = NumericallyBoundable | Date
  type LengthBoundKind (line 255) | type LengthBoundKind = "minLength" | "maxLength" | "exactLength"
  type OperandKindsByBoundKind (line 270) | type OperandKindsByBoundKind = satisfy<
  type BoundOperandKind (line 299) | type BoundOperandKind = "value" | "length" | "date"
  type LengthBoundableData (line 301) | type LengthBoundableData = string | array
  type DateRangeKind (line 303) | type DateRangeKind = "before" | "after"
  type writeUnboundableMessage (line 313) | type writeUnboundableMessage<root extends string> =

FILE: ark/schema/roots/alias.ts
  type Schema (line 26) | type Schema<alias extends string = string> =
  type NormalizedSchema (line 30) | interface NormalizedSchema<alias extends string = string>
  type Inner (line 36) | interface Inner<alias extends string = string> {
  type Declaration (line 41) | interface Declaration
  type Node (line 49) | type Node = AliasNode
  class AliasNode (line 102) | class AliasNode extends BaseRoot<Alias.Declaration> {
    method resolution (line 106) | get resolution(): BaseRoot {
    method _resolve (line 111) | protected _resolve(): BaseRoot {
    method resolutionId (line 138) | get resolutionId(): NodeId {
    method defaultShortDescription (line 152) | get defaultShortDescription(): string {
    method innerToJsonSchema (line 156) | protected innerToJsonSchema(ctx: ToJsonSchema.Context): JsonSchema {
    method compile (line 174) | compile(js: NodeCompiler): void {

FILE: ark/schema/roots/basis.ts
  method errorContext (line 18) | get errorContext(): d["errorContext"] {
  method compiledErrorContext (line 27) | get compiledErrorContext(): string {
  method compile (line 31) | compile(js: NodeCompiler): void {

FILE: ark/schema/roots/domain.ts
  type Domain (line 23) | type Domain = _Domain
  type Enumerable (line 26) | type Enumerable = "undefined" | "null" | "boolean"
  type NonEnumerable (line 28) | type NonEnumerable = Exclude<Domain, Enumerable>
  type Inner (line 30) | interface Inner<domain extends NonEnumerable = NonEnumerable> {
  type NormalizedSchema (line 35) | interface NormalizedSchema<
  type Schema (line 40) | type Schema<
  type ErrorContext (line 45) | interface ErrorContext extends BaseErrorContext<"domain">, Inner {}
  type Declaration (line 47) | interface Declaration
  type Node (line 56) | type Node = DomainNode
  class DomainNode (line 98) | class DomainNode extends InternalBasis<Domain.Declaration> {
    method nestableExpression (line 120) | get nestableExpression(): string {
    method defaultShortDescription (line 124) | get defaultShortDescription(): string {
    method innerToJsonSchema (line 128) | protected innerToJsonSchema(

FILE: ark/schema/roots/intersection.ts
  type BasisKind (line 66) | type BasisKind = "domain" | "proto"
  type ChildKind (line 68) | type ChildKind = BasisKind | RefinementKind
  type FlattenedChildKind (line 70) | type FlattenedChildKind = ChildKind | StructuralKind
  type RefinementsInner (line 72) | type RefinementsInner = {
  type Inner (line 76) | interface Inner extends RefinementsInner {
  type mutable (line 84) | type mutable = makeRootAndArrayPropertiesMutable<Inner>
  type ConstraintsSchema (line 87) | type ConstraintsSchema<inferredBasis = any> = show<
  type NormalizedSchema (line 94) | type NormalizedSchema = Omit<
  type Schema (line 99) | type Schema<inferredBasis = any> = ConstraintsSchema<inferredBasis>
  type AstSchema (line 101) | interface AstSchema extends BaseNormalizedSchema {
  type ErrorContext (line 105) | interface ErrorContext
  type Declaration (line 111) | type Declaration = declareNode<{
  type Node (line 121) | type Node = IntersectionNode
  class IntersectionNode (line 294) | class IntersectionNode extends BaseRoot<Intersection.Declaration> {
    method shallowMorphs (line 314) | get shallowMorphs(): array<Morph> {
    method defaultShortDescription (line 320) | get defaultShortDescription(): string {
    method innerToJsonSchema (line 324) | protected innerToJsonSchema(ctx: ToJsonSchema.Context): JsonSchema {
    method compile (line 371) | compile(js: NodeCompiler): void {
  type ConditionalTerminalIntersectionRoot (line 469) | type ConditionalTerminalIntersectionRoot = {
  type ConditionalTerminalIntersectionKey (line 473) | type ConditionalTerminalIntersectionKey =
  type ConditionalIntersectionKey (line 476) | type ConditionalIntersectionKey =
  type constraintKindOf (line 480) | type constraintKindOf<t> = {
  type conditionalIntersectionKeyOf (line 484) | type conditionalIntersectionKeyOf<t> =
  type intersectionChildSchemaValueOf (line 488) | type intersectionChildSchemaValueOf<k extends Intersection.FlattenedChil...
  type conditionalSchemaValueOfKey (line 491) | type conditionalSchemaValueOfKey<k extends ConditionalIntersectionKey> =
  type intersectionChildInnerValueOf (line 495) | type intersectionChildInnerValueOf<k extends Intersection.FlattenedChild...
  type conditionalRootOf (line 498) | type conditionalRootOf<t> = {

FILE: ark/schema/roots/morph.ts
  type Inner (line 32) | interface Inner {
  type Schema (line 39) | interface Schema extends BaseNormalizedSchema {
  type Declaration (line 46) | interface Declaration
  type Node (line 55) | type Node = MorphNode
  type In (line 57) | type In<morph extends Morph> = morph extends Morph<infer i> ? i : never
  type Out (line 59) | type Out<morph extends Morph> =
  type ContextFree (line 62) | type ContextFree<i = never, o = unknown> = (In: i) => o
  type Morph (line 65) | type Morph<i = never, o = unknown> = (In: i, ctx: Traversal) => o
  class MorphNode (line 151) | class MorphNode extends BaseRoot<Morph.Declaration> {
    method shallowMorphs (line 166) | get shallowMorphs(): array<Morph> {
    method rawIn (line 173) | override get rawIn(): BaseRoot {
    method rawOut (line 179) | override get rawOut(): BaseRoot {
    method declareIn (line 187) | declareIn(declaredIn: BaseRoot): MorphNode {
    method declareOut (line 194) | declareOut(declaredOut: BaseRoot): MorphNode {
    method defaultShortDescription (line 203) | get defaultShortDescription(): string {
    method innerToJsonSchema (line 207) | protected innerToJsonSchema(ctx: ToJsonSchema.Context): JsonSchema {
    method compile (line 215) | compile(js: NodeCompiler): void {
    method hasEqualMorphs (line 234) | override hasEqualMorphs(r: MorphNode): boolean {

FILE: ark/schema/roots/proto.ts
  type Reference (line 33) | type Reference = Constructor | BuiltinObjectKind
  type Schema (line 35) | type Schema<proto extends Reference = Reference> =
  type NormalizedSchema (line 39) | interface NormalizedSchema<proto extends Constructor = Constructor>
  type ExpandedSchema (line 45) | interface ExpandedSchema<proto extends Reference = Reference> {
  type Inner (line 50) | interface Inner<proto extends Constructor = Constructor> {
  type ErrorContext (line 55) | interface ErrorContext extends BaseErrorContext<"proto">, Inner {}
  type Declaration (line 57) | interface Declaration
  type Node (line 66) | type Node = ProtoNode
  class ProtoNode (line 138) | class ProtoNode extends InternalBasis<Proto.Declaration> {
    method innerToJsonSchema (line 155) | protected innerToJsonSchema(ctx: ToJsonSchema.Context): JsonSchema {
    method nestableExpression (line 178) | get nestableExpression(): string {
    method defaultShortDescription (line 184) | get defaultShortDescription(): string {

FILE: ark/schema/roots/root.ts
  type InternalRootDeclaration (line 66) | interface InternalRootDeclaration extends BaseNodeDeclaration {
  method constructor (line 80) | constructor(attachments: UnknownAttachments, $: BaseScope) {
  method rawIn (line 88) | override get rawIn(): BaseRoot {
  method rawOut (line 92) | override get rawOut(): BaseRoot {
  method internal (line 96) | get internal(): this {
  method "~standard" (line 100) | get "~standard"(): StandardSchemaV1.ArkTypeProps {
  method as (line 124) | as(): this {
  method brand (line 128) | brand(name: string): this {
  method readonly (line 133) | readonly(): this {
  method distribute (line 140) | distribute<mapOut, reduceOut = mapOut[]>(
  method shortDescription (line 154) | get shortDescription(): string {
  method toJsonSchema (line 158) | toJsonSchema(opts: ToJsonSchema.Options = {}): JsonSchema {
  method toJsonSchemaRecurse (line 187) | toJsonSchemaRecurse(ctx: ToJsonSchema.Context): JsonSchema {
  method alwaysExpandJsonSchema (line 197) | get alwaysExpandJsonSchema(): boolean {
  method toResolvedJsonSchema (line 205) | protected toResolvedJsonSchema(ctx: ToJsonSchema.Context): JsonSchema {
  method intersect (line 213) | intersect(r: unknown): BaseRoot | Disjoint {
  method rawIntersect (line 220) | rawIntersect(r: BaseRoot): BaseRoot {
  method toNeverIfDisjoint (line 224) | toNeverIfDisjoint(): BaseRoot {
  method and (line 228) | and(r: unknown): BaseRoot {
  method rawAnd (line 233) | rawAnd(r: BaseRoot): BaseRoot {
  method or (line 238) | or(r: unknown): BaseRoot {
  method rawOr (line 243) | rawOr(r: BaseRoot): BaseRoot {
  method map (line 248) | map(flatMapEntry: PropFlatMapper): BaseRoot {
  method pick (line 252) | pick(...keys: KeyOrKeyNode[]): BaseRoot {
  method omit (line 256) | omit(...keys: KeyOrKeyNode[]): BaseRoot {
  method required (line 260) | required(): BaseRoot {
  method partial (line 264) | partial(): BaseRoot {
  method keyof (line 269) | keyof(): BaseRoot {
  method props (line 284) | get props(): Prop.Node[] {
  method merge (line 290) | merge(r: unknown): BaseRoot {
  method applyStructuralOperation (line 304) | private applyStructuralOperation<operation extends StructuralOperationNa...
  method get (line 340) | get(...path: GettableKeyOrNode[]): BaseRoot {
  method extract (line 346) | extract(r: unknown): BaseRoot {
  method exclude (line 353) | exclude(r: unknown): BaseRoot {
  method array (line 360) | array(): BaseRoot {
  method overlaps (line 372) | overlaps(r: unknown): boolean {
  method extends (line 377) | extends(r: unknown): boolean {
  method ifExtends (line 386) | ifExtends(r: unknown): BaseRoot | undefined {
  method subsumes (line 390) | subsumes(r: unknown): boolean {
  method configure (line 395) | configure(
  method describe (line 402) | describe(description: string, selector: NodeSelector = "shallow"): this {
  method optional (line 408) | optional(): [this, "?"] {
  method default (line 414) | default(thunkableValue: unknown): [this, "=", unknown] {
  method from (line 420) | from(input: unknown): unknown {
  method _pipe (line 426) | protected _pipe(...morphs: Morph[]): BaseRoot {
  method tryPipe (line 434) | protected tryPipe(...morphs: Morph[]): BaseRoot {
  method to (line 461) | to(def: unknown): BaseRoot {
  method toNode (line 465) | private toNode(root: BaseRoot): BaseRoot {
  method rawPipeOnce (line 471) | rawPipeOnce(morph: Morph): BaseRoot {
  method narrow (line 489) | narrow(predicate: Predicate): BaseRoot {
  method constrain (line 493) | constrain<kind extends Constraint.PrimitiveKind>(
  method constrainIn (line 500) | constrainIn<kind extends Constraint.PrimitiveKind>(
  method constrainOut (line 507) | constrainOut<kind extends Constraint.PrimitiveKind>(
  method _constrain (line 514) | private _constrain(
  method onUndeclaredKey (line 559) | onUndeclaredKey(cfg: UndeclaredKeyBehavior | UndeclaredKeyConfig): BaseR...
  method hasEqualMorphs (line 577) | hasEqualMorphs(r: BaseRoot): boolean {
  method onDeepUndeclaredKey (line 600) | onDeepUndeclaredKey(behavior: UndeclaredKeyBehavior): BaseRoot {
  method filter (line 604) | filter(predicate: Predicate): BaseRoot {
  method divisibleBy (line 608) | divisibleBy(schema: Divisor.Schema): BaseRoot {
  method matching (line 612) | matching(schema: Pattern.Schema): BaseRoot {
  method atLeast (line 616) | atLeast(schema: InclusiveNumericRangeSchema): BaseRoot {
  method atMost (line 620) | atMost(schema: InclusiveNumericRangeSchema): BaseRoot {
  method moreThan (line 624) | moreThan(schema: ExclusiveNumericRangeSchema): BaseRoot {
  method lessThan (line 628) | lessThan(schema: ExclusiveNumericRangeSchema): BaseRoot {
  method atLeastLength (line 632) | atLeastLength(schema: InclusiveNumericRangeSchema): BaseRoot {
  method atMostLength (line 636) | atMostLength(schema: InclusiveNumericRangeSchema): BaseRoot {
  method moreThanLength (line 640) | moreThanLength(schema: ExclusiveNumericRangeSchema): BaseRoot {
  method lessThanLength (line 644) | lessThanLength(schema: ExclusiveNumericRangeSchema): BaseRoot {
  method exactlyLength (line 648) | exactlyLength(schema: ExactLength.Schema): BaseRoot {
  method atOrAfter (line 652) | atOrAfter(schema: InclusiveDateRangeSchema): BaseRoot {
  method atOrBefore (line 656) | atOrBefore(schema: InclusiveDateRangeSchema): BaseRoot {
  method laterThan (line 660) | laterThan(schema: ExclusiveDateRangeSchema): BaseRoot {
  method earlierThan (line 664) | earlierThan(schema: ExclusiveDateRangeSchema): BaseRoot {
  type UndeclaredKeyConfig (line 669) | type UndeclaredKeyConfig = {
  type emptyBrandNameMessage (line 676) | type emptyBrandNameMessage = typeof emptyBrandNameMessage
  type exclusivizeRangeSchema (line 705) | type exclusivizeRangeSchema<schema extends UnknownRangeSchema> =
  type intersectRoot (line 715) | type intersectRoot<l extends RootKind, r extends NodeKind> =
  type asymmetricIntersectionOf (line 719) | type asymmetricIntersectionOf<l extends NodeKind, r extends NodeKind> =
  type schemaKindRightOf (line 726) | type schemaKindRightOf<kind extends RootKind> = Extract<
  type schemaKindOrRightOf (line 731) | type schemaKindOrRightOf<kind extends RootKind> =
  type StructuralOperationBranchResultByName (line 753) | type StructuralOperationBranchResultByName = {
  type StructuralOperationName (line 765) | type StructuralOperationName =
  type writeNonStructuralOperandMessage (line 781) | type writeNonStructuralOperandMessage<

FILE: ark/schema/roots/union.ts
  type ChildKind (line 66) | type ChildKind = UnionChildKind
  type ChildSchema (line 68) | type ChildSchema = NodeSchema<ChildKind>
  type ChildNode (line 70) | type ChildNode = nodeOfKind<ChildKind>
  type Schema (line 72) | type Schema = NormalizedSchema | readonly RootSchema[]
  type NormalizedSchema (line 74) | interface NormalizedSchema extends BaseNormalizedSchema {
  type Inner (line 79) | interface Inner {
  type ErrorContext (line 84) | interface ErrorContext extends BaseErrorContext<"union"> {
  type Declaration (line 88) | interface Declaration
  type Node (line 99) | type Node = UnionNode
  class UnionNode (line 241) | class UnionNode extends BaseRoot<Union.Declaration> {
    method branchGroups (line 247) | get branchGroups(): BaseRoot[] {
    method createBranchedOptimisticRootApply (line 277) | createBranchedOptimisticRootApply(): BaseNode["rootApply"] {
    method shallowMorphs (line 288) | get shallowMorphs(): array<Morph> {
    method defaultShortDescription (line 295) | get defaultShortDescription(): string {
    method innerToJsonSchema (line 302) | protected innerToJsonSchema(ctx: ToJsonSchema.Context): JsonSchema {
    method compile (line 364) | compile(js: NodeCompiler): void {
    method compileIndiscriminable (line 443) | private compileIndiscriminable(js: NodeCompiler): void {
    method nestableExpression (line 482) | get nestableExpression(): string {
    method discriminate (line 488) | discriminate(): Discriminant | null {
  type CaseResolutionContext (line 638) | type CaseResolutionContext = {
  type BranchEntry (line 645) | type BranchEntry = {
  type DescribeBranchesOptions (line 841) | type DescribeBranchesOptions = {
  type CaseKey (line 1012) | type CaseKey<kind extends DiscriminantKind = DiscriminantKind> =
  type DiscriminantLocation (line 1015) | type DiscriminantLocation<kind extends DiscriminantKind = DiscriminantKi...
  type Discriminant (line 1021) | interface Discriminant<kind extends DiscriminantKind = DiscriminantKind>
  type DiscriminantCandidate (line 1026) | type DiscriminantCandidate<kind extends DiscriminantKind = DiscriminantK...
  type CandidateCases (line 1032) | type CandidateCases<kind extends DiscriminantKind = DiscriminantKind> = {
  type CaseContext (line 1036) | type CaseContext = {
  type CaseDiscriminant (line 1041) | type CaseDiscriminant = nodeOfKind<DiscriminantKind> | Domain.Enumerable
  type DiscriminatedCases (line 1043) | type DiscriminatedCases<
  type DiscriminantKinds (line 1049) | type DiscriminantKinds = {
  type DiscriminantKind (line 1054) | type DiscriminantKind = show<keyof DiscriminantKinds>

FILE: ark/schema/roots/unit.ts
  type Schema (line 28) | interface Schema<value = unknown> extends BaseNormalizedSchema {
  type Inner (line 32) | interface Inner<value = unknown> {
  type ErrorContext (line 36) | interface ErrorContext<value = unknown>
  type Declaration (line 40) | interface Declaration
  type Node (line 49) | type Node = UnitNode
  class UnitNode (line 111) | class UnitNode extends InternalBasis<Unit.Declaration> {
    method defaultShortDescription (line 130) | get defaultShortDescription(): string {
    method innerToJsonSchema (line 136) | protected innerToJsonSchema(ctx: ToJsonSchema.Context): JsonSchema {

FILE: ark/schema/scope.ts
  type InternalResolutions (line 77) | type InternalResolutions = Record<string, InternalResolution | undefined>
  type exportedNameOf (line 79) | type exportedNameOf<$> = Exclude<keyof $ & string, PrivateDeclaration>
  type resolvableReferenceIn (line 81) | type resolvableReferenceIn<$> = {
  type resolveReference (line 91) | type resolveReference<reference extends resolvableReferenceIn<$>, $> =
  type flatResolutionsOf (line 94) | type flatResolutionsOf<$> = show<
  type resolutionsOfReference (line 104) | type resolutionsOfReference<k extends string, v> =
  type prefixKeys (line 114) | type prefixKeys<o, prefix extends string> = {
  type PrivateDeclaration (line 118) | type PrivateDeclaration<key extends string = string> = `#${key}`
  type InternalResolution (line 120) | type InternalResolution = BaseRoot | GenericRoot | InternalModule
  type toInternalScope (line 122) | type toInternalScope<$> = BaseScope<{
  type CachedResolution (line 131) | type CachedResolution = NodeId | BaseRoot | GenericRoot
  type writeDuplicateAliasError (line 148) | type writeDuplicateAliasError<alias extends string> =
  type AliasDefEntry (line 151) | type AliasDefEntry = [name: string, defValue: unknown]
  type GlobalOnlyConfigOptionName (line 155) | type GlobalOnlyConfigOptionName = satisfy<
  type ScopeOnlyConfigOptions (line 160) | interface ScopeOnlyConfigOptions {
  type ArkSchemaScopeConfig (line 165) | interface ArkSchemaScopeConfig
  type ResolvedScopeConfig (line 169) | interface ResolvedScopeConfig
  type PrecompiledReferences (line 212) | type PrecompiledReferences = {
  method [arkKind] (line 249) | get [arkKind](): "scope" {
  method constructor (line 265) | constructor(
  method cacheGetter (line 347) | protected cacheGetter<name extends keyof this>(
  method internal (line 355) | get internal(): this {
  method json (line 362) | get json(): JsonStructure {
  method defineSchema (line 367) | defineSchema<def extends RootSchema>(def: def): def {
  method lazilyResolve (line 396) | lazilyResolve(resolve: () => BaseRoot, syntheticAlias?: string): Alias.N...
  method preparseNode (line 415) | protected preparseNode(
  method bindReference (line 465) | bindReference<reference extends BaseNode | GenericRoot>(
  method resolveRoot (line 497) | resolveRoot(name: string): BaseRoot {
  method maybeResolveRoot (line 504) | maybeResolveRoot(name: string): BaseRoot | undefined {
  method maybeResolveSubalias (line 511) | protected maybeResolveSubalias(
  method ambient (line 520) | get ambient(): InternalModule {
  method maybeResolve (line 524) | maybeResolve(name: string): Exclude<CachedResolution, string> | undefined {
  method createParseContext (line 574) | protected createParseContext<input extends BaseParseContextInput>(
  method traversal (line 586) | traversal(root: unknown): Traversal {
  method import (line 600) | import(...names: string[]): SchemaModule {
  method export (line 621) | export(...names: string[]): SchemaModule {
  method resolve (line 658) | resolve<name extends exportedNameOf<$>>(
  method parseDefinition (line 691) | parseDefinition(def: unknown, opts: BaseParseOptions = {}): BaseRoot {
  method finalize (line 711) | finalize<node extends BaseRoot>(node: node): node {
  class SchemaScope (line 733) | class SchemaScope<$ extends {} = {}> extends BaseScope<$> {
    method parseOwnDefinitionFormat (line 734) | parseOwnDefinitionFormat(def: unknown, ctx: NodeParseContext): BaseRoot {
    method preparseOwnDefinitionFormat (line 738) | protected preparseOwnDefinitionFormat(
    method preparseOwnAliasEntry (line 745) | protected preparseOwnAliasEntry(k: string, v: unknown): AliasDefEntry {
    method normalizeRootScopeValue (line 749) | protected normalizeRootScopeValue(v: unknown): unknown {
  type instantiateAliases (line 810) | type instantiateAliases<aliases> = {
  type SchemaScopeParser (line 815) | type SchemaScopeParser = <const aliases>(
  type InternalSchemaParser (line 828) | type InternalSchemaParser = (
  type RootExportCache (line 847) | type RootExportCache = Record<
  type writeUnresolvableMessage (line 873) | type writeUnresolvableMessage<token extends string> =
  type writeNonSubmoduleDotMessage (line 881) | type writeNonSubmoduleDotMessage<name extends string> =
  type writeMissingSubmoduleAccessMessage (line 889) | type writeMissingSubmoduleAccessMessage<name extends string> =

FILE: ark/schema/shared/compile.ts
  type CoercibleValue (line 14) | type CoercibleValue = string | number | boolean | null | undefined
  class CompiledFunction (line 16) | class CompiledFunction<
    method constructor (line 25) | constructor(...args: args) {
    method indent (line 39) | indent(): this {
    method dedent (line 44) | dedent(): this {
    method prop (line 49) | prop(key: PropertyKey, optional = false): string {
    method index (line 53) | index(key: string | number, optional = false): string {
    method line (line 57) | line(statement: string): this {
    method const (line 62) | const(identifier: string, expression: CoercibleValue): this {
    method let (line 67) | let(identifier: string, expression: CoercibleValue): this {
    method set (line 71) | set(identifier: string, expression: CoercibleValue): this {
    method if (line 75) | if(condition: string, then: (self: this) => this): this {
    method elseIf (line 79) | elseIf(condition: string, then: (self: this) => this): this {
    method else (line 83) | else(then: (self: this) => this): this {
    method for (line 88) | for(
    method forIn (line 97) | forIn(object: string, body: (self: this) => this): this {
    method block (line 101) | block(prefix: string, contents: (self: this) => this, suffix = ""): th...
    method return (line 109) | return(expression: CoercibleValue = ""): this {
    method write (line 113) | write(name = "anonymous", indent: number = 0): string {
    method compile (line 124) | compile(): compiledSignature {
  type InvokeOptions (line 150) | interface InvokeOptions extends ReferenceOptions {
  type ReferenceOptions (line 154) | interface ReferenceOptions {
  type Context (line 160) | interface Context {
  class NodeCompiler (line 166) | class NodeCompiler extends CompiledFunction<Fn, ["data", "ctx"]> {
    method constructor (line 170) | constructor(ctx: NodeCompiler.Context) {
    method invoke (line 176) | invoke(node: BaseNode | NodeId, opts?: InvokeOptions): string {
    method referenceToId (line 187) | referenceToId(id: NodeId, opts?: ReferenceOptions): string {
    method requiresContextFor (line 193) | requiresContextFor(node: BaseNode): boolean {
    method initializeErrorCount (line 197) | initializeErrorCount(): this {
    method returnIfFail (line 201) | returnIfFail(): this {
    method returnIfFailFast (line 205) | returnIfFailFast(): this {
    method traverseKey (line 211) | traverseKey(
    method check (line 227) | check(node: BaseNode, opts?: InvokeOptions): this {

FILE: ark/schema/shared/declare.ts
  type withMetaPrefixedKeys (line 9) | type withMetaPrefixedKeys<o> = {
  type DefaultArkEnv (line 13) | interface DefaultArkEnv {
  type NodeMeta (line 18) | interface NodeMeta extends JsonSchema.UniversalMeta, UnknownErrorConfigs {
  type ArkEnv (line 24) | interface ArkEnv extends DefaultArkEnv {}
  type meta (line 27) | type meta = show<NodeMeta & ReturnType<ArkEnv["meta"]>>
  type onFail (line 29) | type onFail = ReturnType<ArkEnv["onFail"]>
  type TypeMeta (line 33) | type TypeMeta = Omit<ArkEnv.meta, "onFail">
  type Collapsible (line 36) | type Collapsible<meta extends TypeMeta = TypeMeta> = meta | string
  type Mapper (line 38) | type Mapper<meta extends TypeMeta = TypeMeta> = (
  type MappableInput (line 42) | type MappableInput<meta extends TypeMeta = TypeMeta> =
  type Internal (line 47) | type Internal = MappableInput<ArkEnv.meta>
  type BaseNormalizedSchema (line 51) | interface BaseNormalizedSchema extends withMetaPrefixedKeys<TypeMeta> {
  type DeclarationInput (line 55) | interface DeclarationInput {
  type BaseErrorContext (line 67) | interface BaseErrorContext<kind extends NodeKind = NodeKind> {
  type defaultErrorContext (line 73) | type defaultErrorContext<d extends DeclarationInput> = show<
  type declareNode (line 77) | type declareNode<
  type prerequisiteOf (line 93) | type prerequisiteOf<d extends DeclarationInput> =
  type attachmentsOf (line 96) | type attachmentsOf<d extends BaseNodeDeclaration> =
  type attachedInner (line 101) | type attachedInner<d extends BaseNodeDeclaration> =
  type BaseNodeDeclaration (line 104) | interface BaseNodeDeclaration {
  type ownIntersectionResult (line 116) | type ownIntersectionResult<d extends BaseNodeDeclaration> =

FILE: ark/schema/shared/disjoint.ts
  type DisjointEntry (line 11) | interface DisjointEntry<kind extends DisjointKind = DisjointKind> {
  type OperandsByDisjointKind (line 19) | type OperandsByDisjointKind = {
  type DisjointEntryContext (line 29) | type DisjointEntryContext = {
  class Disjoint (line 34) | class Disjoint extends Array<DisjointEntry> {
    method init (line 35) | static init<kind extends DisjointKind>(
    method add (line 50) | add<kind extends DisjointKind>(
    method summary (line 66) | get summary(): string {
    method describeReasons (line 70) | describeReasons(): string {
    method throw (line 85) | throw(): never {
    method invert (line 89) | invert(): Disjoint {
    method withPrefixKey (line 103) | withPrefixKey(key: PropertyKey, kind: Prop.Kind): Disjoint {
    method toNeverIfDisjoint (line 111) | toNeverIfDisjoint(): BaseRoot {
  type DisjointKind (line 116) | type DisjointKind = keyof OperandsByDisjointKind
  type writeUnsatisfiableExpressionError (line 131) | type writeUnsatisfiableExpressionError<expression extends string> =

FILE: ark/schema/shared/errors.ts
  type ArkErrorResult (line 24) | type ArkErrorResult = ArkError | ArkErrors
  class ArkError (line 26) | class ArkError<
    method constructor (line 38) | constructor(
    method transform (line 74) | transform(
    method hasCode (line 87) | hasCode<code extends ArkErrorCode>(code: code): this is ArkError<code> {
    method propString (line 91) | get propString(): string {
    method expected (line 95) | get expected(): string {
    method actual (line 103) | get actual(): string {
    method problem (line 111) | get problem(): string {
    method message (line 119) | get message(): string {
    method flat (line 127) | get flat(): ArkError[] {
    method toJSON (line 131) | toJSON(): JsonObject {
    method toString (line 143) | toString(): string {
    method throw (line 147) | throw(): never {
  type Handler (line 153) | type Handler<returns = unknown> = (errors: ArkErrors) => returns
  class ArkErrors (line 162) | class ArkErrors
    method constructor (line 170) | constructor(ctx: Traversal) {
    method flatByPath (line 186) | get flatByPath(): Record<string, ArkError[]> {
    method flatProblemsByPath (line 193) | get flatProblemsByPath(): Record<string, string[]> {
    method throw (line 209) | throw(): never {
    method toTraversalError (line 217) | toTraversalError(): TraversalError {
    method add (line 224) | add(error: ArkError): void {
    method transform (line 266) | transform(f: (e: ArkError) => ArkError): ArkErrors {
    method merge (line 276) | merge(errors: ArkErrors): void {
    method affectsPath (line 290) | affectsPath(path: ReadonlyPath): boolean {
    method summary (line 306) | get summary(): string {
    method issues (line 313) | get issues(): this {
    method toJSON (line 317) | toJSON(): JsonArray {
    method toString (line 321) | toString(): string {
    method addAncestorPaths (line 325) | private addAncestorPaths(error: ArkError): void {
  class TraversalError (line 335) | class TraversalError extends Error {
    method constructor (line 339) | constructor(errors: ArkErrors) {
  type DerivableErrorContext (line 353) | interface DerivableErrorContext<
  type DerivableErrorContextInput (line 365) | type DerivableErrorContextInput<
  type ArkErrorCode (line 373) | type ArkErrorCode = {
  type ArkErrorContextInputsByCode (line 377) | type ArkErrorContextInputsByCode = {
  type ArkErrorContextInput (line 381) | type ArkErrorContextInput<code extends ArkErrorCode = ArkErrorCode> =
  type NodeErrorContextInput (line 384) | type NodeErrorContextInput<code extends ArkErrorCode = ArkErrorCode> =
  type MessageContext (line 387) | type MessageContext<code extends ArkErrorCode = ArkErrorCode> = Omit<
  type ProblemContext (line 392) | type ProblemContext<code extends ArkErrorCode = ArkErrorCode> = Omit<
  type CustomErrorInput (line 397) | type CustomErrorInput = show<
  type ArkErrorInput (line 402) | type ArkErrorInput = string | ArkErrorContextInput | CustomErrorInput
  type ProblemConfig (line 404) | type ProblemConfig<code extends ArkErrorCode = ArkErrorCode> =
  type ProblemWriter (line 408) | type ProblemWriter<code extends ArkErrorCode = ArkErrorCode> = (
  type MessageConfig (line 412) | type MessageConfig<code extends ArkErrorCode = ArkErrorCode> =
  type MessageWriter (line 416) | type MessageWriter<code extends ArkErrorCode = ArkErrorCode> = (
  type getAssociatedDataForError (line 420) | type getAssociatedDataForError<code extends ArkErrorCode> =
  type ExpectedConfig (line 423) | type ExpectedConfig<code extends ArkErrorCode = ArkErrorCode> =
  type ExpectedWriter (line 427) | type ExpectedWriter<code extends ArkErrorCode = ArkErrorCode> = (
  type ActualConfig (line 431) | type ActualConfig<code extends ArkErrorCode = ArkErrorCode> =
  type ActualWriter (line 435) | type ActualWriter<code extends ArkErrorCode = ArkErrorCode> = (

FILE: ark/schema/shared/implement.ts
  type BasisKind (line 38) | type BasisKind = (typeof basisKinds)[number]
  type StructuralKind (line 47) | type StructuralKind = (typeof structuralKinds)[number]
  type PrestructuralKind (line 61) | type PrestructuralKind = (typeof prestructuralKinds)[number]
  type RefinementKind (line 69) | type RefinementKind = (typeof refinementKinds)[number]
  type ConstraintKind (line 73) | type ConstraintKind = (typeof constraintKinds)[number]
  type RootKind (line 85) | type RootKind = (typeof rootKinds)[number]
  type NodeKind (line 87) | type NodeKind = RootKind | ConstraintKind
  type orderedNodeKinds (line 89) | type orderedNodeKinds = [...typeof rootKinds, ...typeof constraintKinds]
  type OpenNodeKind (line 93) | type OpenNodeKind = {
  type ClosedNodeKind (line 97) | type ClosedNodeKind = Exclude<NodeKind, OpenNodeKind>
  type PrimitiveKind (line 99) | type PrimitiveKind = Exclude<RefinementKind | BasisKind, "structure">
  type CompositeKind (line 101) | type CompositeKind = Exclude<NodeKind, PrimitiveKind>
  type OrderedNodeKinds (line 103) | type OrderedNodeKinds = typeof nodeKinds
  type RightsByKind (line 115) | type RightsByKind = accumulateRightKinds<OrderedNodeKinds, {}>
  type kindOrRightOf (line 117) | type kindOrRightOf<kind extends NodeKind> = kind | kindRightOf<kind>
  type kindLeftOf (line 119) | type kindLeftOf<kind extends NodeKind> = Exclude<
  type kindOrLeftOf (line 124) | type kindOrLeftOf<kind extends NodeKind> = kind | kindLeftOf<kind>
  type accumulateRightKinds (line 126) | type accumulateRightKinds<remaining extends readonly NodeKind[], result> =
  type InternalIntersectionOptions (line 133) | interface InternalIntersectionOptions {
  type IntersectionContext (line 137) | interface IntersectionContext extends InternalIntersectionOptions {
  type ConstraintIntersection (line 142) | type ConstraintIntersection<
  type ConstraintIntersectionMap (line 151) | type ConstraintIntersectionMap<kind extends ConstraintKind> = show<
  type RootIntersection (line 159) | type RootIntersection<
  type TypeIntersectionMap (line 168) | type TypeIntersectionMap<kind extends RootKind> = {
  type IntersectionMap (line 172) | type IntersectionMap<kind extends NodeKind> =
  type UnknownIntersectionMap (line 176) | type UnknownIntersectionMap = {
  type UnknownIntersectionResult (line 184) | type UnknownIntersectionResult = BaseNode | Disjoint | null
  type PrecedenceByKind (line 186) | type PrecedenceByKind = {
  function assertNodeKind (line 198) | function assertNodeKind<kind extends NodeKind>(
  type precedenceOfKind (line 212) | type precedenceOfKind<kind extends NodeKind> = PrecedenceByKind[kind]
  type kindRightOf (line 218) | type kindRightOf<kind extends NodeKind> = RightsByKind[kind]
  type UnionChildKind (line 230) | type UnionChildKind = (typeof unionChildKinds)[number]
  type MorphChildKind (line 237) | type MorphChildKind = (typeof morphChildKinds)[number]
  type keySchemaDefinitions (line 239) | type keySchemaDefinitions<d extends BaseNodeDeclaration> = {
  type keyRequiringSchemaDefinition (line 243) | type keyRequiringSchemaDefinition<d extends BaseNodeDeclaration> = Exclude<
  type NodeKeyImplementation (line 261) | type NodeKeyImplementation<
  type CommonNodeImplementationInput (line 289) | interface CommonNodeImplementationInput<d extends BaseNodeDeclaration> {
  type UnknownNodeImplementation (line 310) | interface UnknownNodeImplementation
  type nodeImplementationOf (line 325) | type nodeImplementationOf<d extends BaseNodeDeclaration> =
  type nodeImplementationInputOf (line 332) | type nodeImplementationInputOf<d extends BaseNodeDeclaration> =
  type nodeSchemaaultsImplementationInputFor (line 342) | type nodeSchemaaultsImplementationInputFor<kind extends NodeKind> = requ...
  type DescriptionWriter (line 355) | type DescriptionWriter<kind extends NodeKind = NodeKind> = (
  type UnknownAttachments (line 359) | interface UnknownAttachments {
  type NarrowedAttachments (line 378) | interface NarrowedAttachments<d extends BaseNodeDeclaration>

FILE: ark/schema/shared/intersections.ts
  type InternalNodeIntersection (line 19) | type InternalNodeIntersection<ctx> = <l extends BaseNode, r extends Base...

FILE: ark/schema/shared/jsonSchema.ts
  type JsonSchema (line 9) | type JsonSchema = JsonSchema.NonBooleanBranch
  type ListableJsonSchema (line 10) | type ListableJsonSchema = listable<JsonSchema>
  type JsonSchemaOrBoolean (line 11) | type JsonSchemaOrBoolean = listable<JsonSchema.Branch>
  type TypeName (line 14) | type TypeName =
  type Meta (line 27) | interface Meta<t = unknown> extends UniversalMeta<t> {
  type Format (line 32) | type Format = autocomplete<
  type UniversalMeta (line 47) | interface UniversalMeta<t = unknown> {
  type Composition (line 56) | type Composition = Union | OneOf | Intersection | Not
  type NonBooleanBranch (line 58) | type NonBooleanBranch =
  type Branch (line 69) | type Branch = boolean | JsonSchema
  type RefString (line 71) | type RefString = `#/$defs/${string}`
  type Ref (line 76) | interface Ref extends Meta {
  type Constrainable (line 81) | interface Constrainable extends Meta {
  type Intersection (line 85) | interface Intersection extends Meta {
  type Not (line 89) | interface Not extends Meta {
  type OneOf (line 93) | interface OneOf extends Meta {
  type Union (line 97) | interface Union extends Meta {
  type Const (line 101) | interface Const extends Meta {
  type Enum (line 105) | interface Enum extends Meta {
  type String (line 109) | interface String extends Meta<string> {
  type Numeric (line 119) | interface Numeric extends Meta<number> {
  type Object (line 131) | interface Object extends Meta<JsonObject> {
  type Array (line 142) | interface Array extends Meta<JsonArray> {
  type LengthBoundable (line 153) | type LengthBoundable = String | Array
  type Structure (line 155) | type Structure = Object | Array

FILE: ark/schema/shared/registry.ts
  type RegisteredReference (line 21) | type RegisteredReference<to extends string = string> =

FILE: ark/schema/shared/standardSchema.ts
  type StandardTypedV1 (line 4) | interface StandardTypedV1<Input = unknown, Output = Input> {
  type Props (line 11) | interface Props<Input = unknown, Output = Input> {
  type Types (line 21) | interface Types<Input = unknown, Output = Input> {
  type InferInput (line 29) | type InferInput<Schema extends StandardTypedV1> = NonNullable<
  type InferOutput (line 34) | type InferOutput<Schema extends StandardTypedV1> = NonNullable<
  type StandardSchemaV1 (line 40) | interface StandardSchemaV1<Input = unknown, Output = Input> {
  type Props (line 47) | interface Props<Input = unknown, Output = Input>
  type Result (line 57) | type Result<Output> = SuccessResult<Output> | FailureResult
  type SuccessResult (line 60) | interface SuccessResult<Output> {
  type Options (line 67) | interface Options {
  type FailureResult (line 73) | interface FailureResult {
  type Issue (line 79) | interface Issue {
  type PathSegment (line 87) | interface PathSegment {
  type Types (line 93) | interface Types<Input = unknown, Output = Input>
  type InferInput (line 97) | type InferInput<Schema extends StandardTypedV1> =
  type InferOutput (line 101) | type InferOutput<Schema extends StandardTypedV1> =
  type ArkTypeProps (line 105) | interface ArkTypeProps<Input = unknown, Output = Input>
  type StandardJSONSchemaV1 (line 113) | interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
  type Props (line 120) | interface Props<Input = unknown, Output = Input>
  type Converter (line 127) | interface Converter {
  type Target (line 145) | type Target =
  type Options (line 153) | interface Options {
  type Types (line 162) | interface Types<Input = unknown, Output = Input>
  type InferInput (line 166) | type InferInput<Schema extends StandardTypedV1> =
  type InferOutput (line 170) | type InferOutput<Schema extends StandardTypedV1> =

FILE: ark/schema/shared/toJsonSchema.ts
  class ToJsonSchemaError (line 15) | class ToJsonSchemaError<
    method constructor (line 22) | constructor(code: code, context: ToJsonSchema.ContextByCode[code]) {
    method hasCode (line 28) | hasCode<code extends ToJsonSchema.Code>(
  type Unjsonifiable (line 70) | type Unjsonifiable = object | symbol | bigint | undefined
  type Error (line 72) | type Error = InstanceType<typeof ToJsonSchema.Error>
  type BaseContext (line 74) | interface BaseContext<
  type ArrayObjectContext (line 82) | interface ArrayObjectContext
  type ArrayPostfixContext (line 87) | interface ArrayPostfixContext
  type DefaultValueContext (line 92) | interface DefaultValueContext
  type DomainContext (line 97) | interface DomainContext extends BaseContext<"domain", JsonSchema> {
  type MorphContext (line 101) | interface MorphContext extends BaseContext<"morph", JsonSchema> {
  type PatternIntersectionContext (line 105) | interface PatternIntersectionContext
  type PredicateContext (line 110) | interface PredicateContext
  type ProtoContext (line 115) | interface ProtoContext extends BaseContext<"proto", JsonSchema> {
  type SymbolKeyContext (line 119) | type SymbolKeyContext =
  type IndexSymbolKeyContext (line 124) | interface IndexSymbolKeyContext
  type RequiredSymbolKeyContext (line 131) | interface RequiredSymbolKeyContext
  type OptionalSymbolKeyContext (line 138) | interface OptionalSymbolKeyContext
  type UnitContext (line 146) | interface UnitContext extends BaseContext<"unit", JsonSchema> {
  type DateContext (line 150) | interface DateContext extends BaseContext<"date", JsonSchema> {
  type ContextByCode (line 155) | interface ContextByCode {
  type Code (line 169) | type Code = keyof ContextByCode
  type FallbackContext (line 171) | type FallbackContext = ContextByCode[Code]
  type HandlerByCode (line 173) | type HandlerByCode = satisfy<
  type VariadicArraySchema (line 192) | type VariadicArraySchema = requireKeys<JsonSchema.Array, "items">
  type StringSchemaWithPattern (line 194) | type StringSchemaWithPattern = requireKeys<
  type UniversalFallback (line 199) | type UniversalFallback = (ctx: FallbackContext) => JsonSchema
  type FallbackObject (line 201) | interface FallbackObject extends Partial<HandlerByCode> {
  type FallbackOption (line 205) | type FallbackOption = UniversalFallback | FallbackObject
  type Target (line 207) | type Target = satisfy<
  type Options (line 212) | interface Options {
  type Context (line 236) | interface Context extends Required<Options> {

FILE: ark/schema/shared/traversal.ts
  type MorphsAtPath (line 14) | type MorphsAtPath = {
  type BranchTraversal (line 19) | type BranchTraversal = {
  type InternalTraversal (line 25) | type InternalTraversal = Omit<Traversal, "error" | "mustBe" | "reject">
  class Traversal (line 27) | class Traversal {
    method constructor (line 62) | constructor(root: unknown, config: ResolvedConfig) {
    method data (line 72) | get data(): unknown {
    method propString (line 84) | get propString(): string {
    method reject (line 93) | reject(input: ArkErrorInput): false {
    method mustBe (line 104) | mustBe(expected: string): false {
    method error (line 119) | error(input: ArkErrorInput): ArkError {
    method hasError (line 132) | hasError(): boolean {
    method currentBranch (line 136) | get currentBranch(): BranchTraversal | undefined {
    method queueMorphs (line 140) | queueMorphs(morphs: array<Morph>): void {
    method finalize (line 149) | finalize(onFail?: ArkErrors.Handler | null): unknown {
    method currentErrorCount (line 166) | get currentErrorCount(): number {
    method failFast (line 176) | get failFast(): boolean {
    method pushBranch (line 180) | pushBranch(): void {
    method popBranch (line 187) | popBranch(): BranchTraversal | undefined {
    method external (line 197) | get external(): this {
    method errorFromNodeContext (line 207) | errorFromNodeContext(input: NodeErrorContextInput): ArkError {
    method errorFromContext (line 211) | private errorFromContext(errCtx: ArkErrorContextInput): ArkError {
    method applyQueuedMorphs (line 219) | private applyQueuedMorphs() {
    method applyMorphsAtPath (line 235) | private applyMorphsAtPath(path: ReadonlyPath, morphs: array<Morph>): v...
  type TraversalMethodsByKind (line 303) | type TraversalMethodsByKind<input = unknown> = {
  type TraversalKind (line 309) | type TraversalKind = keyof TraversalMethodsByKind & {}
  type TraverseAllows (line 311) | type TraverseAllows<data = unknown> = (
  type TraverseApply (line 316) | type TraverseApply<data = unknown> = (

FILE: ark/schema/shared/utils.ts
  type makeRootAndArrayPropertiesMutable (line 26) | type makeRootAndArrayPropertiesMutable<inner> = {
  type internalImplementationOf (line 32) | type internalImplementationOf<
  type arkKind (line 44) | type arkKind = typeof arkKind
  type ArkKinds (line 48) | interface ArkKinds {
  type ArkKind (line 59) | type ArkKind = show<keyof ArkKinds>
  type unwrapDefault (line 69) | type unwrapDefault<thunkableValue> =

FILE: ark/schema/structure/index.ts
  type KeyKind (line 32) | type KeyKind = Exclude<RootKind, "unit">
  type KeyNode (line 34) | type KeyNode = nodeOfKind<KeyKind>
  type Schema (line 36) | interface Schema extends BaseNormalizedSchema {
  type Inner (line 41) | interface Inner {
  type Declaration (line 46) | interface Declaration
  type Node (line 57) | type Node = IndexNode
  class IndexNode (line 120) | class IndexNode extends BaseConstraint<Index.Declaration> {
    method _transform (line 155) | protected override _transform(
    method compile (line 165) | compile(): void {
  type writeInvalidPropertyKeyMessage (line 183) | type writeInvalidPropertyKeyMessage<indexSchema extends string> =

FILE: ark/schema/structure/optional.ts
  type Schema (line 25) | interface Schema extends Prop.Schema {
  type Inner (line 29) | interface Inner extends Prop.Inner {
  type Declaration (line 33) | type Declaration = declareNode<
  type Node (line 41) | type Node = OptionalNode
  type withDefault (line 44) | type withDefault = requireKeys<
  class OptionalNode (line 86) | class OptionalNode extends BaseProp<"optional"> {
    method constructor (line 87) | constructor(...args: ConstructorParameters<typeof BaseProp>) {
    method rawIn (line 93) | override get rawIn(): OptionalNode {
    method outProp (line 106) | get outProp(): Prop.Node {
  type writeUnassignableDefaultValueMessage (line 214) | type writeUnassignableDefaultValueMessage<

FILE: ark/schema/structure/prop.ts
  type Kind (line 27) | type Kind = "required" | "optional"
  type Node (line 29) | type Node = nodeOfKind<Kind>
  type Schema (line 31) | interface Schema extends BaseNormalizedSchema {
  type Inner (line 36) | interface Inner {
  type Declaration (line 41) | interface Declaration<kind extends Kind = Kind> {
  method _transform (line 112) | protected override _transform(
  method hasDefault (line 122) | hasDefault(): this is Optional.Node.withDefault {
  method compile (line 149) | compile(js: NodeCompiler): void {

FILE: ark/schema/structure/required.ts
  type ErrorContext (line 11) | interface ErrorContext extends BaseErrorContext<"required"> {
  type Schema (line 15) | interface Schema extends Prop.Schema {}
  type Inner (line 17) | interface Inner extends Prop.Inner {}
  type Declaration (line 19) | type Declaration = declareNode<
  type Node (line 28) | type Node = RequiredNode
  class RequiredNode (line 55) | class RequiredNode extends BaseProp<"required"> {

FILE: ark/schema/structure/sequence.ts
  type NormalizedSchema (line 52) | interface NormalizedSchema extends BaseNormalizedSchema {
  type Schema (line 61) | type Schema = NormalizedSchema | RootSchema
  type DefaultableSchema (line 63) | type DefaultableSchema = [schema: RootSchema, defaultValue: unknown]
  type DefaultableElement (line 65) | type DefaultableElement = [node: BaseRoot, defaultValue: unknown]
  type Inner (line 67) | interface Inner {
  type Declaration (line 81) | interface Declaration
  type Node (line 92) | type Node = SequenceNode
  class SequenceNode (line 305) | class SequenceNode extends BaseConstraint<Sequence.Declaration> {
    method addFlatRefs (line 335) | protected addFlatRefs(): FlatRef[] {
    method elementAtIndex (line 396) | protected elementAtIndex(data: array, index: number): SequenceElement {
    method element (line 432) | get element(): BaseRoot {
    method compile (line 437) | compile(js: NodeCompiler): void {
    method _transform (line 474) | protected override _transform(
    method reduceJsonSchema (line 487) | reduceJsonSchema(
  type postfixAfterOptionalOrDefaultableMessage (line 614) | type postfixAfterOptionalOrDefaultableMessage =
  type postfixWithoutVariadicMessage (line 620) | type postfixWithoutVariadicMessage = typeof postfixWithoutVariadicMessage
  type SequenceElement (line 622) | type SequenceElement =
  type SequenceElementKind (line 627) | type SequenceElementKind = satisfy<
  type PrevariadicSequenceElement (line 632) | type PrevariadicSequenceElement =
  type PrefixSequenceElement (line 637) | type PrefixSequenceElement = {
  type OptionalSequenceElement (line 642) | type OptionalSequenceElement = {
  type PostfixSequenceElement (line 647) | type PostfixSequenceElement = {
  type VariadicSequenceElement (line 652) | type VariadicSequenceElement = {
  type DefaultableSequenceElement (line 657) | type DefaultableSequenceElement = {
  type SequenceTuple (line 663) | type SequenceTuple = array<SequenceElement>
  type SequenceIntersectionState (line 665) | type SequenceIntersectionState = {

FILE: ark/schema/structure/structure.ts
  type UndeclaredKeyBehavior (line 70) | type UndeclaredKeyBehavior = "ignore" | UndeclaredKeyHandling
  type UndeclaredKeyHandling (line 72) | type UndeclaredKeyHandling = "reject" | "delete"
  type Schema (line 75) | interface Schema extends BaseNormalizedSchema {
  type Inner (line 83) | interface Inner {
  type mutable (line 92) | type mutable = makeRootAndArrayPropertiesMutable<Inner>
  type Declaration (line 95) | interface Declaration
  type Node (line 105) | type Node = StructureNode
  class StructureNode (line 400) | class StructureNode extends BaseConstraint<Structure.Declaration> {
    method keyof (line 429) | keyof(): BaseRoot {
    method map (line 439) | map(flatMapProp: PropFlatMapper): StructureNode {
    method assertHasKeys (line 480) | assertHasKeys(keys: array<KeyOrKeyNode>): void {
    method get (line 490) | get(indexer: GettableKeyOrNode, ...path: array<GettableKeyOrNode>): Ba...
    method pick (line 556) | pick(...keys: KeyOrKeyNode[]): StructureNode {
    method omit (line 561) | omit(...keys: KeyOrKeyNode[]): StructureNode {
    method optionalize (line 566) | optionalize(): StructureNode {
    method require (line 576) | require(): StructureNode {
    method merge (line 591) | merge(r: StructureNode): StructureNode {
    method filterKeys (line 603) | private filterKeys(
    method defaultable (line 712) | get defaultable(): Optional.Node.withDefault[] {
    method _compileDeclaresKey (line 725) | _compileDeclaresKey(js: NodeCompiler): string {
    method structuralMorph (line 742) | get structuralMorph(): Morph | undefined {
    method compile (line 749) | compile(js: NodeCompiler): unknown {
    method compileExhaustiveEntry (line 782) | protected compileExhaustiveEntry(js: NodeCompiler): NodeCompiler {
    method reduceJsonSchema (line 808) | reduceJsonSchema(
    method reduceObjectJsonSchema (line 833) | reduceObjectJsonSchema(
  type PartiallyInitializedStructure (line 943) | type PartiallyInitializedStructure = attachmentsOf<Structure.Declaration> &
  type PropFlatMapper (line 1047) | type PropFlatMapper = (entry: Prop.Node) => listable<MappedPropInner>
  type MappedPropInner (line 1049) | type MappedPropInner = BaseMappedPropInner | OptionalMappedPropInner
  type BaseMappedPropInner (line 1052) | interface BaseMappedPropInner extends Required.Schema {
  type OptionalMappedPropInner (line 1056) | interface OptionalMappedPropInner extends Optional.Schema {
  type NormalizedIndex (line 1078) | type NormalizedIndex = {
  type writeDuplicateKeyMessage (line 1135) | type writeDuplicateKeyMessage<key extends Key> =

FILE: ark/type/__tests__/cast.test.ts
  type F (line 26) | type F = () => boolean

FILE: ark/type/__tests__/declared.test.ts
  type Expected (line 13) | type Expected = { a: string; b?: number }
  type Expected (line 24) | type Expected = { a: string; b?: number }
  type Expected (line 34) | type Expected = [string, number]
  type Expected (line 92) | type Expected = { a: string; b?: number }
  type Expected (line 130) | type Expected = { f?: string }
  type Expected (line 139) | type Expected = { f: string | undefined }
  type Expected (line 147) | type Expected = { f?: string | undefined }
  type Expected (line 155) | type Expected = { f?: string }
  type Expected (line 209) | type Expected = { a: string; b?: number }
  type Expected (line 220) | type Expected = { a: string; b?: number }
  type Expected (line 235) | type Expected = { a: number; b?: number }
  type Expected (line 246) | type Expected = { a: number; b?: number }
  type Expected (line 258) | type Expected = { a: string; b?: number }
  type Expected (line 269) | type Expected = { f?: string }
  type Expected (line 279) | type Expected = { f?: string }
  type Member (line 291) | type Member = "a" | "b" | undefined // without undefined it works
  type Object (line 294) | type Object = {

FILE: ark/type/__tests__/enclosed.test.ts
  type Expected (line 177) | type Expected = typeof s extends `"${infer enclosed}"` ? enclosed : never

FILE: ark/type/__tests__/generic.test.ts
  class MyExternalClass (line 493) | class MyExternalClass<T> {
    method constructor (line 496) | constructor(data: T) {

FILE: ark/type/__tests__/instanceOf.test.ts
  class Sub (line 44) | class Sub extends Base {
  class ArkClass (line 65) | class ArkClass {
  class ArkClass (line 88) | class ArkClass {

FILE: ark/type/__tests__/match.test.ts
  type Data (line 674) | type Data =
  type Discriminated (line 809) | type Discriminated =
  type Data (line 899) | type Data = {

FILE: ark/type/__tests__/narrow.test.ts
  type Expected (line 86) | type Expected = number | boolean[]

FILE: ark/type/__tests__/objects/indexSignatures.test.ts
  type Key (line 153) | type Key = symbol | "foo" | "bar" | "baz"
  type Expected (line 254) | type Expected = { normal: string; optional?: string }

FILE: ark/type/__tests__/objects/mapped.test.ts
  type ExpectedKey (line 66) | type ExpectedKey<t = type<object>> =
  type Base (line 80) | type Base = typeof Base.infer
  type Original (line 82) | type Original = { [k in ExpectedKey]: Base }

FILE: ark/type/__tests__/operator.bench.ts
  type Expected (line 178) | type Expected = {

FILE: ark/type/__tests__/pipe.test.ts
  class TypeA (line 1106) | class TypeA {
    method constructor (line 1108) | constructor() {}
  class TypeB (line 1111) | class TypeB {
    method constructor (line 1113) | constructor() {}

FILE: ark/type/__tests__/realWorld.test.ts
  class TimeStub (line 11) | class TimeStub {
  type Test (line 169) | type Test = typeof badType.infer
  type MyType (line 603) | type MyType = typeof MyType.in.infer
  type T (line 1130) | type T = {
  function fn (line 1239) | function fn<
  class ValidatedUserID (line 1304) | class ValidatedUserID {
    method fromString (line 1305) | static fromString(value: string): ValidatedUserID {
    method constructor (line 1308) | private constructor(readonly data: string) {}
  function someFunction (line 1372) | function someFunction<TSchema extends Record<string, any>>(
  function someFunction (line 1388) | function someFunction<schema extends type.Any<Record<string, any>>>(

FILE: ark/type/__tests__/runtime.bench.ts
  type Data (line 145) | type Data =

FILE: ark/type/__tests__/scope.test.ts
  type Package (line 292) | type Package = distill.Out<
  type Value (line 474) | type Value = boolean | number | string | { [k: string]: Value } | Value[]

FILE: ark/type/__tests__/submodule.test.ts
  type Expected$ (line 300) | type Expected$ = {
  type DeepExpected$ (line 371) | type DeepExpected$ = {

FILE: ark/type/__tests__/this.test.ts
  type ExpectedDisappointingGift (line 12) | type ExpectedDisappointingGift = {
  type Initial (line 56) | type Initial = {
  type Expected (line 59) | type Expected = {

FILE: ark/type/__tests__/thunk.test.ts
  type BrandedId (line 165) | type BrandedId = typeof types.id.t

FILE: ark/type/attributes.ts
  type Comparator (line 23) | type Comparator = "<" | "<=" | ">" | ">=" | "=="
  type RegexLiteral (line 25) | type RegexLiteral<source extends string = string> = `/${source}/`
  type DateLiteral (line 27) | type DateLiteral<source extends string = string> =
  type LimitLiteral (line 31) | type LimitLiteral = number | DateLiteral
  type normalizeLimit (line 33) | type normalizeLimit<limit> =
  type distill (line 38) | type distill<t, side extends distill.Side> = finalizeDistillation<
  type Side (line 44) | type Side = "in" | "out" | "introspectableOut"
  type In (line 46) | type In<t> = distill<t, "in">
  type Out (line 48) | type Out<t> = distill<t, "out">
  type Out (line 51) | type Out<t> = distill<t, "introspectableOut">
  type finalizeDistillation (line 55) | type finalizeDistillation<t, distilled> =
  type _distill (line 58) | type _distill<t, side extends distill.Side> =
  type distillMappable (line 80) | type distillMappable<o, side extends distill.Side> =
  type distillIo (line 93) | type distillIo<i, o extends Out, side extends distill.Side> =
  type unwrapInput (line 100) | type unwrapInput<t> =
  type inferredDefaultKeyOf (line 107) | type inferredDefaultKeyOf<o> =
  type distillArray (line 118) | type distillArray<t extends array, side extends distill.Side> =
  type alignReadonly (line 128) | type alignReadonly<result extends unknown[], original extends array> =
  type distillNonArraykeys (line 132) | type distillNonArraykeys<
  type distillArrayFromPrefix (line 147) | type distillArrayFromPrefix<
  type distillArrayFromPostfix (line 161) | type distillArrayFromPostfix<
  type BuiltinTerminalObjectKind (line 170) | type BuiltinTerminalObjectKind = Exclude<
  type TerminallyInferredObject (line 176) | type TerminallyInferredObject =
  type inferPredicate (line 180) | type inferPredicate<t, predicate> =
  type inferNaryPipe (line 185) | type inferNaryPipe<morphs extends readonly Morph[]> = _inferNaryPipe<
  type _inferNaryPipe (line 190) | type _inferNaryPipe<remaining extends readonly unknown[], result> =
  type inferNaryIntersection (line 197) | type inferNaryIntersection<types extends readonly unknown[]> =
  type _inferNaryIntersection (line 202) | type _inferNaryIntersection<remaining extends readonly unknown[], result> =
  type inferNaryMerge (line 207) | type inferNaryMerge<types extends readonly unknown[]> =
  type _inferUnorderedMerge (line 211) | type _inferUnorderedMerge<
  type optionalAtLeastOnceUnionKeyOf (line 241) | type optionalAtLeastOnceUnionKeyOf<t> =
  type _inferNaryMerge (line 244) | type _inferNaryMerge<remaining extends readonly unknown[], result> =
  type inferMorphOut (line 251) | type inferMorphOut<morph extends Morph> = Exclude<
  type Out (line 258) | interface Out<o = any> {
  type To (line 264) | interface To<o = any> extends Out<o> {
  type InferredMorph (line 268) | type InferredMorph<i = never, o extends Out = Out> = (In: i) => o
  type Default (line 272) | type Default<t = unknown, v = unknown> = { [defaultsToKey]: [t, v] }
  type withDefault (line 277) | type withDefault<t, v, undistributed = t> =
  type addDefaultToMorph (line 281) | type addDefaultToMorph<t extends InferredMorph, v> =
  type normalizeMorphDistribution (line 288) | type normalizeMorphDistribution<
  type defaultFor (line 313) | type defaultFor<t = unknown> =
  type termOrType (line 319) | type termOrType<t> = t | Type<t, any>
  type inferIntersection (line 321) | type inferIntersection<l, r> = normalizeMorphDistribution<
  type inferMorph (line 325) | type inferMorph<t, morph extends Morph> =
  type inferPipe (line 330) | type inferPipe<l, r> = normalizeMorphDistribution<
  type _inferIntersection (line 334) | type _inferIntersection<l, r, piped extends boolean> =
  type MorphableIntersection (line 353) | interface MorphableIntersection<piped extends boolean>
  type intersectObjects (line 358) | type intersectObjects<l, r, piped extends boolean> =

FILE: ark/type/config.ts
  type KeywordConfig (line 7) | type KeywordConfig = {
  type parseConfigurableFlatAlias (line 14) | type parseConfigurableFlatAlias<k extends string, v> =
  type ArkConfig (line 20) | interface ArkConfig extends ArkSchemaConfig {
  type ArkEnv (line 28) | interface ArkEnv {
  type $ (line 42) | type $ = ReturnType<ArkEnv["$"]>
  type meta (line 44) | type meta = ArkEnv.meta
  type prototypes (line 46) | type prototypes = ArkEnv.prototypes

FILE: ark/type/declare.ts
  type DeclarationParser (line 24) | type DeclarationParser<$> = <
  type finalizePreinferred (line 37) | type finalizePreinferred<preinferred, def, $, ctx extends DeclareContext> =
  type DeclareContext (line 44) | type DeclareContext = {
  type validateDeclared (line 48) | type validateDeclared<declared, def, $, ctx extends DeclareContext> =
  type validateInference (line 53) | type validateInference<def, declared, $, args, ctx extends DeclareContex...
  type validateArrayInference (line 64) | type validateArrayInference<
  type validateObjectInference (line 79) | type validateObjectInference<
  type declaredOptionalKeySuggestion (line 98) | type declaredOptionalKeySuggestion<k extends string, def> =
  type declaredOptionalValueSuggestion (line 105) | type declaredOptionalValueSuggestion<
  type validateShallowInference (line 122) | type validateShallowInference<
  type declarationMismatch (line 131) | type declarationMismatch<inferred, declared> = ErrorType<{

FILE: ark/type/fn.ts
  type BaseFnParser (line 20) | type BaseFnParser<$ = {}> = <
  type FnParser (line 54) | interface FnParser<$ = {}> extends BaseFnParser<$> {
  type RawFnParser (line 68) | type RawFnParser = (
  type FnParserAttachments (line 72) | type FnParserAttachments = Omit<FnParser, never>
  class InternalFnParser (line 74) | class InternalFnParser extends Callable<(...args: unknown[]) => Fn> {
    method constructor (line 75) | constructor($: InternalScope) {
  type meta (line 109) | type meta = {
  type TypedFn (line 114) | interface TypedFn<
  class InternalTypedFn (line 127) | class InternalTypedFn extends Callable<(...args: unknown[]) => unknown> {
    method constructor (line 133) | constructor(raw: Fn, params: IntersectionNode, returns: BaseRoot) {
  type introspectable (line 163) | interface introspectable {
  type validateFnArgs (line 168) | type validateFnArgs<args, $> =
  type validateFnParamDefs (line 179) | type validateFnParamDefs<paramDefs extends readonly unknown[], $> =

FILE: ark/type/generic.ts
  type ParameterString (line 34) | type ParameterString<params extends string = string> = `<${params}>`
  type extractParams (line 36) | type extractParams<s extends ParameterString> =
  type validateParameterString (line 39) | type validateParameterString<s extends ParameterString, $> =
  type validateGenericArg (line 44) | type validateGenericArg<arg, param extends GenericParamAst, $> =
  type GenericInstantiator (line 48) | type GenericInstantiator<
  type instantiateGeneric (line 148) | type instantiateGeneric<
  type bindGenericArgs (line 161) | type bindGenericArgs<params extends array<GenericParamAst>, $, args> = {
  type baseGenericResolutions (line 168) | type baseGenericResolutions<params extends array<GenericParamAst>, $> =
  type baseGenericConstraints (line 173) | type baseGenericConstraints<params extends array<GenericParamAst>> = {
  type Generic (line 177) | interface Generic<
  type GenericConstructor (line 198) | type GenericConstructor<
  type GenericDeclaration (line 207) | type GenericDeclaration<
  type parseValidGenericParams (line 212) | type parseValidGenericParams<def extends ParameterString, $> = conform<
  type emptyGenericParameterMessage (line 220) | type emptyGenericParameterMessage = typeof emptyGenericParameterMessage
  type parseGenericParams (line 222) | type parseGenericParams<def extends string, $> = parseNextNameChar<
  type ParamsTerminator (line 229) | type ParamsTerminator = WhitespaceChar | ","
  type parseName (line 250) | type parseName<
  type parseNextNameChar (line 256) | type parseNextNameChar<
  type extendsToken (line 276) | type extendsToken = typeof extendsToken
  type _parseOptionalConstraint (line 301) | type _parseOptionalConstraint<
  type genericParamDefToAst (line 331) | type genericParamDefToAst<schema extends GenericParamDef, $> =
  type genericParamDefsToAst (line 336) | type genericParamDefsToAst<defs extends array<GenericParamDef>, $> = [
  type GenericParser (line 340) | type GenericParser<$ = {}> = <
  type GenericBodyParser (line 353) | interface GenericBodyParser<params extends array<GenericParamAst>, $> {

FILE: ark/type/keywords/Array.ts
  class liftFromHkt (line 7) | class liftFromHkt extends Hkt<[element: unknown]> {
  type module (line 38) | type module = Module<submodule>
  type submodule (line 40) | type submodule = Submodule<$>
  type $ (line 42) | type $ = {
  type NonNegativeIntegerString (line 50) | type NonNegativeIntegerString =

FILE: ark/type/keywords/FormData.ts
  type FormDataValue (line 7) | type FormDataValue = string | File
  type ParsedFormData (line 9) | type ParsedFormData = Record<string, FormDataValue | FormDataValue[]>
  type FormDataEntries (line 38) | type FormDataEntries = [string, FormDataValue][]
  type module (line 61) | type module = Module<submodule>
  type submodule (line 63) | type submodule = Submodule<$>
  type $ (line 65) | type $ = {

FILE: ark/type/keywords/TypedArray.ts
  type module (line 24) | type module = Module<TypedArray.$>
  type submodule (line 27) | type submodule = Submodule<$>
  type $ (line 29) | type $ = {

FILE: ark/type/keywords/builtins.ts
  class MergeHkt (line 7) | class MergeHkt extends Hkt<[base: object, props: object]> {
  type arkBuiltins (line 24) | type arkBuiltins = Module<arkBuiltins.$>
  type submodule (line 27) | type submodule = Submodule<$>
  type $ (line 29) | type $ = {

FILE: ark/type/keywords/constructors.ts
  type module (line 32) | type module = Module<submodule>
  type submodule (line 34) | type submodule = Submodule<$>
  type keywords (line 36) | interface keywords extends ecmascript, platform {}
  type $ (line 38) | interface $ extends Omit<keywords, keyof wrapped>, wrapped {}
  type wrapped (line 40) | interface wrapped {
  type ecmascript (line 46) | type ecmascript = Omit<
  type platform (line 51) | type platform = PlatformObjects
  type instances (line 53) | interface instances extends ecmascript, platform {}
  type NonDegenerateName (line 57) | type NonDegenerateName =
  type instanceOf (line 66) | type instanceOf<name extends NonDegenerateName = NonDegenerateName> =

FILE: ark/type/keywords/keywords.ts
  type Ark (line 28) | interface Ark
  type keywords (line 33) | interface keywords
  type wrapped (line 40) | interface wrapped extends arkPrototypes.wrapped {
  type flat (line 47) | type flat = flatResolutionsOf<Ark>
  type typeAttachments (line 49) | interface typeAttachments extends arkTsKeywords.$ {
  type boundTypeAttachments (line 57) | interface boundTypeAttachments<$>
  type cast (line 108) | interface cast<to> {
  type errors (line 112) | type errors = ArkErrors
  type validate (line 114) | type validate<def, $ = {}, args = bindThis<def>> = validateDefinition<
  type instantiate (line 120) | type instantiate<def, $ = {}, args = bindThis<def>> = instantiateType<
  type infer (line 125) | type infer<def, $ = {}, args = bindThis<def>> = inferDefinition<
  type In (line 132) | type In<def, $ = {}, args = {}> = distill.In<
  type Out (line 136) | type Out<def, $ = {}, args = {}> = distill.Out<
  type Out (line 141) | type Out<def, $ = {}, args = {}> = distill.introspectable.Out<
  type brand (line 147) | type brand<t, id> =
  type Any (line 155) | interface Any<out t = any, $ = any> extends BaseType<t, $> {}
  type type (line 158) | type type<t = unknown, $ = {}> = Type<t, $>

FILE: ark/type/keywords/number.ts
  type module (line 60) | type module = Module<submodule>
  type submodule (line 62) | type submodule = Submodule<$>
  type $ (line 64) | type $ = {

FILE: ark/type/keywords/string.ts
  type module (line 71) | type module = Module<submodule>
  type submodule (line 73) | type submodule = Submodule<$>
  type $ (line 75) | type $ = {
  type module (line 100) | type module = Module<submodule>
  type submodule (line 102) | type submodule = Submodule<$>
  type $ (line 104) | type $ = {
  type module (line 127) | type module = Module<submodule>
  type submodule (line 129) | type submodule = Submodule<$>
  type $ (line 131) | type $ = {
  type DayDelimiter (line 173) | type DayDelimiter = "." | "/" | "-"
  type DayPart (line 177) | type DayPart = DayPatterns[PartKey]
  type PartKey (line 179) | type PartKey = keyof DayPatterns
  type DayPatterns (line 181) | type DayPatterns = {
  type fragment (line 187) | type fragment<part extends DayPart, delimiter extends DayDelimiter> =
  type DayPattern (line 191) | type DayPattern<delimiter extends DayDelimiter = DayDelimiter> =
  type DateFormat (line 206) | type DateFormat = "iso" | DayPattern
  type DateOptions (line 208) | type DateOptions = {
  type ParsedDayParts (line 218) | type ParsedDayParts = {
  type module (line 354) | type module = Module<stringDate.submodule>
  type submodule (line 356) | type submodule = Submodule<$>
  type $ (line 358) | type $ = {
  type submodule (line 366) | type submodule = Submodule<$>
  type $ (line 368) | type $ = {
  type submodule (line 375) | type submodule = Submodule<$>
  type $ (line 377) | type $ = {
  type module (line 426) | type module = Module<submodule>
  type submodule (line 428) | type submodule = Submodule<$>
  type $ (line 430) | type $ = {
  type module (line 499) | type module = Module<submodule>
  type submodule (line 501) | type submodule = Submodule<$>
  type $ (line 503) | type $ = {
  type module (line 526) | type module = Module<submodule>
  type submodule (line 528) | type submodule = Submodule<$>
  type $ (line 530) | type $ = {
  type NormalizedForm (line 538) | type NormalizedForm = (typeof normalizedForms)[number]
  constant NFC (line 566) | const NFC = Scope.module(
  constant NFD (line 576) | const NFD = Scope.module(
  constant NFKC (line 586) | const NFKC = Scope.module(
  constant NFKD (line 596) | const NFKD = Scope.module(
  type module (line 620) | type module = Module<submodule>
  type submodule (line 622) | type submodule = Submodule<$>
  type $ (line 624) | type $ = {
  type submodule (line 633) | type submodule = Submodule<$>
  type $ (line 635) | type $ = {
  type submodule (line 642) | type submodule = Submodule<$>
  type $ (line 644) | type $ = {
  type submodule (line 651) | type submodule = Submodule<$>
  type $ (line 653) | type $ = {
  type submodule (line 660) | type submodule = Submodule<$>
  type $ (line 662) | type $ = {
  type module (line 689) | type module = Module<submodule>
  type submodule (line 691) | type submodule = Submodule<$>
  type $ (line 693) | type $ = {
  type module (line 749) | type module = Module<submodule>
  type submodule (line 751) | type submodule = Submodule<$>
  type $ (line 753) | type $ = {
  type module (line 776) | type module = Module<submodule>
  type submodule (line 778) | type submodule = Submodule<$>
  type $ (line 780) | type $ = {
  type module (line 821) | type module = Module<submodule>
  type submodule (line 823) | type submodule = Submodule<$>
  type $ (line 825) | type $ = {
  type module (line 884) | type module = Module<submodule>
  type submodule (line 886) | type submodule = Submodule<$>
  type $ (line 888) | type $ = {
  type flat (line 901) | type flat = {}
  type module (line 939) | type module = Module<string.submodule>
  type submodule (line 941) | type submodule = Submodule<$>
  type $ (line 943) | type $ = {

FILE: ark/type/keywords/ts.ts
  type arkTsKeywords (line 29) | type arkTsKeywords = Module<arkTsKeywords.$>
  type submodule (line 32) | type submodule = Submodule<$>
  type $ (line 34) | type $ = {
  type submodule (line 61) | type submodule = Submodule<$>
  type $ (line 63) | type $ = {
  type submodule (line 84) | type submodule = Submodule<$>
  type $ (line 86) | type $ = {
  type submodule (line 103) | type submodule = Submodule<$>
  type $ (line 105) | type $ = {
  class RecordHkt (line 111) | class RecordHkt extends Hkt<[Key, unknown]> {
  class PickHkt (line 129) | class PickHkt extends Hkt<[object, Key]> {
  class OmitHkt (line 141) | class OmitHkt extends Hkt<[object, Key]> {
  class PartialHkt (line 153) | class PartialHkt extends Hkt<[object]> {
  class RequiredHkt (line 165) | class RequiredHkt extends Hkt<[object]> {
  class ExcludeHkt (line 177) | class ExcludeHkt extends Hkt<[unknown, unknown]> {
  class ExtractHkt (line 188) | class ExtractHkt extends Hkt<[unknown, unknown]> {
  type module (line 211) | type module = Module<arkTsGenerics.$>
  type submodule (line 213) | type submodule = Submodule<$>
  type $ (line 215) | type $ = {

FILE: ark/type/match.ts
  type MatchParserContext (line 29) | type MatchParserContext<input = unknown> = {
  type from (line 38) | type from<ctx extends MatchParserContext> = ctx
  type init (line 40) | type init<$, input = unknown, checked extends boolean = false> = from<{
  type atKey (line 48) | type atKey<ctx extends MatchParserContext, key extends string> = from<{
  type MatchParser (line 57) | interface MatchParser<$> extends CaseMatchParser<ctx.init<$>> {
  method if (line 405) | if (i !== entries.length - 1) {

FILE: ark/type/module.ts
  type Module (line 13) | interface Module<$ extends {} = {}> extends RootModule<exportScope<$>> {}
  type exportScope (line 15) | type exportScope<$> = bindExportsToScope<$, $>
  type BoundModule (line 22) | interface BoundModule<exports extends {}, $>
  type bindExportsToScope (line 25) | type bindExportsToScope<exports, $> = {
  type Submodule (line 29) | type Submodule<exports extends {}> = RootModule<
  type instantiateExport (line 34) | type instantiateExport<t, $> =

FILE: ark/type/nary.ts
  type NaryUnionParser (line 17) | type NaryUnionParser<$> = {
  type NaryIntersectionParser (line 564) | type NaryIntersectionParser<$> = {
  type NaryMergeParser (line 1179) | type NaryMergeParser<$> = {

FILE: ark/type/parser/ast/bounds.ts
  type validateRange (line 13) | type validateRange<l, comparator extends Comparator, r, $, args> =
  type validateBound (line 19) | type validateBound<
  type isNumericallyBoundable (line 42) | type isNumericallyBoundable<bounded> =
  type writeDoubleRightBoundMessage (line 53) | type writeDoubleRightBoundMessage<root extends string> =

FILE: ark/type/parser/ast/default.ts
  type validateDefault (line 9) | type validateDefault<baseAst, unitLiteral extends UnitLiteral, $, args> =

FILE: ark/type/parser/ast/divisor.ts
  type validateDivisor (line 8) | type validateDivisor<l, $, args> =

FILE: ark/type/parser/ast/generic.ts
  type GenericInstantiationAst (line 13) | type GenericInstantiationAst<
  type inferGenericInstantiation (line 18) | type inferGenericInstantiation<
  type validateGenericInstantiation (line 42) | type validateGenericInstantiation<
  type validateGenericArgs (line 49) | type validateGenericArgs<
  type resolveScope (line 69) | type resolveScope<g$, $> =

FILE: ark/type/parser/ast/infer.ts
  type inferAstRoot (line 18) | type inferAstRoot<ast, $, args> =
  type inferAstIn (line 21) | type inferAstIn<ast, $, args> = distill.In<inferAstRoot<ast, $, args>>
  type inferAstOut (line 23) | type inferAstOut<ast, $, args> = distill.Out<inferAstRoot<ast, $, args>>
  type DefAst (line 25) | type DefAst<def = unknown, alias extends string = string> = [
  type InferredAst (line 31) | type InferredAst<t = unknown, def extends string = string> = [
  type inferExpression (line 37) | type inferExpression<ast, $, args> =
  type PrefixOperator (line 73) | type PrefixOperator = "keyof" | "instanceof" | "===" | "node"
  type PrefixExpression (line 75) | type PrefixExpression<
  type PostfixExpression (line 80) | type PostfixExpression<
  type InfixExpression (line 85) | type InfixExpression<

FILE: ark/type/parser/ast/keyof.ts
  type validateKeyof (line 6) | type validateKeyof<operandAst, $, args> =

FILE: ark/type/parser/ast/utils.ts
  type astToString (line 11) | type astToString<ast> =
  type ConstraintOperator (line 24) | type ConstraintOperator = satisfy<OperatorToken, "%" | Comparator>
  type writeConstrainedMorphMessage (line 26) | type writeConstrainedMorphMessage<constrainedAst> =

FILE: ark/type/parser/ast/validate.ts
  type validateAst (line 35) | type validateAst<ast, $, args> =
  type writeUnexpectedExpressionMessage (line 66) | type writeUnexpectedExpressionMessage<expression extends string> =
  type writePrefixedPrivateReferenceMessage (line 74) | type writePrefixedPrivateReferenceMessage<name extends string> =
  type validateInferredAst (line 77) | type validateInferredAst<inferred, def extends string> =
  type validateString (line 100) | type validateString<def extends string, $, args> =
  type validateInfix (line 111) | type validateInfix<ast extends InfixExpression, $, args> =
  type shallowOptionalMessage (line 119) | type shallowOptionalMessage = typeof shallowOptionalMessage
  type shallowDefaultableMessage (line 124) | type shallowDefaultableMessage = typeof shallowDefaultableMessage

FILE: ark/type/parser/definition.ts
  type inferDefinition (line 138) | type inferDefinition<def, $, args> =
  type inferStandardSchema (line 153) | type inferStandardSchema<
  type validateDefinition (line 164) | type validateDefinition<def, $, args> =
  type validateInnerDefinition (line 180) | type validateInnerDefinition<def, $, args> =
  type validateTuple (line 195) | type validateTuple<def extends array, $, args> =
  type inferTuple (line 202) | type inferTuple<def extends array, $, args> =
  type TerminalObjectDefinition (line 208) | type TerminalObjectDefinition =
  type ThunkCast (line 214) | type ThunkCast<t = unknown> = () => type.cast<t>
  type BadDefinitionType (line 216) | type BadDefinitionType = Exclude<Primitive, string>
  type writeBadDefinitionTypeMessage (line 223) | type writeBadDefinitionTypeMessage<actual extends string> =

FILE: ark/type/parser/objectLiteral.ts
  type MutableStructureSchema (line 39) | type MutableStructureSchema = mutable<NodeSchema<"structure">, 2>
  type inferObjectLiteral (line 174) | type inferObjectLiteral<def extends object, $, args> = show<
  type _inferObjectLiteral (line 186) | type _inferObjectLiteral<def extends object, $, args> = {
  type validateObjectLiteral (line 205) | type validateObjectLiteral<def, $, args> = {
  type nonOptionalKeyFromEntry (line 224) | type nonOptionalKeyFromEntry<k extends PropertyKey, v, $, args> =
  type optionalKeyFromEntry (line 242) | type optionalKeyFromEntry<k extends PropertyKey, v> =
  type PreparsedKey (line 259) | type PreparsedKey = PreparsedEntryKey | PreparsedSpecialKey
  type normalizedKeyKind (line 261) | type normalizedKeyKind<kind extends EntryKeyKind> =
  type PreparsedEntryKey (line 264) | type PreparsedEntryKey<
  type PreparsedSpecialKey (line 272) | type PreparsedSpecialKey<kind extends SpecialKeyKind = SpecialKeyKind> =
  type from (line 278) | type from<t extends PreparsedKey> = t
  type ParsedKeyKind (line 281) | type ParsedKeyKind = EntryKeyKind | SpecialKeyKind
  type EntryKeyKind (line 283) | type EntryKeyKind = "required" | "optional" | "index"
  type SpecialKeyKind (line 285) | type SpecialKeyKind = "spread" | "undeclared"
  type MetaKey (line 287) | type MetaKey = "..." | "+"
  type IndexKey (line 289) | type IndexKey<def extends string = string> = `[${def}]`
  type preparseKey (line 314) | type preparseKey<k> =
  type writeInvalidSpreadTypeMessage (line 354) | type writeInvalidSpreadTypeMessage<def extends string> =

FILE: ark/type/parser/property.ts
  type ParsedPropertyKind (line 25) | type ParsedPropertyKind = "plain" | "optional" | "defaultable"
  type ParsedProperty (line 27) | type ParsedProperty =
  type ParsedRequiredProperty (line 32) | type ParsedRequiredProperty = BaseRoot
  type ParsedOptionalProperty (line 34) | type ParsedOptionalProperty = readonly [BaseRoot, "?"]
  type validateProperty (line 52) | type validateProperty<def, keyKind extends ParsedKeyKind, $, args> =
  type isDefaultable (line 84) | type isDefaultable<def, $, args> =
  type OptionalPropertyDefinition (line 92) | type OptionalPropertyDefinition<baseDef = unknown> =
  type OptionalPropertyString (line 96) | type OptionalPropertyString<baseDef extends string = string> =
  type OptionalPropertyTuple (line 99) | type OptionalPropertyTuple<baseDef = unknown> = readonly [baseDef, "?"]
  type PossibleDefaultableStringDefinition (line 105) | type PossibleDefaultableStringDefinition = `${string}=${string}`
  type DefaultablePropertyTuple (line 107) | type DefaultablePropertyTuple<
  type invalidOptionalKeyKindMessage (line 115) | type invalidOptionalKeyKindMessage = typeof invalidOptionalKeyKindMessage
  type invalidDefaultableKeyKindMessage (line 120) | type invalidDefaultableKeyKindMessage =

FILE: ark/type/parser/reduce/dynamic.ts
  type BranchState (line 29) | type BranchState = {
  type RootedRuntimeState (line 37) | type RootedRuntimeState = requireKeys<RuntimeState, "root">
  class RuntimeState (line 39) | class RuntimeState {
    method constructor (line 54) | constructor(scanner: Scanner, ctx: BaseParseContext) {
    method error (line 59) | error(message: string): never {
    method hasRoot (line 63) | hasRoot(): this is RootedRuntimeState {
    method setRoot (line 67) | setRoot(root: BaseRoot): void {
    method unsetRoot (line 71) | unsetRoot(): this["root"] {
    method constrainRoot (line 77) | constrainRoot(...args: Parameters<BaseRoot<any>["constrain"]>): void {
    method finalize (line 81) | finalize(finalizer: FinalizingLookahead): void {
    method reduceLeftBound (line 88) | reduceLeftBound(limit: LimitLiteral, comparator: Comparator): void {
    method finalizeBranches (line 109) | finalizeBranches(): void {
    method finalizeGroup (line 133) | finalizeGroup(): void {
    method addPrefix (line 145) | addPrefix(prefix: StringifiablePrefixOperator): void {
    method applyPrefixes (line 149) | applyPrefixes(): void {
    method pushRootToBranch (line 159) | pushRootToBranch(token: BranchOperator): void {
    method parseUntilFinalizer (line 183) | parseUntilFinalizer(): RootedRuntimeState {
    method parseOperator (line 187) | parseOperator(this: RootedRuntimeState): void {
    method parseOperand (line 191) | parseOperand(): void {
    method assertRangeUnset (line 195) | private assertRangeUnset() {
    method reduceGroupOpen (line 206) | reduceGroupOpen(): void {
    method previousOperator (line 217) | previousOperator():
    method shiftedBy (line 232) | shiftedBy(count: number): this {

FILE: ark/type/parser/reduce/shared.ts
  type StringifiablePrefixOperator (line 3) | type StringifiablePrefixOperator = "keyof"
  type MinComparator (line 10) | type MinComparator = keyof typeof minComparators
  type MaxComparator (line 17) | type MaxComparator = keyof typeof maxComparators
  type Comparator (line 27) | type Comparator = keyof typeof comparators
  type InvertedComparators (line 37) | type InvertedComparators = {
  type BranchOperator (line 45) | type BranchOperator = "&" | "|" | "|>"
  type OpenLeftBound (line 47) | type OpenLeftBound = { limit: LimitLiteral; comparator: MinComparator }
  type writeOpenRangeMessage (line 58) | type writeOpenRangeMessage<
  type writeUnpairableComparatorMessage (line 63) | type writeUnpairableComparatorMessage<comparator extends Comparator> =
  type writeMultipleLeftBoundsMessage (line 89) | type writeMultipleLeftBoundsMessage<

FILE: ark/type/parser/reduce/static.ts
  type StaticState (line 23) | type StaticState = {
  type BranchState (line 32) | type BranchState = {
  type AutocompletePrefix (line 40) | type AutocompletePrefix = `${StringifiablePrefixOperator} `
  type initialize (line 43) | type initialize<def extends string> = from<{
  type error (line 52) | type error<message extends string> = from<{
  type completion (line 61) | type completion<text extends string> = from<{
  type initialBranches (line 70) | type initialBranches = branchesFrom<{
  type updateScanned (line 78) | type updateScanned<
  type setRoot (line 87) | type setRoot<
  type addPrefix (line 100) | type addPrefix<
  type reduceBranch (line 119) | type reduceBranch<
  type reduceLeftBound (line 143) | type reduceLeftBound<
  type reduceRange (line 178) | type reduceRange<
  type reduceSingleBound (line 200) | type reduceSingleBound<
  type mergeToIntersection (line 220) | type mergeToIntersection<s extends StaticState> =
  type mergeToUnion (line 224) | type mergeToUnion<s extends StaticState> =
  type mergeToPipe (line 228) | type mergeToPipe<s extends StaticState> =
  type mergePrefixes (line 232) | type mergePrefixes<
  type popGroup (line 240) | type popGroup<stack extends BranchState[], top extends BranchState> = [
  type finalizeGroup (line 245) | type finalizeGroup<s extends StaticState, unscanned extends string> =
  type reduceGroupOpen (line 259) | type reduceGroupOpen<
  type finalize (line 271) | type finalize<
  type openRangeError (line 288) | type openRangeError<range extends defined<BranchState["leftBound"]>> =
  type previousOperator (line 291) | type previousOperator<s extends StaticState> =
  type scanTo (line 302) | type scanTo<s extends StaticState, unscanned extends string> = from<{
  type from (line 311) | type from<s extends StaticState> = s
  type branchesFrom (line 313) | type branchesFrom<b extends BranchState> = b

FILE: ark/type/parser/shift/operand/date.ts
  type extractDateLiteralSource (line 16) | type extractDateLiteralSource<literal extends DateLiteral> =
  type writeInvalidDateMessage (line 24) | type writeInvalidDateMessage<source extends string> =
  type DateInput (line 27) | type DateInput = ConstructorParameters<typeof Date>[0]
  type DateParseResult (line 29) | type DateParseResult<

FILE: ark/type/parser/shift/operand/enclosed.ts
  type StringLiteral (line 15) | type StringLiteral<contents extends string = string> =
  type DoubleQuotedStringLiteral (line 19) | type DoubleQuotedStringLiteral<contents extends string = string> =
  type SingleQuotedStringLiteral (line 22) | type SingleQuotedStringLiteral<contents extends string = string> =
  type parseEnclosed (line 79) | type parseEnclosed<
  type _parseEnclosed (line 92) | type _parseEnclosed<
  type EnclosingQuote (line 138) | type EnclosingQuote = keyof typeof enclosingQuote
  type EnclosingLiteralTokens (line 153) | type EnclosingLiteralTokens = typeof enclosingLiteralTokens
  type EnclosingLiteralStartToken (line 154) | type EnclosingLiteralStartToken = keyof EnclosingLiteralTokens
  type EnclosingRegexTokens (line 161) | type EnclosingRegexTokens = typeof enclosingRegexTokens
  type EnclosingRegexToken (line 162) | type EnclosingRegexToken = keyof EnclosingRegexTokens
  type EnclosingTokens (line 169) | type EnclosingTokens = typeof enclosingTokens
  type EnclosingStartToken (line 171) | type EnclosingStartToken = keyof EnclosingTokens
  type EnclosingEndToken (line 173) | type EnclosingEndToken = EnclosingTokens[keyof EnclosingTokens]
  type enclosingCharDescriptions (line 190) | type enclosingCharDescriptions = typeof enclosingCharDescriptions
  type writeUnterminatedEnclosedMessage (line 203) | type writeUnterminatedEnclosedMessage<

FILE: ark/type/parser/shift/operand/genericArgs.ts
  type parseGenericArgs (line 23) | type parseGenericArgs<
  type ParsedArgs (line 56) | type ParsedArgs<
  type _parseGenericArgs (line 64) | type _parseGenericArgs<
  type writeInvalidGenericArgCountMessage (line 123) | type writeInvalidGenericArgCountMessage<

FILE: ark/type/parser/shift/operand/operand.ts
  type parseOperand (line 32) | type parseOperand<s extends StaticState, $, args> =

FILE: ark/type/parser/shift/operand/unenclosed.ts
  type parseUnenclosed (line 44) | type parseUnenclosed<s extends StaticState, $, args> =
  type parseResolution (line 53) | type parseResolution<
  type parseGenericInstantiation (line 81) | type parseGenericInstantiation<
  type tryResolve (line 149) | type tryResolve<
  type tryResolveSubmodule (line 198) | type tryResolveSubmodule<
  type unresolvableState (line 229) | type unresolvableState<
  type qualifiedReference (line 251) | type qualifiedReference<
  type validReferenceFromToken (line 256) | type validReferenceFromToken<
  type writeMissingRightOperandMessage (line 274) | type writeMissingRightOperandMessage<
  type writeExpressionExpectedMessage (line 296) | type writeExpressionExpectedMessage<unscanned extends string> =

FILE: ark/type/parser/shift/operator/bounds.ts
  type parseBound (line 48) | type parseBound<
  type OneCharComparator (line 73) | type OneCharComparator = ">" | "<"
  type ComparatorStartChar (line 75) | type ComparatorStartChar =
  type shiftComparator (line 92) | type shiftComparator<
  type parseRightBound (line 212) | type parseRightBound<
  type writeInvalidLimitMessage (line 258) | type writeInvalidLimitMessage<
  type BoundExpressionKind (line 266) | type BoundExpressionKind = "left" | "right"

FILE: ark/type/parser/shift/operator/brand.ts
  type parseBrand (line 13) | type parseBrand<s extends StaticState, unscanned extends string> =

FILE: ark/type/parser/shift/operator/default.ts
  type UnitLiteralKeyword (line 17) | type UnitLiteralKeyword = "null" | "undefined" | "true" | "false"
  type UnitLiteral (line 19) | type UnitLiteral = UnenclosedUnitLiteral | EnclosedUnitLiteral
  type UnenclosedUnitLiteral (line 21) | type UnenclosedUnitLiteral =
  type EnclosedUnitLiteral (line 26) | type EnclosedUnitLiteral = StringLiteral | DateLiteral
  type ParsedDefaultableProperty (line 28) | type ParsedDefaultableProperty = readonly [BaseRoot, "=", unknown]
  type parseDefault (line 48) | type parseDefault<root, unscanned extends string> =
  type isValidEnclosedLiteral (line 65) | type isValidEnclosedLiteral<
  type writeNonLiteralDefaultMessage (line 84) | type writeNonLiteralDefaultMessage<defaultDef extends string> =

FILE: ark/type/parser/shift/operator/divisor.ts
  type parseDivisor (line 17) | type parseDivisor<s extends StaticState, unscanned extends string> =
  type writeInvalidDivisorMessage (line 34) | type writeInvalidDivisorMessage<divisor extends string | number> =

FILE: ark/type/parser/shift/operator/operator.ts
  type parseOperator (line 42) | type parseOperator<s extends StaticState, $, args> =
  type writeUnexpectedCharacterMessage (line 76) | type writeUnexpectedCharacterMessage<
  type incompleteArrayTokenMessage (line 84) | type incompleteArrayTokenMessage = typeof incompleteArrayTokenMessage

FILE: ark/type/parser/shift/tokens.ts
  type TerminatingChar (line 20) | type TerminatingChar = keyof typeof terminatingChars
  type FinalizingLookahead (line 30) | type FinalizingLookahead = keyof typeof finalizingLookaheads
  type lookaheadIsFinalizing (line 51) | type lookaheadIsFinalizing<
  type InfixToken (line 72) | type InfixToken =
  type PostfixToken (line 84) | type PostfixToken = "[]" | "?"
  type OperatorToken (line 86) | type OperatorToken = InfixToken | PostfixToken

FILE: ark/type/parser/string.ts
  type parseString (line 46) | type parseString<def extends string, $, args> =
  type inferString (line 57) | type inferString<def extends string, $, args> = inferAstRoot<
  type BaseCompletions (line 63) | type BaseCompletions<$, args, otherSuggestions extends string = never> =
  type fullStringParse (line 90) | type fullStringParse<s extends StaticState, $, args> = extractFinalizedR...
  type parseUntilFinalizer (line 100) | type parseUntilFinalizer<s extends StaticState, $, args> =
  type next (line 108) | type next<s extends StaticState, $, args> =
  type extractFinalizedResult (line 112) | type extractFinalizedResult<s extends StaticState> =

FILE: ark/type/parser/tupleExpressions.ts
  type maybeValidateTupleExpression (line 51) | type maybeValidateTupleExpression<def extends array, $, args> =
  type inferTupleExpression (line 65) | type inferTupleExpression<def extends TupleExpression, $, args> =
  type validatePrefixExpression (line 90) | type validatePrefixExpression<def extends IndexZeroExpression, $, args> =
  type validateIndexOneExpression (line 98) | type validateIndexOneExpression<
  type UnparsedTupleExpressionInput (line 122) | type UnparsedTupleExpressionInput = {
  type UnparsedTupleOperator (line 127) | type UnparsedTupleOperator = show<keyof UnparsedTupleExpressionInput>
  type inferKeyOfExpression (line 132) | type inferKeyOfExpression<operandDef, $, args> = show<
  type TupleExpression (line 154) | type TupleExpression = IndexZeroExpression | IndexOneExpression
  type TupleExpressionOperator (line 156) | type TupleExpressionOperator = IndexZeroOperator | IndexOneOperator
  type ArgTwoOperator (line 158) | type ArgTwoOperator = Exclude<IndexOneOperator, "?" | "=">
  type parseTo (line 177) | type parseTo<inDef, outDef, $, args> = inferPipe<
  type parseMorph (line 182) | type parseMorph<inDef, morph, $, args> =
  type IndexOneExpression (line 207) | type IndexOneExpression<token extends string = IndexOneOperator> =
  type IndexOneParser (line 210) | type IndexOneParser<token extends string> = (
  type TuplePostfixOperator (line 224) | type TuplePostfixOperator = keyof typeof postfixParsers
  type TupleInfixOperator (line 238) | type TupleInfixOperator = keyof typeof infixParsers
  type IndexOneOperator (line 242) | type IndexOneOperator = keyof typeof indexOneParsers
  type InfixExpression (line 247) | type InfixExpression = readonly [unknown, InfixToken, ...unknown[]]
  type IndexZeroParser (line 249) | type IndexZeroParser<token extends string> = (
  type IndexZeroExpression (line 254) | type IndexZeroExpression<token extends string = IndexZeroOperator> = rea...
  type IndexZeroOperator (line 287) | type IndexZeroOperator = keyof typeof indexZeroParsers

FILE: ark/type/parser/tupleLiteral.ts
  type validateTupleLiteral (line 87) | type validateTupleLiteral<def extends array, $, args> =
  type inferTupleLiteral (line 92) | type inferTupleLiteral<def extends array, $, args> =
  type SequencePhase (line 192) | type SequencePhase = satisfy<
  type prefix (line 201) | type prefix = "prefix"
  type optionals (line 203) | type optionals = "optionals"
  type defaultables (line 205) | type defaultables = "defaultables"
  type postfix (line 207) | type postfix = "postfix"
  type SequenceParseState (line 210) | type SequenceParseState = {
  type parseSequence (line 217) | type parseSequence<def extends array, $, args> = parseNextElement<
  type PreparsedElementKind (line 228) | type PreparsedElementKind =
  type PreparsedElement (line 233) | type PreparsedElement = {
  type from (line 243) | type from<result extends PreparsedElement> = result
  type required (line 245) | type required = "required"
  type optionals (line 247) | type optionals = "optionals"
  type defaultables (line 249) | type defaultables = "defaultables"
  type preparseNextState (line 252) | type preparseNextState<s extends SequenceParseState, $, args> =
  type preparseNextElement (line 259) | type preparseNextElement<
  type parseNextElement (line 279) | type parseNextElement<s extends SequenceParseState, $, args> =
  type nextInferred (line 301) | type nextInferred<s extends SequenceParseState, next extends PreparsedEl...
  type nextValidated (line 308) | type nextValidated<
  type nextValidatedSpreadOperatorIfPresent (line 317) | type nextValidatedSpreadOperatorIfPresent<
  type nextValidatedElement (line 338) | type nextValidatedElement<
  type writeNonArraySpreadMessage (line 365) | type writeNonArraySpreadMessage<operand> =
  type multipleVariadicMessage (line 372) | type multipleVariadicMessage = typeof multipleVariadicMesage
  type requiredPostOptionalMessage (line 377) | type requiredPostOptionalMessage = typeof requiredPostOptionalMessage
  type optionalOrDefaultableAfterVariadicMessage (line 382) | type optionalOrDefaultableAfterVariadicMessage =
  type spreadOptionalMessage (line 387) | type spreadOptionalMessage = typeof spreadOptionalMessage
  type spreadDefaultableMessage (line 391) | type spreadDefaultableMessage = typeof spreadDefaultableMessage
  type defaultablePostOptionalMessage (line 396) | type defaultablePostOptionalMessage = typeof defaultablePostOptionalMessage

FILE: ark/type/scope.ts
  type ScopeParserAttachments (line 98) | type ScopeParserAttachments =
  type ArkScopeConfig (line 102) | interface ArkScopeConfig extends ArkSchemaScopeConfig {}
  type ScopeParser (line 104) | interface ScopeParser {
  type ModuleParser (line 113) | type ModuleParser = <const def>(
  type bindThis (line 120) | type bindThis<def> = { this: Def<def> }
  type Def (line 123) | type Def<def = {}> = Brand<def, "unparsed">
  type UnparsedScope (line 126) | type UnparsedScope = "$"
  type PreparsedResolution (line 129) | type PreparsedResolution = PreparsedNodeResolution
  type bootstrapAliases (line 131) | type bootstrapAliases<def> = {
  type inferBootstrapped (line 152) | type inferBootstrapped<$> = {
  type bindGenericToScope (line 160) | type bindGenericToScope<g extends GenericAst, $> = GenericAst<
  type extractGenericName (line 167) | type extractGenericName<k> =
  type extractGenericParameters (line 170) | type extractGenericParameters<k> =
  type resolutionToAst (line 175) | type resolutionToAst<alias extends string, resolution> =
  type moduleKeyOf (line 183) | type moduleKeyOf<$> = {
  type ArkTypeRegistry (line 191) | interface ArkTypeRegistry extends ArkSchemaRegistry {
  type InternalScope (line 198) | interface InternalScope {
    method ambientAttachments (line 203) | get ambientAttachments(): Ark.boundTypeAttachments<$> | undefined {
    method preparseOwnAliasEntry (line 214) | protected preparseOwnAliasEntry(alias: string, def: unknown): AliasDef...
    method parseGenericParams (line 255) | parseGenericParams(
    method normalizeRootScopeValue (line 270) | protected normalizeRootScopeValue(resolution: unknown): unknown {
    method preparseOwnDefinitionFormat (line 276) | protected preparseOwnDefinitionFormat(
    method parseOwnDefinitionFormat (line 287) | parseOwnDefinitionFormat(def: unknown, ctx: BaseParseContext): BaseRoot {
    method define (line 343) | define<def>(def: def): def {
  class InternalScope (line 202) | class InternalScope<$ extends {} = {}> extends BaseScope<$> {
    method ambientAttachments (line 203) | get ambientAttachments(): Ark.boundTypeAttachments<$> | undefined {
    method preparseOwnAliasEntry (line 214) | protected preparseOwnAliasEntry(alias: string, def: unknown): AliasDef...
    method parseGenericParams (line 255) | parseGenericParams(
    method normalizeRootScopeValue (line 270) | protected normalizeRootScopeValue(resolution: unknown): unknown {
    method preparseOwnDefinitionFormat (line 276) | protected preparseOwnDefinitionFormat(
    method parseOwnDefinitionFormat (line 287) | parseOwnDefinitionFormat(def: unknown, ctx: BaseParseContext): BaseRoot {
    method define (line 343) | define<def>(def: def): def {
  type validate (line 361) | type validate<def> = {
  type infer (line 387) | type infer<def> = inferBootstrapped<bootstrapAliases<def>>
  type Scope (line 390) | interface Scope<$ = {}> {
  type ScopeConstructor (line 455) | interface ScopeConstructor {
  type parseScopeKey (line 463) | type parseScopeKey<k, def> =
  type parseGenericScopeKey (line 472) | type parseGenericScopeKey<name extends string, params extends string, de...
  type InnerParseResult (line 477) | type InnerParseResult =

FILE: ark/type/type.ts
  type TypeParserAttachments (line 53) | type TypeParserAttachments =
  type TypeParser (line 57) | interface TypeParser<$ = {}> extends Ark.boundTypeAttachments<$> {
  class InternalTypeParser (line 213) | class InternalTypeParser extends Callable<
    method constructor (line 217) | constructor($: InternalScope) {
  type UnitTypeParser (line 283) | type UnitTypeParser<$> = <const t>(value: t) => Type<t, $>
  type InstanceOfTypeParser (line 285) | type InstanceOfTypeParser<$> = <const t extends object>(
  type EnumeratedTypeParser (line 289) | type EnumeratedTypeParser<$> = <const values extends readonly unknown[]>(
  type ValueOfTypeParser (line 293) | type ValueOfTypeParser<$> = <const o extends object>(
  type DefinitionParser (line 297) | type DefinitionParser<$> = <const def>(def: type.validate<def, $>) => def
  type SchemaParser (line 299) | type SchemaParser<$> = (
  type Type (line 304) | type Type<t = unknown, $ = {}> = instantiateType<t, $>
  type TypeConstructor (line 306) | type TypeConstructor<t = unknown, $ = {}> = new (

FILE: ark/type/variants/array.ts
  type Type (line 8) | interface Type<

FILE: ark/type/variants/base.ts
  type Inferred (line 39) | interface Inferred<out t = unknown, $ = {}> {
  type Type (line 454) | interface Type<out t = unknown, $ = {}>
  type ChainedPipeParser (line 676) | interface ChainedPipeParser<$, t> extends NaryPipeParser<$, t> {
  type validateChainedAsArgs (line 680) | type validateChainedAsArgs<t> =

FILE: ark/type/variants/date.ts
  type Type (line 8) | interface Type<out t extends globalThis.Date = globalThis.Date, $ = {}>

FILE: ark/type/variants/instantiate.ts
  type instantiateType (line 9) | type instantiateType<t, $> =

FILE: ark/type/variants/number.ts
  type Type (line 9) | interface Type<out t extends number = number, $ = {}> extends BaseType<t...

FILE: ark/type/variants/object.ts
  type Type (line 29) | interface Type<out t extends object = object, $ = {}> extends BaseType<t...
  type typePropOf (line 133) | type typePropOf<o, $> =
  type typeProp (line 140) | type typeProp<o, k extends keyof o, $, t = o[k] & ({} | null)> =
  type BaseTypeProp (line 150) | interface BaseTypeProp<
  type DefaultedTypeProp (line 164) | interface DefaultedTypeProp<
  type MappedTypeProp (line 173) | type MappedTypeProp<k extends Key = Key, v = unknown> =
  type BaseMappedTypeProp (line 177) | type BaseMappedTypeProp<k extends Key, v> = merge<
  type OptionalMappedTypeProp (line 185) | type OptionalMappedTypeProp<k extends Key, v> = merge<
  type constructMapped (line 194) | type constructMapped<t, transformed extends listable<MappedTypeProp>> = ...
  type fromTypeProps (line 200) | type fromTypeProps<t, props extends array<MappedTypeProp>> = show<
  type NonObjectMergeErrorMessage (line 222) | type NonObjectMergeErrorMessage = "Merged type must be an object"
  type applyHomomorphicOptionality (line 224) | type applyHomomorphicOptionality<t, prop extends MappedTypeProp> =

FILE: ark/type/variants/string.ts
  type Type (line 11) | interface Type<out t extends string = string, $ = {}> extends BaseType<t...

FILE: ark/util/__tests__/arrays.test.ts
  type PinkLady (line 4) | type PinkLady = { group: "apple"; kind: "Pink Lady" }
  type Gala (line 5) | type Gala = { group: "apple"; kind: "Gala" }
  type Bengal (line 6) | type Bengal = { group: "lychee"; kind: "Bengal" }
  type Valencia (line 7) | type Valencia = { group: "orange"; kind: "Valencia" }
  type Bartlett (line 8) | type Bartlett = { group: "pear"; kind: "Bartlett" }
  type Anjou (line 9) | type Anjou = { group: "pear"; kind: "Anjou" }
  type VisionPro (line 10) | type VisionPro = { group: "apple"; kind: "Vision Pro" }
  type Fruit (line 12) | type Fruit =
  type T (line 65) | type T = setIndex<[1, 2], 1, 1>
  type T (line 71) | type T = setIndex<readonly [1, 2], 1, 1>

FILE: ark/util/__tests__/callable.test.ts
  class Sub (line 5) | class Sub extends Callable<(name: string) => string> {
    method constructor (line 6) | constructor() {
    method doSomething (line 10) | doSomething() {
  class SecondSub (line 23) | class SecondSub extends Sub {
  class Foo (line 50) | class Foo<attach extends object> extends Callable<() => 0, attach> {
    method constructor (line 51) | constructor(attach: attach) {
    method b (line 55) | b() {
    method getAttached (line 59) | getAttached<k extends keyof attach>(k: k): attach[k] {
  class GetAttached (line 78) | class GetAttached<attach extends object> extends Callable<
    method constructor (line 82) | constructor(attach: attach) {
    method protoGetAttached (line 88) | protoGetAttached(k: PropertyKey) {
    method getAttached (line 92) | getAttached<k extends keyof attach>(k: k): attach[k] {

FILE: ark/util/__tests__/clone.test.ts
  method foo (line 76) | get foo() {

FILE: ark/util/__tests__/hkt.test.ts
  type AppendKind (line 5) | interface AppendKind<element = unknown>
  type result (line 11) | type result = Hkt.apply<AppendKind, [2, [0, 1]]>

FILE: ark/util/__tests__/intersections.test.ts
  type t (line 7) | type t = intersectParameters<[], []>
  type t (line 12) | type t = intersectParameters<[], [string, number, ...boolean[]]>
  type t (line 17) | type t = intersectParameters<["a"], [string, number]>
  type t (line 22) | type t = intersectParameters<[{ a: string }], [{ b: boolean }]>
  type t (line 28) | type t = intersectParameters<[unknown], []>
  type t (line 34) | type t = intersectParameters<[("a" | "b" | "c")?], [string, 1 | 2 | 3]>
  type t (line 39) | type t = intersectParameters<[{ a: 0 }?], [{ b: 1 }?]>
  type t (line 44) | type t = intersectParameters<[{ a: 0 }?], []>
  type t (line 49) | type t = intersectParameters<{ a: 0 }[], { b: 1 }[]>
  type t (line 54) | type t = intersectParameters<[{ a: 0 }, { b: 1 }], { c: 2 }[]>
  type t (line 74) | type t = intersectParameters<
  type t (line 97) | type t = intersectParameters<
  type t (line 121) | type t = intersectParameters<
  type t (line 149) | type t = intersectParameters<["a", "b"], [string, ...string[]]>
  type t (line 157) | type t = intersectArrays<[], [string]>
  type t (line 162) | type t = intersectArrays<["a", "b"], [string, ...string[]]>
  type t (line 167) | type t = intersectArrays<[...0[], number], [...number[], 1]>
  type l (line 172) | type l = [...{ a: 1 }[], { b: 1 }]
  type r (line 173) | type r = [...{ c: 1 }[]]
  type expected (line 175) | type expected = [
  type l (line 191) | type l = [
  type r (line 202) | type r = [
  type expected (line 220) | type expected = [

FILE: ark/util/__tests__/overloads.test.ts
  type fn (line 4) | type fn = {
  type limit (line 27) | type limit = ((s: string) => string) & ((n: number) => number)
  type fromNumber (line 28) | type fromNumber = ReturnType<overloadOf<limit, [number]>>
  type result (line 36) | type result = Parameters<

FILE: ark/util/__tests__/printable.test.ts
  class Type (line 118) | class Type {
  class MyClass (line 125) | class MyClass {}

FILE: ark/util/__tests__/records.test.ts
  type Source (line 13) | interface Source {
  type Target (line 18) | interface Target {
  type Result (line 22) | type Result = withJsDoc<Target, Source>
  type Source (line 34) | interface Source {
  type Target (line 40) | interface Target {
  type Result (line 44) | type Result = withJsDoc<Target, Source>
  type Source (line 56) | interface Source {
  type Target (line 61) | interface Target {
  type Result (line 66) | type Result = withJsDoc<Target, Source>
  type Source (line 78) | interface Source {
  type Target (line 83) | interface Target {
  type Result (line 87) | type Result = withJsDoc<Target, Source>
  type t (line 99) | type t = merge<
  type t (line 115) | type t = unionToPropwiseXor<{ a: 1; b?: 2 } | { c: 3 } | { d?: 4 }>

FILE: ark/util/__tests__/traits.scratch.ts
  class Rectangle (line 4) | class Rectangle extends Trait {
    method constructor (line 8) | constructor(length: number, width: number) {
    method area (line 14) | area(): number {
    method perimeter (line 18) | perimeter(): number {
  class Rhombus (line 24) | class Rhombus extends Trait<{
    method constructor (line 34) | constructor(side: number) {
    method perimeter (line 39) | perimeter(): number {
  class Square (line 45) | class Square extends implement(
    method calculateArea (line 51) | calculateArea() {
    method constructor (line 59) | constructor(side: number) {

FILE: ark/util/__tests__/traits.test.ts
  class Describable (line 5) | class Describable extends Trait<{
    method constructor (line 12) | constructor(rule: unknown, attributes?: { description?: string }) {
  class Boundable (line 18) | class Boundable<data> extends Trait<{
    method constructor (line 23) | constructor(rule: { limit?: number }) {
    method check (line 28) | check(data: data): boolean {
  class StringChecker (line 35) | class StringChecker extends implement(Describable, Boundable<string>, {
  type Params (line 45) | type Params = ConstructorParameters<typeof StringChecker>
  class Foo (line 75) | class Foo extends Boundable<number> {
    method getFoo (line 76) | getFoo() {
  class Bar (line 80) | class Bar extends implement(Foo, {
  class A (line 90) | class A extends Trait {
  class B (line 95) | class B extends Trait<{
  class C (line 105) | class C extends compose(A, B) {
  class A (line 121) | class A extends Trait {
  class B (line 124) | class B extends Trait {
  class C (line 127) | class C extends compose(A, B) {
  class D (line 130) | class D extends Trait {
  class E (line 133) | class E extends compose(C, D) {
  class A (line 146) | class A extends Trait<{ abstractMethods: { a(): number } }> {}
  class B (line 147) | class B extends Trait<{ abstractMethods: { b(): number } }> {}

FILE: ark/util/arrays.ts
  type DuplicateData (line 6) | type DuplicateData<val = unknown> = { element: val; indices: number[] }
  type pathToString (line 59) | type pathToString<
  type join (line 69) | type join<
  type filter (line 104) | type filter<t extends array, constraint, result extends unknown[] = []> =
  type array (line 113) | type array<t = unknown> = readonly t[]
  type multiply (line 116) | type multiply<t extends array, count extends number> = _multiply<
  type _multiply (line 123) | type _multiply<
  type repeat (line 132) | type repeat<element, count extends number> = buildFromSegments<
  type buildFromSegments (line 139) | type buildFromSegments<
  type nextSegments (line 154) | type nextSegments<segments extends 1[][]> =
  type minLength (line 159) | type minLength<element, minLength extends number> = readonly [
  type listable (line 165) | type listable<t> = t | readonly t[]
  type flattenListable (line 167) | type flattenListable<t> = t extends array<infer element> ? element : t
  type longerThan (line 169) | type longerThan<t extends array, n extends number> =
  type CollapsingList (line 172) | type CollapsingList<t = unknown> =
  type headOf (line 177) | type headOf<t extends array> = t[0]
  type tailOf (line 179) | type tailOf<t extends array> =
  type lastIndexOf (line 182) | type lastIndexOf<t extends array> = tailOf<t>["length"]
  type lastOf (line 184) | type lastOf<t extends array> = t[lastIndexOf<t>]
  type initOf (line 186) | type initOf<t extends array> =
  type numericStringKeyOf (line 189) | type numericStringKeyOf<t extends array> = Extract<keyof t, `${number}`>
  type arrayIndexOf (line 191) | type arrayIndexOf<a extends array> =
  type liftArray (line 194) | type liftArray<t> =
  type AppendOptions (line 249) | type AppendOptions = {
  type appendableValue (line 284) | type appendableValue<to extends array | undefined> =
  type ComparisonOptions (line 314) | interface ComparisonOptions<t = unknown> {
  type groupableKeyOf (line 336) | type groupableKeyOf<o> =
  type groupBy (line 345) | type groupBy<element, discriminant extends groupableKeyOf<element>> = {
  type validateExhaustiveKeys (line 375) | type validateExhaustiveKeys<
  type applyElementLabels (line 387) | type applyElementLabels<
  type applyOptionalElementLabels (line 400) | type applyOptionalElementLabels<
  type applyRestElementLabels (line 413) | type applyRestElementLabels<
  type labelElement (line 422) | type labelElement<element, labels extends readonly unknown[]> =
  type labelOptionalElement (line 428) | type labelOptionalElement<element, label extends readonly unknown[]> =
  type setIndex (line 434) | type setIndex<
  type _setIndex (line 443) | type _setIndex<
  type zero (line 453) | type zero = []
  type one (line 455) | type one = [1]
  type two (line 457) | type two = [1, 1]
  type three (line 459) | type three = [...two, ...two]
  type four (line 461) | type four = [...three, ...three]
  type five (line 463) | type five = [...four, ...four]
  type six (line 465) | type six = [...five, ...five]
  type seven (line 467) | type seven = [...six, ...six]
  type eight (line 469) | type eight = [...seven, ...seven]
  type nine (line 471) | type nine = [...eight, ...eight]
  type ten (line 473) | type ten = [...nine, ...nine]
  type eleven (line 475) | type eleven = [...ten, ...ten]
  type twelve (line 477) | type twelve = [...eleven, ...eleven]
  type thirteen (line 479) | type thirteen = [...twelve, ...twelve]
  type fourteen (line 481) | type fourteen = [...thirteen, ...thirteen]
  type exponentials (line 486) | type exponentials = [
  type max (line 505) | type max<n extends number> = _max<n, exponentials>
  type _max (line 507) | type _max<n extends number, filtered extends unknown[]> =

FILE: ark/util/describe.ts
  type DescribeOptions (line 7) | type DescribeOptions = {
  type typeToString (line 12) | type typeToString<t, opts extends DescribeOptions = {}> = stringifyUnion<
  type stringifiableToString (line 29) | type stringifiableToString<
  type describe (line 38) | type describe<t> = typeToString<
  type arrayTypeToString (line 46) | type arrayTypeToString<t extends array, opts extends DescribeOptions> =
  type describeArrayOf (line 53) | type describeArrayOf<element extends string> =
  type includesDelimiter (line 56) | type includesDelimiter<s extends string, opts extends DescribeOptions> =
  type describeDefaults (line 63) | type describeDefaults = satisfy<

FILE: ark/util/domain.ts
  type JsTypeOf (line 5) | type JsTypeOf =
  type TypesByDomain (line 21) | type TypesByDomain = {
  type inferDomain (line 32) | type inferDomain<kind extends Domain> =
  type Domain (line 35) | type Domain = show<keyof TypesByDomain>
  type NullishDomain (line 37) | type NullishDomain = "undefined" | "null"
  type NonNullishDomain (line 39) | type NonNullishDomain = Exclude<Domain, NullishDomain>
  type PrimitiveDomain (line 41) | type PrimitiveDomain = Exclude<Domain, "object">
  type Primitive (line 43) | type Primitive = inferDomain<PrimitiveDomain>
  type domainOf (line 45) | type domainOf<data> =
  type domainDescriptions (line 85) | type domainDescriptions = typeof domainDescriptions
  type describeDomainOf (line 87) | type describeDomainOf<

FILE: ark/util/errors.ts
  class InternalArktypeError (line 4) | class InternalArktypeError extends Error {}
  class ParseError (line 16) | class ParseError extends Error {
  type noSuggest (line 33) | type noSuggest<s extends string = string> = ` ${s}`
  type ZeroWidthSpace (line 39) | type ZeroWidthSpace = typeof ZeroWidthSpace
  type ErrorMessage (line 41) | type ErrorMessage<message extends string = string> =
  type ErrorType (line 44) | interface ErrorType<ctx extends {} = {}> extends CastableBase<ctx> {
  type Completion (line 48) | type Completion<text extends string = string> =

FILE: ark/util/flatMorph.ts
  type objectFromListableEntries (line 7) | type objectFromListableEntries<transformed extends readonly GroupableEnt...
  type fromGroupableEntries (line 10) | type fromGroupableEntries<entries extends readonly GroupableEntry[]> = {
  type arrayFromListableEntries (line 16) | type arrayFromListableEntries<transformed extends Entry> =
  type _arrayFromListableEntries (line 20) | type _arrayFromListableEntries<
  type extractEntrySets (line 35) | type extractEntrySets<e extends listable<GroupableEntry>> =
  type extractEntries (line 38) | type extractEntries<e extends listable<Entry>> =
  type entryArgsWithIndex (line 41) | type entryArgsWithIndex<o> = {
  type numericArrayEntry (line 45) | type numericArrayEntry<a extends array> =
  type GroupedEntry (line 51) | type GroupedEntry = readonly [key: { group: Key }, value: unknown]
  type GroupableEntry (line 53) | type GroupableEntry = Entry<Key> | Entry<number> | GroupedEntry
  type ListableEntry (line 55) | type ListableEntry = listable<GroupableEntry>
  type fromMappedEntries (line 57) | type fromMappedEntries<transformed extends ListableEntry> =
  type FlatMorph (line 62) | type FlatMorph = {

FILE: ark/util/functions.ts
  type Fn (line 4) | type Fn<
  type Thunk (line 19) | type Thunk<ret = unknown> = () => ret
  type thunkable (line 21) | type thunkable<t> = t | Thunk<t>
  method constructor (line 35) | constructor(...args: [string, ...string[]]) {
  type DynamicFunction (line 52) | type DynamicFunction = new <fn extends Fn>(
  type CallableOptions (line 60) | type CallableOptions<attachments extends object> = {
  type Callable (line 66) | interface Callable<fn extends Fn, attachments extends object>
    method constructor (line 71) | constructor(
  class Callable (line 70) | class Callable<fn extends Fn, attachments extends object = {}> {
    method constructor (line 71) | constructor(
  type GuardablePredicate (line 86) | type GuardablePredicate<
  type TypeGuard (line 91) | type TypeGuard<input = unknown, narrowed extends input = input> = (

FILE: ark/util/generics.ts
  type Stringifiable (line 5) | type Stringifiable =
  type show (line 14) | type show<t> = { [k in keyof t]: t[k] } & unknown
  type evaluate (line 17) | type evaluate<t> = { [k in keyof t]: t[k] } & unknown
  type get (line 19) | type get<t, k extends PropertyKey> = t[k & keyof t]
  type exact (line 21) | type exact<t extends object, u extends object> = {
  type exactMessageOnError (line 25) | type exactMessageOnError<t extends object, u extends object> = {
  type promisable (line 30) | type promisable<t> = t | Promise<t>
  type leftIfEqual (line 32) | type leftIfEqual<l, r> = [l, r] extends [r, l] ? l : r
  type UnknownUnion (line 34) | type UnknownUnion =
  type andPreserveUnknown (line 47) | type andPreserveUnknown<l, r> =
  type anyOrNever (line 59) | type anyOrNever = " anyOrNever"
  type conform (line 61) | type conform<t, base> = t extends base ? t : base
  type equals (line 63) | type equals<l, r> = [l, r] extends [r, l] ? true : false
  type exactEquals (line 65) | type exactEquals<l, r> =
  type Brand (line 71) | type Brand<t = unknown, id = unknown> = t & {
  type unbrand (line 75) | type unbrand<t> = t extends Brand<infer base, string> ? base : never
  type satisfy (line 77) | type satisfy<base, t extends base> = t
  type defined (line 79) | type defined<t> = t & ({} | null)
  type autocomplete (line 81) | type autocomplete<suggestions extends string> =
  type widen (line 85) | type widen<t, supertypes> = collectWidenedType<
  type collectWidenedType (line 90) | type collectWidenedType<t, remaining extends unknown[], result = never> =
  type narrowTuple (line 95) | type narrowTuple<t extends readonly unknown[]> =
  type narrow (line 100) | type narrow<t> =
  type inferred (line 111) | type inferred = typeof inferred

FILE: ark/util/get.ts
  type getKey (line 4) | type getKey<o, k> =
  type getPath (line 9) | type getPath<o, path extends string> =
  type validatePath (line 13) | type validatePath<o, path extends string, prefix extends string = ""> =

FILE: ark/util/hkt.ts
  type args (line 4) | type args = typeof args
  method constructor (line 18) | constructor() {}
  type constructor (line 25) | type constructor<constraints extends unknown[] = any> =
  type args (line 28) | type args = typeof args
  type apply (line 30) | type apply<

FILE: ark/util/intersections.ts
  type AndPreserveUnknown (line 7) | interface AndPreserveUnknown extends Hkt<[unknown, unknown]> {
  type SequenceIntersectionKind (line 11) | type SequenceIntersectionKind = "array" | "parameters"
  type intersectArrays (line 13) | type intersectArrays<
  type intersectParameters (line 19) | type intersectParameters<
  type intersectSequences (line 25) | type intersectSequences<
  type isDisjoint (line 99) | type isDisjoint<l, r> = overlaps<l, r> extends true ? false : true
  type overlaps (line 101) | type overlaps<l, r> =

FILE: ark/util/isomorphic.ts
  type ArkKnownEnvVar (line 19) | type ArkKnownEnvVar = "ARK_DEBUG"

FILE: ark/util/keys.ts
  type Key (line 4) | type Key = string | symbol
  type toArkKey (line 6) | type toArkKey<o, k extends keyof o> =
  type arkIndexableOf (line 13) | type arkIndexableOf<o> =
  type arkKeyOf (line 20) | type arkKeyOf<o> =
  type arkArrayKeyOf (line 27) | type arkArrayKeyOf<a extends array> =
  type arkObjectLiteralKeyOf (line 35) | type arkObjectLiteralKeyOf<o extends object> =
  type arkGet (line 42) | type arkGet<o, k extends arkIndexableOf<o>> = o[k extends keyof o ? k
  type writeInvalidKeysMessage (line 47) | type writeInvalidKeysMessage<

FILE: ark/util/numbers.ts
  type Digit (line 4) | type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
  type NumberLiteral (line 6) | type NumberLiteral<n extends number = number> = `${n}`
  type BigintLiteral (line 8) | type BigintLiteral<n extends bigint = bigint> = `${n}n`
  type IntegerLiteral (line 10) | type IntegerLiteral<n extends bigint = bigint> = `${n}`
  type NonNegativeIntegerLiteral (line 12) | type NonNegativeIntegerLiteral<n extends bigint = bigint> =
  type CreateNumberMatcherOptions (line 30) | type CreateNumberMatcherOptions = {
  type NumericLiteralKind (line 101) | type NumericLiteralKind = "number" | "bigint" | "integer"
  type numericLiteralDescriptions (line 109) | type numericLiteralDescriptions = typeof numericLiteralDescriptions
  type writeMalformedNumericLiteralMessage (line 111) | type writeMalformedNumericLiteralMessage<
  type ValidationKind (line 125) | type ValidationKind = "number" | "integer"
  type tryParseNumber (line 147) | type tryParseNumber<token extends string, messageOnFail extends string> =
  type parseNumber (line 154) | type parseNumber<token extends string> =
  type tryParseInteger (line 166) | type tryParseInteger<
  type parseInteger (line 176) | type parseInteger<token extends string> =
  type parseNonNegativeInteger (line 183) | type parseNonNegativeInteger<token extends string> =
  type NumericParseOptions (line 186) | type NumericParseOptions<errorOnFail extends boolean | string> = {

FILE: ark/util/objectKinds.ts
  type ecmascriptConstructors (line 25) | type ecmascriptConstructors = typeof ecmascriptConstructors
  type EcmascriptObjects (line 28) | type EcmascriptObjects = satisfy<
  type platformConstructors (line 51) | type platformConstructors = {
  type PlatformObjects (line 76) | type PlatformObjects = instantiateConstructors<
  type typedArrayConstructors (line 94) | type typedArrayConstructors = typeof typedArrayConstructors
  type TypedArrayObjects (line 96) | type TypedArrayObjects = instantiateConstructors<
  type builtinConstructors (line 111) | type builtinConstructors = typeof builtinConstructors
  type BuiltinObjectKind (line 113) | type BuiltinObjectKind = keyof builtinConstructors
  type GlobalName (line 115) | type GlobalName = keyof typeof globalThis
  type instantiateConstructors (line 117) | type instantiateConstructors<kind extends BuiltinObjectKind> = {
  type BuiltinObjects (line 128) | type BuiltinObjects = instantiateConstructors<BuiltinObjectKind>
  type objectKindOf (line 130) | type objectKindOf<data extends object> =
  type describeObject (line 136) | type describeObject<
  type instantiableObjectKind (line 147) | type instantiableObjectKind<data extends object> = {
  type objectKindOrDomainOf (line 179) | type objectKindOrDomainOf<data> =
  type objectKindDescriptions (line 243) | type objectKindDescriptions = typeof objectKindDescriptions
  type Constructor (line 262) | type Constructor<instance = {}> = abstract new (
  type instanceOf (line 266) | type instanceOf<constructor> =
  type normalizedKeyOf (line 282) | type normalizedKeyOf<t> =

FILE: ark/util/path.ts
  type StringifyPathOptions (line 7) | type StringifyPathOptions<stringifiable = PropertyKey> = requireKeys<
  type StringifyPathFn (line 15) | type StringifyPathFn = <stringifiable>(
  type AppendStringifiedKeyFn (line 22) | type AppendStringifiedKeyFn = <stringifiable>(
  class ReadonlyPath (line 70) | class ReadonlyPath extends ReadonlyArray<PropertyKey> {
    method constructor (line 78) | constructor(...items: array<PropertyKey>) {
    method toJSON (line 84) | toJSON(): JsonArray {
    method stringify (line 96) | stringify(): string {
    method stringifyAncestors (line 101) | stringifyAncestors(): readonly string[] {

FILE: ark/util/primitive.ts
  type SerializedString (line 4) | type SerializedString<value extends string = string> = `"${value}"`
  type SerializedPrimitives (line 6) | type SerializedPrimitives = {
  type SerializedPrimitive (line 15) | type SerializedPrimitive =
  type SerializablePrimitive (line 18) | type SerializablePrimitive = inferDomain<keyof SerializedPrimitives>
  type serializePrimitive (line 27) | type serializePrimitive<value extends SerializablePrimitive> =

FILE: ark/util/records.ts
  type Dict (line 10) | type Dict<k extends string = string, v = unknown> = {
  type dict (line 14) | type dict<v = unknown, k extends string = string> = {
  type propwiseXor (line 23) | type propwiseXor<a, b> =
  type unionToPropwiseXor (line 27) | type unionToPropwiseXor<
  type requireKeys (line 40) | type requireKeys<o, key extends keyof o> = o & {
  type require (line 44) | type require<o, maxDepth extends number = 1> = _require<o, [], maxDepth>
  type _require (line 46) | type _require<o, depth extends 1[], maxDepth extends number> =
  type PartialRecord (line 56) | type PartialRecord<k extends PropertyKey = PropertyKey, v = unknown> = {
  type isSafelyMappable (line 63) | type isSafelyMappable<t> =
  type KeySet (line 66) | type KeySet<key extends string = string> = { readonly [_ in key]?: 1 }
  type keySetOf (line 68) | type keySetOf<o extends object> = KeySet<Extract<keyof o, string>>
  type mutable (line 70) | type mutable<o, maxDepth extends number = 1> = _mutable<o, [], maxDepth>
  type _mutable (line 72) | type _mutable<o, depth extends 1[], maxDepth extends number> =
  type entryOf (line 84) | type entryOf<o> = {
  type entriesOf (line 89) | type entriesOf<o extends object> = entryOf<o>[]
  type Entry (line 98) | type Entry<
  type fromEntries (line 103) | type fromEntries<entries extends readonly Entry[]> = show<{
  type keyOf (line 112) | type keyOf<o> =
  type unionKeyOf (line 132) | type unionKeyOf<t> = t extends unknown ? keyof t : never
  type extractKeyed (line 134) | type extractKeyed<o extends object, k extends unionKeyOf<o>> = Extract<
  type extractDefinedKey (line 144) | type extractDefinedKey<o extends object, k extends unionKeyOf<o>> = show<
  type requiredKeyOf (line 155) | type requiredKeyOf<o> =
  type optionalKeyOf (line 164) | type optionalKeyOf<o> = Exclude<keyof o, requiredKeyOf<o>>
  type merge (line 166) | type merge<base, props> =
  type override (line 175) | type override<
  type propValueOf (line 180) | type propValueOf<o> = o[keyof o]
  class Covariant (line 184) | class Covariant<t> {
  type DynamicBase (line 198) | interface DynamicBase<t extends object> extends t, Covariant<t> {}
    method constructor (line 200) | constructor(properties: t) {
  class DynamicBase (line 199) | class DynamicBase<t extends object> {
    method constructor (line 200) | constructor(properties: t) {
  class CastableBase (line 208) | class CastableBase<t extends object> extends NoopBase<t> {
  type pick (line 241) | type pick<o, key extends keyof o> =
  type omit (line 268) | type omit<o, key extends keyof o> = {
  type ifEmptyObjectLiteral (line 278) | type ifEmptyObjectLiteral<t, onTrue = true, onFalse = false> =
  type EmptyObject (line 283) | type EmptyObject = Record<PropertyKey, never>
  type invert (line 314) | type invert<t extends Record<PropertyKey, PropertyKey>> = {
  type unset (line 326) | type unset = typeof unset
  type withJsDoc (line 332) | type withJsDoc<o, jsDocSource> = show<
  type _withJsDoc (line 342) | type _withJsDoc<o, jsDocSource> = {
  type propertyDescriptorsOf (line 346) | type propertyDescriptorsOf<o extends object> = {
  type keyWithValue (line 350) | type keyWithValue<t, constraint> =

FILE: ark/util/registry.ts
  type InitialRegistryContents (line 19) | type InitialRegistryContents = typeof initialRegistryContents
  type ArkRegistry (line 21) | interface ArkRegistry extends InitialRegistryContents {
  type ArkEnv (line 28) | interface ArkEnv {
  type prototypes (line 33) | type prototypes = ReturnType<ArkEnv["prototypes"]>

FILE: ark/util/scanner.ts
  class Scanner (line 4) | class Scanner<lookahead extends string = string> {
    method constructor (line 9) | constructor(def: string) {
    method shift (line 16) | shift(): this["lookahead"] {
    method lookahead (line 20) | get lookahead(): lookahead {
    method nextLookahead (line 24) | get nextLookahead(): string {
    method length (line 28) | get length(): number {
    method shiftUntil (line 32) | shiftUntil(condition: Scanner.UntilCondition): string {
    method shiftUntilEscapable (line 41) | shiftUntilEscapable(condition: Scanner.UntilCondition): string {
    method shiftUntilLookahead (line 55) | shiftUntilLookahead(charOrSet: string | KeySet): string {
    method shiftUntilNonWhitespace (line 61) | shiftUntilNonWhitespace(): string {
    method jumpToIndex (line 65) | jumpToIndex(i: number): void {
    method jumpForward (line 69) | jumpForward(count: number): void {
    method location (line 73) | get location(): number {
    method unscanned (line 77) | get unscanned(): string {
    method scanned (line 81) | get scanned(): string {
    method sliceChars (line 85) | sliceChars(start: number, end?: number): string {
    method lookaheadIs (line 89) | lookaheadIs<char extends lookahead>(char: char): this is Scanner<char> {
    method lookaheadIsIn (line 93) | lookaheadIsIn<keySet extends KeySet>(
  type UntilCondition (line 101) | type UntilCondition = (scanner: Scanner, shifted: string) => boolean
  type shift (line 103) | type shift<
  type shiftUntil (line 108) | type shiftUntil<
  type shiftUntilEscapable (line 119) | type shiftUntilEscapable<
  type shiftUntilNot (line 148) | type shiftUntilNot<
  type skipWhitespace (line 159) | type skipWhitespace<unscanned extends string> = shiftUntilNot<
  type shiftResult (line 164) | type shiftResult<scanned extends string, unscanned extends string> = [
  type writeUnmatchedGroupCloseMessage (line 179) | type writeUnmatchedGroupCloseMessage<
  type writeUnclosedGroupMessage (line 188) | type writeUnclosedGroupMessage<missingChar extends string> =

FILE: ark/util/serialize.ts
  type SerializationOptions (line 7) | type SerializationOptions = {
  type JsonStructure (line 15) | type JsonStructure = JsonObject | JsonArray
  type JsonObject (line 17) | interface JsonObject {
  type JsonArray (line 21) | type JsonArray = Json[]
  type JsonPrimitive (line 23) | type JsonPrimitive = string | boolean | number | null
  type Json (line 25) | type Json = JsonStructure | JsonPrimitive
  type snapshot (line 41) | type snapshot<t, depth extends 1[] = []> =
  type snapshotPrimitive (line 53) | type snapshotPrimitive<t> = t extends symbol ? `Symbol(${string})` : t
  type PrintableOptions (line 55) | type PrintableOptions = {

FILE: ark/util/strings.ts
  type firstChar (line 9) | type firstChar<s extends string> =
  type charsAfterFirst (line 12) | type charsAfterFirst<s extends string> =
  type lastChar (line 15) | type lastChar<s extends string> =
  type charsBeforeLast (line 22) | type charsBeforeLast<s extends string> =
  type contains (line 29) | type contains<s extends string, sub extends string> =
  type Backslash (line 68) | type Backslash = typeof Backslash
  type WhitespaceChar (line 76) | type WhitespaceChar = keyof typeof whitespaceChars
  type trim (line 78) | type trim<s extends string> = trimEnd<trimStart<s>>
  type trimStart (line 80) | type trimStart<s extends string> =
  type trimEnd (line 83) | type trimEnd<s extends string> =
  type isStringLiteral (line 87) | type isStringLiteral<t> =

FILE: ark/util/traits.ts
  type TraitImplementation (line 9) | type TraitImplementation = <
  type TraitComposition (line 28) | type TraitComposition = <
  type TraitDeclaration (line 61) | type TraitDeclaration = {
  method [Symbol.hasInstance] (line 81) | static get [Symbol.hasInstance](): (o: unknown) => boolean {
  method traitsOf (line 85) | traitsOf(): readonly TraitConstructor[] {
  type TraitConstructor (line 147) | type TraitConstructor<
  type CompositionState (line 162) | type CompositionState = {
  type TraitCompositionKind (line 174) | type TraitCompositionKind = "abstract" | "implementation"
  type composeTraits (line 176) | type composeTraits<
  type intersectImplementations (line 191) | type intersectImplementations<l, r> = {
  type _compose (line 202) | type _compose<s extends CompositionState> =
  type finalizeState (line 241) | type finalizeState<s extends CompositionState> = satisfy<
  type implementationOf (line 256) | type implementationOf<s extends CompositionState> =

FILE: ark/util/unionToTuple.ts
  type stringifyUnion (line 5) | type stringifyUnion<
  type unionToTuple (line 10) | type unionToTuple<t> =
  type _unionToTuple (line 13) | type _unionToTuple<t, result extends unknown[]> =
  type getLastBranch (line 20) | type getLastBranch<t> =
  type intersectUnion (line 27) | type intersectUnion<t> =
  type intersectOverloadReturns (line 34) | type intersectOverloadReturns<fn extends Fn> = intersectUnion<
  type overloadOf (line 39) | type overloadOf<
  type collectSignatures (line 56) | type collectSignatures<fn, givenArgs extends array, result> =
Condensed preview — 550 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,318K chars).
[
  {
    "path": ".cursor/commands/armstrong.md",
    "chars": 410,
    "preview": "senator armstrong is reviewing the work on the current branch and he's angry. he will destroy both of us if he finds a s"
  },
  {
    "path": ".github/CODE_OF_CONDUCT.md",
    "chars": 5481,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "chars": 4808,
    "preview": "# Contributing\n\nArkType values the time of its users and contributors as much as its maintainers, so our goal is for the"
  },
  {
    "path": ".github/FUNDING.yml",
    "chars": 97,
    "preview": "github: [arktypeio]\ndrips:\n  ethereum:\n    ownedBy: \"0xD5c5Fe5DF95adf8DA1Ae640fCAE8f72795657fa5\"\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 1101,
    "preview": "---\nname: Bug\nabout: Report a bug\ntitle: \"\"\nlabels: \"bug\"\nassignees: \"ssalbdivad\"\n---\n\n# Report a bug\n\n### 🔎 Search Term"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "chars": 527,
    "preview": "---\nname: Feature Request\nabout: Suggest a new feature\ntitle: \"\"\nlabels: \"\"\nassignees: \"\"\n---\n\n# Request a feature\n\n<!--"
  },
  {
    "path": ".github/SECURITY.md",
    "chars": 369,
    "preview": "# Security Policy\n\n## Supported Versions\n\n| Version | Supported          |\n| ------- | ------------------ |\n| 2.x     | "
  },
  {
    "path": ".github/actions/setup/action.yml",
    "chars": 666,
    "preview": "name: Setup repo\ndescription: Install dependencies and perform setup for https://github.com/arktypeio/arktype\n\ninputs:\n "
  },
  {
    "path": ".github/pull_request_template.md",
    "chars": 355,
    "preview": "<!--\nThank you for submitting a pull request!\n\nPlease verify that:\n\n* [ ] Code is up-to-date with the `main` branch\n* [ "
  },
  {
    "path": ".github/workflows/pr.yml",
    "chars": 1237,
    "preview": "name: pr\n\non:\n  pull_request:\n    branches: [main]\n\ndefaults:\n  run:\n    shell: bash\n\njobs:\n  core:\n    runs-on: ubuntu-"
  },
  {
    "path": ".github/workflows/publish.yml",
    "chars": 1634,
    "preview": "name: publish\n\non:\n  push:\n    branches: [main]\n\n  # Allows you to run this workflow manually from the Actions tab on Gi"
  },
  {
    "path": ".github/workflows/pullfrog.yml",
    "chars": 1032,
    "preview": "# PULLFROG ACTION — DO NOT EDIT EXCEPT WHERE INDICATED\nname: Pullfrog\nrun-name: ${{ inputs.name || github.workflow }}\non"
  },
  {
    "path": ".gitignore",
    "chars": 142,
    "preview": "dist\nout\n*.vsix\nnode_modules\ntemp\ntmp\n*.temp.*\n*.log\n*.tsbuildinfo\n.DS_Store\n.next\n.source\n.cache-loader\n.attest\ntsconfi"
  },
  {
    "path": ".vscode/extensions.json",
    "chars": 357,
    "preview": "{\n\t\"recommendations\": [\n\t\t\"esbenp.prettier-vscode\",\n\t\t\"dbaeumer.vscode-eslint\",\n\t\t// Run/debug tests inline via VSCode's"
  },
  {
    "path": ".vscode/launch.json",
    "chars": 522,
    "preview": "// A launch configuration that launches the extension inside a new window\n{\n\t\"version\": \"0.1.0\",\n\t\"configurations\": [\n\t\t"
  },
  {
    "path": ".vscode/settings.json",
    "chars": 1730,
    "preview": "{\n\t\"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n\t\"prettier.prettierPath\": \"./node_modules/prettier\",\n\t\"biome.ena"
  },
  {
    "path": "LICENSE",
    "chars": 1047,
    "preview": "Copyright 2025 ArkType\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software an"
  },
  {
    "path": "ark/attest/CHANGELOG.md",
    "chars": 7487,
    "preview": "# @ark/attest\n\nNOTE: This changelog is incomplete, but will include notable attest-specific changes (many updates consis"
  },
  {
    "path": "ark/attest/README.md",
    "chars": 13322,
    "preview": "# Attest\n\nAttest is a testing library that makes your TypeScript types available at runtime, giving you access to precis"
  },
  {
    "path": "ark/attest/__tests__/assertions.test.ts",
    "chars": 4727,
    "preview": "import { attest } from \"@ark/attest\"\nimport { MissingSnapshotError } from \"@ark/attest/internal/assert/assertions.ts\"\nim"
  },
  {
    "path": "ark/attest/__tests__/benchExpectedOutput.ts",
    "chars": 1155,
    "preview": "import { bench } from \"@ark/attest\"\nimport type { makeComplexType as externalmakeComplexType } from \"./utils.ts\"\n\nconst "
  },
  {
    "path": "ark/attest/__tests__/benchTemplate.ts",
    "chars": 996,
    "preview": "import { bench } from \"@ark/attest\"\nimport type { makeComplexType as externalmakeComplexType } from \"./utils.ts\"\n\nconst "
  },
  {
    "path": "ark/attest/__tests__/completions.test.ts",
    "chars": 1600,
    "preview": "import { attest, contextualize } from \"@ark/attest\"\nimport { hasDomain, type domainDescriptions } from \"@ark/util\"\nimpor"
  },
  {
    "path": "ark/attest/__tests__/demo.test.ts",
    "chars": 2758,
    "preview": "import {\n\tattest,\n\tcontextualize,\n\tgetPrimaryTsVersionUnderTest\n} from \"@ark/attest\"\nimport { type } from \"arktype\"\n\ncon"
  },
  {
    "path": "ark/attest/__tests__/externalSnapshots.test.ts",
    "chars": 2323,
    "preview": "import { attest, contextualize } from \"@ark/attest\"\nimport { attestInternal } from \"@ark/attest/internal/assert/attest.t"
  },
  {
    "path": "ark/attest/__tests__/functions.test.ts",
    "chars": 2685,
    "preview": "import { attest, contextualize } from \"@ark/attest\"\nimport { fileName } from \"@ark/fs\"\nimport * as assert from \"node:ass"
  },
  {
    "path": "ark/attest/__tests__/instantiations.test.ts",
    "chars": 593,
    "preview": "import { attest, contextualize } from \"@ark/attest\"\nimport { type } from \"arktype\"\nimport { it } from \"mocha\"\n\ncontextua"
  },
  {
    "path": "ark/attest/__tests__/satisfies.test.ts",
    "chars": 467,
    "preview": "import { attest, contextualize } from \"@ark/attest\"\nimport { nonOverlappingSatisfiesMessage } from \"@ark/attest/internal"
  },
  {
    "path": "ark/attest/__tests__/snap.test.ts",
    "chars": 2277,
    "preview": "import { attest, contextualize } from \"@ark/attest\"\nimport * as assert from \"node:assert/strict\"\n\nconst o = { re: \"do\" }"
  },
  {
    "path": "ark/attest/__tests__/snapExpectedOutput.ts",
    "chars": 1697,
    "preview": "import { attest, cleanup, setup } from \"@ark/attest\"\nimport type { makeComplexType } from \"./utils.ts\"\n\nsetup({ typeToSt"
  },
  {
    "path": "ark/attest/__tests__/snapPopulation.test.ts",
    "chars": 716,
    "preview": "import { contextualize } from \"@ark/attest\"\nimport { fromHere, readFile } from \"@ark/fs\"\nimport { equal } from \"node:ass"
  },
  {
    "path": "ark/attest/__tests__/snapTemplate.ts",
    "chars": 1232,
    "preview": "import { attest, cleanup, setup } from \"@ark/attest\"\nimport type { makeComplexType } from \"./utils.ts\"\n\nsetup({ typeToSt"
  },
  {
    "path": "ark/attest/__tests__/unwrap.test.ts",
    "chars": 762,
    "preview": "import { attest, contextualize } from \"@ark/attest\"\nimport type { Completions } from \"@ark/attest/internal/cache/writeAs"
  },
  {
    "path": "ark/attest/__tests__/utils.ts",
    "chars": 788,
    "preview": "import { dirName, fromHere, readFile, shell } from \"@ark/fs\"\nimport { copyFileSync, rmSync } from \"node:fs\"\n\nexport cons"
  },
  {
    "path": "ark/attest/assert/assertions.ts",
    "chars": 5668,
    "preview": "import { printable, throwInternalError } from \"@ark/util\"\nimport type { type } from \"arktype\"\nimport * as assert from \"n"
  },
  {
    "path": "ark/attest/assert/attest.ts",
    "chars": 2903,
    "preview": "import { caller, getCallStack, type SourcePosition } from \"@ark/fs\"\nimport type { ErrorMessage } from \"@ark/util\"\nimport"
  },
  {
    "path": "ark/attest/assert/chainableAssertions.ts",
    "chars": 10830,
    "preview": "import { caller, positionToString } from \"@ark/fs\"\nimport {\n\tprintable,\n\tsnapshot,\n\ttype Constructor,\n\ttype ErrorType,\n\t"
  },
  {
    "path": "ark/attest/bench/await1k.ts",
    "chars": 12077,
    "preview": "export const await1K = async (fn: () => Promise<void>): Promise<void> => {\n\tawait fn()\n\tawait fn()\n\tawait fn()\n\tawait fn"
  },
  {
    "path": "ark/attest/bench/baseline.ts",
    "chars": 3205,
    "preview": "import { snapshot, throwInternalError } from \"@ark/util\"\nimport process from \"node:process\"\nimport { throwAssertionError"
  },
  {
    "path": "ark/attest/bench/bench.ts",
    "chars": 9528,
    "preview": "import { caller, getCallStack, rmRf, type SourcePosition } from \"@ark/fs\"\nimport { performance } from \"node:perf_hooks\"\n"
  },
  {
    "path": "ark/attest/bench/call1k.ts",
    "chars": 6052,
    "preview": "export const call1K = (fn: () => void): void => {\n\tfn()\n\tfn()\n\tfn()\n\tfn()\n\tfn()\n\tfn()\n\tfn()\n\tfn()\n\tfn()\n\tfn()\n\tfn()\n\tfn("
  },
  {
    "path": "ark/attest/bench/measure.ts",
    "chars": 2361,
    "preview": "import type { StatName } from \"./bench.ts\"\n\ntype MeasureUnit = TimeUnit | TypeUnit\n\nexport type Measure<Unit extends Mea"
  },
  {
    "path": "ark/attest/bench/type.ts",
    "chars": 2538,
    "preview": "import { caller } from \"@ark/fs\"\nimport { throwInternalError } from \"@ark/util\"\nimport ts from \"typescript\"\nimport { get"
  },
  {
    "path": "ark/attest/cache/getCachedAssertions.ts",
    "chars": 3923,
    "preview": "import { readJson, type LinePosition, type SourcePosition } from \"@ark/fs\"\nimport { existsSync, readdirSync } from \"node"
  },
  {
    "path": "ark/attest/cache/snapshots.ts",
    "chars": 6831,
    "preview": "import {\n\tfilePath,\n\tpositionToString,\n\treadFile,\n\treadJson,\n\tshell,\n\twriteFile,\n\twriteJson,\n\ttype SourcePosition\n} from"
  },
  {
    "path": "ark/attest/cache/ts.ts",
    "chars": 8864,
    "preview": "import { fromCwd, readFile, type SourcePosition } from \"@ark/fs\"\nimport { printable, throwError, throwInternalError, typ"
  },
  {
    "path": "ark/attest/cache/utils.ts",
    "chars": 6631,
    "preview": "import { filePath } from \"@ark/fs\"\nimport { throwInternalError } from \"@ark/util\"\nimport * as tsvfs from \"@typescript/vf"
  },
  {
    "path": "ark/attest/cache/writeAssertionCache.ts",
    "chars": 10165,
    "preview": "import type { LinePosition } from \"@ark/fs\"\nimport { flatMorph } from \"@ark/util\"\nimport ts from \"typescript\"\n\nimport { "
  },
  {
    "path": "ark/attest/cli/cli.ts",
    "chars": 1039,
    "preview": "#!/usr/bin/env node\nimport { fileName } from \"@ark/fs\"\nimport { basename } from \"node:path\"\nimport { precache } from \"./"
  },
  {
    "path": "ark/attest/cli/precache.ts",
    "chars": 300,
    "preview": "import { ensureDir } from \"@ark/fs\"\nimport { join } from \"node:path\"\nimport { writeAssertionData } from \"../fixtures.ts\""
  },
  {
    "path": "ark/attest/cli/shared.ts",
    "chars": 129,
    "preview": "export const baseDiagnosticTscCmd =\n\t\"npm exec -- tsc --noEmit --extendedDiagnostics --incremental false --tsBuildInfoFi"
  },
  {
    "path": "ark/attest/cli/stats.ts",
    "chars": 1985,
    "preview": "import { execSync } from \"node:child_process\"\nimport { baseDiagnosticTscCmd } from \"./shared.ts\"\n\nexport const stats = ("
  },
  {
    "path": "ark/attest/cli/trace.ts",
    "chars": 23548,
    "preview": "import { ensureDir, getShellOutput, readJson, writeFile } from \"@ark/fs\"\nimport type { ExecException } from \"node:child_"
  },
  {
    "path": "ark/attest/config.ts",
    "chars": 6292,
    "preview": "import { ensureDir, fromCwd } from \"@ark/fs\"\nimport {\n\tisArray,\n\tliftArray,\n\ttryParseNumber,\n\ttype autocomplete\n} from \""
  },
  {
    "path": "ark/attest/fixtures.ts",
    "chars": 1734,
    "preview": "import { fileName, shell, writeJson } from \"@ark/fs\"\nimport { rmSync } from \"node:fs\"\nimport { join } from \"node:path\"\ni"
  },
  {
    "path": "ark/attest/index.ts",
    "chars": 747,
    "preview": "export { cleanup, setup, teardown, writeAssertionData } from \"./fixtures.ts\"\n// ensure fixtures are exported before conf"
  },
  {
    "path": "ark/attest/package.json",
    "chars": 1176,
    "preview": "{\n\t\"name\": \"@ark/attest\",\n\t\"version\": \"0.56.0\",\n\t\"license\": \"MIT\",\n\t\"author\": {\n\t\t\"name\": \"David Blass\",\n\t\t\"email\": \"dav"
  },
  {
    "path": "ark/attest/tsVersioning.ts",
    "chars": 6065,
    "preview": "import { assertPackageRoot, findPackageAncestors, readJson } from \"@ark/fs\"\nimport type { Digit } from \"@ark/util\"\nimpor"
  },
  {
    "path": "ark/attest/utils.ts",
    "chars": 2225,
    "preview": "import { caller } from \"@ark/fs\"\nimport { throwError } from \"@ark/util\"\nimport { basename, relative } from \"node:path\"\n\n"
  },
  {
    "path": "ark/docs/.turbo/daemon/a6661884d53fb864-turbo.log.2025-10-05",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "ark/docs/README.md",
    "chars": 592,
    "preview": "# my-app\n\nThis is a Next.js application generated with\n[Create Fumadocs](https://github.com/fuma-nama/fumadocs).\n\nRun de"
  },
  {
    "path": "ark/docs/app/(home)/layout.tsx",
    "chars": 465,
    "preview": "import { HomeLayout } from \"fumadocs-ui/layouts/home\"\nimport type { ReactNode } from \"react\"\nimport { FloatYourBoat } fr"
  },
  {
    "path": "ark/docs/app/(home)/page.tsx",
    "chars": 2630,
    "preview": "import {\n\tFunnelIcon,\n\tLightbulbIcon,\n\tMessageCircleWarning,\n\tRocketIcon,\n\tSearchIcon\n} from \"lucide-react\"\nimport { Ark"
  },
  {
    "path": "ark/docs/app/api/search/route.ts",
    "chars": 543,
    "preview": "import {\n\tcreateSearchAPI,\n\ttype AdvancedIndex\n} from \"fumadocs-core/search/server\"\nimport { source } from \"../../../lib"
  },
  {
    "path": "ark/docs/app/discord/page.tsx",
    "chars": 283,
    "preview": "import { redirect } from \"next/navigation\"\nimport { defineMetadata } from \"../metadata.ts\"\n\nexport const metadata = defi"
  },
  {
    "path": "ark/docs/app/docs/[[...slug]]/page.tsx",
    "chars": 2687,
    "preview": "import { Popup, PopupContent, PopupTrigger } from \"fumadocs-twoslash/ui\"\nimport { CodeBlock, Pre } from \"fumadocs-ui/com"
  },
  {
    "path": "ark/docs/app/docs/layout.tsx",
    "chars": 475,
    "preview": "import { DocsLayout } from \"fumadocs-ui/layouts/docs\"\nimport type { ReactNode } from \"react\"\nimport { source } from \"../"
  },
  {
    "path": "ark/docs/app/global-error.tsx",
    "chars": 3102,
    "preview": "\"use client\"\n\nimport { useEffect } from \"react\"\n\nexport type GlobalErrorProps = {\n\terror: Error & { digest?: string }\n\tr"
  },
  {
    "path": "ark/docs/app/global.css",
    "chars": 7561,
    "preview": "@import \"tailwindcss\";\n@import \"fumadocs-ui/css/ocean.css\";\n@import \"fumadocs-ui/css/preset.css\";\n\n@source '../node_modu"
  },
  {
    "path": "ark/docs/app/layout.config.tsx",
    "chars": 830,
    "preview": "import {\n\tSiBluesky,\n\tSiDiscord,\n\tSiTwitch,\n\tSiX\n} from \"@icons-pack/react-simple-icons\"\nimport type { BaseLayoutProps }"
  },
  {
    "path": "ark/docs/app/layout.tsx",
    "chars": 1215,
    "preview": "import \"fumadocs-twoslash/twoslash.css\"\nimport { RootProvider } from \"fumadocs-ui/provider\"\nimport { Atkinson_Hyperlegib"
  },
  {
    "path": "ark/docs/app/metadata.ts",
    "chars": 891,
    "preview": "import type { Metadata } from \"next\"\n\nexport type MetadataOptions = {\n\ttitle?: string\n\togImage?: string\n}\n\nexport const "
  },
  {
    "path": "ark/docs/app/playground/page.tsx",
    "chars": 986,
    "preview": "import { HomeLayout } from \"fumadocs-ui/layouts/home\"\nimport type { ReactNode } from \"react\"\nimport { FloatYourBoat } fr"
  },
  {
    "path": "ark/docs/app/providers.tsx",
    "chars": 507,
    "preview": "\"use client\"\n\nimport posthog from \"posthog-js\"\nimport { PostHogProvider } from \"posthog-js/react\"\n\nif (\n\tglobalThis.wind"
  },
  {
    "path": "ark/docs/components/AnchorAliases.tsx",
    "chars": 400,
    "preview": "import React from \"react\"\n\nexport declare namespace AnchorAliases {\n\texport type Props = Record<string, true | undefined"
  },
  {
    "path": "ark/docs/components/ApiTable.tsx",
    "chars": 2717,
    "preview": "import type { ApiGroup, ParsedJsDocPart } from \"../../repo/jsdocGen.ts\"\nimport { apiDocsByGroup } from \"./apiData.ts\"\nim"
  },
  {
    "path": "ark/docs/components/ArkCard.tsx",
    "chars": 662,
    "preview": "import { cx } from \"class-variance-authority\"\nimport { Card, type CardProps, Cards } from \"fumadocs-ui/components/card\"\n"
  },
  {
    "path": "ark/docs/components/AutoplayDemo.tsx",
    "chars": 3176,
    "preview": "\"use client\"\n\nimport { ArrowRightLeftIcon, ExpandIcon } from \"lucide-react\"\nimport { useEffect, useRef, useState } from "
  },
  {
    "path": "ark/docs/components/Badge.tsx",
    "chars": 1018,
    "preview": "import { cva, cx, type VariantProps } from \"class-variance-authority\"\nimport * as React from \"react\"\n\nexport const badge"
  },
  {
    "path": "ark/docs/components/Banner.tsx",
    "chars": 4526,
    "preview": "\"use client\"\nimport { cx } from \"class-variance-authority\"\nimport { buttonVariants } from \"fumadocs-ui/components/ui/but"
  },
  {
    "path": "ark/docs/components/Button.tsx",
    "chars": 2257,
    "preview": "import { cx } from \"class-variance-authority\"\nimport Link from \"next/link\"\nimport { type ComponentPropsWithoutRef, forwa"
  },
  {
    "path": "ark/docs/components/CodeBlock.tsx",
    "chars": 2734,
    "preview": "import { throwInternalError, type propwiseXor } from \"@ark/util\"\nimport { cx } from \"class-variance-authority\"\nimport ty"
  },
  {
    "path": "ark/docs/components/FloatYourBoat.tsx",
    "chars": 794,
    "preview": "\"use client\"\n\nimport { BoatIcon } from \"./icons/boat.tsx\"\nimport { cx } from \"class-variance-authority\"\n\nexport const Fl"
  },
  {
    "path": "ark/docs/components/GhStarButton.tsx",
    "chars": 1493,
    "preview": "\"use client\"\n\nimport { cx } from \"class-variance-authority\"\nimport { Star } from \"lucide-react\"\nimport React, { useEffec"
  },
  {
    "path": "ark/docs/components/Head.tsx",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "ark/docs/components/Hero.tsx",
    "chars": 1495,
    "preview": "import { ArrowRightIcon, PlayIcon } from \"lucide-react\"\nimport { MainAutoplayDemo } from \"./AutoplayDemo.tsx\"\nimport { B"
  },
  {
    "path": "ark/docs/components/InstallationTabs.tsx",
    "chars": 695,
    "preview": "import { Tab, Tabs } from \"fumadocs-ui/components/tabs\"\nimport { CodeBlock } from \"./CodeBlock.tsx\"\n\nconst installers = "
  },
  {
    "path": "ark/docs/components/KeywordTable.tsx",
    "chars": 2446,
    "preview": "import { append, entriesOf, flatMorph } from \"@ark/util\"\nimport { ark, Generic } from \"arktype\"\nimport { arkPrototypes }"
  },
  {
    "path": "ark/docs/components/LinkCard.tsx",
    "chars": 812,
    "preview": "import { cx } from \"class-variance-authority\"\nimport { Card } from \"fumadocs-ui/components/card\"\nimport { ArrowRight } f"
  },
  {
    "path": "ark/docs/components/LocalFriendlyUrl.tsx",
    "chars": 725,
    "preview": "\"use client\"\nimport { useEffect, useState } from \"react\"\n\nexport interface LocalFriendlyUrlProps {\n\tchildren: string\n\tur"
  },
  {
    "path": "ark/docs/components/PlatformCloud.tsx",
    "chars": 1811,
    "preview": "\"use client\"\n\nimport { BunIcon } from \"./icons/bun.tsx\"\nimport { ChromiumIcon } from \"./icons/chromium.tsx\"\nimport { Den"
  },
  {
    "path": "ark/docs/components/ReleaseBanner.tsx",
    "chars": 326,
    "preview": "\"use client\"\n\nimport { usePathname } from \"next/navigation.js\"\nimport { Banner } from \"./Banner.tsx\"\n\nconst text = \"🎉 In"
  },
  {
    "path": "ark/docs/components/RuntimeBenchmarksGraph.tsx",
    "chars": 2019,
    "preview": "import { cx } from \"class-variance-authority\"\nimport React from \"react\"\n\nconst barStyles: React.CSSProperties = {\n\theigh"
  },
  {
    "path": "ark/docs/components/SyntaxTabs.tsx",
    "chars": 1246,
    "preview": "import type { omit, unionToPropwiseXor } from \"@ark/util\"\nimport { Tab, Tabs, type TabsProps } from \"fumadocs-ui/compone"
  },
  {
    "path": "ark/docs/components/apiData.ts",
    "chars": 37407,
    "preview": "import type { ApiDocsByGroup } from \"../../repo/jsdocGen.ts\"\n\n/** THIS FILE IS AUTOGENERATED FROM ark/repo/jsdocGen.ts *"
  },
  {
    "path": "ark/docs/components/dts/regex.ts",
    "chars": 33972,
    "preview": "/** THIS FILE IS AUTOGENERATED FROM ark/repo/dtsGen.ts **/\n// prettier-ignore\nexport const regexDts = \"declare module \\\""
  },
  {
    "path": "ark/docs/components/dts/schema.ts",
    "chars": 138650,
    "preview": "/** THIS FILE IS AUTOGENERATED FROM ark/repo/dtsGen.ts **/\n// prettier-ignore\nexport const schemaDts = \"declare module \\"
  },
  {
    "path": "ark/docs/components/dts/type.ts",
    "chars": 215528,
    "preview": "/** THIS FILE IS AUTOGENERATED FROM ark/repo/dtsGen.ts **/\n// prettier-ignore\nexport const typeDts = \"declare module \\\"a"
  },
  {
    "path": "ark/docs/components/dts/util.ts",
    "chars": 70081,
    "preview": "/** THIS FILE IS AUTOGENERATED FROM ark/repo/dtsGen.ts **/\n// prettier-ignore\nexport const utilDts = \"declare module \\\"@"
  },
  {
    "path": "ark/docs/components/icons/arktype-logo.tsx",
    "chars": 1171,
    "preview": "export const ArkTypeLogo = ({ height = 40, width = 40 }) => (\n\t<svg\n\t\tviewBox=\"0 0 100 100\"\n\t\tversion=\"1.1\"\n\t\txmlns=\"htt"
  },
  {
    "path": "ark/docs/components/icons/boat.tsx",
    "chars": 5915,
    "preview": "export const BoatIcon: React.FC<{ height: number }> = ({ height }) => (\n\t<svg\n\t\tversion=\"1.1\"\n\t\tviewBox=\"0 0 375 375\"\n\t\t"
  },
  {
    "path": "ark/docs/components/icons/bun.tsx",
    "chars": 4352,
    "preview": "export const BunIcon: React.FC<{ height: number }> = ({ height }) => (\n\t<svg\n\t\tid=\"Bun\"\n\t\txmlns=\"http://www.w3.org/2000/"
  },
  {
    "path": "ark/docs/components/icons/chromium.tsx",
    "chars": 2284,
    "preview": "export const ChromiumIcon: React.FC<{ height: number }> = ({ height }) => (\n\t<svg\n\t\tversion=\"1.1\"\n\t\tviewBox=\"0 0 511.98 "
  },
  {
    "path": "ark/docs/components/icons/deno.tsx",
    "chars": 6149,
    "preview": "export const DenoIcon: React.FC<{ height: number }> = ({ height }) => (\n\t<svg\n\t\tversion=\"1.0\"\n\t\txmlns=\"http://www.w3.org"
  },
  {
    "path": "ark/docs/components/icons/intellij.tsx",
    "chars": 2453,
    "preview": "export const IntellijIcon: React.FC<{ height: number }> = ({ height }) => (\n\t<svg height={height} viewBox=\"0 0 105 105\" "
  },
  {
    "path": "ark/docs/components/icons/js.tsx",
    "chars": 952,
    "preview": "export const JsIcon: React.FC<{ height: number }> = ({ height }) => (\n\t<svg viewBox=\"0 0 255 255\" xmlns=\"http://www.w3.o"
  },
  {
    "path": "ark/docs/components/icons/neovim.tsx",
    "chars": 2199,
    "preview": "export const NeovimIcon: React.FC<{ height: number }> = ({ height }) => (\n\t<svg\n\t\theight={height}\n\t\tviewBox=\"0 0 602 734"
  },
  {
    "path": "ark/docs/components/icons/node.tsx",
    "chars": 2889,
    "preview": "export const NodeIcon: React.FC<{ height: number }> = ({ height }) => (\n\t<svg\n\t\tviewBox=\"0 0 256 292\"\n\t\txmlns=\"http://ww"
  },
  {
    "path": "ark/docs/components/icons/npm.tsx",
    "chars": 464,
    "preview": "export const NPMIcon = () => (\n\t<svg\n\t\twidth=\"18\"\n\t\theight=\"18\"\n\t\tviewBox=\"0 0 18 18\"\n\t\tversion=\"1.1\"\n\t\txmlns=\"http://ww"
  },
  {
    "path": "ark/docs/components/icons/ts.tsx",
    "chars": 1693,
    "preview": "export const TsIcon: React.FC<{ height: number; className?: string }> = ({\n\theight,\n\tclassName\n}) => (\n\t<svg\n\t\tviewBox=\""
  },
  {
    "path": "ark/docs/components/icons/vscode.tsx",
    "chars": 2515,
    "preview": "export const VscodeIcon: React.FC<{\n\theight: number\n}> = ({ height }) => (\n\t<svg\n\t\tviewBox=\"0 0 256 254\"\n\t\txmlns=\"http:/"
  },
  {
    "path": "ark/docs/components/playground/ParseResult.tsx",
    "chars": 3118,
    "preview": "import { tryCatch } from \"@ark/util\"\nimport type { Type, type } from \"arktype\"\nimport { DynamicCodeBlock } from \"fumadoc"
  },
  {
    "path": "ark/docs/components/playground/Playground.tsx",
    "chars": 8503,
    "preview": "\"use client\"\n\nimport { unset } from \"@ark/util\"\nimport Editor, { useMonaco } from \"@monaco-editor/react\"\nimport { type }"
  },
  {
    "path": "ark/docs/components/playground/PlaygroundTabs.tsx",
    "chars": 2651,
    "preview": "\"use client\"\n\nimport { hasDomain, type dict } from \"@ark/util\"\nimport { cx } from \"class-variance-authority\"\nimport Reac"
  },
  {
    "path": "ark/docs/components/playground/RestoreDefault.tsx",
    "chars": 989,
    "preview": "import { cx } from \"class-variance-authority\"\nimport { RotateCcwIcon } from \"lucide-react\"\n\nexport interface RestoreDefa"
  },
  {
    "path": "ark/docs/components/playground/ShareLink.tsx",
    "chars": 951,
    "preview": "import { cx } from \"class-variance-authority\"\nimport { CheckIcon, LinkIcon } from \"lucide-react\"\nimport { useState } fro"
  },
  {
    "path": "ark/docs/components/playground/TraverseResult.tsx",
    "chars": 1169,
    "preview": "import { hasArkKind } from \"@ark/schema\"\nimport { printable, unset } from \"@ark/util\"\nimport type { type } from \"arktype"
  },
  {
    "path": "ark/docs/components/playground/completions.ts",
    "chars": 4432,
    "preview": "import type * as Monaco from \"monaco-editor\"\nimport type { CompletionInfo, ScriptElementKind } from \"typescript\"\nimport "
  },
  {
    "path": "ark/docs/components/playground/errorLens.ts",
    "chars": 3910,
    "preview": "import extensionPackage from \"arkdark/package.json\" with { type: \"json\" }\nimport arkdarkColors from \"arkthemes/arkdark.j"
  },
  {
    "path": "ark/docs/components/playground/execute.ts",
    "chars": 1072,
    "preview": "import { unset } from \"@ark/util\"\nimport * as arktypeExports from \"arktype\"\nimport type { ParseResult } from \"./ParseRes"
  },
  {
    "path": "ark/docs/components/playground/format.ts",
    "chars": 968,
    "preview": "import type * as Monaco from \"monaco-editor\"\nimport prettierPluginEstree from \"prettier/plugins/estree\"\nimport prettierP"
  },
  {
    "path": "ark/docs/components/playground/highlights.ts",
    "chars": 1182,
    "preview": "import arktypeTextmate from \"arkdark/tsWithArkType.tmLanguage.json\" with { type: \"json\" }\nimport arkdarkColors from \"ark"
  },
  {
    "path": "ark/docs/components/playground/hovers.ts",
    "chars": 1943,
    "preview": "import type * as Monaco from \"monaco-editor\"\nimport { createPositionHash, isDuplicateRequest } from \"./utils.ts\"\n\ntype D"
  },
  {
    "path": "ark/docs/components/playground/tsserver.ts",
    "chars": 1518,
    "preview": "import type * as Monaco from \"monaco-editor\"\nimport { regexDts } from \"../dts/regex.ts\"\nimport { schemaDts } from \"../dt"
  },
  {
    "path": "ark/docs/components/playground/utils.ts",
    "chars": 1961,
    "preview": "import type * as Monaco from \"monaco-editor\"\n\nexport const playgroundTypeVariableName = \"Thing\"\n\nexport const playground"
  },
  {
    "path": "ark/docs/components/snippets/betterErrors.twoslash.ts",
    "chars": 690,
    "preview": "import { type, type ArkErrors } from \"arktype\"\n\nconst User = type({\n\tname: \"string\",\n\tplatform: \"'android' | 'ios'\",\n\t\"v"
  },
  {
    "path": "ark/docs/components/snippets/clarityAndConcision.twoslash.js",
    "chars": 326,
    "preview": "// @errors: 2322\nimport { type } from \"arktype\"\n// this file is written in JS so that it can include a syntax error\n// w"
  },
  {
    "path": "ark/docs/components/snippets/contentsById.ts",
    "chars": 2477,
    "preview": "// prettier-ignore\nexport default {\n    \"betterErrors\": \"import { type, type ArkErrors } from \\\"arktype\\\"\\n\\nconst User "
  },
  {
    "path": "ark/docs/components/snippets/deepIntrospectability.twoslash.js",
    "chars": 378,
    "preview": "import { type } from \"arktype\"\n\nconst User = type({\n\tname: \"string\",\n\tdevice: {\n\t\tplatform: \"'android' | 'ios'\",\n\t\t\"vers"
  },
  {
    "path": "ark/docs/components/snippets/intrinsicOptimization.twoslash.js",
    "chars": 299,
    "preview": "import { type } from \"arktype\"\n// prettier-ignore\n// ---cut---\n// all unions are optimally discriminated\n// even if mult"
  },
  {
    "path": "ark/docs/components/snippets/nestedTypeInScopeError.twoslash.js",
    "chars": 154,
    "preview": "// @errors: 2322\nimport { scope } from \"arktype\"\n// ---cut---\nconst myScope = scope({\n\tid: \"string#id\",\n\tuser: type({\n\t\t"
  },
  {
    "path": "ark/docs/components/snippets/unparalleledDx.twoslash.js",
    "chars": 201,
    "preview": "// @noErrors\nimport { type } from \"arktype\"\n// prettier-ignore\n// ---cut---\nconst User = type({\n\tname: \"string\",\n\tplatfo"
  },
  {
    "path": "ark/docs/content/docs/blog/2.0.mdx",
    "chars": 2566,
    "preview": "---\ntitle: Announcing ArkType 2.0\ndescription: 100x faster validation with DX that will blow your mind\n---\n\nAs of today,"
  },
  {
    "path": "ark/docs/content/docs/blog/2.1.mdx",
    "chars": 8504,
    "preview": "---\ntitle: Announcing ArkType 2.1\ndescription: Optimized pattern matching from type syntax\n---\n\nAs of today, 2.1.0 is ge"
  },
  {
    "path": "ark/docs/content/docs/blog/2.2.mdx",
    "chars": 13257,
    "preview": "---\ntitle: Announcing ArkType 2.2\ndescription: Type-safe regex, validated functions, and native Standard Schema definiti"
  },
  {
    "path": "ark/docs/content/docs/blog/arkregex.mdx",
    "chars": 3849,
    "preview": "---\ntitle: Introducing ArkRegex\ndescription: A drop-in replacement for new RegExp() with types\n---\n\nRegular expressions "
  },
  {
    "path": "ark/docs/content/docs/blog/index.mdx",
    "chars": 689,
    "preview": "---\ntitle: Posts\n---\n\n<LinkCard\n\ttitle=\"Announcing ArkType 2.2\"\n\tdescription=\"Type-safe regex, validated functions, and "
  },
  {
    "path": "ark/docs/content/docs/blog/meta.json",
    "chars": 221,
    "preview": "{\n\t\"title\": \"Blog\",\n\t\"defaultOpen\": true,\n\t\"pages\": [\n\t\t\"[2.2 Announcement](/docs/blog/2.2)\",\n\t\t\"[ArkRegex Intro](/docs/"
  },
  {
    "path": "ark/docs/content/docs/comparisons.mdx",
    "chars": 27,
    "preview": "---\ntitle: Comparisons\n---\n"
  },
  {
    "path": "ark/docs/content/docs/configuration/index.mdx",
    "chars": 17738,
    "preview": "---\ntitle: Configuration\n---\n\nA great out-of-the-box experience is a core goal of ArkType, including safe defaults and h"
  },
  {
    "path": "ark/docs/content/docs/configuration/meta.json",
    "chars": 511,
    "preview": "{\n\t\"title\": \"Configuration\",\n\t\"pages\": [\n\t\t\"[levels](/docs/configuration#levels)\",\n\t\t\"[errors](/docs/configuration#error"
  },
  {
    "path": "ark/docs/content/docs/declare.mdx",
    "chars": 1665,
    "preview": "---\ntitle: Declare\n---\n\nIf your ArkType definitions are your source of truth, it's easy to infer out the type with an ex"
  },
  {
    "path": "ark/docs/content/docs/ecosystem/index.mdx",
    "chars": 972,
    "preview": "---\ntitle: Ecosystem\n---\n\n### ArkEnv\n\n[ArkEnv](https://arkenv.js.org) brings the power of ArkType to your environment va"
  },
  {
    "path": "ark/docs/content/docs/ecosystem/meta.json",
    "chars": 90,
    "preview": "{\n\t\"title\": \"Ecosystem\",\n\t\"icon\": \"New\",\n\t\"pages\": [\"[ArkEnv](/docs/ecosystem#arkenv)\"]\n}\n"
  },
  {
    "path": "ark/docs/content/docs/expressions/index.mdx",
    "chars": 20152,
    "preview": "---\ntitle: Expressions\n---\n\n### Intersection\n\nLike its TypeScript counterpart, an intersection combines two existing `Ty"
  },
  {
    "path": "ark/docs/content/docs/expressions/meta.json",
    "chars": 607,
    "preview": "{\n\t\"title\": \"Expressions\",\n\t\"pages\": [\n\t\t\"[intersection](/docs/expressions#intersection)\",\n\t\t\"[union](/docs/expressions#"
  },
  {
    "path": "ark/docs/content/docs/faq.mdx",
    "chars": 4582,
    "preview": "---\ntitle: FAQ\n---\n\n### Why do I see type errors in an ArkType package in `node_modules`?\n\nThis can occur due to incompa"
  },
  {
    "path": "ark/docs/content/docs/generics/index.mdx",
    "chars": 3064,
    "preview": "---\ntitle: Generics\n---\n\n### Keywords\n\nThis table includes all generic keywords available in default `type` API.\n\n<Gener"
  },
  {
    "path": "ark/docs/content/docs/generics/meta.json",
    "chars": 211,
    "preview": "{\n\t\"title\": \"Generics\",\n\t\"icon\": \"Advanced\",\n\t\"pages\": [\n\t\t\"[keywords](/docs/generics#keywords)\",\n\t\t\"[syntax](/docs/gene"
  },
  {
    "path": "ark/docs/content/docs/integrations/index.mdx",
    "chars": 4486,
    "preview": "---\ntitle: Integrations\n---\n\n### Standard Schema\n\nArkType is proud to support and co-author the new [Standard Schema](ht"
  },
  {
    "path": "ark/docs/content/docs/integrations/meta.json",
    "chars": 330,
    "preview": "{\n\t\"title\": \"Integrations\",\n\t\"pages\": [\n\t\t\"[Standard Schema](/docs/integrations#standard-schema)\",\n\t\t\"[JSON Schema](/doc"
  },
  {
    "path": "ark/docs/content/docs/internal/index.mdx",
    "chars": 6364,
    "preview": "---\ntitle: Internal\n---\n\nTypes have an extremely powerful internal representation defined in `@ark/schema` that is prima"
  },
  {
    "path": "ark/docs/content/docs/internal/meta.json",
    "chars": 121,
    "preview": "{\n\t\"title\": \"Internal\",\n\t\"pages\": [\n\t\t\"[node kinds](/docs/internal#nodekinds)\",\n\t\t\"[select](/docs/internal#select)\"\n\t]\n}"
  },
  {
    "path": "ark/docs/content/docs/intro/adding-constraints.mdx",
    "chars": 2628,
    "preview": "---\ntitle: Adding Constraints\n---\n\nTypeScript is extremely versatile for representing types like `string` or `number`, b"
  },
  {
    "path": "ark/docs/content/docs/intro/meta.json",
    "chars": 125,
    "preview": "{\n\t\"title\": \"Intro\",\n\t\"defaultOpen\": true,\n\t\"pages\": [\"setup\", \"your-first-type\", \"adding-constraints\", \"morphs-and-more"
  },
  {
    "path": "ark/docs/content/docs/intro/morphs-and-more.mdx",
    "chars": 3535,
    "preview": "---\ntitle: Morphs & More\n---\n\nSometimes, data at the boundaries of your code requires more than validation before it's r"
  },
  {
    "path": "ark/docs/content/docs/intro/setup.mdx",
    "chars": 1896,
    "preview": "---\ntitle: Setup\n---\n\n## Installation\n\n<InstallationTabs />\n\nYou'll also need...\n\n- TypeScript version `>=5.1`.\n- A `pac"
  },
  {
    "path": "ark/docs/content/docs/intro/your-first-type.mdx",
    "chars": 2506,
    "preview": "---\ntitle: Your First Type\n---\n\nIf you already know TypeScript, congratulations- you just learned most of ArkType's synt"
  },
  {
    "path": "ark/docs/content/docs/introspection/index.mdx",
    "chars": 6492,
    "preview": "---\ntitle: Introspection\n---\n\nTypes have an extremely powerful internal representation defined in `@ark/schema` that is "
  },
  {
    "path": "ark/docs/content/docs/introspection/meta.json",
    "chars": 136,
    "preview": "{\n\t\"title\": \"Introspection\",\n\t\"pages\": [\n\t\t\"[node kinds](/docs/introspection#nodekinds)\",\n\t\t\"[select](/docs/introspectio"
  },
  {
    "path": "ark/docs/content/docs/keywords.mdx",
    "chars": 1672,
    "preview": "---\ntitle: Keywords\n---\n\n### TypeScript\n\n<div>All\\* built-in TypeScript keywords are directly available.</div>\n\n<SyntaxT"
  },
  {
    "path": "ark/docs/content/docs/match.mdx",
    "chars": 2566,
    "preview": "---\ntitle: Match\n---\n\nThe `match` function provides a powerful way to handle different types of input and return corresp"
  },
  {
    "path": "ark/docs/content/docs/meta.json",
    "chars": 243,
    "preview": "{\n\t\"pages\": [\n\t\t\"intro\",\n\t\t\"primitives\",\n\t\t\"objects\",\n\t\t\"keywords\",\n\t\t\"expressions\",\n\t\t\"match\",\n\t\t\"configuration\",\n\t\t\"ty"
  },
  {
    "path": "ark/docs/content/docs/objects/arrays/meta.json",
    "chars": 329,
    "preview": "{\n\t\"title\": \"arrays and tuples\",\n\t\"pages\": [\n\t\t\"[lengths](/docs/objects#arrays-lengths)\",\n\t\t\"[prefix](/docs/objects#tupl"
  },
  {
    "path": "ark/docs/content/docs/objects/index.mdx",
    "chars": 25597,
    "preview": "---\ntitle: Objects\n---\n\n## properties\n\nObjects definitions can include any combination of required, optional, defaultabl"
  },
  {
    "path": "ark/docs/content/docs/objects/meta.json",
    "chars": 167,
    "preview": "{\n\t\"title\": \"Objects\",\n\t\"defaultOpen\": true,\n\t\"pages\": [\n\t\t\"properties\",\n\t\t\"arrays\",\n\t\t\"[dates](/docs/objects#dates)\",\n\t"
  },
  {
    "path": "ark/docs/content/docs/objects/properties/meta.json",
    "chars": 695,
    "preview": "{\n\t\"title\": \"properties\",\n\t\"pages\": [\n\t\t\"[required](/docs/objects#properties-required)\",\n\t\t\"[optional](/docs/objects#pro"
  },
  {
    "path": "ark/docs/content/docs/primitives/index.mdx",
    "chars": 7852,
    "preview": "---\ntitle: Primitives\n---\n\n## string\n\n### keywords\n\nThe following keywords can be referenced in any definition, e.g.:\n\n`"
  },
  {
    "path": "ark/docs/content/docs/primitives/meta.json",
    "chars": 287,
    "preview": "{\n\t\"title\": \"Primitives\",\n\t\"defaultOpen\": true,\n\t\"pages\": [\n\t\t\"string\",\n\t\t\"number\",\n\t\t\"[bigint](/docs/primitives#bigint)"
  },
  {
    "path": "ark/docs/content/docs/primitives/number/meta.json",
    "chars": 234,
    "preview": "{\n\t\"title\": \"number\",\n\t\"pages\": [\n\t\t\"[keywords](/docs/primitives#number-keywords)\",\n\t\t\"[literals](/docs/primitives#numbe"
  },
  {
    "path": "ark/docs/content/docs/primitives/string/meta.json",
    "chars": 236,
    "preview": "{\n\t\"title\": \"string\",\n\t\"pages\": [\n\t\t\"[keywords](/docs/primitives#string-keywords)\",\n\t\t\"[literals](/docs/primitives#strin"
  },
  {
    "path": "ark/docs/content/docs/scopes/index.mdx",
    "chars": 10893,
    "preview": "---\ntitle: Scopes\n---\n\n<AnchorAliases intro />\n\nScopes are the foundation of ArkType, and one of the most powerful featu"
  },
  {
    "path": "ark/docs/content/docs/scopes/meta.json",
    "chars": 217,
    "preview": "{\n\t\"title\": \"Scopes\",\n\t\"icon\": \"Advanced\",\n\t\"pages\": [\n\t\t\"[modules](/docs/scopes#modules)\",\n\t\t\"[visibility](/docs/scopes"
  },
  {
    "path": "ark/docs/content/docs/traversal-api.mdx",
    "chars": 2466,
    "preview": "---\ntitle: Traversal API\n---\n\n<ApiTable group=\"Traversal\" />\n\n### assert\n\nValidate data, returning the output on success"
  },
  {
    "path": "ark/docs/content/docs/type-api/index.mdx",
    "chars": 3511,
    "preview": "---\ntitle: Type API\n---\n\n<ApiTable group=\"Type\" />\n\nThe methods below are available on every `Type` instance. For valida"
  },
  {
    "path": "ark/docs/content/docs/type-api/meta.json",
    "chars": 382,
    "preview": "{\n\t\"title\": \"Type API\",\n\t\"pages\": [\n\t\t\"[from](/docs/type-api#from)\",\n\t\t\"[in / out](/docs/type-api#in--out)\",\n\t\t\"[extends"
  },
  {
    "path": "ark/docs/lib/ambient.d.ts",
    "chars": 89,
    "preview": "declare module \"*.css\" {}\n\ndeclare module \"*?raw\" {\n\tconst _: string\n\texport default _\n}\n"
  },
  {
    "path": "ark/docs/lib/metadata.ts",
    "chars": 185,
    "preview": "import { createMetadataImage } from \"fumadocs-core/server\"\nimport { source } from \"./source.tsx\"\n\nexport const metadataI"
  },
  {
    "path": "ark/docs/lib/shiki.ts",
    "chars": 6152,
    "preview": "import { transformerNotationErrorLevel } from \"@shikijs/transformers\"\nimport type { RehypeCodeOptions } from \"fumadocs-c"
  },
  {
    "path": "ark/docs/lib/source.tsx",
    "chars": 1051,
    "preview": "import type { autocomplete } from \"@ark/util\"\nimport { loader } from \"fumadocs-core/source\"\nimport { icons } from \"lucid"
  },
  {
    "path": "ark/docs/lib/writeLlmsTxt.ts",
    "chars": 458,
    "preview": "import { readFile, walkPaths, writeFile } from \"@ark/fs\"\nimport { join } from \"node:path\"\nimport { repoDirs } from \"../."
  },
  {
    "path": "ark/docs/lib/writeSnippetsEntrypoint.ts",
    "chars": 1739,
    "preview": "import { fromHere, readFile, writeFile } from \"@ark/fs\"\nimport { flatMorph, throwInternalError } from \"@ark/util\"\nimport"
  },
  {
    "path": "ark/docs/next-env.d.ts",
    "chars": 211,
    "preview": "/// <reference types=\"next\" />\n/// <reference types=\"next/image-types/global\" />\n\n// NOTE: This file should not be edite"
  },
  {
    "path": "ark/docs/next.config.ts",
    "chars": 1448,
    "preview": "import { createMDX } from \"fumadocs-mdx/next\"\nimport type { NextConfig } from \"next\"\nimport { mkdtempSync } from \"node:f"
  },
  {
    "path": "ark/docs/package.json",
    "chars": 1687,
    "preview": "{\n\t\"name\": \"@ark/docs\",\n\t\"version\": \"0.0.1\",\n\t\"private\": true,\n\t\"type\": \"module\",\n\t\"scripts\": {\n\t\t\"build\": \"next build\","
  },
  {
    "path": "ark/docs/postcss.config.cjs",
    "chars": 65,
    "preview": "module.exports = {\n\tplugins: {\n\t\t\"@tailwindcss/postcss\": {}\n\t}\n}\n"
  },
  {
    "path": "ark/docs/public/CNAME",
    "chars": 10,
    "preview": "arktype.io"
  },
  {
    "path": "ark/docs/public/llms.txt",
    "chars": 159585,
    "preview": "---\ntitle: Announcing ArkType 2.0\ndescription: 100x faster validation with DX that will blow your mind\n---\n\nAs of today,"
  },
  {
    "path": "ark/docs/source.config.ts",
    "chars": 278,
    "preview": "import { defineConfig, defineDocs } from \"fumadocs-mdx/config\"\nimport { shikiConfig } from \"./lib/shiki.ts\"\n\nexport cons"
  },
  {
    "path": "ark/docs/tsconfig.json",
    "chars": 726,
    "preview": "{\n\t\"extends\": \"../../tsconfig.json\",\n\t\"compilerOptions\": {\n\t\t// unfortunately, twoslash doesn't seem to respect customCo"
  },
  {
    "path": "ark/extension/.vscode/launch.json",
    "chars": 311,
    "preview": "// A launch configuration that launches the extension inside a new window\n{\n\t\"version\": \"0.1.0\",\n\t\"configurations\": [\n\t\t"
  },
  {
    "path": "ark/extension/README.md",
    "chars": 1931,
    "preview": "<div align=\"center\">\n  <img src=\"https://arktype.io/image/logo.png\" height=\"64px\" />\n  <h1>ArkType</h1>\n</div>\n<div alig"
  },
  {
    "path": "ark/extension/arktype.scratch.ts",
    "chars": 3380,
    "preview": "// @ts-nocheck\nimport { scope, type } from \"arktype\"\nimport { hasArkKind } from \"../schema/out/shared/utils\"\n\ntype(\"(boo"
  },
  {
    "path": "ark/extension/injected.tmLanguage.json",
    "chars": 4254,
    "preview": "{\n\t\"$schema\": \"https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json\",\n\t\"name\": \"InjectedArkTyp"
  },
  {
    "path": "ark/extension/package.json",
    "chars": 1928,
    "preview": "{\n\t\"name\": \"arkdark\",\n\t\"displayName\": \"ArkType\",\n\t\"description\": \"Syntax highlighting and inline errors for ArkType⛵\",\n\t"
  },
  {
    "path": "ark/extension/tsWithArkType.tmLanguage.json",
    "chars": 98066,
    "preview": "{\n\t\"name\": \"ArkTypeScript\",\n\t\"scopeName\": \"source.ts\",\n\t\"fileTypes\": [\"ts\", \"js\"],\n\t\"patterns\": [\n\t\t{\n\t\t\t\"include\": \"#di"
  },
  {
    "path": "ark/fast-check/__tests__/arktypeFastCheck.test.ts",
    "chars": 9216,
    "preview": "import { attest, contextualize } from \"@ark/attest\"\nimport { arkToArbitrary } from \"@ark/fast-check/internal/arktypeFast"
  },
  {
    "path": "ark/fast-check/arbitraries/array.ts",
    "chars": 1491,
    "preview": "import type { nodeOfKind, SequenceTuple } from \"@ark/schema\"\nimport * as fc from \"fast-check\"\nimport type { Ctx } from \""
  },
  {
    "path": "ark/fast-check/arbitraries/date.ts",
    "chars": 486,
    "preview": "import * as fc from \"fast-check\"\nimport type { ProtoInputNode } from \"./proto.ts\"\n\nexport const buildDateArbitrary = (\n\t"
  },
  {
    "path": "ark/fast-check/arbitraries/domain.ts",
    "chars": 987,
    "preview": "import type { nodeOfKind } from \"@ark/schema\"\nimport * as fc from \"fast-check\"\nimport { buildStructureArbitrary } from \""
  }
]

// ... and 350 more files (download for full content)

About this extraction

This page contains the full source code of the arktypeio/arktype GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 550 files (2.8 MB), approximately 763.4k tokens, and a symbol index with 2376 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!