[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\nindent_style = tab\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.yml]\nindent_style = space\nindent_size = 2\n"
  },
  {
    "path": ".gitattributes",
    "content": "* text=auto eol=lf\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/1 new type.yml",
    "content": "name: 💡 Suggest new type\ndescription: '​‌‍﻿⁠ ' # Magic whitespace to hide this required field\nlabels: 'type addition'\n\nbody:\n  - type: textarea\n    id: description\n    validations:\n      required: true\n    attributes:\n      label: Type description + examples\n\n  - type: textarea\n    id: type\n    attributes:\n      label: Type source\n      description: If you already have the type source, enter it here as a starting point for a the discussion\n\n  - id: requirements\n    type: checkboxes\n    attributes:\n      label: Search existing types and issues first\n      options:\n        - label: I tried my best to look for it\n          required: true\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/2 bug report.yml",
    "content": "name: 🐛 Report bug\ndescription: '​‌‍﻿⁠ ' # Magic whitespace to hide this required field\nlabels: bug\n\nbody:\n  - type: textarea\n    id: description\n    validations:\n      required: true\n    attributes:\n      label: Bug description\n\n  - type: input\n    id: repro\n    validations:\n      required: true\n    attributes:\n      label: Repro\n      description: |\n        Open [this playground](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBDAnmApnA3gUQB4GMVgwC+cAZlBCHAORKoC0pKAzjNQNwCwAUD3WgDEIEOAF4MPAJABXAHbBc0WQC44rKMFkBzLt0lQAhpoBGEAO6rTEADYoDs3UV19kaAHIQASkdmmzYuBx8QgAeIQgAGhpDE3NqAD5dOGS4AHpUuAA9AH4eIA), write a piece of code that fails your expectations, click \"Share\", and paste the URL here\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/3 enhancement.md",
    "content": "---\nname: ♻️ Propose change or improvement to existing types\nabout: '​‌‍﻿⁠ ' # Magic whitespace to hide this required field\nlabels: 'enhancement'\n---\n"
  },
  {
    "path": ".github/contributing.md",
    "content": "# Contributing guidelines\n\n## Submitting a new type\n\n- One type addition per pull request, unless they are connected.\n- **Please help review the other open pull requests.**\n\t- If there are no open pull requests, provide some feedback on some of the open issues.\n- [Example of a type contribution.](https://github.com/sindresorhus/type-fest/commit/5374588a88ee643893784f66367bc26b8e6509ec)\n- Create a new file in the `test-d` directory and write at least one type test.\n\t- See the other tests for inspiration.\n\t- If it makes sense, also write a negative test using [`expectNotAssignable()`](https://github.com/SamVerschueren/tsd#expectnotassignabletexpression-any) or, to test other diagnostics, [`expectError()`](https://github.com/SamVerschueren/tsd#expecterrort--anyexpression-t).\n- Don't use one-character type names like `T` and `U`. Use descriptive names. See the existing types for inspiration.\n- Follow the existing code style, even in documentation code examples.\n\t- Don't prefix each line in documentation comments with `*`.\n- Write a good documentation comment that includes:\n\t- Write a short and clear description of what the type does.\n\t\t- The first line should match the description in the readme.\n\t- Write about some real-world use-cases where it can be useful. (It can be hard sometimes for users to see where they would use something)\n\t- Example code block with a realistic example.\n\t- At the bottom, explain how the type works. Some types can be quite advanced and hard to understand. We can use this opportunity to teach users.\n\t- If there has been any discussion somewhere about this type, include a link to it. For example, a discussion on the TypeScript issue tracker.\n\t- Add relevant `@category` tags. See other types for examples.\n- If you add any internal helper types, they should still be properly documented and tested.\n- Add the type to the readme.\n- Make sure the file in the `source` directory uses a `.d.ts` extension and not `.ts`.\n- **Use AI (like ChatGPT) to catch type bugs, improve docs, spot typos, validate examples, and suggest more tests.** Include all relevant code (type, tests, helpers, etc.) in the prompt, and also provide a couple of existing types as examples of how it's done. Try this prompt: “Review this TypeScript type for correctness, edge cases, naming, docs, and test coverage. Suggest improvements and realistic succinct examples.”\n- Run `$ npm test` before submitting and make sure it passes.\n- Name the pull request ```Add `TypeName` type```.\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n  - package-ecosystem: 'github-actions'\n    directory: '/'\n    schedule:\n      interval: 'weekly'\n    groups:\n      github-actions:\n        patterns:\n          - '*'\n  - package-ecosystem: 'npm'\n    directory: '/'\n    schedule:\n      interval: 'monthly'\n    versioning-strategy: 'increase-if-necessary'\n    groups:\n      development-dependencies:\n        dependency-type: 'development'\n"
  },
  {
    "path": ".github/funding.yml",
    "content": "github: [sindresorhus, som-sm, Emiyaaaaa, voxpelli]\n"
  },
  {
    "path": ".github/pull_request_template.md",
    "content": "<!--\n\nThanks for submitting a pull request 🙌\n\nIf you're submitting a new type, please review the contribution guidelines:\nhttps://github.com/sindresorhus/type-fest/blob/main/.github/contributing.md\n\n-->\n"
  },
  {
    "path": ".github/security.md",
    "content": "# Security Policy\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.\n"
  },
  {
    "path": ".github/workflows/claude-code-review.yml",
    "content": "name: Claude Code Review\non:\n  pull_request:\n    types: [opened, synchronize]\njobs:\n  claude-review:\n    runs-on: ubuntu-latest\n    # Only run if the PR is from the same repository (not a fork), because forks are not supported yet: https://github.com/anthropics/claude-code-action/issues/339\n    if: github.event.pull_request.head.repo.full_name == github.repository\n    permissions:\n      contents: read\n      pull-requests: write\n      issues: read\n      id-token: write\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v5\n        with:\n          fetch-depth: 1\n      - name: Run Claude Code Review\n        id: claude-review\n        uses: anthropics/claude-code-action@v1\n        with:\n          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}\n          prompt: |\n            REPO: ${{ github.repository }}\n            PR NUMBER: ${{ github.event.pull_request.number }}\n\n            Please review this pull request and provide feedback on:\n            - Code quality and best practices\n            - Potential bugs or issues\n            - Performance considerations\n            - Security concerns\n            - Test coverage\n            - Be succinct\n            - Only comment about things that needs to be fixed/improved\n            - Review thoroughly\n\n            Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.\n\n            Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.\n\n          # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md\n          # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options\n          claude_args: '--allowed-tools \"Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)\"'\n"
  },
  {
    "path": ".github/workflows/claude.yml",
    "content": "name: Claude Code\non:\n  issue_comment:\n    types: [created]\n  pull_request_review_comment:\n    types: [created]\n  issues:\n    types: [opened, assigned]\n  pull_request_review:\n    types: [submitted]\njobs:\n  claude:\n    if: |\n      (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||\n      (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||\n      (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||\n      (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      pull-requests: read\n      issues: read\n      id-token: write\n      actions: read # Required for Claude to read CI results on PRs\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 1\n      - name: Run Claude Code\n        id: claude\n        uses: anthropics/claude-code-action@v1\n        with:\n          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}\n          additional_permissions: |\n            actions: read\n"
  },
  {
    "path": ".github/workflows/main.yml",
    "content": "name: CI\non:\n  push:\n    branches:\n      - main\n    tags:\n      - '*'\n  pull_request:\n    branches:\n      - main\njobs:\n  test:\n    name: Node.js ${{ matrix.node-version }}\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        node-version:\n          - 24\n          - 22\n          - 20\n    steps:\n      - uses: actions/checkout@v5\n      - uses: actions/setup-node@v5\n        with:\n          node-version: ${{ matrix.node-version }}\n      - run: npm install\n      - run: npm test\n  types:\n    name: TypeScript ${{ matrix.typescript-version }}\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        typescript-version:\n          - 'latest'\n          - '~5.9.0'\n    steps:\n      - uses: actions/checkout@v5\n      - uses: actions/setup-node@v5\n        with:\n          node-version: 24\n      - run: npm install\n      - run: npm install typescript@${{ matrix.typescript-version }}\n      - run: NODE_OPTIONS=\"--max-old-space-size=6144\" npx tsc\n"
  },
  {
    "path": ".github/workflows/ts-canary.yml",
    "content": "name: TypeScript Canary\non:\n  schedule:\n    # Every Thursday at 21.15\n    - cron: '15 21 * * 4'\n  workflow_dispatch:\njobs:\n  types:\n    name: TypeScript ${{ matrix.typescript-version }}\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        typescript-version:\n          - next\n          - latest\n    steps:\n      - uses: actions/checkout@v5\n      - uses: actions/setup-node@v5\n        with:\n          node-version: lts/*\n      - run: npm install\n      - run: npm install typescript@${{ matrix.typescript-version }}\n      - name: show installed typescript version\n        run: npm list typescript --depth=0\n      - run: NODE_OPTIONS=\"--max-old-space-size=6144\" npx tsc\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\nyarn.lock\n"
  },
  {
    "path": ".npmrc",
    "content": "package-lock=false\n"
  },
  {
    "path": "CLAUDE.md",
    "content": "# type-fest\n\nTypeScript utility types library. Pure type-level programming—no runtime code.\n\n**Read `.github/contributing.md` for complete guidelines.**\n\n## Commands\n\n```bash\nnpm test         # MUST pass before committing (runs all below)\nnpm run test:tsc # TypeScript compiler\nnpm run test:tsd # Type tests (tsd)\nnpm run test:xo  # Linter\n```\n\n## File Structure\n\n```\nsource/type-name.d.ts → Type definition (.d.ts REQUIRED)\ntest-d/type-name.ts   → Tests (tsd)\nindex.d.ts            → Export (MUST add, lint enforces)\nreadme.md             → API docs (add to category)\nsource/internal/      → Shared helpers (not exported)\n```\n\n## Code Patterns\n\n```ts\n// ✅ CORRECT\nimport type {IsNever} from './is-never.d.ts';  // Include .d.ts\nexport type MyType<Value extends string> = ... // Descriptive names (not T/U)\nexport {};                                      // REQUIRED at end\n\n// ❌ WRONG\nimport type {IsNever} from './is-never';       // Missing .d.ts\nexport type MyType<T> = ...;                   // Single-letter\n\n/**\nCreates a tuple type of specified length with elements of specified type.\n\nUse-cases:\n- Define fixed-length arrays with specific types\n\n@example\n```\nimport type {TupleOf} from 'type-fest';\ntype RGB = TupleOf<3, number>; //=> [number, number, number]\n```\n\n@category Array\n*/\nexport type TupleOf<Length extends number, Fill = unknown> = ...;\nexport {};\n```\n\nType params: `Value`, `Target`, `Item`, `Length`, `Element`, `Key` (not `T`, `U`, `V`, `K`)\nDocs: No `*` prefix. First line → readme. Include use-cases, examples, `@category`.\n\n## Testing\n\n**ALWAYS test edge cases** (`any`, `never`, `unknown`).\n\n```ts\nexpectType<string>('' as MyType<'foo'>);           // Basic\nexpectType<any>('' as MyType<any>);                // any/never/unknown\nexpectNotAssignable<MyType<'foo'>>({wrong: true}); // Negative\nexpectError<MyType<number>>();                     // Should error\n```\n\nStudy: `source/tuple-of.d.ts`, `is-equal.d.ts`, `literal-union.d.ts`, `internal/*.d.ts`\n\n## Workflow\n\n1. Research - Study `source/` similar types + online research\n2. Define - `source/type-name.d.ts` with docs\n3. Test - `test-d/type-name.ts` with edge cases\n4. Export - Add to `index.d.ts` + readme.md\n5. Verify - `npm test` must pass\n6. Commit - ``Add `TypeName` type`` or ``  `TypeName`: Fix description``\n\n## Critical Rules\n\n1. Import paths MUST include `.d.ts` extension\n2. Files MUST end with `export {};`\n3. Types MUST be exported from `index.d.ts`\n4. Type params MUST use descriptive names (not `T`/`U`)\n5. MUST test `any`, `never`, `unknown` edge cases\n6. First doc line MUST be concise (goes in readme)\n7. Use realistic examples with `//=>` comments\n8. Include `@category` tags\n9. Fix lint issues, don't disable rules\n\n## Type Programming\n\n- Conditionals: `T extends U ? X : Y`\n- Recursion: `type Loop<T, Acc> = ... Loop<...> ...`\n- Extract: `infer Item`\n- Distribute: `T extends any ? ... : never`\n- Count via tuple `['length']`\n- Union distribution is tricky—test it\n\n## Philosophy\n\n- Correctness > cleverness\n- Real problems only\n- Docs teach how, not what\n- Edge cases mandatory\n- One concept per PR\n- Descriptive names > brevity\n- No unrelated changes\n\n## Troubleshooting\n\n- Tests fail? Check `.d.ts` imports, `export {};`, edge cases (`any`, `never`, `unknown`)\n- Lint errors? Add to `index.d.ts`, fix issues (don't disable rules)\n"
  },
  {
    "path": "index.d.ts",
    "content": "// Basic\nexport type * from './source/primitive.d.ts';\nexport type * from './source/typed-array.d.ts';\nexport type * from './source/basic.d.ts';\nexport type * from './source/json-value.d.ts';\nexport type * from './source/characters.d.ts';\n\n// Utilities\nexport type {KeysOfUnion} from './source/keys-of-union.d.ts';\nexport type {DistributedOmit} from './source/distributed-omit.d.ts';\nexport type {DistributedPick} from './source/distributed-pick.d.ts';\nexport type {EmptyObject, IsEmptyObject} from './source/empty-object.d.ts';\nexport type {IfEmptyObject} from './source/if-empty-object.d.ts';\nexport type {NonEmptyObject} from './source/non-empty-object.d.ts';\nexport type {NonEmptyString} from './source/non-empty-string.d.ts';\nexport type {UnknownRecord} from './source/unknown-record.d.ts';\nexport type {UnknownArray} from './source/unknown-array.d.ts';\nexport type {UnknownSet} from './source/unknown-set.d.ts';\nexport type {UnknownMap} from './source/unknown-map.d.ts';\nexport type {Except, ExceptOptions} from './source/except.d.ts';\nexport type {TaggedUnion} from './source/tagged-union.d.ts';\nexport type {Writable} from './source/writable.d.ts';\nexport type {WritableDeep} from './source/writable-deep.d.ts';\nexport type {Merge} from './source/merge.d.ts';\nexport type {ObjectMerge} from './source/object-merge.d.ts';\nexport type {MergeDeep, MergeDeepOptions} from './source/merge-deep.d.ts';\nexport type {MergeExclusive} from './source/merge-exclusive.d.ts';\nexport type {RequireAtLeastOne} from './source/require-at-least-one.d.ts';\nexport type {RequireExactlyOne} from './source/require-exactly-one.d.ts';\nexport type {RequireAllOrNone} from './source/require-all-or-none.d.ts';\nexport type {RequireOneOrNone} from './source/require-one-or-none.d.ts';\nexport type {SingleKeyObject} from './source/single-key-object.d.ts';\nexport type {OmitIndexSignature} from './source/omit-index-signature.d.ts';\nexport type {PickIndexSignature} from './source/pick-index-signature.d.ts';\nexport type {PartialDeep, PartialDeepOptions} from './source/partial-deep.d.ts';\nexport type {UnwrapPartial} from './source/unwrap-partial.d.ts';\nexport type {RequiredDeep} from './source/required-deep.d.ts';\nexport type {PickDeep} from './source/pick-deep.d.ts';\nexport type {OmitDeep} from './source/omit-deep.d.ts';\nexport type {PartialOnUndefinedDeep, PartialOnUndefinedDeepOptions} from './source/partial-on-undefined-deep.d.ts';\nexport type {UndefinedOnPartialDeep} from './source/undefined-on-partial-deep.d.ts';\nexport type {ReadonlyDeep} from './source/readonly-deep.d.ts';\nexport type {LiteralUnion} from './source/literal-union.d.ts';\nexport type {Promisable} from './source/promisable.d.ts';\nexport type {Arrayable} from './source/arrayable.d.ts';\nexport type {Optional} from './source/optional.d.ts';\nexport type {Opaque, UnwrapOpaque, Tagged, GetTagMetadata, UnwrapTagged} from './source/tagged.d.ts';\nexport type {InvariantOf} from './source/invariant-of.d.ts';\nexport type {SetOptional} from './source/set-optional.d.ts';\nexport type {SetReadonly} from './source/set-readonly.d.ts';\nexport type {SetRequired} from './source/set-required.d.ts';\nexport type {SetRequiredDeep} from './source/set-required-deep.d.ts';\nexport type {SetNonNullable} from './source/set-non-nullable.d.ts';\nexport type {SetNonNullableDeep} from './source/set-non-nullable-deep.d.ts';\nexport type {ValueOf} from './source/value-of.d.ts';\nexport type {AsyncReturnType} from './source/async-return-type.d.ts';\nexport type {ConditionalExcept} from './source/conditional-except.d.ts';\nexport type {ConditionalKeys} from './source/conditional-keys.d.ts';\nexport type {ConditionalPick} from './source/conditional-pick.d.ts';\nexport type {ConditionalPickDeep, ConditionalPickDeepOptions} from './source/conditional-pick-deep.d.ts';\nexport type {UnionToIntersection} from './source/union-to-intersection.d.ts';\nexport type {Stringified} from './source/stringified.d.ts';\nexport type {StringSlice} from './source/string-slice.d.ts';\nexport type {FixedLengthArray} from './source/fixed-length-array.d.ts';\nexport type {MultidimensionalArray} from './source/multidimensional-array.d.ts';\nexport type {MultidimensionalReadonlyArray} from './source/multidimensional-readonly-array.d.ts';\nexport type {IterableElement} from './source/iterable-element.d.ts';\nexport type {Entry} from './source/entry.d.ts';\nexport type {Entries} from './source/entries.d.ts';\nexport type {SetReturnType} from './source/set-return-type.d.ts';\nexport type {SetParameterType} from './source/set-parameter-type.d.ts';\nexport type {Asyncify} from './source/asyncify.d.ts';\nexport type {Simplify} from './source/simplify.d.ts';\nexport type {SimplifyDeep} from './source/simplify-deep.d.ts';\nexport type {Jsonify} from './source/jsonify.d.ts';\nexport type {Jsonifiable} from './source/jsonifiable.d.ts';\nexport type {StructuredCloneable} from './source/structured-cloneable.d.ts';\nexport type {Schema, SchemaOptions} from './source/schema.d.ts';\nexport type {LiteralToPrimitive} from './source/literal-to-primitive.d.ts';\nexport type {LiteralToPrimitiveDeep} from './source/literal-to-primitive-deep.d.ts';\nexport type {\n\tPositiveInfinity,\n\tNegativeInfinity,\n\tFinite,\n\tInteger,\n\tFloat,\n\tNegativeFloat,\n\tNegative,\n\tNonNegative,\n\tNegativeInteger,\n\tNonNegativeInteger,\n\tIsNegative,\n} from './source/numeric.d.ts';\nexport type {GreaterThan} from './source/greater-than.d.ts';\nexport type {GreaterThanOrEqual} from './source/greater-than-or-equal.d.ts';\nexport type {LessThan} from './source/less-than.d.ts';\nexport type {LessThanOrEqual} from './source/less-than-or-equal.d.ts';\nexport type {Sum} from './source/sum.d.ts';\nexport type {Subtract} from './source/subtract.d.ts';\nexport type {KeyAsString} from './source/key-as-string.d.ts';\nexport type {Exact} from './source/exact.d.ts';\nexport type {ReadonlyTuple} from './source/readonly-tuple.d.ts';\nexport type {OverrideProperties} from './source/override-properties.d.ts';\nexport type {OptionalKeysOf} from './source/optional-keys-of.d.ts';\nexport type {IsOptionalKeyOf} from './source/is-optional-key-of.d.ts';\nexport type {HasOptionalKeys} from './source/has-optional-keys.d.ts';\nexport type {RequiredKeysOf} from './source/required-keys-of.d.ts';\nexport type {IsRequiredKeyOf} from './source/is-required-key-of.d.ts';\nexport type {HasRequiredKeys} from './source/has-required-keys.d.ts';\nexport type {ReadonlyKeysOf} from './source/readonly-keys-of.d.ts';\nexport type {IsReadonlyKeyOf} from './source/is-readonly-key-of.d.ts';\nexport type {HasReadonlyKeys} from './source/has-readonly-keys.d.ts';\nexport type {WritableKeysOf} from './source/writable-keys-of.d.ts';\nexport type {IsWritableKeyOf} from './source/is-writable-key-of.d.ts';\nexport type {HasWritableKeys} from './source/has-writable-keys.d.ts';\nexport type {Spread} from './source/spread.d.ts';\nexport type {SplitOnRestElement} from './source/split-on-rest-element.d.ts';\nexport type {ExtractRestElement} from './source/extract-rest-element.d.ts';\nexport type {ExcludeRestElement} from './source/exclude-rest-element.d.ts';\nexport type {IsInteger} from './source/is-integer.d.ts';\nexport type {IsFloat} from './source/is-float.d.ts';\nexport type {TupleToObject} from './source/tuple-to-object.d.ts';\nexport type {TupleToUnion} from './source/tuple-to-union.d.ts';\nexport type {UnionToTuple} from './source/union-to-tuple.d.ts';\nexport type {IntRange} from './source/int-range.d.ts';\nexport type {IntClosedRange} from './source/int-closed-range.d.ts';\nexport type {IsEqual} from './source/is-equal.d.ts';\nexport type {\n\tIsLiteral,\n\tIsStringLiteral,\n\tIsNumericLiteral,\n\tIsBooleanLiteral,\n\tIsSymbolLiteral,\n} from './source/is-literal.d.ts';\nexport type {IsAny} from './source/is-any.d.ts';\nexport type {IfAny} from './source/if-any.d.ts';\nexport type {IsNever} from './source/is-never.d.ts';\nexport type {IfNever} from './source/if-never.d.ts';\nexport type {IsUnknown} from './source/is-unknown.d.ts';\nexport type {IfUnknown} from './source/if-unknown.d.ts';\nexport type {IsTuple, IsTupleOptions} from './source/is-tuple.d.ts';\nexport type {ArrayIndices} from './source/array-indices.d.ts';\nexport type {ArrayValues} from './source/array-values.d.ts';\nexport type {ArraySlice} from './source/array-slice.d.ts';\nexport type {ArraySplice} from './source/array-splice.d.ts';\nexport type {ArrayTail} from './source/array-tail.d.ts';\nexport type {ArrayElement} from './source/array-element.d.ts';\nexport type {ArrayLength} from './source/array-length.d.ts';\nexport type {SetFieldType, SetFieldTypeOptions} from './source/set-field-type.d.ts';\nexport type {Paths, PathsOptions} from './source/paths.d.ts';\nexport type {AllUnionFields} from './source/all-union-fields.d.ts';\nexport type {SharedUnionFields} from './source/shared-union-fields.d.ts';\nexport type {SharedUnionFieldsDeep, SharedUnionFieldsDeepOptions} from './source/shared-union-fields-deep.d.ts';\nexport type {IsNull} from './source/is-null.d.ts';\nexport type {IfNull} from './source/if-null.d.ts';\nexport type {IsUndefined} from './source/is-undefined.d.ts';\nexport type {And} from './source/and.d.ts';\nexport type {AndAll} from './source/and-all.d.ts';\nexport type {Or} from './source/or.d.ts';\nexport type {OrAll} from './source/or-all.d.ts';\nexport type {Xor} from './source/xor.d.ts';\nexport type {AllExtend, AllExtendOptions} from './source/all-extend.d.ts';\nexport type {SomeExtend, SomeExtendOptions} from './source/some-extend.d.ts';\nexport type {NonEmptyTuple} from './source/non-empty-tuple.d.ts';\nexport type {FindGlobalInstanceType, FindGlobalType} from './source/find-global-type.d.ts';\nexport type {If} from './source/if.d.ts';\nexport type {IsUnion} from './source/is-union.d.ts';\nexport type {IsLowercase} from './source/is-lowercase.d.ts';\nexport type {IsUppercase} from './source/is-uppercase.d.ts';\nexport type {IsOptional} from './source/is-optional.d.ts';\nexport type {IsNullable} from './source/is-nullable.d.ts';\nexport type {TupleOf} from './source/tuple-of.d.ts';\nexport type {ExclusifyUnion} from './source/exclusify-union.d.ts';\nexport type {ArrayReverse} from './source/array-reverse.d.ts';\nexport type {UnionMember} from './source/union-member.d.ts';\n\n// Template literal types\nexport type {CamelCase, CamelCaseOptions} from './source/camel-case.d.ts';\nexport type {CamelCasedProperties} from './source/camel-cased-properties.d.ts';\nexport type {CamelCasedPropertiesDeep} from './source/camel-cased-properties-deep.d.ts';\nexport type {KebabCase} from './source/kebab-case.d.ts';\nexport type {KebabCasedProperties} from './source/kebab-cased-properties.d.ts';\nexport type {KebabCasedPropertiesDeep} from './source/kebab-cased-properties-deep.d.ts';\nexport type {PascalCase} from './source/pascal-case.d.ts';\nexport type {PascalCasedProperties} from './source/pascal-cased-properties.d.ts';\nexport type {PascalCasedPropertiesDeep} from './source/pascal-cased-properties-deep.d.ts';\nexport type {SnakeCase} from './source/snake-case.d.ts';\nexport type {SnakeCasedProperties} from './source/snake-cased-properties.d.ts';\nexport type {SnakeCasedPropertiesDeep} from './source/snake-cased-properties-deep.d.ts';\nexport type {ScreamingSnakeCase} from './source/screaming-snake-case.d.ts';\nexport type {DelimiterCase} from './source/delimiter-case.d.ts';\nexport type {DelimiterCasedProperties} from './source/delimiter-cased-properties.d.ts';\nexport type {DelimiterCasedPropertiesDeep} from './source/delimiter-cased-properties-deep.d.ts';\nexport type {Join} from './source/join.d.ts';\nexport type {Split, SplitOptions} from './source/split.d.ts';\nexport type {Words, WordsOptions} from './source/words.d.ts';\nexport type {Trim} from './source/trim.d.ts';\nexport type {Replace, ReplaceOptions} from './source/replace.d.ts';\nexport type {StringRepeat} from './source/string-repeat.d.ts';\nexport type {Includes} from './source/includes.d.ts';\nexport type {Get, GetOptions} from './source/get.d.ts';\nexport type {LastArrayElement} from './source/last-array-element.d.ts';\nexport type {ConditionalSimplify} from './source/conditional-simplify.d.ts';\nexport type {ConditionalSimplifyDeep} from './source/conditional-simplify-deep.d.ts';\nexport type {RemovePrefix, RemovePrefixOptions} from './source/remove-prefix.d.ts';\n\n// Miscellaneous\nexport type {GlobalThis} from './source/global-this.d.ts';\nexport type {PackageJson} from './source/package-json.d.ts';\nexport type {TsConfigJson} from './source/tsconfig-json.d.ts';\n\n// Improved built-in\nexport type {ExtendsStrict} from './source/extends-strict.d.ts';\nexport type {ExtractStrict} from './source/extract-strict.d.ts';\nexport type {ExcludeStrict} from './source/exclude-strict.d.ts';\nexport type {ExcludeExactly} from './source/exclude-exactly.d.ts';\n\nexport {};\n"
  },
  {
    "path": "license-cc0",
    "content": "Creative Commons Legal Code\n\nCC0 1.0 Universal\n\n    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE\n    LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN\n    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS\n    INFORMATION ON AN \"AS-IS\" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES\n    REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS\n    PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM\n    THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED\n    HEREUNDER.\n\nStatement of Purpose\n\nThe laws of most jurisdictions throughout the world automatically confer\nexclusive Copyright and Related Rights (defined below) upon the creator\nand subsequent owner(s) (each and all, an \"owner\") of an original work of\nauthorship and/or a database (each, a \"Work\").\n\nCertain owners wish to permanently relinquish those rights to a Work for\nthe purpose of contributing to a commons of creative, cultural and\nscientific works (\"Commons\") that the public can reliably and without fear\nof later claims of infringement build upon, modify, incorporate in other\nworks, reuse and redistribute as freely as possible in any form whatsoever\nand for any purposes, including without limitation commercial purposes.\nThese owners may contribute to the Commons to promote the ideal of a free\nculture and the further production of creative, cultural and scientific\nworks, or to gain reputation or greater distribution for their Work in\npart through the use and efforts of others.\n\nFor these and/or other purposes and motivations, and without any\nexpectation of additional consideration or compensation, the person\nassociating CC0 with a Work (the \"Affirmer\"), to the extent that he or she\nis an owner of Copyright and Related Rights in the Work, voluntarily\nelects to apply CC0 to the Work and publicly distribute the Work under its\nterms, with knowledge of his or her Copyright and Related Rights in the\nWork and the meaning and intended legal effect of CC0 on those rights.\n\n1. Copyright and Related Rights. A Work made available under CC0 may be\nprotected by copyright and related or neighboring rights (\"Copyright and\nRelated Rights\"). Copyright and Related Rights include, but are not\nlimited to, the following:\n\n  i. the right to reproduce, adapt, distribute, perform, display,\n     communicate, and translate a Work;\n ii. moral rights retained by the original author(s) and/or performer(s);\niii. publicity and privacy rights pertaining to a person's image or\n     likeness depicted in a Work;\n iv. rights protecting against unfair competition in regards to a Work,\n     subject to the limitations in paragraph 4(a), below;\n  v. rights protecting the extraction, dissemination, use and reuse of data\n     in a Work;\n vi. database rights (such as those arising under Directive 96/9/EC of the\n     European Parliament and of the Council of 11 March 1996 on the legal\n     protection of databases, and under any national implementation\n     thereof, including any amended or successor version of such\n     directive); and\nvii. other similar, equivalent or corresponding rights throughout the\n     world based on applicable law or treaty, and any national\n     implementations thereof.\n\n2. Waiver. To the greatest extent permitted by, but not in contravention\nof, applicable law, Affirmer hereby overtly, fully, permanently,\nirrevocably and unconditionally waives, abandons, and surrenders all of\nAffirmer's Copyright and Related Rights and associated claims and causes\nof action, whether now known or unknown (including existing as well as\nfuture claims and causes of action), in the Work (i) in all territories\nworldwide, (ii) for the maximum duration provided by applicable law or\ntreaty (including future time extensions), (iii) in any current or future\nmedium and for any number of copies, and (iv) for any purpose whatsoever,\nincluding without limitation commercial, advertising or promotional\npurposes (the \"Waiver\"). Affirmer makes the Waiver for the benefit of each\nmember of the public at large and to the detriment of Affirmer's heirs and\nsuccessors, fully intending that such Waiver shall not be subject to\nrevocation, rescission, cancellation, termination, or any other legal or\nequitable action to disrupt the quiet enjoyment of the Work by the public\nas contemplated by Affirmer's express Statement of Purpose.\n\n3. Public License Fallback. Should any part of the Waiver for any reason\nbe judged legally invalid or ineffective under applicable law, then the\nWaiver shall be preserved to the maximum extent permitted taking into\naccount Affirmer's express Statement of Purpose. In addition, to the\nextent the Waiver is so judged Affirmer hereby grants to each affected\nperson a royalty-free, non transferable, non sublicensable, non exclusive,\nirrevocable and unconditional license to exercise Affirmer's Copyright and\nRelated Rights in the Work (i) in all territories worldwide, (ii) for the\nmaximum duration provided by applicable law or treaty (including future\ntime extensions), (iii) in any current or future medium and for any number\nof copies, and (iv) for any purpose whatsoever, including without\nlimitation commercial, advertising or promotional purposes (the\n\"License\"). The License shall be deemed effective as of the date CC0 was\napplied by Affirmer to the Work. Should any part of the License for any\nreason be judged legally invalid or ineffective under applicable law, such\npartial invalidity or ineffectiveness shall not invalidate the remainder\nof the License, and in such case Affirmer hereby affirms that he or she\nwill not (i) exercise any of his or her remaining Copyright and Related\nRights in the Work or (ii) assert any associated claims and causes of\naction with respect to the Work, in either case contrary to Affirmer's\nexpress Statement of Purpose.\n\n4. Limitations and Disclaimers.\n\n a. No trademark or patent rights held by Affirmer are waived, abandoned,\n    surrendered, licensed or otherwise affected by this document.\n b. Affirmer offers the Work as-is and makes no representations or\n    warranties of any kind concerning the Work, express, implied,\n    statutory or otherwise, including without limitation warranties of\n    title, merchantability, fitness for a particular purpose, non\n    infringement, or the absence of latent or other defects, accuracy, or\n    the present or absence of errors, whether or not discoverable, all to\n    the greatest extent permissible under applicable law.\n c. Affirmer disclaims responsibility for clearing rights of other persons\n    that may apply to the Work or any use thereof, including without\n    limitation any person's Copyright and Related Rights in the Work.\n    Further, Affirmer disclaims responsibility for obtaining any necessary\n    consents, permissions or other rights required for any use of the\n    Work.\n d. Affirmer understands and acknowledges that Creative Commons is not a\n    party to this document and has no duty or obligation with respect to\n    this CC0 or use of the Work.\n"
  },
  {
    "path": "license-mit",
    "content": "MIT License\n\nCopyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n"
  },
  {
    "path": "lint-processors/fixtures/eslint.config.js",
    "content": "import tseslint from 'typescript-eslint';\nimport {defineConfig} from 'eslint/config';\nimport {jsdocCodeblocksProcessor} from '../jsdoc-codeblocks.js';\n\nconst errorEndingAtFirstColumnRule = {\n\tcreate(context) {\n\t\treturn {\n\t\t\t'TSTypeAliasDeclaration Literal'(node) {\n\t\t\t\tif (node.value !== 'error_ending_at_first_column') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tloc: {\n\t\t\t\t\t\tstart: {\n\t\t\t\t\t\t\tline: node.loc.start.line,\n\t\t\t\t\t\t\tcolumn: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tend: {\n\t\t\t\t\t\t\tline: node.loc.start.line + 1,\n\t\t\t\t\t\t\tcolumn: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tmessage: 'Error ending at first column',\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst config = defineConfig(\n\ttseslint.configs.recommended,\n\ttseslint.configs.stylistic,\n\t{\n\t\trules: {\n\t\t\t'@typescript-eslint/no-unused-vars': 'off',\n\t\t\t'@typescript-eslint/consistent-type-definitions': [\n\t\t\t\t'error',\n\t\t\t\t'type',\n\t\t\t],\n\t\t\t'test/error-ending-at-first-column': 'error',\n\t\t},\n\t},\n\t{\n\t\tplugins: {\n\t\t\ttest: {\n\t\t\t\tprocessors: {\n\t\t\t\t\t'jsdoc-codeblocks': jsdocCodeblocksProcessor,\n\t\t\t\t},\n\t\t\t\trules: {\n\t\t\t\t\t'error-ending-at-first-column': errorEndingAtFirstColumnRule,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tfiles: ['**/*.d.ts'],\n\t\tprocessor: 'test/jsdoc-codeblocks',\n\t},\n);\n\nexport default config;\n"
  },
  {
    "path": "lint-processors/jsdoc-codeblocks.js",
    "content": "// @ts-check\nimport tsParser from '@typescript-eslint/parser';\n\n/**\n@import {Linter} from 'eslint';\n*/\n\nconst CODEBLOCK_REGEX = /(?<openingFence>(?<indent>^[ \\t]*)```(?:ts|typescript)?\\n)(?<code>[\\s\\S]*?)\\n\\s*```/gm;\n/**\n@typedef {{lineOffset: number, characterOffset: number, indent: string, unindentedText: string}} CodeblockData\n@type {Map<string, CodeblockData[]>}\n*/\nconst codeblockDataPerFile = new Map();\n\n/**\n@param {string} text\n@param {number} index\n@param {string} indent\n@returns {number}\n*/\nfunction indentsUptoIndex(text, index, indent) {\n\tlet i = 0;\n\tlet indents = 0;\n\n\tfor (const line of text.split('\\n')) {\n\t\tif (i > index) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (line === '') {\n\t\t\ti += 1; // +1 for the newline\n\t\t\tcontinue;\n\t\t}\n\n\t\ti += line.length + 1; // +1 for the newline\n\t\ti -= indent.length; // Because `text` is unindented but `index` corresponds to dedented text\n\t\tindents += indent.length;\n\t}\n\n\treturn indents;\n}\n\nexport const jsdocCodeblocksProcessor = {\n\tsupportsAutofix: true,\n\n\t/**\n\t@param {string} text\n\t@param {string} filename\n\t@returns {(string | Linter.ProcessorFile)[]}\n\t*/\n\tpreprocess(text, filename) {\n\t\tconst ast = tsParser.parse(text);\n\n\t\tconst jsdocComments = ast.comments.filter(\n\t\t\tcomment => comment.type === 'Block' && comment.value.startsWith('*'),\n\t\t);\n\n\t\t/** @type {(string | Linter.ProcessorFile)[]} */\n\t\tconst files = [text]; // First entry is for the entire file\n\t\t/** @type {CodeblockData[]} */\n\t\tconst allCodeblocksData = [];\n\n\t\t// Loop over all JSDoc comments in the file\n\t\tfor (const comment of jsdocComments) {\n\t\t\t// Loop over all codeblocks in the JSDoc comment\n\t\t\tfor (const match of comment.value.matchAll(CODEBLOCK_REGEX)) {\n\t\t\t\tconst {code, openingFence, indent} = match.groups ?? {};\n\n\t\t\t\t// Skip empty code blocks\n\t\t\t\tif (!code || !openingFence || indent === undefined) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst codeLines = code.split('\\n');\n\t\t\t\tconst indentSize = indent.length;\n\n\t\t\t\t// Skip comments that are not consistently indented\n\t\t\t\tif (!codeLines.every(line => line === '' || line.startsWith(indent))) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst dedentedCode = codeLines\n\t\t\t\t\t.map(line => line.slice(indentSize))\n\t\t\t\t\t.join('\\n');\n\n\t\t\t\tfiles.push({\n\t\t\t\t\ttext: dedentedCode,\n\t\t\t\t\tfilename: `${files.length}.ts`, // Final filename example: `/path/to/type-fest/source/and.d.ts/1_1.ts`\n\t\t\t\t});\n\n\t\t\t\tconst linesBeforeMatch = comment.value.slice(0, match.index).split('\\n').length - 1;\n\t\t\t\tallCodeblocksData.push({\n\t\t\t\t\tlineOffset: comment.loc.start.line + linesBeforeMatch,\n\t\t\t\t\tcharacterOffset: comment.range[0] + match.index + openingFence.length + 2, // +2 because `comment.value` doesn't include the starting `/*`\n\t\t\t\t\tindent,\n\t\t\t\t\tunindentedText: code,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tcodeblockDataPerFile.set(filename, allCodeblocksData);\n\n\t\treturn files;\n\t},\n\n\t/**\n\t@param {import('eslint').Linter.LintMessage[][]} messages\n\t@param {string} filename\n\t@returns {import('eslint').Linter.LintMessage[]}\n\t*/\n\tpostprocess(messages, filename) {\n\t\tconst codeblocks = codeblockDataPerFile.get(filename) || [];\n\t\tcodeblockDataPerFile.delete(filename);\n\n\t\tconst normalizedMessages = [...(messages[0] ?? [])]; // First entry contains errors for the entire file, and it doesn't need any adjustments\n\n\t\tfor (const [index, codeblockMessages] of messages.slice(1).entries()) {\n\t\t\tconst codeblockData = codeblocks[index];\n\n\t\t\tif (!codeblockData) {\n\t\t\t\t// This should ideally never happen\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst {lineOffset, characterOffset, indent, unindentedText} = codeblockData;\n\n\t\t\tfor (const message of codeblockMessages) {\n\t\t\t\tmessage.line += lineOffset;\n\t\t\t\tmessage.column += indent.length;\n\n\t\t\t\tif (typeof message.endColumn === 'number' && message.endColumn > 1) {\n\t\t\t\t\t// An `endColumn` of `1` indicates the error actually ended on the previous line since it's exclusive.\n\t\t\t\t\t// So, adding `indent.length` in this case would incorrectly move the error marker into the indentation.\n\t\t\t\t\t// Therefore, the indentation length is only added when `endColumn` is greater than `1`.\n\t\t\t\t\tmessage.endColumn += indent.length;\n\t\t\t\t}\n\n\t\t\t\tif (typeof message.endLine === 'number') {\n\t\t\t\t\tmessage.endLine += lineOffset;\n\t\t\t\t}\n\n\t\t\t\tif (message.fix) {\n\t\t\t\t\tmessage.fix.text = message.fix.text.split('\\n').join(`\\n${indent}`);\n\n\t\t\t\t\tconst indentsBeforeFixStart = indentsUptoIndex(unindentedText, message.fix.range[0], indent);\n\t\t\t\t\tconst indentsBeforeFixEnd = indentsUptoIndex(unindentedText, message.fix.range[1] - 1, indent); // -1 because range end is exclusive\n\n\t\t\t\t\tmessage.fix.range = [\n\t\t\t\t\t\tmessage.fix.range[0] + characterOffset + indentsBeforeFixStart,\n\t\t\t\t\t\tmessage.fix.range[1] + characterOffset + indentsBeforeFixEnd,\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\tfor (const {fix} of (message.suggestions ?? [])) {\n\t\t\t\t\tfix.text = fix.text.split('\\n').join(`\\n${indent}`);\n\n\t\t\t\t\tconst indentsBeforeFixStart = indentsUptoIndex(unindentedText, fix.range[0], indent);\n\t\t\t\t\tconst indentsBeforeFixEnd = indentsUptoIndex(unindentedText, fix.range[1] - 1, indent); // -1 because range end is exclusive\n\n\t\t\t\t\tfix.range = [\n\t\t\t\t\t\tfix.range[0] + characterOffset + indentsBeforeFixStart,\n\t\t\t\t\t\tfix.range[1] + characterOffset + indentsBeforeFixEnd,\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\tnormalizedMessages.push(message);\n\t\t\t}\n\t\t}\n\n\t\treturn normalizedMessages;\n\t},\n};\n"
  },
  {
    "path": "lint-processors/jsdoc-codeblocks.test.js",
    "content": "import {describe, test} from 'node:test';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport {ESLint} from 'eslint';\nimport {code1, code2, dedenter, errorAt, exportType, exportTypeAndOption, fence, jsdoc} from '../lint-rules/test-utils.js';\n\nconst root = path.join(import.meta.dirname, 'fixtures');\n\ntry {\n\tawait fs.access(path.join(root, 'eslint.config.js'));\n} catch {\n\tthrow new Error('\\'eslint.config.js\\' is missing in \\'lint-processors/fixtures\\' directory.');\n}\n\nconst valid = [\n\t{\n\t\tname: 'No JSDoc',\n\t\tcode: exportTypeAndOption(''),\n\t},\n\t{\n\t\tname: 'JSDoc without code block',\n\t\tcode: exportType(jsdoc('No codeblock here')),\n\t},\n\t{\n\t\tname: 'Valid code block',\n\t\tcode: exportTypeAndOption(jsdoc(fence(code1))),\n\t},\n\t{\n\t\tname: 'With text before and after',\n\t\tcode: exportTypeAndOption(jsdoc('Some description.', fence(code1), '@category Test')),\n\t},\n\t{\n\t\tname: 'With line breaks before and after',\n\t\tcode: exportTypeAndOption(\n\t\t\tjsdoc('Some description.\\n', 'Note: Some note.\\n', fence(code1, 'ts'), '\\n@category Test'),\n\t\t),\n\t},\n\t{\n\t\tname: 'With @example tag',\n\t\tcode: exportTypeAndOption(jsdoc('@example', fence(code1))),\n\t},\n\t{\n\t\tname: 'With ts language specifier',\n\t\tcode: exportTypeAndOption(jsdoc(fence(code1, 'ts'))),\n\t},\n\t{\n\t\tname: 'With typescript language specifier',\n\t\tcode: exportTypeAndOption(jsdoc(fence(code1, 'typescript'))),\n\t},\n\t{\n\t\tname: 'Multiple code blocks',\n\t\tcode: exportTypeAndOption(\n\t\t\tjsdoc('@example', fence(code1, 'ts'), '\\nSome text in between.\\n', '@example', fence(code2)),\n\t\t),\n\t},\n\t{\n\t\tname: 'Multiple exports and multiple properties',\n\t\tcode: exportTypeAndOption(jsdoc(fence(code1)), jsdoc(fence(code2))),\n\t},\n\t{\n\t\tname: 'Indented code blocks',\n\t\tcode: exportTypeAndOption(jsdoc(\n\t\t\t'Note:',\n\t\t\tdedenter`\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\timport type {Subtract} from 'type-fest';\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\timport type {Sum} from 'type-fest';\n\t\t\t\t\ttype A = Sum<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t`,\n\t\t)),\n\t},\n\t{\n\t\tname: 'Ignore codeblocks with inconsistent indentation',\n\t\tcode: exportTypeAndOption(jsdoc(\n\t\t\t'Some description.',\n\t\t\tdedenter`\n\t\t\tNote:\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: string = '1';\n\n\t\t\tconst bar: number = 1;\n\t\t\t\t\\`\\`\\`\n\t\t\t`,\n\t\t)),\n\t},\n];\n\nconst invalid = [\n\t{\n\t\tname: 'With text before and after',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: Array<string> = [];\n\t\t\t\\`\\`\\`\n\t\t\t@category Test\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: Array<string> = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\t@category Test\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: string[] = [];\n\t\t\t\\`\\`\\`\n\t\t\t@category Test\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: string[] = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\t@category Test\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 4,\n\t\t\t\ttextBeforeStart: 'const foo: ',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 14,\n\t\t\t\ttextBeforeStart: '\\tconst foo: ',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'With line breaks before and after',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\n\t\t\tNote: Some note.\n\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: number = 1;\n\t\t\t\\`\\`\\`\n\n\t\t\t@category Test\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\n\t\t\t\tNote: Some note.\n\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: number = 1;\n\t\t\t\t\\`\\`\\`\n\n\t\t\t\t@category Test\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\n\t\t\tNote: Some note.\n\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo = 1;\n\t\t\t\\`\\`\\`\n\n\t\t\t@category Test\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\n\t\t\t\tNote: Some note.\n\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = 1;\n\t\t\t\t\\`\\`\\`\n\n\t\t\t\t@category Test\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/no-inferrable-types',\n\t\t\t\tline: 7,\n\t\t\t\ttextBeforeStart: 'const ',\n\t\t\t\ttarget: 'foo: number = 1',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/no-inferrable-types',\n\t\t\t\tline: 21,\n\t\t\t\ttextBeforeStart: '\\tconst ',\n\t\t\t\ttarget: 'foo: number = 1',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'With @example tag',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\tinterface Foo {\n\t\t\t\ta: string;\n\t\t\t\tb: number;\n\t\t\t}\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tinterface Foo {\n\t\t\t\t\ta: string;\n\t\t\t\t\tb: number;\n\t\t\t\t}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\ttype Foo = {\n\t\t\t\ta: string;\n\t\t\t\tb: number;\n\t\t\t}\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = {\n\t\t\t\t\ta: string;\n\t\t\t\t\tb: number;\n\t\t\t\t}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-type-definitions',\n\t\t\t\tline: 4,\n\t\t\t\ttextBeforeStart: 'interface ',\n\t\t\t\ttarget: 'Foo',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-type-definitions',\n\t\t\t\tline: 16,\n\t\t\t\ttextBeforeStart: '\\tinterface ',\n\t\t\t\ttarget: 'Foo',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'With language specifiers',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: Array<string> = [];\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: Array<string> = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: string[] = [];\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: string[] = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 3,\n\t\t\t\ttextBeforeStart: 'const foo: ',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 11,\n\t\t\t\ttextBeforeStart: '\\tconst foo: ',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'With typescript language specifiers',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`typescript\n\t\t\tconst foo: Array<string> = [];\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`typescript\n\t\t\t\tconst foo: Array<string> = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`typescript\n\t\t\tconst foo: string[] = [];\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`typescript\n\t\t\t\tconst foo: string[] = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 3,\n\t\t\t\ttextBeforeStart: 'const foo: ',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 11,\n\t\t\t\ttextBeforeStart: '\\tconst foo: ',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Multiple code blocks',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: Array<string> = [];\n\t\t\t\\`\\`\\`\n\n\t\t\tSome text in between.\n\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\tconst bar: number = 1;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: Array<string> = [];\n\t\t\t\t\\`\\`\\`\n\n\t\t\t\tSome text in between.\n\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst bar: number = 1;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: string[] = [];\n\t\t\t\\`\\`\\`\n\n\t\t\tSome text in between.\n\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\tconst bar = 1;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: string[] = [];\n\t\t\t\t\\`\\`\\`\n\n\t\t\t\tSome text in between.\n\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst bar = 1;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 4,\n\t\t\t\ttextBeforeStart: 'const foo: ',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/no-inferrable-types',\n\t\t\t\tline: 11,\n\t\t\t\ttextBeforeStart: 'const ',\n\t\t\t\ttarget: 'bar: number = 1',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 20,\n\t\t\t\ttextBeforeStart: '\\tconst foo: ',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/no-inferrable-types',\n\t\t\t\tline: 27,\n\t\t\t\ttextBeforeStart: '\\tconst ',\n\t\t\t\ttarget: 'bar: number = 1',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Multiple exports and multiple properties',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\tfunction foo(example: {(): number}): number {\n\t\t\t\treturn example();\n\t\t\t}\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\ttype Foo = {\n\t\t\t\t[key: string]: unknown;\n\t\t\t};\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T1 = string;\n\n\t\t\texport type T0Options = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tfunction foo(example: {(): number}): number {\n\t\t\t\t\treturn example();\n\t\t\t\t}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = {\n\t\t\t\t\t[key: string]: unknown;\n\t\t\t\t};\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp1: string;\n\t\t\t};\n\n\t\t\texport type T1Options = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: Map<string, number> = new Map();\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\tfunction foo(example: () => number): number {\n\t\t\t\treturn example();\n\t\t\t}\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\ttype Foo = Record<string, unknown>;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T1 = string;\n\n\t\t\texport type T0Options = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tfunction foo(example: () => number): number {\n\t\t\t\t\treturn example();\n\t\t\t\t}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = Record<string, unknown>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp1: string;\n\t\t\t};\n\n\t\t\texport type T1Options = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = new Map<string, number>();\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 3,\n\t\t\t\ttextBeforeStart: 'function foo(example: {',\n\t\t\t\ttarget: '(): number',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-indexed-object-style',\n\t\t\t\tline: 12,\n\t\t\t\ttextBeforeStart: 'type Foo = ',\n\t\t\t\tendLine: 14,\n\t\t\t\ttextBeforeEnd: '}',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 22,\n\t\t\t\ttextBeforeStart: '\\tfunction foo(example: {',\n\t\t\t\ttarget: '(): number',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-indexed-object-style',\n\t\t\t\tline: 31,\n\t\t\t\ttextBeforeStart: '\\ttype Foo = ',\n\t\t\t\tendLine: 33,\n\t\t\t\ttextBeforeEnd: '\\t}',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-generic-constructors',\n\t\t\t\tline: 42,\n\t\t\t\ttextBeforeStart: '\\tconst ',\n\t\t\t\ttarget: 'foo: Map<string, number> = new Map()',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Indented code blocks',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\tNote:\n\t\t\t1. First point\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = {\n\t\t\t\t\t[x: string]: unknown;\n\t\t\t\t};\n\t\t\t\t\\`\\`\\`\n\t\t\t2. Second point\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Bar = {\n\t\t\t\t\t(arg: string): number;\n\t\t\t\t};\n\t\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tNote:\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype Foo = {\n\t\t\t\t\t\t[x: string]: unknown;\n\t\t\t\t\t};\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype Bar = {\n\t\t\t\t\t\t(arg: string): number;\n\t\t\t\t\t};\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\tNote:\n\t\t\t1. First point\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = Record<string, unknown>;\n\t\t\t\t\\`\\`\\`\n\t\t\t2. Second point\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Bar = (arg: string) => number;\n\t\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tNote:\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype Foo = Record<string, unknown>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype Bar = (arg: string) => number;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-indexed-object-style',\n\t\t\t\tline: 5,\n\t\t\t\ttextBeforeStart: '\\ttype Foo = ',\n\t\t\t\tendLine: 7,\n\t\t\t\ttextBeforeEnd: '\\t}',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 12,\n\t\t\t\ttextBeforeStart: '\\t\\t',\n\t\t\t\ttarget: '(arg: string): number;',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-indexed-object-style',\n\t\t\t\tline: 23,\n\t\t\t\ttextBeforeStart: '\\t\\ttype Foo = ',\n\t\t\t\tendLine: 25,\n\t\t\t\ttextBeforeEnd: '\\t\\t}',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 30,\n\t\t\t\ttextBeforeStart: '\\t\\t\\t',\n\t\t\t\ttarget: '(arg: string): number;',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Error and fix starting at the first character of the codeblock',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\t\t\t\\`\\`\\`ts\n\t\t\tvar foo = 1;\n\t\t\tfoo = 2;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tvar foo = 1;\n\t\t\t\tfoo = 2;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\t\t\t\\`\\`\\`ts\n\t\t\tlet foo = 1;\n\t\t\tfoo = 2;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tlet foo = 1;\n\t\t\t\tfoo = 2;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: 'no-var',\n\t\t\t\tline: 4,\n\t\t\t\ttextBeforeStart: '',\n\t\t\t\ttarget: 'var foo = 1;',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: 'no-var',\n\t\t\t\tline: 14,\n\t\t\t\ttextBeforeStart: '\\t',\n\t\t\t\ttarget: 'var foo = 1;',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Error and fix in the middle of the codeblock',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: string[] = [];\n\n\t\t\tconst bar: Array<number> = [];\n\n\t\t\tconst baz: boolean[] = [];\n\t\t\t\\`\\`\\`\n\t\t\tSome text after.\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: string[] = [];\n\n\t\t\t\tconst bar: Array<number> = [];\n\n\t\t\t\tconst baz: boolean[] = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\tSome text after.\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: string[] = [];\n\n\t\t\tconst bar: number[] = [];\n\n\t\t\tconst baz: boolean[] = [];\n\t\t\t\\`\\`\\`\n\t\t\tSome text after.\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: string[] = [];\n\n\t\t\t\tconst bar: number[] = [];\n\n\t\t\t\tconst baz: boolean[] = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\tSome text after.\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 5,\n\t\t\t\ttextBeforeStart: 'const bar: ',\n\t\t\t\ttarget: 'Array<number>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 18,\n\t\t\t\ttextBeforeStart: '\\tconst bar: ',\n\t\t\t\ttarget: 'Array<number>',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Error and fix ending at the last character of the codeblock',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\ttype Foo = {a: string}\n\t\t\ttype Bar = {[K: string]: Foo}\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = {a: string}\n\t\t\t\ttype Bar = {[K: string]: Foo}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\ttype Foo = {a: string}\n\t\t\ttype Bar = Record<string, Foo>\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = {a: string}\n\t\t\t\ttype Bar = Record<string, Foo>\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-indexed-object-style',\n\t\t\t\tline: 7,\n\t\t\t\ttextBeforeStart: 'type Bar = ',\n\t\t\t\ttarget: '{[K: string]: Foo}',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-indexed-object-style',\n\t\t\t\tline: 19,\n\t\t\t\ttextBeforeStart: '\\ttype Bar = ',\n\t\t\t\ttarget: '{[K: string]: Foo}',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Error spanning multiple lines',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\timport type {PickIndexSignature} from 'type-fest';\n\n\t\t\ttype Foo = {\n\t\t\t\t[key: string]: unknown;\n\t\t\t};\n\n\t\t\ttype Test = PickIndexSignature<Foo>;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\timport type {PickIndexSignature} from 'type-fest';\n\n\t\t\t\ttype Foo = {\n\t\t\t\t\t[key: string]: unknown;\n\t\t\t\t};\n\n\t\t\t\ttype Test = PickIndexSignature<Foo>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\timport type {PickIndexSignature} from 'type-fest';\n\n\t\t\ttype Foo = Record<string, unknown>;\n\n\t\t\ttype Test = PickIndexSignature<Foo>;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\timport type {PickIndexSignature} from 'type-fest';\n\n\t\t\t\ttype Foo = Record<string, unknown>;\n\n\t\t\t\ttype Test = PickIndexSignature<Foo>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-indexed-object-style',\n\t\t\t\tline: 5,\n\t\t\t\ttextBeforeStart: 'type Foo = ',\n\t\t\t\tendLine: 7,\n\t\t\t\ttextBeforeEnd: '}',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-indexed-object-style',\n\t\t\t\tline: 19,\n\t\t\t\ttextBeforeStart: '\\ttype Foo = ',\n\t\t\t\tendLine: 21,\n\t\t\t\ttextBeforeEnd: '\\t}',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Multiline fix',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\t\t\tSome more description.\n\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\ttype Test = {(\n\t\t\t\tfoo: string,\n\t\t\t\tbar: number\n\t\t\t): void};\n\t\t\t\\`\\`\\`\n\t\t\t@category Test\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\t\t\t\tSome more description.\n\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Test = {(\n\t\t\t\t\tfoo: string,\n\t\t\t\t\tbar: number\n\t\t\t\t): void};\n\t\t\t\t\\`\\`\\`\n\t\t\t\t@category Test\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\t\t\tSome more description.\n\n\t\t\t@example\n\t\t\t\\`\\`\\`ts\n\t\t\ttype Test = (\n\t\t\t\tfoo: string,\n\t\t\t\tbar: number\n\t\t\t) => void;\n\t\t\t\\`\\`\\`\n\t\t\t@category Test\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\t\t\t\tSome more description.\n\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Test = (\n\t\t\t\t\tfoo: string,\n\t\t\t\t\tbar: number\n\t\t\t\t) => void;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t@category Test\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 7,\n\t\t\t\ttextBeforeStart: 'type Test = {',\n\t\t\t\tendLine: 10,\n\t\t\t\ttextBeforeEnd: '): void',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 23,\n\t\t\t\ttextBeforeStart: '\\ttype Test = {',\n\t\t\t\tendLine: 26,\n\t\t\t\ttextBeforeEnd: '\\t): void',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Multiple errors',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t@example\n\t\t\t\\`\\`\\`typescript\n\t\t\tconst foo: number = 1\n\n\t\t\tconst bar: Map<string, number> = new Map()\n\n\t\t\tinterface Baz {\n\t\t\t\t(x: string): unknown\n\t\t\t}\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`typescript\n\t\t\t\tconst foo: number = 1\n\n\t\t\t\tconst bar: Map<string, number> = new Map()\n\n\t\t\t\tinterface Baz {\n\t\t\t\t\t(x: string): unknown\n\t\t\t\t}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t@example\n\t\t\t\\`\\`\\`typescript\n\t\t\tconst foo = 1\n\n\t\t\tconst bar = new Map<string, number>()\n\n\t\t\ttype Baz = (x: string) => unknown\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`typescript\n\t\t\t\tconst foo = 1\n\n\t\t\t\tconst bar = new Map<string, number>()\n\n\t\t\t\ttype Baz = (x: string) => unknown\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/no-inferrable-types',\n\t\t\t\tline: 4,\n\t\t\t\ttextBeforeStart: 'const ',\n\t\t\t\ttarget: 'foo: number = 1',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-generic-constructors',\n\t\t\t\tline: 6,\n\t\t\t\ttextBeforeStart: 'const ',\n\t\t\t\ttarget: 'bar: Map<string, number> = new Map()',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-type-definitions',\n\t\t\t\tline: 8,\n\t\t\t\ttextBeforeStart: 'interface ',\n\t\t\t\ttarget: 'Baz',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 9,\n\t\t\t\ttextBeforeStart: '\\t',\n\t\t\t\ttarget: '(x: string): unknown',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/no-inferrable-types',\n\t\t\t\tline: 19,\n\t\t\t\ttextBeforeStart: '\\tconst ',\n\t\t\t\ttarget: 'foo: number = 1',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-generic-constructors',\n\t\t\t\tline: 21,\n\t\t\t\ttextBeforeStart: '\\tconst ',\n\t\t\t\ttarget: 'bar: Map<string, number> = new Map()',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/consistent-type-definitions',\n\t\t\t\tline: 23,\n\t\t\t\ttextBeforeStart: '\\tinterface ',\n\t\t\t\ttarget: 'Baz',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 24,\n\t\t\t\ttextBeforeStart: '\\t\\t',\n\t\t\t\ttarget: '(x: string): unknown',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Overlapping errors',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: Array<Array<string>> = [];\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: Array<Array<string>> = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\tconst foo: string[][] = [];\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo: string[][] = [];\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 3,\n\t\t\t\ttextBeforeStart: 'const foo: ',\n\t\t\t\ttarget: 'Array<Array<string>>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 3,\n\t\t\t\ttextBeforeStart: 'const foo: Array<',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 11,\n\t\t\t\ttextBeforeStart: '\\tconst foo: ',\n\t\t\t\ttarget: 'Array<Array<string>>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 11,\n\t\t\t\ttextBeforeStart: '\\tconst foo: Array<',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Error reporting location different from fix location',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\ttype Foo = {\n\t\t\t\t(): void;\n\t\t\t};\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = {\n\t\t\t\t\t(): void;\n\t\t\t\t};\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\ttype Foo = () => void;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = () => void;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 4,\n\t\t\t\ttextBeforeStart: '\\t',\n\t\t\t\ttarget: '(): void;',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/prefer-function-type',\n\t\t\t\tline: 14,\n\t\t\t\ttextBeforeStart: '\\t\\t',\n\t\t\t\ttarget: '(): void;',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Non fixable error',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\t\t\t@example\n\t\t\t\\`\\`\\`\n\t\t\ttype Foo = {};\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`\n\t\t\t\ttype Foo = {};\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: undefined,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/no-empty-object-type',\n\t\t\t\tline: 5,\n\t\t\t\ttextBeforeStart: 'type Foo = ',\n\t\t\t\ttarget: '{}',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/no-empty-object-type',\n\t\t\t\tline: 15,\n\t\t\t\ttextBeforeStart: '\\ttype Foo = ',\n\t\t\t\ttarget: '{}',\n\t\t\t}),\n\t\t],\n\t},\n\n\t{\n\t\tname: 'Error outside JSDoc',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\t\t\t\\`\\`\\`\n\t\t\ttype Foo = string;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = Array<string>;\n\n\t\t\ttype Foo = String;\n\t\t`,\n\t\toutput: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\t\t\t\\`\\`\\`\n\t\t\ttype Foo = string;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string[];\n\n\t\t\ttype Foo = string;\n\t\t`,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/array-type',\n\t\t\t\tline: 7,\n\t\t\t\ttextBeforeStart: 'export type T0 = ',\n\t\t\t\ttarget: 'Array<string>',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\truleId: '@typescript-eslint/no-wrapper-object-types',\n\t\t\t\tline: 9,\n\t\t\t\ttextBeforeStart: 'type Foo = ',\n\t\t\t\ttarget: 'String',\n\t\t\t}),\n\t\t],\n\t},\n\t{\n\t\tname: 'Error ending at first column',\n\t\tcode: dedenter`\n\t\t\t/**\n\t\t\tSome description.\n\n\t\t\tNote:\n\t\t\t    @example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = 'error_ending_at_first_column'\n\t\t\t\ttype Bar = number\n\t\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\n\t\t\texport type TOptions = {\n\t\t\t\t/**\n\t\t\t\tSome description.\n\n\t\t\t\tNote:\n\t\t\t\t\t@example\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype Foo = 'error_ending_at_first_column'\n\t\t\t\t\ttype Bar = number\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\tp0: string;\n\t\t\t};\n\t\t`,\n\t\toutput: undefined,\n\t\terrors: [\n\t\t\terrorAt({\n\t\t\t\tline: 7,\n\t\t\t\ttextBeforeStart: '\\t',\n\t\t\t\tendLine: 8,\n\t\t\t\ttextBeforeEnd: '',\n\t\t\t}),\n\t\t\terrorAt({\n\t\t\t\tline: 20,\n\t\t\t\ttextBeforeStart: '\\t\\t',\n\t\t\t\tendLine: 21,\n\t\t\t\ttextBeforeEnd: '',\n\t\t\t}),\n\t\t],\n\t},\n];\n\ndescribe('jsdoc-codeblocks processor', {concurrency: true}, () => {\n\tconst eslint = new ESLint({cwd: root});\n\tconst eslintFixed = new ESLint({cwd: root, fix: true});\n\n\tconst testCases = [\n\t\t...valid.map(testCase => ({...testCase, type: 'valid'})),\n\t\t...invalid.map(testCase => ({...testCase, type: 'invalid'})),\n\t];\n\n\tfor (const {type, name, code, output, errors = []} of testCases) {\n\t\ttest(`${type} - ${name}`, async t => {\n\t\t\tconst fileName = `test-${type}-${name.replaceAll(/\\s+/g, '-')}.d.ts`;\n\t\t\tconst filePath = path.join(root, fileName);\n\t\t\tawait fs.writeFile(filePath, code);\n\t\t\tt.after(async () => {\n\t\t\t\tawait fs.unlink(filePath);\n\t\t\t});\n\n\t\t\tconst results = await eslint.lintFiles([fileName]);\n\t\t\tt.assert.strictEqual(results[0].messages.length, errors.length);\n\n\t\t\tif (type === 'invalid') {\n\t\t\t\t// Manual loop because `assert.partialDeepStrictEqual` isn't available in Node 20\n\t\t\t\tfor (const [index, expected] of errors.entries()) {\n\t\t\t\t\tconst actual = results[0].messages[index];\n\t\t\t\t\tconst actualSubset = Object.fromEntries(Object.keys(expected).map(key => [key, actual[key]]));\n\n\t\t\t\t\tt.assert.deepStrictEqual(actualSubset, expected);\n\t\t\t\t}\n\n\t\t\t\tconst resultsFixed = await eslintFixed.lintFiles([fileName]);\n\t\t\t\tt.assert.strictEqual(resultsFixed[0].output, output);\n\t\t\t}\n\t\t});\n\t}\n});\n"
  },
  {
    "path": "lint-rules/import-path.js",
    "content": "import path from 'node:path';\n\nexport const importPathRule = /** @type {const} */ ({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Enforces import paths to end with a \\'.d.ts\\' extension.',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\tincorrectImportPath:\n                'Import path \\'{{importPath}}\\' must end with a \\'.d.ts\\' extension. Use \\'{{fixedImportPath}}\\' instead.',\n\t\t},\n\t\tschema: [],\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\treturn {\n\t\t\t'ImportDeclaration, ExportNamedDeclaration, ExportAllDeclaration'(node) {\n\t\t\t\t// Exit if not a re-export\n\t\t\t\tif (!node.source) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst importPath = node.source.value;\n\n\t\t\t\t// Skip if not relative path\n\t\t\t\tif (!(importPath.startsWith('./') || importPath.startsWith('../'))) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst filename = path.basename(importPath);\n\t\t\t\tconst firstDotIndex = filename.indexOf('.');\n\t\t\t\tconst extension = firstDotIndex === -1 ? '' : filename.slice(firstDotIndex);\n\n\t\t\t\t// Skip if the import path already ends with `.d.ts`\n\t\t\t\tif (extension === '.d.ts') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst importPathWithoutExtension = extension.length > 0\n\t\t\t\t\t? importPath.slice(0, -extension.length)\n\t\t\t\t\t: importPath;\n\t\t\t\tconst fixedImportPath = `${importPathWithoutExtension}.d.ts`;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: node.source,\n\t\t\t\t\tmessageId: 'incorrectImportPath',\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\treturn fixer.replaceText(node.source, `'${fixedImportPath}'`);\n\t\t\t\t\t},\n\t\t\t\t\tdata: {importPath, fixedImportPath},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n"
  },
  {
    "path": "lint-rules/import-path.test.js",
    "content": "import {createRuleTester} from './test-utils.js';\nimport {importPathRule} from './import-path.js';\n\nconst ruleTester = createRuleTester();\n\nconst invalidImport = (code, output) => ({\n\tcode,\n\terrors: [{messageId: 'incorrectImportPath'}],\n\toutput,\n});\n\nruleTester.run('import-path', importPathRule, {\n\tvalid: [\n\t\t// Already has .d.ts extension\n\t\t{\n\t\t\tcode: 'import type {Foo} from \"./foo.d.ts\";',\n\t\t},\n\t\t{\n\t\t\tcode: 'import type {Bar} from \"../bar.d.ts\";',\n\t\t},\n\t\t{\n\t\t\tcode: 'import {Baz} from \"./types/baz.d.ts\";',\n\t\t},\n\t\t// Non-relative imports are ignored\n\t\t{\n\t\t\tcode: 'import {something} from \"external-package\";',\n\t\t},\n\t\t{\n\t\t\tcode: 'import type {Type} from \"@types/node\";',\n\t\t},\n\t\t// Export named declarations with .d.ts extension\n\t\t{\n\t\t\tcode: 'export type {Foo} from \"./foo.d.ts\";',\n\t\t},\n\t\t{\n\t\t\tcode: 'export {Bar} from \"../bar.d.ts\";',\n\t\t},\n\t\t{\n\t\t\tcode: 'export type {Baz as Qux} from \"./types/baz.d.ts\";',\n\t\t},\n\t\t// Export all declarations with .d.ts extension\n\t\t{\n\t\t\tcode: 'export * from \"./foo.d.ts\";',\n\t\t},\n\t\t{\n\t\t\tcode: 'export * from \"../bar.d.ts\";',\n\t\t},\n\t\t{\n\t\t\tcode: 'export * as Types from \"./types.d.ts\";',\n\t\t},\n\t\t// Non re-exports are ignored\n\t\t{\n\t\t\tcode: 'export {localVar};',\n\t\t},\n\t\t{\n\t\t\tcode: 'export type {LocalType};',\n\t\t},\n\t\t{\n\t\t\tcode: 'export type Foo = string;',\n\t\t},\n\t\t// Non-relative exports are ignored\n\t\t{\n\t\t\tcode: 'export {something} from \"external-package\";',\n\t\t},\n\t\t{\n\t\t\tcode: 'export * from \"@types/node\";',\n\t\t},\n\t],\n\tinvalid: [\n\t\t// Missing extension\n\t\tinvalidImport(\n\t\t\t'import type {Foo} from \"./foo\";',\n\t\t\t'import type {Foo} from \\'./foo.d.ts\\';',\n\t\t),\n\t\t// Wrong extension .ts\n\t\tinvalidImport(\n\t\t\t'import type {Bar} from \"../bar.ts\";',\n\t\t\t'import type {Bar} from \\'../bar.d.ts\\';',\n\t\t),\n\t\t// Wrong extension .js\n\t\tinvalidImport(\n\t\t\t'import type {Baz} from \"./types.js\";',\n\t\t\t'import type {Baz} from \\'./types.d.ts\\';',\n\t\t),\n\t\t// Deep path\n\t\tinvalidImport(\n\t\t\t'import type {Deep} from \"../../deep/path.tsx\";',\n\t\t\t'import type {Deep} from \\'../../deep/path.d.ts\\';',\n\t\t),\n\t\t// Export named declarations - missing extension\n\t\tinvalidImport(\n\t\t\t'export type {Foo} from \"./foo\";',\n\t\t\t'export type {Foo} from \\'./foo.d.ts\\';',\n\t\t),\n\t\tinvalidImport(\n\t\t\t'export {Bar} from \"../bar\";',\n\t\t\t'export {Bar} from \\'../bar.d.ts\\';',\n\t\t),\n\t\t// Export named declarations - wrong extension\n\t\tinvalidImport(\n\t\t\t'export type {Baz} from \"./types.ts\";',\n\t\t\t'export type {Baz} from \\'./types.d.ts\\';',\n\t\t),\n\t\tinvalidImport(\n\t\t\t'export {Qux} from \"./qux.js\";',\n\t\t\t'export {Qux} from \\'./qux.d.ts\\';',\n\t\t),\n\t\t// Export all declarations - missing extension\n\t\tinvalidImport(\n\t\t\t'export * from \"./foo\";',\n\t\t\t'export * from \\'./foo.d.ts\\';',\n\t\t),\n\t\tinvalidImport(\n\t\t\t'export * from \"../bar\";',\n\t\t\t'export * from \\'../bar.d.ts\\';',\n\t\t),\n\t\t// Export all declarations - wrong extension\n\t\tinvalidImport(\n\t\t\t'export * from \"./types.ts\";',\n\t\t\t'export * from \\'./types.d.ts\\';',\n\t\t),\n\t\tinvalidImport(\n\t\t\t'export * as AllTypes from \"../../all.js\";',\n\t\t\t'export * as AllTypes from \\'../../all.d.ts\\';',\n\t\t),\n\t\t// Wrong extension .d.d.ts\n\t\tinvalidImport(\n\t\t\t'import type {Foo} from \"./foo.d.d.ts\";',\n\t\t\t'import type {Foo} from \\'./foo.d.ts\\';',\n\t\t),\n\t],\n});\n"
  },
  {
    "path": "lint-rules/require-export.js",
    "content": "export const requireExportRule = /** @type {const} */ ({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Ensure .d.ts files always have `export {}` to avoid being treated as global',\n\t\t\tcategory: 'Best Practices',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tnoEmptyExport: 'File must have `export {}` to ensure it is treated as a module.',\n\t\t},\n\t\tfixable: 'code',\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\tconst filename = context.filename.replaceAll('\\\\', '/');\n\n\t\t// Only check source .d.ts files\n\t\tif (!filename.includes('/source/') || !filename.endsWith('.d.ts')) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet hasEmptyExport = false;\n\n\t\treturn {\n\t\t\tExportNamedDeclaration(node) {\n\t\t\t\t// Check if this is specifically `export {}`\n\t\t\t\tif (!node.declaration && node.specifiers.length === 0 && !node.source) {\n\t\t\t\t\thasEmptyExport = true;\n\t\t\t\t}\n\t\t\t},\n\t\t\t'Program:exit'(node) {\n\t\t\t\tif (!hasEmptyExport) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'noEmptyExport',\n\t\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\t\t// Add export {} at the end of the file\n\t\t\t\t\t\t\treturn fixer.insertTextAfter(node, '\\nexport {};\\n');\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n});\n"
  },
  {
    "path": "lint-rules/require-export.test.js",
    "content": "import {createRuleTester} from './test-utils.js';\nimport {requireExportRule} from './require-export.js';\n\nconst ruleTester = createRuleTester();\n\nconst missingEmptyExport = (code, filename, output) => ({\n\tcode,\n\tfilename,\n\terrors: [{messageId: 'noEmptyExport'}],\n\toutput,\n});\n\nruleTester.run('require-export', requireExportRule, {\n\tvalid: [\n\t\t// Has export {}\n\t\t{\n\t\t\tcode: 'export {};',\n\t\t\tfilename: '/source/foo.d.ts',\n\t\t},\n\t\t// Has export {} with other exports\n\t\t{\n\t\t\tcode: 'export type Foo = string;\\nexport {};',\n\t\t\tfilename: '/source/bar.d.ts',\n\t\t},\n\t\t// Non-.d.ts files don't need export {}\n\t\t{\n\t\t\tcode: 'const x = 1;',\n\t\t\tfilename: '/source/foo.ts',\n\t\t},\n\t\t{\n\t\t\tcode: 'export const y = 2;',\n\t\t\tfilename: '/source/bar.js',\n\t\t},\n\t\t// Files outside source directory are ignored\n\t\t{\n\t\t\tcode: 'type Test = string;',\n\t\t\tfilename: '/test/foo.d.ts',\n\t\t},\n\t\t{\n\t\t\tcode: 'interface ITest {}',\n\t\t\tfilename: '/lib/bar.d.ts',\n\t\t},\n\t],\n\tinvalid: [\n\t\t// Missing export {} in empty file\n\t\tmissingEmptyExport('', '/source/foo.d.ts', '\\nexport {};\\n'),\n\t\t// Missing export {} with type declarations\n\t\tmissingEmptyExport(\n\t\t\t'export type Foo = string;',\n\t\t\t'/source/bar.d.ts',\n\t\t\t'export type Foo = string;\\nexport {};\\n',\n\t\t),\n\t\t// Missing export {} with interface\n\t\tmissingEmptyExport(\n\t\t\t'export interface IFoo {\\n\\tx: string;\\n}',\n\t\t\t'/source/baz.d.ts',\n\t\t\t'export interface IFoo {\\n\\tx: string;\\n}\\nexport {};\\n',\n\t\t),\n\t\t// Missing export {} with multiple exports\n\t\tmissingEmptyExport(\n\t\t\t'export type A = string;\\nexport type B = number;',\n\t\t\t'/source/multi.d.ts',\n\t\t\t'export type A = string;\\nexport type B = number;\\nexport {};\\n',\n\t\t),\n\t],\n});\n"
  },
  {
    "path": "lint-rules/require-exported-types.js",
    "content": "import path from 'node:path';\nimport fs from 'node:fs';\n\nexport const requireExportedTypesRule = /** @type {const} */ ({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Enforce that exported types are also exported from index.d.ts',\n\t\t\tcategory: 'Best Practices',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tmissingExport: 'Type `{{typeName}}` is exported from this file but not from index.d.ts. '\n\t\t\t\t+ 'Add it to index.d.ts or use `// eslint-disable-next-line type-fest/require-exported-types` to ignore.',\n\t\t\tnoTypeInfo: 'Rule requires TypeScript type information. Configure `parserServices` in your ESLint config.',\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tindexFile: {\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'Path to the index file (default: \"index.d.ts\")',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\t// Only run on TypeScript declaration files in source directory\n\t\t// Convert to forward slashes for consistent path checking across platforms\n\t\tconst filename = context.filename.replaceAll('\\\\', '/');\n\t\tif (!filename.includes('/source/') || !filename.endsWith('.d.ts')) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Skip internal files\n\t\tif (filename.includes('/internal/')) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst options = context.options?.[0] ?? {};\n\t\tconst indexFileName = options.indexFile ?? 'index.d.ts';\n\n\t\t// Get TypeScript type-aware services\n\t\tconst {parserServices} = context.sourceCode;\n\n\t\t// Type information is required for this rule\n\t\tif (!parserServices?.program || !parserServices?.esTreeNodeToTSNodeMap) {\n\t\t\t// Report once per file that type information is required\n\t\t\treturn {\n\t\t\t\t'Program'(node) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: 'noTypeInfo',\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst {program} = parserServices;\n\t\tconst checker = program.getTypeChecker();\n\n\t\t// Find project root\n\t\tlet projectRoot = path.dirname(filename);\n\t\twhile (projectRoot !== path.dirname(projectRoot)) {\n\t\t\tif (fs.existsSync(path.join(projectRoot, 'package.json'))) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tprojectRoot = path.dirname(projectRoot);\n\t\t}\n\n\t\tconst indexPath = path.join(projectRoot, indexFileName);\n\n\t\t// Get index exports (no caching to detect changes immediately)\n\t\tconst indexExports = new Set();\n\n\t\t// Get the source file for index.d.ts\n\t\tconst indexSourceFile = program.getSourceFile(indexPath);\n\t\tif (indexSourceFile) {\n\t\t\tconst indexSymbol = checker.getSymbolAtLocation(indexSourceFile);\n\t\t\tif (indexSymbol) {\n\t\t\t\tconst exports = checker.getExportsOfModule(indexSymbol);\n\t\t\t\tfor (const exportSymbol of exports) {\n\t\t\t\t\tindexExports.add(exportSymbol.name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// State to track processed nodes\n\t\tconst processed = new Set();\n\n\t\t// Helper function to check exported type/interface\n\t\tconst checkExportedType = node => {\n\t\t\tconst typeName = node.id.name;\n\n\t\t\t// Skip types starting with underscore (internal/private convention)\n\t\t\tif (typeName.startsWith('_')) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip if inside declare namespace\n\t\t\tconst ancestors = context.sourceCode.getAncestors(node);\n\t\t\tconst isInsideDeclareNamespace = ancestors.some(ancestor =>\n\t\t\t\tancestor.type === 'TSModuleDeclaration' && ancestor.declare,\n\t\t\t);\n\n\t\t\tif (isInsideDeclareNamespace) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip if already processed\n\t\t\tif (processed.has(typeName)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tprocessed.add(typeName);\n\n\t\t\t// Report if not exported from index\n\t\t\tif (!indexExports.has(typeName)) {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'missingExport',\n\t\t\t\t\tdata: {typeName},\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\t// Handle: export type Foo = ...\n\t\t\t'ExportNamedDeclaration > TSTypeAliasDeclaration': checkExportedType,\n\n\t\t\t// Handle: export interface Foo { ... }\n\t\t\t'ExportNamedDeclaration > TSInterfaceDeclaration': checkExportedType,\n\n\t\t\t// Clean up cache periodically\n\t\t};\n\t},\n});\n"
  },
  {
    "path": "lint-rules/require-exported-types.test.js",
    "content": "import {createTypeAwareRuleTester} from './test-utils.js';\nimport {requireExportedTypesRule} from './require-exported-types.js';\n\nconst packageContent = JSON.stringify({\n\tname: 'require-exported-types-fixture',\n}, null, '\\t');\n\nconst indexContent = 'export {type ExportedType} from \\'./source/exported-type\\';\\n';\nconst exportedTypeContent = 'export type ExportedType = {\\n\\tvalue: string;\\n};\\n';\nconst internalTypeContent = 'export type InternalType = {\\n\\tvalue: boolean;\\n};\\n';\nconst nestedInternalTypeContent = 'export interface NestedInternalType {\\n\\tvalue: string;\\n}\\n';\nconst privateTypeContent = 'export type _HiddenType = string;\\n';\nconst missingTypeContent = 'export type MissingType = {\\n\\tvalue: number;\\n};\\n';\nconst unexportedMultipleContent = 'export type FirstUnexportedType = string;\\nexport interface SecondUnexportedInterface {\\n\\tvalue: boolean;\\n}\\n';\nconst implementationContent = 'export const value = 1;\\n';\nconst testDeclarationContent = 'export type Test = number;\\n';\nconst libDeclarationContent = 'export interface LibTest {\\n\\tvalue: string;\\n}\\n';\n\nconst {ruleTester, fixturePath} = createTypeAwareRuleTester({\n\t'package.json': `${packageContent}\\n`,\n\t'index.d.ts': indexContent,\n\t'source/exported-type.d.ts': undefined,\n\t'source/internal/internal-type.d.ts': undefined,\n\t'source/internal/nested/deep.d.ts': undefined,\n\t'source/private-type.d.ts': undefined,\n\t'source/missing-type.d.ts': undefined,\n\t'source/unexported-multiple.d.ts': undefined,\n\t'source/implementation.ts': undefined,\n\t'test/test.d.ts': undefined,\n\t'lib/test.d.ts': undefined,\n});\n\n// Type-aware rule tests rely on the generated fixture project above.\nconst missingExportError = typeName => ({\n\tmessageId: 'missingExport',\n\tdata: {typeName},\n});\n\nruleTester.run('require-exported-types', requireExportedTypesRule, {\n\tvalid: [\n\t\t{\n\t\t\tcode: exportedTypeContent,\n\t\t\tfilename: fixturePath('source/exported-type.d.ts'),\n\t\t},\n\t\t{\n\t\t\tcode: privateTypeContent,\n\t\t\tfilename: fixturePath('source/private-type.d.ts'),\n\t\t},\n\t\t{\n\t\t\tcode: internalTypeContent,\n\t\t\tfilename: fixturePath('source/internal/internal-type.d.ts'),\n\t\t},\n\t\t{\n\t\t\tcode: nestedInternalTypeContent,\n\t\t\tfilename: fixturePath('source/internal/nested/deep.d.ts'),\n\t\t},\n\t\t{\n\t\t\tcode: implementationContent,\n\t\t\tfilename: fixturePath('source/implementation.ts'),\n\t\t},\n\t\t{\n\t\t\tcode: testDeclarationContent,\n\t\t\tfilename: fixturePath('test/test.d.ts'),\n\t\t},\n\t\t{\n\t\t\tcode: libDeclarationContent,\n\t\t\tfilename: fixturePath('lib/test.d.ts'),\n\t\t},\n\t],\n\tinvalid: [\n\t\t{\n\t\t\tcode: missingTypeContent,\n\t\t\tfilename: fixturePath('source/missing-type.d.ts'),\n\t\t\terrors: [missingExportError('MissingType')],\n\t\t},\n\t\t{\n\t\t\tcode: unexportedMultipleContent,\n\t\t\tfilename: fixturePath('source/unexported-multiple.d.ts'),\n\t\t\terrors: [\n\t\t\t\tmissingExportError('FirstUnexportedType'),\n\t\t\t\tmissingExportError('SecondUnexportedInterface'),\n\t\t\t],\n\t\t},\n\t],\n});\n"
  },
  {
    "path": "lint-rules/source-files-extension.js",
    "content": "import path from 'node:path';\n\nexport const sourceFilesExtensionRule = /** @type {const} */ ({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Enforces source files to end with a \\'.d.ts\\' extension.',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\tincorrectFilename:\n\t\t\t\t'Filename \\'{{filename}}\\' must end with a \\'.d.ts\\' extension. Use \\'{{fixedFilename}}\\' instead.',\n\t\t},\n\t\tschema: [],\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\tconst filename = path.basename(context.filename);\n\t\tconst firstDotIndex = filename.indexOf('.');\n\t\tconst extension = firstDotIndex === -1 ? '' : filename.slice(firstDotIndex);\n\n\t\tif (extension === '.d.ts') {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tProgram(node) {\n\t\t\t\tconst filenameWithoutExtension = extension.length > 0\n\t\t\t\t\t? filename.slice(0, -extension.length)\n\t\t\t\t\t: filename;\n\t\t\t\tconst fixedFilename = `${filenameWithoutExtension}.d.ts`;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tloc: {column: 0, line: 1}, // Report error on start of the file\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'incorrectFilename',\n\t\t\t\t\tdata: {filename, fixedFilename},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n"
  },
  {
    "path": "lint-rules/source-files-extension.test.js",
    "content": "import {createRuleTester} from './test-utils.js';\nimport {sourceFilesExtensionRule} from './source-files-extension.js';\n\nconst ruleTester = createRuleTester();\n\nconst invalidSourceFile = (filename, code = '') => ({\n\tcode,\n\tfilename,\n\terrors: [{messageId: 'incorrectFilename'}],\n});\n\nruleTester.run('source-files-extension', sourceFilesExtensionRule, {\n\tvalid: [\n\t\t// Correct .d.ts extension\n\t\t{\n\t\t\tcode: '',\n\t\t\tfilename: '/source/foo.d.ts',\n\t\t},\n\t\t{\n\t\t\tcode: '',\n\t\t\tfilename: '/source/types/bar.d.ts',\n\t\t},\n\t\t{\n\t\t\tcode: '',\n\t\t\tfilename: '/source/deeply/nested/file.d.ts',\n\t\t},\n\t],\n\tinvalid: [\n\t\t// Wrong .ts extension\n\t\tinvalidSourceFile('/source/foo.ts'),\n\t\t// Wrong .js extension\n\t\tinvalidSourceFile('/source/foo.js'),\n\t\t// No extension\n\t\tinvalidSourceFile('/source/bar'),\n\t\t// Wrong .tsx extension\n\t\tinvalidSourceFile('/source/component.tsx'),\n\t\t// Wrong .mjs extension\n\t\tinvalidSourceFile('/source/module.mjs'),\n\t],\n});\n"
  },
  {
    "path": "lint-rules/test-utils.js",
    "content": "import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport {RuleTester} from 'eslint';\nimport tsParser from '@typescript-eslint/parser';\nimport dedent from 'dedent';\n\nexport const createRuleTester = (overrides = {}) => {\n\tconst {\n\t\tlanguageOptions: overrideLanguageOptions = {},\n\t\t...restOverrides\n\t} = overrides;\n\n\tconst {\n\t\tparserOptions: overrideParserOptions = {},\n\t\t...otherLanguageOptions\n\t} = overrideLanguageOptions;\n\n\treturn new RuleTester({\n\t\t...restOverrides,\n\t\tlanguageOptions: {\n\t\t\tecmaVersion: 'latest',\n\t\t\tsourceType: 'module',\n\t\t\tparser: tsParser,\n\t\t\t...otherLanguageOptions,\n\t\t\tparserOptions: {\n\t\t\t\t...overrideParserOptions,\n\t\t\t},\n\t\t},\n\t});\n};\n\nconst defaultTypeAwareTsconfig = {\n\tcompilerOptions: {\n\t\tdeclaration: true,\n\t\temitDeclarationOnly: true,\n\t\tmodule: 'ESNext',\n\t\tmoduleResolution: 'Bundler',\n\t\tskipLibCheck: true,\n\t\tstrict: true,\n\t\ttarget: 'ES2022',\n\t},\n\tinclude: [\n\t\t'*.d.ts',\n\t\t'source/**/*.*',\n\t\t'lib/**/*.d.ts',\n\t\t'test/**/*.d.ts',\n\t],\n};\n\nexport const createTypeAwareRuleTester = (fixtureFiles, options = {}) => {\n\tconst fixtureRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'type-fest-type-aware-'));\n\n\tconst writeFixture = (relativePath, content) => {\n\t\tconst absolutePath = path.join(fixtureRoot, relativePath);\n\t\tfs.mkdirSync(path.dirname(absolutePath), {recursive: true});\n\t\tfs.writeFileSync(absolutePath, content ?? '');\n\t};\n\n\tfor (const [relativePath, content] of Object.entries(fixtureFiles)) {\n\t\twriteFixture(relativePath, content);\n\t}\n\n\tconst hasRuleTesterOption = Object.hasOwn(options, 'ruleTester');\n\tconst hasTsconfigOption = Object.hasOwn(options, 'tsconfig');\n\tconst ruleTesterOverrides = hasRuleTesterOption || hasTsconfigOption ? options.ruleTester ?? {} : options;\n\tconst tsconfig = hasRuleTesterOption || hasTsconfigOption\n\t\t? options.tsconfig ?? defaultTypeAwareTsconfig\n\t\t: defaultTypeAwareTsconfig;\n\n\tif (!('tsconfig.json' in fixtureFiles)) {\n\t\twriteFixture('tsconfig.json', `${JSON.stringify(tsconfig, null, '\\t')}\\n`);\n\t}\n\n\tconst overrideLanguageOptions = ruleTesterOverrides.languageOptions ?? {};\n\tconst overrideParserOptions = overrideLanguageOptions.parserOptions ?? {};\n\tconst overrideProjectService = overrideParserOptions.projectService ?? {};\n\tconst ruleTester = createRuleTester({\n\t\t...ruleTesterOverrides,\n\t\tlanguageOptions: {\n\t\t\t...overrideLanguageOptions,\n\t\t\tparserOptions: {\n\t\t\t\t...overrideParserOptions,\n\t\t\t\tprojectService: {\n\t\t\t\t\tallowDefaultProject: ['*.ts*'],\n\t\t\t\t\t...overrideProjectService,\n\t\t\t\t},\n\t\t\t\ttsconfigRootDir: fixtureRoot,\n\t\t\t},\n\t\t},\n\t});\n\n\tconst fixturePath = relativePath => path.join(fixtureRoot, relativePath);\n\n\treturn {\n\t\truleTester,\n\t\tfixtureRoot,\n\t\tfixturePath,\n\t\twriteFixture,\n\t};\n};\n\nexport const dedenter = dedent.withOptions({alignValues: true});\n\n/**\nReturns the specified code in a fenced code block, with an optional language tag.\n\n@example\n```\nfence('type A = string;');\n// Returns:\n// ```\n// type A = string;\n// ```\n\nfence(`import {RemovePrefix} from 'type-fest';\n\ntype A = RemovePrefix<'onChange', 'on'>;\n//=> 'Change'`, 'ts');\n// Returns:\n// ```ts\n// import {RemovePrefix} from 'type-fest';\n\n// type A = RemovePrefix<'onChange', 'on'>;\n// //=> 'Change'\n// ```\n```\n*/\nexport const fence = (code, lang = '') =>\n\tdedenter`\n\t\t\\`\\`\\`${lang}\n\t\t${code}\n\t\t\\`\\`\\`\n\t`;\n\n/**\nReturns the specified lines as a JSDoc comment, placing each specified line on a new line.\n\n@example\n```\njsdoc('Some description.', 'Note: Some note.');\n// Returns:\n// /**\n// Some description.\n// Note: Some note.\n// *​/\n\njsdoc('@example', '```\\ntype A = string;\\n```', '@category Test');\n// Returns;\n// /**\n// @example\n// ```\n// type A = string;\n// ```\n// @category Test\n// *​/\n```\n*/\nexport const jsdoc = (...lines) =>\n\tdedenter`\n\t\t/**\n\t\t${lines.join('\\n')}\n\t\t*/\n\t`;\n\n/**\nReturns an exported type for each provided prefix, with each prefix placed directly above its corresponding type declaration.\n\n@example\n```\nexportType(\n\t'// Some comment',\n\t'type Test = string;',\n\t'/**\\nSome description.\\nNote: Some note.\\n*​/'\n);\n// Returns:\n// // Some comment\n// export type T0 = string;\n//\n// type Test = string;\n// export type T1 = string;\n//\n// /**\n// Some description.\n// Note: Some note.\n// *​/\n// export type T2 = string;\n*/\nexport const exportType = (...prefixes) =>\n\tprefixes\n\t\t.map((doc, i) => dedenter`\n\t\t\t${doc}\n\t\t\texport type T${i} = string;\n\t\t`)\n\t\t.join('\\n\\n');\n\n/**\nReturns an exported \"Options\" object type containing a property for each specified prefix, with each prefix placed directly above its corresponding property declaration.\n\n@example\n```\nexportOption(\n\t'// Some comment',\n\t'type Test = string;',\n\t'/**\\nSome description.\\nNote: Some note.\\n*​/'\n);\n// Returns:\n// export type TOptions = {\n// \t// Some comment\n// \tp0: string;\n\n// \ttest: string;\n// \tp1: string;\n\n// \t/**\n// \tSome description.\n// \tNote: Some note.\n// \t*​/\n// \tp2: string;\n// };\n```\n*/\nexport const exportOption = (...prefixes) =>\n\tdedenter`\n\t\texport type TOptions = {\n\t\t\t${prefixes\n\t\t\t\t.map((doc, i) => dedenter`\n\t\t\t\t\t${doc}\n\t\t\t\t\tp${i}: string;\n\t\t\t\t`)\n\t\t\t\t.join('\\n\\n')}\n\t\t};\n\t`;\n\n/**\nReturns an exported type for each provided prefix, and an exported \"Options\" object type containing a property for each specified prefix, with each prefix placed directly above its corresponding declaration.\n\n@example\n```\nexportTypeAndOption('// Some comment', '/**\\nSome JSDoc\\n*​/');\n// Returns:\n// // Some comment\n// type T0 = string;\n\n// /**\n// Some JSDoc\n// *​/\n// type T1 = string;\n\n// type TOptions = {\n// \t// Some comment\n// \tp0: string;\n\n// \t/**\n// \tSome JSDoc\n// \t*​/\n// \tp1: string;\n// };\n```\n*/\nexport const exportTypeAndOption = (...prefixes) =>\n\tdedenter`\n\t\t${exportType(...prefixes)}\n\n\t\t${exportOption(...prefixes)}\n\t`;\n\n/**\n@typedef {{\n\tline: number;\n\ttextBeforeStart: string;\n\truleId?: string;\n\tmessageId?: string;\n} & ({ target: string } | { endLine: number; textBeforeEnd: string })} ErrorAtProps\n\n@param {ErrorAtProps} props\n@returns {{line: number, column: number, endLine: number, endColumn: number, ruleId?: string, messageId?: string}}\n*/\nexport const errorAt = props => {\n\tconst {line, textBeforeStart, ruleId, messageId} = props;\n\n\tconst column = textBeforeStart.length + 1;\n\tconst endColumn = 'textBeforeEnd' in props ? props.textBeforeEnd.length + 1 : column + props.target.length;\n\n\tconst endLine = 'endLine' in props ? props.endLine : line;\n\n\treturn {\n\t\t...(ruleId && {ruleId}),\n\t\t...(messageId && {messageId}),\n\t\tline, // 1-based, inclusive\n\t\tcolumn, // 1-based, inclusive\n\t\tendLine, // 1-based, inclusive\n\t\tendColumn, // 1-based, exclusive\n\t};\n};\n\n/// Code samples\nexport const code1 = dedenter`\nimport type {Sum} from 'type-fest';\n\ntype A = Sum<1, 2>;\n//=> 3\n`;\n\nexport const code2 = dedenter`\nimport type {LiteralToPrimitiveDeep} from 'type-fest';\n\nconst config = {appName: 'MyApp', version: '1.0.0'} as const;\n\ndeclare function updateConfig(newConfig: LiteralToPrimitiveDeep<typeof config>): void;\n\nupdateConfig({appName: 'MyUpdatedApp', version: '2.0.0'});\n`;\n"
  },
  {
    "path": "lint-rules/validate-jsdoc-codeblocks.js",
    "content": "import path from 'node:path';\nimport ts from 'typescript';\nimport {createFSBackedSystem, createVirtualTypeScriptEnvironment} from '@typescript/vfs';\n\nconst CODEBLOCK_REGEX = /(?<openingFence>```(?:ts|typescript)?\\n)(?<code>[\\s\\S]*?)```/g;\nconst FILENAME = 'example-codeblock.ts';\nconst TWOSLASH_COMMENT = '//=>';\n\nconst compilerOptions = {\n\tlib: ['lib.es2023.d.ts', 'lib.dom.d.ts', 'lib.dom.iterable.d.ts'],\n\ttarget: ts.ScriptTarget.ESNext,\n\tmodule: ts.ModuleKind.Node20,\n\tmoduleResolution: ts.ModuleResolutionKind.Node16,\n\tstrict: true,\n\tnoImplicitReturns: true,\n\tnoImplicitOverride: true,\n\tnoUnusedLocals: false, // This is intentionally disabled\n\tnoUnusedParameters: true,\n\tnoFallthroughCasesInSwitch: true,\n\tnoUncheckedIndexedAccess: true,\n\tnoPropertyAccessFromIndexSignature: true,\n\tnoUncheckedSideEffectImports: true,\n\tuseDefineForClassFields: true,\n\texactOptionalPropertyTypes: true,\n};\n\nconst virtualFsMap = new Map();\nvirtualFsMap.set(FILENAME, '// Can\\'t be empty');\n\nconst rootDir = path.join(import.meta.dirname, '..');\nconst system = createFSBackedSystem(virtualFsMap, rootDir, ts);\nconst defaultEnv = createVirtualTypeScriptEnvironment(system, [FILENAME], ts, compilerOptions);\n\nfunction parseCompilerOptions(code) {\n\tconst options = {};\n\tconst lines = code.split('\\n');\n\n\tfor (const line of lines) {\n\t\tif (!line.trim()) {\n\t\t\t// Skip empty lines\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst match = line.match(/^\\s*\\/\\/ @(\\w+): (.*)$/);\n\t\tif (!match) {\n\t\t\t// Stop parsing at the first non-matching line\n\t\t\treturn options;\n\t\t}\n\n\t\tconst [, key, value] = match;\n\t\tconst trimmedValue = value.trim();\n\n\t\ttry {\n\t\t\toptions[key] = JSON.parse(trimmedValue);\n\t\t} catch {\n\t\t\toptions[key] = trimmedValue;\n\t\t}\n\t}\n\n\treturn options;\n}\n\nfunction getJSDocNode(sourceCode, node) {\n\tlet previousToken = sourceCode.getTokenBefore(node, {includeComments: true});\n\n\t// Skip over any line comments immediately before the node\n\twhile (previousToken && previousToken.type === 'Line') {\n\t\tpreviousToken = sourceCode.getTokenBefore(previousToken, {includeComments: true});\n\t}\n\n\tif (previousToken && previousToken.type === 'Block' && previousToken.value.startsWith('*')) {\n\t\treturn previousToken;\n\t}\n\n\treturn undefined;\n}\n\nexport const validateJSDocCodeblocksRule = /** @type {const} */ ({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Ensures JSDoc example codeblocks don\\'t have errors',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\tinvalidCodeblock: '{{errorMessage}}',\n\t\t\tincorrectTwoslashType: 'Expected twoslash comment to be: {{expectedComment}}, but found: {{actualComment}}',\n\t\t\tincorrectTwoslashFormat: 'Expected twoslash comment to be: {{expectedComment}}, but found: {{actualComment}}',\n\t\t},\n\t\tschema: [{\n\t\t\ttype: 'object',\n\t\t\tproperties: {\n\t\t\t\tverbosityLevels: {\n\t\t\t\t\ttype: 'array',\n\t\t\t\t\tuniqueItems: true,\n\t\t\t\t\titems: {\n\t\t\t\t\t\tminimum: 0,\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}],\n\t\t/** @type {unknown[]} */\n\t\tdefaultOptions: [{\n\t\t\tverbosityLevels: [],\n\t\t}],\n\t},\n\tcreate(context) {\n\t\tconst filename = context.filename.replaceAll('\\\\', '/');\n\n\t\t// Skip internal files\n\t\tif (filename.includes('/internal/')) {\n\t\t\treturn {};\n\t\t}\n\n\t\ttry {\n\t\t\tdefaultEnv.updateFile(context.filename, context.sourceCode.getText());\n\t\t} catch {\n\t\t\t// Ignore\n\t\t}\n\n\t\treturn {\n\t\t\tTSTypeAliasDeclaration(node) {\n\t\t\t\tconst {parent} = node;\n\n\t\t\t\t// Skip if type is not exported or starts with an underscore (private/internal)\n\t\t\t\tif (parent.type !== 'ExportNamedDeclaration' || node.id.name.startsWith('_')) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst previousNodes = [];\n\t\t\t\tconst jsdocForExport = getJSDocNode(context.sourceCode, parent);\n\t\t\t\tif (jsdocForExport) {\n\t\t\t\t\tpreviousNodes.push(jsdocForExport);\n\t\t\t\t}\n\n\t\t\t\t// Handle JSDoc blocks for options\n\t\t\t\tif (node.id.name.endsWith('Options') && node.typeAnnotation.type === 'TSTypeLiteral') {\n\t\t\t\t\tfor (const member of node.typeAnnotation.members) {\n\t\t\t\t\t\tconst jsdocForMember = getJSDocNode(context.sourceCode, member);\n\t\t\t\t\t\tif (jsdocForMember) {\n\t\t\t\t\t\t\tpreviousNodes.push(jsdocForMember);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const previousNode of previousNodes) {\n\t\t\t\t\tconst comment = previousNode.value;\n\n\t\t\t\t\tfor (const match of comment.matchAll(CODEBLOCK_REGEX)) {\n\t\t\t\t\t\tconst {code, openingFence} = match.groups ?? {};\n\n\t\t\t\t\t\t// Skip empty code blocks\n\t\t\t\t\t\tif (!code || !openingFence) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst matchOffset = match.index + openingFence.length + 2; // Add `2` because `comment` doesn't include the starting `/*`\n\t\t\t\t\t\tconst codeStartIndex = previousNode.range[0] + matchOffset;\n\n\t\t\t\t\t\tconst overrides = parseCompilerOptions(code);\n\t\t\t\t\t\tlet env = defaultEnv;\n\n\t\t\t\t\t\tif (Object.keys(overrides).length > 0) {\n\t\t\t\t\t\t\tconst {options, errors} = ts.convertCompilerOptionsFromJson(overrides, rootDir);\n\n\t\t\t\t\t\t\tif (errors.length === 0) {\n\t\t\t\t\t\t\t\t// Create a new environment with overridden options\n\t\t\t\t\t\t\t\tenv = createVirtualTypeScriptEnvironment(system, [FILENAME], ts, {...compilerOptions, ...options});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tenv.updateFile(FILENAME, code);\n\t\t\t\t\t\tconst syntacticDiagnostics = env.languageService.getSyntacticDiagnostics(FILENAME);\n\t\t\t\t\t\tconst semanticDiagnostics = env.languageService.getSemanticDiagnostics(FILENAME);\n\t\t\t\t\t\tconst diagnostics = syntacticDiagnostics.length > 0 ? syntacticDiagnostics : semanticDiagnostics; // Show semantic errors only if there are no syntactic errors\n\n\t\t\t\t\t\tfor (const diagnostic of diagnostics) {\n\t\t\t\t\t\t\t// If diagnostic location is not available, report on the entire code block\n\t\t\t\t\t\t\tconst diagnosticStart = codeStartIndex + (diagnostic.start ?? 0);\n\t\t\t\t\t\t\tconst diagnosticEnd = diagnosticStart + (diagnostic.length ?? code.length);\n\n\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\tloc: {\n\t\t\t\t\t\t\t\t\tstart: context.sourceCode.getLocFromIndex(diagnosticStart),\n\t\t\t\t\t\t\t\t\tend: context.sourceCode.getLocFromIndex(diagnosticEnd),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tmessageId: 'invalidCodeblock',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\terrorMessage: ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (diagnostics.length === 0) {\n\t\t\t\t\t\t\tvalidateTwoslashTypes(context, env, code, codeStartIndex);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n});\n\nfunction getLeftmostQuickInfo(env, line, lineOffset, verbosityLevel) {\n\tfor (let i = 0; i < line.length; i++) {\n\t\tconst quickInfo = env.languageService.getQuickInfoAtPosition(FILENAME, lineOffset + i, undefined, verbosityLevel);\n\t\tif (quickInfo?.displayParts) {\n\t\t\treturn quickInfo;\n\t\t}\n\t}\n}\n\nfunction extractTypeFromQuickInfo(quickInfo) {\n\tconst {displayParts} = quickInfo;\n\n\t// For interfaces and enums, return everything after the keyword\n\tconst keywordIndex = displayParts.findIndex(\n\t\tpart => part.kind === 'keyword' && ['interface', 'enum'].includes(part.text),\n\t);\n\n\tif (keywordIndex !== -1) {\n\t\treturn displayParts.slice(keywordIndex + 1).map(part => part.text).join('').trim();\n\t}\n\n\tlet depth = 0;\n\tconst separatorIndex = displayParts.findIndex(part => {\n\t\tif (part.kind === 'punctuation') {\n\t\t\tif (['(', '{', '<'].includes(part.text)) {\n\t\t\t\tdepth++;\n\t\t\t} else if ([')', '}', '>'].includes(part.text)) {\n\t\t\t\tdepth--;\n\t\t\t} else if (part.text === ':' && depth === 0) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if (part.kind === 'operator' && part.text === '=' && depth === 0) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t});\n\n\t// If `separatorIndex` is `-1` (not found), return the entire thing\n\treturn displayParts.slice(separatorIndex + 1).map(part => part.text).join('').trim();\n}\n\nfunction normalizeType(type, onlySortNumbers = false) {\n\tconst sourceFile = ts.createSourceFile(\n\t\t'twoslash-type.ts',\n\t\t`declare const test: ${type};`,\n\t\tts.ScriptTarget.Latest,\n\t);\n\n\tconst typeNode = sourceFile.statements[0].declarationList.declarations[0].type;\n\n\tconst print = node => ts.createPrinter().printNode(ts.EmitHint.Unspecified, node, sourceFile);\n\n\tconst isNumeric = v => v.trim() !== '' && Number.isFinite(Number(v));\n\n\tconst visit = node => {\n\t\tnode = ts.visitEachChild(node, visit, undefined);\n\n\t\tif (ts.isUnionTypeNode(node)) {\n\t\t\tlet types = node.types.map(t => [print(t), t]);\n\n\t\t\tif (onlySortNumbers) {\n\t\t\t\t// Sort only numeric members while keeping non-numeric members at their original positions\n\t\t\t\tconst sortedNumericTypes = types.filter(([a]) => isNumeric(a)).sort(([a], [b]) => Number(a) - Number(b));\n\t\t\t\tlet numericIndex = 0;\n\t\t\t\ttypes = types.map(t => isNumeric(t[0]) ? sortedNumericTypes[numericIndex++][1] : t[1]);\n\t\t\t} else {\n\t\t\t\ttypes = types\n\t\t\t\t\t.sort(([a], [b]) => a < b ? -1 : (a > b ? 1 : 0))\n\t\t\t\t\t.map(t => t[1]);\n\t\t\t}\n\n\t\t\treturn ts.factory.updateUnionTypeNode(\n\t\t\t\tnode,\n\t\t\t\tts.factory.createNodeArray(types),\n\t\t\t);\n\t\t}\n\n\t\t// Prefer single-line formatting for tuple types\n\t\tif (ts.isTupleTypeNode(node)) {\n\t\t\tconst updated = ts.factory.createTupleTypeNode(node.elements);\n\t\t\tts.setEmitFlags(updated, ts.EmitFlags.SingleLine);\n\t\t\treturn updated;\n\t\t}\n\n\t\t// Replace double-quoted string literals with single-quoted ones\n\t\tif (ts.isStringLiteral(node)) {\n\t\t\tconst updated = ts.factory.createStringLiteral(node.text, true);\n\t\t\t// Preserve non-ASCII characters like emojis.\n\t\t\tts.setEmitFlags(updated, ts.EmitFlags.NoAsciiEscaping);\n\t\t\treturn updated;\n\t\t}\n\n\t\treturn node;\n\t};\n\n\treturn print(visit(typeNode)).replaceAll(/^( +)/gm, indentation => {\n\t\t// Replace spaces used for indentation with tabs\n\t\tconst spacesPerTab = 4;\n\t\tconst tabCount = Math.floor(indentation.length / spacesPerTab);\n\t\tconst remainingSpaces = indentation.length % spacesPerTab;\n\t\treturn '\\t'.repeat(tabCount) + ' '.repeat(remainingSpaces);\n\t});\n}\n\nfunction getCommentForType(type) {\n\tlet comment = type;\n\n\tif (type.length < 80) {\n\t\tcomment = type\n\t\t\t.replaceAll(/\\r?\\n\\s*/g, ' ') // Collapse into single line\n\t\t\t.replaceAll(/{\\s+/g, '{') // Remove spaces after `{`\n\t\t\t.replaceAll(/\\s+}/g, '}') // Remove spaces before `}`\n\t\t\t.replaceAll(/;(?=})/g, ''); // Remove semicolons before `}`\n\t}\n\n\treturn `${TWOSLASH_COMMENT} ${comment.replaceAll('\\n', '\\n// ')}`;\n}\n\nfunction reportTypeMismatch({context, messageId, start, end, data, fix}) {\n\tcontext.report({\n\t\tloc: {\n\t\t\tstart: context.sourceCode.getLocFromIndex(start),\n\t\t\tend: context.sourceCode.getLocFromIndex(end),\n\t\t},\n\t\tmessageId,\n\t\tdata,\n\t\tfix(fixer) {\n\t\t\treturn fixer.replaceTextRange([start, end], fix);\n\t\t},\n\t});\n}\n\nfunction validateTwoslashTypes(context, env, code, codeStartIndex) {\n\tconst sourceFile = env.languageService.getProgram().getSourceFile(FILENAME);\n\tconst lines = code.split('\\n');\n\n\tconst specifiedVerbosityLevels = context.options[0].verbosityLevels;\n\tconst verbosityLevels = [0, ...specifiedVerbosityLevels, Infinity]; // Keep `Infinity` last since suggestion logic relies on the order\n\n\tfor (const [index, line] of lines.entries()) {\n\t\tconst dedentedLine = line.trimStart();\n\t\tif (!dedentedLine.startsWith(TWOSLASH_COMMENT)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst previousLineIndex = index - 1;\n\t\tif (previousLineIndex < 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet rawActualType = dedentedLine.slice(TWOSLASH_COMMENT.length);\n\t\tlet actualComment = dedentedLine;\n\t\tlet actualCommentEndLine = index;\n\n\t\tfor (let i = index + 1; i < lines.length; i++) {\n\t\t\tconst dedentedNextLine = lines[i].trimStart();\n\t\t\tif (!dedentedNextLine.startsWith('//') || dedentedNextLine.startsWith(TWOSLASH_COMMENT)) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tactualComment += '\\n' + dedentedNextLine;\n\t\t\trawActualType += '\\n' + dedentedNextLine.slice(2); // Remove the `//` from start\n\t\t\tactualCommentEndLine = i;\n\t\t}\n\n\t\tconst previousLine = lines[previousLineIndex];\n\t\tconst previousLineOffset = sourceFile.getPositionOfLineAndCharacter(previousLineIndex, 0);\n\n\t\tconst actualCommentIndex = line.indexOf(TWOSLASH_COMMENT);\n\n\t\tconst actualCommentStartOffset = sourceFile.getPositionOfLineAndCharacter(index, actualCommentIndex);\n\t\tconst actualCommentEndOffset = sourceFile.getPositionOfLineAndCharacter(actualCommentEndLine, lines[actualCommentEndLine].length);\n\n\t\tconst start = codeStartIndex + actualCommentStartOffset;\n\t\tconst end = codeStartIndex + actualCommentEndOffset;\n\n\t\tconst indent = line.slice(0, actualCommentIndex);\n\n\t\tconst quickInfos = verbosityLevels\n\t\t\t.map(verbosity => getLeftmostQuickInfo(env, previousLine, previousLineOffset, verbosity))\n\t\t\t.filter(qi => qi?.displayParts);\n\n\t\tif (quickInfos.length > 0) {\n\t\t\tconst expectedTypes = quickInfos.map(qi => normalizeType(extractTypeFromQuickInfo(qi)));\n\t\t\tconst actualType = normalizeType(rawActualType);\n\n\t\t\tif (expectedTypes.includes(actualType)) {\n\t\t\t\t// If the types match, check for formatting errors and unordered numbers in unions\n\t\t\t\tconst expectedComment = getCommentForType(normalizeType(rawActualType, true));\n\n\t\t\t\tif (actualComment !== expectedComment) {\n\t\t\t\t\treportTypeMismatch({\n\t\t\t\t\t\tmessageId: 'incorrectTwoslashFormat',\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tstart,\n\t\t\t\t\t\tend,\n\t\t\t\t\t\tdata: {expectedComment, actualComment},\n\t\t\t\t\t\tfix: expectedComment.replaceAll('\\n', `\\n${indent}`),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// For suggestion, use infinite verbosity, and it should be the last one\n\t\t\t\tconst expectedComment = getCommentForType(expectedTypes.at(-1));\n\n\t\t\t\treportTypeMismatch({\n\t\t\t\t\tmessageId: 'incorrectTwoslashType',\n\t\t\t\t\tcontext,\n\t\t\t\t\tstart,\n\t\t\t\t\tend,\n\t\t\t\t\tdata: {expectedComment, actualComment},\n\t\t\t\t\tfix: expectedComment.replaceAll('\\n', `\\n${indent}`),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "lint-rules/validate-jsdoc-codeblocks.test.js",
    "content": "/* eslint-disable max-lines */\nimport {code1, code2, createRuleTester, dedenter, errorAt as errorAt_, exportType, exportTypeAndOption, fence, jsdoc} from './test-utils.js';\nimport {validateJSDocCodeblocksRule} from './validate-jsdoc-codeblocks.js';\n\nconst ruleTester = createRuleTester();\n\nconst codeWithErrors = dedenter`\nimport type {RemovePrefix} from 'type-fest';\n\ntype A = RemovePrefix<'on-change', string, {strict: \"yes\"}>;\n`;\n\nconst invalidCodeblockErrorAt = props => errorAt_({...props, messageId: 'invalidCodeblock'});\nconst incorrectTwoslashTypeErrorAt = props => errorAt_({...props, messageId: 'incorrectTwoslashType'});\nconst incorrectTwoslashFormatErrorAt = props => errorAt_({...props, messageId: 'incorrectTwoslashFormat'});\n\nruleTester.run('validate-jsdoc-codeblocks', validateJSDocCodeblocksRule, {\n\tvalid: [\n\t\t// Not exported\n\t\tdedenter`\n\t\t\t${jsdoc(fence(codeWithErrors))}\n\t\t\ttype NotExported = string;\n\t\t`,\n\t\tdedenter`\n\t\t\ttype NotExportedOptions = {\n\t\t\t\t${jsdoc(fence(codeWithErrors))}\n\t\t\t\tp1: string;\n\t\t\t}\n\t\t`,\n\n\t\t// Internal (leading underscore)\n\t\tdedenter`\n\t\t\t${jsdoc(fence(codeWithErrors))}\n\t\t\texport type _Internal = string;\n\t\t`,\n\t\tdedenter`\n\t\t\texport type _InternalOptions = {\n\t\t\t\t${jsdoc(fence(codeWithErrors))}\n\t\t\t\tp1: string;\n\t\t\t}\n\t\t`,\n\n\t\t// Without `Options` suffix\n\t\tdedenter`\n\t\t\texport type NoSuffix = {\n\t\t\t\t${jsdoc(fence(codeWithErrors))}\n\t\t\t\tp1: string;\n\t\t\t}\n\t\t`,\n\n\t\t// No JSDoc\n\t\texportTypeAndOption(''),\n\t\texportType('type Some = number;'),\n\t\texportTypeAndOption('// Not block comment'),\n\t\texportTypeAndOption('/* Block comment, but not JSDoc */'),\n\n\t\t// No codeblock in JSDoc\n\t\texportType(jsdoc('No codeblock here')),\n\n\t\t// With text before and after\n\t\texportTypeAndOption(jsdoc('Some description.', fence(code1), '@category Test')),\n\n\t\t// With line breaks before and after\n\t\texportTypeAndOption(\n\t\t\tjsdoc('Some description.\\n', 'Note: Some note.\\n', fence(code1, 'ts'), '\\n@category Test'),\n\t\t),\n\n\t\t// With `@example` tag\n\t\texportTypeAndOption(jsdoc('@example', fence(code1))),\n\n\t\t// With language specifiers\n\t\texportTypeAndOption(jsdoc(fence(code1, 'ts'))),\n\t\texportTypeAndOption(jsdoc(fence(code1, 'typescript'))),\n\n\t\t// Multiple code blocks\n\t\texportTypeAndOption(\n\t\t\tjsdoc('@example', fence(code1, 'ts'), '\\nSome text in between.\\n', '@example', fence(code2)),\n\t\t),\n\n\t\t// Multiple exports and multiple properties\n\t\texportTypeAndOption(jsdoc(fence(code1)), jsdoc(fence(code2))),\n\n\t\t// With @ts-expect-error\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\timport type {ExtractStrict} from 'type-fest';\n\n\t\t\t// @ts-expect-error\n\t\t\ttype A = ExtractStrict<'foo' | 'bar', 'baz'>;\n\t\t`))),\n\n\t\t// Indented code blocks\n\t\texportTypeAndOption(jsdoc(\n\t\t\t'Note:',\n\t\t\tdedenter`\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\timport type {Subtract} from 'type-fest';\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\timport type {Sum} from 'type-fest';\n\t\t\t\t\ttype A = Sum<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t`,\n\t\t)),\n\n\t\t// Compiler options overrides\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\t// @exactOptionalPropertyTypes: false\n\t\t\tconst foo: {a?: number} = {a: undefined};\n\t\t`))),\n\n\t\t// Incorrect compiler options are ignored\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\t// @noUnusedLocals: 'invalid-value'\n\t\t\tconst foo = {a: 1};\n\t\t`))),\n\n\t\t// Line comment between JSDoc and type/option\n\t\texportTypeAndOption(dedenter`\n\t\t\t${jsdoc(fence(code1))}\n\t\t\t// Some line comment between JSDoc and export\n\t\t`),\n\t],\n\tinvalid: [\n\t\t// With text before and after\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\tSome description.\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t@category Test\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\n\t\t\t\texport type TOptions = {\n\t\t\t\t\t/**\n\t\t\t\t\tSome description.\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t@category Test\n\t\t\t\t\t*/\n\t\t\t\t\tp0: string;\n\t\t\t\t};\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 4, textBeforeStart: 'type A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 14, textBeforeStart: '\\ttype A = ', target: 'Subtract'}),\n\t\t\t],\n\t\t},\n\n\t\t// With line breaks before and after\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\tSome description.\n\n\t\t\t\tNote: Some note.\n\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\\`\\`\\`\n\n\t\t\t\t@category Test\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\n\t\t\t\texport type TOptions = {\n\t\t\t\t\t/**\n\t\t\t\t\tSome description.\n\n\t\t\t\t\tNote: Some note.\n\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\n\t\t\t\t\t@category Test\n\t\t\t\t\t*/\n\t\t\t\t\tp0: string;\n\t\t\t\t};\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 7, textBeforeStart: 'type A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 21, textBeforeStart: '\\ttype A = ', target: 'Subtract'}),\n\t\t\t],\n\t\t},\n\n\t\t// With `@example` tag\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\n\t\t\t\texport type TOptions = {\n\t\t\t\t\t/**\n\t\t\t\t\t@example\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t*/\n\t\t\t\t\tp0: string;\n\t\t\t\t};\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 4, textBeforeStart: 'type A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 13, textBeforeStart: '\\ttype A = ', target: 'Subtract'}),\n\t\t\t],\n\t\t},\n\n\t\t// With language specifiers\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\n\t\t\t\texport type TOptions = {\n\t\t\t\t\t/**\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t*/\n\t\t\t\t\tp0: string;\n\t\t\t\t};\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 3, textBeforeStart: 'type A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 11, textBeforeStart: '\\ttype A = ', target: 'Subtract'}),\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`typescript\n\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\n\t\t\t\texport type TOptions = {\n\t\t\t\t\t/**\n\t\t\t\t\t\\`\\`\\`typescript\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t*/\n\t\t\t\t\tp0: string;\n\t\t\t\t};\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 3, textBeforeStart: 'type A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 11, textBeforeStart: '\\ttype A = ', target: 'Subtract'}),\n\t\t\t],\n\t\t},\n\n\t\t// Multiple code blocks\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\\`\\`\\`\n\n\t\t\t\tSome text in between.\n\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\timport type {ExcludeStrict} from 'type-fest';\n\n\t\t\t\ttype A = ExcludeStrict<string, number>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\n\t\t\t\texport type TOptions = {\n\t\t\t\t\t/**\n\t\t\t\t\t@example\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\n\t\t\t\t\tSome text in between.\n\n\t\t\t\t\t@example\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\timport type {ExcludeStrict} from 'type-fest';\n\n\t\t\t\t\ttype A = ExcludeStrict<string, number>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t*/\n\t\t\t\t\tp0: string;\n\t\t\t\t};\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 4, textBeforeStart: 'type A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 13, textBeforeStart: 'type A = ExcludeStrict<string, ', target: 'number'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 22, textBeforeStart: '\\ttype A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 31, textBeforeStart: '\\ttype A = ExcludeStrict<string, ', target: 'number'}),\n\t\t\t],\n\t\t},\n\n\t\t// Multiple exports and multiple properties\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\timport type {ExcludeStrict} from 'type-fest';\n\n\t\t\t\ttype A = ExcludeStrict<string, number>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T1 = string;\n\n\t\t\t\texport type T0Options = {\n\t\t\t\t\t/**\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t*/\n\t\t\t\t\tp0: string;\n\n\t\t\t\t\t/**\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\timport type {ExcludeStrict} from 'type-fest';\n\n\t\t\t\t\ttype A = ExcludeStrict<string, number>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t*/\n\t\t\t\t\tp1: string;\n\t\t\t\t};\n\n\t\t\t\texport type T1Options = {\n\t\t\t\t\t/**\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\timport type {Sum} from 'type-fest';\n\n\t\t\t\t\tSum<1, 2>; //=> 3\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t*/\n\t\t\t\t\tp0: string;\n\t\t\t\t};\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 3, textBeforeStart: 'type A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 12, textBeforeStart: 'type A = ExcludeStrict<string, ', target: 'number'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 20, textBeforeStart: '\\ttype A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 29, textBeforeStart: '\\ttype A = ExcludeStrict<string, ', target: 'number'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 40, textBeforeStart: '\\t', target: 'Sum'}),\n\t\t\t],\n\t\t},\n\n\t\t// Indented code blocks\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\tNote:\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\ttype A = Sum<1, 2>;\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\n\t\t\t\texport type TOptions = {\n\t\t\t\t\t/**\n\t\t\t\t\tNote:\n\t\t\t\t\t1. First point\n\t\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t2. Second point\n\t\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\t\ttype A = Sum<1, 2>;\n\t\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t*/\n\t\t\t\t\tp0: string;\n\t\t\t\t};\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 5, textBeforeStart: '\\ttype A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 9, textBeforeStart: '\\ttype A = ', target: 'Sum'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 19, textBeforeStart: '\\t\\ttype A = ', target: 'Subtract'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 23, textBeforeStart: '\\t\\ttype A = ', target: 'Sum'}),\n\t\t\t],\n\t\t},\n\n\t\t// Missing import\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\tDescription\n\t\t\t\t\\`\\`\\`\n\t\t\t\ttype A = Sum<1, 2>;\n\t\t\t\t//=> 3\n\n\t\t\t\ttype B = Sum<-1, 2>;\n\t\t\t\t//=> 1\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type Sum = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 4, textBeforeStart: 'type A = ', target: 'Sum'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 7, textBeforeStart: 'type B = ', target: 'Sum'}),\n\t\t\t],\n\t\t},\n\n\t\t// Floating examples\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\timport type {IsUppercase} from 'type-fest';\n\n\t\t\tIsUppercase<'ABC'>;\n\t\t\t//=> true\n\n\t\t\tIsUppercase<'Abc'>;\n\t\t\t//=> false\n\t\t\t\\`\\`\\`\n\t\t\t@category Utilities\n\t\t\t*/\n\t\t\texport type IsUppercase = boolean;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 5, textBeforeStart: '', target: 'IsUppercase'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 8, textBeforeStart: '', target: 'IsUppercase'}),\n\t\t\t],\n\t\t},\n\n\t\t// Hypthetical references\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\tSome description\n\t\t\t\tSome note\n\t\t\t\t\\`\\`\\`\n\t\t\t\timport type {Except} from 'type-fest';\n\n\t\t\t\ttype PostPayload = Except<UserData, 'email'>;\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type Except = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 7, textBeforeStart: 'type PostPayload = Except<', target: 'UserData'}),\n\t\t\t],\n\t\t},\n\n\t\t// Duplicate identifiers\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\texport type IsTupleOptions = {\n\t\t\t\t\t/**\n\t\t\t\t\t@example\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\timport type {IsTuple} from 'type-fest';\n\n\t\t\t\t\ttype Example = IsTuple<[number, ...number[]], {fixedLengthOnly: true}>;\n\t\t\t\t\t//=> false\n\n\t\t\t\t\ttype Example = IsTuple<[number, ...number[]], {fixedLengthOnly: false}>;\n\t\t\t\t\t//=> true\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t\t@default true\n\t\t\t\t\t*/\n\t\t\t\t\tfixedLengthOnly: boolean;\n\t\t\t\t};\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 7, textBeforeStart: '\\ttype ', target: 'Example'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 10, textBeforeStart: '\\ttype ', target: 'Example'}),\n\t\t\t],\n\t\t},\n\n\t\t// Multi line error\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t@example\n\t\t\t\t\\`\\`\\`\n\t\t\t\tdeclare function updateConfig(newConfig: {name?: string; version?: number}): void;\n\n\t\t\t\tupdateConfig({\n\t\t\t\t\tname: undefined,\n\t\t\t\t\tversion: undefined,\n\t\t\t\t});\n\t\t\t\t\\`\\`\\`\n\t\t\t\t@category Utilities\n\t\t\t\t*/\n\t\t\t\texport type MultiLine = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 6, textBeforeStart: 'updateConfig(', endLine: 9, textBeforeEnd: '}'}),\n\t\t\t],\n\t\t},\n\n\t\t// Precise one character error\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`\n\t\t\timport type {ExcludeStrict} from 'type-fest';\n\n\t\t\ttype A = ExcludeStrict<'a' | 'b', 'A'>;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type ExcludeStrict = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({\n\t\t\t\t\tline: 5,\n\t\t\t\t\ttextBeforeStart: 'type A = ExcludeStrict<\\'a\\' | \\'b\\', ',\n\t\t\t\t\ttarget: '\\'A\\'',\n\t\t\t\t}),\n\t\t\t],\n\t\t},\n\n\t\t// `exactOptionalPropertyTypes` is enabled\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`\n\t\t\tconst test: {foo?: string} = {foo: undefined};\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type Test = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 3, textBeforeStart: 'const ', target: 'test'}),\n\t\t\t],\n\t\t},\n\n\t\t// Overlapping errors\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`typescript\n\t\t\timport type {ExcludeStrict, Sum} from 'type-fest';\n\n\t\t\ttype A = Sum<1, '2'>;\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type Test = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 5, textBeforeStart: 'type A = ', target: 'Sum<1, \\'2\\'>'}),\n\t\t\t\tinvalidCodeblockErrorAt({line: 5, textBeforeStart: 'type A = Sum<1, ', target: '\\'2\\''}),\n\t\t\t],\n\t\t},\n\n\t\t// Compiler options overrides\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t/**\n\t\t\t\\`\\`\\`ts\n\t\t\t// @noUnusedLocals: true\n\t\t\tconst foo = {a: 1};\n\t\t\t\\`\\`\\`\n\t\t\t*/\n\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tinvalidCodeblockErrorAt({line: 4, textBeforeStart: 'const ', target: 'foo'}),\n\t\t\t],\n\t\t},\n\t],\n});\n\n// Type mismatch tests\nruleTester.run('validate-jsdoc-codeblocks', validateJSDocCodeblocksRule, {\n\tvalid: [\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\ttype Foo = string;\n\t\t\t//=> string\n\t\t`))),\n\n\t\t// No twoslash comment at all\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tconst foo = 'bar';\n\t\t`))),\n\n\t\t// Twoslash comment at very first line\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\t//=> 'bar'\n\t\t\tconst foo = 'bar';\n\t\t`))),\n\n\t\t// Object type collapsed into single line\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tconst foo = {a: 1, b: {c: 'c'}};\n\t\t\t//=> {a: number; b: {c: string}}\n\t\t`))),\n\n\t\t// Multiline type\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\timport type {Simplify} from 'type-fest';\n\n\t\t\ttype Foo = {readonly a: number; readonly b?: number};\n\t\t\ttype Bar = {c?: string; d: {readonly e: boolean}; e: string};\n\t\t\ttype Baz = Simplify<Foo & Bar>;\n\t\t\t//=> {\n\t\t\t// \treadonly a: number;\n\t\t\t// \treadonly b?: number;\n\t\t\t// \tc?: string;\n\t\t\t// \td: {\n\t\t\t// \t\treadonly e: boolean;\n\t\t\t// \t};\n\t\t\t// \te: string;\n\t\t\t// }\n\t\t`))),\n\n\t\t// Quick info at 0th index\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tlet foo = 1;\n\t\t\tfoo++;\n\t\t\t//=> number\n\t\t`))),\n\n\t\t// Quick info at some middle index\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tconst foo = 1 as string | number;\n\t\t\t//=> string | number\n\t\t`))),\n\n\t\t// Quick info at last index\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tconst foo = {n: 1}\n\t\t\tconst bar = foo\n\t\t\t\t.n\n\t\t\t//=> number\n\t\t`))),\n\n\t\t// Double-quotes properly replaced\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\timport type {Simplify} from 'type-fest';\n\n\t\t\ttype Foo = {a: 'abc'; b: 123; c: 'def'};\n\t\t\ttype Bar = {x: {y: 'y'; z: 'z'}};\n\t\t\ttype Baz = Simplify<Foo & Bar>;\n\t\t\t//=> {a: 'abc'; b: 123; c: 'def'; x: {y: 'y'; z: 'z'}}\n\t\t`))),\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\ttype Foo = 'a\"b\"c';\n\t\t\t//=> 'a\"b\"c'\n\n\t\t\ttype Bar = \"d'e'f\";\n\t\t\t//=> 'd\\'e\\'f'\n\t\t`))),\n\n\t\t// Space indentation properly replaced\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\timport type {Simplify} from 'type-fest';\n\n\t\t\ttype Foo = {\n\t\t\t\ta: {\n\t\t\t\t\tab: boolean;\n\t\t\t\t\tac: {\n\t\t\t\t\t\tacd: string | number;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t\te: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfgh: false;\n\t\t\t\t\t\tijk: {\n\t\t\t\t\t\t\tlmno: 'yes' | 'no';\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t\tstring,\n\t\t\t\t\t[\n\t\t\t\t\t\t'foo',\n\t\t\t\t\t\t'bar',\n\t\t\t\t\t],\n\t\t\t\t];\n\t\t\t};\n\n\t\t\ttype Bar = Simplify<Foo>;\n\t\t\t//=> {\n\t\t\t// \ta: {\n\t\t\t// \t\tab: boolean;\n\t\t\t// \t\tac: {\n\t\t\t// \t\t\tacd: string | number;\n\t\t\t// \t\t};\n\t\t\t// \t};\n\t\t\t// \te: [{\n\t\t\t// \t\tfgh: false;\n\t\t\t// \t\tijk: {\n\t\t\t// \t\t\tlmno: 'yes' | 'no';\n\t\t\t// \t\t};\n\t\t\t// \t}, string, ['foo', 'bar']];\n\t\t\t// }\n\t\t`))),\n\n\t\t// Compiler options overrides\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\t// @exactOptionalPropertyTypes: false\n\t\t\timport type {AllExtend} from 'type-fest';\n\n\t\t\ttype A = AllExtend<[1?, 2?, 3?], number>;\n\t\t\t//=> boolean\n\t\t`))),\n\n\t\t// Multiple `//=>`\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tconst foo = {a: true, b: false, c: {d: true}} as const;\n\t\t\t//=> {\n\t\t\t// \treadonly a: true;\n\t\t\t// \treadonly b: false;\n\t\t\t// \treadonly c: {\n\t\t\t// \t\treadonly d: true;\n\t\t\t// \t};\n\t\t\t// }\n\t\t\tconst bar = ['a', 'b', 'c'] as const;\n\t\t\t//=> readonly ['a', 'b', 'c']\n\t\t\tconst baz = new Set(bar);\n\t\t\t//=> Set<'a' | 'b' | 'c'>\n\t\t`))),\n\n\t\t// Indented code blocks\n\t\texportTypeAndOption(jsdoc(\n\t\t\t'Note:',\n\t\t\tdedenter`\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\timport type {Subtract} from 'type-fest';\n\t\t\t\t\ttype A = Subtract<1, 2>;\n\t\t\t\t\t//=> -1\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\timport type {Sum} from 'type-fest';\n\t\t\t\t\ttype A = Sum<1, 2>;\n\t\t\t\t\t//=> 3\n\t\t\t\t\t\\`\\`\\`\n\t\t\t`,\n\t\t)),\n\n\t\t// Order of non-numbers in unions doesn't matter\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\ttype Test = 'a' | 'b' | {x: ['c' | 'd' | 'e']; y: {z: 'f' | 'g' | 'h'}};\n\n\t\t\ttype Valid = Test\n\t\t\t//=> 'b' | 'a' | {x: ['d' | 'c' | 'e']; y: {z: 'g' | 'h' | 'f'}}\n\t\t\t\n\t\t\ttype Valid2 = Test\n\t\t\t//=> 'a' | {x: ['e' | 'd' | 'c']; y: {z: 'h' | 'g' | 'f'}} | 'b'\n\t\t\t\n\t\t\ttype Valid3 = Test\n\t\t\t//=> {x: ['e' | 'c' | 'd']; y: {z: 'h' | 'f' | 'g'}} | 'b' | 'a'\n\t\t`))),\n\n\t\t// Numbers are sorted in unions\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\timport type {IntClosedRange} from 'type-fest';\n\n\t\t\ttype ZeroToNine = IntClosedRange<0, 9>;\n\t\t\t//=> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\t\t`))),\n\n\t\t// Numbers in nested unions are sorted\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\ttype Test = {w: 0 | 10 | 5; x: [2 | 16 | 4]; y: {z: 3 | 27 | 9}};\n\t\t\t//=> {w: 0 | 5 | 10; x: [2 | 4 | 16]; y: {z: 3 | 9 | 27}}\n\t\t`))),\n\n\t\t// Numbers in unions inside unions are sorted, non-numbers can be in any order\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\ttype Test = {a: 'foo' | 27 | 1 | {b: 2 | 1 | 8 | 4} | 'baz' | 9 | 3 | 'bar'};\n\n\t\t\ttype Valid = Test;\n\t\t\t//=> {a: 1 | 3 | 9 | 27 | {b: 1 | 2 | 4 | 8} | 'bar' | 'foo' | 'baz'}\n\t\t\t\n\t\t\ttype Valid2 = Test;\n\t\t\t//=> {a: {b: 1 | 2 | 4 | 8} | 1 | 'foo' | 3 | 'baz' | 'bar' | 9 | 27}\n\t\t\t\n\t\t\ttype Valid3 = Test;\n\t\t\t//=> {a: 'baz' | 'foo' | 1 | 3 | 9 | 'bar' | 27 | {b: 1 | 2 | 4 | 8}}\n\t\t`))),\n\n\t\t// Only numbers are sorted in unions, non-numbers can be in any order\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\timport type {ArrayElement} from 'type-fest';\n\n\t\t\ttype Tuple1 = ArrayElement<[null, string, boolean, 1, 3, 0, -2, 4, 2, -1]>;\n\t\t\t//=> string | -2 | -1 | boolean | 0 | null | 1 | 2 | 3 | 4\n\n\t\t\ttype Tuple2 = ArrayElement<[null, 1, 3, string, 0, -2, 4, 2, boolean, -1]>;\n\t\t\t//=> -2 | boolean | -1 | 0 | 1 | 2 | 3 | 4 | null | string\n\t\t`))),\n\n\t\t// Tuples are in single line\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\timport type {TupleOf} from 'type-fest';\n\n\t\t\ttype RGB = TupleOf<3, number>;\n\t\t\t//=> [number, number, number]\n\n\t\t\ttype TicTacToeBoard = TupleOf<3, TupleOf<3, 'X' | 'O' | null>>;\n\t\t\t//=> [['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null], ['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null], ['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null]]\n\t\t`))),\n\n\t\t// Emojis are preserved\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\ttype Pets = '🦄' | '🐶' | '🐇';\n\t\t\t//=> '🦄' | '🐶' | '🐇'\n\t\t`))),\n\n\t\t// `0` and `Infinity` verbosity levels\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\ttype Test = {a: Pick<{b: Pick<{c: Pick<{d: 1}, 'd'>}, 'c'>}, 'b'>};\n\n\t\t\ttype LevelZero = Test;\n\t\t\t//=> {a: {b: {c: {d: 1}}}}\n\n\t\t\ttype LevelThree = Test;\n\t\t\t//=> {\n\t\t\t// \ta: Pick<{\n\t\t\t// \t\tb: Pick<{\n\t\t\t// \t\t\tc: Pick<{\n\t\t\t// \t\t\t\td: 1;\n\t\t\t// \t\t\t}, 'd'>;\n\t\t\t// \t\t}, 'c'>;\n\t\t\t// \t}, 'b'>;\n\t\t\t// }\n\t\t`))),\n\n\t\t// Custom verbosity level\n\t\t// `0` and `Infinity` verbosity levels are still allowed\n\t\t{\n\t\t\tcode: exportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\t\ttype Test = {a: Pick<{b: Pick<{c: Pick<{d: 1}, 'd'>}, 'c'>}, 'b'>};\n\n\t\t\t\ttype LevelZero = Test;\n\t\t\t\t//=> {a: {b: {c: {d: 1}}}}\n\n\t\t\t\ttype LevelOne = Test;\n\t\t\t\t//=> {a: {b: Pick<{c: Pick<{d: 1}, 'd'>}, 'c'>}}\n\n\t\t\t\ttype LevelTwo = Test;\n\t\t\t\t//=> {a: {b: {c: Pick<{d: 1}, 'd'>}}}\n\n\t\t\t\ttype LevelThree = Test;\n\t\t\t\t//=> {\n\t\t\t\t// \ta: Pick<{\n\t\t\t\t// \t\tb: Pick<{\n\t\t\t\t// \t\t\tc: Pick<{\n\t\t\t\t// \t\t\t\td: 1;\n\t\t\t\t// \t\t\t}, 'd'>;\n\t\t\t\t// \t\t}, 'c'>;\n\t\t\t\t// \t}, 'b'>;\n\t\t\t\t// }\n\t\t\t`))),\n\t\t\toptions: [{verbosityLevels: [1, 2]}],\n\t\t},\n\n\t\t// === Different types of quick info ===\n\t\t// Function\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tdeclare function foo(a: string): {b: string; c: number};\n\t\t\tfoo('a');\n\t\t\t//=> {b: string; c: number}\n\t\t`))),\n\n\t\t// Variable\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tconst foo = 'foo';\n\t\t\t//=> 'foo'\n\n\t\t\tlet bar = {a: 1};\n\t\t\t//=> {a: number}\n\n\t\t\tvar baz = true;\n\t\t\t//=> boolean\n\t\t`))),\n\n\t\t// Type Alias\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\ttype Foo = {a: number};\n\t\t\t//=> {a: number}\n\t\t`))),\n\n\t\t// Interface\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tinterface Foo { foo: string; }\n\t\t\t//=> Foo\n\t\t`))),\n\n\t\t// Generic interface\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tinterface Foo<T> { foo: T; }\n\t\t\t//=> Foo<T>\n\t\t`))),\n\n\t\t// Parameter\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tfunction foo(n: number) {\n\t\t\t\tn++;\n\t\t\t\t//=> number\n\t\t\t}\n\t\t`))),\n\n\t\t// Property\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tconst foo = {n: 1};\n\t\t\tfoo\n\t\t\t\t.n++;\n\t\t\t//=> number\n\t\t`))),\n\n\t\t// Method\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tclass Foo {\n\t\t\t\tm() {\n\t\t\t\t\treturn 'foo';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst f = new Foo()\n\t\t\t\t.m();\n\t\t\t//=> string\n\t\t`))),\n\n\t\t// Constructor\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tclass Foo {\n\t\t\t\tconstructor() {\n\t\t\t\t\t//=> Foo\n\t\t\t\t\tconsole.log('Foo');\n\t\t\t\t}\n\t\t\t}\n\t\t`))),\n\n\t\t// Enum\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tenum Foo {}\n\t\t\t//=> Foo\n\t\t`))),\n\n\t\t// Const enum\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tconst enum Foo { A = 1 }\n\t\t\t//=> Foo\n\t\t`))),\n\n\t\t// Enum Member\n\t\texportTypeAndOption(jsdoc(fence(dedenter`\n\t\t\tenum Foo { A }\n\t\t\tvoid Foo\n\t\t\t.A;\n\t\t\t//=> 0\n\t\t`))),\n\t],\n\tinvalid: [\n\t\t// === Twoslash format errors ===\n\n\t\t// No space after `//=>`\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = string;\n\t\t\t\t//=>string\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 4,\ttextBeforeStart: '',\ttarget: '//=>string'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = string;\n\t\t\t\t//=> string\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// More than one space after `//=>`\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = string;\n\t\t\t\t//=>     string\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 4, textBeforeStart: '', target: '//=>     string'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = string;\n\t\t\t\t//=> string\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Incorrect spacing\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = 'a' | 'b' | { c: 'd' } | 'e';\n\t\t\t\t//=> 'a'|'b'   |    { c :  'd' }|    'e'  \n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 4, textBeforeStart: '', target: '//=> \\'a\\'|\\'b\\'   |    { c :  \\'d\\' }|    \\'e\\'  '}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = 'a' | 'b' | { c: 'd' } | 'e';\n\t\t\t\t//=> 'a' | 'b' | {c: 'd'} | 'e'\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// No space in subsequent lines\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: true, b: true, c: false, d: false, e: true} as const;\n\t\t\t\t//=> {\n\t\t\t\t//\treadonly a: true;\n\t\t\t\t//\treadonly b: true;\n\t\t\t\t//\treadonly c: false;\n\t\t\t\t//\treadonly d: false;\n\t\t\t\t//\treadonly e: true;\n\t\t\t\t//}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 4, textBeforeStart: '', endLine: 10, textBeforeEnd: '//}'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: true, b: true, c: false, d: false, e: true} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \treadonly a: true;\n\t\t\t\t// \treadonly b: true;\n\t\t\t\t// \treadonly c: false;\n\t\t\t\t// \treadonly d: false;\n\t\t\t\t// \treadonly e: true;\n\t\t\t\t// }\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Incorrect double quotes\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = [\"a\", {b: \"c\", d: {e: \"f\"}}, \"g\" | \"h\"];\n\t\t\t\t//=> [\"a\", {b: \"c\"; d: {e: \"f\"}}, \"g\" | \"h\"]\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 4, textBeforeStart: '', target: '//=> [\"a\", {b: \"c\"; d: {e: \"f\"}}, \"g\" | \"h\"]'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = [\"a\", {b: \"c\", d: {e: \"f\"}}, \"g\" | \"h\"];\n\t\t\t\t//=> ['a', {b: 'c'; d: {e: 'f'}}, 'g' | 'h']\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Incorrect multiline tuples\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\timport type {TupleOf} from 'type-fest';\n\n\t\t\t\ttype RGB = TupleOf<3, number>;\n\t\t\t\t//=> [\n\t\t\t\t// \tnumber,\n\t\t\t\t// \tnumber,\n\t\t\t\t// \tnumber,\n\t\t\t\t// ]\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 6, textBeforeStart: '', endLine: 10, textBeforeEnd: '// ]'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\timport type {TupleOf} from 'type-fest';\n\n\t\t\t\ttype RGB = TupleOf<3, number>;\n\t\t\t\t//=> [number, number, number]\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Multi line to single line\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = [{a: 1}] as const;\n\t\t\t\t//=> readonly [{\n\t\t\t\t// \treadonly a: 1;\n\t\t\t\t// }]\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 4, textBeforeStart: '', endLine: 6, textBeforeEnd: '// }]'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = [{a: 1}] as const;\n\t\t\t\t//=> readonly [{readonly a: 1}]\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Single line to multi line\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: true, b: true, c: false, d: false, e: true} as const;\n\t\t\t\t//=> {readonly a: true; readonly b: true; readonly c: false; readonly d: false; readonly e: true}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 4, textBeforeStart: '', target: '//=> {readonly a: true; readonly b: true; readonly c: false; readonly d: false; readonly e: true}'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: true, b: true, c: false, d: false, e: true} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \treadonly a: true;\n\t\t\t\t// \treadonly b: true;\n\t\t\t\t// \treadonly c: false;\n\t\t\t\t// \treadonly d: false;\n\t\t\t\t// \treadonly e: true;\n\t\t\t\t// }\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Incorrect order of numbers in unions\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype T1 = 5 | 4 | 3 | 2 | 1;\n\t\t\t\t//=> 5 | 4 | 1 | 2 | 3\n\n\t\t\t\ttype T2 = 1 | 2 | 3 | 'a';\n\t\t\t\t//=> 2 | 'a' | 3 | 1\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 4, textBeforeStart: '', target: '//=> 5 | 4 | 1 | 2 | 3'}),\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 7, textBeforeStart: '', target: '//=> 2 | \\'a\\' | 3 | 1'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype T1 = 5 | 4 | 3 | 2 | 1;\n\t\t\t\t//=> 1 | 2 | 3 | 4 | 5\n\n\t\t\t\ttype T2 = 1 | 2 | 3 | 'a';\n\t\t\t\t//=> 1 | 'a' | 2 | 3\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Indented code blocks\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\tNote:\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\tconst foo = {a: true, b: false, c: {d: true}};\n\t\t\t\t\t//=> {a: boolean; b: boolean;\n\t\t\t\t\t// c: {d: boolean};\n\t\t\t\t\t// }\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\tconst bar = ['a', 'b', 'c'] as const;\n\t\t\t\t\t//=> readonly [ 'a', 'b', 'c' ]\n\t\t\t\t\tconst baz = new Set(bar);\n\t\t\t\t\t//=>Set< 'a'|'b'|'c' >\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 6, textBeforeStart: '\\t', endLine: 8, textBeforeEnd: '\\t// }'}),\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 13, textBeforeStart: '\\t', target: '//=> readonly [ \\'a\\', \\'b\\', \\'c\\' ]'}),\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 15, textBeforeStart: '\\t', target: '//=>Set< \\'a\\'|\\'b\\'|\\'c\\' >'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\tNote:\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\tconst foo = {a: true, b: false, c: {d: true}};\n\t\t\t\t\t//=> {a: boolean; b: boolean; c: {d: boolean}}\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\tconst bar = ['a', 'b', 'c'] as const;\n\t\t\t\t\t//=> readonly ['a', 'b', 'c']\n\t\t\t\t\tconst baz = new Set(bar);\n\t\t\t\t\t//=> Set<'a' | 'b' | 'c'>\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Multiple `//=>`\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: 'a', b: 'b'} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \treadonly a: 'a';\n\t\t\t\t// \treadonly b: 'b';\n\t\t\t\t// }\n\t\t\t\tconst bar = ['a', 'b', 'c'] as const;\n\t\t\t\t//=> readonly [\n\t\t\t\t// \t'a', \n\t\t\t\t// \t'b', \n\t\t\t\t// \t'c'\n\t\t\t\t// ]\n\t\t\t\tconst baz = new Set(bar);\n\t\t\t\t//=> Set<\n\t\t\t\t// \t| 'a'\n\t\t\t\t// \t| 'b'\n\t\t\t\t// \t| 'c'\n\t\t\t\t// >\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 4, textBeforeStart: '', endLine: 7, textBeforeEnd: '// }'}),\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 9, textBeforeStart: '', endLine: 13, textBeforeEnd: '// ]'}),\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 15, textBeforeStart: '', endLine: 19, textBeforeEnd: '// >'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: 'a', b: 'b'} as const;\n\t\t\t\t//=> {readonly a: 'a'; readonly b: 'b'}\n\t\t\t\tconst bar = ['a', 'b', 'c'] as const;\n\t\t\t\t//=> readonly ['a', 'b', 'c']\n\t\t\t\tconst baz = new Set(bar);\n\t\t\t\t//=> Set<'a' | 'b' | 'c'>\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Preserves the specified verbosity level during formatting fixes\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Test = {a: Pick<{b: Pick<{c: Pick<{d: 'abracadabra'}, 'd'>}, 'c'>}, 'b'>};\n\n\t\t\t\ttype LevelOne = Test;\n\t\t\t\t//=> {a: {b: Pick<{c: Pick<{d: 'abracadabra'}, 'd'>}, 'c'>}}\n\n\t\t\t\ttype LevelTwo = Test;\n\t\t\t\t//=> {a: {b: {c: Pick<{d: \"abracadabra\"}, \"d\">}}}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 6, textBeforeStart: '', target: '//=> {a: {b: Pick<{c: Pick<{d: \\'abracadabra\\'}, \\'d\\'>}, \\'c\\'>}}'}),\n\t\t\t\tincorrectTwoslashFormatErrorAt({line: 9, textBeforeStart: '', target: '//=> {a: {b: {c: Pick<{d: \"abracadabra\"}, \"d\">}}}'}),\n\t\t\t],\n\t\t\toptions: [{verbosityLevels: [1, 2]}],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Test = {a: Pick<{b: Pick<{c: Pick<{d: 'abracadabra'}, 'd'>}, 'c'>}, 'b'>};\n\n\t\t\t\ttype LevelOne = Test;\n\t\t\t\t//=> {\n\t\t\t\t// \ta: {\n\t\t\t\t// \t\tb: Pick<{\n\t\t\t\t// \t\t\tc: Pick<{\n\t\t\t\t// \t\t\t\td: 'abracadabra';\n\t\t\t\t// \t\t\t}, 'd'>;\n\t\t\t\t// \t\t}, 'c'>;\n\t\t\t\t// \t};\n\t\t\t\t// }\n\n\t\t\t\ttype LevelTwo = Test;\n\t\t\t\t//=> {a: {b: {c: Pick<{d: 'abracadabra'}, 'd'>}}}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// === Twoslash type errors ===\n\n\t\t// Incorrect type\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = 'bar';\n\t\t\t\t//=> 'baz'\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', target: '//=> \\'baz\\''}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = 'bar';\n\t\t\t\t//=> 'bar'\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Empty `//=>`\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = string;\n\t\t\t\t//=>\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', target: '//=>'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Foo = string;\n\t\t\t\t//=> string\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Broken type\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: 1, b: 2};\n\t\t\t\t//=> {a\n\t\t\t\t\n\t\t\t\tconst bar = {a: 1, b: 2};\n\t\t\t\t//=> {a: number\n\t\t\t\t// \tb:\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', target: '//=> {a'}),\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 7, textBeforeStart: '', endLine: 8, textBeforeEnd: '// \tb:'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: 1, b: 2};\n\t\t\t\t//=> {a: number; b: number}\n\n\t\t\t\tconst bar = {a: 1, b: 2};\n\t\t\t\t//=> {a: number; b: number}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Multiline replace\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {foo: true, bar: {baz: true, qux: [true, false]}} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \tfoo: true;\n\t\t\t\t// \treadonly bar: {\n\t\t\t\t// \t\treadonly baz: false;\n\t\t\t\t// \t\treadonly qux: [true, false];\n\t\t\t\t// \t};\n\t\t\t\t// }\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', endLine: 10, textBeforeEnd: '// }'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {foo: true, bar: {baz: true, qux: [true, false]}} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \treadonly foo: true;\n\t\t\t\t// \treadonly bar: {\n\t\t\t\t// \t\treadonly baz: true;\n\t\t\t\t// \t\treadonly qux: readonly [true, false];\n\t\t\t\t// \t};\n\t\t\t\t// }\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Multiline add missing lines\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {foo: true, bar: {baz: true, qux: [true, false]}} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \treadonly bar: {\n\t\t\t\t// \t\treadonly qux: readonly [true, false];\n\t\t\t\t// \t};\n\t\t\t\t// }\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', endLine: 8, textBeforeEnd: '// }'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {foo: true, bar: {baz: true, qux: [true, false]}} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \treadonly foo: true;\n\t\t\t\t// \treadonly bar: {\n\t\t\t\t// \t\treadonly baz: true;\n\t\t\t\t// \t\treadonly qux: readonly [true, false];\n\t\t\t\t// \t};\n\t\t\t\t// }\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Multiline remove extra lines\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {bar: {qux: [true, false]}, quux: [null, undefined]} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \treadonly foo: true;\n\t\t\t\t// \treadonly bar: {\n\t\t\t\t// \t\treadonly baz: true;\n\t\t\t\t// \t\treadonly qux: readonly [true, false];\n\t\t\t\t// \t};\n\t\t\t\t// \treadonly quux: readonly [null, undefined];\n\t\t\t\t// }\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', endLine: 11, textBeforeEnd: '// }'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {bar: {qux: [true, false]}, quux: [null, undefined]} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \treadonly bar: {\n\t\t\t\t// \t\treadonly qux: readonly [true, false];\n\t\t\t\t// \t};\n\t\t\t\t// \treadonly quux: readonly [null, undefined];\n\t\t\t\t// }\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Compiler options overrides\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\t// @exactOptionalPropertyTypes: false\n\t\t\t\ttype Prettify<T> = {\n\t\t\t\t\t[P in keyof T]: T[P];\n\t\t\t\t};\n\n\t\t\t\ttype T1 = Prettify<{a?: string; b?: number}>;\n\t\t\t\t//=> {\n\t\t\t\t// \ta?: string;\n\t\t\t\t// \tb?: number;\n\t\t\t\t// }\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 9, textBeforeStart: '', endLine: 12, textBeforeEnd: '// }'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\t// @exactOptionalPropertyTypes: false\n\t\t\t\ttype Prettify<T> = {\n\t\t\t\t\t[P in keyof T]: T[P];\n\t\t\t\t};\n\n\t\t\t\ttype T1 = Prettify<{a?: string; b?: number}>;\n\t\t\t\t//=> {a?: string | undefined; b?: number | undefined}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Incorrect type and improper formatting\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: 'a', b: 'b'} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \ta: 'a';\n\t\t\t\t// \tb: 'b';\n\t\t\t\t// }\n\n\t\t\t\tconst bar = 'bar';\n\t\t\t\t//=>\"baz\"\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', endLine: 7, textBeforeEnd: '// }'}),\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 10, textBeforeStart: '', target: '//=>\"baz\"'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: 'a', b: 'b'} as const;\n\t\t\t\t//=> {readonly a: 'a'; readonly b: 'b'}\n\n\t\t\t\tconst bar = 'bar';\n\t\t\t\t//=> 'bar'\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Indented code blocks\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\tNote:\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\tconst foo = {a: true, b: false, c: {d: true}} as const;\n\t\t\t\t\t//=> {\n\t\t\t\t\t// \ta?: false;\n\t\t\t\t\t// \tc?: {\n\t\t\t\t\t// \t\td?: false;\n\t\t\t\t\t// \t};\n\t\t\t\t\t// }\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\tconst bar = ['a', 'b', 'c'] as const;\n\t\t\t\t\t//=> ['a', 'c']\n\t\t\t\t\tconst baz = new Set(bar);\n\t\t\t\t\t//=> Set<string>\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 6, textBeforeStart: '\\t', endLine: 11, textBeforeEnd: '\\t// }'}),\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 16, textBeforeStart: '\\t', target: '//=> [\\'a\\', \\'c\\']'}),\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 18, textBeforeStart: '\\t', target: '//=> Set<string>'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\tNote:\n\t\t\t\t1. First point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\tconst foo = {a: true, b: false, c: {d: true}} as const;\n\t\t\t\t\t//=> {\n\t\t\t\t\t// \treadonly a: true;\n\t\t\t\t\t// \treadonly b: false;\n\t\t\t\t\t// \treadonly c: {\n\t\t\t\t\t// \t\treadonly d: true;\n\t\t\t\t\t// \t};\n\t\t\t\t\t// }\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t2. Second point\n\t\t\t\t\t\\`\\`\\`ts\n\t\t\t\t\tconst bar = ['a', 'b', 'c'] as const;\n\t\t\t\t\t//=> readonly ['a', 'b', 'c']\n\t\t\t\t\tconst baz = new Set(bar);\n\t\t\t\t\t//=> Set<'a' | 'b' | 'c'>\n\t\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Multiple `//=>`\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: true, b: false, c: {d: true}} as const;\n\t\t\t\t//=>\n\t\t\t\tconst bar = ['a', 'b', 'c'] as const;\n\t\t\t\t//=>\n\t\t\t\tconst baz = new Set(bar);\n\t\t\t\t//=>\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', target: '//=>'}),\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 6, textBeforeStart: '', target: '//=>'}),\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 8, textBeforeStart: '', target: '//=>'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\tconst foo = {a: true, b: false, c: {d: true}} as const;\n\t\t\t\t//=> {\n\t\t\t\t// \treadonly a: true;\n\t\t\t\t// \treadonly b: false;\n\t\t\t\t// \treadonly c: {\n\t\t\t\t// \t\treadonly d: true;\n\t\t\t\t// \t};\n\t\t\t\t// }\n\t\t\t\tconst bar = ['a', 'b', 'c'] as const;\n\t\t\t\t//=> readonly ['a', 'b', 'c']\n\t\t\t\tconst baz = new Set(bar);\n\t\t\t\t//=> Set<'a' | 'b' | 'c'>\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Fixer suggests types at `Infinity` verbosity level\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Test = {foo: Pick<{bar: Pick<{baz: string}, 'baz'>}, 'bar'>};\n\t\t\t\t//=>\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', target: '//=>'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Test = {foo: Pick<{bar: Pick<{baz: string}, 'baz'>}, 'bar'>};\n\t\t\t\t//=> {foo: {bar: {baz: string}}}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\n\t\t// Only `0` and `Infinity` verbosity levels are allowed by default\n\t\t{\n\t\t\tcode: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Test = {foo: Pick<{bar: Pick<{baz: string}, 'baz'>}, 'bar'>};\n\t\t\t\t//=> {foo: {bar: Pick<{baz: string}, 'baz'>}}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t\terrors: [\n\t\t\t\tincorrectTwoslashTypeErrorAt({line: 4, textBeforeStart: '', target: '//=> {foo: {bar: Pick<{baz: string}, \\'baz\\'>}}'}),\n\t\t\t],\n\t\t\toutput: dedenter`\n\t\t\t\t/**\n\t\t\t\t\\`\\`\\`ts\n\t\t\t\ttype Test = {foo: Pick<{bar: Pick<{baz: string}, 'baz'>}, 'bar'>};\n\t\t\t\t//=> {foo: {bar: {baz: string}}}\n\t\t\t\t\\`\\`\\`\n\t\t\t\t*/\n\t\t\t\texport type T0 = string;\n\t\t\t`,\n\t\t},\n\t],\n});\n"
  },
  {
    "path": "media/readme.md",
    "content": "# Media\n\n## Attribution\n\n### Fireworks vector graphic\n\n[Free Vectors via Vecteezy!](https://www.vecteezy.com)\n"
  },
  {
    "path": "package.json",
    "content": "{\n\t\"name\": \"type-fest\",\n\t\"version\": \"5.5.0\",\n\t\"description\": \"A collection of essential TypeScript types\",\n\t\"license\": \"(MIT OR CC0-1.0)\",\n\t\"repository\": \"sindresorhus/type-fest\",\n\t\"funding\": \"https://github.com/sponsors/sindresorhus\",\n\t\"author\": {\n\t\t\"name\": \"Sindre Sorhus\",\n\t\t\"email\": \"sindresorhus@gmail.com\",\n\t\t\"url\": \"https://sindresorhus.com\"\n\t},\n\t\"type\": \"module\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"types\": \"./index.d.ts\"\n\t\t},\n\t\t\"./globals\": {\n\t\t\t\"types\": \"./source/globals/index.d.ts\"\n\t\t}\n\t},\n\t\"types\": \"./index.d.ts\",\n\t\"sideEffects\": false,\n\t\"engines\": {\n\t\t\"node\": \">=20\"\n\t},\n\t\"scripts\": {\n\t\t\"test:tsc\": \"node --max-old-space-size=6144 ./node_modules/.bin/tsc\",\n\t\t\"test:tsd\": \"node --max-old-space-size=6144 ./node_modules/.bin/tsd\",\n\t\t\"test:xo\": \"node --max-old-space-size=6144 ./node_modules/.bin/xo --ignores=lint-processors/fixtures/**/*.d.ts\",\n\t\t\"test:linter\": \"node --test\",\n\t\t\"test\": \"run-p test:*\"\n\t},\n\t\"files\": [\n\t\t\"index.d.ts\",\n\t\t\"source\",\n\t\t\"license-mit\",\n\t\t\"license-cc0\"\n\t],\n\t\"keywords\": [\n\t\t\"typescript\",\n\t\t\"ts\",\n\t\t\"types\",\n\t\t\"utility\",\n\t\t\"util\",\n\t\t\"utilities\",\n\t\t\"omit\",\n\t\t\"merge\",\n\t\t\"json\",\n\t\t\"generics\"\n\t],\n\t\"dependencies\": {\n\t\t\"tagged-tag\": \"^1.0.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@sindresorhus/tsconfig\": \"^8.0.1\",\n\t\t\"@typescript-eslint/parser\": \"^8.44.0\",\n\t\t\"eslint\": \"^9.35.0\",\n\t\t\"@typescript/vfs\": \"^1.6.1\",\n\t\t\"dedent\": \"^1.7.0\",\n\t\t\"expect-type\": \"^1.2.2\",\n\t\t\"npm-run-all2\": \"^8.0.4\",\n\t\t\"tsd\": \"^0.33.0\",\n\t\t\"typescript\": \"^5.9.2\",\n\t\t\"typescript-eslint\": \"^8.47.0\",\n\t\t\"xo\": \"^1.2.2\"\n\t},\n\t\"tsd\": {\n\t\t\"compilerOptions\": {\n\t\t\t\"noUnusedLocals\": false\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "readme.md",
    "content": "<div align=\"center\">\n\t<br>\n\t<br>\n\t<img src=\"media/logo.svg\" alt=\"type-fest\" height=\"300\">\n\t<br>\n\t<br>\n\t<b>A collection of essential TypeScript types</b>\n\t<br>\n\t<br>\n\t<br>\n\t<br>\n\t<hr>\n\t<div align=\"center\">\n\t\t<p>\n\t\t\t<p>\n\t\t\t\t<sup>\n\t\t\t\t\t<a href=\"https://github.com/sponsors/sindresorhus\">Sindre Sorhus' open source work is supported by the community</a>\n\t\t\t\t</sup>\n\t\t\t</p>\n\t\t\t<sup>Special thanks to:</sup>\n\t\t\t<br>\n\t\t\t<br>\n\t\t\t<a href=\"https://nitric.io/?utm_campaign=github_repo&utm_medium=referral&utm_content=sindresorhus&utm_source=github\">\n\t\t\t\t<div>\n\t\t\t\t\t<img width=\"230\" src=\"https://sindresorhus.com/assets/thanks/nitric-logo.svg\" alt=\"nitric logo\">\n\t\t\t\t</div>\n\t\t\t\t<b>Effortless backends with infrastructure from code</b>\n\t\t\t\t<div>\n\t\t\t\t\t<sup>An open-source framework that supports any programming language, cloud provider, or deployment automation tool.</sup>\n\t\t\t\t</div>\n\t\t\t</a>\n\t\t</p>\n\t</div>\n\t<br>\n\t<hr>\n</div>\n<br>\n<br>\n\n[![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://giphy.com/gifs/illustration-rainbow-unicorn-26AHG5KGFxSkUWw1i)\n[![npm dependents](https://badgen.net/npm/dependents/type-fest)](https://www.npmjs.com/package/type-fest?activeTab=dependents)\n[![npm downloads](https://badgen.net/npm/dt/type-fest)](https://www.npmjs.com/package/type-fest)\n\nMany of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/main/CONTRIBUTING.md).\n\nEither add this package as a dependency or copy-paste the needed types. No credit required. 👌\n\nPR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first.\n\n**Help wanted with reviewing [proposals](https://github.com/sindresorhus/type-fest/issues) and [pull requests](https://github.com/sindresorhus/type-fest/pulls).**\n\n## Install\n\n```sh\nnpm install type-fest\n```\n\n*Requires TypeScript >=5.9, [ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c), and [`{strict: true}`](https://www.typescriptlang.org/tsconfig#strict) in your tsconfig.*\n\n> [!NOTE]\n> This readme shows the current development version. For docs about the latest version, see the [npm page](https://www.npmjs.com/package/type-fest).\n\n*You may also like my [`ts-extras`](https://github.com/sindresorhus/ts-extras) package which provides runtime functions for some of these types.*\n\n## Usage\n\n```ts\nimport type {Except} from 'type-fest';\n\ntype Foo = {\n\tunicorn: string;\n\trainbow: boolean;\n};\n\ntype FooWithoutRainbow = Except<Foo, 'rainbow'>;\n//=> {unicorn: string}\n```\n\n## API\n\nClick the type names for complete docs.\n\n### Basic\n\n- [`Primitive`](source/primitive.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).\n- [`Class`](source/basic.d.ts) - Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n- [`Constructor`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n- [`AbstractClass`](source/basic.d.ts) - Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/2/classes.html#abstract-classes-and-members).\n- [`AbstractConstructor`](source/basic.d.ts) - Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.\n- [`TypedArray`](source/typed-array.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.\n- [`ObservableLike`](source/globals/observable-like.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).\n- [`LowercaseLetter`](source/characters.d.ts) - Matches any lowercase letter in the basic Latin alphabet (a-z).\n- [`UppercaseLetter`](source/characters.d.ts) - Matches any uppercase letter in the basic Latin alphabet (A-Z).\n- [`DigitCharacter`](source/characters.d.ts) - Matches any digit as a string ('0'-'9').\n- [`Alphanumeric`](source/characters.d.ts) - Matches any lowercase letter (a-z), uppercase letter (A-Z), or digit ('0'-'9') in the basic Latin alphabet.\n\n### Utilities\n\n- [`EmptyObject`](source/empty-object.d.ts) - Represents a strictly empty plain object, the `{}` value.\n- [`NonEmptyObject`](source/non-empty-object.d.ts) - Represents an object with at least 1 non-optional key.\n- [`UnknownRecord`](source/unknown-record.d.ts) - Represents an object with `unknown` value. You probably want this instead of `{}`.\n- [`UnknownArray`](source/unknown-array.d.ts) - Represents an array with `unknown` value.\n- [`UnknownMap`](source/unknown-map.d.ts) - Represents a map with `unknown` key and value.\n- [`UnknownSet`](source/unknown-set.d.ts) - Represents a set with `unknown` value.\n- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys).\n- [`Writable`](source/writable.d.ts) - Create a type that strips `readonly` from the given type. Inverse of `Readonly<T>`.\n- [`WritableDeep`](source/writable-deep.d.ts) - Create a deeply mutable version of an `object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray` type. The inverse of `ReadonlyDeep<T>`. Use `Writable<T>` if you only need one level deep.\n- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.\n- [`ObjectMerge`](source/object-merge.d.ts) - Merge two object types into a new object type, where keys from the second override keys from the first.\n- [`MergeDeep`](source/merge-deep.d.ts) - Merge two objects or two arrays/tuples recursively into a new type.\n- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.\n- [`OverrideProperties`](source/override-properties.d.ts) - Override only existing properties of the given type. Similar to `Merge`, but enforces that the original type has the properties you want to override.\n- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys.\n- [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.\n- [`RequireAllOrNone`](source/require-all-or-none.d.ts) - Create a type that requires all of the given keys or none of the given keys.\n- [`RequireOneOrNone`](source/require-one-or-none.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more, or none of the given keys.\n- [`SingleKeyObject`](source/single-key-object.d.ts) - Create a type that only accepts an object with a single key.\n- [`RequiredDeep`](source/required-deep.d.ts) - Create a deeply required version of another type. Use [`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype) if you only need one level deep.\n- [`PickDeep`](source/pick-deep.d.ts) - Pick properties from a deeply-nested object. Use [`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys) if you only need one level deep.\n- [`OmitDeep`](source/omit-deep.d.ts) - Omit properties from a deeply-nested object. Use [`Omit<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys) if you only need one level deep.\n- [`OmitIndexSignature`](source/omit-index-signature.d.ts) - Omit any index signatures from the given object type, leaving only explicitly defined properties.\n- [`PickIndexSignature`](source/pick-index-signature.d.ts) - Pick only index signatures from the given object type, leaving out all explicitly defined properties.\n- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) if you only need one level deep.\n- [`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts) - Create a deep version of another type where all keys accepting `undefined` type are set to optional.\n- [`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts) - Create a deep version of another type where all optional keys are set to also accept `undefined`.\n- [`UnwrapPartial`](source/unwrap-partial.d.ts) - Revert the `Partial` modifier on an object type.\n- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) if you only need one level deep.\n- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).\n- [`Tagged`](source/tagged.d.ts) - Create a [tagged type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) that can support [multiple tags](https://github.com/sindresorhus/type-fest/issues/665) and [per-tag metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). (This replaces the previous [`Opaque`](source/tagged.d.ts) type, which is now deprecated.)\n- [`UnwrapTagged`](source/tagged.d.ts) - Get the untagged portion of a tagged type created with `Tagged`. (This replaces the previous [`UnwrapOpaque`](source/tagged.d.ts) type, which is now deprecated.)\n- [`InvariantOf`](source/invariant-of.d.ts) - Create an [invariant type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance), which is a type that does not accept supertypes and subtypes.\n- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.\n- [`SetReadonly`](source/set-readonly.d.ts) - Create a type that makes the given keys readonly.\n- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.\n- [`SetRequiredDeep`](source/set-required-deep.d.ts) - Like `SetRequired` except it selects the keys deeply.\n- [`SetNonNullable`](source/set-non-nullable.d.ts) - Create a type that makes the given keys non-nullable.\n- [`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts) - Create a type that makes the specified keys non-nullable (removes `null` and `undefined`), supports deeply nested key paths, and leaves all other keys unchanged.\n- [`ValueOf`](source/value-of.d.ts) - Create a union of the given object's values, and optionally specify which keys to get the values from.\n- [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type.\n- [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type.\n- [`ConditionalPickDeep`](source/conditional-pick-deep.d.ts) - Like `ConditionalPick` except that it selects the properties deeply.\n- [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type.\n- [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type.\n- [`LiteralToPrimitive`](source/literal-to-primitive.d.ts) - Convert a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types) to the [primitive type](source/primitive.d.ts) it belongs to.\n- [`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts) - Like `LiteralToPrimitive` except it converts literal types inside an object or array deeply.\n- [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type.\n- [`IterableElement`](source/iterable-element.d.ts) - Get the element type of an `Iterable`/`AsyncIterable`. For example, `Array`, `Set`, `Map`, generator, stream, etc.\n- [`Entry`](source/entry.d.ts) - Create a type that represents the type of an entry of a collection.\n- [`Entries`](source/entries.d.ts) - Create a type that represents the type of the entries of a collection.\n- [`SetReturnType`](source/set-return-type.d.ts) - Create a function type with a return type of your choice and the same parameters as the given function type.\n- [`SetParameterType`](source/set-parameter-type.d.ts) - Create a function that replaces some parameters with the given parameters.\n- [`Simplify`](source/simplify.d.ts) - Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.\n- [`SimplifyDeep`](source/simplify-deep.d.ts) - Deeply simplifies an object type.\n- [`Get`](source/get.d.ts) - Get a deeply-nested property from an object using a key path, like [Lodash's `.get()`](https://lodash.com/docs/latest#get) function.\n- [`KeyAsString`](source/key-as-string.d.ts) - Get keys of the given type as strings.\n- [`Schema`](source/schema.d.ts) - Create a deep version of another object type where property values are recursively replaced into a given value type.\n- [`Exact`](source/exact.d.ts) - Create a type that does not allow extra properties.\n- [`KeysOfUnion`](source/keys-of-union.d.ts) - Create a union of all keys from a given type, even those exclusive to specific union members.\n- [`OptionalKeysOf`](source/optional-keys-of.d.ts) - Extract all optional keys from the given type.\n- [`HasOptionalKeys`](source/has-optional-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any optional fields.\n- [`RequiredKeysOf`](source/required-keys-of.d.ts) - Extract all required keys from the given type.\n- [`HasRequiredKeys`](source/has-required-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any required fields.\n- [`ReadonlyKeysOf`](source/readonly-keys-of.d.ts) - Extract all readonly keys from the given type.\n- [`HasReadonlyKeys`](source/has-readonly-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any readonly fields.\n- [`WritableKeysOf`](source/writable-keys-of.d.ts) - Extract all writable (non-readonly) keys from the given type.\n- [`HasWritableKeys`](source/has-writable-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any writable fields.\n- [`Spread`](source/spread.d.ts) - Mimic the type inferred by TypeScript when merging two objects or two arrays/tuples using the spread syntax.\n- [`IsEqual`](source/is-equal.d.ts) - Returns a boolean for whether the two given types are equal.\n- [`TaggedUnion`](source/tagged-union.d.ts) - Create a union of types that share a common discriminant property.\n- [`IntRange`](source/int-range.d.ts) - Generate a union of numbers (includes the start and excludes the end).\n- [`IntClosedRange`](source/int-closed-range.d.ts) - Generate a union of numbers (includes the start and the end).\n- [`ArrayIndices`](source/array-indices.d.ts) - Provides valid indices for a constant array or tuple.\n- [`ArrayValues`](source/array-values.d.ts) - Provides all values for a constant array or tuple.\n- [`ArraySplice`](source/array-splice.d.ts) - Create a new array type by adding or removing elements at a specified index range in the original array.\n- [`ArrayTail`](source/array-tail.d.ts) - Extract the type of an array or tuple minus the first element.\n- [`SetFieldType`](source/set-field-type.d.ts) - Create a type that changes the type of the given keys.\n- [`Paths`](source/paths.d.ts) - Generate a union of all possible paths to properties in the given object.\n- [`SharedUnionFields`](source/shared-union-fields.d.ts) - Create a type with shared fields from a union of object types.\n- [`SharedUnionFieldsDeep`](source/shared-union-fields-deep.d.ts) - Create a type with shared fields from a union of object types, deeply traversing nested structures.\n- [`AllUnionFields`](source/all-union-fields.d.ts) - Create a type with all fields from a union of object types.\n- [`DistributedOmit`](source/distributed-omit.d.ts) - Omits keys from a type, distributing the operation over a union.\n- [`DistributedPick`](source/distributed-pick.d.ts) - Picks keys from a type, distributing the operation over a union.\n- [`And`](source/and.d.ts) - Returns a boolean for whether two given types are both `true`.\n- [`Or`](source/or.d.ts) - Returns a boolean for whether either of two given types is `true`.\n- [`Xor`](source/xor.d.ts) - Returns a boolean for whether only one of two given types is `true`.\n- [`AndAll`](source/and-all.d.ts) - Returns a boolean for whether all of the given elements are `true`.\n- [`OrAll`](source/or-all.d.ts) - Returns a boolean for whether any of the given elements is `true`.\n- [`AllExtend`](source/all-extend.d.ts) - Returns a boolean for whether every element in an array type extends another type.\n- [`SomeExtend`](source/some-extend.d.ts) - Returns a boolean for whether some element in an array type extends another type.\n- [`NonEmptyTuple`](source/non-empty-tuple.d.ts) - Matches any non-empty tuple.\n- [`NonEmptyString`](source/non-empty-string.d.ts) - Matches any non-empty string.\n- [`FindGlobalType`](source/find-global-type.d.ts) - Tries to find the type of a global with the given name.\n- [`FindGlobalInstanceType`](source/find-global-type.d.ts) - Tries to find one or more types from their globally-defined constructors.\n- [`ConditionalSimplify`](source/conditional-simplify.d.ts) - Simplifies a type while including and/or excluding certain types from being simplified.\n- [`ConditionalSimplifyDeep`](source/conditional-simplify-deep.d.ts) - Recursively simplifies a type while including and/or excluding certain types from being simplified.\n- [`ExclusifyUnion`](source/exclusify-union.d.ts) - Ensure mutual exclusivity in object unions by adding other members’ keys as `?: never`.\n- [`Optional`](source/optional.d.ts) - Create a type that represents either the value or `undefined`, while stripping `null` from the type.\n- [`UnionMember`](source/union-member.d.ts) - Returns an arbitrary member of a union type.\n\n### Type Guard\n\n- [`If`](source/if.d.ts) - An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.\n- [`IsLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsStringLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsNumericLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsBooleanLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsSymbolLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsAny`](source/is-any.d.ts) - Returns a boolean for whether the given type is `any`.\n- [`IsNever`](source/is-never.d.ts) - Returns a boolean for whether the given type is `never`.\n- [`IsUnknown`](source/is-unknown.d.ts) - Returns a boolean for whether the given type is `unknown`.\n- [`IsEmptyObject`](source/empty-object.d.ts) - Returns a boolean for whether the type is strictly equal to an empty plain object, the `{}` value.\n- [`IsNull`](source/is-null.d.ts) - Returns a boolean for whether the given type is `null`.\n- [`IsUndefined`](source/is-undefined.d.ts) - Returns a boolean for whether the given type is `undefined`.\n- [`IsTuple`](source/is-tuple.d.ts) - Returns a boolean for whether the given array is a tuple.\n- [`IsUnion`](source/is-union.d.ts) - Returns a boolean for whether the given type is a union.\n- [`IsLowercase`](source/is-lowercase.d.ts) - Returns a boolean for whether the given string literal is lowercase.\n- [`IsUppercase`](source/is-uppercase.d.ts) - Returns a boolean for whether the given string literal is uppercase.\n- [`IsOptional`](source/is-optional.d.ts) - Returns a boolean for whether the given type includes `undefined`.\n- [`IsNullable`](source/is-nullable.d.ts) - Returns a boolean for whether the given type includes `null`.\n- [`IsOptionalKeyOf`](source/is-optional-key-of.d.ts) - Returns a boolean for whether the given key is an optional key of type.\n- [`IsRequiredKeyOf`](source/is-required-key-of.d.ts) - Returns a boolean for whether the given key is a required key of type.\n- [`IsReadonlyKeyOf`](source/is-readonly-key-of.d.ts) - Returns a boolean for whether the given key is a readonly key of type.\n- [`IsWritableKeyOf`](source/is-writable-key-of.d.ts) - Returns a boolean for whether the given key is a writable key of type.\n\n### JSON\n\n- [`Jsonify`](source/jsonify.d.ts) - Transform a type to one that is assignable to the `JsonValue` type.\n- [`Jsonifiable`](source/jsonifiable.d.ts) - Matches a value that can be losslessly converted to JSON.\n- [`JsonPrimitive`](source/json-value.d.ts) - Matches a JSON primitive.\n- [`JsonObject`](source/json-value.d.ts) - Matches a JSON object.\n- [`JsonArray`](source/json-value.d.ts) - Matches a JSON array.\n- [`JsonValue`](source/json-value.d.ts) - Matches any valid JSON value.\n\n### Structured clone\n\n- [`StructuredCloneable`](source/structured-cloneable.d.ts) - Matches a value that can be losslessly cloned using `structuredClone`.\n\n### Async\n\n- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.\n- [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.\n- [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.\n\n### String\n\n- [`Trim`](source/trim.d.ts) - Remove leading and trailing spaces from a string.\n- [`Split`](source/split.d.ts) - Represents an array of strings split using a given character or character set.\n- [`Words`](source/words.d.ts) - Represents an array of strings split using a heuristic for detecting words.\n- [`Replace`](source/replace.d.ts) - Represents a string with some or all matches replaced by a replacement.\n- [`StringSlice`](source/string-slice.d.ts) - Returns a string slice of a given range, just like `String#slice()`.\n- [`StringRepeat`](source/string-repeat.d.ts) - Returns a new string which contains the specified number of copies of a given string, just like `String#repeat()`.\n- [`RemovePrefix`](source/remove-prefix.d.ts) - Remove the specified prefix from the start of a string.\n\n### Array\n\n- [`Arrayable`](source/arrayable.d.ts) - Create a type that represents either the value or an array of the value.\n- [`Includes`](source/includes.d.ts) - Returns a boolean for whether the given array includes the given item.\n- [`Join`](source/join.d.ts) - Join an array of strings and/or numbers using the given string as a delimiter.\n- [`ArraySlice`](source/array-slice.d.ts) - Returns an array slice of a given range, just like `Array#slice()`.\n- [`ArrayElement`](source/array-element.d.ts) - Extracts the element type of an array or tuple.\n- [`LastArrayElement`](source/last-array-element.d.ts) - Extract the type of the last element of an array.\n- [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length. The `Array` prototype methods that manipulate its length are excluded from the resulting type.\n- [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and dimensions.\n- [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and dimensions.\n- [`ReadonlyTuple`](source/readonly-tuple.d.ts) - Create a type that represents a read-only tuple of the given type and length.\n- [`TupleToUnion`](source/tuple-to-union.d.ts) - Convert a tuple/array into a union type of its elements.\n- [`UnionToTuple`](source/union-to-tuple.d.ts) - Convert a union type into an unordered tuple type of its elements.\n- [`TupleToObject`](source/tuple-to-object.d.ts) - Transforms a tuple into an object, mapping each tuple index to its corresponding type as a key-value pair.\n- [`TupleOf`](source/tuple-of.d.ts) - Create a tuple type of the specified length with elements of the specified type.\n- [`SplitOnRestElement`](source/split-on-rest-element.d.ts) - Splits an array into three parts, where the first contains all elements before the rest element, the second is the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element itself, and the third contains all elements after the rest element.\n- [`ExtractRestElement`](source/extract-rest-element.d.ts) - Extract the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element type from an array.\n- [`ExcludeRestElement`](source/exclude-rest-element.d.ts) - Create a tuple with the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element removed.\n- [`ArrayReverse`](source/array-reverse.d.ts) - Reverse the order of elements in a tuple type.\n- [`ArrayLength`](source/array-length.d.ts) - Return the length of an array. Equivalent to `T['length']` where `T` extends any array.\n\n### Numeric\n\n- [`PositiveInfinity`](source/numeric.d.ts) - Matches the hidden `Infinity` type.\n- [`NegativeInfinity`](source/numeric.d.ts) - Matches the hidden `-Infinity` type.\n- [`Finite`](source/numeric.d.ts) - A finite `number`.\n- [`Integer`](source/numeric.d.ts) - A `number` that is an integer.\n- [`Float`](source/numeric.d.ts) - A `number` that is not an integer.\n- [`NegativeFloat`](source/numeric.d.ts) - A negative (`-∞ < x < 0`) `number` that is not an integer.\n- [`Negative`](source/numeric.d.ts) - A negative `number`/`bigint` (`-∞ < x < 0`)\n- [`NonNegative`](source/numeric.d.ts) - A non-negative `number`/`bigint` (`0 <= x < ∞`).\n- [`NegativeInteger`](source/numeric.d.ts) - A negative (`-∞ < x < 0`) `number` that is an integer.\n- [`NonNegativeInteger`](source/numeric.d.ts) - A non-negative (`0 <= x < ∞`) `number` that is an integer.\n- [`IsNegative`](source/numeric.d.ts) - Returns a boolean for whether the given number is a negative number.\n- [`IsFloat`](source/is-float.d.ts) - Returns a boolean for whether the given number is a float, like `1.5` or `-1.5`.\n- [`IsInteger`](source/is-integer.d.ts) - Returns a boolean for whether the given number is an integer, like `-5`, `1.0` or `100`.\n- [`GreaterThan`](source/greater-than.d.ts) - Returns a boolean for whether a given number is greater than another number.\n- [`GreaterThanOrEqual`](source/greater-than-or-equal.d.ts) - Returns a boolean for whether a given number is greater than or equal to another number.\n- [`LessThan`](source/less-than.d.ts) - Returns a boolean for whether a given number is less than another number.\n- [`LessThanOrEqual`](source/less-than-or-equal.d.ts) - Returns a boolean for whether a given number is less than or equal to another number.\n- [`Sum`](source/sum.d.ts) - Returns the sum of two numbers.\n- [`Subtract`](source/subtract.d.ts) - Returns the difference between two numbers.\n\n### Change case\n\n- [`CamelCase`](source/camel-case.d.ts) - Convert a string literal to camel-case (`fooBar`).\n- [`CamelCasedProperties`](source/camel-cased-properties.d.ts) - Convert object properties to camel-case (`fooBar`).\n- [`CamelCasedPropertiesDeep`](source/camel-cased-properties-deep.d.ts) - Convert object properties to camel-case recursively (`fooBar`).\n- [`KebabCase`](source/kebab-case.d.ts) - Convert a string literal to kebab-case (`foo-bar`).\n- [`KebabCasedProperties`](source/kebab-cased-properties.d.ts) - Convert object properties to kebab-case (`foo-bar`).\n- [`KebabCasedPropertiesDeep`](source/kebab-cased-properties-deep.d.ts) - Convert object properties to kebab-case recursively (`foo-bar`).\n- [`PascalCase`](source/pascal-case.d.ts) - Convert a string literal to pascal-case (`FooBar`).\n- [`PascalCasedProperties`](source/pascal-cased-properties.d.ts) - Convert object properties to pascal-case (`FooBar`).\n- [`PascalCasedPropertiesDeep`](source/pascal-cased-properties-deep.d.ts) - Convert object properties to pascal-case recursively (`FooBar`).\n- [`SnakeCase`](source/snake-case.d.ts) - Convert a string literal to snake-case (`foo_bar`).\n- [`SnakeCasedProperties`](source/snake-cased-properties.d.ts) - Convert object properties to snake-case (`foo_bar`).\n- [`SnakeCasedPropertiesDeep`](source/snake-cased-properties-deep.d.ts) - Convert object properties to snake-case recursively (`foo_bar`).\n- [`ScreamingSnakeCase`](source/screaming-snake-case.d.ts) - Convert a string literal to screaming-snake-case (`FOO_BAR`).\n- [`DelimiterCase`](source/delimiter-case.d.ts) - Convert a string literal to a custom string delimiter casing.\n- [`DelimiterCasedProperties`](source/delimiter-cased-properties.d.ts) - Convert object properties to a custom string delimiter casing.\n- [`DelimiterCasedPropertiesDeep`](source/delimiter-cased-properties-deep.d.ts) - Convert object properties to a custom string delimiter casing recursively.\n\n### Miscellaneous\n\n- [`GlobalThis`](source/global-this.d.ts) - Declare locally scoped properties on `globalThis`.\n- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). It also includes support for [TypeScript Declaration Files](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html).\n- [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html).\n\n### Improved built-in\n\n- [`ExtendsStrict`](source/extends-strict.d.ts) - A stricter, non-distributive version of `extends` for checking whether one type is assignable to another.\n- [`ExtractStrict`](source/extract-strict.d.ts) - A stricter version of `Extract<T, U>` that ensures every member of `U` can successfully extract something from `T`.\n- [`ExcludeStrict`](source/exclude-strict.d.ts) - A stricter version of `Exclude<T, U>` that ensures every member of `U` can successfully exclude something from `T`.\n- [`ExcludeExactly`](source/exclude-exactly.d.ts) - A stricter version of `Exclude<T, U>` that excludes types only when they are exactly identical.\n\n## Declined types\n\n*If we decline a type addition, we will make sure to document the better solution here.*\n\n- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The pull request author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider.\n- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary<number>` vs `Record<string, number>`) from [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now.\n- [`ExtractProperties` and `ExtractMethods`](https://github.com/sindresorhus/type-fest/pull/4) - The types violate the single responsibility principle. Instead, refine your types into more granular type hierarchies.\n- [`Url2Json`](https://github.com/sindresorhus/type-fest/pull/262) - Inferring search parameters from a URL string is a cute idea, but not very useful in practice, since search parameters are usually dynamic and defined separately.\n- [`Nullish`](https://github.com/sindresorhus/type-fest/pull/318) - The type only saves a couple of characters, not everyone knows what \"nullish\" means, and I'm also trying to [get away from `null`](https://github.com/sindresorhus/meta/discussions/7).\n- [`TitleCase`](https://github.com/sindresorhus/type-fest/pull/303) - It's not solving a common need and is a better fit for a separate package.\n- [`ExtendOr` and `ExtendAnd`](https://github.com/sindresorhus/type-fest/pull/247) - The benefits don't outweigh having to learn what they mean.\n- [`PackageJsonExtras`](https://github.com/sindresorhus/type-fest/issues/371) - There are too many possible configurations that can be put into `package.json`. If you would like to extend `PackageJson` to support an additional configuration in your project, please see the *Extending existing types* section below.\n\n## Alternative type names\n\n*If you know one of our types by a different name, add it here for discovery.*\n\n- `Prettify`- See [`Simplify`](source/simplify.d.ts)\n- `Expand`- See [`Simplify`](source/simplify.d.ts)\n- `PartialBy` - See [`SetOptional`](source/set-optional.d.ts)\n- `RecordDeep`- See [`Schema`](source/schema.d.ts)\n- `Mutable`- See [`Writable`](source/writable.d.ts)\n- `RequireOnlyOne`, `OneOf` - See [`RequireExactlyOne`](source/require-exactly-one.d.ts)\n- `AtMostOne` - See [`RequireOneOrNone`](source/require-one-or-none.d.ts)\n- `AllKeys` - See [`KeysOfUnion`](source/keys-of-union.d.ts)\n- `Branded` - See [`Tagged`](source/tagged.d.ts)\n- `Opaque` - See [`Tagged`](source/tagged.d.ts)\n- `SetElement` - See [`IterableElement`](source/iterable-element.d.ts)\n- `SetEntry` - See [`IterableElement`](source/iterable-element.d.ts)\n- `SetValues` - See [`IterableElement`](source/iterable-element.d.ts)\n- `PickByTypes` - See [`ConditionalPick`](source/conditional-pick.d.ts)\n- `HomomorphicOmit` - See [`Except`](source/except.d.ts)\n- `IfAny`, `IfNever`, `If*` - See [`If`](source/if.d.ts)\n- `Maybe`, `Option` - See [`Optional`](source/optional.d.ts)\n- `MaybePromise` - See [`Promisable`](source/promisable.d.ts)\n- `ReadonlyTuple` - See [`TupleOf`](source/tuple-of.d.ts)\n- `LastOfUnion` - See [`UnionMember`](source/union-member.d.ts)\n- `FirstOfUnion` - See [`UnionMember`](source/union-member.d.ts)\n\n## Tips\n\n### Extending existing types\n\n- [`PackageJson`](source/package-json.d.ts) - There are a lot of tools that place extra configurations inside the `package.json` file. You can extend `PackageJson` to support these additional configurations.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBDAnmApnA3gBQIYGMDW2A5igFIDOEAdnNuXAEJ0o4HFmVUC+cAZlBBBwA5ElQBaXinIxhAbgCwAKFCRYCZGnQAZYFRgooPfoJHSANntmKlysWlaESFanAC8jZo-YuaAMgwLKwBhal5gIgB+AC44XX1DADpQqnCiLhsgA)\n\n\t```ts\n\timport type {PackageJson as BasePackageJson} from 'type-fest';\n\timport type {Linter} from 'eslint';\n\n\ttype PackageJson = BasePackageJson & {eslintConfig?: Linter.Config};\n\t```\n\t</details>\n\n### Related\n\n- [typed-query-selector](https://github.com/g-plane/typed-query-selector) - Enhances `document.querySelector` and `document.querySelectorAll` with a template literal type that matches element types returned from an HTML element query selector.\n- [`Linter.Config`](https://github.com/eslint/eslint/blob/main/lib/types/index.d.ts) - Definitions for the [ESLint configuration schema](https://eslint.org/docs/user-guide/configuring/language-options).\n\n### Built-in types\n\nThere are many advanced types most users don't know about.\n\n\n- [`Awaited<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#awaitedtype) - Extract the type of a value that a `Promise` resolves to.\n  <details>\n  <summary>\n  \tExample\n  </summary>\n\n  [Playground](https://www.typescriptlang.org/play/?#code/JYOwLgpgTgZghgYwgAgKoGdrIN4FgBQyyAkMACYBcyIArgLYBG0A3AUcSHHRFemFKADmrQiTiCe1ekygiiAXwJtkCADZx06NJigBBAA7AAytABuwJDmXENATxAJkMCGAQALDNAAUNHQElKKUZoAEoqAAUoAHs6YEwAHk8oAD4rUWJiAHpM5AAxF3dkMDcUXywyODA4J2i6IpLkCqqGDQgAOmssnIAVBsQwGjhVZGA6fVUIbnBK4CiQZFjBNzBkVSiogGtV4A2UYriKTuyVOb5kKAh0fVOUAF5kOAB3OGAV51c3LwAiTLhDTLKUEyABJsICAvIQnISF0TiAzk1qvcLlcbm0AFboOZeKFHHIXAZQeaI6EZAk0Ik4EaBACMABpqFxJF8AFJRNzzAAiUQgXwZ4kkAGYAAzIeSkxSiSXKMC2fQofIfCBkJLIe66Z6vZXxABKLgpIG6cogiR0BmMZgsEAA2l93u4kl8ALrJZIiZR2BxOGgOMCzeZuOAgMgTJKcypwLx-C1QcxIKhJc0mWNWhngwK0YJQEJpdj8Wy5mEIU4rQFURXuZWq+5PF4raPJuPte0eHQ+fxkXHpWG6GCQKBOApuITIQGNCMM2xRGgqIPIeWwKJQOqmOACadafr+rToGiFDSj-RNEfFUo6EbgaDwJB0vGz9wnhqImpRb2Es8QBlLhZwDYjuBkGQrz+kMyC6OEfjnBAACONCXGAm5aCAEDKsqHTpPIs4fMgXjQNE2aFhkxx4d+gbBqoQjWJKChKKIxbwqWZqGI2VpqtQECPNo0BJpaSA4tCZEhhAYYRu23HMbxn7IDSUJAA)\n\n  ```ts\n  interface User {\n  \tid: number;\n  \tname: string;\n  \tage: number;\n  }\n\n  class UserApiService {\n  \tasync fetchUser(userId: number): Promise<User> {\n  \t\t// Fetch the user data from the database.\n  \t\t// The actual implementation might look like this:\n  \t\t// const response = await fetch('/api/user/${userId}');\n  \t\t// const data = response.json();\n  \t\t// return data;\n  \t\treturn {\n  \t\t\tid: 1,\n  \t\t\tname: 'John Doe',\n  \t\t\tage: 30\n  \t\t};\n  \t}\n  }\n\n  type FetchedUser = Awaited<ReturnType<UserApiService['fetchUser']>>;\n\n  async function handleUserData(apiService: UserApiService, userId: number) {\n  \ttry {\n  \t\tconst user: FetchedUser = await apiService.fetchUser(userId);\n  \t\t// After fetching user data, you can perform various actions such as updating the user interface,\n  \t\t// caching the data for future use, or making additional API requests as needed.\n  \t} catch (error) {\n  \t\t// Error handling\n  \t}\n  }\n\n  const userApiService = new UserApiService();\n  handleUserData(userApiService, 1);\n  ```\n\n- [`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) - Make all properties in `T` optional.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgHIHsAmEDC6QzADmyA3gLABQyycADnanALYQBcyAzmFKEQNxUaddFDAcQAV2YAjaIMoBfKlQQAbOJ05osEAIIMAQpOBrsUMkOR1eANziRkCfISKSoD4Pg4ZseAsTIALyW1DS0DEysHADkvvoMMQA0VsKi4sgAzAAMuVaKClY2wPaOknSYDrguADwA0sgQAB6QIJjaANYQAJ7oMDp+LsQAfAAUXd0cdUnI9mo+uv6uANp1ALoAlKHhyGAAFsCcAHTOAW4eYF4gyxNrwbNwago0ypRWp66jH8QcAApwYmAjxq8SWIy2FDCNDA3ToKFBQyIdR69wmfQG1TOhShyBgomQX3w3GQE2Q6IA8jIAFYQBBgI4TTiEs5bTQYsFInrLTbbHZOIlgZDlSqQABqj0kKBC3yINx6a2xfOQwH6o2FVXFaklwSCIUkbQghBAEEwENSfNOlykEGefNe5uhB2O6sgS3GPRmLogmslG1tLxUOKgEDA7hAuydtteryAA)\n\n\t```ts\n\tinterface NodeConfig {\n\t\t\tappName: string;\n\t\t\tport: number;\n\t}\n\n\tclass NodeAppBuilder {\n\t\t\tprivate configuration: NodeConfig = {\n\t\t\t\t\tappName: 'NodeApp',\n\t\t\t\t\tport: 3000\n\t\t\t};\n\n\t\t\tprivate updateConfig<Key extends keyof NodeConfig>(key: Key, value: NodeConfig[Key]) {\n\t\t\t\t\tthis.configuration[key] = value;\n\t\t\t}\n\n\t\t\tconfig(config: Partial<NodeConfig>) {\n\t\t\t\t\ttype NodeConfigKey = keyof NodeConfig;\n\n\t\t\t\t\tfor (const key of Object.keys(config) as NodeConfigKey[]) {\n\t\t\t\t\t\t\tconst updateValue = config[key];\n\n\t\t\t\t\t\t\tif (updateValue === undefined) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tthis.updateConfig(key, updateValue);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this;\n\t\t\t}\n\t}\n\n\t// `Partial<NodeConfig>`` allows us to provide only a part of the\n\t// NodeConfig interface.\n\tnew NodeAppBuilder().config({appName: 'ToDoApp'});\n\t```\n\n\t`Partial<T>` can be reverted with [`UnwrapPartial`](source/unwrap-partial.d.ts).\n\t</details>\n\n- [`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype) - Make all properties in `T` required.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA)\n\n\t```ts\n\tinterface ContactForm {\n\t\t\temail?: string;\n\t\t\tmessage?: string;\n\t}\n\n\tfunction submitContactForm(formData: Required<ContactForm>) {\n\t\t\t// Send the form data to the server.\n\t}\n\n\tsubmitContactForm({\n\t\t\temail: 'ex@mple.com',\n\t\t\tmessage: 'Hi! Could you tell me more about…',\n\t});\n\n\t// TypeScript error: missing property 'message'\n\tsubmitContactForm({\n\t\t\temail: 'ex@mple.com',\n\t});\n\t```\n\t</details>\n\n- [`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) - Make all properties in `T` readonly.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA)\n\n\t```ts\n\tenum LogLevel {\n\t\t\tOff,\n\t\t\tDebug,\n\t\t\tError,\n\t\t\tFatal\n\t};\n\n\tinterface LoggerConfig {\n\t\t\tname: string;\n\t\t\tlevel: LogLevel;\n\t}\n\n\tclass Logger {\n\t\t\tconfig: Readonly<LoggerConfig>;\n\n\t\t\tconstructor({name, level}: LoggerConfig) {\n\t\t\t\t\tthis.config = {name, level};\n\t\t\t\t\tObject.freeze(this.config);\n\t\t\t}\n\t}\n\n\tconst config: LoggerConfig = {\n\t\tname: 'MyApp',\n\t\tlevel: LogLevel.Debug\n\t};\n\n\tconst logger = new Logger(config);\n\n\t// TypeScript Error: cannot assign to read-only property.\n\tlogger.config.level = LogLevel.Error;\n\n\t// We are able to edit config variable as we please.\n\tconfig.level = LogLevel.Error;\n\t```\n\t</details>\n\n- [`Pick<T, K>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys) - From `T`, pick a set of properties whose keys are in the union `K`.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA)\n\n\t```ts\n\tinterface Article {\n\t\t\ttitle: string;\n\t\t\tthumbnail: string;\n\t\t\tcontent: string;\n\t}\n\n\t// Creates new type out of the `Article` interface composed\n\t// from the Articles' two properties: `title` and `thumbnail`.\n\t// `ArticlePreview = {title: string; thumbnail: string}`\n\ttype ArticlePreview = Pick<Article, 'title' | 'thumbnail'>;\n\n\t// Render a list of articles using only title and description.\n\tfunction renderArticlePreviews(previews: ArticlePreview[]): HTMLElement {\n\t\t\tconst articles = document.createElement('div');\n\n\t\t\tfor (const preview of previews) {\n\t\t\t\t\t// Append preview to the articles.\n\t\t\t}\n\n\t\t\treturn articles;\n\t}\n\n\tconst articles = renderArticlePreviews([\n\t\t\t{\n\t\t\t\ttitle: 'TypeScript tutorial!',\n\t\t\t\tthumbnail: '/assets/ts.jpg'\n\t\t\t}\n\t]);\n\t```\n\t</details>\n\n- [`Record<K, T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type) - Construct a type with a set of properties `K` of type `T`.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA)\n\n\t```ts\n\t// Positions of employees in our company.\n\ttype MemberPosition = 'intern' | 'developer' | 'tech-lead';\n\n\t// Interface describing properties of a single employee.\n\tinterface Employee {\n\t\t\tfirstName: string;\n\t\t\tlastName: string;\n\t\t\tyearsOfExperience: number;\n\t}\n\n\t// Create an object that has all possible `MemberPosition` values set as keys.\n\t// Those keys will store a collection of Employees of the same position.\n\tconst team: Record<MemberPosition, Employee[]> = {\n\t\t\tintern: [],\n\t\t\tdeveloper: [],\n\t\t\t'tech-lead': [],\n\t};\n\n\t// Our team has decided to help John with his dream of becoming Software Developer.\n\tteam.intern.push({\n\t\tfirstName: 'John',\n\t\tlastName: 'Doe',\n\t\tyearsOfExperience: 0\n\t});\n\n\t// `Record` forces you to initialize all of the property keys.\n\t// TypeScript Error: \"tech-lead\" property is missing\n\tconst teamEmpty: Record<MemberPosition, null> = {\n\t\t\tintern: null,\n\t\t\tdeveloper: null,\n\t};\n\t```\n\t</details>\n\n- [`Exclude<T, U>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#excludetype-excludedunion) - Exclude from `T` those types that are assignable to `U`.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA)\n\n\t```ts\n\tinterface ServerConfig {\n\t\tport: null | string | number;\n\t}\n\n\ttype RequestHandler = (request: Request, response: Response) => void;\n\n\t// Exclude `null` type from `null | string | number`.\n\t// In case the port is equal to `null`, we will use default value.\n\tfunction getPortValue(port: Exclude<ServerConfig['port'], null>): number {\n\t\tif (typeof port === 'string') {\n\t\t\treturn parseInt(port, 10);\n\t\t}\n\n\t\treturn port;\n\t}\n\n\tfunction startServer(handler: RequestHandler, config: ServerConfig): void {\n\t\tconst server = require('http').createServer(handler);\n\n\t\tconst port = config.port === null ? 3000 : getPortValue(config.port);\n\t\tserver.listen(port);\n\t}\n\t```\n\t</details>\n\n- [`Extract<T, U>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#extracttype-union) - Extract from `T` those types that are assignable to `U`.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA)\n\n\t```ts\n\tdeclare function uniqueId(): number;\n\n\tconst ID = Symbol('ID');\n\n\tinterface Person {\n\t\t[ID]: number;\n\t\tname: string;\n\t\tage: number;\n\t}\n\n\t// Allows changing the person data as long as the property key is of string type.\n\tfunction changePersonData<\n\t\tObj extends Person,\n\t\tKey extends Extract<keyof Person, string>,\n\t\tValue extends Obj[Key]\n\t> (obj: Obj, key: Key, value: Value): void {\n\t\tobj[key] = value;\n\t}\n\n\t// Tiny Andrew was born.\n\tconst andrew = {\n\t\t[ID]: uniqueId(),\n\t\tname: 'Andrew',\n\t\tage: 0,\n\t};\n\n\t// Cool, we're fine with that.\n\tchangePersonData(andrew, 'name', 'Pony');\n\n\t// Government didn't like the fact that you wanted to change your identity.\n\tchangePersonData(andrew, ID, uniqueId());\n\t```\n\t</details>\n\n- [`NonNullable<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#nonnullabletype) - Exclude `null` and `undefined` from `T`.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\tWorks with <a href=\"https://www.typescriptlang.org/tsconfig#strictNullChecks\"><code>strictNullChecks</code></a> set to <code>true</code>.\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA)\n\n\t```ts\n\ttype PortNumber = string | number | null;\n\n\t/** Part of a class definition that is used to build a server */\n\tclass ServerBuilder {\n\t\t\tportNumber!: NonNullable<PortNumber>;\n\n\t\t\tport(this: ServerBuilder, port: PortNumber): ServerBuilder {\n\t\t\t\t\tif (port == null) {\n\t\t\t\t\t\t\tthis.portNumber = 8000;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.portNumber = port;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this;\n\t\t\t}\n\t}\n\n\tconst serverBuilder = new ServerBuilder();\n\n\tserverBuilder\n\t\t\t.port('8000')   // portNumber = '8000'\n\t\t\t.port(null)     // portNumber =  8000\n\t\t\t.port(3000);    // portNumber =  3000\n\n\t// TypeScript error\n\tserverBuilder.portNumber = null;\n\t```\n\t</details>\n\n- [`Parameters<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype) - Obtain the parameters of a function type in a tuple.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA)\n\n\t```ts\n\tfunction shuffle(input: any[]): void {\n\t\t// Mutate array randomly changing its' elements indexes.\n\t}\n\n\tfunction callNTimes<Fn extends (...arguments_: any[]) => any> (func: Fn, callCount: number) {\n\t\t// Type that represents the type of the received function parameters.\n\t\ttype FunctionParameters = Parameters<Fn>;\n\n\t\treturn function (...arguments_: FunctionParameters) {\n\t\t\tfor (let i = 0; i < callCount; i++) {\n\t\t\t\tfunc(...arguments_);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst shuffleTwice = callNTimes(shuffle, 2);\n\t```\n\t</details>\n\n- [`ConstructorParameters<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#constructorparameterstype) - Obtain the parameters of a constructor function type in a tuple.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA)\n\n\t```ts\n\tclass ArticleModel {\n\t\ttitle: string;\n\t\tcontent?: string;\n\n\t\tconstructor(title: string) {\n\t\t\tthis.title = title;\n\t\t}\n\t}\n\n\tclass InstanceCache<T extends (new (...arguments_: any[]) => any)> {\n\t\tprivate ClassConstructor: T;\n\t\tprivate cache: Map<string, InstanceType<T>> = new Map();\n\n\t\tconstructor (ctr: T) {\n\t\t\tthis.ClassConstructor = ctr;\n\t\t}\n\n\t\tgetInstance (...arguments_: ConstructorParameters<T>): InstanceType<T> {\n\t\t\tconst hash = this.calculateArgumentsHash(...arguments_);\n\n\t\t\tconst existingInstance = this.cache.get(hash);\n\t\t\tif (existingInstance !== undefined) {\n\t\t\t\treturn existingInstance;\n\t\t\t}\n\n\t\t\treturn new this.ClassConstructor(...arguments_);\n\t\t}\n\n\t\tprivate calculateArgumentsHash(...arguments_: any[]): string {\n\t\t\t// Calculate hash.\n\t\t\treturn 'hash';\n\t\t}\n\t}\n\n\tconst articleCache = new InstanceCache(ArticleModel);\n\tconst amazonArticle = articleCache.getInstance('Amazon forests burning!');\n\t```\n\t</details>\n\n- [`ReturnType<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#returntypetype) - Obtain the return type of a function type.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)\n\n\t```ts\n\t/** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */\n\tfunction mapIter<\n\t\t\tElem,\n\t\t\tFunc extends (elem: Elem) => any,\n\t\t\tRet extends ReturnType<Func>\n\t>(iter: Iterable<Elem>, callback: Func): Ret[] {\n\t\t\tconst mapped: Ret[] = [];\n\n\t\t\tfor (const elem of iter) {\n\t\t\t\t\tmapped.push(callback(elem));\n\t\t\t}\n\n\t\t\treturn mapped;\n\t}\n\n\tconst setObject: Set<string> = new Set();\n\tconst mapObject: Map<number, string> = new Map();\n\n\tmapIter(setObject, (value: string) => value.indexOf('Foo')); // number[]\n\n\tmapIter(mapObject, ([key, value]: [number, string]) => {\n\t\t\treturn key % 2 === 0 ? value : 'Odd';\n\t}); // string[]\n\t```\n\t</details>\n\n- [`InstanceType<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#instancetypetype) - Obtain the instance type of a constructor function type.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)\n\n\t```ts\n\tclass IdleService {\n\t\t\tdoNothing (): void {}\n\t}\n\n\tclass News {\n\t\t\ttitle: string;\n\t\t\tcontent: string;\n\n\t\t\tconstructor(title: string, content: string) {\n\t\t\t\t\tthis.title = title;\n\t\t\t\t\tthis.content = content;\n\t\t\t}\n\t}\n\n\tconst instanceCounter: Map<Function, number> = new Map();\n\n\tinterface Constructor {\n\t\t\tnew(...arguments_: any[]): any;\n\t}\n\n\t// Keep track how many instances of `Constr` constructor have been created.\n\tfunction getInstance<\n\t\t\tConstr extends Constructor,\n\t\t\tArguments extends ConstructorParameters<Constr>\n\t>(constructor: Constr, ...arguments_: Arguments): InstanceType<Constr> {\n\t\t\tlet count = instanceCounter.get(constructor) || 0;\n\n\t\t\tconst instance = new constructor(...arguments_);\n\n\t\t\tinstanceCounter.set(constructor, count + 1);\n\n\t\t\tconsole.log(`Created ${count + 1} instances of ${Constr.name} class`);\n\n\t\t\treturn instance;\n\t}\n\n\n\tconst idleService = getInstance(IdleService);\n\t// Will log: `Created 1 instances of IdleService class`\n\tconst newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...');\n\t// Will log: `Created 1 instances of News class`\n\t```\n\t</details>\n\n- [`Omit<T, K>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys) - Constructs a type by picking all properties from T and then removing K.\n\t<details>\n\t<summary>\n\t\t\tExample\n\t</summary>\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA)\n\n\t```ts\n\tinterface Animal {\n\t\t\timageUrl: string;\n\t\t\tspecies: string;\n\t\t\timages: string[];\n\t\t\tparagraphs: string[];\n\t}\n\n\t// Creates new type with all properties of the `Animal` interface\n\t// except 'images' and 'paragraphs' properties. We can use this\n\t// type to render small hover tooltip for a wiki entry list.\n\ttype AnimalShortInfo = Omit<Animal, 'images' | 'paragraphs'>;\n\n\tfunction renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement {\n\t\t\tconst container = document.createElement('div');\n\t\t\t// Internal implementation.\n\t\t\treturn container;\n\t}\n\t```\n\t</details>\n\n- [`Uppercase<S extends string>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#uppercasestringtype) - Transforms every character in a string into uppercase.\n\t<details>\n\t<summary>\n\t\tExample\n\t</summary>\n\n\t```ts\n\ttype T = Uppercase<'hello'>;  // 'HELLO'\n\n\ttype T2 = Uppercase<'foo' | 'bar'>;  // 'FOO' | 'BAR'\n\n\ttype T3<S extends string> = Uppercase<`aB${S}`>;\n\ttype T4 = T3<'xYz'>;  // 'ABXYZ'\n\n\ttype T5 = Uppercase<string>;  // string\n\ttype T6 = Uppercase<any>;  // any\n\ttype T7 = Uppercase<never>;  // never\n\ttype T8 = Uppercase<42>;  // Error, type 'number' does not satisfy the constraint 'string'\n\t```\n\t</details>\n\n- [`Lowercase<S extends string>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#lowercasestringtype) - Transforms every character in a string into lowercase.\n\t<details>\n\t<summary>\n\t\tExample\n\t</summary>\n\n\t```ts\n\ttype T = Lowercase<'HELLO'>;  // 'hello'\n\n\ttype T2 = Lowercase<'FOO' | 'BAR'>;  // 'foo' | 'bar'\n\n\ttype T3<S extends string> = Lowercase<`aB${S}`>;\n\ttype T4 = T3<'xYz'>;  // 'abxyz'\n\n\ttype T5 = Lowercase<string>;  // string\n\ttype T6 = Lowercase<any>;  // any\n\ttype T7 = Lowercase<never>;  // never\n\ttype T8 = Lowercase<42>;  // Error, type 'number' does not satisfy the constraint 'string'\n\t```\n\t</details>\n\n- [`Capitalize<S extends string>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#capitalizestringtype) - Transforms the first character in a string into uppercase.\n\t<details>\n\t<summary>\n\t\tExample\n\t</summary>\n\n\t```ts\n\ttype T = Capitalize<'hello'>;  // 'Hello'\n\n\ttype T2 = Capitalize<'foo' | 'bar'>;  // 'Foo' | 'Bar'\n\n\ttype T3<S extends string> = Capitalize<`aB${S}`>;\n\ttype T4 = T3<'xYz'>;  // 'ABxYz'\n\n\ttype T5 = Capitalize<string>;  // string\n\ttype T6 = Capitalize<any>;  // any\n\ttype T7 = Capitalize<never>;  // never\n\ttype T8 = Capitalize<42>;  // Error, type 'number' does not satisfy the constraint 'string'\n\t```\n\t</details>\n\n- [`Uncapitalize<S extends string>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#uncapitalizestringtype) - Transforms the first character in a string into lowercase.\n\t<details>\n\t<summary>\n\t\tExample\n\t</summary>\n\n\t```ts\n\ttype T = Uncapitalize<'Hello'>;  // 'hello'\n\n\ttype T2 = Uncapitalize<'Foo' | 'Bar'>;  // 'foo' | 'bar'\n\n\ttype T3<S extends string> = Uncapitalize<`AB${S}`>;\n\ttype T4 = T3<'xYz'>;  // 'aBxYz'\n\n\ttype T5 = Uncapitalize<string>;  // string\n\ttype T6 = Uncapitalize<any>;  // any\n\ttype T7 = Uncapitalize<never>;  // never\n\ttype T8 = Uncapitalize<42>;  // Error, type 'number' does not satisfy the constraint 'string'\n\t```\n\t</details>\n\nYou can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/utility-types.html).\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Haozheng Li](https://github.com/Emiyaaaaa)\n- [Som Shekhar Mukherjee](https://github.com/som-sm)\n- [Jarek Radosz](https://github.com/CvX)\n- [Dimitri Benin](https://github.com/BendingBender)\n- [Pelle Wessman](https://github.com/voxpelli)\n- [Sébastien Mischler](https://github.com/skarab42)\n\n## License\n\n- [MIT](license-mit)\n- [CC0-1.0](license-cc0)\n\nSPDX-License-Identifier: (MIT OR CC0-1.0)\n"
  },
  {
    "path": "source/all-extend.d.ts",
    "content": "import type {CollapseRestElement} from './internal/array.d.ts';\nimport type {ApplyDefaultOptions} from './internal/object.d.ts';\nimport type {IfNotAnyOrNever, Not} from './internal/type.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {Or} from './or.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\n@see {@link AllExtend}\n*/\nexport type AllExtendOptions = {\n\t/**\n\tConsider `never` elements to match the target type only if the target type itself is `never` (or `any`).\n\n\t- When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).\n\t- When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.\n\n\t@default true\n\n\t@example\n\t```\n\timport type {AllExtend} from 'type-fest';\n\n\ttype A = AllExtend<[1, 2, never], number, {strictNever: true}>;\n\t//=> false\n\n\ttype B = AllExtend<[1, 2, never], number, {strictNever: false}>;\n\t//=> true\n\n\ttype C = AllExtend<[never, never], never, {strictNever: true}>;\n\t//=> true\n\n\ttype D = AllExtend<[never, never], never, {strictNever: false}>;\n\t//=> true\n\n\ttype E = AllExtend<['a', 'b', never], any, {strictNever: true}>;\n\t//=> true\n\n\ttype F = AllExtend<['a', 'b', never], any, {strictNever: false}>;\n\t//=> true\n\n\ttype G = AllExtend<[never, 1], never, {strictNever: true}>;\n\t//=> false\n\n\ttype H = AllExtend<[never, 1], never, {strictNever: false}>;\n\t//=> false\n\t```\n\t*/\n\tstrictNever?: boolean;\n};\n\ntype DefaultAllExtendOptions = {\n\tstrictNever: true;\n};\n\n/**\nReturns a boolean for whether every element in an array type extends another type.\n\n@example\n```\nimport type {AllExtend} from 'type-fest';\n\ntype A = AllExtend<[1, 2, 3], number>;\n//=> true\n\ntype B = AllExtend<[1, 2, '3'], number>;\n//=> false\n\ntype C = AllExtend<[number, number | string], number>;\n//=> boolean\n\ntype D = AllExtend<[true, boolean, true], true>;\n//=> boolean\n```\n\nNote: Behaviour of optional elements depend on the `exactOptionalPropertyTypes` compiler option. When the option is disabled, the target type must include `undefined` for a successful match.\n\n```\n// @exactOptionalPropertyTypes: true\nimport type {AllExtend} from 'type-fest';\n\ntype A = AllExtend<[1?, 2?, 3?], number>;\n//=> true\n```\n\n```\n// @exactOptionalPropertyTypes: false\nimport type {AllExtend} from 'type-fest';\n\ntype A = AllExtend<[1?, 2?, 3?], number>;\n//=> boolean\n\ntype B = AllExtend<[1?, 2?, 3?], number | undefined>;\n//=> true\n```\n\n@see {@link AllExtendOptions}\n\n@category Utilities\n@category Array\n*/\nexport type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> =\n\t_AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;\n\ntype _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray,\n\tTArray extends readonly [infer First, ...infer Rest]\n\t\t? IsNever<First> extends true\n\t\t\t? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true\n\t\t\t\t// If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.\n\t\t\t\t? _AllExtend<Rest, Type, Options>\n\t\t\t\t: false\n\t\t\t: First extends Type\n\t\t\t\t? _AllExtend<Rest, Type, Options>\n\t\t\t\t: false\n\t\t: true,\n\tfalse, false>;\n\nexport {};\n"
  },
  {
    "path": "source/all-union-fields.d.ts",
    "content": "import type {NonRecursiveType, ReadonlyKeysOfUnion, ValueOfUnion} from './internal/index.d.ts';\nimport type {KeysOfUnion} from './keys-of-union.d.ts';\nimport type {SharedUnionFields} from './shared-union-fields.d.ts';\nimport type {Simplify} from './simplify.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nCreate a type with all fields from a union of object types.\n\nUse-cases:\n- You want a safe object type where each key exists in the union object.\n\n@example\n```\nimport type {AllUnionFields} from 'type-fest';\n\ntype Cat = {\n\tname: string;\n\ttype: 'cat';\n\tcatType: string;\n};\n\ntype Dog = {\n\tname: string;\n\ttype: 'dog';\n\tdogType: string;\n};\n\nfunction displayPetInfo(petInfo: Cat | Dog) {\n\t// typeof petInfo =>\n\t// {\n\t// \tname: string;\n\t// \ttype: 'cat';\n\t// \tcatType: string;\n\t// } | {\n\t// \tname: string;\n\t// \ttype: 'dog';\n\t// \tdogType: string;\n\t// }\n\n\tconsole.log('name:', petInfo.name);\n\tconsole.log('type:', petInfo.type);\n\n\t// TypeScript complains about `catType` and `dogType` not existing on type `Cat | Dog`.\n\t// @ts-expect-error\n\tconsole.log('animal type:', petInfo.catType ?? petInfo.dogType);\n}\n\nfunction displayPetInfoWithAllUnionFields(petInfo: AllUnionFields<Cat | Dog>) {\n\t// typeof petInfo =>\n\t// {\n\t// \tname: string;\n\t// \ttype: 'cat' | 'dog';\n\t// \tcatType?: string;\n\t// \tdogType?: string;\n\t// }\n\n\tconsole.log('name:', petInfo.name);\n\tconsole.log('type:', petInfo.type);\n\n\t// No TypeScript error.\n\tconsole.log('animal type:', petInfo.catType ?? petInfo.dogType);\n}\n```\n\n@see {@link SharedUnionFields}\n\n@category Object\n@category Union\n*/\nexport type AllUnionFields<Union> =\nExtract<Union, NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown> | UnknownArray> extends infer SkippedMembers\n\t? Exclude<Union, SkippedMembers> extends infer RelevantMembers\n\t\t?\n\t\t| SkippedMembers\n\t\t| Simplify<\n\t\t// Include fields that are common in all union members\n\t\t\tSharedUnionFields<RelevantMembers> &\n\t\t// Include readonly fields present in any union member\n\t\t\t{\n\t\t\t\treadonly [P in ReadonlyKeysOfUnion<RelevantMembers>]?: ValueOfUnion<RelevantMembers, P & KeysOfUnion<RelevantMembers>>\n\t\t\t} &\n\t\t// Include remaining fields that are neither common nor readonly\n\t\t\t{\n\t\t\t\t[P in Exclude<KeysOfUnion<RelevantMembers>, ReadonlyKeysOfUnion<RelevantMembers> | keyof RelevantMembers>]?: ValueOfUnion<RelevantMembers, P>\n\t\t\t}\n\t\t>\n\t\t: never\n\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/and-all.d.ts",
    "content": "import type {AllExtend} from './all-extend.d.ts';\n\n/**\nReturns a boolean for whether all of the given elements are `true`.\n\nUse-cases:\n- Check if all conditions in a list of booleans are met.\n\n@example\n```\nimport type {AndAll} from 'type-fest';\n\ntype TTT = AndAll<[true, true, true]>;\n//=> true\n\ntype TTF = AndAll<[true, true, false]>;\n//=> false\n\ntype TFT = AndAll<[true, false, true]>;\n//=> false\n```\n\nNote: When `boolean` is passed as an element, it is distributed into separate cases, and the final result is a union of those cases.\nFor example, `AndAll<[true, boolean]>` expands to `AndAll<[true, true]> | AndAll<[true, false]>`, which simplifies to `true | false` (i.e., `boolean`).\n\n@example\n```\nimport type {AndAll} from 'type-fest';\n\ntype A = AndAll<[true, boolean]>;\n//=> boolean\n\ntype B = AndAll<[false, boolean]>;\n//=> false\n```\n\nNote: If any of the elements is `never`, the result becomes `false`.\n\n@example\n```\nimport type {AndAll} from 'type-fest';\n\ntype A = AndAll<[true, true, never]>;\n//=> false\n\ntype B = AndAll<[false, never, never]>;\n//=> false\n\ntype C = AndAll<[never, never, never]>;\n//=> false\n\ntype D = AndAll<[boolean, true, never]>;\n//=> false\n```\n\nNote: If `any` is passed as an element, it is treated as `boolean` and the result is computed accordingly.\n\n@example\n```\nimport type {AndAll} from 'type-fest';\n\ntype A = AndAll<[false, any]>;\n//=> false\n\ntype B = AndAll<[true, any]>;\n//=> boolean\n```\n\nNote: `AndAll<[]>` evaluates to `true` due to the concept of [vacuous truth](https://en.wikipedia.org/wiki/Logical_conjunction#:~:text=In%20keeping%20with%20the%20concept%20of%20vacuous%20truth%2C%20when%20conjunction%20is%20defined%20as%20an%20operator%20or%20function%20of%20arbitrary%20arity%2C%20the%20empty%20conjunction%20(AND%2Ding%20over%20an%20empty%20set%20of%20operands)%20is%20often%20defined%20as%20having%20the%20result%20true.), i.e., there are no `false` elements in an empty tuple.\n\n@see {@link And}\n@see {@link OrAll}\n*/\nexport type AndAll<T extends readonly boolean[]> = AllExtend<T, true>;\n\nexport {};\n"
  },
  {
    "path": "source/and.d.ts",
    "content": "import type {AndAll} from './and-all.d.ts';\n\n/**\nReturns a boolean for whether two given types are both true.\n\nUse-case: Constructing complex conditional types where multiple conditions must be satisfied.\n\n@example\n```\nimport type {And} from 'type-fest';\n\ntype TT = And<true, true>;\n//=> true\n\ntype TF = And<true, false>;\n//=> false\n\ntype FT = And<false, true>;\n//=> false\n\ntype FF = And<false, false>;\n//=> false\n```\n\nNote: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.\nFor example, `And<true, boolean>` expands to `And<true, true> | And<true, false>`, which simplifies to `true | false` (i.e., `boolean`).\n\n@example\n```\nimport type {And} from 'type-fest';\n\ntype A = And<true, boolean>;\n//=> boolean\n\ntype B = And<boolean, true>;\n//=> boolean\n\ntype C = And<false, boolean>;\n//=> false\n\ntype D = And<boolean, false>;\n//=> false\n\ntype E = And<boolean, boolean>;\n//=> boolean\n```\n\nNote: If either of the types is `never`, the result becomes `false`.\n\n@example\n```\nimport type {And} from 'type-fest';\n\ntype A = And<true, never>;\n//=> false\n\ntype B = And<never, true>;\n//=> false\n\ntype C = And<false, never>;\n//=> false\n\ntype D = And<never, false>;\n//=> false\n\ntype E = And<boolean, never>;\n//=> false\n\ntype F = And<never, boolean>;\n//=> false\n\ntype G = And<never, never>;\n//=> false\n```\n\n@see {@link AndAll}\n@see {@link Or}\n@see {@link Xor}\n*/\nexport type And<A extends boolean, B extends boolean> = AndAll<[A, B]>;\n\nexport {};\n"
  },
  {
    "path": "source/array-element.d.ts",
    "content": "import type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nExtracts the element type of an array or tuple.\n\nUse-cases:\n- When you need type-safe element extraction that returns `never` for non-arrays.\n- When extracting element types from generic array parameters in function signatures.\n- For better readability and explicit intent over using `T[number]` directly.\n\nNote: Returns `never` if the type is not an array.\n\n@example\n```\nimport type {ArrayElement} from 'type-fest';\n\n// Arrays\ntype StringArray = ArrayElement<string[]>;\n//=> string\n\n// Tuples\ntype Tuple = ArrayElement<[1, 2, 3]>;\n//=> 1 | 2 | 3\n\n// Type-safe\ntype NotArray = ArrayElement<{a: string}>;\n//=> never\n\n// Practical example\ndeclare function getRandomElement<T extends readonly unknown[]>(array: T): ArrayElement<T>;\n\ngetRandomElement(['foo', 'bar', 'baz'] as const);\n//=> 'foo' | 'bar' | 'baz'\n```\n\n@see {@link ArrayValues} - For directly extracting values from a constant array type.\n@see {@link IterableElement} - For iterables like `Set`, `Map`, and generators (not suitable for all use cases due to different inference behavior).\n\n@category Array\n*/\nexport type ArrayElement<T> =\n\tT extends UnknownArray\n\t\t? T[number]\n\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/array-indices.d.ts",
    "content": "/**\nProvides valid indices for a constant array or tuple.\n\nUse-case: This type is useful when working with constant arrays or tuples and you want to enforce type-safety for accessing elements by their indices.\n\n@example\n```\nimport type {ArrayIndices, ArrayValues} from 'type-fest';\n\nconst weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as const;\n\ntype Weekday = ArrayIndices<typeof weekdays>;\ntype WeekdayName = ArrayValues<typeof weekdays>;\n\nconst getWeekdayName = (day: Weekday): WeekdayName => weekdays[day];\n```\n\n@see {@link ArrayValues}\n\n@category Array\n*/\nexport type ArrayIndices<Element extends readonly unknown[]> =\n\tExclude<Partial<Element>['length'], Element['length']>;\n\nexport {};\n"
  },
  {
    "path": "source/array-length.d.ts",
    "content": "/**\nReturn the length of an array. Equivalent to `T['length']` where `T` extends any array.\n\nTuples resolve to numeric literals, while non-tuples resolve to the `number` type.\n\n@example\n```\nimport type {ArrayLength} from 'type-fest';\n\ntype TupleLength = ArrayLength<[1, 2, 3]>;\n//=> 3\n\ntype TupleWithOptionalMembersLength = ArrayLength<[1, 2, number?]>;\n//=> 2 | 3\n\ntype NonTupleArrayLength = ArrayLength<string[]>;\n//=> number\n\ntype TupleWithRestElementLength = ArrayLength<[1, 2, ...string[]]>;\n//=> number\n\n// Distinguish between arrays with fixed and non-fixed lengths\ntype IsFixedLengthArray<T extends readonly unknown[]> = number extends ArrayLength<T> ? false : true;\n\ntype A = IsFixedLengthArray<number[]>;\n//=> false\n\ntype B = IsFixedLengthArray<[1, 2, 3]>;\n//=> true\n```\n\n@category Array\n*/\nexport type ArrayLength<T extends readonly unknown[]> = T['length'];\n\nexport {};\n"
  },
  {
    "path": "source/array-reverse.d.ts",
    "content": "import type {If} from './if.d.ts';\nimport type {IsArrayReadonly} from './internal/array.d.ts';\nimport type {IfNotAnyOrNever, IsExactOptionalPropertyTypesEnabled} from './internal/type.d.ts';\nimport type {IsOptionalKeyOf} from './is-optional-key-of.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nReverse the order of elements in a tuple type.\n\n@example\n```ts\nimport type {ArrayReverse} from 'type-fest';\n\ntype A = ArrayReverse<[string, number, boolean]>;\n//=> [boolean, number, string]\n\ntype B = ArrayReverse<readonly [string, number, ...boolean[]]>;\n//=> readonly [...boolean[], number, string]\n\ntype C = ArrayReverse<['foo', 'bar'] | readonly [1, 2, 3]>;\n//=> ['bar', 'foo'] | readonly [3, 2, 1]\n\ntype D = ArrayReverse<string[]>;\n//=> string[]\n\ntype E = ArrayReverse<[]>;\n//=> []\n```\n\nNote: If the tuple contains optional elements, the result will be a union of tuples, refer to the examples below:\n\n@example\n```ts\nimport type {ArrayReverse} from 'type-fest';\n\ntype A = ArrayReverse<[string, number, boolean?]>;\n//=> [number, string] | [boolean, number, string]\n\ntype B = ArrayReverse<[string, number?, boolean?]>;\n//=> [string] | [number, string] | [boolean, number, string]\n\ntype C = ArrayReverse<[string?, number?, boolean?]>;\n//=> [] | [string] | [number, string] | [boolean, number, string]\n\ntype D = ArrayReverse<[string, number?, ...boolean[]]>;\n//=> [string] | [...boolean[], number, string]\n\ntype E = ArrayReverse<[string?, number?, ...boolean[]]>;\n//=> [] | [string] | [...boolean[], number, string]\n```\n\n@category Array\n*/\nexport type ArrayReverse<TArray extends UnknownArray> = IfNotAnyOrNever<TArray,\n\tTArray extends unknown // For distributing `TArray`\n\t\t? _ArrayReverse<TArray> extends infer Result\n\t\t\t? If<IsArrayReadonly<TArray>, Readonly<Result>, Result>\n\t\t\t: never // Should never happen\n\t\t: never>; // Should never happen\n\ntype _ArrayReverse<\n\tTArray extends UnknownArray,\n\tBeforeRestAcc extends UnknownArray = [],\n\tAfterRestAcc extends UnknownArray = [],\n\tResult extends UnknownArray = never,\n> =\n\tkeyof TArray & `${number}` extends never\n\t\t// Enters this branch, if `TArray` is empty (e.g., `[]`),\n\t\t// or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).\n\t\t? TArray extends readonly [...infer Rest, infer Last]\n\t\t\t? _ArrayReverse<Rest, BeforeRestAcc, [...AfterRestAcc, Last], Result> // Accumulate elements that are present after the rest element in reverse order.\n\t\t\t: Result | [...AfterRestAcc, ...TArray, ...BeforeRestAcc] // Add the rest element between the accumulated elements.\n\t\t: TArray extends readonly [(infer First)?, ...infer Rest]\n\t\t\t? IsOptionalKeyOf<TArray, '0'> extends true\n\t\t\t\t? _ArrayReverse<\n\t\t\t\t\tRest,\n\t\t\t\t\t[First | (If<IsExactOptionalPropertyTypesEnabled, never, undefined>), ...BeforeRestAcc], // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.\n\t\t\t\t\tAfterRestAcc,\n\t\t\t\t\tResult | BeforeRestAcc\n\t\t\t\t>\n\t\t\t\t: _ArrayReverse<Rest, [First, ...BeforeRestAcc], AfterRestAcc, Result>\n\t\t\t: never; // Should never happen, since `readonly [(infer First)?, ...infer Rest]` is a top-type for arrays.\n\nexport {};\n"
  },
  {
    "path": "source/array-slice.d.ts",
    "content": "import type {Sum} from './sum.d.ts';\nimport type {LessThanOrEqual} from './less-than-or-equal.d.ts';\nimport type {GreaterThanOrEqual} from './greater-than-or-equal.d.ts';\nimport type {GreaterThan} from './greater-than.d.ts';\nimport type {IsNegative} from './numeric.d.ts';\nimport type {Not, TupleMin} from './internal/index.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\nimport type {And} from './and.d.ts';\nimport type {ArraySplice} from './array-splice.d.ts';\nimport type {IsNever} from './is-never.d.ts';\n\n/**\nReturns an array slice of a given range, just like `Array#slice()`.\n\n@example\n```\nimport type {ArraySlice} from 'type-fest';\n\ntype T0 = ArraySlice<[0, 1, 2, 3, 4]>;\n//=> [0, 1, 2, 3, 4]\n\ntype T1 = ArraySlice<[0, 1, 2, 3, 4], 0, -1>;\n//=> [0, 1, 2, 3]\n\ntype T2 = ArraySlice<[0, 1, 2, 3, 4], 1, -2>;\n//=> [1, 2]\n\ntype T3 = ArraySlice<[0, 1, 2, 3, 4], -2, 4>;\n//=> [3]\n\ntype T4 = ArraySlice<[0, 1, 2, 3, 4], -2, -1>;\n//=> [3]\n\ntype T5 = ArraySlice<[0, 1, 2, 3, 4], 0, -999>;\n//=> []\n\nfunction arraySlice<\n\tconst Array_ extends readonly unknown[],\n\tStart extends number = 0,\n\tEnd extends number = Array_['length'],\n>(array: Array_, start?: Start, end?: End) {\n\treturn array.slice(start, end) as ArraySlice<Array_, Start, End>;\n}\n\nconst slice = arraySlice([1, '2', {a: 3}, [4, 5]], 0, -1);\n\ntype Slice = typeof slice;\n//=> [1, '2', {readonly a: 3}]\n\nconst value = slice[2].a;\n//=> 3\n\n// @ts-expect-error -- TS2493: Tuple type '[1, \"2\", {readonly a: 3}]' of length '3' has no element at index '3'.\nconst invalidIndexAccess = slice[3];\n```\n\n@category Array\n*/\nexport type ArraySlice<\n\tArray_ extends readonly unknown[],\n\tStart extends number = never,\n\tEnd extends number = never,\n> = Array_ extends unknown // To distributive type\n\t? IsNever<Start> extends true\n\t\t? IsNever<End> extends true\n\t\t\t? _ArraySlice<Array_, Start, End>\n\t\t\t: End extends unknown // To distribute `End`\n\t\t\t\t? _ArraySlice<Array_, Start, End>\n\t\t\t\t: never // Never happens\n\t\t: IsNever<End> extends true\n\t\t\t? Start extends unknown // To distribute `Start`\n\t\t\t\t? _ArraySlice<Array_, Start, End>\n\t\t\t\t: never // Never happens\n\t\t\t: Start extends unknown // To distribute `Start`\n\t\t\t\t? End extends unknown // To distribute `End`\n\t\t\t\t\t? _ArraySlice<Array_, Start, End>\n\t\t\t\t\t: never // Never happens\n\t\t\t\t: never // Never happens\n\t: never; // Never happens\n\ntype _ArraySlice<\n\tArray_ extends readonly unknown[],\n\tStart extends number = 0,\n\tEnd extends number = Array_['length'],\n> = And<IsEqual<Start, never>, IsEqual<End, never>> extends true\n\t? Array_\n\t: number extends Array_['length']\n\t\t? VariableLengthArraySliceHelper<Array_, Start, End>\n\t\t: ArraySliceHelper<Array_, IsEqual<Start, never> extends true ? 0 : Start, IsEqual<End, never> extends true ? Array_['length'] : End>;\n\ntype VariableLengthArraySliceHelper<\n\tArray_ extends readonly unknown[],\n\tStart extends number,\n\tEnd extends number,\n> = And<Not<IsNegative<Start>>, IsEqual<End, never>> extends true\n\t? ArraySplice<Array_, 0, Start>\n\t: And<\n\t\tAnd<Not<IsNegative<Start>>, Not<IsNegative<End>>>,\n\t\tIsEqual<GreaterThan<End, Start>, true>\n\t> extends true\n\t\t? ArraySliceByPositiveIndex<Array_, Start, End>\n\t\t: [];\n\ntype ArraySliceHelper<\n\tArray_ extends readonly unknown[],\n\tStart extends number = 0,\n\tEnd extends number = Array_['length'],\n\tTraversedElement extends Array<Array_[number]> = [],\n\tResult extends Array<Array_[number]> = [],\n\tArrayLength extends number = Array_['length'],\n\tPositiveS extends number = IsNegative<Start> extends true\n\t\t? Sum<ArrayLength, Start> extends infer AddResult extends number\n\t\t\t? number extends AddResult // (ArrayLength + Start) < 0\n\t\t\t\t? 0\n\t\t\t\t: GreaterThan<AddResult, 0> extends true ? AddResult : 0\n\t\t\t: never\n\t\t: Start,\n\tPositiveE extends number = IsNegative<End> extends true ? Sum<ArrayLength, End> : End,\n> = true extends [IsNegative<PositiveS>, LessThanOrEqual<PositiveE, PositiveS>, GreaterThanOrEqual<PositiveS, ArrayLength>][number]\n\t? []\n\t: ArraySliceByPositiveIndex<Array_, TupleMin<[PositiveS, ArrayLength]>, TupleMin<[PositiveE, ArrayLength]>>;\n\ntype ArraySliceByPositiveIndex<\n\tArray_ extends readonly unknown[],\n\tStart extends number,\n\tEnd extends number,\n\tResult extends Array<Array_[number]> = [],\n> = Start extends End\n\t? Result\n\t: ArraySliceByPositiveIndex<Array_, Sum<Start, 1>, End, [...Result, Array_[Start]]>;\n\nexport {};\n"
  },
  {
    "path": "source/array-splice.d.ts",
    "content": "import type {StaticPartOfArray, VariablePartOfArray} from './internal/index.d.ts';\nimport type {GreaterThanOrEqual} from './greater-than-or-equal.d.ts';\nimport type {Subtract} from './subtract.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\nimport type {TupleOf} from './tuple-of.d.ts';\n\n/**\nThe implementation of `SplitArrayByIndex` for fixed length arrays.\n*/\ntype SplitFixedArrayByIndex<T extends UnknownArray, SplitIndex extends number> =\nSplitIndex extends 0\n\t? [[], T]\n\t: T extends readonly [...TupleOf<SplitIndex>, ...infer V]\n\t\t? T extends readonly [...infer U, ...V]\n\t\t\t? [U, V]\n\t\t\t: [never, never]\n\t\t: [never, never];\n\n/**\nThe implementation of `SplitArrayByIndex` for variable length arrays.\n*/\ntype SplitVariableArrayByIndex<T extends UnknownArray,\n\tSplitIndex extends number,\n\tT1 = Subtract<SplitIndex, StaticPartOfArray<T>['length']>,\n\tT2 = T1 extends number\n\t\t? TupleOf<GreaterThanOrEqual<T1, 0> extends true ? T1 : number, VariablePartOfArray<T>[number]>\n\t\t: [],\n> =\nSplitIndex extends 0\n\t? [[], T]\n\t: GreaterThanOrEqual<StaticPartOfArray<T>['length'], SplitIndex> extends true\n\t\t? [\n\t\t\tSplitFixedArrayByIndex<StaticPartOfArray<T>, SplitIndex>[0],\n\t\t\t[\n\t\t\t\t...SplitFixedArrayByIndex<StaticPartOfArray<T>, SplitIndex>[1],\n\t\t\t\t...VariablePartOfArray<T>,\n\t\t\t],\n\t\t]\n\t\t: [\n\t\t\t[\n\t\t\t\t...StaticPartOfArray<T>,\n\t\t\t\t...(T2 extends UnknownArray ? T2 : []),\n\t\t\t],\n\t\t\tVariablePartOfArray<T>,\n\t\t];\n\n/**\nSplit the given array `T` by the given `SplitIndex`.\n\n@example\n```\ntype A = SplitArrayByIndex<[1, 2, 3, 4], 2>;\n//=> [[1, 2], [3, 4]];\n\ntype B = SplitArrayByIndex<[1, 2, 3, 4], 0>;\n//=> [[], [1, 2, 3, 4]];\n```\n*/\ntype SplitArrayByIndex<T extends UnknownArray, SplitIndex extends number> =\n\tSplitIndex extends 0\n\t\t? [[], T]\n\t\t: number extends T['length']\n\t\t\t? SplitVariableArrayByIndex<T, SplitIndex>\n\t\t\t: SplitFixedArrayByIndex<T, SplitIndex>;\n\n/**\nCreate a new array type by adding or removing elements at a specified index range in the original array.\n\nUse-case: Replace or insert items in an array type.\n\nLike [`Array#splice()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) but for types.\n\n@example\n```\nimport type {ArraySplice} from 'type-fest';\n\ntype SomeMonths0 = ['January', 'April', 'June'];\ntype Months0 = ArraySplice<SomeMonths0, 1, 0, ['Feb', 'March']>;\n//=> ['January', 'Feb', 'March', 'April', 'June']\n\ntype SomeMonths1 = ['January', 'April', 'June'];\ntype Months1 = ArraySplice<SomeMonths1, 1, 1>;\n//=> ['January', 'June']\n\ntype SomeMonths2 = ['January', 'Foo', 'April'];\ntype Months2 = ArraySplice<SomeMonths2, 1, 1, ['Feb', 'March']>;\n//=> ['January', 'Feb', 'March', 'April']\n```\n\n@category Array\n*/\nexport type ArraySplice<\n\tT extends UnknownArray,\n\tStart extends number,\n\tDeleteCount extends number,\n\tItems extends UnknownArray = [],\n> =\n\tSplitArrayByIndex<T, Start> extends [infer U extends UnknownArray, infer V extends UnknownArray]\n\t\t? SplitArrayByIndex<V, DeleteCount> extends [infer _Deleted extends UnknownArray, infer X extends UnknownArray]\n\t\t\t? [...U, ...Items, ...X]\n\t\t\t: never // Should never happen\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/array-tail.d.ts",
    "content": "import type {If} from './if.d.ts';\nimport type {IfNotAnyOrNever, IsArrayReadonly} from './internal/index.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nExtract the type of an array or tuple minus the first element.\n\n@example\n```\nimport type {ArrayTail} from 'type-fest';\n\ntype A = ArrayTail<[1, 2, 3]>;\n//=> [2, 3]\n\ntype B = ArrayTail<readonly [1, 2, 3]>;\n//=> readonly [2, 3]\n\ntype C = ArrayTail<[1, 2, 3?, ...string[]]>;\n//=> [2, 3?, ...string[]]\n\ntype D = ArrayTail<readonly [1]>;\n//=> readonly []\n\ntype E = ArrayTail<[]>;\n//=> []\n\ntype F = ArrayTail<string[]>;\n//=> string[]\n\ntype G = ArrayTail<readonly [...string[], 1, 2]>;\n//=> readonly [...string[], 1, 2]\n```\n\n@example\n```\nimport type {ArrayTail} from 'type-fest';\n\ntype Curry<Func> = Func extends (...agruments_: infer Arguments) => infer Return\n\t? Arguments extends readonly []\n\t\t? Return\n\t\t: (agrument: Arguments[0]) => Curry<(...agruments_: ArrayTail<Arguments>) => Return>\n\t: never;\n\ndeclare function curry<Func extends Function>(fn: Func): Curry<Func>;\n\ndeclare function searchBooks(genre: string, minRating: number, available: boolean): string[];\n\nconst availableTopSciFi = curry(searchBooks)('sci-fi')(4.5)(true);\n//=> string[]\n```\n\n@category Array\n*/\nexport type ArrayTail<TArray extends UnknownArray> = IfNotAnyOrNever<TArray,\n\tTArray extends UnknownArray // For distributing `TArray`\n\t\t? _ArrayTail<TArray> extends infer Result\n\t\t\t? If<IsArrayReadonly<TArray>, Readonly<Result>, Result>\n\t\t\t: never // Should never happen\n\t\t: never\n>;\n\ntype _ArrayTail<TArray extends UnknownArray> = TArray extends readonly [unknown?, ...infer Tail]\n\t? keyof TArray & `${number}` extends never\n\t\t? TArray extends readonly []\n\t\t\t? []\n\t\t\t: TArray // Happens when `TArray` is a non-tuple array (e.g., `string[]`) or has a leading rest element (e.g., `[...string[], number]`)\n\t\t: Tail\n\t: [];\n\nexport {};\n"
  },
  {
    "path": "source/array-values.d.ts",
    "content": "/**\nProvides all values for a constant array or tuple.\n\nUse-case: This type is useful when working with constant arrays or tuples and you want to enforce type-safety with their values.\n\n@example\n```\nimport type {ArrayValues, ArrayIndices} from 'type-fest';\n\nconst weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as const;\n\ntype WeekdayName = ArrayValues<typeof weekdays>;\ntype Weekday = ArrayIndices<typeof weekdays>;\n\nconst getWeekdayName = (day: Weekday): WeekdayName => weekdays[day];\n```\n\n@see {@link ArrayIndices}\n\n@category Array\n*/\nexport type ArrayValues<T extends readonly unknown[]> = T[number];\n\nexport {};\n"
  },
  {
    "path": "source/arrayable.d.ts",
    "content": "/**\nCreate a type that represents either the value or an array of the value.\n\n@see {@link Promisable}\n\n@example\n```\nimport type {Arrayable} from 'type-fest';\n\nfunction bundle(input: string, output: Arrayable<string>) {\n\tconst outputList = Array.isArray(output) ? output : [output];\n\n\t// …\n\n\tfor (const output of outputList) {\n\t\tconsole.log(`write ${input} to: ${output}`);\n\t}\n}\n\nbundle('src/index.js', 'dist/index.js');\nbundle('src/index.js', ['dist/index.cjs', 'dist/index.mjs']);\n```\n\n@category Array\n*/\nexport type Arrayable<T> =\n\tT\n// TODO: Use `readonly T[]` when this issue is resolved: https://github.com/microsoft/TypeScript/issues/17002\n\t| T[];\n\nexport {};\n"
  },
  {
    "path": "source/async-return-type.d.ts",
    "content": "type AsyncFunction = (...arguments_: any[]) => PromiseLike<unknown>;\n\n/**\nUnwrap the return type of a function that returns a `Promise`.\n\nThere has been [discussion](https://github.com/microsoft/TypeScript/pull/35998) about implementing this type in TypeScript.\n\n@example\n```ts\nimport type {AsyncReturnType} from 'type-fest';\n\ndeclare function asyncFunction(): Promise<{foo: string}>;\n\n// This type resolves to the unwrapped return type of `asyncFunction`.\ntype Value = AsyncReturnType<typeof asyncFunction>;\n//=> {foo: string}\n\ndeclare function doSomething(value: Value): void;\n\nconst value = await asyncFunction();\ndoSomething(value);\n```\n\n@category Async\n*/\nexport type AsyncReturnType<Target extends AsyncFunction> = Awaited<ReturnType<Target>>;\n\nexport {};\n"
  },
  {
    "path": "source/asyncify.d.ts",
    "content": "import type {SetReturnType} from './set-return-type.d.ts';\n\n/**\nCreate an async version of the given function type, by boxing the return type in `Promise` while keeping the same parameter types.\n\nUse-case: You have two functions, one synchronous and one asynchronous that do the same thing. Instead of having to duplicate the type definition, you can use `Asyncify` to reuse the synchronous type.\n\n@example\n```\nimport type {Asyncify} from 'type-fest';\n\n// Synchronous function\ntype Config = {featureFlags: Record<string, boolean>};\n\ndeclare function loadConfigSync(path: string): Config;\n\ntype LoadConfigAsync = Asyncify<typeof loadConfigSync>;\n//=> (path: string) => Promise<Config>\n```\n\n@category Async\n*/\nexport type Asyncify<Function_ extends (...arguments_: any[]) => any> = SetReturnType<Function_, Promise<Awaited<ReturnType<Function_>>>>;\n\nexport {};\n"
  },
  {
    "path": "source/basic.d.ts",
    "content": "/**\nMatches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n\n@category Class\n*/\nexport type Class<T, Arguments extends unknown[] = any[]> = {\n\tprototype: Pick<T, keyof T>;\n\tnew(...arguments_: Arguments): T;\n};\n\n/**\nMatches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n\n@category Class\n*/\nexport type Constructor<T, Arguments extends unknown[] = any[]> = new(...arguments_: Arguments) => T;\n\n/**\nMatches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/2/classes.html#abstract-classes-and-members).\n\n@category Class\n\n@privateRemarks\nWe cannot use a `type` here because TypeScript throws: 'abstract' modifier cannot appear on a type member. (1070)\n*/\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface AbstractClass<T, Arguments extends unknown[] = any[]> extends AbstractConstructor<T, Arguments> {\n\tprototype: Pick<T, keyof T>;\n}\n\n/**\nMatches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.\n\n@category Class\n*/\nexport type AbstractConstructor<T, Arguments extends unknown[] = any[]> = abstract new(...arguments_: Arguments) => T;\n\nexport {};\n"
  },
  {
    "path": "source/camel-case.d.ts",
    "content": "import type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {Words, WordsOptions} from './words.d.ts';\n\n/**\nCamelCase options.\n\n@see {@link CamelCase}\n*/\nexport type CamelCaseOptions = WordsOptions & {\n\t/**\n\tWhether to preserved consecutive uppercase letter.\n\n\t@default false\n\t*/\n\tpreserveConsecutiveUppercase?: boolean;\n};\n\nexport type _DefaultCamelCaseOptions = {\n\tsplitOnNumbers: true;\n\tpreserveConsecutiveUppercase: false;\n};\n\n/**\nConvert an array of words to camel-case.\n*/\ntype CamelCaseFromArray<\n\tWords extends string[],\n\tOptions extends Required<CamelCaseOptions>,\n\tOutputString extends string = '',\n> = Words extends [\n\tinfer FirstWord extends string,\n\t...infer RemainingWords extends string[],\n]\n\t? Options['preserveConsecutiveUppercase'] extends true\n\t\t? `${Capitalize<FirstWord>}${CamelCaseFromArray<RemainingWords, Options>}`\n\t\t: `${Capitalize<Lowercase<FirstWord>>}${CamelCaseFromArray<RemainingWords, Options>}`\n\t: OutputString;\n\n/**\nConvert a string literal to camel-case.\n\nThis can be useful when, for example, converting some kebab-cased command-line flags or a snake-cased database result.\n\nBy default, consecutive uppercase letter are preserved. See {@link CamelCaseOptions.preserveConsecutiveUppercase preserveConsecutiveUppercase} option to change this behaviour.\n\n@example\n```\nimport type {CamelCase} from 'type-fest';\n\n// Simple\n\nconst someVariable: CamelCase<'foo-bar'> = 'fooBar';\nconst preserveConsecutiveUppercase: CamelCase<'foo-BAR-baz', {preserveConsecutiveUppercase: true}> = 'fooBARBaz';\n\n// Advanced\n\ntype CamelCasedProperties<T> = {\n\t[K in keyof T as CamelCase<K>]: T[K]\n};\n\ntype RawOptions = {\n\t'dry-run': boolean;\n\t'full_family_name': string;\n\tfoo: number;\n\tBAR: string;\n\tQUZ_QUX: number;\n\t'OTHER-FIELD': boolean;\n};\n\nconst dbResult: CamelCasedProperties<RawOptions> = {\n\tdryRun: true,\n\tfullFamilyName: 'bar.js',\n\tfoo: 123,\n\tbar: 'foo',\n\tquzQux: 6,\n\totherField: false,\n};\n```\n\n@category Change case\n@category Template literal\n*/\nexport type CamelCase<Type, Options extends CamelCaseOptions = {}> = Type extends string\n\t? string extends Type\n\t\t? Type\n\t\t: Uncapitalize<CamelCaseFromArray<\n\t\t\tWords<Type extends Uppercase<Type> ? Lowercase<Type> : Type, Options>,\n\t\t\tApplyDefaultOptions<CamelCaseOptions, _DefaultCamelCaseOptions, Options>\n\t\t>>\n\t: Type;\n\nexport {};\n"
  },
  {
    "path": "source/camel-cased-properties-deep.d.ts",
    "content": "import type {CamelCase, CamelCaseOptions, _DefaultCamelCaseOptions} from './camel-case.d.ts';\nimport type {ApplyDefaultOptions, NonRecursiveType} from './internal/index.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nConvert object properties to camel case recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link CamelCasedProperties}\n@see {@link CamelCase}\n\n@example\n```\nimport type {CamelCasedPropertiesDeep} from 'type-fest';\n\ntype User = {\n\tUserId: number;\n\tUserName: string;\n};\n\ntype UserWithFriends = {\n\tUserInfo: User;\n\tUserFriends: User[];\n};\n\nconst result: CamelCasedPropertiesDeep<UserWithFriends> = {\n\tuserInfo: {\n\t\tuserId: 1,\n\t\tuserName: 'Tom',\n\t},\n\tuserFriends: [\n\t\t{\n\t\t\tuserId: 2,\n\t\t\tuserName: 'Jerry',\n\t\t},\n\t\t{\n\t\t\tuserId: 3,\n\t\t\tuserName: 'Spike',\n\t\t},\n\t],\n};\n\nconst preserveConsecutiveUppercase: CamelCasedPropertiesDeep<{fooBAR: {fooBARBiz: [{fooBARBaz: string}]}}, {preserveConsecutiveUppercase: true}> = {\n\tfooBAR: {\n\t\tfooBARBiz: [{\n\t\t\tfooBARBaz: 'string',\n\t\t}],\n\t},\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type CamelCasedPropertiesDeep<\n\tValue,\n\tOptions extends CamelCaseOptions = {},\n> = _CamelCasedPropertiesDeep<Value, ApplyDefaultOptions<CamelCaseOptions, _DefaultCamelCaseOptions, Options>>;\n\ntype _CamelCasedPropertiesDeep<\n\tValue,\n\tOptions extends Required<CamelCaseOptions>,\n> = Value extends NonRecursiveType\n\t? Value\n\t: Value extends UnknownArray\n\t\t? CamelCasedPropertiesArrayDeep<Value, Options>\n\t\t: Value extends Set<infer U>\n\t\t\t? Set<_CamelCasedPropertiesDeep<U, Options>>\n\t\t\t: Value extends object\n\t\t\t\t? {\n\t\t\t\t\t[K in keyof Value as CamelCase<K, Options>]: _CamelCasedPropertiesDeep<Value[K], Options>;\n\t\t\t\t}\n\t\t\t\t: Value;\n\n// This is a copy of DelimiterCasedPropertiesArrayDeep (see: delimiter-cased-properties-deep.d.ts).\n// These types should be kept in sync.\ntype CamelCasedPropertiesArrayDeep<\n\tValue extends UnknownArray,\n\tOptions extends Required<CamelCaseOptions>,\n> = Value extends []\n\t? []\n\t// Trailing spread array\n\t: Value extends [infer U, ...infer V]\n\t\t? [_CamelCasedPropertiesDeep<U, Options>, ..._CamelCasedPropertiesDeep<V, Options>]\n\t\t: Value extends readonly [infer U, ...infer V]\n\t\t\t? readonly [_CamelCasedPropertiesDeep<U, Options>, ..._CamelCasedPropertiesDeep<V, Options>]\n\t\t\t: // Leading spread array\n\t\t\tValue extends readonly [...infer U, infer V]\n\t\t\t\t? [..._CamelCasedPropertiesDeep<U, Options>, _CamelCasedPropertiesDeep<V, Options>]\n\t\t\t\t: // Array\n\t\t\t\tValue extends Array<infer U>\n\t\t\t\t\t? Array<_CamelCasedPropertiesDeep<U, Options>>\n\t\t\t\t\t: Value extends ReadonlyArray<infer U>\n\t\t\t\t\t\t? ReadonlyArray<_CamelCasedPropertiesDeep<U, Options>>\n\t\t\t\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/camel-cased-properties.d.ts",
    "content": "import type {CamelCase, CamelCaseOptions, _DefaultCamelCaseOptions} from './camel-case.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\n\n/**\nConvert object properties to camel case but not recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link CamelCasedPropertiesDeep}\n@see {@link CamelCase}\n\n@example\n```\nimport type {CamelCasedProperties} from 'type-fest';\n\ntype User = {\n\tUserId: number;\n\tUserName: string;\n};\n\nconst result: CamelCasedProperties<User> = {\n\tuserId: 1,\n\tuserName: 'Tom',\n};\n\nconst preserveConsecutiveUppercase: CamelCasedProperties<{fooBAR: string}, {preserveConsecutiveUppercase: true}> = {\n\tfooBAR: 'string',\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type CamelCasedProperties<Value, Options extends CamelCaseOptions = {}> = Value extends Function\n\t? Value\n\t: Value extends Array<infer U>\n\t\t? Value\n\t\t: {\n\t\t\t[K in keyof Value as\n\t\t\tCamelCase<K, ApplyDefaultOptions<CamelCaseOptions, _DefaultCamelCaseOptions, Options>>\n\t\t\t]: Value[K];\n\t\t};\n\nexport {};\n"
  },
  {
    "path": "source/characters.d.ts",
    "content": "/**\nMatches any uppercase letter in the basic Latin alphabet (A-Z).\n\n@example\n```\nimport type {UppercaseLetter} from 'type-fest';\n\nconst a: UppercaseLetter = 'A'; // Valid\n// @ts-expect-error\nconst b: UppercaseLetter = 'a'; // Invalid\n// @ts-expect-error\nconst c: UppercaseLetter = 'AB'; // Invalid\n```\n\n@category Type\n*/\nexport type UppercaseLetter = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';\n\n/**\nMatches any lowercase letter in the basic Latin alphabet (a-z).\n\n@example\n```\nimport type {LowercaseLetter} from 'type-fest';\n\nconst a: LowercaseLetter = 'a'; // Valid\n// @ts-expect-error\nconst b: LowercaseLetter = 'A'; // Invalid\n```\n\n@category Type\n*/\nexport type LowercaseLetter = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';\n\n/**\nMatches any digit as a string ('0'-'9').\n\n@example\n```\nimport type {DigitCharacter} from 'type-fest';\n\nconst a: DigitCharacter = '0'; // Valid\n// @ts-expect-error\nconst b: DigitCharacter = 0; // Invalid\n```\n\n@category Type\n*/\nexport type DigitCharacter = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';\n\n/**\nMatches any lowercase letter (a-z), uppercase letter (A-Z), or digit ('0'-'9') in the basic Latin alphabet.\n\n@example\n```\nimport type {Alphanumeric} from 'type-fest';\n\nconst a: Alphanumeric = 'A'; // Valid\n// @ts-expect-error\nconst b: Alphanumeric = '#'; // Invalid\n```\n\n@category Type\n*/\nexport type Alphanumeric = LowercaseLetter | UppercaseLetter | DigitCharacter;\n\nexport {};\n"
  },
  {
    "path": "source/conditional-except.d.ts",
    "content": "import type {Except} from './except.d.ts';\nimport type {ConditionalKeys} from './conditional-keys.d.ts';\n\n/**\nExclude keys from a shape that matches the given `Condition`.\n\nThis is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.\n\n@example\n```\nimport type {Primitive, ConditionalExcept} from 'type-fest';\n\nclass Awesome {\n\tconstructor(public name: string, public successes: number, public failures: bigint) {}\n\n\trun() {\n\t\t// do something\n\t}\n}\n\ntype ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;\n//=> {run: () => void}\n```\n\n@example\n```\nimport type {ConditionalExcept} from 'type-fest';\n\ntype Example = {\n\ta: string;\n\tb: string | number;\n\tc: () => void;\n\td: {};\n};\n\ntype NonStringKeysOnly = ConditionalExcept<Example, string>;\n//=> {b: string | number; c: () => void; d: {}}\n```\n\n@category Object\n*/\nexport type ConditionalExcept<Base, Condition> = Except<\n\tBase,\n\tConditionalKeys<Base, Condition>\n>;\n\nexport {};\n"
  },
  {
    "path": "source/conditional-keys.d.ts",
    "content": "import type {ExtendsStrict} from './extends-strict.d.ts';\nimport type {IfNotAnyOrNever} from './internal/type.d.ts';\nimport type {TupleToObject} from './tuple-to-object.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nExtract the keys from a type where the value type of the key extends the given `Condition`.\n\nInternally this is used for the `ConditionalPick` and `ConditionalExcept` types.\n\n@example\n```\nimport type {ConditionalKeys} from 'type-fest';\n\ntype Example = {\n\ta: string;\n\tb: string | number;\n\tc?: string;\n\td: {};\n};\n\ntype StringKeysOnly = ConditionalKeys<Example, string>;\n//=> 'a'\n```\n\nNote: To extract optional keys, make sure your `Condition` is a union of `undefined` (for example, `string | undefined`) as demonstrated below.\n\n@example\n```\nimport type {ConditionalKeys} from 'type-fest';\n\ntype StringKeysAndUndefined = ConditionalKeys<{a?: string}, string | undefined>;\n//=> 'a'\n\ntype NoMatchingKeys = ConditionalKeys<{a?: string}, string>;\n//=> never\n```\n\nYou can also extract array indices whose value match the specified condition, as shown below:\n```\nimport type {ConditionalKeys} from 'type-fest';\n\ntype StringValueIndices = ConditionalKeys<[string, number, string], string>;\n//=> '0' | '2'\n\ntype NumberValueIndices = ConditionalKeys<[string, number?, string?], number | undefined>;\n//=> '1'\n```\n\n@category Object\n*/\nexport type ConditionalKeys<Base, Condition> = (Base extends UnknownArray ? TupleToObject<Base> : Base) extends infer _Base // Remove non-numeric keys from arrays\n\t? IfNotAnyOrNever<_Base, _ConditionalKeys<_Base, Condition>, keyof _Base>\n\t: never;\n\ntype _ConditionalKeys<Base, Condition> = keyof {\n\t[\n\tKey in (keyof Base & {}) as // `& {}` prevents homomorphism\n\tExtendsStrict<Base[Key], Condition> extends true ? Key : never\n\t]: never\n};\n\nexport {};\n"
  },
  {
    "path": "source/conditional-pick-deep.d.ts",
    "content": "import type {IsEqual} from './is-equal.d.ts';\nimport type {ConditionalExcept} from './conditional-except.d.ts';\nimport type {ConditionalSimplifyDeep} from './conditional-simplify-deep.d.ts';\nimport type {UnknownRecord} from './unknown-record.d.ts';\nimport type {EmptyObject} from './empty-object.d.ts';\nimport type {ApplyDefaultOptions, IsPlainObject} from './internal/index.d.ts';\n\n/**\nUsed to mark properties that should be excluded.\n*/\ndeclare const conditionalPickDeepSymbol: unique symbol;\n\n/**\nAssert the condition according to the {@link ConditionalPickDeepOptions.condition|condition} option.\n*/\ntype AssertCondition<Type, Condition, Options extends ConditionalPickDeepOptions> = Options['condition'] extends 'equality'\n\t? IsEqual<Type, Condition>\n\t: Type extends Condition\n\t\t? true\n\t\t: false;\n\n/**\nConditionalPickDeep options.\n\n@see {@link ConditionalPickDeep}\n*/\nexport type ConditionalPickDeepOptions = {\n\t/**\n\tThe condition assertion mode.\n\n\t@default 'extends'\n\t*/\n\tcondition?: 'extends' | 'equality';\n};\n\ntype DefaultConditionalPickDeepOptions = {\n\tcondition: 'extends';\n};\n\n/**\nPick keys recursively from the shape that matches the given condition.\n\n@see {@link ConditionalPick}\n\n@example\n```\nimport type {ConditionalPickDeep} from 'type-fest';\n\ntype Example = {\n\ta: string;\n\tb: string | boolean;\n\tc: {\n\t\td: string;\n\t\te: {\n\t\t\tf?: string;\n\t\t\tg?: boolean;\n\t\t\th: string | boolean;\n\t\t\ti: boolean | bigint;\n\t\t};\n\t\tj: boolean;\n\t};\n};\n\ntype StringPick = ConditionalPickDeep<Example, string>;\n//=> {a: string; c: {d: string}}\n\ntype StringPickOptional = ConditionalPickDeep<Example, string | undefined>;\n//=> {a: string; c: {d: string; e: {f?: string}}}\n\ntype StringPickOptionalOnly = ConditionalPickDeep<Example, string | undefined, {condition: 'equality'}>;\n//=> {c: {e: {f?: string}}}\n\ntype BooleanPick = ConditionalPickDeep<Example, boolean | undefined>;\n//=> {c: {e: {g?: boolean}; j: boolean}}\n\ntype NumberPick = ConditionalPickDeep<Example, number>;\n//=> never\n\ntype StringOrBooleanPick = ConditionalPickDeep<Example, string | boolean>;\n//=> {\n// \ta: string;\n// \tb: string | boolean;\n// \tc: {\n// \t\td: string;\n// \t\te: {\n// \t\t\th: string | boolean;\n// \t\t};\n// \t\tj: boolean;\n// \t};\n// }\n\ntype StringOrBooleanPickOnly = ConditionalPickDeep<Example, string | boolean, {condition: 'equality'}>;\n//=> {b: string | boolean; c: {e: {h: string | boolean}}}\n```\n\n@category Object\n*/\nexport type ConditionalPickDeep<\n\tType,\n\tCondition,\n\tOptions extends ConditionalPickDeepOptions = {},\n> = _NeverIfEmpty<_ConditionalPickDeep<\n\tType,\n\tCondition,\n\tApplyDefaultOptions<ConditionalPickDeepOptions, DefaultConditionalPickDeepOptions, Options>\n>>;\n\ntype _NeverIfEmpty<Type> = Type extends EmptyObject ? never : Type;\n\ntype _ConditionalPickDeep<\n\tType,\n\tCondition,\n\tOptions extends Required<ConditionalPickDeepOptions>,\n> = ConditionalSimplifyDeep<ConditionalExcept<{\n\t[Key in keyof Type]: AssertCondition<Type[Key], Condition, Options> extends true\n\t\t? Type[Key]\n\t\t: IsPlainObject<Type[Key]> extends true\n\t\t\t? _ConditionalPickDeep<Type[Key], Condition, Options>\n\t\t\t: typeof conditionalPickDeepSymbol;\n}, (typeof conditionalPickDeepSymbol | undefined) | EmptyObject>, never, UnknownRecord>;\n\nexport {};\n"
  },
  {
    "path": "source/conditional-pick.d.ts",
    "content": "import type {ConditionalKeys} from './conditional-keys.d.ts';\nimport type {IsNever} from './is-never.d.ts';\n\n/**\nPick keys from the shape that matches the given `Condition`.\n\nThis is useful when you want to create a new type from a specific subset of an existing type. For example, you might want to pick all the primitive properties from a class and form a new automatically derived type.\n\n@example\n```\nimport type {Primitive, ConditionalPick} from 'type-fest';\n\nclass Awesome {\n\tconstructor(public name: string, public successes: number, public failures: bigint) {}\n\n\trun() {\n\t\t// do something\n\t}\n}\n\ntype PickPrimitivesFromAwesome = ConditionalPick<Awesome, Primitive>;\n//=> {name: string; successes: number; failures: bigint}\n```\n\n@example\n```\nimport type {ConditionalPick} from 'type-fest';\n\ntype Example = {\n\ta: string;\n\tb: string | number;\n\tc: () => void;\n\td: {};\n};\n\ntype StringKeysOnly = ConditionalPick<Example, string>;\n//=> {a: string}\n```\n\n@category Object\n*/\nexport type ConditionalPick<Base, Condition> = ConditionalKeys<Base, Condition> extends infer Keys\n\t? IsNever<Keys> extends true\n\t\t? never\n\t\t: Pick<Base, Keys & keyof Base>\n\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/conditional-simplify-deep.d.ts",
    "content": "/**\nRecursively simplifies a type while including and/or excluding certain types from being simplified.\n\n@example\n```\nimport type {ConditionalSimplifyDeep} from 'type-fest';\n\ntype TypeA = {\n\tfoo: {\n\t\ta: string;\n\t};\n};\n\ntype TypeB = {\n\tfoo: {\n\t\tb: string;\n\t};\n};\n\ntype SimplifyDeepTypeAB = ConditionalSimplifyDeep<TypeA & TypeB, never, object>;\n//=> {foo: {a: string; b: string}}\n```\n\n@example\n```\nimport type {ConditionalSimplifyDeep} from 'type-fest';\n\ntype SomeComplexType1 = {\n\ta1: string;\n\tb1: number;\n\tc1: boolean;\n};\n\ntype SomeComplexType2 = {\n\ta2: string;\n\tb2: number;\n\tc2: boolean;\n};\n\ntype TypeA = {\n\tfoo: {\n\t\ta: string;\n\t\tcomplexType: SomeComplexType1;\n\t};\n};\n\ntype TypeB = {\n\tfoo: {\n\t\tb: string;\n\t\tcomplexType: SomeComplexType2;\n\t};\n};\n\ntype SimplifyDeepTypeAB = ConditionalSimplifyDeep<TypeA & TypeB, SomeComplexType1 | SomeComplexType2, object>;\n//=> {\n// \tfoo: {\n// \t\ta: string;\n// \t\tcomplexType: SomeComplexType1 & SomeComplexType2;\n// \t\tb: string;\n// \t};\n// }\n```\n\n@see {@link SimplifyDeep}\n@category Object\n*/\nexport type ConditionalSimplifyDeep<Type, ExcludeType = never, IncludeType = unknown> = Type extends ExcludeType\n\t? Type\n\t: Type extends IncludeType\n\t\t? {[TypeKey in keyof Type]: ConditionalSimplifyDeep<Type[TypeKey], ExcludeType, IncludeType>}\n\t\t: Type;\n\nexport {};\n"
  },
  {
    "path": "source/conditional-simplify.d.ts",
    "content": "/**\nSimplifies a type while including and/or excluding certain types from being simplified.\n\nUseful to improve type hints shown in editors. And also to transform an `interface` into a `type` to aid with assignability.\n\n@example\n```\nimport type {ConditionalSimplify} from 'type-fest';\n\ntype TypeA = {\n\ta: string;\n};\n\ntype TypeB = {\n\tb: string;\n};\n\ntype TypeAB = TypeA & TypeB;\n//=> TypeA & TypeB\n\ntype SimplifyTypeAB = ConditionalSimplify<TypeAB, never, object>;\n//=> {a: string; b: string}\n```\n\n@example\n```\nimport type {ConditionalSimplify} from 'type-fest';\n\ntype Simplify<T> = ConditionalSimplify<T, Set<unknown> | Map<unknown, unknown> | unknown[], object>;\n\ntype A = Simplify<Set<number> & Set<string>>;\n//=> Set<number> & Set<string>\n\ntype B = Simplify<Map<number, number> & Map<string, string>>;\n//=> Map<number, number> & Map<string, string>\n\ntype C = Simplify<{a: number} & {b: string}>;\n//=> {a: number; b: string}\n```\n\n@see {@link ConditionalSimplifyDeep}\n@category Object\n*/\nexport type ConditionalSimplify<Type, ExcludeType = never, IncludeType = unknown> = Type extends ExcludeType\n\t? Type\n\t: Type extends IncludeType\n\t\t? {[TypeKey in keyof Type]: Type[TypeKey]}\n\t\t: Type;\n\nexport {};\n"
  },
  {
    "path": "source/delimiter-case.d.ts",
    "content": "import type {ApplyDefaultOptions, AsciiPunctuation, StartsWith} from './internal/index.d.ts';\nimport type {IsStringLiteral} from './is-literal.d.ts';\nimport type {Merge} from './merge.d.ts';\nimport type {RemovePrefix} from './remove-prefix.d.ts';\nimport type {_DefaultWordsOptions, Words, WordsOptions} from './words.d.ts';\n\nexport type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {splitOnNumbers: false}>;\n\n/**\nConvert an array of words to delimiter case starting with a delimiter with input capitalization.\n*/\ntype DelimiterCaseFromArray<\n\tWords extends string[],\n\tDelimiter extends string,\n\tOutputString extends string = '',\n> = Words extends [\n\tinfer FirstWord extends string,\n\t...infer RemainingWords extends string[],\n]\n\t? DelimiterCaseFromArray<RemainingWords, Delimiter, `${OutputString}${\n\t\tStartsWith<FirstWord, AsciiPunctuation> extends true ? '' : Delimiter\n\t}${FirstWord}`>\n\t: OutputString;\n\n/**\nConvert a string literal to a custom string delimiter casing.\n\nThis can be useful when, for example, converting a camel-cased object property to an oddly cased one.\n\n@see {@link KebabCase}\n@see {@link SnakeCase}\n\n@example\n```\nimport type {DelimiterCase} from 'type-fest';\n\n// Simple\n\nconst someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar';\nconst someVariableNoSplitOnNumbers: DelimiterCase<'p2pNetwork', '#', {splitOnNumbers: false}> = 'p2p#network';\n\n// Advanced\n\ntype OddlyCasedProperties<T> = {\n\t[K in keyof T as DelimiterCase<K, '#'>]: T[K]\n};\n\ntype SomeOptions = {\n\tdryRun: boolean;\n\tincludeFile: string;\n\tfoo: number;\n};\n\nconst rawCliOptions: OddlyCasedProperties<SomeOptions> = {\n\t'dry#run': true,\n\t'include#file': 'bar.js',\n\tfoo: 123,\n};\n```\n\n@category Change case\n@category Template literal\n */\nexport type DelimiterCase<\n\tValue,\n\tDelimiter extends string,\n\tOptions extends WordsOptions = {},\n> = Value extends string\n\t? IsStringLiteral<Value> extends false\n\t\t? Value\n\t\t: Lowercase<RemovePrefix<DelimiterCaseFromArray<\n\t\t\tWords<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>,\n\t\t\tDelimiter\n\t\t>, string, {strict: false}>>\n\t: Value;\n\nexport {};\n"
  },
  {
    "path": "source/delimiter-cased-properties-deep.d.ts",
    "content": "import type {_DefaultDelimiterCaseOptions, DelimiterCase} from './delimiter-case.d.ts';\nimport type {ApplyDefaultOptions, NonRecursiveType} from './internal/index.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\nimport type {WordsOptions} from './words.d.ts';\n\n/**\nConvert object properties to delimiter case recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link DelimiterCase}\n@see {@link DelimiterCasedProperties}\n\n@example\n```\nimport type {DelimiterCasedPropertiesDeep} from 'type-fest';\n\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\n\ntype UserWithFriends = {\n\tuserInfo: User;\n\tuserFriends: User[];\n};\n\nconst result: DelimiterCasedPropertiesDeep<UserWithFriends, '-'> = {\n\t'user-info': {\n\t\t'user-id': 1,\n\t\t'user-name': 'Tom',\n\t},\n\t'user-friends': [\n\t\t{\n\t\t\t'user-id': 2,\n\t\t\t'user-name': 'Jerry',\n\t\t},\n\t\t{\n\t\t\t'user-id': 3,\n\t\t\t'user-name': 'Spike',\n\t\t},\n\t],\n};\n\nconst splitOnNumbers: DelimiterCasedPropertiesDeep<{line1: {line2: [{line3: string}]}}, '-', {splitOnNumbers: true}> = {\n\t'line-1': {\n\t\t'line-2': [\n\t\t\t{\n\t\t\t\t'line-3': 'string',\n\t\t\t},\n\t\t],\n\t},\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type DelimiterCasedPropertiesDeep<\n\tValue,\n\tDelimiter extends string,\n\tOptions extends WordsOptions = {},\n> = _DelimiterCasedPropertiesDeep<Value, Delimiter, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;\n\ntype _DelimiterCasedPropertiesDeep<\n\tValue,\n\tDelimiter extends string,\n\tOptions extends Required<WordsOptions>,\n> = Value extends NonRecursiveType\n\t? Value\n\t: Value extends UnknownArray\n\t\t? DelimiterCasedPropertiesArrayDeep<Value, Delimiter, Options>\n\t\t: Value extends Set<infer U>\n\t\t\t? Set<_DelimiterCasedPropertiesDeep<U, Delimiter, Options>>\n\t\t\t: Value extends object\n\t\t\t\t? {\n\t\t\t\t\t[K in keyof Value as DelimiterCase<K, Delimiter, Options>]:\n\t\t\t\t\t_DelimiterCasedPropertiesDeep<Value[K], Delimiter, Options>\n\t\t\t\t}\n\t\t\t\t: Value;\n\n// This is a copy of CamelCasedPropertiesArrayDeep (see: camel-cased-properties-deep.d.ts).\n// These types should be kept in sync.\ntype DelimiterCasedPropertiesArrayDeep<\n\tValue extends UnknownArray,\n\tDelimiter extends string,\n\tOptions extends Required<WordsOptions>,\n> = Value extends []\n\t? []\n\t// Trailing spread array\n\t:\tValue extends [infer U, ...infer V]\n\t\t? [_DelimiterCasedPropertiesDeep<U, Delimiter, Options>, ..._DelimiterCasedPropertiesDeep<V, Delimiter, Options>]\n\t\t: Value extends readonly [infer U, ...infer V]\n\t\t\t? readonly [_DelimiterCasedPropertiesDeep<U, Delimiter, Options>, ..._DelimiterCasedPropertiesDeep<V, Delimiter, Options>]\n\t\t\t// Leading spread array\n\t\t\t: Value extends [...infer U, infer V]\n\t\t\t\t? [..._DelimiterCasedPropertiesDeep<U, Delimiter, Options>, _DelimiterCasedPropertiesDeep<V, Delimiter, Options>]\n\t\t\t\t: Value extends readonly [...infer U, infer V]\n\t\t\t\t\t? readonly [..._DelimiterCasedPropertiesDeep<U, Delimiter, Options>, _DelimiterCasedPropertiesDeep<V, Delimiter, Options>]\n\t\t\t\t\t// Array\n\t\t\t\t\t: Value extends Array<infer U>\n\t\t\t\t\t\t? Array<_DelimiterCasedPropertiesDeep<U, Delimiter, Options>>\n\t\t\t\t\t\t: Value extends ReadonlyArray<infer U>\n\t\t\t\t\t\t\t? ReadonlyArray<_DelimiterCasedPropertiesDeep<U, Delimiter, Options>>\n\t\t\t\t\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/delimiter-cased-properties.d.ts",
    "content": "import type {_DefaultDelimiterCaseOptions, DelimiterCase} from './delimiter-case.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {WordsOptions} from './words.d.ts';\n\n/**\nConvert object properties to delimiter case but not recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link DelimiterCase}\n@see {@link DelimiterCasedPropertiesDeep}\n\n@example\n```\nimport type {DelimiterCasedProperties} from 'type-fest';\n\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\n\nconst result: DelimiterCasedProperties<User, '-'> = {\n\t'user-id': 1,\n\t'user-name': 'Tom',\n};\n\nconst splitOnNumbers: DelimiterCasedProperties<{line1: string}, '-', {splitOnNumbers: true}> = {\n\t'line-1': 'string',\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type DelimiterCasedProperties<\n\tValue,\n\tDelimiter extends string,\n\tOptions extends WordsOptions = {},\n> = Value extends Function\n\t? Value\n\t: Value extends Array<infer U>\n\t\t? Value\n\t\t: {[K in keyof Value as\n\t\t\tDelimiterCase<K, Delimiter, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>\n\t\t\t]: Value[K]};\n\nexport {};\n"
  },
  {
    "path": "source/distributed-omit.d.ts",
    "content": "import type {KeysOfUnion} from './keys-of-union.d.ts';\n\n/**\nOmits keys from a type, distributing the operation over a union.\n\nTypeScript's `Omit` doesn't distribute over unions, leading to the erasure of unique properties from union members when omitting keys. This creates a type that only retains properties common to all union members, making it impossible to access member-specific properties after the Omit. Essentially, using `Omit` on a union type merges the types into a less specific one, hindering type narrowing and property access based on discriminants. This type solves that.\n\nExample:\n\n```\ntype A = {\n\tdiscriminant: 'A';\n\tfoo: string;\n\ta: number;\n};\n\ntype B = {\n\tdiscriminant: 'B';\n\tfoo: string;\n\tb: string;\n};\n\ntype Union = A | B;\n\ntype OmittedUnion = Omit<Union, 'foo'>;\n//=> {discriminant: 'A' | 'B'}\n\ndeclare const omittedUnion: OmittedUnion;\n\nif (omittedUnion.discriminant === 'A') {\n\t// We would like to narrow `omittedUnion`'s type\n\t// to `A` here, but we can't because `Omit`\n\t// doesn't distribute over unions.\n\n\t// @ts-expect-error\n\tconst aValue = omittedUnion.a;\n\t// Error: `a` is not a property of `{discriminant: 'A' | 'B'}`\n}\n```\n\nWhile `Except` solves this problem, it restricts the keys you can omit to the ones that are present in **ALL** union members, where `DistributedOmit` allows you to omit keys that are present in **ANY** union member.\n\n@example\n```\nimport type {DistributedOmit} from 'type-fest';\n\ntype A = {\n\tdiscriminant: 'A';\n\tfoo: string;\n\ta: number;\n};\n\ntype B = {\n\tdiscriminant: 'B';\n\tfoo: string;\n\tbar: string;\n\tb: string;\n};\n\ntype C = {\n\tdiscriminant: 'C';\n\tbar: string;\n\tc: boolean;\n};\n\n// Notice that `foo` exists in `A` and `B`, but not in `C`, and\n// `bar` exists in `B` and `C`, but not in `A`.\n\ntype Union = A | B | C;\n\ntype OmittedUnion = DistributedOmit<Union, 'foo' | 'bar'>;\n\ndeclare const omittedUnion: OmittedUnion;\n\nif (omittedUnion.discriminant === 'A') {\n\tconst aValue = omittedUnion.a;\n\t// OK\n\n\t// @ts-expect-error\n\tconst fooValue = omittedUnion.foo;\n\t// Error: `foo` is not a property of `{discriminant: 'A'; a: string}`\n\n\t// @ts-expect-error\n\tconst barValue = omittedUnion.bar;\n\t// Error: `bar` is not a property of `{discriminant: 'A'; a: string}`\n}\n```\n\n@category Object\n*/\nexport type DistributedOmit<ObjectType, KeyType extends KeysOfUnion<ObjectType>> =\n\tObjectType extends unknown\n\t\t? Omit<ObjectType, KeyType>\n\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/distributed-pick.d.ts",
    "content": "import type {KeysOfUnion} from './keys-of-union.d.ts';\n\n/**\nPick keys from a type, distributing the operation over a union.\n\nTypeScript's `Pick` doesn't distribute over unions, leading to the erasure of unique properties from union members when picking keys. This creates a type that only retains properties common to all union members, making it impossible to access member-specific properties after the Pick. Essentially, using `Pick` on a union type merges the types into a less specific one, hindering type narrowing and property access based on discriminants. This type solves that.\n\nExample:\n\n```\ntype A = {\n\tdiscriminant: 'A';\n\tfoo: {\n\t\tbar: string;\n\t};\n};\n\ntype B = {\n\tdiscriminant: 'B';\n\tfoo: {\n\t\tbaz: string;\n\t};\n};\n\ntype Union = A | B;\n\ntype PickedUnion = Pick<Union, 'discriminant' | 'foo'>;\n//=> {discriminant: 'A' | 'B'; foo: {bar: string} | {baz: string}}\n\ndeclare const pickedUnion: PickedUnion;\n\nif (pickedUnion.discriminant === 'A') {\n\t// We would like to narrow `pickedUnion`'s type\n\t// to `A` here, but we can't because `Pick`\n\t// doesn't distribute over unions.\n\n\t// @ts-expect-error\n\tconst barValue = pickedUnion.foo.bar;\n\t// Error: Property 'bar' does not exist on type '{bar: string} | {baz: string}'.\n}\n```\n\n@example\n```\nimport type {DistributedPick} from 'type-fest';\n\ntype A = {\n\tdiscriminant: 'A';\n\tfoo: {\n\t\tbar: string;\n\t};\n\textraneous: boolean;\n};\n\ntype B = {\n\tdiscriminant: 'B';\n\tfoo: {\n\t\tbaz: string;\n\t};\n\textraneous: boolean;\n};\n\n// Notice that `foo.bar` exists in `A` but not in `B`.\n\ntype Union = A | B;\n\ntype PickedUnion = DistributedPick<Union, 'discriminant' | 'foo'>;\n\ndeclare const pickedUnion: PickedUnion;\n\nif (pickedUnion.discriminant === 'A') {\n\tconst barValue = pickedUnion.foo.bar;\n\t// OK\n\n\t// @ts-expect-error\n\tconst extraneousValue = pickedUnion.extraneous;\n\t// Error: Property `extraneous` does not exist on type `Pick<A, 'discriminant' | 'foo'>`.\n\n\t// @ts-expect-error\n\tconst bazValue = pickedUnion.foo.baz;\n\t// Error: `bar` is not a property of `{discriminant: 'A'; a: string}`.\n}\n```\n\n@category Object\n*/\nexport type DistributedPick<ObjectType, KeyType extends KeysOfUnion<ObjectType>> =\n\tObjectType extends unknown\n\t\t? Pick<ObjectType, Extract<KeyType, keyof ObjectType>>\n\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/empty-object.d.ts",
    "content": "declare const emptyObjectSymbol: unique symbol;\n\n/**\nRepresents a strictly empty plain object, the `{}` value.\n\nWhen you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).\n\n@example\n```\nimport type {EmptyObject} from 'type-fest';\n\n// The following illustrates the problem with `{}`.\nconst foo1: {} = {}; // Pass\nconst foo2: {} = []; // Pass\nconst foo3: {} = 42; // Pass\nconst foo4: {} = {a: 1}; // Pass\n\n// With `EmptyObject` only the first case is valid.\nconst bar1: EmptyObject = {}; // Pass\n// @ts-expect-error\nconst bar2: EmptyObject = []; // Fail\n// @ts-expect-error\nconst bar3: EmptyObject = 42; // Fail\n// @ts-expect-error\nconst bar4: EmptyObject = {a: 1}; // Fail\n```\n\nUnfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.\n\n@category Object\n*/\nexport type EmptyObject = {[emptyObjectSymbol]?: never};\n\n/**\nReturns a `boolean` for whether the type is strictly equal to an empty plain object, the `{}` value.\n\n@example\n```\nimport type {IsEmptyObject} from 'type-fest';\n\ntype Pass = IsEmptyObject<{}>; //=> true\ntype Fail1 = IsEmptyObject<[]>; //=> false\ntype Fail2 = IsEmptyObject<null>; //=> false\n```\n\n@see {@link EmptyObject}\n@category Object\n*/\nexport type IsEmptyObject<T> = T extends EmptyObject ? true : false;\n\nexport {};\n"
  },
  {
    "path": "source/entries.d.ts",
    "content": "import type {_ArrayEntry, _MapEntry, _ObjectEntry, _SetEntry} from './entry.d.ts';\n\ntype ArrayEntries<BaseType extends readonly unknown[]> = Array<_ArrayEntry<BaseType>>;\ntype MapEntries<BaseType> = Array<_MapEntry<BaseType>>;\ntype ObjectEntries<BaseType> = Array<_ObjectEntry<BaseType>>;\ntype SetEntries<BaseType extends Set<unknown>> = Array<_SetEntry<BaseType>>;\n\n/**\nMany collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entries` type will return the type of that collection's entries.\n\nFor example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable.\n\n@see `Entry` if you want to just access the type of a single entry.\n\n@example\n```\nimport type {Entries} from 'type-fest';\n\ntype Example = {\n\tsomeKey: number;\n};\n\nconst manipulatesEntries = (examples: Entries<Example>) => examples.map(example => [\n\t// Does some arbitrary processing on the key (with type information available)\n\texample[0].toUpperCase(),\n\n\t// Does some arbitrary processing on the value (with type information available)\n\texample[1].toFixed(0),\n]);\n\nconst example: Example = {someKey: 1};\nconst entries = Object.entries(example) as Entries<Example>;\nconst output = manipulatesEntries(entries);\n\n// Objects\nconst objectExample = {a: 1};\nconst objectEntries: Entries<typeof objectExample> = [['a', 1]];\n\n// Arrays\nconst arrayExample = ['a', 1];\nconst arrayEntries: Entries<typeof arrayExample> = [[0, 'a'], [1, 1]];\n\n// Maps\nconst mapExample = new Map([['a', 1]]);\nconst mapEntries: Entries<typeof mapExample> = [['a', 1]];\n\n// Sets\nconst setExample = new Set(['a', 1]);\nconst setEntries: Entries<typeof setExample> = [['a', 'a'], [1, 1]];\n```\n\n@category Object\n@category Map\n@category Set\n@category Array\n*/\nexport type Entries<BaseType> =\n\tBaseType extends Map<unknown, unknown> ? MapEntries<BaseType>\n\t\t: BaseType extends Set<unknown> ? SetEntries<BaseType>\n\t\t\t: BaseType extends readonly unknown[] ? ArrayEntries<BaseType>\n\t\t\t\t: BaseType extends object ? ObjectEntries<BaseType>\n\t\t\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/entry.d.ts",
    "content": "type MapKey<BaseType> = BaseType extends Map<infer KeyType, unknown> ? KeyType : never;\ntype MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;\n\nexport type _ArrayEntry<BaseType extends readonly unknown[]> = [number, BaseType[number]];\nexport type _MapEntry<BaseType> = [MapKey<BaseType>, MapValue<BaseType>];\nexport type _ObjectEntry<BaseType> = [keyof BaseType, BaseType[keyof BaseType]];\nexport type _SetEntry<BaseType> = BaseType extends Set<infer ItemType> ? [ItemType, ItemType] : never;\n\n/**\nMany collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entry` type will return the type of that collection's entry.\n\nFor example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable.\n\n@see `Entries` if you want to just access the type of the array of entries (which is the return of the `.entries()` method).\n\n@example\n```\nimport type {Entry} from 'type-fest';\n\ntype Example = {\n\tsomeKey: number;\n};\n\nconst manipulatesEntry = (example: Entry<Example>) => [\n\t// Does some arbitrary processing on the key (with type information available)\n\texample[0].toUpperCase(),\n\n\t// Does some arbitrary processing on the value (with type information available)\n\texample[1].toFixed(0),\n];\n\nconst example: Example = {someKey: 1};\nconst entry = Object.entries(example)[0] as Entry<Example>;\nconst output = manipulatesEntry(entry);\n\n// Objects\nconst objectExample = {a: 1};\nconst objectEntry: Entry<typeof objectExample> = ['a', 1];\n\n// Arrays\nconst arrayExample = ['a', 1];\nconst arrayEntryString: Entry<typeof arrayExample> = [0, 'a'];\nconst arrayEntryNumber: Entry<typeof arrayExample> = [1, 1];\n\n// Maps\nconst mapExample = new Map([['a', 1]]);\nconst mapEntry: Entry<typeof mapExample> = ['a', 1];\n\n// Sets\nconst setExample = new Set(['a', 1]);\nconst setEntryString: Entry<typeof setExample> = ['a', 'a'];\nconst setEntryNumber: Entry<typeof setExample> = [1, 1];\n```\n\n@category Object\n@category Map\n@category Array\n@category Set\n*/\nexport type Entry<BaseType> =\n\tBaseType extends Map<unknown, unknown> ? _MapEntry<BaseType>\n\t\t: BaseType extends Set<unknown> ? _SetEntry<BaseType>\n\t\t\t: BaseType extends readonly unknown[] ? _ArrayEntry<BaseType>\n\t\t\t\t: BaseType extends object ? _ObjectEntry<BaseType>\n\t\t\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/exact.d.ts",
    "content": "import type {ObjectValue} from './internal/index.d.ts';\nimport type {ArrayElement} from './array-element.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\nimport type {KeysOfUnion} from './keys-of-union.d.ts';\nimport type {IsUnknown} from './is-unknown.d.ts';\nimport type {Primitive} from './primitive.d.ts';\n\n/**\nCreate a type from `ParameterType` and `InputType` and change keys exclusive to `InputType` to `never`.\n- Generate a list of keys that exists in `InputType` but not in `ParameterType`.\n- Mark these excess keys as `never`.\n*/\ntype ExactObject<ParameterType, InputType> = {[Key in keyof ParameterType]: Exact<ParameterType[Key], ObjectValue<InputType, Key>>}\n\t& Record<Exclude<keyof InputType, KeysOfUnion<ParameterType>>, never>;\n\n/**\nCreate a type that does not allow extra properties, meaning it only allows properties that are explicitly declared.\n\nThis is useful for function type-guarding to reject arguments with excess properties. Due to the nature of TypeScript, it does not complain if excess properties are provided unless the provided value is an object literal.\n\n*Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/12936) if you want to have this type as a built-in in TypeScript.*\n\n@example\n```\ntype OnlyAcceptName = {name: string};\n\ndeclare function onlyAcceptName(arguments_: OnlyAcceptName): void;\n\n// TypeScript complains about excess properties when an object literal is provided.\n// @ts-expect-error\nonlyAcceptName({name: 'name', id: 1});\n// `id` is excess\n\n// TypeScript does not complain about excess properties when the provided value is a variable (not an object literal).\nconst invalidInput = {name: 'name', id: 1};\nonlyAcceptName(invalidInput); // No errors\n```\n\nHaving `Exact` allows TypeScript to reject excess properties.\n\n@example\n```\nimport type {Exact} from 'type-fest';\n\ntype OnlyAcceptName = {name: string};\n\ndeclare function onlyAcceptNameImproved<T extends Exact<OnlyAcceptName, T>>(arguments_: T): void;\n\nconst invalidInput = {name: 'name', id: 1};\n// @ts-expect-error\nonlyAcceptNameImproved(invalidInput); // Compilation error\n```\n\n[Read more](https://stackoverflow.com/questions/49580725/is-it-possible-to-restrict-typescript-object-to-contain-only-properties-defined)\n\n@category Utilities\n*/\nexport type Exact<ParameterType, InputType> =\n\t// Before distributing, check if the two types are equal and if so, return the parameter type immediately\n\tIsEqual<ParameterType, InputType> extends true ? ParameterType\n\t\t// If the parameter is a primitive, return it as is immediately to avoid it being converted to a complex type\n\t\t: ParameterType extends Primitive ? ParameterType\n\t\t\t// If the parameter is an unknown, return it as is immediately to avoid it being converted to a complex type\n\t\t\t: IsUnknown<ParameterType> extends true ? unknown\n\t\t\t\t// If the parameter is a Function, return it as is because this type is not capable of handling function, leave it to TypeScript\n\t\t\t\t: ParameterType extends Function ? ParameterType\n\t\t\t\t\t// Convert union of array to array of union: A[] & B[] => (A & B)[]\n\t\t\t\t\t: ParameterType extends unknown[] ? Array<Exact<ArrayElement<ParameterType>, ArrayElement<InputType>>>\n\t\t\t\t\t\t// In TypeScript, Array is a subtype of ReadonlyArray, so always test Array before ReadonlyArray.\n\t\t\t\t\t\t: ParameterType extends readonly unknown[] ? ReadonlyArray<Exact<ArrayElement<ParameterType>, ArrayElement<InputType>>>\n\t\t\t\t\t\t\t: ExactObject<ParameterType, InputType>;\n\nexport {};\n"
  },
  {
    "path": "source/except.d.ts",
    "content": "import type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\n\n/**\nFilter out keys from an object.\n\nReturns `never` if `Exclude` is strictly equal to `Key`.\nReturns `never` if `Key` extends `Exclude`.\nReturns `Key` otherwise.\n\n@example\n```\ntype Filtered = Filter<'foo', 'foo'>;\n//=> never\n```\n\n@example\n```\ntype Filtered = Filter<'bar', string>;\n//=> never\n```\n\n@example\n```\ntype Filtered = Filter<'bar', 'foo'>;\n//=> 'bar'\n```\n\n@see {Except}\n*/\ntype Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);\n\nexport type ExceptOptions = {\n\t/**\n\tDisallow assigning non-specified properties.\n\n\tNote that any omitted properties in the resulting type will be present in autocomplete as `undefined`.\n\n\t@default false\n\t*/\n\trequireExactProps?: boolean;\n};\n\ntype DefaultExceptOptions = {\n\trequireExactProps: false;\n};\n\n/**\nCreate a type from an object type without certain keys.\n\nWe recommend setting the `requireExactProps` option to `true`.\n\nThis type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.\n\nThis type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).\n\n@example\n```\nimport type {Except} from 'type-fest';\n\ntype Foo = {\n\ta: number;\n\tb: string;\n};\n\ntype FooWithoutA = Except<Foo, 'a'>;\n//=> {b: string}\n\n// @ts-expect-error\nconst fooWithoutA: FooWithoutA = {a: 1, b: '2'};\n// errors: 'a' does not exist in type '{ b: string; }'\n\ntype FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;\n//=> {a: number} & Partial<Record<'b', never>>\n\n// @ts-expect-error\nconst fooWithoutB: FooWithoutB = {a: 1, b: '2'};\n// errors at 'b': Type 'string' is not assignable to type 'undefined'.\n\n// The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.\n\n// Consider the following example:\n\ntype UserData = {\n\t[metadata: string]: string;\n\temail: string;\n\tname: string;\n\trole: 'admin' | 'user';\n};\n\n// `Omit` clearly doesn't behave as expected in this case:\ntype PostPayload = Omit<UserData, 'email'>;\n//=> {[x: string]: string; [x: number]: string}\n\n// In situations like this, `Except` works better.\n// It simply removes the `email` key while preserving all the other keys.\ntype PostPayloadFixed = Except<UserData, 'email'>;\n//=> {[x: string]: string; name: string; role: 'admin' | 'user'}\n```\n\n@category Object\n*/\nexport type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> =\n\t_Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;\n\ntype _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = {\n\t[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];\n} & (Options['requireExactProps'] extends true\n\t? Partial<Record<KeysType, never>>\n\t: {});\n\nexport {};\n"
  },
  {
    "path": "source/exclude-exactly.d.ts",
    "content": "import type {IsNever} from './is-never.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {If} from './if.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\nimport type {IfNotAnyOrNever} from './internal/type.d.ts';\n\n/**\nA stricter version of `Exclude<T, U>` that excludes types only when they are exactly identical.\n\n@example\n```\nimport type {ExcludeExactly} from 'type-fest';\n\ntype TestExclude1 = Exclude<'a' | 'b' | 'c' | 1 | 2 | 3, string>;\n//=> 1 | 2 | 3\n\ntype TestExcludeExactly1 = ExcludeExactly<'a' | 'b' | 'c' | 1 | 2 | 3, string>;\n//=> 'a' | 'b' | 'c' | 1 | 2 | 3\n\ntype TestExclude2 = Exclude<'a' | 'b' | 'c' | 1 | 2 | 3, any>;\n//=> never\n\ntype TestExcludeExactly2 = ExcludeExactly<'a' | 'b' | 'c' | 1 | 2 | 3, any>;\n//=> 'a' | 'b' | 'c' | 1 | 2 | 3\n\ntype TestExclude3 = Exclude<{a: string} | {a: string; b: string}, {a: string}>;\n//=> never\n\ntype TestExcludeExactly3 = ExcludeExactly<{a: string} | {a: string; b: string}, {a: string}>;\n//=> {a: string; b: string}\n```\n\n@category Improved Built-in\n*/\nexport type ExcludeExactly<Union, Delete> =\n\tIfNotAnyOrNever<\n\t\tUnion,\n\t\t_ExcludeExactly<Union, Delete>,\n\t\t// If `Union` is `any`, then if `Delete` is `any`, return `never`, else return `Union`.\n\t\tIf<IsAny<Delete>, never, Union>,\n\t\t// If `Union` is `never`, then if `Delete` is `never`, return `never`, else return `Union`.\n\t\tIf<IsNever<Delete>, never, Union>\n\t>;\n\ntype _ExcludeExactly<Union, Delete> =\n\tIfNotAnyOrNever<Delete,\n\t\tUnion extends unknown // For distributing `Union`\n\t\t\t? [Delete extends unknown // For distributing `Delete`\n\t\t\t\t? If<IsEqual<Union, Delete>, true, never>\n\t\t\t\t: never] extends [never] ? Union : never\n\t\t\t: never,\n\t\t// If `Delete` is `any` or `never`, then return `Union`,\n\t\t// because `Union` cannot be `any` or `never` here.\n\t\tUnion, Union\n\t>;\n\nexport {};\n"
  },
  {
    "path": "source/exclude-rest-element.d.ts",
    "content": "import type {SplitOnRestElement} from './split-on-rest-element.d.ts';\nimport type {IsArrayReadonly} from './internal/array.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\nimport type {IfNotAnyOrNever} from './internal/type.d.ts';\n\n/**\nCreate a tuple with the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element removed.\n\n@example\n```\nimport type {ExcludeRestElement} from 'type-fest';\n\ntype T1 = ExcludeRestElement<[number, ...string[], string, 'foo']>;\n//=> [number, string, 'foo']\n\ntype T2 = ExcludeRestElement<[...boolean[], string]>;\n//=> [string]\n\ntype T3 = ExcludeRestElement<[...Array<'foo'>, true]>;\n//=> [true]\n\ntype T4 = ExcludeRestElement<[number, string]>;\n//=> [number, string]\n```\n\n@see {@link ExtractRestElement}\n@see {@link SplitOnRestElement}\n@category Array\n*/\nexport type ExcludeRestElement<Array_ extends UnknownArray> = IfNotAnyOrNever<Array_,\n\tSplitOnRestElement<Array_> extends infer Result\n\t\t? Result extends readonly UnknownArray[]\n\t\t\t? IsArrayReadonly<Array_> extends true\n\t\t\t\t? Readonly<[...Result[0], ...Result[2]]>\n\t\t\t\t: [...Result[0], ...Result[2]]\n\t\t\t: never\n\t\t: never\n>;\n\nexport {};\n"
  },
  {
    "path": "source/exclude-strict.d.ts",
    "content": "/**\nA stricter version of {@link Exclude<T, U>} that ensures every member of `U` can successfully exclude something from `T`.\n\nFor example, `ExcludeStrict<string | number | boolean, number | bigint>` will error because `bigint` cannot exclude anything from `string | number | boolean`.\n\n@example\n```\n// Valid Examples\nimport type {ExcludeStrict} from 'type-fest';\n\ntype Example1 = ExcludeStrict<{status: 'success'; data: string[]} | {status: 'error'; error: string}, {status: 'success'}>;\n//=> {status: 'error'; error: string}\n\ntype Example2 = ExcludeStrict<'xs' | 's' | 'm' | 'l' | 'xl', 'xs' | 's'>;\n//=> 'm' | 'l' | 'xl'\n\ntype Example3 = ExcludeStrict<{x: number; y: number} | [number, number], unknown[]>;\n//=> {x: number; y: number}\n```\n\n@example\n```\n// Invalid Examples\nimport type {ExcludeStrict} from 'type-fest';\n\n// `'xxl'` cannot exclude anything from `'xs' | 's' | 'm' | 'l' | 'xl'`\n// @ts-expect-error\ntype Example1 = ExcludeStrict<'xs' | 's' | 'm' | 'l' | 'xl', 'xl' | 'xxl'>;\n//                                                           ~~~~~~~~~~~~\n// Error: Type \"'xl' | 'xxl'\" does not satisfy the constraint 'never'.\n\n// `unknown[]` cannot exclude anything from `{x: number; y: number} | {x: string; y: string}`\n// @ts-expect-error\ntype Example2 = ExcludeStrict<{x: number; y: number} | {x: string; y: string}, unknown[]>;\n//                                                                             ~~~~~~~~~\n// Error: Type 'unknown[]' does not satisfy the constraint 'never'.\n```\n\n@category Improved Built-in\n*/\nexport type ExcludeStrict<\n\tT,\n\tU extends [U] extends [\n\t\t// Ensure every member of `U` excludes something from `T`\n\t\tU extends unknown ? ([T] extends [Exclude<T, U>] ? never : U) : never,\n\t]\n\t\t? unknown\n\t\t: never,\n> = Exclude<T, U>;\n\nexport {};\n"
  },
  {
    "path": "source/exclusify-union.d.ts",
    "content": "import type {If} from './if.d.ts';\nimport type {IfNotAnyOrNever, MapsSetsOrArrays, NonRecursiveType} from './internal/type.d.ts';\nimport type {IsUnknown} from './is-unknown.d.ts';\nimport type {KeysOfUnion} from './keys-of-union.d.ts';\nimport type {Simplify} from './simplify.d.ts';\n\n/**\nEnsure mutual exclusivity in object unions by adding other members’ keys as `?: never`.\n\nUse-cases:\n- You want each union member to be exclusive, preventing overlapping object shapes.\n- You want to safely access any property defined across the union without additional type guards.\n\n@example\n```\nimport type {ExclusifyUnion} from 'type-fest';\n\ntype FileConfig = {\n\tfilePath: string;\n};\n\ntype InlineConfig = {\n\tcontent: string;\n};\n\ndeclare function loadConfig1(options: FileConfig | InlineConfig): void;\n\n// Someone could mistakenly provide both `filePath` and `content`.\nloadConfig1({filePath: './config.json', content: '{ \"name\": \"app\" }'}); // No errors\n\n// Use `ExclusifyUnion` to prevent that mistake.\ntype Config = ExclusifyUnion<FileConfig | InlineConfig>;\n//=> {\n// \tfilePath: string;\n// \tcontent?: never;\n// } | {\n// \tcontent: string;\n// \tfilePath?: never;\n// }\n\ndeclare function loadConfig2(options: Config): void;\n\n// @ts-expect-error\nloadConfig2({filePath: './config.json', content: '{ \"name\": \"app\" }'});\n// Error: Argument of type '{ filePath: string; content: string; }' is not assignable to parameter of type '{ filePath: string; content?: never; } | { content: string; filePath?: never; }'.\n\nloadConfig2({filePath: './config.json'}); // Ok\n\nloadConfig2({content: '{ \"name\": \"app\" }'}); // Ok\n```\n\n@example\n```\nimport type {ExclusifyUnion} from 'type-fest';\n\ntype CardPayment = {\n\tamount: number;\n\tcardNumber: string;\n};\n\ntype PaypalPayment = {\n\tamount: number;\n\tpaypalId: string;\n};\n\nfunction processPayment1(payment: CardPayment | PaypalPayment) {\n\t// @ts-expect-error\n\tconst details = payment.cardNumber ?? payment.paypalId; // Cannot access `cardNumber` or `paypalId` directly\n}\n\ntype Payment = ExclusifyUnion<CardPayment | PaypalPayment>;\n//=> {\n// \tamount: number;\n// \tcardNumber: string;\n// \tpaypalId?: never;\n// } | {\n// \tamount: number;\n// \tpaypalId: string;\n// \tcardNumber?: never;\n// }\n\nfunction processPayment2(payment: Payment) {\n\tconst details = payment.cardNumber ?? payment.paypalId; // Ok\n\t//=> string\n}\n```\n\n@example\n```\nimport type {ExclusifyUnion} from 'type-fest';\n\ntype A = ExclusifyUnion<{a: string} | {b: number}>;\n//=> {a: string; b?: never} | {b: number; a?: never}\n\ntype B = ExclusifyUnion<{a: string} | {b: number} | {c: boolean}>;\n//=> {\n// \ta: string;\n// \tb?: never;\n// \tc?: never;\n// } | {\n// \tb: number;\n// \ta?: never;\n// \tc?: never;\n// } | {\n// \tc: boolean;\n// \ta?: never;\n// \tb?: never;\n// }\n\ntype C = ExclusifyUnion<{a: string; b: number} | {b: string; c: number}>;\n//=> {\n// \ta: string;\n// \tb: number;\n// \tc?: never;\n// } | {\n// \tb: string;\n// \tc: number;\n// \ta?: never;\n// }\n\ntype D = ExclusifyUnion<{a?: 1; readonly b: 2} | {d: 4}>;\n//=> {a?: 1; readonly b: 2; d?: never} | {d: 4; a?: never; b?: never}\n```\n\n@category Object\n@category Union\n*/\nexport type ExclusifyUnion<Union> = IfNotAnyOrNever<Union,\n\tIf<IsUnknown<Union>, Union,\n\t\tExtract<Union, NonRecursiveType | MapsSetsOrArrays> extends infer SkippedMembers\n\t\t\t? SkippedMembers | _ExclusifyUnion<Exclude<Union, SkippedMembers>>\n\t\t\t: never\n\t>\n>;\n\ntype _ExclusifyUnion<Union, UnionCopy = Union> = Union extends unknown // For distributing `Union`\n\t? Simplify<\n\t\tUnion & Partial<\n\t\t\tRecord<\n\t\t\t\tExclude<KeysOfUnion<UnionCopy>, keyof Union>,\n\t\t\t\tnever\n\t\t\t>\n\t\t>\n\t>\n\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/extends-strict.d.ts",
    "content": "import type {IsNever} from './is-never.d.ts';\nimport type {IsAny} from './is-any.d.ts';\n\n/**\nA stricter, non-distributive version of `extends` for checking whether one type is assignable to another.\n\nUnlike the built-in `extends` keyword, `ExtendsStrict`:\n\n1. Prevents distribution over union types by wrapping both types in tuples. For example, `ExtendsStrict<string | number, number>` returns `false`, whereas `string | number extends number` would result in `boolean`.\n\n2. Treats `never` as a special case: `never` doesn't extend every other type, it only extends itself (or `any`). For example, `ExtendsStrict<never, number>` returns `false` whereas `never extends number` would result in `true`.\n\n@example\n```\nimport type {ExtendsStrict} from 'type-fest';\n\ntype T1 = ExtendsStrict<number | string, string>;\n//=> false\n\ntype T2 = ExtendsStrict<never, number>;\n//=> false\n\ntype T3 = ExtendsStrict<never, never>;\n//=> true\n\ntype T4 = ExtendsStrict<string, number | string>;\n//=> true\n\ntype T5 = ExtendsStrict<string, string>;\n//=> true\n```\n\n@category Improved Built-in\n*/\nexport type ExtendsStrict<Left, Right> =\n\tIsAny<Left | Right> extends true\n\t\t? true\n\t\t: IsNever<Left> extends true\n\t\t\t? IsNever<Right>\n\t\t\t: [Left] extends [Right]\n\t\t\t\t? true\n\t\t\t\t: false;\n\nexport {};\n"
  },
  {
    "path": "source/extract-rest-element.d.ts",
    "content": "import type {SplitOnRestElement} from './split-on-rest-element.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nExtract the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element type from an array.\n\n@example\n```\nimport type {ExtractRestElement} from 'type-fest';\n\ntype T1 = ExtractRestElement<[number, ...string[], string, 'foo']>;\n//=> string\n\ntype T2 = ExtractRestElement<[...boolean[], string]>;\n//=> boolean\n\ntype T3 = ExtractRestElement<[...Array<'foo'>, true]>;\n//=> 'foo'\n\ntype T4 = ExtractRestElement<[number, string]>;\n//=> never\n```\n\n@see {@link ExcludeRestElement}\n@see {@link SplitOnRestElement}\n@category Array\n*/\nexport type ExtractRestElement<T extends UnknownArray> = SplitOnRestElement<T>[1][number];\n\nexport {};\n"
  },
  {
    "path": "source/extract-strict.d.ts",
    "content": "/**\nA stricter version of {@link Extract<T, U>} that ensures every member of `U` can successfully extract something from `T`.\n\nFor example, `ExtractStrict<string | number | boolean, number | bigint>` will error because `bigint` cannot extract anything from `string | number | boolean`.\n\n@example\n```\n// Valid Examples\nimport type {ExtractStrict} from 'type-fest';\n\ntype Example1 = ExtractStrict<{status: 'success'; data: string[]} | {status: 'error'; error: string}, {status: 'success'}>;\n//=> {status: 'success'; data: string[]}\n\ntype Example2 = ExtractStrict<'xs' | 's' | 'm' | 'l' | 'xl', 'xs' | 's'>;\n//=> 'xs' | 's'\n\ntype Example3 = ExtractStrict<{x: number; y: number} | [number, number], unknown[]>;\n//=> [number, number]\n```\n\n@example\n```\n// Invalid Examples\nimport type {ExtractStrict} from 'type-fest';\n\n// `'xxl'` cannot extract anything from `'xs' | 's' | 'm' | 'l' | 'xl'`\n// @ts-expect-error\ntype Example1 = ExtractStrict<'xs' | 's' | 'm' | 'l' | 'xl', 'xl' | 'xxl'>;\n//                                                           ~~~~~~~~~~~~\n// Error: Type \"'xl' | 'xxl'\" does not satisfy the constraint 'never'.\n\n// `unknown[]` cannot extract anything from `{x: number; y: number} | {x: string; y: string}`\n// @ts-expect-error\ntype Example2 = ExtractStrict<{x: number; y: number} | {x: string; y: string}, unknown[]>;\n//                                                                             ~~~~~~~~~\n// Error: Type 'unknown[]' does not satisfy the constraint 'never'.\n```\n\n@category Improved Built-in\n*/\nexport type ExtractStrict<\n\tT,\n\tU extends [U] extends [\n\t\t// Ensure every member of `U` extracts something from `T`\n\t\tU extends unknown ? (Extract<T, U> extends never ? never : U) : never,\n\t]\n\t\t? unknown\n\t\t: never,\n> = Extract<T, U>;\n\nexport {};\n"
  },
  {
    "path": "source/find-global-type.d.ts",
    "content": "/**\nTries to find the type of a global with the given name.\n\nLimitations: Due to peculiarities with the behavior of `globalThis`, \"globally defined\" only includes `var` declarations in `declare global` blocks, not `let` or `const` declarations.\n\n@example\n```\nimport type {FindGlobalType} from 'type-fest';\n\ndeclare global {\n\tconst foo: number; // let and const don't work\n\tvar bar: string; // var works\n}\n\ntype FooType = FindGlobalType<'foo'>; //=> never (let/const don't work)\ntype BarType = FindGlobalType<'bar'>; //=> string\ntype OtherType = FindGlobalType<'other'>; //=> never (no global named 'other')\n```\n\n@category Utilities\n*/\nexport type FindGlobalType<Name extends string> = typeof globalThis extends Record<Name, infer T> ? T : never;\n\n/**\nTries to find one or more types from their globally-defined constructors.\n\nUse-case: Conditionally referencing DOM types only when the DOM library present.\n\n*Limitations:* Due to peculiarities with the behavior of `globalThis`, \"globally defined\" has a narrow definition in this case. Declaring a class in a `declare global` block won't work, instead you must declare its type using an interface and declare its constructor as a `var` (*not* `let`/`const`) inside the `declare global` block.\n\n@example\n```\nimport type {FindGlobalInstanceType} from 'type-fest';\n\nclass Point {\n\tconstructor(public x: number, public y: number) {}\n}\n\ntype PointLike = Point | FindGlobalInstanceType<'DOMPoint'>;\n```\n\n@example\n```\nimport type {FindGlobalInstanceType} from 'type-fest';\n\ndeclare global {\n\t// Class syntax won't add the key to `globalThis`\n\tclass Foo {}\n\n\t// interface + constructor style works\n\tinterface Bar {\n\t\tbar: string;\n\t}\n\tvar Bar: new () => Bar; // Not let or const\n}\n\ntype FindFoo = FindGlobalInstanceType<'Foo'>; // Doesn't work\ntype FindBar = FindGlobalInstanceType<'Bar'>; // Works\n```\n\n@category Utilities\n*/\nexport type FindGlobalInstanceType<Name extends string> =\n\tName extends string\n\t\t? typeof globalThis extends Record<Name, abstract new (...arguments_: any[]) => infer T> ? T : never\n\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/fixed-length-array.d.ts",
    "content": "import type {Except} from './except.d.ts';\nimport type {TupleOf} from './tuple-of.d.ts';\n\n/**\nMethods to exclude.\n*/\ntype ArrayLengthMutationKeys = 'splice' | 'push' | 'pop' | 'shift' | 'unshift';\n\n/**\nCreate a type that represents an array of the given type and length. The `Array` prototype methods that manipulate its length are excluded from the resulting type.\n\nThe problem with the built-in tuple type is that it allows mutating methods like `push`, `pop` etc, which can cause issues, like in the following example:\n\n@example\n```\nconst color: [number, number, number] = [255, 128, 64];\n\nfunction toHex([r, g, b]: readonly [number, number, number]) {\n\treturn `#${r.toString(16)}${g.toString(16)}${b.toString(16)}`;\n}\n\ncolor.pop(); // Allowed\n\nconsole.log(toHex(color)); // Compiles fine, but fails at runtime since index `2` no longer contains a `number`.\n```\n\n`ArrayLengthMutationKeys` solves this problem by excluding methods like `push`, `pop` etc from the resulting type.\n\n@example\n```\nimport type {FixedLengthArray} from 'type-fest';\n\nconst color: FixedLengthArray<number, 3> = [255, 128, 64];\n\n// @ts-expect-error\ncolor.pop();\n// Error: Property 'pop' does not exist on type 'FixedLengthArray<number, 3>'.\n```\n\nUse-cases:\n- Declaring fixed-length tuples or arrays with a large number of items.\n- Creating an array of coordinates with a static length, for example, length of 3 for a 3D vector.\n\n@example\n```\nimport type {FixedLengthArray} from 'type-fest';\n\nlet color: FixedLengthArray<number, 3> = [255, 128, 64];\n\nconst red = color[0];\n//=> number\nconst green = color[1];\n//=> number\nconst blue = color[2];\n//=> number\n\n// @ts-expect-error\nconst alpha = color[3];\n// Error: Property '3' does not exist on type 'FixedLengthArray<number, 3>'.\n\n// You can write to valid indices.\ncolor[0] = 128;\ncolor[1] = 64;\ncolor[2] = 32;\n\n// But you cannot write to out-of-bounds indices.\n// @ts-expect-error\ncolor[3] = 0.5;\n// Error: Property '3' does not exist on type 'FixedLengthArray<number, 3>'.\n\n// @ts-expect-error\ncolor.push(0.5);\n// Error: Property 'push' does not exist on type 'FixedLengthArray<number, 3>'.\n\n// @ts-expect-error\ncolor = [0, 128, 255, 0.5];\n// Error: Type '[number, number, number, number]' is not assignable to type 'FixedLengthArray<number, 3>'. Types of property 'length' are incompatible.\n\n// @ts-expect-error\ncolor.length = 4;\n// Error: Cannot assign to 'length' because it is a read-only property.\n\nfunction toHex([r, g, b]: readonly [number, number, number]) {\n\treturn `#${r.toString(16)}${g.toString(16)}${b.toString(16)}`;\n}\n\nconsole.log(toHex(color)); // `FixedLengthArray<number, 3>` is assignable to `readonly [number, number, number]`.\n```\n\n@category Array\n*/\nexport type FixedLengthArray<Element, Length extends number> =\n\tExcept<TupleOf<Length, Element>, ArrayLengthMutationKeys | number | 'length'>\n\t& {readonly length: Length}\n\t& (number extends Length ? {[n: number]: Element} : {}); // Add `number` index signature only for non-tuple arrays.\n\nexport {};\n"
  },
  {
    "path": "source/get.d.ts",
    "content": "import type {ApplyDefaultOptions, ToString} from './internal/index.d.ts';\nimport type {_LiteralStringUnion} from './literal-union.d.ts';\nimport type {Paths} from './paths.d.ts';\nimport type {Split} from './split.d.ts';\nimport type {KeyAsString} from './key-as-string.d.ts';\nimport type {DigitCharacter} from './characters.d.ts';\n\nexport type GetOptions = {\n\t/**\n\tInclude `undefined` in the return type when accessing properties.\n\n\tSetting this to `false` is not recommended.\n\n\t@default true\n\t*/\n\tstrict?: boolean;\n};\n\ntype DefaultGetOptions = {\n\tstrict: true;\n};\n\n/**\nLike the `Get` type but receives an array of strings as a path parameter.\n*/\ntype GetWithPath<BaseType, Keys, Options extends Required<GetOptions>> =\n\tKeys extends readonly []\n\t\t? BaseType\n\t\t: Keys extends readonly [infer Head, ...infer Tail]\n\t\t\t? GetWithPath<\n\t\t\t\tPropertyOf<BaseType, Extract<Head, string>, Options>,\n\t\t\t\tExtract<Tail, string[]>,\n\t\t\t\tOptions\n\t\t\t>\n\t\t\t: never;\n\n/**\nAdds `undefined` to `Type` if `strict` is enabled.\n*/\ntype Strictify<Type, Options extends Required<GetOptions>> =\n\tOptions['strict'] extends false ? Type : (Type | undefined);\n\n/**\nIf `Options['strict']` is `true`, includes `undefined` in the returned type when accessing properties on `Record<string, any>`.\n\nKnown limitations:\n- Does not include `undefined` in the type on object types with an index signature (for example, `{a: string; [key: string]: string}`).\n*/\ntype StrictPropertyOf<BaseType, Key extends keyof BaseType, Options extends Required<GetOptions>> =\n\tRecord<string, any> extends BaseType\n\t\t? string extends keyof BaseType\n\t\t\t? Strictify<BaseType[Key], Options> // Record<string, any>\n\t\t\t: BaseType[Key] // Record<'a' | 'b', any> (Records with a string union as keys have required properties)\n\t\t: BaseType[Key];\n\n/**\nSplits a dot-prop style path into a tuple comprised of the properties in the path. Handles square-bracket notation.\n\n@example\n```\ntype A = ToPath<'foo.bar.baz'>;\n//=> ['foo', 'bar', 'baz']\n\ntype B = ToPath<'foo[0].bar.baz'>;\n//=> ['foo', '0', 'bar', 'baz']\n```\n*/\ntype ToPath<S extends string> = Split<FixPathSquareBrackets<S>, '.', {strictLiteralChecks: false}>;\n\n/**\nReplaces square-bracketed dot notation with dots, for example, `foo[0].bar` -> `foo.0.bar`.\n*/\ntype FixPathSquareBrackets<Path extends string> =\n\tPath extends `[${infer Head}]${infer Tail}`\n\t\t? Tail extends `[${string}`\n\t\t\t? `${Head}.${FixPathSquareBrackets<Tail>}`\n\t\t\t: `${Head}${FixPathSquareBrackets<Tail>}`\n\t\t: Path extends `${infer Head}[${infer Middle}]${infer Tail}`\n\t\t\t? `${Head}.${FixPathSquareBrackets<`[${Middle}]${Tail}`>}`\n\t\t\t: Path;\n\n/**\nReturns true if `LongString` is made up out of `Substring` repeated 0 or more times.\n\n@example\n```\ntype A = ConsistsOnlyOf<'aaa', 'a'>; //=> true\ntype B = ConsistsOnlyOf<'ababab', 'ab'>; //=> true\ntype C = ConsistsOnlyOf<'aBa', 'a'>; //=> false\ntype D = ConsistsOnlyOf<'', 'a'>; //=> true\n```\n*/\ntype ConsistsOnlyOf<LongString extends string, Substring extends string> =\n\tLongString extends ''\n\t\t? true\n\t\t: LongString extends `${Substring}${infer Tail}`\n\t\t\t? ConsistsOnlyOf<Tail, Substring>\n\t\t\t: false;\n\n/**\nConvert a type which may have number keys to one with string keys, making it possible to index using strings retrieved from template types.\n\n@example\n```\ntype WithNumbers = {foo: string; 0: boolean};\ntype WithStrings = WithStringKeys<WithNumbers>;\n\ntype WithNumbersKeys = keyof WithNumbers;\n//=> 'foo' | 0\ntype WithStringsKeys = keyof WithStrings;\n//=> 'foo' | '0'\n```\n*/\ntype WithStringKeys<BaseType> = {\n\t[Key in KeyAsString<BaseType>]: UncheckedIndex<BaseType, Key>\n};\n\n/**\nPerform a `T[U]` operation if `T` supports indexing.\n*/\ntype UncheckedIndex<T, U extends string | number> = [T] extends [Record<string | number, any>] ? T[U] : never;\n\n/**\nGet a property of an object or array. Works when indexing arrays using number-literal-strings, for example, `PropertyOf<number[], '0'> = number`, and when indexing objects with number keys.\n\nNote:\n- Returns `unknown` if `Key` is not a property of `BaseType`, since TypeScript uses structural typing, and it cannot be guaranteed that extra properties unknown to the type system will exist at runtime.\n- Returns `undefined` from nullish values, to match the behaviour of most deep-key libraries like `lodash`, `dot-prop`, etc.\n*/\ntype PropertyOf<BaseType, Key extends string, Options extends Required<GetOptions>> =\n\tBaseType extends null | undefined\n\t\t? undefined\n\t\t: Key extends keyof BaseType\n\t\t\t? StrictPropertyOf<BaseType, Key, Options>\n\t\t\t// Handle arrays and tuples\n\t\t\t: BaseType extends readonly unknown[]\n\t\t\t\t? Key extends `${number}`\n\t\t\t\t\t// For arrays with unknown length (regular arrays)\n\t\t\t\t\t? number extends BaseType['length']\n\t\t\t\t\t\t? Strictify<BaseType[number], Options>\n\t\t\t\t\t\t// For tuples: check if the index is valid\n\t\t\t\t\t\t: Key extends keyof BaseType\n\t\t\t\t\t\t\t? Strictify<BaseType[Key & keyof BaseType], Options>\n\t\t\t\t\t\t\t// Out-of-bounds access for tuples\n\t\t\t\t\t\t\t: unknown\n\t\t\t\t\t// Non-numeric string key for arrays/tuples\n\t\t\t\t\t: unknown\n\t\t\t\t// Handle array-like objects\n\t\t\t\t: BaseType extends {\n\t\t\t\t\t[n: number]: infer Item;\n\t\t\t\t\tlength: number; // Note: This is needed to avoid being too lax with records types using number keys like `{0: string; 1: boolean}`.\n\t\t\t\t}\n\t\t\t\t\t? (\n\t\t\t\t\t\tConsistsOnlyOf<Key, DigitCharacter> extends true\n\t\t\t\t\t\t\t? Strictify<Item, Options>\n\t\t\t\t\t\t\t: unknown\n\t\t\t\t\t)\n\t\t\t\t\t: Key extends keyof WithStringKeys<BaseType>\n\t\t\t\t\t\t? StrictPropertyOf<WithStringKeys<BaseType>, Key, Options>\n\t\t\t\t\t\t: unknown;\n\n// This works by first splitting the path based on `.` and `[...]` characters into a tuple of string keys. Then it recursively uses the head key to get the next property of the current object, until there are no keys left. Number keys extract the item type from arrays, or are converted to strings to extract types from tuples and dictionaries with number keys.\n/**\nGet a deeply-nested property from an object using a key path, like Lodash's `.get()` function.\n\nUse-case: Retrieve a property from deep inside an API response or some other complex object.\n\n@example\n```\nimport type {Get} from 'type-fest';\n\ndeclare function get<BaseType, const Path extends string | readonly string[]>(object: BaseType, path: Path): Get<BaseType, Path>;\n\ntype ApiResponse = {\n\thits: {\n\t\thits: Array<{\n\t\t\t_id: string;\n\t\t\t_source: {\n\t\t\t\tname: Array<{\n\t\t\t\t\tgiven: string[];\n\t\t\t\t\tfamily: string;\n\t\t\t\t}>;\n\t\t\t\tbirthDate: string;\n\t\t\t};\n\t\t}>;\n\t};\n};\n\nconst getName = (apiResponse: ApiResponse) => get(apiResponse, 'hits.hits[0]._source.name');\n//=> (apiResponse: ApiResponse) => {\n// \tgiven: string[];\n// \tfamily: string;\n// }[] | undefined\n\n// Path also supports a readonly array of strings\nconst getNameWithPathArray = (apiResponse: ApiResponse) => get(apiResponse, ['hits', 'hits', '0', '_source', 'name']);\n//=> (apiResponse: ApiResponse) => {\n// \tgiven: string[];\n// \tfamily: string;\n// }[] | undefined\n\n// Non-strict mode:\ntype A = Get<string[], '3', {strict: false}>;\n//=> string\n\ntype B = Get<Record<string, string>, 'foo', {strict: true}>;\n//=> string | undefined\n```\n\n@category Object\n@category Array\n@category Template literal\n*/\nexport type Get<\n\tBaseType,\n\tPath extends\n\t| readonly string[]\n\t| _LiteralStringUnion<ToString<Paths<BaseType, {bracketNotation: false; maxRecursionDepth: 2}> | Paths<BaseType, {bracketNotation: true; maxRecursionDepth: 2}>>>,\n\tOptions extends GetOptions = {},\n> =\n\tGetWithPath<\n\t\tBaseType,\n\t\tPath extends string ? ToPath<Path> : Path,\n\t\tApplyDefaultOptions<GetOptions, DefaultGetOptions, Options>\n\t>;\n\nexport {};\n"
  },
  {
    "path": "source/global-this.d.ts",
    "content": "/**\nDeclare locally scoped properties on `globalThis`.\n\nWhen defining a global variable in a declaration file is inappropriate, it can be helpful to define a `type` or `interface` (say `ExtraGlobals`) with the global variable and then cast `globalThis` via code like `globalThis as unknown as ExtraGlobals`.\n\nInstead of casting through `unknown`, you can update your `type` or `interface` to extend `GlobalThis` and then directly cast `globalThis`.\n\n@example\n```\nimport type {GlobalThis} from 'type-fest';\n\ntype ExtraGlobals = GlobalThis & {\n\treadonly GLOBAL_TOKEN: string;\n};\n\nconst globalToken = (globalThis as ExtraGlobals).GLOBAL_TOKEN;\n//=> string\n```\n\n@category Type\n*/\nexport type GlobalThis = typeof globalThis;\n\nexport {};\n"
  },
  {
    "path": "source/globals/index.d.ts",
    "content": "export type * from './observable-like.d.ts';\n\nexport {};\n"
  },
  {
    "path": "source/globals/observable-like.d.ts",
    "content": "declare global {\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.\n\tinterface SymbolConstructor {\n\t\treadonly observable: symbol;\n\t}\n}\n\n/**\n@remarks\nThe TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.\nAs well, some guidance on making an `Observable` to not include `closed` property.\n\n@see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130\n@see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85\n@see https://github.com/benlesh/symbol-observable#making-an-object-observable\n\n@category Observable\n*/\n// eslint-disable-next-line type-fest/require-exported-types\nexport type Unsubscribable = {\n\tunsubscribe(): void;\n};\n\n/**\n@category Observable\n*/\ntype OnNext<ValueType> = (value: ValueType) => void;\n\n/**\n@category Observable\n*/\ntype OnError = (error: unknown) => void;\n\n/**\n@category Observable\n*/\ntype OnComplete = () => void;\n\n/**\n@category Observable\n*/\n// eslint-disable-next-line type-fest/require-exported-types\nexport type Observer<ValueType> = {\n\tnext: OnNext<ValueType>;\n\terror: OnError;\n\tcomplete: OnComplete;\n};\n\n/**\nMatches a value that is like an [Observable](https://github.com/tc39/proposal-observable).\n\nYou must import it as a sub-import:\n\n@example\n```\nimport type {ObservableLike} from 'type-fest/globals';\n```\n\n@remarks\nThe TC39 Observable proposal defines 2 forms of `subscribe()`:\n1. Three callback arguments: `subscribe(observer: OnNext<ValueType>, onError?: OnError, onComplete?: OnComplete): Unsubscribable;`\n2. A single `observer` argument: (as defined below)\n\nBut `Observable` implementations have evolved to preferring case 2 and some implementations choose not to implement case 1. Therefore, an `ObservableLike` cannot be trusted to implement the first case. (xstream and hand built observerables often do not implement case 1)\n\n@see https://github.com/tc39/proposal-observable#observable\n@see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L246-L259\n@see https://benlesh.com/posts/learning-observable-by-building-observable/\n\n@category Observable\n*/\n// eslint-disable-next-line type-fest/require-exported-types\nexport type ObservableLike<ValueType = unknown> = {\n\tsubscribe(observer?: Partial<Observer<ValueType>>): Unsubscribable;\n\t[Symbol.observable](): ObservableLike<ValueType>;\n};\n\nexport {};\n"
  },
  {
    "path": "source/greater-than-or-equal.d.ts",
    "content": "import type {GreaterThan} from './greater-than.d.ts';\n\n/**\nReturns a boolean for whether a given number is greater than or equal to another number.\n\n@example\n```\nimport type {GreaterThanOrEqual} from 'type-fest';\n\ntype A = GreaterThanOrEqual<1, -5>;\n//=> true\n\ntype B = GreaterThanOrEqual<1, 1>;\n//=> true\n\ntype C = GreaterThanOrEqual<1, 5>;\n//=> false\n```\n\nNote: If either argument is the non-literal `number` type, the result is `boolean`.\n\n@example\n```\nimport type {GreaterThanOrEqual} from 'type-fest';\n\ntype A = GreaterThanOrEqual<number, 1>;\n//=> boolean\n\ntype B = GreaterThanOrEqual<1, number>;\n//=> boolean\n\ntype C = GreaterThanOrEqual<number, number>;\n//=> boolean\n```\n\n@example\n```\nimport type {GreaterThanOrEqual} from 'type-fest';\n\n// Use `GreaterThanOrEqual` to constrain a function parameter to non-negative numbers.\ndeclare function setNonNegative<N extends number>(value: GreaterThanOrEqual<N, 0> extends true ? N : never): void;\n\nsetNonNegative(0); // ✅ Allowed\nsetNonNegative(1); // ✅ Allowed\n\n// @ts-expect-error\nsetNonNegative(-1);\n\n// @ts-expect-error\nsetNonNegative(-2);\n```\n*/\nexport type GreaterThanOrEqual<A extends number, B extends number> = number extends A | B\n\t? boolean\n\t: A extends number // For distributing `A`\n\t\t? B extends number // For distributing `B`\n\t\t\t? A extends B\n\t\t\t\t? true\n\t\t\t\t: GreaterThan<A, B>\n\t\t\t: never // Should never happen\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/greater-than.d.ts",
    "content": "import type {NumberAbsolute, PositiveNumericStringGt} from './internal/index.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\nimport type {PositiveInfinity, NegativeInfinity, IsNegative} from './numeric.d.ts';\nimport type {And} from './and.d.ts';\nimport type {Or} from './or.d.ts';\n\n/**\nReturns a boolean for whether a given number is greater than another number.\n\n@example\n```\nimport type {GreaterThan} from 'type-fest';\n\ntype A = GreaterThan<1, -5>;\n//=> true\n\ntype B = GreaterThan<1, 1>;\n//=> false\n\ntype C = GreaterThan<1, 5>;\n//=> false\n```\n\nNote: If either argument is the non-literal `number` type, the result is `boolean`.\n\n@example\n```\nimport type {GreaterThan} from 'type-fest';\n\ntype A = GreaterThan<number, 1>;\n//=> boolean\n\ntype B = GreaterThan<1, number>;\n//=> boolean\n\ntype C = GreaterThan<number, number>;\n//=> boolean\n```\n\n@example\n```\nimport type {GreaterThan} from 'type-fest';\n\n// Use `GreaterThan` to constrain a function parameter to positive numbers.\ndeclare function setPositive<N extends number>(value: GreaterThan<N, 0> extends true ? N : never): void;\n\nsetPositive(1); // ✅ Allowed\nsetPositive(2); // ✅ Allowed\n\n// @ts-expect-error\nsetPositive(0);\n\n// @ts-expect-error\nsetPositive(-1);\n```\n*/\nexport type GreaterThan<A extends number, B extends number> =\n\tA extends number // For distributing `A`\n\t\t? B extends number // For distributing `B`\n\t\t\t? number extends A | B\n\t\t\t\t? boolean\n\t\t\t\t: [\n\t\t\t\t\tIsEqual<A, PositiveInfinity>, IsEqual<A, NegativeInfinity>,\n\t\t\t\t\tIsEqual<B, PositiveInfinity>, IsEqual<B, NegativeInfinity>,\n\t\t\t\t] extends infer R extends [boolean, boolean, boolean, boolean]\n\t\t\t\t\t? Or<\n\t\t\t\t\t\tAnd<IsEqual<R[0], true>, IsEqual<R[2], false>>,\n\t\t\t\t\t\tAnd<IsEqual<R[3], true>, IsEqual<R[1], false>>\n\t\t\t\t\t> extends true\n\t\t\t\t\t\t? true\n\t\t\t\t\t\t: Or<\n\t\t\t\t\t\t\tAnd<IsEqual<R[1], true>, IsEqual<R[3], false>>,\n\t\t\t\t\t\t\tAnd<IsEqual<R[2], true>, IsEqual<R[0], false>>\n\t\t\t\t\t\t> extends true\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: true extends R[number]\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: [IsNegative<A>, IsNegative<B>] extends infer R extends [boolean, boolean]\n\t\t\t\t\t\t\t\t\t? [true, false] extends R\n\t\t\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t\t\t: [false, true] extends R\n\t\t\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t\t\t: [false, false] extends R\n\t\t\t\t\t\t\t\t\t\t\t\t? PositiveNumericStringGt<`${A}`, `${B}`>\n\t\t\t\t\t\t\t\t\t\t\t\t: PositiveNumericStringGt<`${NumberAbsolute<B>}`, `${NumberAbsolute<A>}`>\n\t\t\t\t\t\t\t\t\t: never\n\t\t\t\t\t: never\n\t\t\t: never // Should never happen\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/has-optional-keys.d.ts",
    "content": "import type {OptionalKeysOf} from './optional-keys-of.d.ts';\n\n/**\nCreates a type that represents `true` or `false` depending on whether the given type has any optional fields.\n\nThis is useful when you want to create an API whose behavior depends on the presence or absence of optional fields.\n\n@example\n```\nimport type {HasOptionalKeys, OptionalKeysOf} from 'type-fest';\n\ntype UpdateService<Entity extends object> = {\n\tremoveField: HasOptionalKeys<Entity> extends true\n\t\t? (field: OptionalKeysOf<Entity>) => Promise<void>\n\t\t: never;\n};\n```\n\n@category Utilities\n*/\nexport type HasOptionalKeys<BaseType extends object> = OptionalKeysOf<BaseType> extends never ? false : true;\n\nexport {};\n"
  },
  {
    "path": "source/has-readonly-keys.d.ts",
    "content": "import type {ReadonlyKeysOf} from './readonly-keys-of.d.ts';\n\n/**\nCreates a type that represents `true` or `false` depending on whether the given type has any readonly fields.\n\nThis is useful when you want to create an API whose behavior depends on the presence or absence of readonly fields.\n\n@example\n```\nimport type {HasReadonlyKeys, ReadonlyKeysOf} from 'type-fest';\n\ntype UpdateService<Entity extends object> = {\n\tremoveField: HasReadonlyKeys<Entity> extends true\n\t\t? (field: ReadonlyKeysOf<Entity>) => Promise<void>\n\t\t: never;\n};\n```\n\n@category Utilities\n*/\nexport type HasReadonlyKeys<BaseType extends object> = ReadonlyKeysOf<BaseType> extends never ? false : true;\n\nexport {};\n"
  },
  {
    "path": "source/has-required-keys.d.ts",
    "content": "import type {RequiredKeysOf} from './required-keys-of.d.ts';\n\n/**\nCreates a type that represents `true` or `false` depending on whether the given type has any required fields.\n\nThis is useful when you want to create an API whose behavior depends on the presence or absence of required fields.\n\n@example\n```\nimport type {HasRequiredKeys} from 'type-fest';\n\ntype GeneratorOptions<Template extends object> = {\n\tprop1: number;\n\tprop2: string;\n} & (HasRequiredKeys<Template> extends true\n\t? {template: Template}\n\t: {template?: Template});\n\ntype Template1 = {\n\toptionalSubParam?: string;\n};\n\ntype Template2 = {\n\trequiredSubParam: string;\n};\n\ntype Options1 = GeneratorOptions<Template1>;\ntype Options2 = GeneratorOptions<Template2>;\n\nconst optA: Options1 = {\n\tprop1: 0,\n\tprop2: 'hi',\n};\nconst optB: Options1 = {\n\tprop1: 0,\n\tprop2: 'hi',\n\ttemplate: {},\n};\nconst optC: Options1 = {\n\tprop1: 0,\n\tprop2: 'hi',\n\ttemplate: {\n\t\toptionalSubParam: 'optional value',\n\t},\n};\n\nconst optD: Options2 = {\n\tprop1: 0,\n\tprop2: 'hi',\n\ttemplate: {\n\t\trequiredSubParam: 'required value',\n\t},\n};\n\n```\n\n@category Utilities\n*/\nexport type HasRequiredKeys<BaseType extends object> = RequiredKeysOf<BaseType> extends never ? false : true;\n\nexport {};\n"
  },
  {
    "path": "source/has-writable-keys.d.ts",
    "content": "import type {WritableKeysOf} from './writable-keys-of.d.ts';\n\n/**\nCreates a type that represents `true` or `false` depending on whether the given type has any writable fields.\n\nThis is useful when you want to create an API whose behavior depends on the presence or absence of writable fields.\n\n@example\n```\nimport type {HasWritableKeys, WritableKeysOf} from 'type-fest';\n\ntype UpdateService<Entity extends object> = {\n\tremoveField: HasWritableKeys<Entity> extends true\n\t\t? (field: WritableKeysOf<Entity>) => Promise<void>\n\t\t: never;\n};\n```\n\n@category Utilities\n*/\nexport type HasWritableKeys<BaseType extends object> = WritableKeysOf<BaseType> extends never ? false : true;\n\nexport {};\n"
  },
  {
    "path": "source/if-any.d.ts",
    "content": "import type {IsAny} from './is-any.d.ts';\n\n/**\nAn if-else-like type that resolves depending on whether the given type is `any`.\n\n@deprecated This type will be removed in the next major version. Use the {@link If} type instead.\n\n@see {@link IsAny}\n\n@example\n```\nimport type {IfAny} from 'type-fest';\n\ntype ShouldBeTrue = IfAny<any>;\n//=> true\n\ntype ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;\n//=> 'bar'\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (\n\tIsAny<T> extends true ? TypeIfAny : TypeIfNotAny\n);\n\nexport {};\n"
  },
  {
    "path": "source/if-empty-object.d.ts",
    "content": "import type {IsEmptyObject} from './empty-object.d.ts';\n\n/**\nAn if-else-like type that resolves depending on whether the given type is `{}`.\n\n@deprecated This type will be removed in the next major version. Use the {@link If} type instead.\n\n@see {@link IsEmptyObject}\n\n@example\n```\nimport type {IfEmptyObject} from 'type-fest';\n\ntype ShouldBeTrue = IfEmptyObject<{}>;\n//=> true\n\ntype ShouldBeBar = IfEmptyObject<{key: any}, 'foo', 'bar'>;\n//=> 'bar'\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IfEmptyObject<\n\tT,\n\tTypeIfEmptyObject = true,\n\tTypeIfNotEmptyObject = false,\n> = IsEmptyObject<T> extends true ? TypeIfEmptyObject : TypeIfNotEmptyObject;\n\nexport {};\n"
  },
  {
    "path": "source/if-never.d.ts",
    "content": "import type {IsNever} from './is-never.d.ts';\n\n/**\nAn if-else-like type that resolves depending on whether the given type is `never`.\n\n@deprecated This type will be removed in the next major version. Use the {@link If} type instead.\n\n@see {@link IsNever}\n\n@example\n```\nimport type {IfNever} from 'type-fest';\n\ntype ShouldBeTrue = IfNever<never>;\n//=> true\n\ntype ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;\n//=> 'bar'\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (\n\tIsNever<T> extends true ? TypeIfNever : TypeIfNotNever\n);\n\nexport {};\n"
  },
  {
    "path": "source/if-null.d.ts",
    "content": "import type {IsNull} from './is-null.d.ts';\n\n/**\nAn if-else-like type that resolves depending on whether the given type is `null`.\n\n@deprecated This type will be removed in the next major version. Use the {@link If} type instead.\n\n@see {@link IsNull}\n\n@example\n```\nimport type {IfNull} from 'type-fest';\n\ntype ShouldBeTrue = IfNull<null>;\n//=> true\n\ntype ShouldBeBar = IfNull<'not null', 'foo', 'bar'>;\n//=> 'bar'\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IfNull<T, TypeIfNull = true, TypeIfNotNull = false> = (\n\tIsNull<T> extends true ? TypeIfNull : TypeIfNotNull\n);\n\nexport {};\n"
  },
  {
    "path": "source/if-unknown.d.ts",
    "content": "import type {IsUnknown} from './is-unknown.d.ts';\n\n/**\nAn if-else-like type that resolves depending on whether the given type is `unknown`.\n\n@deprecated This type will be removed in the next major version. Use the {@link If} type instead.\n\n@see {@link IsUnknown}\n\n@example\n```\nimport type {IfUnknown} from 'type-fest';\n\ntype ShouldBeTrue = IfUnknown<unknown>;\n//=> true\n\ntype ShouldBeBar = IfUnknown<'not unknown', 'foo', 'bar'>;\n//=> 'bar'\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IfUnknown<T, TypeIfUnknown = true, TypeIfNotUnknown = false> = (\n\tIsUnknown<T> extends true ? TypeIfUnknown : TypeIfNotUnknown\n);\n\nexport {};\n"
  },
  {
    "path": "source/if.d.ts",
    "content": "import type {IsNever} from './is-never.d.ts';\n\n/**\nAn if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.\n\nUse-cases:\n- You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.\n\nNote:\n- Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.\n- Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.\n\n@example\n```\nimport type {If} from 'type-fest';\n\ntype A = If<true, 'yes', 'no'>;\n//=> 'yes'\n\ntype B = If<false, 'yes', 'no'>;\n//=> 'no'\n\ntype C = If<boolean, 'yes', 'no'>;\n//=> 'yes' | 'no'\n\ntype D = If<any, 'yes', 'no'>;\n//=> 'yes' | 'no'\n\ntype E = If<never, 'yes', 'no'>;\n//=> 'no'\n```\n\n@example\n```\nimport type {If, IsAny, IsNever} from 'type-fest';\n\ntype A = If<IsAny<unknown>, 'is any', 'not any'>;\n//=> 'not any'\n\ntype B = If<IsNever<never>, 'is never', 'not never'>;\n//=> 'is never'\n```\n\n@example\n```\nimport type {If, IsEqual} from 'type-fest';\n\ntype IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;\n\ntype A = IfEqual<string, string, 'equal', 'not equal'>;\n//=> 'equal'\n\ntype B = IfEqual<string, number, 'equal', 'not equal'>;\n//=> 'not equal'\n```\n\nNote: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:\n\n@example\n```\nimport type {If, IsEqual, StringRepeat} from 'type-fest';\n\ntype HundredZeroes = StringRepeat<'0', 100>;\n\n// The following implementation is not tail recursive\ntype Includes<S extends string, Char extends string> =\n\tS extends `${infer First}${infer Rest}`\n\t\t? If<IsEqual<First, Char>,\n\t\t\t'found',\n\t\t\tIncludes<Rest, Char>>\n\t\t: 'not found';\n\n// Hence, instantiations with long strings will fail\n// @ts-expect-error\ntype Fails = Includes<HundredZeroes, '1'>;\n//           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n// Error: Type instantiation is excessively deep and possibly infinite.\n\n// However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive\ntype IncludesWithoutIf<S extends string, Char extends string> =\n\tS extends `${infer First}${infer Rest}`\n\t\t? IsEqual<First, Char> extends true\n\t\t\t? 'found'\n\t\t\t: IncludesWithoutIf<Rest, Char>\n\t\t: 'not found';\n\n// Now, instantiations with long strings will work\ntype Works = IncludesWithoutIf<HundredZeroes, '1'>;\n//=> 'not found'\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type If<Type extends boolean, IfBranch, ElseBranch> =\n\tIsNever<Type> extends true\n\t\t? ElseBranch\n\t\t: Type extends true\n\t\t\t? IfBranch\n\t\t\t: ElseBranch;\n\nexport {};\n"
  },
  {
    "path": "source/includes.d.ts",
    "content": "import type {IsEqual} from './is-equal.d.ts';\n\n/**\nReturns a boolean for whether the given array includes the given item.\n\nThis can be useful if another type wants to make a decision based on whether the array includes that item.\n\n@example\n```\nimport type {Includes} from 'type-fest';\n\ntype hasRed<array extends any[]> = Includes<array, 'red'>;\n```\n\n@category Array\n*/\nexport type Includes<Value extends readonly any[], Item> =\n\tValue extends readonly [Value[0], ...infer rest]\n\t\t? IsEqual<Value[0], Item> extends true\n\t\t\t? true\n\t\t\t: Includes<rest, Item>\n\t\t: false;\n\nexport {};\n"
  },
  {
    "path": "source/int-closed-range.d.ts",
    "content": "import type {IntRange} from './int-range.d.ts';\nimport type {Sum} from './sum.d.ts';\n\n/**\nGenerate a union of numbers.\n\nThe numbers are created from the given `Start` (inclusive) parameter to the given `End` (inclusive) parameter.\n\nYou skip over numbers using the `Step` parameter (defaults to `1`). For example, `IntClosedRange<0, 10, 2>` will create a union of `0 | 2 | 4 | 6 | 8 | 10`.\n\nNote: `Start` or `End` must be non-negative and smaller than `999`.\n\nUse-cases:\n1. This can be used to define a set of valid input/output values. for example:\n\n@example\n```\nimport type {IntClosedRange} from 'type-fest';\n\ntype Age = IntClosedRange<0, 20>;\n//=> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20\n\ntype FontSize = IntClosedRange<10, 20>;\n//=> 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20\n\ntype EvenNumber = IntClosedRange<0, 10, 2>;\n//=> 0 | 2 | 4 | 6 | 8 | 10\n```\n\n2. This can be used to define random numbers in a range. For example, `type RandomNumber = IntClosedRange<0, 100>;`\n\n@example\n```\nimport type {IntClosedRange} from 'type-fest';\n\ntype ZeroToNine = IntClosedRange<0, 9>;\n//=> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\ntype Hundreds = IntClosedRange<100, 900, 100>;\n//=> 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900\n```\n\n@see {@link IntRange}\n*/\nexport type IntClosedRange<Start extends number, End extends number, Skip extends number = 1> = IntRange<Start, Sum<End, 1>, Skip>;\n\nexport {};\n"
  },
  {
    "path": "source/int-range.d.ts",
    "content": "import type {TupleOf} from './tuple-of.d.ts';\nimport type {Subtract} from './subtract.d.ts';\n\n/**\nGenerate a union of numbers.\n\nThe numbers are created from the given `Start` (inclusive) parameter to the given `End` (exclusive) parameter.\n\nYou skip over numbers using the `Step` parameter (defaults to `1`). For example, `IntRange<0, 10, 2>` will create a union of `0 | 2 | 4 | 6 | 8`.\n\nNote: `Start` or `End` must be non-negative and smaller than `1000`.\n\nUse-cases:\n1. This can be used to define a set of valid input/output values. for example:\n\n@example\n```\nimport type {IntRange} from 'type-fest';\n\ntype Age = IntRange<0, 20>;\n//=> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19\n\ntype FontSize = IntRange<10, 20>;\n//=> 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19\n\ntype EvenNumber = IntRange<0, 11, 2>;\n//=> 0 | 2 | 4 | 6 | 8 | 10\n```\n\n2. This can be used to define random numbers in a range. For example, `type RandomNumber = IntRange<0, 100>;`\n\n@example\n```\nimport type {IntRange} from 'type-fest';\n\ntype ZeroToNine = IntRange<0, 10>;\n//=> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\ntype Hundreds = IntRange<100, 901, 100>;\n//=> 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900\n```\n\n@see {@link IntClosedRange}\n*/\nexport type IntRange<Start extends number, End extends number, Step extends number = 1> = PrivateIntRange<Start, End, Step>;\n\n/**\nThe actual implementation of `IntRange`. It's private because it has some arguments that don't need to be exposed.\n*/\ntype PrivateIntRange<\n\tStart extends number,\n\tEnd extends number,\n\tStep extends number,\n\t// The gap between each number, gap = step - 1\n\tGap extends number = Subtract<Step, 1>,\n\t// The final `List` is `[...StartLengthTuple, ...[number, ...GapLengthTuple], ...[number, ...GapLengthTuple], ... ...]`, so can initialize the `List` with `[...StartLengthTuple]`\n\tList extends unknown[] = TupleOf<Start, never>,\n\tEndLengthTuple extends unknown[] = TupleOf<End>,\n> = Gap extends 0 ?\n\t// Handle the case that without `Step`\n\tList['length'] extends End // The result of \"List[length] === End\"\n\t\t? Exclude<List[number], never> // All unused elements are `never`, so exclude them\n\t\t: PrivateIntRange<Start, End, Step, Gap, [...List, List['length'] ]>\n\t// Handle the case that with `Step`\n\t: List extends [...(infer U), ...EndLengthTuple] // The result of \"List[length] >= End\", because the `...TupleOf<Gap, never>` maybe make `List` too long.\n\t\t? Exclude<List[number], never>\n\t\t: PrivateIntRange<Start, End, Step, Gap, [...List, List['length'], ...TupleOf<Gap, never>]>;\n\nexport {};\n"
  },
  {
    "path": "source/internal/array.d.ts",
    "content": "import type {If} from '../if.d.ts';\nimport type {IsNever} from '../is-never.d.ts';\nimport type {OptionalKeysOf} from '../optional-keys-of.d.ts';\nimport type {UnknownArray} from '../unknown-array.d.ts';\nimport type {IsExactOptionalPropertyTypesEnabled, IfNotAnyOrNever} from './type.d.ts';\n\n/**\nMatches any unknown array or tuple.\n*/\nexport type UnknownArrayOrTuple = readonly [...unknown[]];\n// TODO: should unknown-array be updated?\n\n/**\nExtracts the type of the first element of an array or tuple.\n*/\nexport type FirstArrayElement<TArray extends UnknownArrayOrTuple> = TArray extends readonly [infer THead, ...unknown[]]\n\t? THead\n\t: never;\n\n/**\nReturns the static, fixed-length portion of the given array, excluding variable-length parts.\n\n@example\n```\ntype A = [string, number, boolean, ...string[]];\ntype B = StaticPartOfArray<A>;\n//=> [string, number, boolean]\n```\n*/\nexport type StaticPartOfArray<T extends UnknownArray, Result extends UnknownArray = []> =\n\tT extends unknown\n\t\t? number extends T['length'] ?\n\t\t\tT extends readonly [infer U, ...infer V]\n\t\t\t\t? StaticPartOfArray<V, [...Result, U]>\n\t\t\t\t: Result\n\t\t\t: T\n\t\t: never; // Should never happen\n\n/**\nReturns the variable, non-fixed-length portion of the given array, excluding static-length parts.\n\n@example\n```\ntype A = [string, number, boolean, ...string[]];\ntype B = VariablePartOfArray<A>;\n//=> string[]\n```\n*/\nexport type VariablePartOfArray<T extends UnknownArray> =\n\tT extends unknown\n\t\t? T extends readonly [...StaticPartOfArray<T>, ...infer U]\n\t\t\t? U\n\t\t\t: []\n\t\t: never; // Should never happen\n\n/**\nSet the given array to readonly if `IsReadonly` is `true`, otherwise set the given array to normal, then return the result.\n\n@example\n```\ntype ReadonlyStringArray = readonly string[];\ntype NormalStringArray = string[];\n\ntype ReadonlyResult = SetArrayAccess<NormalStringArray, true>;\n//=> readonly string[]\n\ntype NormalResult = SetArrayAccess<ReadonlyStringArray, false>;\n//=> string[]\n```\n*/\nexport type SetArrayAccess<T extends UnknownArray, IsReadonly extends boolean> =\nT extends readonly [...infer U] ?\n\tIsReadonly extends true\n\t\t? readonly [...U]\n\t\t: [...U]\n\t: T;\n\n/**\nReturns whether the given array `T` is readonly.\n*/\nexport type IsArrayReadonly<T extends UnknownArray> = If<IsNever<T>, false, T extends unknown[] ? false : true>;\n\n/**\nTransforms a tuple type by replacing it's rest element with a single element that has the same type as the rest element, while keeping all the non-rest elements intact.\n\n@example\n```\ntype A = CollapseRestElement<[string, string, ...number[]]>;\n//=> [string, string, number]\n\ntype B = CollapseRestElement<[...string[], number, number]>;\n//=> [string, number, number]\n\ntype C = CollapseRestElement<[string, string, ...Array<number | bigint>]>;\n//=> [string, string, number | bigint]\n\ntype D = CollapseRestElement<[string, number]>;\n//=> [string, number]\n```\n\nNote: Optional modifiers (`?`) are removed from elements unless the `exactOptionalPropertyTypes` compiler option is disabled. When disabled, there's an additional `| undefined` for optional elements.\n\n@example\n```\n// `exactOptionalPropertyTypes` enabled\ntype A = CollapseRestElement<[string?, string?, ...number[]]>;\n//=> [string, string, number]\n\n// `exactOptionalPropertyTypes` disabled\ntype B = CollapseRestElement<[string?, string?, ...number[]]>;\n//=> [string | undefined, string | undefined, number]\n```\n*/\nexport type CollapseRestElement<TArray extends UnknownArray> = IfNotAnyOrNever<TArray, _CollapseRestElement<TArray>>;\n\ntype _CollapseRestElement<\n\tTArray extends UnknownArray,\n\tForwardAccumulator extends UnknownArray = [],\n\tBackwardAccumulator extends UnknownArray = [],\n> =\n\tTArray extends UnknownArray // For distributing `TArray`\n\t\t? keyof TArray & `${number}` extends never\n\t\t\t// Enters this branch, if `TArray` is empty (e.g., []),\n\t\t\t// or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).\n\t\t\t? TArray extends readonly [...infer Rest, infer Last]\n\t\t\t\t? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.\n\t\t\t\t: TArray extends readonly []\n\t\t\t\t\t? [...ForwardAccumulator, ...BackwardAccumulator]\n\t\t\t\t\t: [...ForwardAccumulator, TArray[number], ...BackwardAccumulator] // Add the rest element between the accumulated elements.\n\t\t\t: TArray extends readonly [(infer First)?, ...infer Rest]\n\t\t\t\t? _CollapseRestElement<\n\t\t\t\t\tRest,\n\t\t\t\t\t[\n\t\t\t\t\t\t...ForwardAccumulator,\n\t\t\t\t\t\t'0' extends OptionalKeysOf<TArray>\n\t\t\t\t\t\t\t? If<IsExactOptionalPropertyTypesEnabled, First, First | undefined> // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.\n\t\t\t\t\t\t\t: First,\n\t\t\t\t\t],\n\t\t\t\t\tBackwardAccumulator\n\t\t\t\t>\n\t\t\t\t: never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/internal/characters.d.ts",
    "content": "export type Whitespace =\n\t| '\\u{9}' // '\\t'\n\t| '\\u{A}' // '\\n'\n\t| '\\u{B}' // '\\v'\n\t| '\\u{C}' // '\\f'\n\t| '\\u{D}' // '\\r'\n\t| '\\u{20}' // ' '\n\t| '\\u{85}'\n\t| '\\u{A0}'\n\t| '\\u{1680}'\n\t| '\\u{2000}'\n\t| '\\u{2001}'\n\t| '\\u{2002}'\n\t| '\\u{2003}'\n\t| '\\u{2004}'\n\t| '\\u{2005}'\n\t| '\\u{2006}'\n\t| '\\u{2007}'\n\t| '\\u{2008}'\n\t| '\\u{2009}'\n\t| '\\u{200A}'\n\t| '\\u{2028}'\n\t| '\\u{2029}'\n\t| '\\u{202F}'\n\t| '\\u{205F}'\n\t| '\\u{3000}'\n\t| '\\u{FEFF}';\n\nexport type WordSeparators = '-' | '_' | Whitespace;\n\nexport type AsciiPunctuation =\n\t| '!'\n\t| '\"'\n\t| '#'\n\t| '$'\n\t| '%'\n\t| '&'\n\t| '\\''\n\t| '('\n\t| ')'\n\t| '*'\n\t| '+'\n\t| ','\n\t| '-'\n\t| '.'\n\t| '/'\n\t| ':'\n\t| ';'\n\t| '<'\n\t| '='\n\t| '>'\n\t| '?'\n\t| '@'\n\t| '['\n\t| '\\\\'\n\t| ']'\n\t| '^'\n\t| '_'\n\t| '`'\n\t| '{'\n\t| '|'\n\t| '}'\n\t| '~';\n\nexport {};\n"
  },
  {
    "path": "source/internal/enforce-optional.d.ts",
    "content": "import type {Simplify} from '../simplify.d.ts';\n\n// Returns `never` if the key is optional otherwise return the key type.\ntype RequiredFilter<Type, Key extends keyof Type> = undefined extends Type[Key]\n\t? Type[Key] extends undefined\n\t\t? Key\n\t\t: never\n\t: Key;\n\n// Returns `never` if the key is required otherwise return the key type.\ntype OptionalFilter<Type, Key extends keyof Type> = undefined extends Type[Key]\n\t? Type[Key] extends undefined\n\t\t? never\n\t\t: Key\n\t: never;\n\n/**\nEnforce optional keys (by adding the `?` operator) for keys that have a union with `undefined`.\n\n@example\n```\nimport type {EnforceOptional} from 'type-fest';\n\ntype Foo = {\n\ta: string;\n\tb?: string;\n\tc: undefined;\n\td: number | undefined;\n};\n\ntype FooBar = EnforceOptional<Foo>;\n// => {\n// \ta: string;\n// \tb?: string;\n// \tc: undefined;\n// \td?: number;\n// }\n```\n\n@internal\n@category Object\n*/\nexport type EnforceOptional<ObjectType> = Simplify<{\n\t[Key in keyof ObjectType as RequiredFilter<ObjectType, Key>]: ObjectType[Key]\n} & {\n\t[Key in keyof ObjectType as OptionalFilter<ObjectType, Key>]?: Exclude<ObjectType[Key], undefined>\n}>;\n\nexport {};\n"
  },
  {
    "path": "source/internal/index.d.ts",
    "content": "export type * from './array.d.ts';\nexport type * from './characters.d.ts';\nexport type * from './keys.d.ts';\nexport type * from './numeric.d.ts';\nexport type * from './object.d.ts';\nexport type * from './string.d.ts';\nexport type * from './tuple.d.ts';\nexport type * from './type.d.ts';\nexport type * from './enforce-optional.d.ts';\n\nexport {};\n"
  },
  {
    "path": "source/internal/keys.d.ts",
    "content": "import type {IsAny} from '../is-any.d.ts';\nimport type {IsLiteral} from '../is-literal.d.ts';\nimport type {IsUnknown} from '../is-unknown.d.ts';\nimport type {ToString} from './string.d.ts';\n\n// Returns `never` if the key or property is not jsonable without testing whether the property is required or optional otherwise return the key.\ntype BaseKeyFilter<Type, Key extends keyof Type> = Key extends symbol\n\t? never\n\t: Type[Key] extends symbol\n\t\t? never\n\t\t/*\n\t\tTo prevent a problem where an object with only a `name` property is incorrectly treated as assignable to a function, we first check if the property is a record.\n\t\tThis check is necessary, because without it, if we don't verify whether the property is a record, an object with a type of `{name: any}` would return `never` due to its potential assignability to a function.\n\t\tSee: https://github.com/sindresorhus/type-fest/issues/657\n\t\t*/\n\t\t: Type[Key] extends Record<string, unknown>\n\t\t\t? Key\n\t\t\t: [(...arguments_: any[]) => any] extends [Type[Key]]\n\t\t\t\t? never\n\t\t\t\t: Key;\n\n/**\nReturns the required keys.\n*/\nexport type FilterDefinedKeys<T extends object> = Exclude<\n\t{\n\t\t[Key in keyof T]: IsAny<T[Key]> extends true\n\t\t\t? Key\n\t\t\t: IsUnknown<T[Key]> extends true ? Key : undefined extends T[Key]\n\t\t\t\t? never\n\t\t\t\t: T[Key] extends undefined\n\t\t\t\t\t? never\n\t\t\t\t\t: BaseKeyFilter<T, Key>;\n\t}[keyof T],\n\tundefined\n>;\n\n/**\nReturns the optional keys.\n*/\nexport type FilterOptionalKeys<T extends object> = Exclude<\n\t{\n\t\t[Key in keyof T]: IsAny<T[Key]> extends true\n\t\t\t? never\n\t\t\t: undefined extends T[Key]\n\t\t\t\t? T[Key] extends undefined\n\t\t\t\t\t? never\n\t\t\t\t\t: BaseKeyFilter<T, Key>\n\t\t\t\t: never;\n\t}[keyof T],\n\tundefined\n>;\n\n/**\nDisallows any of the given keys.\n*/\nexport type RequireNone<KeysType extends PropertyKey> = Partial<Record<KeysType, never>>;\n\n/**\nUtility type to retrieve only literal keys from type.\n*/\nexport type LiteralKeyOf<T> = keyof {[K in keyof T as IsLiteral<K> extends true ? K : never]-?: never};\n\n/**\nGet the exact version of the given `Key` in the given object `T`.\n\nUse-case: You know that a number key (e.g. 10) is in an object, but you don't know how it is defined in the object, as a string or as a number (e.g. 10 or '10'). You can use this type to get the exact version of the key. See the example.\n\n@example\n```\ntype Object = {\n\t0: number;\n\t'1': string;\n};\n\ntype Key1 = ExactKey<Object, '0'>;\n//=> 0\ntype Key2 = ExactKey<Object, 0>;\n//=> 0\n\ntype Key3 = ExactKey<Object, '1'>;\n//=> '1'\ntype Key4 = ExactKey<Object, 1>;\n//=> '1'\n```\n\n@category Object\n*/\nexport type ExactKey<T extends object, Key extends PropertyKey> =\nKey extends keyof T\n\t? Key\n\t: ToString<Key> extends keyof T\n\t\t? ToString<Key>\n\t\t: Key extends `${infer NumberKey extends number}`\n\t\t\t? NumberKey extends keyof T\n\t\t\t\t? NumberKey\n\t\t\t\t: never\n\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/internal/numeric.d.ts",
    "content": "import type {IsNever} from '../is-never.d.ts';\nimport type {Finite, NegativeInfinity, PositiveInfinity} from '../numeric.d.ts';\nimport type {UnknownArray} from '../unknown-array.d.ts';\nimport type {StringToNumber} from './string.d.ts';\nimport type {IfNotAnyOrNever, IsAnyOrNever} from './type.d.ts';\n\n/**\nReturns the absolute value of a given value.\n\n@example\n```\ntype A = NumberAbsolute<-1>;\n//=> 1\n\ntype B = NumberAbsolute<1>;\n//=> 1\n\ntype C = NumberAbsolute<NegativeInfinity>;\n//=> PositiveInfinity\n```\n*/\nexport type NumberAbsolute<N extends number> = `${N}` extends `-${infer StringPositiveN}` ? StringToNumber<StringPositiveN> : N;\n\n/**\nCheck whether the given type is a number or a number string.\n\nSupports floating-point as a string.\n\n@example\n```\ntype A = IsNumberLike<'1'>;\n//=> true\n\ntype B = IsNumberLike<'-1.1'>;\n//=> true\n\ntype C = IsNumberLike<'5e-20'>;\n//=> true\n\ntype D = IsNumberLike<1>;\n//=> true\n\ntype E = IsNumberLike<'a'>;\n//=> false\n*/\nexport type IsNumberLike<N> =\n\tIfNotAnyOrNever<N,\n\t\tN extends number | `${number}`\n\t\t\t? true\n\t\t\t: false,\n\t\tboolean, false>;\n\n/**\nReturns the minimum number in the given union of numbers.\n\nNote: Just supports numbers from 0 to 999.\n\n@example\n```\ntype A = UnionMin<1 | 3 | 2>;\n//=> 1\n\ntype B = UnionMin<number>;\n//=> number\n\ntype C = UnionMin<any>;\n//=> any\n\ntype D = UnionMin<never>;\n//=> never\n```\n*/\nexport type UnionMin<N extends number> =\n\tIsAnyOrNever<N> extends true ? N\n\t\t: number extends N ? number\n\t\t\t: NegativeInfinity extends N ? NegativeInfinity\n\t\t\t\t: [N] extends [PositiveInfinity] ? PositiveInfinity\n\t\t\t\t\t: InternalUnionMin<Finite<N>>;\n\n/**\nThe actual implementation of `UnionMin`. It's private because it has some arguments that don't need to be exposed.\n*/\ntype InternalUnionMin<N extends number, T extends UnknownArray = []> =\n\tT['length'] extends N\n\t\t? T['length']\n\t\t: InternalUnionMin<N, [...T, unknown]>;\n\n/**\nReturns the maximum number in the given union of numbers.\n\nNote: Just supports numbers from 0 to 999.\n\n@example\n```\ntype A = UnionMax<1 | 3 | 2>;\n//=> 3\n\ntype B = UnionMax<number>;\n//=> number\n\ntype C = UnionMax<any>;\n//=> any\n\ntype D = UnionMax<never>;\n//=> never\n```\n*/\nexport type UnionMax<N extends number> =\n\tIsAnyOrNever<N> extends true ? N\n\t\t: number extends N ? number\n\t\t\t: PositiveInfinity extends N ? PositiveInfinity\n\t\t\t\t: [N] extends [NegativeInfinity] ? NegativeInfinity\n\t\t\t\t\t: InternalUnionMax<Finite<N>>;\n\n/**\nThe actual implementation of `UnionMax`. It's private because it has some arguments that don't need to be exposed.\n*/\ntype InternalUnionMax<N extends number, T extends UnknownArray = []> =\n\tIsNever<N> extends true\n\t\t? T['length']\n\t\t: T['length'] extends N\n\t\t\t? InternalUnionMax<Exclude<N, T['length']>, T>\n\t\t\t: InternalUnionMax<N, [...T, unknown]>;\n\n/**\nReturns the number with reversed sign.\n\n@example\n```\ntype A = ReverseSign<-1>;\n//=> 1\n\ntype B = ReverseSign<1>;\n//=> -1\n\ntype C = ReverseSign<NegativeInfinity>;\n//=> PositiveInfinity\n\ntype D = ReverseSign<PositiveInfinity>;\n//=> NegativeInfinity\n```\n*/\nexport type ReverseSign<N extends number> =\n\t// Handle edge cases\n\tN extends 0 ? 0 : N extends PositiveInfinity ? NegativeInfinity : N extends NegativeInfinity ? PositiveInfinity :\n\t// Handle negative numbers\n\t`${N}` extends `-${infer P extends number}` ? P\n\t\t// Handle positive numbers\n\t\t: `-${N}` extends `${infer R extends number}` ? R : never;\n\nexport {};\n"
  },
  {
    "path": "source/internal/object.d.ts",
    "content": "import type {Simplify} from '../simplify.d.ts';\nimport type {IsEqual} from '../is-equal.d.ts';\nimport type {KeysOfUnion} from '../keys-of-union.d.ts';\nimport type {RequiredKeysOf} from '../required-keys-of.d.ts';\nimport type {Merge} from '../merge.d.ts';\nimport type {OptionalKeysOf} from '../optional-keys-of.d.ts';\nimport type {IsAny} from '../is-any.d.ts';\nimport type {If} from '../if.d.ts';\nimport type {IsNever} from '../is-never.d.ts';\nimport type {FilterDefinedKeys, FilterOptionalKeys} from './keys.d.ts';\nimport type {MapsSetsOrArrays, NonRecursiveType} from './type.d.ts';\nimport type {StringToNumber, ToString} from './string.d.ts';\n\n/**\nCreate an object type with the given key `<Key>` and value `<Value>`.\n\nIt will copy the prefix and optional status of the same key from the given object `CopiedFrom` into the result.\n\n@example\n```\ntype A = BuildObject<'a', string>;\n//=> {a: string}\n\n// Copy `readonly` and `?` from the key `a` of `{readonly a?: any}`\ntype B = BuildObject<'a', string, {readonly a?: any}>;\n//=> {readonly a?: string}\n```\n*/\nexport type BuildObject<Key extends PropertyKey, Value, CopiedFrom extends object = {}> =\n\tKey extends keyof CopiedFrom\n\t\t? Pick<{[_ in keyof CopiedFrom]: Value}, Key>\n\t\t: Key extends `${infer NumberKey extends number}`\n\t\t\t? NumberKey extends keyof CopiedFrom\n\t\t\t\t? Pick<{[_ in keyof CopiedFrom]: Value}, NumberKey>\n\t\t\t\t: {[_ in Key]: Value}\n\t\t\t: {[_ in Key]: Value};\n\n/**\nReturns a boolean for whether the given type is a plain key-value object.\n*/\nexport type IsPlainObject<T> =\n\tIsNever<T> extends true\n\t\t? false\n\t\t: T extends NonRecursiveType | MapsSetsOrArrays\n\t\t\t? false\n\t\t\t: T extends object\n\t\t\t\t? true\n\t\t\t\t: false;\n\n/**\nExtract the object field type if T is an object and K is a key of T, return `never` otherwise.\n\nIt creates a type-safe way to access the member type of `unknown` type.\n*/\nexport type ObjectValue<T, K> =\n\tK extends keyof T\n\t\t? T[K]\n\t\t: ToString<K> extends keyof T\n\t\t\t? T[ToString<K>]\n\t\t\t: K extends `${infer NumberK extends number}`\n\t\t\t\t? NumberK extends keyof T\n\t\t\t\t\t? T[NumberK]\n\t\t\t\t\t: never\n\t\t\t\t: never;\n\n/**\nFor an object T, if it has any properties that are a union with `undefined`, make those into optional properties instead.\n\n@example\n```\ntype User = {\n\tfirstName: string;\n\tlastName: string | undefined;\n};\n\ntype OptionalizedUser = UndefinedToOptional<User>;\n//=> {\n// \tfirstName: string;\n// \tlastName?: string;\n// }\n```\n*/\nexport type UndefinedToOptional<T extends object> = Simplify<\n\t{\n\t// Property is not a union with `undefined`, keep it as-is.\n\t\t[Key in keyof Pick<T, FilterDefinedKeys<T>>]: T[Key];\n\t} & {\n\t// Property _is_ a union with defined value. Set as optional (via `?`) and remove `undefined` from the union.\n\t\t[Key in keyof Pick<T, FilterOptionalKeys<T>>]?: Exclude<T[Key], undefined>;\n\t}\n>;\n\n/**\nWorks similar to the built-in `Pick` utility type, except for the following differences:\n- Distributes over union types and allows picking keys from any member of the union type.\n- Primitives types are returned as-is.\n- Picks all keys if `Keys` is `any`.\n- Doesn't pick `number` from a `string` index signature.\n\n@example\n```\ntype ImageUpload = {\n\turl: string;\n\tsize: number;\n\tthumbnailUrl: string;\n};\n\ntype VideoUpload = {\n\turl: string;\n\tduration: number;\n\tencodingFormat: string;\n};\n\n// Distributes over union types and allows picking keys from any member of the union type\ntype MediaDisplay = HomomorphicPick<ImageUpload | VideoUpload, \"url\" | \"size\" | \"duration\">;\n//=> {url: string; size: number} | {url: string; duration: number}\n\n// Primitive types are returned as-is\ntype Primitive = HomomorphicPick<string | number, 'toUpperCase' | 'toString'>;\n//=> string | number\n\n// Picks all keys if `Keys` is `any`\ntype Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>;\n//=> {a: 1; b: 2} | {c: 3}\n\n// Doesn't pick `number` from a `string` index signature\ntype IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>;\n//=> {}\n*/\nexport type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = {\n\t[P in keyof T as Extract<P, Keys>]: T[P]\n};\n\n/**\nExtract all possible values for a given key from a union of object types.\n\n@example\n```\ntype Statuses = ValueOfUnion<{id: 1; status: 'open'} | {id: 2; status: 'closed'}, 'status'>;\n//=> \"open\" | \"closed\"\n```\n*/\nexport type ValueOfUnion<Union, Key extends KeysOfUnion<Union>> =\n\tUnion extends unknown ? Key extends keyof Union ? Union[Key] : never : never;\n\n/**\nExtract all readonly keys from a union of object types.\n\n@example\n```\ntype User = {\n\treadonly id: string;\n\tname: string;\n};\n\ntype Post = {\n\treadonly id: string;\n\treadonly author: string;\n\tbody: string;\n};\n\ntype ReadonlyKeys = ReadonlyKeysOfUnion<User | Post>;\n//=> \"id\" | \"author\"\n```\n*/\nexport type ReadonlyKeysOfUnion<Union> = Union extends unknown ? keyof {\n\t[Key in keyof Union as IsEqual<{[K in Key]: Union[Key]}, {readonly [K in Key]: Union[Key]}> extends true ? Key : never]: never\n} : never;\n\n/**\nMerges user specified options with default options.\n\n@example\n```\ntype PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};\ntype DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};\ntype SpecifiedOptions = {leavesOnly: true};\n\ntype Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;\n//=> {maxRecursionDepth: 10; leavesOnly: true}\n```\n\n@example\n```\n// Complains if default values are not provided for optional options\n\ntype PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};\ntype DefaultPathsOptions = {maxRecursionDepth: 10};\ntype SpecifiedOptions = {};\n\ntype Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;\n//                                              ~~~~~~~~~~~~~~~~~~~\n// Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.\n```\n\n@example\n```\n// Complains if an option's default type does not conform to the expected type\n\ntype PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};\ntype DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};\ntype SpecifiedOptions = {};\n\ntype Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;\n//                                              ~~~~~~~~~~~~~~~~~~~\n// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.\n```\n\n@example\n```\n// Complains if an option's specified type does not conform to the expected type\n\ntype PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};\ntype DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};\ntype SpecifiedOptions = {leavesOnly: 'yes'};\n\ntype Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;\n//                                                                   ~~~~~~~~~~~~~~~~\n// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.\n```\n*/\nexport type ApplyDefaultOptions<\n\tOptions extends object,\n\tDefaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>,\n\tSpecifiedOptions extends Options,\n> =\n\tIf<IsAny<SpecifiedOptions>, Defaults,\n\t\tIf<IsNever<SpecifiedOptions>, Defaults,\n\t\t\tSimplify<Merge<Defaults, {\n\t\t\t\t[Key in keyof SpecifiedOptions\n\t\t\t\tas Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key\n\t\t\t\t]: SpecifiedOptions[Key]\n\t\t\t}> & Required<Options>>>>; // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`\n\n/**\nCollapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.\n\nNote: This doesn't collapse literals within tagged types. For example, `CollapseLiterals<Tagged<'foo' | (string & {}), 'Tag'>>` returns `(\"foo\" & Tag<\"Tag\", never>) | (string & Tag<\"Tag\", never>)` and not `string & Tag<\"Tag\", never>`.\n\nUse-case: For collapsing unions created using {@link LiteralUnion}.\n\n@example\n```\nimport type {LiteralUnion} from 'type-fest';\n\ntype A = CollapseLiterals<'foo' | 'bar' | (string & {})>;\n//=> string\n\ntype B = CollapseLiterals<LiteralUnion<1 | 2 | 3, number>>;\n//=> number\n\ntype C = CollapseLiterals<LiteralUnion<'onClick' | 'onChange', `on${string}`>>;\n//=> `on${string}`\n\ntype D = CollapseLiterals<'click' | 'change' | (`on${string}` & {})>;\n//=> 'click' | 'change' | `on${string}`\n\ntype E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined>;\n//=> string | null | undefined\n```\n*/\nexport type CollapseLiterals<T> = {} extends T\n\t? T\n\t: T extends infer U & {}\n\t\t? U\n\t\t: T;\n\n/**\nNormalize keys by including string and number representations wherever applicable.\n\n@example\n```ts\ntype A = NormalizedKeys<0 | '1'>;\n//=> 0 | '0' | 1 | '1'\n\ntype B = NormalizedKeys<string>;\n//=> string | number\n\ntype C = NormalizedKeys<number>;\n//=> number | `${number}`\n\ntype D = NormalizedKeys<symbol | 'foo'>;\n//=> symbol | 'foo'\n```\n*/\nexport type NormalizedKeys<Keys extends PropertyKey> =\n\t| Keys\n\t| (string extends Keys ? number : never)\n\t| StringToNumber<Keys & string>\n\t| ToString<Keys & number>;\n\nexport {};\n"
  },
  {
    "path": "source/internal/string.d.ts",
    "content": "import type {TupleOf} from '../tuple-of.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../numeric.d.ts';\nimport type {Trim} from '../trim.d.ts';\nimport type {Whitespace} from './characters.d.ts';\n\n/**\nReturn a string representation of the given string or number.\n\nNote: This type is not the return type of the `.toString()` function.\n*/\nexport type ToString<T> = T extends string | number ? `${T}` : never;\n\n/**\nConverts a numeric string to a number.\n\n@example\n```\ntype PositiveInt = StringToNumber<'1234'>;\n//=> 1234\n\ntype NegativeInt = StringToNumber<'-1234'>;\n//=> -1234\n\ntype PositiveFloat = StringToNumber<'1234.56'>;\n//=> 1234.56\n\ntype NegativeFloat = StringToNumber<'-1234.56'>;\n//=> -1234.56\n\ntype PositiveInfinity = StringToNumber<'Infinity'>;\n//=> Infinity\n\ntype NegativeInfinity = StringToNumber<'-Infinity'>;\n//=> -Infinity\n```\n\n@category String\n@category Numeric\n@category Template literal\n*/\nexport type StringToNumber<S extends string> = S extends `${infer N extends number}`\n\t? N\n\t: S extends 'Infinity'\n\t\t? PositiveInfinity\n\t\t: S extends '-Infinity'\n\t\t\t? NegativeInfinity\n\t\t\t: never;\n\n/**\nReturns a boolean for whether the given string `S` starts with the given string `SearchString`.\n\n@example\n```\ntype A = StartsWith<'abcde', 'abc'>;\n//=> true\n\ntype B = StartsWith<'abcde', 'bc'>;\n//=> false\n\ntype C = StartsWith<string, 'bc'>;\n//=> never\n\ntype D = StartsWith<'abcde', string>;\n//=> never\n```\n\n@category String\n@category Template literal\n*/\nexport type StartsWith<S extends string, SearchString extends string> = string extends S | SearchString\n\t? never\n\t: S extends `${SearchString}${infer T}`\n\t\t? true\n\t\t: false;\n\n/**\nReturns an array of the characters of the string.\n\n@example\n```\ntype A = StringToArray<'abcde'>;\n//=> ['a', 'b', 'c', 'd', 'e']\n\ntype B = StringToArray<string>;\n//=> never\n```\n\n@category String\n*/\nexport type StringToArray<S extends string, Result extends string[] = []> = string extends S\n\t? never\n\t: S extends `${infer F}${infer R}`\n\t\t? StringToArray<R, [...Result, F]>\n\t\t: Result;\n\n/**\nReturns the length of the given string.\n\n@example\n```\ntype A = StringLength<'abcde'>;\n//=> 5\n\ntype B = StringLength<string>;\n//=> never\n```\n\n@category String\n@category Template literal\n*/\nexport type StringLength<S extends string> = string extends S\n\t? never\n\t: StringToArray<S>['length'];\n\n/**\nReturns a boolean for whether a string is whitespace.\n*/\nexport type IsWhitespace<T extends string> = T extends Whitespace\n\t? true\n\t: T extends `${Whitespace}${infer Rest}`\n\t\t? IsWhitespace<Rest>\n\t\t: false;\n\n/**\nReturns a boolean for whether the string is numeric.\n\nThis type is a workaround for [Microsoft/TypeScript#46109](https://github.com/microsoft/TypeScript/issues/46109#issuecomment-930307987).\n*/\nexport type IsNumeric<T extends string> = T extends `${number}`\n\t? Trim<T> extends T\n\t\t? true\n\t\t: false\n\t: false;\n\n/**\nReturns a boolean for whether `A` represents a number greater than `B`, where `A` and `B` are both numeric strings and have the same length.\n\n@example\n```\ntype A = SameLengthPositiveNumericStringGt<'50', '10'>;\n//=> true\n\ntype B = SameLengthPositiveNumericStringGt<'10', '10'>;\n//=> false\n```\n*/\ntype SameLengthPositiveNumericStringGt<A extends string, B extends string> = A extends `${infer FirstA}${infer RestA}`\n\t? B extends `${infer FirstB}${infer RestB}`\n\t\t? FirstA extends FirstB\n\t\t\t? SameLengthPositiveNumericStringGt<RestA, RestB>\n\t\t\t: PositiveNumericCharacterGt<FirstA, FirstB>\n\t\t: never\n\t: false;\n\ntype NumericString = '0123456789';\n\n/**\nReturns a boolean for whether `A` is greater than `B`, where `A` and `B` are both positive numeric strings.\n\n@example\n```\ntype A = PositiveNumericStringGt<'500', '1'>;\n//=> true\n\ntype B = PositiveNumericStringGt<'1', '1'>;\n//=> false\n\ntype C = PositiveNumericStringGt<'1', '500'>;\n//=> false\n```\n*/\nexport type PositiveNumericStringGt<A extends string, B extends string> = A extends B\n\t? false\n\t: [TupleOf<StringLength<A>, 0>, TupleOf<StringLength<B>, 0>] extends infer R extends [readonly unknown[], readonly unknown[]]\n\t\t? R[0] extends [...R[1], ...infer Remain extends readonly unknown[]]\n\t\t\t? 0 extends Remain['length']\n\t\t\t\t? SameLengthPositiveNumericStringGt<A, B>\n\t\t\t\t: true\n\t\t\t: false\n\t\t: never;\n\n/**\nReturns a boolean for whether `A` represents a number greater than `B`, where `A` and `B` are both positive numeric characters.\n\n@example\n```\ntype A = PositiveNumericCharacterGt<'5', '1'>;\n//=> true\n\ntype B = PositiveNumericCharacterGt<'1', '1'>;\n//=> false\n```\n*/\ntype PositiveNumericCharacterGt<A extends string, B extends string> = NumericString extends `${infer HeadA}${A}${infer TailA}`\n\t? NumericString extends `${infer HeadB}${B}${infer TailB}`\n\t\t? HeadA extends `${HeadB}${infer _}${infer __}`\n\t\t\t? true\n\t\t\t: false\n\t\t: never\n\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/internal/tuple.d.ts",
    "content": "import type {GreaterThan} from '../greater-than.d.ts';\nimport type {LessThan} from '../less-than.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../numeric.d.ts';\nimport type {UnknownArray} from '../unknown-array.d.ts';\n\n/**\nInfer the length of the given tuple `<T>`.\n\nReturns `never` if the given type is an non-fixed-length array like `Array<string>`.\n\n@example\n```\ntype Tuple = TupleLength<[string, number, boolean]>;\n//=> 3\n\ntype Array = TupleLength<string[]>;\n//=> never\n\n// Supports union types.\ntype Union = TupleLength<[] | [1, 2, 3] | number[]>;\n//=> 1 | 3\n```\n*/\nexport type TupleLength<T extends UnknownArray> =\n\t// `extends unknown` is used to convert `T` (if `T` is a union type) to\n\t// a [distributive conditional type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types))\n\tT extends unknown\n\t\t? number extends T['length']\n\t\t\t? never // Return never if the given type is an non-flexed-length array like `Array<string>`\n\t\t\t: T['length']\n\t\t: never; // Should never happen\n\n/**\nReturns the maximum value from a tuple of integers.\n\nNote:\n- Float numbers are not supported.\n\n@example\n```\ntype A = TupleMax<[1, 2, 5, 3]>;\n//=> 5\n\ntype B = TupleMax<[1, 2, 5, 3, 99, -1]>;\n//=> 99\n```\n*/\nexport type TupleMax<A extends number[], Result extends number = NegativeInfinity> = number extends A[number]\n\t? never :\n\tA extends [infer F extends number, ...infer R extends number[]]\n\t\t? GreaterThan<F, Result> extends true\n\t\t\t? TupleMax<R, F>\n\t\t\t: TupleMax<R, Result>\n\t\t: Result;\n\n/**\nReturns the minimum value from a tuple of integers.\n\nNote:\n- Float numbers are not supported.\n\n@example\n```\ntype A = TupleMin<[1, 2, 5, 3]>;\n//=> 1\n\ntype B = TupleMin<[1, 2, 5, 3, -5]>;\n//=> -5\n```\n*/\nexport type TupleMin<A extends number[], Result extends number = PositiveInfinity> = number extends A[number]\n\t? never\n\t: A extends [infer F extends number, ...infer R extends number[]]\n\t\t? LessThan<F, Result> extends true\n\t\t\t? TupleMin<R, F>\n\t\t\t: TupleMin<R, Result>\n\t\t: Result;\n\nexport {};\n"
  },
  {
    "path": "source/internal/type.d.ts",
    "content": "import type {If} from '../if.d.ts';\nimport type {IsAny} from '../is-any.d.ts';\nimport type {IsNever} from '../is-never.d.ts';\nimport type {Primitive} from '../primitive.d.ts';\nimport type {UnknownArray} from '../unknown-array.d.ts';\nimport type {UnionToIntersection} from '../union-to-intersection.d.ts';\n\n/**\nMatches any primitive, `void`, `Date`, or `RegExp` value.\n*/\nexport type BuiltIns = Primitive | void | Date | RegExp;\n\n/**\nMatches non-recursive types.\n*/\nexport type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown) | Promise<unknown>;\n\n/**\nMatches maps, sets, or arrays.\n*/\nexport type MapsSetsOrArrays = ReadonlyMap<unknown, unknown> | WeakMap<WeakKey, unknown> | ReadonlySet<unknown> | WeakSet<WeakKey> | UnknownArray;\n\n/**\nReturns a boolean for whether the two given types extends the base type.\n*/\nexport type IsBothExtends<BaseType, FirstType, SecondType> = FirstType extends BaseType\n\t? SecondType extends BaseType\n\t\t? true\n\t\t: false\n\t: false;\n\n/**\nTest if the given function has multiple call signatures.\n\nNeeded to handle the case of a single call signature with properties.\n\nMultiple call signatures cannot currently be supported due to a TypeScript limitation.\n@see https://github.com/microsoft/TypeScript/issues/29732\n*/\nexport type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> =\n\tT extends {(...arguments_: infer A): unknown; (...arguments_: infer B): unknown}\n\t\t? B extends A\n\t\t\t? A extends B\n\t\t\t\t? false\n\t\t\t\t: true\n\t\t\t: true\n\t\t: false;\n\n/**\nReturns a boolean for whether the given `boolean` is not `false`.\n*/\nexport type IsNotFalse<T extends boolean> = [T] extends [false] ? false : true;\n\n/**\nReturns a boolean for whether the given type is primitive value or primitive type.\n\n@example\n```\ntype A = IsPrimitive<'string'>;\n//=> true\n\ntype B = IsPrimitive<string>;\n//=> true\n\ntype C = IsPrimitive<Object>;\n//=> false\n```\n*/\nexport type IsPrimitive<T> = [T] extends [Primitive] ? true : false;\n\n/**\nReturns a boolean for whether A is false.\n\n@example\n```\ntype A = Not<true>;\n//=> false\n\ntype B = Not<false>;\n//=> true\n```\n*/\nexport type Not<A extends boolean> = A extends true\n\t? false\n\t: A extends false\n\t\t? true\n\t\t: never;\n\n/**\nAn if-else-like type that resolves depending on whether the given type is `any` or `never`.\n\n@example\n```\n// When `T` is a NOT `any` or `never` (like `string`) => Returns `IfNotAnyOrNever` branch\ntype A = IfNotAnyOrNever<string, 'VALID', 'IS_ANY', 'IS_NEVER'>;\n//=> 'VALID'\n\n// When `T` is `any` => Returns `IfAny` branch\ntype B = IfNotAnyOrNever<any, 'VALID', 'IS_ANY', 'IS_NEVER'>;\n//=> 'IS_ANY'\n\n// When `T` is `never` => Returns `IfNever` branch\ntype C = IfNotAnyOrNever<never, 'VALID', 'IS_ANY', 'IS_NEVER'>;\n//=> 'IS_NEVER'\n```\n\nNote: Wrapping a tail-recursive type with `IfNotAnyOrNever` makes the implementation non-tail-recursive. To fix this, move the recursion into a helper type. Refer to the following example:\n\n@example\n```ts\nimport type {StringRepeat} from 'type-fest';\n\ntype NineHundredNinetyNineSpaces = StringRepeat<' ', 999>;\n\n// The following implementation is not tail recursive\ntype TrimLeft<S extends string> = IfNotAnyOrNever<S, S extends ` ${infer R}` ? TrimLeft<R> : S>;\n\n// Hence, instantiations with long strings will fail\n// @ts-expect-error\ntype T1 = TrimLeft<NineHundredNinetyNineSpaces>;\n//        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n// Error: Type instantiation is excessively deep and possibly infinite.\n\n// To fix this, move the recursion into a helper type\ntype TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, _TrimLeftOptimised<S>>;\n\ntype _TrimLeftOptimised<S extends string> = S extends ` ${infer R}` ? _TrimLeftOptimised<R> : S;\n\ntype T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;\n//=> ''\n```\n*/\nexport type IfNotAnyOrNever<T, IfNotAnyOrNever, IfAny = any, IfNever = never> =\n\tIf<IsAny<T>, IfAny, If<IsNever<T>, IfNever, IfNotAnyOrNever>>;\n\n/**\nReturns a boolean for whether the given type is `any` or `never`.\n\nThis type can be better to use than {@link IfNotAnyOrNever `IfNotAnyOrNever`} in recursive types because it does not evaluate any branches.\n\n@example\n```\n// When `T` is a NOT `any` or `never` (like `string`) => Returns `false`\ntype A = IsAnyOrNever<string>;\n//=> false\n\n// When `T` is `any` => Returns `true`\ntype B = IsAnyOrNever<any>;\n//=> true\n\n// When `T` is `never` => Returns `true`\ntype C = IsAnyOrNever<never>;\n//=> true\n```\n*/\nexport type IsAnyOrNever<T> = IsNotFalse<IsAny<T> | IsNever<T>>;\n\n/**\nIndicates the value of `exactOptionalPropertyTypes` compiler option.\n*/\nexport type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?]\n\t? false\n\t: true;\n\nexport {};\n"
  },
  {
    "path": "source/invariant-of.d.ts",
    "content": "declare const invariantBrand: unique symbol;\n\n/**\nCreate an [invariant type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance), which is a type that does not accept supertypes and subtypes.\n\nUse-case:\n- Prevent runtime errors that may occur due to assigning subtypes to supertypes.\n- Improve type signature of object methods like [`Object.keys()` or `Object.entries()`](https://github.com/microsoft/TypeScript/pull/12253#issuecomment-263132208) by sealing the object type.\n\n@example\n```\nimport type {InvariantOf} from 'type-fest';\n\nclass Animal {\n\tconstructor(public name: string) {}\n}\n\nclass Cat extends Animal {\n\tmeow() {\n\t\t// do something\n\t}\n}\n\nlet animalArray: Animal[] = [new Animal('jerry')];\nconst catArray: Cat[] = [new Cat('tom')];\n\nanimalArray = catArray; // Okay if covariant\nanimalArray.push(new Animal('another animal')); // Pushed an animal into catArray\nfor (const c of catArray) {\n\tc.meow();\n} // Allowed but, error at runtime\n\nlet invariantAnimalArray: Array<InvariantOf<Animal>> = [new Animal('jerry')] as Array<InvariantOf<Animal>>;\nconst invariantCatArray: Array<InvariantOf<Cat>> = [new Cat('tom')] as Array<InvariantOf<Cat>>;\n\n// @ts-expect-error\ninvariantAnimalArray = invariantCatArray; // Error: Type 'InvariantOf<Cat>[]' is not assignable to type 'InvariantOf<Animal>[]'.\n```\n\n@example\n```\nimport type {InvariantOf} from 'type-fest';\n\n// In covariance (default)\n\ntype FooBar = {\n\tfoo: number;\n\tbar: string;\n};\n\ntype FooBarBaz = {\n\tbaz: boolean;\n} & FooBar;\n\ndeclare const fooBar: FooBar;\ndeclare const fooBarBaz: FooBarBaz;\n\nfunction keyOfFooBar(fooBar: FooBar) {\n\treturn Object.keys(fooBar) as Array<keyof FooBar>;\n}\n\nkeyOfFooBar(fooBar); //=> (keyof FooBar)[]\nkeyOfFooBar(fooBarBaz); //=> (keyof FooBar)[] but, (keyof FooBarBaz)[] at runtime\n\n// In invariance\n\nexport function invariantOf<Type>(value: Type): InvariantOf<Type> {\n\treturn value as InvariantOf<Type>;\n}\n\nfunction keyOfInvariantFooBar(fooBar: InvariantOf<FooBar>) {\n\treturn Object.keys(fooBar) as Array<keyof FooBar>;\n}\n\nkeyOfInvariantFooBar(invariantOf(fooBar)); // (keyof FooBar)[]\n\n// @ts-expect-error\nkeyOfInvariantFooBar(invariantOf(fooBarBaz)); // Error: Argument of type 'InvariantOf<FooBarBaz>' is not assignable to parameter of type 'InvariantOf<FooBar>'.\n```\n\n@category Type\n*/\nexport type InvariantOf<Type> = Type & {[invariantBrand]: (_: Type) => Type};\n\nexport {};\n"
  },
  {
    "path": "source/is-any.d.ts",
    "content": "/**\nReturns a boolean for whether the given type is `any`.\n\n@link https://stackoverflow.com/a/49928360/1490091\n\nUseful in type utilities, such as disallowing `any`s to be passed to a function.\n\n@example\n```\nimport type {IsAny} from 'type-fest';\n\nconst typedObject = {a: 1, b: 2} as const;\nconst anyObject: any = {a: 1, b: 2};\n\nfunction get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {\n\treturn object[key];\n}\n\nconst typedA = get(typedObject, 'a');\n//=> 1\n\nconst anyA = get(anyObject, 'a');\n//=> any\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;\n\nexport {};\n"
  },
  {
    "path": "source/is-equal.d.ts",
    "content": "/**\nReturns a boolean for whether the two given types are equal.\n\n@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650\n@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796\n\nUse-cases:\n- If you want to make a conditional branch based on the result of a comparison of two types.\n\n@example\n```\nimport type {IsEqual} from 'type-fest';\n\n// This type returns a boolean for whether the given array includes the given item.\n// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.\ntype Includes<Value extends readonly any[], Item> =\n\tValue extends readonly [Value[0], ...infer rest]\n\t\t? IsEqual<Value[0], Item> extends true\n\t\t\t? true\n\t\t\t: Includes<rest, Item>\n\t\t: false;\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsEqual<A, B> =\n\t[A] extends [B]\n\t\t? [B] extends [A]\n\t\t\t? _IsEqual<A, B>\n\t\t\t: false\n\t\t: false;\n\n// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.\ntype _IsEqual<A, B> =\n\t(<G>() => G extends A & G | G ? 1 : 2) extends\n\t(<G>() => G extends B & G | G ? 1 : 2)\n\t\t? true\n\t\t: false;\n\nexport {};\n"
  },
  {
    "path": "source/is-float.d.ts",
    "content": "/**\nReturns a boolean for whether the given number is a float, like `1.5` or `-1.5`.\n\nUse-case:\n- If you want to make a conditional branch based on the result of whether a number is a float or not.\n\n@example\n```\nimport type {IsFloat, PositiveInfinity} from 'type-fest';\n\ntype A = IsFloat<1.5>;\n//=> true\n\ntype B = IsFloat<-1.5>;\n//=> true\n\ntype C = IsFloat<1e-7>;\n//=> true\n\ntype D = IsFloat<1.0>;\n//=> false\n\ntype E = IsFloat<PositiveInfinity>;\n//=> false\n\ntype F = IsFloat<1.23e+21>;\n//=> false\n```\n\n@category Type Guard\n@category Numeric\n*/\nexport type IsFloat<T> = T extends number\n\t? `${T}` extends `${number}e${infer E extends '-' | '+'}${number}`\n\t\t? E extends '-'\n\t\t\t? true\n\t\t\t: false\n\t\t: `${T}` extends `${number}.${number}`\n\t\t\t? true\n\t\t\t: false\n\t: false;\n\nexport {};\n"
  },
  {
    "path": "source/is-integer.d.ts",
    "content": "import type {Not} from './internal/index.d.ts';\nimport type {IsFloat} from './is-float.d.ts';\nimport type {PositiveInfinity, NegativeInfinity} from './numeric.d.ts';\n\n/**\nReturns a boolean for whether the given number is an integer, like `-5`, `1.0`, or `100`.\n\nUse-case:\n- If you want to make a conditional branch based on the result of whether a number is an integer or not.\n\n@example\n```\nimport type {IsInteger, PositiveInfinity} from 'type-fest';\n\ntype A = IsInteger<1>;\n//=> true\n\ntype B = IsInteger<1.0>;\n//=> true\n\ntype C = IsInteger<-1>;\n//=> true\n\ntype D = IsInteger<0b10>;\n//=> true\n\ntype E = IsInteger<0o10>;\n//=> true\n\ntype F = IsInteger<0x10>;\n//=> true\n\ntype G = IsInteger<1.23e+21>;\n//=> true\n\ntype H = IsInteger<1.5>;\n//=> false\n\ntype I = IsInteger<PositiveInfinity>;\n//=> false\n\ntype J = IsInteger<1e-7>;\n//=> false\n```\n\n@category Type Guard\n@category Numeric\n*/\nexport type IsInteger<T> =\nT extends bigint\n\t? true\n\t: T extends number\n\t\t? number extends T\n\t\t\t? false\n\t\t\t: T extends PositiveInfinity | NegativeInfinity\n\t\t\t\t? false\n\t\t\t\t: Not<IsFloat<T>>\n\t\t: false;\n\nexport {};\n"
  },
  {
    "path": "source/is-literal.d.ts",
    "content": "import type {Primitive} from './primitive.d.ts';\nimport type {_Numeric} from './numeric.d.ts';\nimport type {CollapseLiterals, IfNotAnyOrNever, IsNotFalse, IsPrimitive} from './internal/index.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {TagContainer, UnwrapTagged} from './tagged.d.ts';\n\n/**\nReturns a boolean for whether the given type `T` is the specified `LiteralType`.\n\n@link https://stackoverflow.com/a/52806744/10292952\n\n@example\n```\ntype A = LiteralCheck<1, number>;\n//=> true\n\ntype B = LiteralCheck<number, number>;\n//=> false\n\ntype C = LiteralCheck<1, string>;\n//=> false\n```\n*/\ntype LiteralCheck<T, LiteralType extends Primitive> = (\n\tIsNever<T> extends false // Must be wider than `never`\n\t\t? [T] extends [LiteralType & infer U] // Remove any branding\n\t\t\t? [U] extends [LiteralType] // Must be narrower than `LiteralType`\n\t\t\t\t? [LiteralType] extends [U] // Cannot be wider than `LiteralType`\n\t\t\t\t\t? false\n\t\t\t\t\t: true\n\t\t\t\t: false\n\t\t\t: false\n\t\t: false\n);\n\n/**\nReturns a boolean for whether the given type `T` is one of the specified literal types in `LiteralUnionType`.\n\n@example\n```\ntype A = LiteralChecks<1, Numeric>;\n//=> true\n\ntype B = LiteralChecks<1n, Numeric>;\n//=> true\n\ntype C = LiteralChecks<bigint, Numeric>;\n//=> false\n```\n*/\ntype LiteralChecks<T, LiteralUnionType> = (\n\t// Conditional type to force union distribution.\n\t// If `T` is none of the literal types in the union `LiteralUnionType`, then `LiteralCheck<T, LiteralType>` will evaluate to `false` for the whole union.\n\t// If `T` is one of the literal types in the union, it will evaluate to `boolean` (i.e. `true | false`)\n\tIsNotFalse<LiteralUnionType extends Primitive\n\t\t? LiteralCheck<T, LiteralUnionType>\n\t\t: never\n\t>\n);\n\n/**\nReturns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n\nUseful for:\n\t- providing strongly-typed string manipulation functions\n\t- constraining strings to be a string literal\n\t- type utilities, such as when constructing parsers and ASTs\n\nThe implementation of this type is inspired by the trick mentioned in this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).\n\n@example\n```\nimport type {IsStringLiteral} from 'type-fest';\n\ntype CapitalizedString<T extends string> = IsStringLiteral<T> extends true ? Capitalize<T> : string;\n\n// https://github.com/yankeeinlondon/native-dash/blob/master/src/capitalize.ts\nfunction capitalize<T extends Readonly<string>>(input: T): CapitalizedString<T> {\n\treturn (input.slice(0, 1).toUpperCase() + input.slice(1)) as CapitalizedString<T>;\n}\n\nconst output = capitalize('hello, world!');\n//=> 'Hello, world!'\n```\n\n@example\n```\n// String types with infinite set of possible values return `false`.\n\nimport type {IsStringLiteral} from 'type-fest';\n\ntype AllUppercaseStrings = IsStringLiteral<Uppercase<string>>;\n//=> false\n\ntype StringsStartingWithOn = IsStringLiteral<`on${string}`>;\n//=> false\n\n// This behaviour is particularly useful in string manipulation utilities, as infinite string types often require separate handling.\n\ntype Length<S extends string, Counter extends never[] = []> =\n\tIsStringLiteral<S> extends false\n\t\t? number // return `number` for infinite string types\n\t\t: S extends `${string}${infer Tail}`\n\t\t\t? Length<Tail, [...Counter, never]>\n\t\t\t: Counter['length'];\n\ntype L1 = Length<Lowercase<string>>;\n//=> number\n\ntype L2 = Length<`${number}`>;\n//=> number\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsStringLiteral<S> = IfNotAnyOrNever<S,\n\t_IsStringLiteral<CollapseLiterals<S extends TagContainer<any> ? UnwrapTagged<S> : S>>,\n\tfalse, false>;\n\nexport type _IsStringLiteral<S> =\n// If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,\n// and since `{}` extends index signatures, the result becomes `false`.\nS extends string\n\t? {} extends Record<S, never>\n\t\t? false\n\t\t: true\n\t: false;\n\n/**\nReturns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n\nUseful for:\n\t- providing strongly-typed functions when given literal arguments\n\t- type utilities, such as when constructing parsers and ASTs\n\n@example\n```\nimport type {IsNumericLiteral, IsStringLiteral} from 'type-fest';\n\n// https://github.com/inocan-group/inferred-types/blob/master/modules/types/src/boolean-logic/operators/EndsWith.ts\ntype EndsWith<TValue, TEndsWith extends string> =\n\tTValue extends string\n\t\t? IsStringLiteral<TEndsWith> extends true\n\t\t\t? IsStringLiteral<TValue> extends true\n\t\t\t\t? TValue extends `${string}${TEndsWith}`\n\t\t\t\t\t? true\n\t\t\t\t\t: false\n\t\t\t\t: boolean\n\t\t\t: boolean\n\t\t: TValue extends number\n\t\t\t? IsNumericLiteral<TValue> extends true\n\t\t\t\t? EndsWith<`${TValue}`, TEndsWith>\n\t\t\t\t: false\n\t\t\t: false;\n\nfunction endsWith<Input extends string | number, End extends string>(input: Input, end: End) {\n\treturn `${input}`.endsWith(end) as EndsWith<Input, End>;\n}\n\nendsWith('abc', 'c');\n//=> true\n\nendsWith(123_456, '456');\n//=> true\n\nconst end = '123' as string;\n\nendsWith('abc123', end);\n//=> boolean\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsNumericLiteral<T> = LiteralChecks<T, _Numeric>;\n\n/**\nReturns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n\nUseful for:\n\t- providing strongly-typed functions when given literal arguments\n\t- type utilities, such as when constructing parsers and ASTs\n\n@example\n```\nimport type {IsBooleanLiteral} from 'type-fest';\n\nconst id = 123;\n\ntype GetId<AsString extends boolean> =\n\tIsBooleanLiteral<AsString> extends true\n\t\t? AsString extends true\n\t\t\t? `${typeof id}`\n\t\t\t: typeof id\n\t\t: number | string;\n\nfunction getId<AsString extends boolean = false>(options?: {asString: AsString}) {\n\treturn (options?.asString ? `${id}` : id) as GetId<AsString>;\n}\n\nconst numberId = getId();\n//=> 123\n\nconst stringId = getId({asString: true});\n//=> '123'\n\ndeclare const runtimeBoolean: boolean;\nconst eitherId = getId({asString: runtimeBoolean});\n//=> string | number\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsBooleanLiteral<T> = LiteralCheck<T, boolean>;\n\n/**\nReturns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n\nUseful for:\n\t- providing strongly-typed functions when given literal arguments\n\t- type utilities, such as when constructing parsers and ASTs\n\n@example\n```\nimport type {IsSymbolLiteral} from 'type-fest';\n\ntype Get<Object_ extends Record<symbol, number>, Key extends keyof Object_> =\n\tIsSymbolLiteral<Key> extends true\n\t\t? Object_[Key]\n\t\t: number;\n\nfunction get<Object_ extends Record<symbol, number>, Key extends keyof Object_>(o: Object_, key: Key) {\n\treturn o[key] as Get<Object_, Key>;\n}\n\nconst symbolLiteral = Symbol('literal');\nlet symbolValue = Symbol('value1');\nsymbolValue = Symbol('value2');\n\nget({[symbolLiteral]: 1} as const, symbolLiteral);\n//=> 1\n\nget({[symbolValue]: 1} as const, symbolValue);\n//=> number\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsSymbolLiteral<T> = LiteralCheck<T, symbol>;\n\n/** Helper type for `IsLiteral`. */\ntype IsLiteralUnion<T> =\n\t| IsStringLiteral<T>\n\t| IsNumericLiteral<T>\n\t| IsBooleanLiteral<T>\n\t| IsSymbolLiteral<T>;\n\n/**\nReturns a boolean for whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n\nUseful for:\n\t- providing strongly-typed functions when given literal arguments\n\t- type utilities, such as when constructing parsers and ASTs\n\n@example\n```\nimport type {IsLiteral} from 'type-fest';\n\ntype A = IsLiteral<1>;\n//=> true\n\ntype B = IsLiteral<number>;\n//=> false\n\ntype C = IsLiteral<1n>;\n//=> true\n\ntype D = IsLiteral<bigint>;\n//=> false\n\ntype E = IsLiteral<'type-fest'>;\n//=> true\n\ntype F = IsLiteral<string>;\n//=> false\n\ntype G = IsLiteral<`on${string}`>;\n//=> false\n\ndeclare const symbolLiteral: unique symbol;\ntype H = IsLiteral<typeof symbolLiteral>;\n//=> true\n\ntype I = IsLiteral<symbol>;\n//=> false\n\ntype J = IsLiteral<true>;\n//=> true\n\ntype K = IsLiteral<boolean>;\n//=> false\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsLiteral<T> =\n\tIsPrimitive<T> extends true\n\t\t? IsNotFalse<IsLiteralUnion<T>>\n\t\t: false;\n\nexport {};\n"
  },
  {
    "path": "source/is-lowercase.d.ts",
    "content": "import type {AllExtend} from './all-extend.d.ts';\n\n/**\nReturns a boolean for whether the given string literal is lowercase.\n\n@example\n```\nimport type {IsLowercase} from 'type-fest';\n\ntype A = IsLowercase<'abc'>;\n//=> true\n\ntype B = IsLowercase<'Abc'>;\n//=> false\n\ntype C = IsLowercase<string>;\n//=> boolean\n```\n*/\nexport type IsLowercase<S extends string> = AllExtend<_IsLowercase<S>, true>;\n\n/**\nLoops through each part in the string and returns a boolean array indicating whether each part is lowercase.\n*/\ntype _IsLowercase<S extends string, Accumulator extends boolean[] = []> = S extends `${infer First}${infer Rest}`\n\t? _IsLowercase<Rest, [...Accumulator, IsLowercaseHelper<First>]>\n\t: [...Accumulator, IsLowercaseHelper<S>];\n\n/**\nReturns a boolean for whether an individual part of the string is lowercase.\n*/\ntype IsLowercaseHelper<S extends string> = S extends Lowercase<string>\n\t? true\n\t: S extends Uppercase<string> | Capitalize<string> | `${string}${Uppercase<string>}${string}`\n\t\t? false\n\t\t: boolean;\n\nexport {};\n"
  },
  {
    "path": "source/is-never.d.ts",
    "content": "/**\nReturns a boolean for whether the given type is `never`.\n\n@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919\n@link https://stackoverflow.com/a/53984913/10292952\n@link https://www.zhenghao.io/posts/ts-never\n\nUseful in type utilities, such as checking if something does not occur.\n\n@example\n```\nimport type {IsNever, And} from 'type-fest';\n\ntype A = IsNever<never>;\n//=> true\n\ntype B = IsNever<any>;\n//=> false\n\ntype C = IsNever<unknown>;\n//=> false\n\ntype D = IsNever<never[]>;\n//=> false\n\ntype E = IsNever<object>;\n//=> false\n\ntype F = IsNever<string>;\n//=> false\n```\n\n@example\n```\nimport type {IsNever} from 'type-fest';\n\ntype IsTrue<T> = T extends true ? true : false;\n\n// When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.\ntype A = IsTrue<never>;\n//=> never\n\n// If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.\ntype IsTrueFixed<T> =\n\tIsNever<T> extends true ? false : T extends true ? true : false;\n\ntype B = IsTrueFixed<never>;\n//=> false\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsNever<T> = [T] extends [never] ? true : false;\n\nexport {};\n"
  },
  {
    "path": "source/is-null.d.ts",
    "content": "/**\nReturns a boolean for whether the given type is `null`.\n\n@example\n```\nimport type {IsNull} from 'type-fest';\n\ntype NonNullFallback<T, Fallback> = IsNull<T> extends true ? Fallback : T;\n\ntype Example1 = NonNullFallback<null, string>;\n//=> string\n\ntype Example2 = NonNullFallback<number, string>;\n//=> number\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsNull<T> = [T] extends [null] ? true : false;\n\nexport {};\n"
  },
  {
    "path": "source/is-nullable.d.ts",
    "content": "import type {IsAny} from './is-any.d.ts';\n\n/**\nReturns a boolean for whether the given type includes `null`.\n\nNote: The built-in `NonNullable` type removes both `null` and `undefined`, which is not accurate for the name.\n\n@example\n```ts\nimport type {IsNullable} from 'type-fest';\n\ntype A = IsNullable<string>;\n//=> false\n\ntype B = IsNullable<string | null>;\n//=> true\n\ntype C = IsNullable<string | undefined>;\n//=> false\n\ntype D = IsNullable<string | null | undefined>;\n//=> true\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsNullable<T> = IsAny<T> extends true ? true : Extract<T, null> extends never ? false : true;\n\nexport {};\n"
  },
  {
    "path": "source/is-optional-key-of.d.ts",
    "content": "import type {IsAny} from './is-any.d.ts';\n\n/**\nReturns a boolean for whether the given key is an optional key of type.\n\nThis is useful when writing utility types or schema validators that need to differentiate `optional` keys.\n\n@example\n```\nimport type {IsOptionalKeyOf} from 'type-fest';\n\ntype User = {\n\tname: string;\n\tsurname: string;\n\n\tluckyNumber?: number;\n};\n\ntype Admin = {\n\tname: string;\n\tsurname?: string;\n};\n\ntype T1 = IsOptionalKeyOf<User, 'luckyNumber'>;\n//=> true\n\ntype T2 = IsOptionalKeyOf<User, 'name'>;\n//=> false\n\ntype T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;\n//=> boolean\n\ntype T4 = IsOptionalKeyOf<User | Admin, 'name'>;\n//=> false\n\ntype T5 = IsOptionalKeyOf<User | Admin, 'surname'>;\n//=> boolean\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsOptionalKeyOf<Type extends object, Key extends keyof Type> =\n\tIsAny<Type | Key> extends true ? never\n\t\t: Key extends keyof Type\n\t\t\t? Type extends Record<Key, Type[Key]>\n\t\t\t\t? false\n\t\t\t\t: true\n\t\t\t: false;\n\nexport {};\n"
  },
  {
    "path": "source/is-optional.d.ts",
    "content": "import type {IsAny} from './is-any.d.ts';\n\n/**\nReturns a boolean for whether the given type includes `undefined`.\n\n@example\n```ts\nimport type {IsOptional} from 'type-fest';\n\ntype A = IsOptional<string>;\n//=> false\n\ntype B = IsOptional<string | undefined>;\n//=> true\n\ntype C = IsOptional<string | null>;\n//=> false\n\ntype D = IsOptional<string | null | undefined>;\n//=> true\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsOptional<T> = IsAny<T> extends true ? true : Extract<T, undefined> extends never ? false : true;\n\nexport {};\n"
  },
  {
    "path": "source/is-readonly-key-of.d.ts",
    "content": "import type {IsEqual} from './is-equal.d.ts';\nimport type {IsAny} from './is-any.d.ts';\n\n/**\nReturns a boolean for whether the given key is a readonly key of type.\n\nThis is useful when writing utility types or schema validators that need to differentiate `readonly` keys.\n\n@example\n```\nimport type {IsReadonlyKeyOf} from 'type-fest';\n\ntype User = {\n\tname: string;\n\tsurname: string;\n\n\treadonly id: number;\n};\n\ntype Admin = {\n\tname: string;\n\tid: string;\n};\n\ntype T1 = IsReadonlyKeyOf<User, 'id'>;\n//=> true\n\ntype T2 = IsReadonlyKeyOf<User, 'name'>;\n//=> false\n\ntype T3 = IsReadonlyKeyOf<User, 'name' | 'id'>;\n//=> boolean\n\ntype T4 = IsReadonlyKeyOf<User | Admin, 'name'>;\n//=> false\n\ntype T5 = IsReadonlyKeyOf<User | Admin, 'id'>;\n//=> boolean\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsReadonlyKeyOf<Type extends object, Key extends keyof Type> =\n\tIsAny<Type | Key> extends true ? never\n\t\t: Key extends unknown // For distributing `Key`\n\t\t\t? Type extends unknown // For distributing `Type`\n\t\t\t\t? IsEqual<\n\t\t\t\t\t{[K in Key]: Type[Key]},\n\t\t\t\t\t{readonly [K in Key]: Type[Key]}\n\t\t\t\t>\n\t\t\t\t: never // Should never happen\n\t\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/is-required-key-of.d.ts",
    "content": "import type {IsOptionalKeyOf} from './is-optional-key-of.d.ts';\nimport type {Not} from './internal/type.d.ts';\nimport type {IsAny} from './is-any.d.ts';\n\n/**\nReturns a boolean for whether the given key is a required key of type.\n\nThis is useful when writing utility types or schema validators that need to differentiate `required` keys.\n\n@example\n```\nimport type {IsRequiredKeyOf} from 'type-fest';\n\ntype User = {\n\tname: string;\n\tsurname: string;\n\n\tluckyNumber?: number;\n};\n\ntype Admin = {\n\tname: string;\n\tsurname?: string;\n};\n\ntype T1 = IsRequiredKeyOf<User, 'name'>;\n//=> true\n\ntype T2 = IsRequiredKeyOf<User, 'luckyNumber'>;\n//=> false\n\ntype T3 = IsRequiredKeyOf<User, 'name' | 'luckyNumber'>;\n//=> boolean\n\ntype T4 = IsRequiredKeyOf<User | Admin, 'name'>;\n//=> true\n\ntype T5 = IsRequiredKeyOf<User | Admin, 'surname'>;\n//=> boolean\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsRequiredKeyOf<Type extends object, Key extends keyof Type> =\n\tIsAny<Type | Key> extends true ? never\n\t\t: Key extends keyof Type\n\t\t\t? Not<IsOptionalKeyOf<Type, Key>>\n\t\t\t: false;\n\nexport {};\n"
  },
  {
    "path": "source/is-tuple.d.ts",
    "content": "import type {If} from './if.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\n@see {@link IsTuple}\n*/\nexport type IsTupleOptions = {\n\t/**\n\tConsider only fixed length arrays as tuples.\n\n\t- When set to `true` (default), arrays with rest elements (e.g., `[1, ...number[]]`) are _not_ considered as tuples.\n\t- When set to `false`, arrays with at least one non-rest element (e.g., `[1, ...number[]]`) are considered as tuples.\n\n\t@default true\n\n\t@example\n\t```ts\n\timport type {IsTuple} from 'type-fest';\n\n\ttype Example1 = IsTuple<[number, ...number[]], {fixedLengthOnly: true}>;\n\t//=> false\n\n\ttype Example2 = IsTuple<[number, ...number[]], {fixedLengthOnly: false}>;\n\t//=> true\n\t```\n\t*/\n\tfixedLengthOnly?: boolean;\n};\n\ntype DefaultIsTupleOptions = {\n\tfixedLengthOnly: true;\n};\n\n/**\nReturns a boolean for whether the given array is a tuple.\n\nUse-case:\n- If you want to make a conditional branch based on the result of whether an array is a tuple or not.\n\nNote: `IsTuple` returns `boolean` when instantiated with a union of tuple and non-tuple (e.g., `IsTuple<[1, 2] | number[]>`).\n\n@example\n```ts\nimport type {IsTuple} from 'type-fest';\n\ntype Tuple = IsTuple<[1, 2, 3]>;\n//=> true\n\ntype NotTuple = IsTuple<number[]>;\n//=> false\n\ntype TupleWithOptionalItems = IsTuple<[1?, 2?]>;\n//=> true\n\ntype RestItemsNotAllowed = IsTuple<[1, 2, ...number[]]>;\n//=> false\n\ntype RestItemsAllowed = IsTuple<[1, 2, ...number[]], {fixedLengthOnly: false}>;\n//=> true\n```\n\n@see {@link IsTupleOptions}\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsTuple<\n\tTArray extends UnknownArray,\n\tOptions extends IsTupleOptions = {},\n> =\n\t_IsTuple<TArray, ApplyDefaultOptions<IsTupleOptions, DefaultIsTupleOptions, Options>>;\n\ntype _IsTuple<\n\tTArray extends UnknownArray,\n\tOptions extends Required<IsTupleOptions>,\n> =\n\tIf<IsAny<TArray>, boolean, If<IsNever<TArray>, false,\n\t\tTArray extends unknown // For distributing `TArray`\n\t\t\t? number extends TArray['length']\n\t\t\t\t? Options['fixedLengthOnly'] extends false\n\t\t\t\t\t? If<IsNever<keyof TArray & `${number}`>,\n\t\t\t\t\t\tTArray extends readonly [...any, any] ? true : false, // To handle cases where a non-rest element follows a rest element, e.g., `[...number[], number]`\n\t\t\t\t\t\ttrue>\n\t\t\t\t\t: false\n\t\t\t\t: true\n\t\t\t: false\n\t>>;\n\nexport {};\n"
  },
  {
    "path": "source/is-undefined.d.ts",
    "content": "/**\nReturns a boolean for whether the given type is `undefined`.\n\n@example\n```\nimport type {IsUndefined} from 'type-fest';\n\ntype UndefinedFallback<T, Fallback> = IsUndefined<T> extends true ? Fallback : T;\n\ntype Example1 = UndefinedFallback<undefined, string>;\n//=> string\n\ntype Example2 = UndefinedFallback<number, string>;\n//=> number\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsUndefined<T> = [T] extends [undefined] ? true : false;\n\nexport {};\n"
  },
  {
    "path": "source/is-union.d.ts",
    "content": "import type {IsNever} from './is-never.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\n\n/**\nReturns a boolean for whether the given type is a union.\n\n@example\n```\nimport type {IsUnion} from 'type-fest';\n\ntype A = IsUnion<string | number>;\n//=> true\n\ntype B = IsUnion<string>;\n//=> false\n```\n*/\nexport type IsUnion<T> = InternalIsUnion<T>;\n\n/**\nThe actual implementation of `IsUnion`.\n*/\ntype InternalIsUnion<T, U = T> =\n(\n\tIsNever<T> extends true\n\t\t? false\n\t\t: T extends any\n\t\t\t? IsEqual<U, T> extends true\n\t\t\t\t? false\n\t\t\t\t: true\n\t\t\t: never\n) extends infer Result\n\t// In some cases `Result` will return `false | true` which is `boolean`,\n\t// that means `T` has at least two types and it's a union type,\n\t// so we will return `true` instead of `boolean`.\n\t? boolean extends Result ? true\n\t\t: Result\n\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/is-unknown.d.ts",
    "content": "import type {IsNull} from './is-null.d.ts';\n\n/**\nReturns a boolean for whether the given type is `unknown`.\n\n@link https://github.com/dsherret/conditional-type-checks/pull/16\n\nUseful in type utilities, such as when dealing with unknown data from API calls.\n\n@example\n```\nimport type {IsUnknown} from 'type-fest';\n\ntype A = IsUnknown<unknown>;\n//=> true\n\ntype B = IsUnknown<any>;\n//=> false\n\ntype C = IsUnknown<never>;\n//=> false\n\ntype D = IsUnknown<unknown[]>;\n//=> false\n\ntype E = IsUnknown<object>;\n//=> false\n\ntype F = IsUnknown<string>;\n//=> false\n```\n\n@category Utilities\n*/\nexport type IsUnknown<T> = (\n\tunknown extends T // `T` can be `unknown` or `any`\n\t\t? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be\n\t\t\t? true\n\t\t\t: false\n\t\t: false\n);\n\nexport {};\n"
  },
  {
    "path": "source/is-uppercase.d.ts",
    "content": "import type {AllExtend} from './all-extend.d.ts';\n\n/**\nReturns a boolean for whether the given string literal is uppercase.\n\n@example\n```\nimport type {IsUppercase} from 'type-fest';\n\ntype A = IsUppercase<'ABC'>;\n//=> true\n\ntype B = IsUppercase<'Abc'>;\n//=> false\n\ntype C = IsUppercase<string>;\n//=> boolean\n```\n*/\nexport type IsUppercase<S extends string> = AllExtend<_IsUppercase<S>, true>;\n\n/**\nLoops through each part in the string and returns a boolean array indicating whether each part is uppercase.\n*/\ntype _IsUppercase<S extends string, Accumulator extends boolean[] = []> = S extends `${infer First}${infer Rest}`\n\t? _IsUppercase<Rest, [...Accumulator, IsUppercaseHelper<First>]>\n\t: [...Accumulator, IsUppercaseHelper<S>];\n\n/**\nReturns a boolean for whether an individual part of the string is uppercase.\n*/\ntype IsUppercaseHelper<S extends string> = S extends Uppercase<string>\n\t? true\n\t: S extends Lowercase<string> | Uncapitalize<string> | `${string}${Lowercase<string>}${string}`\n\t\t? false\n\t\t: boolean;\n\nexport {};\n"
  },
  {
    "path": "source/is-writable-key-of.d.ts",
    "content": "import type {IsReadonlyKeyOf} from './is-readonly-key-of.d.ts';\nimport type {Not} from './internal/type.d.ts';\nimport type {IsAny} from './is-any.d.ts';\n\n/**\nReturns a boolean for whether the given key is a writable key of type.\n\nThis is useful when writing utility types or schema validators that need to differentiate `writable` keys.\n\n@example\n```\nimport type {IsWritableKeyOf} from 'type-fest';\n\ntype User = {\n\tname: string;\n\tsurname: string;\n\n\treadonly id: number;\n};\n\ntype Admin = {\n\tname: string;\n\tid: string;\n};\n\ntype T1 = IsWritableKeyOf<User, 'name'>;\n//=> true\n\ntype T2 = IsWritableKeyOf<User, 'id'>;\n//=> false\n\ntype T3 = IsWritableKeyOf<User, 'name' | 'id'>;\n//=> boolean\n\ntype T4 = IsWritableKeyOf<User | Admin, 'name'>;\n//=> true\n\ntype T5 = IsWritableKeyOf<User | Admin, 'id'>;\n//=> boolean\n```\n\n@category Type Guard\n@category Utilities\n*/\nexport type IsWritableKeyOf<Type extends object, Key extends keyof Type> =\n\tIsAny<Type | Key> extends true ? never\n\t\t: Key extends keyof Type\n\t\t\t? Not<IsReadonlyKeyOf<Type, Key>>\n\t\t\t: false;\n\nexport {};\n"
  },
  {
    "path": "source/iterable-element.d.ts",
    "content": "/**\nGet the element type of an `Iterable`/`AsyncIterable`. For example, `Array`, `Set`, `Map`, generator, stream, etc.\n\nThis can be useful, for example, if you want to get the type that is yielded in a generator function. Often the return type of those functions are not specified.\n\nThis type works with both `Iterable`s and `AsyncIterable`s, so it can be use with synchronous and asynchronous generators.\n\nHere is an example of `IterableElement` in action with a generator function:\n\n@example\n```\nimport type {IterableElement} from 'type-fest';\n\nfunction * iAmGenerator() {\n\tyield 1;\n\tyield 2;\n}\n\ntype MeNumber = IterableElement<ReturnType<typeof iAmGenerator>>;\n```\n\nAnd here is an example with an async generator:\n\n@example\n```\nimport type {IterableElement} from 'type-fest';\n\nasync function * iAmGeneratorAsync() {\n\tyield 'hi';\n\tyield true;\n}\n\ntype MeStringOrBoolean = IterableElement<ReturnType<typeof iAmGeneratorAsync>>;\n```\n\nMany types in JavaScript/TypeScript are iterables. This type works on all types that implement those interfaces.\n\nAn example with an array of strings:\n\n@example\n```\nimport type {IterableElement} from 'type-fest';\n\ntype MeString = IterableElement<string[]>;\n```\n\n@example\n```\nimport type {IterableElement} from 'type-fest';\n\nconst fruits = new Set(['🍎', '🍌', '🍉'] as const);\n\ntype Fruit = IterableElement<typeof fruits>;\n//=> '🍎' | '🍌' | '🍉'\n```\n\n@category Iterable\n*/\nexport type IterableElement<TargetIterable> =\n\tTargetIterable extends Iterable<infer ElementType> ?\n\t\tElementType :\n\t\tTargetIterable extends AsyncIterable<infer ElementType> ?\n\t\t\tElementType :\n\t\t\tnever;\n\nexport {};\n"
  },
  {
    "path": "source/join.d.ts",
    "content": "// The builtin `join` method supports all these natively in the same way that typescript handles them so we can safely accept all of them.\ntype JoinableItem = string | number | bigint | boolean | undefined | null;\n\n// `null` and `undefined` are treated uniquely in the built-in join method, in a way that differs from the default `toString` that would result in the type `${undefined}`. That's why we need to handle it specifically with this helper.\n// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join#description\ntype NullishCoalesce<\n\tValue extends JoinableItem,\n\tFallback extends string,\n> = Value extends undefined | null ? NonNullable<Value> | Fallback : Value;\n\n/**\nJoin an array of strings and/or numbers using the given string as a delimiter.\n\nUse-case: Defining key paths in a nested object. For example, for dot-notation fields in MongoDB queries.\n\n@example\n```\nimport type {Join} from 'type-fest';\n\n// Mixed (strings & numbers) items\nconst path1 = ['foo', 0, 'baz'].join('.') as Join<['foo', 0, 'baz'], '.'>;\n//=> 'foo.0.baz'\n\n// Only string items\nconst path2 = ['foo', 'bar', 'baz'].join('.') as Join<['foo', 'bar', 'baz'], '.'>;\n//=> 'foo.bar.baz'\n\n// Only number items\nconst path3 = [1, 2, 3].join('.') as Join<[1, 2, 3], '.'>;\n//=> '1.2.3'\n\n// Only bigint items\nconst path4 = [1n, 2n, 3n].join('.') as Join<[1n, 2n, 3n], '.'>;\n//=> '1.2.3'\n\n// Only boolean items\nconst path5 = [true, false, true].join('.') as Join<[true, false, true], '.'>;\n//=> 'true.false.true'\n\n// Contains nullish items\nconst path6 = ['foo', undefined, 'baz', null, 'xyz'].join('.') as Join<['foo', undefined, 'baz', null, 'xyz'], '.'>;\n//=> 'foo..baz..xyz'\n\n// Partial tuple shapes (rest param last)\nconst path7 = ['prefix'].join('.') as Join<['prefix', ...string[]], '.'>;\n//=> `prefix.${string}`\n\n// Partial tuple shapes (rest param first)\nconst path8 = ['suffix'].join('.') as Join<[...string[], 'suffix'], '.'>;\n//=> `${string}.suffix`\n\n// Tuples items with nullish unions\nconst path9 = ['hello', 'world'].join('.') as Join<['hello' | undefined, 'world' | null], '.'>;\n//=> '.' | '.world' | 'hello.' | 'hello.world'\n```\n\n@category Array\n@category Template literal\n*/\nexport type Join<\n\tItems extends readonly JoinableItem[],\n\tDelimiter extends string,\n> = Items extends readonly []\n\t? ''\n\t: Items extends readonly [JoinableItem?]\n\t\t? `${NullishCoalesce<Items[0], ''>}`\n\t\t: Items extends readonly [\n\t\t\tinfer First extends JoinableItem,\n\t\t\t...infer Tail extends readonly JoinableItem[],\n\t\t]\n\t\t\t? `${NullishCoalesce<First, ''>}${Delimiter}${Join<Tail, Delimiter>}`\n\t\t\t: Items extends readonly [\n\t\t\t\t...infer Head extends readonly JoinableItem[],\n\t\t\t\tinfer Last extends JoinableItem,\n\t\t\t]\n\t\t\t\t? `${Join<Head, Delimiter>}${Delimiter}${NullishCoalesce<Last, ''>}`\n\t\t\t\t: string;\n\nexport {};\n"
  },
  {
    "path": "source/json-value.d.ts",
    "content": "/**\nMatches a JSON object.\n\nThis type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.\n\n@category JSON\n*/\nexport type JsonObject = {[Key in string]: JsonValue};\n\n/**\nMatches a JSON array.\n\n@category JSON\n*/\nexport type JsonArray = JsonValue[] | readonly JsonValue[];\n\n/**\nMatches any valid JSON primitive value.\n\n@category JSON\n*/\nexport type JsonPrimitive = string | number | boolean | null;\n\n/**\nMatches any valid JSON value.\n\n@see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.\n\n@category JSON\n*/\nexport type JsonValue = JsonPrimitive | JsonObject | JsonArray;\n\nexport {};\n"
  },
  {
    "path": "source/jsonifiable.d.ts",
    "content": "import type {JsonPrimitive} from './json-value.d.ts';\n\ntype JsonifiableObject = {[Key in string]?: Jsonifiable} | {toJSON: () => Jsonifiable};\ntype JsonifiableArray = readonly Jsonifiable[];\n\n/**\nMatches a value that can be losslessly converted to JSON.\n\nCan be used to type values that you expect to pass to `JSON.stringify`.\n\n`undefined` is allowed in object fields (for example, `{a?: number}`) as a special case even though `JSON.stringify({a: undefined})` is `{}` because it makes this class more widely useful and checking for undefined-but-present values is likely an anti-pattern.\n\n@example\n```\nimport type {Jsonifiable} from 'type-fest';\n\n// @ts-expect-error\nconst error: Jsonifiable = {\n\tmap: new Map([['a', 1]]),\n};\n\nconsole.log(JSON.stringify(error)); // {\"map\": {}}\n\nconst good: Jsonifiable = {\n\tnumber: 3,\n\tdate: new Date('2025-12-25'),\n\tmissing: undefined,\n};\n\nconsole.log(JSON.stringify(good)); // {\"number\": 3, \"date\": \"2025-12-25T00:00:00.000Z\"}\n```\n\n@category JSON\n*/\nexport type Jsonifiable = JsonPrimitive | JsonifiableObject | JsonifiableArray;\n\nexport {};\n"
  },
  {
    "path": "source/jsonify.d.ts",
    "content": "import type {JsonPrimitive, JsonValue} from './json-value.d.ts';\nimport type {EmptyObject} from './empty-object.d.ts';\nimport type {UndefinedToOptional} from './internal/index.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {IsUnknown} from './is-unknown.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from './numeric.d.ts';\nimport type {TypedArray} from './typed-array.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n// Note: The return value has to be `any` and not `unknown` so it can match `void`.\ntype NotJsonable = ((...arguments_: any[]) => any) | undefined | symbol;\n\ntype NeverToNull<T> = IsNever<T> extends true ? null : T;\ntype UndefinedToNull<T> = T extends undefined ? null : T;\n\n// Handles tuples and arrays\ntype JsonifyList<T extends UnknownArray> = T extends readonly []\n\t? []\n\t: T extends readonly [infer F, ...infer R]\n\t\t? [F, ...R] extends T // With TS 5.8.3, if `string[] & ['foo']`, `R` is `unknown[]` here, making the inferred types not equal to the original one\n\t\t\t? [NeverToNull<Jsonify<F>>, ...JsonifyList<R>]\n\t\t\t: [NeverToNull<Jsonify<F>>]\n\t\t: IsUnknown<T[number]> extends true\n\t\t\t? JsonValue[]\n\t\t\t: Array<T[number] extends NotJsonable ? null : Jsonify<UndefinedToNull<T[number]>>>;\n\ntype FilterJsonableKeys<T extends object> = {\n\t[Key in keyof T]: T[Key] extends NotJsonable ? never : Key;\n}[keyof T];\n\n/**\nJSON serialize objects (not including arrays) and classes.\n*/\ntype JsonifyObject<T extends object> = {\n\t[Key in keyof Pick<T, FilterJsonableKeys<T>>]: Jsonify<T[Key]>;\n};\n\n/**\nTransform a type to one that is assignable to the `JsonValue` type.\n\nThis includes:\n1. Transforming JSON `interface` to a `type` that is assignable to `JsonValue`.\n2. Transforming non-JSON value that is *jsonable* to a type that is assignable to `JsonValue`, where *jsonable* means the non-JSON value implements the `.toJSON()` method that returns a value that is assignable to `JsonValue`.\n\n@remarks\n\nAn interface cannot be structurally compared to `JsonValue` because an interface can be re-opened to add properties that may not satisfy `JsonValue`.\n\n@example\n```\nimport type {Jsonify, JsonValue} from 'type-fest';\n\ninterface Geometry {\n\ttype: 'Point' | 'Polygon';\n\tcoordinates: [number, number];\n}\n\nconst point: Geometry = {\n\ttype: 'Point',\n\tcoordinates: [1, 1],\n};\n\ndeclare function problemFn(data: JsonValue): void;\n\n// @ts-expect-error\nproblemFn(point); // Error: type Geometry is not assignable to parameter of type JsonValue because it is an interface\n\ndeclare function fixedFn<T>(data: Jsonify<T>): void;\n\nfixedFn(point); // Good: point is assignable. Jsonify<T> transforms Geometry into value assignable to JsonValue\n\n// @ts-expect-error\nfixedFn(new Date()); // Error: As expected, Date is not assignable. Jsonify<T> cannot transform Date into a value assignable to JsonValue\n```\n\nNon-JSON values such as `Date` implement `.toJSON()`, so they can be transformed to a value assignable to `JsonValue`:\n\n@example\n```\nimport type {Jsonify} from 'type-fest';\n\nconst time = {\n\ttimeValue: new Date(),\n};\n\n// `Jsonify<typeof time>` is equivalent to `{timeValue: string}`\nconst timeJson = JSON.parse(JSON.stringify(time)) as Jsonify<typeof time>;\n```\n\n@link https://github.com/Microsoft/TypeScript/issues/1897#issuecomment-710744173\n\n@category JSON\n*/\nexport type Jsonify<T> = IsAny<T> extends true\n\t? any\n\t: T extends PositiveInfinity | NegativeInfinity\n\t\t? null\n\t\t: T extends JsonPrimitive\n\t\t\t? T\n\t\t\t: // Any object with toJSON is special case\n\t\t\tT extends {toJSON(): infer J}\n\t\t\t\t? (() => J) extends () => JsonValue // Is J assignable to JsonValue?\n\t\t\t\t\t? J // Then T is Jsonable and its Jsonable value is J\n\t\t\t\t\t: Jsonify<J> // Maybe if we look a level deeper we'll find a JsonValue\n\t\t\t\t: // Instanced primitives are objects\n\t\t\t\tT extends Number\n\t\t\t\t\t? number\n\t\t\t\t\t: T extends String\n\t\t\t\t\t\t? string\n\t\t\t\t\t\t: T extends Boolean\n\t\t\t\t\t\t\t? boolean\n\t\t\t\t\t\t\t: T extends Map<any, any> | Set<any>\n\t\t\t\t\t\t\t\t? EmptyObject\n\t\t\t\t\t\t\t\t: T extends TypedArray\n\t\t\t\t\t\t\t\t\t? Record<string, number>\n\t\t\t\t\t\t\t\t\t: T extends NotJsonable\n\t\t\t\t\t\t\t\t\t\t? never // Non-JSONable type union was found not empty\n\t\t\t\t\t\t\t\t\t\t: T extends UnknownArray\n\t\t\t\t\t\t\t\t\t\t\t? JsonifyList<T>\n\t\t\t\t\t\t\t\t\t\t\t: T extends object\n\t\t\t\t\t\t\t\t\t\t\t\t? JsonifyObject<UndefinedToOptional<T>> // JsonifyObject recursive call for its children\n\t\t\t\t\t\t\t\t\t\t\t\t: IsUnknown<T> extends true\n\t\t\t\t\t\t\t\t\t\t\t\t\t? JsonValue\n\t\t\t\t\t\t\t\t\t\t\t\t\t: never; // Otherwise any other non-object is removed\n\nexport {};\n"
  },
  {
    "path": "source/kebab-case.d.ts",
    "content": "import type {_DefaultDelimiterCaseOptions, DelimiterCase} from './delimiter-case.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {WordsOptions} from './words.d.ts';\n\n/**\nConvert a string literal to kebab-case.\n\nThis can be useful when, for example, converting a camel-cased object property to a kebab-cased CSS class name or a command-line flag.\n\n@example\n```\nimport type {KebabCase} from 'type-fest';\n\n// Simple\n\nconst someVariable: KebabCase<'fooBar'> = 'foo-bar';\nconst someVariableNoSplitOnNumbers: KebabCase<'p2pNetwork', {splitOnNumbers: false}> = 'p2p-network';\n\n// Advanced\n\ntype KebabCasedProperties<T> = {\n\t[K in keyof T as KebabCase<K>]: T[K]\n};\n\ntype CliOptions = {\n\tdryRun: boolean;\n\tincludeFile: string;\n\tfoo: number;\n};\n\nconst rawCliOptions: KebabCasedProperties<CliOptions> = {\n\t'dry-run': true,\n\t'include-file': 'bar.js',\n\tfoo: 123,\n};\n```\n\n@category Change case\n@category Template literal\n*/\nexport type KebabCase<\n\tValue,\n\tOptions extends WordsOptions = {},\n> = DelimiterCase<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;\n\nexport {};\n"
  },
  {
    "path": "source/kebab-cased-properties-deep.d.ts",
    "content": "import type {_DefaultDelimiterCaseOptions} from './delimiter-case.d.ts';\nimport type {DelimiterCasedPropertiesDeep} from './delimiter-cased-properties-deep.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {WordsOptions} from './words.d.ts';\n\n/**\nConvert object properties to kebab case recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link KebabCase}\n@see {@link KebabCasedProperties}\n\n@example\n```\nimport type {KebabCasedPropertiesDeep} from 'type-fest';\n\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\n\ntype UserWithFriends = {\n\tuserInfo: User;\n\tuserFriends: User[];\n};\n\nconst result: KebabCasedPropertiesDeep<UserWithFriends> = {\n\t'user-info': {\n\t\t'user-id': 1,\n\t\t'user-name': 'Tom',\n\t},\n\t'user-friends': [\n\t\t{\n\t\t\t'user-id': 2,\n\t\t\t'user-name': 'Jerry',\n\t\t},\n\t\t{\n\t\t\t'user-id': 3,\n\t\t\t'user-name': 'Spike',\n\t\t},\n\t],\n};\n\nconst splitOnNumbers: KebabCasedPropertiesDeep<{line1: {line2: [{line3: string}]}}, {splitOnNumbers: true}> = {\n\t'line-1': {\n\t\t'line-2': [\n\t\t\t{\n\t\t\t\t'line-3': 'string',\n\t\t\t},\n\t\t],\n\t},\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type KebabCasedPropertiesDeep<\n\tValue,\n\tOptions extends WordsOptions = {},\n> = DelimiterCasedPropertiesDeep<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;\n\nexport {};\n"
  },
  {
    "path": "source/kebab-cased-properties.d.ts",
    "content": "import type {_DefaultDelimiterCaseOptions} from './delimiter-case.d.ts';\nimport type {DelimiterCasedProperties} from './delimiter-cased-properties.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {WordsOptions} from './words.d.ts';\n\n/**\nConvert object properties to kebab case but not recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link KebabCase}\n@see {@link KebabCasedPropertiesDeep}\n\n@example\n```\nimport type {KebabCasedProperties} from 'type-fest';\n\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\n\nconst result: KebabCasedProperties<User> = {\n\t'user-id': 1,\n\t'user-name': 'Tom',\n};\n\nconst splitOnNumbers: KebabCasedProperties<{line1: string}, {splitOnNumbers: true}> = {\n\t'line-1': 'string',\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type KebabCasedProperties<\n\tValue,\n\tOptions extends WordsOptions = {},\n> = DelimiterCasedProperties<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;\n\nexport {};\n"
  },
  {
    "path": "source/key-as-string.d.ts",
    "content": "/**\nGet keys of the given type as strings.\n\nNumber keys are converted to strings.\n\nUse-cases:\n- Get string keys from a type which may have number keys.\n- Makes it possible to index using strings retrieved from template types.\n\n@example\n```\nimport type {KeyAsString} from 'type-fest';\n\ntype Foo = {\n\t1: number;\n\tstringKey: string;\n};\n\ntype StringKeysOfFoo = KeyAsString<Foo>;\n//=> 'stringKey' | '1'\n```\n\n@category Object\n*/\nexport type KeyAsString<BaseType> = `${Extract<keyof BaseType, string | number>}`;\n\nexport {};\n"
  },
  {
    "path": "source/keys-of-union.d.ts",
    "content": "import type {UnionToIntersection} from './union-to-intersection.d.ts';\n\n/**\nCreate a union of all keys from a given type, even those exclusive to specific union members.\n\nUnlike the native `keyof` keyword, which returns keys present in **all** union members, this type returns keys from **any** member.\n\n@link https://stackoverflow.com/a/49402091\n\n@example\n```\nimport type {KeysOfUnion} from 'type-fest';\n\ntype A = {\n\tcommon: string;\n\ta: number;\n};\n\ntype B = {\n\tcommon: string;\n\tb: string;\n};\n\ntype C = {\n\tcommon: string;\n\tc: boolean;\n};\n\ntype Union = A | B | C;\n\ntype CommonKeys = keyof Union;\n//=> 'common'\n\ntype AllKeys = KeysOfUnion<Union>;\n//=> 'common' | 'a' | 'b' | 'c'\n```\n\n@category Object\n*/\nexport type KeysOfUnion<ObjectType> =\n  // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008\n  keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;\n\nexport {};\n"
  },
  {
    "path": "source/last-array-element.d.ts",
    "content": "/**\nExtract the type of the last element of an array.\n\nUse-case: Defining the return type of functions that extract the last element of an array, for example [`lodash.last`](https://lodash.com/docs/4.17.15#last).\n\n@example\n```\nimport type {LastArrayElement} from 'type-fest';\n\ndeclare function lastOf<const V extends readonly any[]>(array: V): LastArrayElement<V>;\n\nconst last1 = lastOf(['foo', 'bar']);\n//=> 'bar'\n\nconst last2 = lastOf([true, false, 'baz', 10]);\n//=> 10\n```\n\n@category Array\n@category Template literal\n*/\nexport type LastArrayElement<Elements extends readonly unknown[], ElementBeforeTailingSpreadElement = never> =\n\t// If the last element of an array is a spread element, the `LastArrayElement` result should be `'the type of the element before the spread element' | 'the type of the spread element'`.\n\tElements extends readonly []\n\t\t? ElementBeforeTailingSpreadElement\n\t\t: Elements extends readonly [...infer U, infer V]\n\t\t\t? V\n\t\t\t: Elements extends readonly [infer U, ...infer V]\n\t\t\t\t// If we return `V[number] | U` directly, it would be wrong for `[[string, boolean, object, ...number[]]`.\n\t\t\t\t// So we need to recurse type `V` and carry over the type of the element before the spread element.\n\t\t\t\t? LastArrayElement<V, U>\n\t\t\t\t: Elements extends ReadonlyArray<infer U>\n\t\t\t\t\t? U | ElementBeforeTailingSpreadElement\n\t\t\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/less-than-or-equal.d.ts",
    "content": "import type {GreaterThan} from './greater-than.d.ts';\n\n/**\n Returns a boolean for whether a given number is less than or equal to another number.\n\n@example\n```\nimport type {LessThanOrEqual} from 'type-fest';\n\ntype A = LessThanOrEqual<1, -5>;\n//=> false\n\ntype B = LessThanOrEqual<1, 1>;\n//=> true\n\ntype C = LessThanOrEqual<1, 5>;\n//=> true\n```\n\nNote: If either argument is the non-literal `number` type, the result is `boolean`.\n\n@example\n```\nimport type {LessThanOrEqual} from 'type-fest';\n\ntype A = LessThanOrEqual<number, 1>;\n//=> boolean\n\ntype B = LessThanOrEqual<1, number>;\n//=> boolean\n\ntype C = LessThanOrEqual<number, number>;\n//=> boolean\n```\n\n@example\n```\nimport type {LessThanOrEqual} from 'type-fest';\n\n// Use `LessThanOrEqual` to constrain a function parameter to non-positive numbers.\ndeclare function setNonPositive<N extends number>(value: LessThanOrEqual<N, 0> extends true ? N : never): void;\n\nsetNonPositive(0); // ✅ Allowed\nsetNonPositive(-1); // ✅ Allowed\n\n// @ts-expect-error\nsetNonPositive(1);\n\n// @ts-expect-error\nsetNonPositive(2);\n```\n*/\nexport type LessThanOrEqual<A extends number, B extends number> =\n\tGreaterThan<A, B> extends infer Result\n\t\t? Result extends true\n\t\t\t? false\n\t\t\t: true\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/less-than.d.ts",
    "content": "import type {GreaterThanOrEqual} from './greater-than-or-equal.d.ts';\n\n/**\nReturns a boolean for whether a given number is less than another number.\n\n@example\n```\nimport type {LessThan} from 'type-fest';\n\ntype A = LessThan<1, -5>;\n//=> false\n\ntype B = LessThan<1, 1>;\n//=> false\n\ntype C = LessThan<1, 5>;\n//=> true\n```\n\nNote: If either argument is the non-literal `number` type, the result is `boolean`.\n\n@example\n```\nimport type {LessThan} from 'type-fest';\n\ntype A = LessThan<number, 1>;\n//=> boolean\n\ntype B = LessThan<1, number>;\n//=> boolean\n\ntype C = LessThan<number, number>;\n//=> boolean\n```\n\n@example\n```\nimport type {LessThan} from 'type-fest';\n\n// Use `LessThan` to constrain a function parameter to negative numbers.\ndeclare function setNegative<N extends number>(value: LessThan<N, 0> extends true ? N : never): void;\n\nsetNegative(-1); // ✅ Allowed\nsetNegative(-2); // ✅ Allowed\n\n// @ts-expect-error\nsetNegative(0);\n\n// @ts-expect-error\nsetNegative(1);\n```\n*/\nexport type LessThan<A extends number, B extends number> =\n\tGreaterThanOrEqual<A, B> extends infer Result\n\t\t? Result extends true\n\t\t\t? false\n\t\t\t: true\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/literal-to-primitive-deep.d.ts",
    "content": "import type {LiteralToPrimitive} from './literal-to-primitive.d.ts';\nimport type {OmitIndexSignature} from './omit-index-signature.d.ts';\n\n/**\nLike `LiteralToPrimitive` except it converts literal types inside an object or array deeply.\n\nFor example, given a constant object, it returns a new object type with the same keys but with all the values converted to primitives.\n\n@see {@link LiteralToPrimitive}\n\nUse-case: Deal with data that is imported from a JSON file.\n\n@example\n```\nimport type {LiteralToPrimitiveDeep} from 'type-fest';\n\nconst config = {\n\tappName: 'MyApp',\n\tversion: '1.0.0',\n\tmaxRetries: 3,\n\tenableLogging: true,\n\tapiUrl: 'https://api.myapp.com/v1',\n} as const;\n\ndeclare function updateConfig(newConfig: typeof config): void;\n\nupdateConfig({\n\t// @ts-expect-error\n\tappName: 'MyUpdatedApp',\n\t// Error: Type '\"MyUpdatedApp\"' is not assignable to type '\"MyApp\"'.\n\n\t// @ts-expect-error\n\tversion: '2.0.0',\n\t// Error: Type '\"2.0.0\"' is not assignable to type '\"1.0.0\"'.\n\n\t// @ts-expect-error\n\tmaxRetries: 1,\n\t// Error: Type '1' is not assignable to type '3'.\n\n\t// @ts-expect-error\n\tenableLogging: false,\n\t// Error: Type 'false' is not assignable to type 'true'.\n\n\t// @ts-expect-error\n\tapiUrl: 'https://api.myapp.com/v2',\n\t// Error: Type '\"https://api.myapp.com/v2\"' is not assignable to type '\"https://api.myapp.com/v1\"'.\n});\n\ndeclare function updateConfigFixed(newConfig: LiteralToPrimitiveDeep<typeof config>): void;\n\nupdateConfigFixed({\n\tappName: 'MyUpdatedApp',\n\tversion: '2.0.0',\n\tmaxRetries: 1,\n\tenableLogging: false,\n\tapiUrl: 'https://api.myapp.com/v2',\n});\n```\n\n@category Type\n@category Object\n*/\nexport type LiteralToPrimitiveDeep<T> = T extends object\n\t? T extends Array<infer U>\n\t\t? Array<LiteralToPrimitiveDeep<U>>\n\t\t: {\n\t\t\t[K in keyof OmitIndexSignature<T>]: LiteralToPrimitiveDeep<T[K]>;\n\t\t}\n\t: LiteralToPrimitive<T>;\n\nexport {};\n"
  },
  {
    "path": "source/literal-to-primitive.d.ts",
    "content": "/**\nGiven a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types) return the {@link Primitive | primitive type} it belongs to, or `never` if it's not a primitive.\n\nUse-case: Working with generic types that may be literal types.\n\n@example\n```\nimport type {LiteralToPrimitive} from 'type-fest';\n\n// No overloads needed to get the correct return type\nfunction plus<T extends number | bigint | string>(x: T, y: T): LiteralToPrimitive<T> {\n\treturn x + (y as any);\n}\n\nplus('a', 'b'); // string\nplus(1, 2); // number\nplus(1n, 2n); // bigint\n```\n\n@category Type\n*/\nexport type LiteralToPrimitive<T> = T extends number\n\t? number\n\t: T extends bigint\n\t\t? bigint\n\t\t: T extends string\n\t\t\t? string\n\t\t\t: T extends boolean\n\t\t\t\t? boolean\n\t\t\t\t: T extends symbol\n\t\t\t\t\t? symbol\n\t\t\t\t\t: T extends null\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: T extends undefined\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/literal-union.d.ts",
    "content": "import type {Primitive} from './primitive.d.ts';\n\nexport type _LiteralStringUnion<T> = LiteralUnion<T, string>;\n\n/**\nAllows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.\n\nCurrently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.\n\nThis type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.\n\n@example\n```\nimport type {LiteralUnion} from 'type-fest';\n\n// Before\n\ntype Pet = 'dog' | 'cat' | string;\n\nconst petWithoutAutocomplete: Pet = '';\n// Start typing in your TypeScript-enabled IDE.\n// You **will not** get auto-completion for `dog` and `cat` literals.\n\n// After\n\ntype Pet2 = LiteralUnion<'dog' | 'cat', string>;\n\nconst petWithAutoComplete: Pet2 = '';\n// You **will** get auto-completion for `dog` and `cat` literals.\n```\n\n@category Type\n*/\nexport type LiteralUnion<\n\tLiteralType,\n\tBaseType extends Primitive,\n> = LiteralType | (BaseType & Record<never, never>);\n\nexport {};\n"
  },
  {
    "path": "source/merge-deep.d.ts",
    "content": "import type {ConditionalSimplifyDeep} from './conditional-simplify-deep.d.ts';\nimport type {OmitIndexSignature} from './omit-index-signature.d.ts';\nimport type {PickIndexSignature} from './pick-index-signature.d.ts';\nimport type {Merge} from './merge.d.ts';\nimport type {\n\tFirstArrayElement,\n\tIsBothExtends,\n\tUnknownArrayOrTuple,\n\tEnforceOptional,\n} from './internal/index.d.ts';\nimport type {NonEmptyTuple} from './non-empty-tuple.d.ts';\nimport type {ArrayTail as _ArrayTail} from './array-tail.d.ts';\nimport type {UnknownRecord} from './unknown-record.d.ts';\nimport type {SimplifyDeep} from './simplify-deep.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\ntype Writable<TArray extends UnknownArray> = {-readonly [Key in keyof TArray]: TArray[Key]}; // TODO: Remove this\n\n// Using the default `ArrayTail` type causes issues, refer https://github.com/sindresorhus/type-fest/pull/1175/files#r2134694728.\ntype ArrayTail<TArray extends UnknownArray> = TArray extends unknown // For distributing `TArray`\n\t? keyof TArray & `${number}` extends never\n\t\t? []\n\t\t: Writable<_ArrayTail<TArray>>\n\t: never; // Should never happen\n\ntype SimplifyDeepExcludeArray<T> = SimplifyDeep<T, UnknownArray>;\n\n/**\nTry to merge two record properties or return the source property value, preserving `undefined` properties values in both cases.\n*/\ntype MergeDeepRecordProperty<\n\tDestination,\n\tSource,\n\tOptions extends MergeDeepInternalOptions,\n> = undefined extends Source\n\t? MergeDeepOrReturn<Source, Exclude<Destination, undefined>, Exclude<Source, undefined>, Options> | (undefined extends Destination ? undefined : never)\n\t: MergeDeepOrReturn<Source, Destination, Source, Options>;\n\n/**\nWalk through the union of the keys of the two objects and test in which object the properties are defined.\nRules:\n1. If the source does not contain the key, the value of the destination is returned.\n2. If the source contains the key and the destination does not contain the key, the value of the source is returned.\n3. If both contain the key, try to merge according to the chosen {@link MergeDeepOptions options} or return the source if unable to merge.\n*/\ntype DoMergeDeepRecord<\n\tDestination extends UnknownRecord,\n\tSource extends UnknownRecord,\n\tOptions extends MergeDeepInternalOptions,\n> =\n// Case in rule 1: The destination contains the key but the source doesn't.\n\t{\n\t\t[Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];\n\t}\n// Case in rule 2: The source contains the key but the destination doesn't.\n\t& {\n\t\t[Key in keyof Source as Key extends keyof Destination ? never : Key]: Source[Key];\n\t}\n// Case in rule 3: Both the source and the destination contain the key.\n\t& {\n\t\t[Key in keyof Source as Key extends keyof Destination ? Key : never]: MergeDeepRecordProperty<Required<Destination>[Key], Required<Source>[Key], Options>;\n\t};\n\n/**\nWrapper around {@link DoMergeDeepRecord} which preserves index signatures.\n*/\ntype MergeDeepRecord<\n\tDestination extends UnknownRecord,\n\tSource extends UnknownRecord,\n\tOptions extends MergeDeepInternalOptions,\n> = DoMergeDeepRecord<OmitIndexSignature<Destination>, OmitIndexSignature<Source>, Options>\n\t& Merge<PickIndexSignature<Destination>, PickIndexSignature<Source>>;\n\n// Helper to avoid computing ArrayTail twice.\ntype PickRestTypeHelper<Tail extends UnknownArrayOrTuple, Type> = Tail extends [] ? Type : PickRestType<Tail>;\n\n/**\nPick the rest type.\n\n@example\n```\ntype Rest1 = PickRestType<[]>; // => []\ntype Rest2 = PickRestType<[string]>; // => []\ntype Rest3 = PickRestType<[...number[]]>; // => number[]\ntype Rest4 = PickRestType<[string, ...number[]]>; // => number[]\ntype Rest5 = PickRestType<string[]>; // => string[]\n```\n*/\ntype PickRestType<Type extends UnknownArrayOrTuple> = number extends Type['length']\n\t? PickRestTypeHelper<ArrayTail<Type>, Type>\n\t: [];\n\n// Helper to avoid computing ArrayTail twice.\ntype OmitRestTypeHelper<\n\tTail extends UnknownArrayOrTuple,\n\tType extends UnknownArrayOrTuple,\n\tResult extends UnknownArrayOrTuple = [],\n> = Tail extends []\n\t? Result\n\t: OmitRestType<Tail, [...Result, FirstArrayElement<Type>]>;\n\n/**\nOmit the rest type.\n\n@example\n```\ntype Tuple1 = OmitRestType<[]>; // => []\ntype Tuple2 = OmitRestType<[string]>; // => [string]\ntype Tuple3 = OmitRestType<[...number[]]>; // => []\ntype Tuple4 = OmitRestType<[string, ...number[]]>; // => [string]\ntype Tuple5 = OmitRestType<[string, boolean[], ...number[]]>; // => [string, boolean[]]\ntype Tuple6 = OmitRestType<string[]>; // => []\n```\n*/\ntype OmitRestType<Type extends UnknownArrayOrTuple, Result extends UnknownArrayOrTuple = []> = number extends Type['length']\n\t? OmitRestTypeHelper<ArrayTail<Type>, Type, Result>\n\t: Type;\n\n// Utility to avoid picking two times the type.\ntype TypeNumberOrType<Type extends UnknownArrayOrTuple> = Type[number] extends never ? Type : Type[number];\n\n// Pick the rest type (array) and try to get the intrinsic type or return the provided type.\ntype PickRestTypeFlat<Type extends UnknownArrayOrTuple> = TypeNumberOrType<PickRestType<Type>>;\n\n/**\nTry to merge two array/tuple elements or return the source element if the end of the destination is reached or vis-versa.\n*/\ntype MergeDeepArrayOrTupleElements<\n\tDestination,\n\tSource,\n\tOptions extends MergeDeepInternalOptions,\n> = Source extends []\n\t? Destination\n\t: Destination extends []\n\t\t? Source\n\t\t: MergeDeepOrReturn<Source, Destination, Source, Options>;\n\n/**\nMerge two tuples recursively.\n*/\ntype DoMergeDeepTupleAndTupleRecursive<\n\tDestination extends UnknownArrayOrTuple,\n\tSource extends UnknownArrayOrTuple,\n\tDestinationRestType,\n\tSourceRestType,\n\tOptions extends MergeDeepInternalOptions,\n> = Destination extends []\n\t? Source extends []\n\t\t? []\n\t\t: MergeArrayTypeAndTuple<DestinationRestType, Source, Options>\n\t: Source extends []\n\t\t? MergeTupleAndArrayType<Destination, SourceRestType, Options>\n\t\t: [\n\t\t\tMergeDeepArrayOrTupleElements<FirstArrayElement<Destination>, FirstArrayElement<Source>, Options>,\n\t\t\t...DoMergeDeepTupleAndTupleRecursive<ArrayTail<Destination>, ArrayTail<Source>, DestinationRestType, SourceRestType, Options>,\n\t\t];\n\n/**\nMerge two tuples recursively taking into account a possible rest element.\n*/\ntype MergeDeepTupleAndTupleRecursive<\n\tDestination extends UnknownArrayOrTuple,\n\tSource extends UnknownArrayOrTuple,\n\tOptions extends MergeDeepInternalOptions,\n> = [\n\t...DoMergeDeepTupleAndTupleRecursive<OmitRestType<Destination>, OmitRestType<Source>, PickRestTypeFlat<Destination>, PickRestTypeFlat<Source>, Options>,\n\t...MergeDeepArrayOrTupleElements<PickRestType<Destination>, PickRestType<Source>, Options>,\n];\n\n/**\nMerge an array type with a tuple recursively.\n*/\ntype MergeTupleAndArrayType<\n\tTuple extends UnknownArrayOrTuple,\n\tArrayType,\n\tOptions extends MergeDeepInternalOptions,\n> = Tuple extends []\n\t? Tuple\n\t: [\n\t\tMergeDeepArrayOrTupleElements<FirstArrayElement<Tuple>, ArrayType, Options>,\n\t\t...MergeTupleAndArrayType<ArrayTail<Tuple>, ArrayType, Options>,\n\t];\n\n/**\nMerge an array into a tuple recursively taking into account a possible rest element.\n*/\ntype MergeDeepTupleAndArrayRecursive<\n\tDestination extends UnknownArrayOrTuple,\n\tSource extends UnknownArrayOrTuple,\n\tOptions extends MergeDeepInternalOptions,\n> = [\n\t...MergeTupleAndArrayType<OmitRestType<Destination>, Source[number], Options>,\n\t...MergeDeepArrayOrTupleElements<PickRestType<Destination>, PickRestType<Source>, Options>,\n];\n\n/**\nMerge a tuple with an array type recursively.\n*/\ntype MergeArrayTypeAndTuple<\n\tArrayType,\n\tTuple extends UnknownArrayOrTuple,\n\tOptions extends MergeDeepInternalOptions,\n> = Tuple extends []\n\t? Tuple\n\t: [\n\t\tMergeDeepArrayOrTupleElements<ArrayType, FirstArrayElement<Tuple>, Options>,\n\t\t...MergeArrayTypeAndTuple<ArrayType, ArrayTail<Tuple>, Options>,\n\t];\n\n/**\nMerge a tuple into an array recursively taking into account a possible rest element.\n*/\ntype MergeDeepArrayAndTupleRecursive<\n\tDestination extends UnknownArrayOrTuple,\n\tSource extends UnknownArrayOrTuple,\n\tOptions extends MergeDeepInternalOptions,\n> = [\n\t...MergeArrayTypeAndTuple<Destination[number], OmitRestType<Source>, Options>,\n\t...MergeDeepArrayOrTupleElements<PickRestType<Destination>, PickRestType<Source>, Options>,\n];\n\n/**\nMerge mode for array/tuple elements.\n*/\ntype ArrayMergeMode = 'spread' | 'replace';\n\n/**\nTest if it should spread top-level arrays.\n*/\ntype ShouldSpread<Options extends MergeDeepInternalOptions> = Options['spreadTopLevelArrays'] extends false\n\t? Options['arrayMergeMode'] extends 'spread' ? true : false\n\t: true;\n\n/**\nMerge two arrays/tuples according to the chosen {@link MergeDeepOptions.arrayMergeMode arrayMergeMode} option.\n*/\ntype DoMergeArrayOrTuple<\n\tDestination extends UnknownArrayOrTuple,\n\tSource extends UnknownArrayOrTuple,\n\tOptions extends MergeDeepInternalOptions,\n> = ShouldSpread<Options> extends true\n\t? Array<Exclude<Destination, undefined>[number] | Exclude<Source, undefined>[number]>\n\t: Source; // 'replace'\n\n/**\nMerge two arrays recursively.\n\nIf the two arrays are multi-level, we merge deeply, otherwise we merge the first level only.\n\nNote: The `[number]` accessor is used to test the type of the second level.\n*/\ntype MergeDeepArrayRecursive<\n\tDestination extends UnknownArrayOrTuple,\n\tSource extends UnknownArrayOrTuple,\n\tOptions extends MergeDeepInternalOptions,\n> = Destination[number] extends UnknownArrayOrTuple\n\t? Source[number] extends UnknownArrayOrTuple\n\t\t? Array<MergeDeepArrayOrTupleRecursive<Destination[number], Source[number], Options>>\n\t\t: DoMergeArrayOrTuple<Destination, Source, Options>\n\t: Destination[number] extends UnknownRecord\n\t\t? Source[number] extends UnknownRecord\n\t\t\t? Array<SimplifyDeepExcludeArray<MergeDeepRecord<Destination[number], Source[number], Options>>>\n\t\t\t: DoMergeArrayOrTuple<Destination, Source, Options>\n\t\t: DoMergeArrayOrTuple<Destination, Source, Options>;\n\n/**\nMerge two array/tuple recursively by selecting one of the four strategies according to the type of inputs.\n\n- tuple/tuple\n- tuple/array\n- array/tuple\n- array/array\n*/\ntype MergeDeepArrayOrTupleRecursive<\n\tDestination extends UnknownArrayOrTuple,\n\tSource extends UnknownArrayOrTuple,\n\tOptions extends MergeDeepInternalOptions,\n> = IsBothExtends<NonEmptyTuple, Destination, Source> extends true\n\t? MergeDeepTupleAndTupleRecursive<Destination, Source, Options>\n\t: Destination extends NonEmptyTuple\n\t\t? MergeDeepTupleAndArrayRecursive<Destination, Source, Options>\n\t\t: Source extends NonEmptyTuple\n\t\t\t? MergeDeepArrayAndTupleRecursive<Destination, Source, Options>\n\t\t\t: MergeDeepArrayRecursive<Destination, Source, Options>;\n\n/**\nMerge two array/tuple according to {@link MergeDeepOptions.recurseIntoArrays recurseIntoArrays} option.\n*/\ntype MergeDeepArrayOrTuple<\n\tDestination extends UnknownArrayOrTuple,\n\tSource extends UnknownArrayOrTuple,\n\tOptions extends MergeDeepInternalOptions,\n> = Options['recurseIntoArrays'] extends true\n\t? MergeDeepArrayOrTupleRecursive<Destination, Source, Options>\n\t: DoMergeArrayOrTuple<Destination, Source, Options>;\n\n/**\nTry to merge two objects or two arrays/tuples recursively into a new type or return the default value.\n*/\ntype MergeDeepOrReturn<\n\tDefaultType,\n\tDestination,\n\tSource,\n\tOptions extends MergeDeepInternalOptions,\n> = SimplifyDeepExcludeArray<[undefined] extends [Destination | Source]\n\t? DefaultType\n\t: Destination extends UnknownRecord\n\t\t? Source extends UnknownRecord\n\t\t\t? MergeDeepRecord<Destination, Source, Options>\n\t\t\t: DefaultType\n\t\t: Destination extends UnknownArrayOrTuple\n\t\t\t? Source extends UnknownArrayOrTuple\n\t\t\t\t? MergeDeepArrayOrTuple<Destination, Source, EnforceOptional<Merge<Options, {spreadTopLevelArrays: false}>>>\n\t\t\t\t: DefaultType\n\t\t\t: DefaultType>;\n\n/**\nMergeDeep options.\n\n@see {@link MergeDeep}\n*/\nexport type MergeDeepOptions = {\n\t/**\n\tMerge mode for array and tuple.\n\n\tWhen we walk through the properties of the objects and the same key is found and both are array or tuple, a merge mode must be chosen:\n\t- `replace`: Replaces the destination value by the source value. This is the default mode.\n\t- `spread`: Spreads the destination and the source values.\n\n\tSee {@link MergeDeep} for usages and examples.\n\n\tNote: Top-level arrays and tuples are always spread.\n\n\t@default 'replace'\n\t*/\n\tarrayMergeMode?: ArrayMergeMode;\n\n\t/**\n\tWhether to affect the individual elements of arrays and tuples.\n\n\tIf this option is set to `true` the following rules are applied:\n\t- If the source does not contain the key, the value of the destination is returned.\n\t- If the source contains the key and the destination does not contain the key, the value of the source is returned.\n\t- If both contain the key, try to merge according to the chosen {@link MergeDeepOptions.arrayMergeMode arrayMergeMode} or return the source if unable to merge.\n\n\t@default false\n\t*/\n\trecurseIntoArrays?: boolean;\n};\n\n/**\nInternal options.\n*/\ntype MergeDeepInternalOptions = Merge<MergeDeepOptions, {spreadTopLevelArrays?: boolean}>;\n\n/**\nMerge default and internal options with user provided options.\n*/\ntype DefaultMergeDeepOptions<Options extends MergeDeepOptions> = Merge<{\n\tarrayMergeMode: 'replace';\n\trecurseIntoArrays: false;\n\tspreadTopLevelArrays: true;\n}, Options>;\n\n/**\nThis utility selects the correct entry point with the corresponding default options. This avoids re-merging the options at each iteration.\n*/\ntype MergeDeepWithDefaultOptions<Destination, Source, Options extends MergeDeepOptions> = SimplifyDeepExcludeArray<\n\t[undefined] extends [Destination | Source]\n\t\t? never\n\t\t: Destination extends UnknownRecord\n\t\t\t? Source extends UnknownRecord\n\t\t\t\t? MergeDeepRecord<Destination, Source, DefaultMergeDeepOptions<Options>>\n\t\t\t\t: never\n\t\t\t: Destination extends UnknownArrayOrTuple\n\t\t\t\t? Source extends UnknownArrayOrTuple\n\t\t\t\t\t? MergeDeepArrayOrTuple<Destination, Source, DefaultMergeDeepOptions<Options>>\n\t\t\t\t\t: never\n\t\t\t\t: never\n>;\n\n/**\nMerge two objects or two arrays/tuples recursively into a new type.\n\n- Properties that only exist in one object are copied into the new object.\n- Properties that exist in both objects are merged if possible or replaced by the one of the source if not.\n- Top-level arrays and tuples are always spread.\n- By default, inner arrays and tuples are replaced. See {@link MergeDeepOptions.arrayMergeMode arrayMergeMode} option to change this behaviour.\n- By default, individual array/tuple elements are not affected. See {@link MergeDeepOptions.recurseIntoArrays recurseIntoArrays} option to change this behaviour.\n\n@example\n```\nimport type {MergeDeep} from 'type-fest';\n\ntype Foo = {\n\tlife: number;\n\titems: string[];\n\ta: {b: string; c: boolean; d: number[]};\n};\n\ntype Bar = {\n\tname: string;\n\titems: number[];\n\ta: {b: number; d: boolean[]};\n};\n\ntype FooBar1 = MergeDeep<Foo, Bar>;\n// {\n// \tlife: number;\n// \tname: string;\n// \titems: number[];\n// \ta: {b: number; c: boolean; d: boolean[]};\n// }\n\ntype FooBar2 = MergeDeep<Foo, Bar, {arrayMergeMode: 'spread'}>;\n// {\n// \tlife: number;\n// \tname: string;\n// \titems: (string | number)[];\n// \ta: {b: number; c: boolean; d: (number | boolean)[]};\n// }\n```\n\n@example\n```\nimport type {MergeDeep} from 'type-fest';\n\n// Merge two arrays\ntype ArrayMerge = MergeDeep<string[], number[]>; // => (string | number)[]\n\n// Merge two tuples\ntype TupleMerge = MergeDeep<[1, 2, 3], ['a', 'b']>; // => (1 | 2 | 3 | 'a' | 'b')[]\n\n// Merge an array into a tuple\ntype TupleArrayMerge = MergeDeep<[1, 2, 3], string[]>; // => (string | 1 | 2 | 3)[]\n\n// Merge a tuple into an array\ntype ArrayTupleMerge = MergeDeep<number[], ['a', 'b']>; // => (number | 'b' | 'a')[]\n```\n\n@example\n```\nimport type {MergeDeep, MergeDeepOptions} from 'type-fest';\n\ntype Foo = {foo: 'foo'; fooBar: string[]};\ntype Bar = {bar: 'bar'; fooBar: number[]};\n\ntype FooBar = MergeDeep<Foo, Bar>;\n//=> {foo: 'foo'; bar: 'bar'; fooBar: number[]}\n\ntype FooBarSpread = MergeDeep<Foo, Bar, {arrayMergeMode: 'spread'}>;\n//=> {foo: 'foo'; bar: 'bar'; fooBar: (string | number)[]}\n\ntype FooBarArray = MergeDeep<Foo[], Bar[]>;\n//=> (Foo | Bar)[]\n\ntype FooBarArrayDeep = MergeDeep<Foo[], Bar[], {recurseIntoArrays: true}>;\n//=> {foo: 'foo'; bar: 'bar'; fooBar: number[]}[]\n\ntype FooBarArraySpreadDeep = MergeDeep<Foo[], Bar[], {recurseIntoArrays: true; arrayMergeMode: 'spread'}>;\n//=> {foo: 'foo'; bar: 'bar'; fooBar: (string | number)[]}[]\n\ntype FooBarTupleDeep = MergeDeep<[Foo, true, 42], [Bar, 'life'], {recurseIntoArrays: true}>;\n//=> [{foo: 'foo'; bar: 'bar'; fooBar: number[]}, 'life', 42]\n\ntype FooBarTupleWithArrayDeep = MergeDeep<[Foo[], true], [Bar[], 'life', 42], {recurseIntoArrays: true}>;\n//=> [{foo: 'foo'; bar: 'bar'; fooBar: number[]}[], 'life', 42]\n```\n\n@example\n```\nimport type {MergeDeep, MergeDeepOptions} from 'type-fest';\n\ndeclare function mergeDeep<Destination, Source, Options extends MergeDeepOptions = {}>(\n\tdestination: Destination,\n\tsource: Source,\n\toptions?: Options,\n): MergeDeep<Destination, Source, Options>;\n```\n\n@experimental This type is marked as experimental because it depends on {@link ConditionalSimplifyDeep} which itself is experimental.\n\n@see {@link MergeDeepOptions}\n\n@category Array\n@category Object\n@category Utilities\n*/\nexport type MergeDeep<Destination, Source, Options extends MergeDeepOptions = {}> = MergeDeepWithDefaultOptions<\n\tSimplifyDeepExcludeArray<Destination>,\n\tSimplifyDeepExcludeArray<Source>,\n\tOptions\n>;\n\nexport {};\n"
  },
  {
    "path": "source/merge-exclusive.d.ts",
    "content": "// Helper type. Not useful on its own.\ntype Without<FirstType, SecondType> = {[KeyType in Exclude<keyof FirstType, keyof SecondType>]?: never};\n\n/**\nCreate a type that has mutually exclusive keys.\n\nThis type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604).\n\nThis type works with a helper type, called `Without`. `Without<FirstType, SecondType>` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`.\n\n@example\n```\nimport type {MergeExclusive} from 'type-fest';\n\ntype ExclusiveVariation1 = {\n\texclusive1: boolean;\n};\n\ntype ExclusiveVariation2 = {\n\texclusive2: string;\n};\n\ntype ExclusiveOptions = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>;\n\nlet exclusiveOptions: ExclusiveOptions;\n\nexclusiveOptions = {exclusive1: true};\n// Works\n\nexclusiveOptions = {exclusive2: 'hi'};\n// Works\n\n// @ts-expect-error\nexclusiveOptions = {exclusive1: true, exclusive2: 'hi'};\n// Error\n```\n\n@category Object\n*/\nexport type MergeExclusive<FirstType, SecondType> =\n\t(FirstType | SecondType) extends object ?\n\t\t(Without<FirstType, SecondType> & SecondType) | (Without<SecondType, FirstType> & FirstType) :\n\t\tFirstType | SecondType;\n\nexport {};\n"
  },
  {
    "path": "source/merge.d.ts",
    "content": "import type {OmitIndexSignature} from './omit-index-signature.d.ts';\nimport type {PickIndexSignature} from './pick-index-signature.d.ts';\nimport type {Simplify} from './simplify.d.ts';\nimport type {If} from './if.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\n\n// Merges two objects without worrying about index signatures.\ntype SimpleMerge<Destination, Source> = Simplify<{\n\t[Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];\n} & Source>;\n\n/**\nMerge two types into a new type. Keys of the second type overrides keys of the first type.\n\nThis is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`.\n\n@example\n```\nimport type {Merge} from 'type-fest';\n\ntype Foo = {\n\ta: string;\n\tb: number;\n};\n\ntype Bar = {\n\ta: number; // Conflicts with Foo['a']\n\tc: boolean;\n};\n\n// With `&`, `a` becomes `string & number` which is `never`. Not what you want.\ntype WithIntersection = (Foo & Bar)['a'];\n//=> never\n\n// With `Merge`, `a` is cleanly overridden to `number`.\ntype WithMerge = Merge<Foo, Bar>['a'];\n//=> number\n```\n\n@example\n```\nimport type {Merge} from 'type-fest';\n\ntype Foo = {\n\t[x: string]: unknown;\n\t[x: number]: unknown;\n\tfoo: string;\n\tbar: symbol;\n};\n\ntype Bar = {\n\t[x: number]: number;\n\t[x: symbol]: unknown;\n\tbar: Date;\n\tbaz: boolean;\n};\n\nexport type FooBar = Merge<Foo, Bar>;\n//=> {\n// \t[x: string]: unknown;\n// \t[x: number]: number;\n// \t[x: symbol]: unknown;\n// \tfoo: string;\n// \tbar: Date;\n// \tbaz: boolean;\n// }\n```\n\nNote: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.\n\n@see {@link ObjectMerge}\n@category Object\n*/\nexport type Merge<Destination, Source> =\n\tDestination extends unknown // For distributing `Destination`\n\t\t? Source extends unknown // For distributing `Source`\n\t\t\t? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>>\n\t\t\t: never // Should never happen\n\t\t: never; // Should never happen\n\nexport type _Merge<Destination, Source> =\n\tSimplify<\n\t\tSimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>>\n\t\t& SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>\n\t>;\n\nexport {};\n"
  },
  {
    "path": "source/multidimensional-array.d.ts",
    "content": "import type {Subtract} from './subtract.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\n\ntype Recursive<T> = Array<Recursive<T>>;\n\n/**\nCreates a type that represents a multidimensional array of the given type and dimension.\n\nUse-cases:\n- Return a n-dimensional array from functions.\n- Declare a n-dimensional array by defining its dimensions rather than declaring `[]` repetitively.\n- Infer the dimensions of a n-dimensional array automatically from function arguments.\n- Avoid the need to know in advance the dimensions of a n-dimensional array allowing them to be dynamic.\n\n@example\n```\nimport type {MultidimensionalArray} from 'type-fest';\n\ndeclare function emptyMatrix<Item = unknown>(): <Dimension extends number>(\n\tdimensions: Dimension,\n) => MultidimensionalArray<Item, Dimension>;\n\nconst unknown3DMatrix = emptyMatrix()(3);\n//=> unknown[][][]\n\nconst boolean2DMatrix = emptyMatrix<boolean>()(2);\n//=> boolean[][]\n```\n\n@category Array\n*/\nexport type MultidimensionalArray<Element, Dimensions extends number> = number extends Dimensions\n\t? Recursive<Element>\n\t: IsEqual<Dimensions, 0> extends true\n\t\t? Element\n\t\t: Array<MultidimensionalArray<Element, Subtract<Dimensions, 1>>>;\n\nexport {};\n"
  },
  {
    "path": "source/multidimensional-readonly-array.d.ts",
    "content": "import type {Subtract} from './subtract.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\n\ntype Recursive<T> = ReadonlyArray<Recursive<T>>;\n\n/**\nCreates a type that represents a multidimensional readonly array that of the given type and dimension.\n\nUse-cases:\n- Return a n-dimensional array from functions.\n- Declare a n-dimensional array by defining its dimensions rather than declaring `[]` repetitively.\n- Infer the dimensions of a n-dimensional array automatically from function arguments.\n- Avoid the need to know in advance the dimensions of a n-dimensional array allowing them to be dynamic.\n\n@example\n```\nimport type {MultidimensionalReadonlyArray} from 'type-fest';\n\ndeclare function emptyMatrix<Item = unknown>(): <Dimension extends number>(\n\tdimensions: Dimension,\n) => MultidimensionalReadonlyArray<Item, Dimension>;\n\nconst readonlyUnknown3DMatrix = emptyMatrix()(3);\n//=> readonly (readonly (readonly unknown[])[])[]\n\nconst readonlyBoolean2DMatrix = emptyMatrix<boolean>()(2);\n//=> readonly (readonly boolean[])[]\n```\n\n@category Array\n*/\nexport type MultidimensionalReadonlyArray<Element, Dimensions extends number> = number extends Dimensions\n\t? Recursive<Element>\n\t: IsEqual<Dimensions, 0> extends true\n\t\t? Element\n\t\t: ReadonlyArray<MultidimensionalReadonlyArray<Element, Subtract<Dimensions, 1>>>;\n\nexport {};\n"
  },
  {
    "path": "source/non-empty-object.d.ts",
    "content": "import type {HasRequiredKeys} from './has-required-keys.d.ts';\nimport type {RequireAtLeastOne} from './require-at-least-one.d.ts';\n\n/**\nRepresents an object with at least 1 non-optional key.\n\nThis is useful when you need an object where all keys are optional, but there must be at least 1 key.\n\n@example\n```\nimport type {NonEmptyObject} from 'type-fest';\n\ntype User = {\n\tname: string;\n\tsurname: string;\n\tid: number;\n};\n\ntype UpdateRequest<Entity extends object> = NonEmptyObject<Partial<Entity>>;\n\nconst update1: UpdateRequest<User> = {\n\tname: 'Alice',\n\tsurname: 'Acme',\n};\n\n// At least 1 key is required, therefore this will report a 2322 error:\n// Type '{}' is not assignable to type 'UpdateRequest<User>'\n// @ts-expect-error\nconst update2: UpdateRequest<User> = {};\n```\n\n@see Use `IsEmptyObject` to check whether an object is empty.\n\n@category Object\n*/\nexport type NonEmptyObject<T extends object> = HasRequiredKeys<T> extends true ? T : RequireAtLeastOne<T, keyof T>;\n\nexport {};\n"
  },
  {
    "path": "source/non-empty-string.d.ts",
    "content": "/**\nMatches any non-empty string.\n\nThis is useful when you need a string that is not empty, for example, as a function parameter.\n\nNOTE:\n- This returns `never` not just when instantiated with an empty string, but also when an empty string is a subtype of the instantiated type, like `string` or `Uppercase<string>`.\n\n@example\n```\nimport type {NonEmptyString} from 'type-fest';\n\ndeclare function foo<T extends string>(string: NonEmptyString<T>): void;\n\nfoo('a');\n// OK\n\n// @ts-expect-error\nfoo('');\n// Error: Argument of type '\"\"' is not assignable to parameter of type 'never'.\n\ndeclare const someString: string;\n// @ts-expect-error\nfoo(someString);\n// Error: Argument of type 'string' is not assignable to parameter of type 'never'.\n```\n\n@category String\n*/\nexport type NonEmptyString<T extends string> = '' extends T ? never : T;\n\nexport {};\n"
  },
  {
    "path": "source/non-empty-tuple.d.ts",
    "content": "/**\nMatches any non-empty tuple.\n\n@example\n```\nimport type {NonEmptyTuple} from 'type-fest';\n\nconst sum = (...numbers: NonEmptyTuple<number>) => numbers.reduce((total, value) => total + value, 0);\n\nsum(1, 2, 3);\n// Ok\n\n// @ts-expect-error\nsum();\n// Error: Expected at least 1 arguments, but got 0.\n```\n\n@see {@link RequireAtLeastOne} for objects\n\n@category Array\n*/\nexport type NonEmptyTuple<T = unknown> = readonly [T, ...T[]];\n\nexport {};\n"
  },
  {
    "path": "source/numeric.d.ts",
    "content": "import type {IsFloat} from './is-float.d.ts';\nimport type {IsInteger} from './is-integer.d.ts';\n\nexport type _Numeric = number | bigint;\n\ntype Zero = 0 | 0n;\n\n/**\nMatches the hidden `Infinity` type.\n\nPlease upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.\n\n@see {@link NegativeInfinity}\n\n@category Numeric\n*/\n// See https://github.com/microsoft/TypeScript/issues/31752\n// eslint-disable-next-line no-loss-of-precision\nexport type PositiveInfinity = 1e999;\n\n/**\nMatches the hidden `-Infinity` type.\n\nPlease upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.\n\n@see {@link PositiveInfinity}\n\n@category Numeric\n*/\n// See https://github.com/microsoft/TypeScript/issues/31752\n// eslint-disable-next-line no-loss-of-precision\nexport type NegativeInfinity = -1e999;\n\n/**\nA finite `number`.\nYou can't pass a `bigint` as they are already guaranteed to be finite.\n\nUse-case: Validating and documenting parameters.\n\nNote: This can't detect `NaN`, please upvote [this issue](https://github.com/microsoft/TypeScript/issues/28682) if you want to have this type as a built-in in TypeScript.\n\n@example\n```\nimport type {Finite} from 'type-fest';\n\ndeclare function setScore<T extends number>(length: Finite<T>): void;\n```\n\n@category Numeric\n*/\nexport type Finite<T extends number> = T extends PositiveInfinity | NegativeInfinity ? never : T;\n\n/**\nA `number` that is an integer.\n\nUse-case: Validating and documenting parameters.\n\n@example\n```\nimport type {Integer} from 'type-fest';\n\ntype SomeInteger = Integer<1>;\n//=> 1\n\ntype IntegerWithDecimal = Integer<1.0>;\n//=> 1\n\ntype NegativeInteger = Integer<-1>;\n//=> -1\n\ntype Float = Integer<1.5>;\n//=> never\n\n// Supports non-decimal numbers\n\ntype OctalInteger = Integer<0o10>;\n//=> 8\n\ntype BinaryInteger = Integer<0b10>;\n//=> 2\n\ntype HexadecimalInteger = Integer<0x10>;\n//=> 16\n```\n\n@example\n```\nimport type {Integer} from 'type-fest';\n\ndeclare function setYear<T extends number>(length: Integer<T>): void;\n```\n\n@see {@link NegativeInteger}\n@see {@link NonNegativeInteger}\n\n@category Numeric\n*/\n// `${bigint}` is a type that matches a valid bigint literal without the `n` (ex. 1, 0b1, 0o1, 0x1)\n// Because T is a number and not a string we can effectively use this to filter out any numbers containing decimal points\nexport type Integer<T> =\n\tT extends unknown // To distributive type\n\t\t? IsInteger<T> extends true ? T : never\n\t\t: never; // Never happens\n\n/**\nA `number` that is not an integer.\n\nUse-case: Validating and documenting parameters.\n\nIt does not accept `Infinity`.\n\n@example\n```\nimport type {Float} from 'type-fest';\n\ndeclare function setPercentage<T extends number>(length: Float<T>): void;\n```\n\n@see {@link Integer}\n\n@category Numeric\n*/\nexport type Float<T> =\nT extends unknown // To distributive type\n\t? IsFloat<T> extends true ? T : never\n\t: never; // Never happens\n\n/**\nA negative (`-∞ < x < 0`) `number` that is not an integer.\nEquivalent to `Negative<Float<T>>`.\n\nUse-case: Validating and documenting parameters.\n\n@see {@link Negative}\n@see {@link Float}\n\n@category Numeric\n*/\nexport type NegativeFloat<T extends number> = Negative<Float<T>>;\n\n/**\nA negative `number`/`bigint` (`-∞ < x < 0`)\n\nUse-case: Validating and documenting parameters.\n\n@see {@link NegativeInteger}\n@see {@link NonNegative}\n\n@category Numeric\n*/\nexport type Negative<T extends _Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never;\n\n/**\nA negative (`-∞ < x < 0`) `number` that is an integer.\nEquivalent to `Negative<Integer<T>>`.\n\nYou can't pass a `bigint` as they are already guaranteed to be integers, instead use `Negative<T>`.\n\nUse-case: Validating and documenting parameters.\n\n@see {@link Negative}\n@see {@link Integer}\n\n@category Numeric\n*/\nexport type NegativeInteger<T extends number> = Negative<Integer<T>>;\n\n/**\nA non-negative `number`/`bigint` (`0 <= x < ∞`).\n\nUse-case: Validating and documenting parameters.\n\n@see {@link NonNegativeInteger}\n@see {@link Negative}\n\n@example\n```\nimport type {NonNegative} from 'type-fest';\n\ndeclare function setLength<T extends number>(length: NonNegative<T>): void;\n```\n\n@category Numeric\n*/\nexport type NonNegative<T extends _Numeric> = T extends Zero ? T : Negative<T> extends never ? T : never;\n\n/**\nA non-negative (`0 <= x < ∞`) `number` that is an integer.\nEquivalent to `NonNegative<Integer<T>>`.\n\nYou can't pass a `bigint` as they are already guaranteed to be integers, instead use `NonNegative<T>`.\n\nUse-case: Validating and documenting parameters.\n\n@see {@link NonNegative}\n@see {@link Integer}\n\n@example\n```\nimport type {NonNegativeInteger} from 'type-fest';\n\ndeclare function setLength<T extends number>(length: NonNegativeInteger<T>): void;\n```\n\n@category Numeric\n*/\nexport type NonNegativeInteger<T extends number> = NonNegative<Integer<T>>;\n\n/**\nReturns a boolean for whether the given number is a negative number.\n\n@see {@link Negative}\n\n@example\n```\nimport type {IsNegative} from 'type-fest';\n\ntype ShouldBeFalse = IsNegative<1>;\ntype ShouldBeTrue = IsNegative<-1>;\n```\n\n@category Numeric\n*/\nexport type IsNegative<T extends _Numeric> = T extends Negative<T> ? true : false;\n\nexport {};\n"
  },
  {
    "path": "source/object-merge.d.ts",
    "content": "import type {If} from './if.d.ts';\nimport type {NormalizedKeys} from './internal/object.d.ts';\nimport type {IfNotAnyOrNever, IsExactOptionalPropertyTypesEnabled, MapsSetsOrArrays} from './internal/type.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {IsOptionalKeyOf} from './is-optional-key-of.d.ts';\nimport type {OmitIndexSignature} from './omit-index-signature.d.ts';\nimport type {PickIndexSignature} from './pick-index-signature.d.ts';\nimport type {RequiredKeysOf} from './required-keys-of.d.ts';\nimport type {Simplify} from './simplify.d.ts';\n\n/**\nMerge two object types into a new object type, where keys from the second override keys from the first.\n\n@example\n```ts\nimport type {ObjectMerge} from 'type-fest';\n\ntype PartialOverride = ObjectMerge<{foo: string; bar: string}, {foo: number; baz: number}>;\n//=> {foo: number; baz: number; bar: string}\n\ntype CompleteOverride = ObjectMerge<{foo: string; bar: number}, {foo: number; bar: string; baz: boolean}>;\n//=> {foo: number; bar: string; baz: boolean}\n\ntype NoOverride = ObjectMerge<{foo: string; bar: number}, {baz: boolean; qux: bigint}>;\n//=> {baz: boolean; qux: bigint; foo: string; bar: number}\n```\n\nUse-cases:\n\nCan be used to accurately type object spread and `Object.assign`. The built-in inference for these operations can sometimes be unsound, especially when index signatures are involved.\n\nIn the following example, both object spread and `Object.assign` produce a type that allows unsafe usage, whereas `ObjectMerge` produces a type that prevents this unsafe access.\n\n@example\n```ts\nimport type {ObjectMerge} from 'type-fest';\n\nconst left: {a: string} = {a: '1'};\nconst right: {[x: string]: number} = {a: 1};\n\nconst inferred = {...left, ...right};\n//=> {a: string}\n\ninferred.a.toUpperCase(); // No compile time error, but fails at runtime.\n\nconst objectAssign = Object.assign(left, right);\n//=> {a: string} & {[x: string]: number}\n\nobjectAssign.a.toUpperCase(); // No compile time error, but fails at runtime.\n\ndeclare const objectMerge: ObjectMerge<typeof left, typeof right>;\n//=> {[x: string]: string | number; a: string | number}\n\n// @ts-expect-error\nobjectMerge.a.toUpperCase(); // Correctly errors at compile time.\n```\n\nCan be used to merge generic type arguments.\n\nIn the following example, object spread without `ObjectMerge` produces an intersection type that is not particularly usable, whereas `ObjectMerge` produces a correctly merged and usable result.\n\n@example\n```ts\nimport type {ObjectMerge} from 'type-fest';\n\nfunction withoutObjectMerge<T extends object, U extends object>(left: T, right: U) {\n\treturn {...left, ...right};\n}\n\nconst result1 = withoutObjectMerge({a: 1}, {a: 'one'});\n//=> {a: number} & {a: string}\n\nconst {a} = result1;\n//=> never\n\nfunction withObjectMerge<T extends object, U extends object>(left: T, right: U) {\n\treturn {...left, ...right} as unknown as ObjectMerge<T, U>;\n}\n\nconst result2 = withObjectMerge({b: 1}, {b: 'one'});\n//=> {b: string}\n\nconst {b} = result2;\n//=> string\n```\n\nNote: If you want a simple merge where properties from the second object always override properties from the first object without considering runtime implications, refer to the {@link Merge} type.\n\n@see {@link Merge}\n@category Object\n*/\nexport type ObjectMerge<First extends object, Second extends object> =\n\tIfNotAnyOrNever<First, IfNotAnyOrNever<Second, First extends unknown // For distributing `First`\n\t\t? Second extends unknown // For distributing `Second`\n\t\t\t? First extends MapsSetsOrArrays\n\t\t\t\t? unknown\n\t\t\t\t: Second extends MapsSetsOrArrays\n\t\t\t\t\t? unknown\n\t\t\t\t\t: _ObjectMerge<\n\t\t\t\t\t\tFirst,\n\t\t\t\t\t\tSecond,\n\t\t\t\t\t\tNormalizedLiteralKeys<First>,\n\t\t\t\t\t\tNormalizedLiteralKeys<Second>,\n\t\t\t\t\t\tIsExactOptionalPropertyTypesEnabled extends true ? Required<First> : First,\n\t\t\t\t\t\tIsExactOptionalPropertyTypesEnabled extends true ? Required<Second> : Second\n\t\t\t\t\t>\n\t\t\t: never // Should never happen\n\t\t: never>, First & Second>; // Should never happen\n\ntype _ObjectMerge<\n\tFirst extends object,\n\tSecond extends object,\n\tNormalizedFirstLiteralKeys extends PropertyKey,\n\tNormalizedSecondLiteralKeys extends PropertyKey,\n\tNormalizedFirst extends object,\n\tNormalizedSecond extends object,\n> = Simplify<{\n\t// Map over literal keys of `Second`, except those that are optional and also present in `First`.\n\t-readonly [P in keyof Second as P extends NormalizedSecondLiteralKeys\n\t\t? P extends NormalizedFirstLiteralKeys\n\t\t\t? If<IsOptionalKeyOf<Second, P>, never, P>\n\t\t\t: P\n\t\t: never]:\n\t\t\t| Second[P]\n\t\t\t| (P extends NormalizedKeys<keyof PickIndexSignature<First>>\n\t\t\t\t? If<IsOptionalKeyOf<Second, P>, First[NormalizedKeys<P> & keyof First], never>\n\t\t\t\t: never)\n} & {\n\t// Map over literal keys of `First`, except those that are not present in `Second`.\n\t-readonly [P in keyof First as P extends NormalizedFirstLiteralKeys\n\t\t? P extends NormalizedSecondLiteralKeys\n\t\t\t? never\n\t\t\t: P\n\t\t: never]:\n\t\t\t| First[P]\n\t\t\t\t// If there's a matching index signature in `Second`, then add the type for it as well,\n\t\t\t\t// for example, in `ObjectMerge<{a: string}, {[x: string]: number}>`, `a` is of type `string | number`.\n\t\t\t| (P extends NormalizedKeys<keyof Second>\n\t\t\t\t? Second[NormalizedKeys<P> & keyof Second]\n\t\t\t\t: never);\n} & {\n\t// Map over non-literal keys of `Second`.\n\t-readonly [P in keyof Second as P extends NormalizedSecondLiteralKeys ? never : P]:\n\t\t| Second[P]\n\t\t\t// If there's a matching key in `First`, then add the type for it as well,\n\t\t\t// for example, in `ObjectMerge<{a: number}, {[x: string]: string}>`,\n\t\t\t// the resulting type is `{[x: string]: number | string; a: number | string}`.\n\t\t\t// But, exclude keys from `First` that would surely get overwritten,\n\t\t\t// for example, in `ObjectMerge<{a: number}, {[x: string]: string; a: string}>`,\n\t\t\t// `a` from `First` would get overwritten by `a` from `Second`, so don't add type for it.\n\t\t| (NormalizedKeys<P> & Exclude<keyof First, NormalizedKeys<RequiredKeysOf<OmitIndexSignature<Second>>>> extends infer NonOverwrittenKeysOfFirst\n\t\t\t? If<IsNever<NonOverwrittenKeysOfFirst>, // This check is required because indexing with `never` doesn't always yield `never`, for example, `{[x: string]: number}[never]` results in `number`.\n\t\t\t\tnever,\n\t\t\t\tNormalizedFirst[NonOverwrittenKeysOfFirst & keyof NormalizedFirst]>\n\t\t\t: never); // Should never happen\n} & {\n\t// Map over non-literal keys of `First`.\n\t-readonly [P in keyof First as P extends NormalizedFirstLiteralKeys ? never : P]:\n\t\t| First[P]\n\t\t| If<IsNever<NormalizedKeys<P> & keyof Second>, // This check is required because indexing with `never` doesn't always yield `never`, for example, `{[x: string]: number}[never]` results in `number`.\n\t\t\tnever,\n\t\t\tNormalizedSecond[NormalizedKeys<P> & keyof NormalizedSecond]>;\n} & {\n\t// Handle optional keys of `Second` that are also present in `First`.\n\t// Map over `First` instead of `Second` because the modifier is in accordance with `First`.\n\t-readonly [P in keyof First as P extends NormalizedFirstLiteralKeys\n\t\t? P extends NormalizedSecondLiteralKeys\n\t\t\t? If<IsOptionalKeyOf<Second, NormalizedKeys<P> & keyof Second>, P, never>\n\t\t\t: never\n\t\t: never]:\n\t\t\t| First[P]\n\t\t\t| NormalizedSecond[NormalizedKeys<P> & keyof NormalizedSecond]\n}>;\n\n/**\nGet literal keys of a type, including both string and number representations wherever applicable.\n\n@example\n```ts\ntype A = NormalizedLiteralKeys<{0: string; '1'?: number; foo: boolean}>;\n//=> 0 | '0' | 1 | '1' | 'foo'\n\ntype B = NormalizedLiteralKeys<{[x: string]: string | number; 0: string; '1'?: number}>;\n//=> 0 | '0' | 1 | '1'\n\ntype C = NormalizedLiteralKeys<{[x: string]: unknown}>;\n//=> never\n```\n*/\ntype NormalizedLiteralKeys<Type> = Type extends unknown // For distributing `Type`\n\t? NormalizedKeys<keyof OmitIndexSignature<Type>>\n\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/omit-deep.d.ts",
    "content": "import type {ArraySplice} from './array-splice.d.ts';\nimport type {ExactKey, IsArrayReadonly, NonRecursiveType, SetArrayAccess, ToString} from './internal/index.d.ts';\nimport type {IsEqual} from './is-equal.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {LiteralUnion} from './literal-union.d.ts';\nimport type {Paths} from './paths.d.ts';\nimport type {SimplifyDeep} from './simplify-deep.d.ts';\nimport type {UnionToTuple} from './union-to-tuple.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nOmit properties from a deeply-nested object.\n\nIt supports recursing into arrays.\n\nIt supports removing specific items from an array, replacing each removed item with unknown at the specified index.\n\nUse-case: Remove unneeded parts of complex objects.\n\nUse [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys) if you only need one level deep.\n\n@example\n```\nimport type {OmitDeep} from 'type-fest';\n\ntype Info = {\n\tuserInfo: {\n\t\tname: string;\n\t\tuselessInfo: {\n\t\t\tfoo: string;\n\t\t};\n\t};\n};\n\ntype UsefulInfo = OmitDeep<Info, 'userInfo.uselessInfo'>;\n//=> {userInfo: {name: string}}\n\n// Supports removing multiple paths\ntype Info1 = {\n\tuserInfo: {\n\t\tname: string;\n\t\tuselessField: string;\n\t\tuselessInfo: {\n\t\t\tfoo: string;\n\t\t};\n\t};\n};\n\ntype UsefulInfo1 = OmitDeep<Info1, 'userInfo.uselessInfo' | 'userInfo.uselessField'>;\n//=> {userInfo: {name: string}}\n\n// Supports array\ntype A = OmitDeep<[1, 'foo', 2], '1'>;\n//=> [1, unknown, 2]\n\n// Supports recursing into array\n\ntype Info2 = {\n\taddress: [\n\t\t{\n\t\t\tstreet: string;\n\t\t},\n\t\t{\n\t\t\tstreet2: string;\n\t\t\tfoo: string;\n\t\t},\n\t];\n};\n\ntype AddressInfo = OmitDeep<Info2, 'address.1.foo'>;\n//=> {address: [{street: string}, {street2: string}]}\n```\n\n@category Object\n@category Array\n*/\nexport type OmitDeep<T, PathUnion extends LiteralUnion<Paths<T>, string>> =\n\tSimplifyDeep<\n\t\tOmitDeepHelper<T, UnionToTuple<PathUnion>>,\n\t\tUnknownArray>;\n\n/**\nInternal helper for {@link OmitDeep}.\n\nRecursively transforms `T` by applying {@link OmitDeepWithOnePath} for each path in `PathTuple`.\n*/\ntype OmitDeepHelper<T, PathTuple extends UnknownArray> =\n\tPathTuple extends [infer Path, ...infer RestPaths]\n\t\t? OmitDeepHelper<OmitDeepWithOnePath<T, Path & (string | number)>, RestPaths>\n\t\t: T;\n\n/**\nOmit one path from the given object/array.\n*/\ntype OmitDeepWithOnePath<T, Path extends string | number> =\nT extends NonRecursiveType\n\t? T\n\t: T extends UnknownArray ? SetArrayAccess<OmitDeepArrayWithOnePath<T, Path>, IsArrayReadonly<T>>\n\t\t: T extends object ? OmitDeepObjectWithOnePath<T, Path>\n\t\t\t: T;\n\n/**\nOmit one path from the given object.\n*/\ntype OmitDeepObjectWithOnePath<ObjectT extends object, P extends string | number> =\nP extends `${infer RecordKeyInPath}.${infer SubPath}`\n\t? {\n\t\t[Key in keyof ObjectT]:\n\t\tIsEqual<RecordKeyInPath, ToString<Key>> extends true\n\t\t\t? ExactKey<ObjectT, Key> extends infer RealKey\n\t\t\t\t? RealKey extends keyof ObjectT\n\t\t\t\t\t? OmitDeepWithOnePath<ObjectT[RealKey], SubPath>\n\t\t\t\t\t: ObjectT[Key]\n\t\t\t\t: ObjectT[Key]\n\t\t\t: ObjectT[Key]\n\t}\n\t: ExactKey<ObjectT, P> extends infer Key\n\t\t? IsNever<Key> extends true\n\t\t\t? ObjectT\n\t\t\t: Key extends PropertyKey\n\t\t\t\t? Omit<ObjectT, Key>\n\t\t\t\t: ObjectT\n\t\t: ObjectT;\n\n/**\nOmit one path from from the given array.\n\nIt replaces the item to `unknown` at the given index.\n\n@example\n```\ntype A = OmitDeepArrayWithOnePath<[10, 20, 30, 40], 2>;\n//=> type A = [10, 20, unknown, 40];\n```\n*/\ntype OmitDeepArrayWithOnePath<ArrayType extends UnknownArray, P extends string | number> =\n\t// Handle paths that are `${number}.${string}`\n\tP extends `${infer ArrayIndex extends number}.${infer SubPath}`\n\t\t// If `ArrayIndex` is equal to `number`\n\t\t? number extends ArrayIndex\n\t\t\t? Array<OmitDeepWithOnePath<NonNullable<ArrayType[number]>, SubPath>>\n\t\t\t// If `ArrayIndex` is a number literal\n\t\t\t: ArraySplice<ArrayType, ArrayIndex, 1, [OmitDeepWithOnePath<NonNullable<ArrayType[ArrayIndex]>, SubPath>]>\n\t\t// If the path is equal to `number`\n\t\t: P extends `${infer ArrayIndex extends number}`\n\t\t\t// If `ArrayIndex` is `number`\n\t\t\t? number extends ArrayIndex\n\t\t\t\t? []\n\t\t\t\t// If `ArrayIndex` is a number literal\n\t\t\t\t: ArraySplice<ArrayType, ArrayIndex, 1, [unknown]>\n\t\t\t: ArrayType;\n\nexport {};\n"
  },
  {
    "path": "source/omit-index-signature.d.ts",
    "content": "/**\nOmit any index signatures from the given object type, leaving only explicitly defined properties.\n\nThis is the counterpart of `PickIndexSignature`.\n\nUse-cases:\n- Remove overly permissive signatures from third-party types.\n\nThis type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).\n\nIt relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.\n\n(The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)\n\n```\nconst indexed: Record<string, unknown> = {}; // Allowed\n\n// @ts-expect-error\nconst keyed: Record<'foo', unknown> = {}; // Error\n// TS2739: Type '{}' is missing the following properties from type 'Record<\"foo\" | \"bar\", unknown>': foo, bar\n```\n\nInstead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:\n\n```\ntype Indexed = {} extends Record<string, unknown>\n\t? '✅ `{}` is assignable to `Record<string, unknown>`'\n\t: '❌ `{}` is NOT assignable to `Record<string, unknown>`';\n\ntype IndexedResult = Indexed;\n//=> '✅ `{}` is assignable to `Record<string, unknown>`'\n\ntype Keyed = {} extends Record<'foo' | 'bar', unknown>\n\t? '✅ `{}` is assignable to `Record<\\'foo\\' | \\'bar\\', unknown>`'\n\t: '❌ `{}` is NOT assignable to `Record<\\'foo\\' | \\'bar\\', unknown>`';\n\ntype KeyedResult = Keyed;\n//=> '❌ `{}` is NOT assignable to `Record<\\'foo\\' | \\'bar\\', unknown>`'\n```\n\nUsing a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...\n\n```\ntype OmitIndexSignature<ObjectType> = {\n\t[KeyType in keyof ObjectType // Map each key of `ObjectType`...\n\t]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.\n};\n```\n\n...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...\n\n```\ntype OmitIndexSignature<ObjectType> = {\n\t[KeyType in keyof ObjectType\n\t// Is `{}` assignable to `Record<KeyType, unknown>`?\n\tas {} extends Record<KeyType, unknown>\n\t\t? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`\n\t\t: KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`\n\t]: ObjectType[KeyType];\n};\n```\n\nIf `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a \"real\" key and we want to keep it.\n\n@example\n```\nimport type {OmitIndexSignature} from 'type-fest';\n\ntype Example = {\n\t// These index signatures will be removed.\n\t[x: string]: any;\n\t[x: number]: any;\n\t[x: symbol]: any;\n\t[x: `head-${string}`]: string;\n\t[x: `${string}-tail`]: string;\n\t[x: `head-${string}-tail`]: string;\n\t[x: `${bigint}`]: string;\n\t[x: `embedded-${number}`]: string;\n\n\t// These explicitly defined keys will remain.\n\tfoo: 'bar';\n\tqux?: 'baz';\n};\n\ntype ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;\n//=> {foo: 'bar'; qux?: 'baz'}\n```\n\n@see {@link PickIndexSignature}\n@category Object\n*/\nexport type OmitIndexSignature<ObjectType> = {\n\t[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>\n\t\t? never\n\t\t: KeyType]: ObjectType[KeyType];\n};\n\nexport {};\n"
  },
  {
    "path": "source/opaque.d.ts",
    "content": "export type * from './tagged.d.ts';\n\nexport {};\n"
  },
  {
    "path": "source/optional-keys-of.d.ts",
    "content": "import type {IsOptionalKeyOf} from './is-optional-key-of.d.ts';\n\n/**\nExtract all optional keys from the given type.\n\nThis is useful when you want to create a new type that contains different type values for the optional keys only.\n\n@example\n```\nimport type {OptionalKeysOf, Except} from 'type-fest';\n\ntype User = {\n\tname: string;\n\tsurname: string;\n\n\tluckyNumber?: number;\n};\n\nconst REMOVE_FIELD = Symbol('remove field symbol');\ntype UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {\n\t[Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;\n};\n\nconst update1: UpdateOperation<User> = {\n\tname: 'Alice',\n};\n\nconst update2: UpdateOperation<User> = {\n\tname: 'Bob',\n\tluckyNumber: REMOVE_FIELD,\n};\n```\n\n@category Utilities\n*/\nexport type OptionalKeysOf<Type extends object> =\n\tType extends unknown // For distributing `Type`\n\t\t? (keyof {[Key in keyof Type as\n\t\t\tIsOptionalKeyOf<Type, Key> extends false\n\t\t\t\t? never\n\t\t\t\t: Key\n\t\t\t]: never\n\t\t}) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/optional.d.ts",
    "content": "/**\nCreate a type that represents either the value or `undefined`, while stripping `null` from the type.\n\nUse-cases:\n- Enforcing the practice of using `undefined` instead of `null` as the \"absence of value\" marker.\n- Converting APIs that return `null` (DOM, JSON, legacy libraries) to use `undefined` consistently.\n\n@example\n```\nimport type {Optional} from 'type-fest';\n\n// Adds `undefined` to the type\ntype MaybeNumber = Optional<number>;\n//=> number | undefined\n\n// Strips `null` from the type\ntype NullableString = Optional<string | null>;\n//=> string | undefined\n\ntype Config = {\n\tname: string;\n\tdescription: Optional<string>;\n\t//=> string | undefined\n};\n```\n\n@category Utilities\n*/\nexport type Optional<Value> = Exclude<Value, null> | undefined;\n\nexport {};\n"
  },
  {
    "path": "source/or-all.d.ts",
    "content": "import type {SomeExtend} from './some-extend.d.ts';\n\n/**\nReturns a boolean for whether any of the given elements is `true`.\n\nUse-cases:\n- Check if at least one condition in a list of booleans is met.\n\n@example\n```\nimport type {OrAll} from 'type-fest';\n\ntype FFT = OrAll<[false, false, true]>;\n//=> true\n\ntype FFF = OrAll<[false, false, false]>;\n//=> false\n```\n\nNote: When `boolean` is passed as an element, it is distributed into separate cases, and the final result is a union of those cases.\nFor example, `OrAll<[false, boolean]>` expands to `OrAll<[false, true]> | OrAll<[false, false]>`, which simplifies to `true | false` (i.e., `boolean`).\n\n@example\n```\nimport type {OrAll} from 'type-fest';\n\ntype A = OrAll<[false, boolean]>;\n//=> boolean\n\ntype B = OrAll<[true, boolean]>;\n//=> true\n```\n\nNote: If `never` is passed as an element, it is treated as `false` and the result is computed accordingly.\n\n@example\n```\nimport type {OrAll} from 'type-fest';\n\ntype A = OrAll<[never, never, true]>;\n//=> true\n\ntype B = OrAll<[never, never, false]>;\n//=> false\n\ntype C = OrAll<[never, never, never]>;\n//=> false\n\ntype D = OrAll<[never, never, boolean]>;\n//=> boolean\n```\n\nNote: If `any` is passed as an element, it is treated as `boolean` and the result is computed accordingly.\n\n@example\n```\nimport type {OrAll} from 'type-fest';\n\ntype A = OrAll<[false, any]>;\n//=> boolean\n\ntype B = OrAll<[true, any]>;\n//=> true\n```\n\nNote: `OrAll<[]>` evaluates to `false` because there are no `true` elements in an empty tuple. See [Wikipedia: Clause (logic) > Empty clauses](https://en.wikipedia.org/wiki/Clause_(logic)#Empty_clauses:~:text=The%20truth%20evaluation%20of%20an%20empty%20disjunctive%20clause%20is%20always%20false.).\n\n@see {@link Or}\n@see {@link AndAll}\n*/\nexport type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;\n\nexport {};\n"
  },
  {
    "path": "source/or.d.ts",
    "content": "import type {OrAll} from './or-all.d.ts';\n\n/**\nReturns a boolean for whether either of two given types is true.\n\nUse-case: Constructing complex conditional types where at least one condition must be satisfied.\n\n@example\n```\nimport type {Or} from 'type-fest';\n\ntype TT = Or<true, true>;\n//=> true\n\ntype TF = Or<true, false>;\n//=> true\n\ntype FT = Or<false, true>;\n//=> true\n\ntype FF = Or<false, false>;\n//=> false\n```\n\nNote: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.\nFor example, `Or<false, boolean>` expands to `Or<false, true> | Or<false, false>`, which simplifies to `true | false` (i.e., `boolean`).\n\n@example\n```\nimport type {Or} from 'type-fest';\n\ntype A = Or<false, boolean>;\n//=> boolean\n\ntype B = Or<boolean, false>;\n//=> boolean\n\ntype C = Or<true, boolean>;\n//=> true\n\ntype D = Or<boolean, true>;\n//=> true\n\ntype E = Or<boolean, boolean>;\n//=> boolean\n```\n\nNote: If `never` is passed as an argument, it is treated as `false` and the result is computed accordingly.\n\n@example\n```\nimport type {Or} from 'type-fest';\n\ntype A = Or<true, never>;\n//=> true\n\ntype B = Or<never, true>;\n//=> true\n\ntype C = Or<false, never>;\n//=> false\n\ntype D = Or<never, false>;\n//=> false\n\ntype E = Or<boolean, never>;\n//=> boolean\n\ntype F = Or<never, boolean>;\n//=> boolean\n\ntype G = Or<never, never>;\n//=> false\n```\n\n@see {@link OrAll}\n@see {@link And}\n@see {@link Xor}\n*/\nexport type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;\n\nexport {};\n"
  },
  {
    "path": "source/override-properties.d.ts",
    "content": "import type {Merge} from './merge.d.ts';\n\n/**\nOverride existing properties of the given type. Similar to `Merge`, but enforces that the original type has the properties you want to override.\n\nThis is useful when you want to override existing properties with a different type and make sure that these properties really exist in the original.\n\n@example\n```\nimport type {OverrideProperties} from 'type-fest';\n\ntype Foo = {\n\ta: string;\n\tb: string;\n};\n\ntype Bar = OverrideProperties<Foo, {b: number}>;\n//=> {a: string; b: number}\n\n// @ts-expect-error\ntype Baz = OverrideProperties<Foo, {c: number}>;\n// Error, type '{ c: number; }' does not satisfy the constraint '{ c: never; }'\n\n// @ts-expect-error\ntype Fizz = OverrideProperties<Foo, {b: number; c: number}>;\n// Error, type '{ b: number; c: number; }' does not satisfy the constraint '{ b: number; c: never; }'\n```\n\n@category Object\n*/\nexport type OverrideProperties<\n\tTOriginal,\n\t// This first bit where we use `Partial` is to enable autocomplete\n\t// and the second bit with the mapped type is what enforces that we don't try\n\t// to override properties that doesn't exist in the original type.\n\tTOverride extends Partial<Record<keyof TOriginal, unknown>> & {\n\t\t[Key in keyof TOverride]: Key extends keyof TOriginal\n\t\t\t? TOverride[Key]\n\t\t\t: never;\n\t},\n> = Merge<TOriginal, TOverride>;\n\nexport {};\n"
  },
  {
    "path": "source/package-json.d.ts",
    "content": "import type {JsonObject, JsonValue} from './json-value.d.ts';\nimport type {LiteralUnion} from './literal-union.d.ts';\n\nexport namespace PackageJson {\n\t/**\n\tA person who has been involved in creating or maintaining the package.\n\t*/\n\ttype Person =\n\t\t| string\n\t\t| {\n\t\t\tname: string;\n\t\t\turl?: string;\n\t\t\temail?: string;\n\t\t};\n\n\ttype BugsLocation =\n\t\t| string\n\t\t| {\n\t\t\t/**\n\t\t\tThe URL to the package's issue tracker.\n\t\t\t*/\n\t\t\turl?: string;\n\n\t\t\t/**\n\t\t\tThe email address to which issues should be reported.\n\t\t\t*/\n\t\t\temail?: string;\n\t\t};\n\n\ttype DirectoryLocations = {\n\t\t[directoryType: string]: JsonValue | undefined;\n\n\t\t/**\n\t\tLocation for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.\n\t\t*/\n\t\tbin?: string;\n\n\t\t/**\n\t\tLocation for Markdown files.\n\t\t*/\n\t\tdoc?: string;\n\n\t\t/**\n\t\tLocation for example scripts.\n\t\t*/\n\t\texample?: string;\n\n\t\t/**\n\t\tLocation for the bulk of the library.\n\t\t*/\n\t\tlib?: string;\n\n\t\t/**\n\t\tLocation for man pages. Sugar to generate a `man` array by walking the folder.\n\t\t*/\n\t\tman?: string;\n\n\t\t/**\n\t\tLocation for test files.\n\t\t*/\n\t\ttest?: string;\n\t};\n\n\ttype Scripts = {\n\t\t/**\n\t\tRun **before** the package is published (Also run on local `npm install` without any arguments).\n\t\t*/\n\t\tprepublish?: string;\n\n\t\t/**\n\t\tRun both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.\n\t\t*/\n\t\tprepare?: string;\n\n\t\t/**\n\t\tRun **before** the package is prepared and packed, **only** on `npm publish`.\n\t\t*/\n\t\tprepublishOnly?: string;\n\n\t\t/**\n\t\tRun **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).\n\t\t*/\n\t\tprepack?: string;\n\n\t\t/**\n\t\tRun **after** the tarball has been generated and moved to its final destination.\n\t\t*/\n\t\tpostpack?: string;\n\n\t\t/**\n\t\tRun **after** the package is published.\n\t\t*/\n\t\tpublish?: string;\n\n\t\t/**\n\t\tRun **after** the package is published.\n\t\t*/\n\t\tpostpublish?: string;\n\n\t\t/**\n\t\tRun **before** the package is installed.\n\t\t*/\n\t\tpreinstall?: string;\n\n\t\t/**\n\t\tRun **after** the package is installed.\n\t\t*/\n\t\tinstall?: string;\n\n\t\t/**\n\t\tRun **after** the package is installed and after `install`.\n\t\t*/\n\t\tpostinstall?: string;\n\n\t\t/**\n\t\tRun **before** the package is uninstalled and before `uninstall`.\n\t\t*/\n\t\tpreuninstall?: string;\n\n\t\t/**\n\t\tRun **before** the package is uninstalled.\n\t\t*/\n\t\tuninstall?: string;\n\n\t\t/**\n\t\tRun **after** the package is uninstalled.\n\t\t*/\n\t\tpostuninstall?: string;\n\n\t\t/**\n\t\tRun **before** bump the package version and before `version`.\n\t\t*/\n\t\tpreversion?: string;\n\n\t\t/**\n\t\tRun **before** bump the package version.\n\t\t*/\n\t\tversion?: string;\n\n\t\t/**\n\t\tRun **after** bump the package version.\n\t\t*/\n\t\tpostversion?: string;\n\n\t\t/**\n\t\tRun with the `npm test` command, before `test`.\n\t\t*/\n\t\tpretest?: string;\n\n\t\t/**\n\t\tRun with the `npm test` command.\n\t\t*/\n\t\ttest?: string;\n\n\t\t/**\n\t\tRun with the `npm test` command, after `test`.\n\t\t*/\n\t\tposttest?: string;\n\n\t\t/**\n\t\tRun with the `npm stop` command, before `stop`.\n\t\t*/\n\t\tprestop?: string;\n\n\t\t/**\n\t\tRun with the `npm stop` command.\n\t\t*/\n\t\tstop?: string;\n\n\t\t/**\n\t\tRun with the `npm stop` command, after `stop`.\n\t\t*/\n\t\tpoststop?: string;\n\n\t\t/**\n\t\tRun with the `npm start` command, before `start`.\n\t\t*/\n\t\tprestart?: string;\n\n\t\t/**\n\t\tRun with the `npm start` command.\n\t\t*/\n\t\tstart?: string;\n\n\t\t/**\n\t\tRun with the `npm start` command, after `start`.\n\t\t*/\n\t\tpoststart?: string;\n\n\t\t/**\n\t\tRun with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.\n\t\t*/\n\t\tprerestart?: string;\n\n\t\t/**\n\t\tRun with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.\n\t\t*/\n\t\trestart?: string;\n\n\t\t/**\n\t\tRun with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.\n\t\t*/\n\t\tpostrestart?: string;\n\t} & Partial<Record<string, string>>;\n\n\t/**\n\tDependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.\n\t*/\n\ttype Dependency = Partial<Record<string, string>>;\n\n\t/**\n\tRecursive map describing selective dependency version overrides supported by npm.\n\t*/\n\ttype DependencyOverrides = {\n\t\t[packageName in string]: string | undefined | DependencyOverrides;\n\t};\n\n\t/**\n\tSpecifies requirements for development environment components such as operating systems, runtimes, or package managers. Used to ensure consistent development environments across the team.\n\t*/\n\ttype DevEngineDependency = {\n\t\tname: string;\n\t\tversion?: string;\n\t\tonFail?: 'ignore' | 'warn' | 'error' | 'download';\n\t};\n\n\t/**\n\tA mapping of conditions and the paths to which they resolve.\n\t*/\n\ttype ExportConditions = {\n\t\t[condition: string]: Exports;\n\t};\n\n\t/**\n\tEntry points of a module, optionally with conditions and subpath exports.\n\t*/\n\ttype Exports =\n\t\t| null\n\t\t| string\n\t\t| Array<string | ExportConditions>\n\t\t| ExportConditions;\n\n\t/**\n\tImport map entries of a module, optionally with conditions and subpath imports.\n\t*/\n\ttype Imports = {\n\t\t[key: `#${string}`]: Exports;\n\t};\n\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n\tinterface NonStandardEntryPoints {\n\t\t/**\n\t\tAn ECMAScript module ID that is the primary entry point to the program.\n\t\t*/\n\t\tmodule?: string;\n\n\t\t/**\n\t\tA module ID with untranspiled code that is the primary entry point to the program.\n\t\t*/\n\t\tesnext?:\n\t\t\t| string\n\t\t\t| {\n\t\t\t\t[moduleName: string]: string | undefined;\n\t\t\t\tmain?: string;\n\t\t\t\tbrowser?: string;\n\t\t\t};\n\n\t\t/**\n\t\tA hint to JavaScript bundlers or component tools when packaging modules for client side use.\n\t\t*/\n\t\tbrowser?:\n\t\t\t| string\n\t\t\t| Partial<Record<string, string | false>>;\n\n\t\t/**\n\t\tDenote which files in your project are \"pure\" and therefore safe for Webpack to prune if unused.\n\n\t\t[Read more.](https://webpack.js.org/guides/tree-shaking/)\n\t\t*/\n\t\tsideEffects?: boolean | string[];\n\t}\n\n\ttype TypeScriptConfiguration = {\n\t\t/**\n\t\tLocation of the bundled TypeScript declaration file.\n\t\t*/\n\t\ttypes?: string;\n\n\t\t/**\n\t\tVersion selection map of TypeScript.\n\t\t*/\n\t\ttypesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>>;\n\n\t\t/**\n\t\tLocation of the bundled TypeScript declaration file. Alias of `types`.\n\t\t*/\n\t\ttypings?: string;\n\t};\n\n\t/**\n\tAn alternative configuration for workspaces.\n\t*/\n\ttype WorkspaceConfig = {\n\t\t/**\n\t\tAn array of workspace pattern strings which contain the workspace packages.\n\t\t*/\n\t\tpackages?: WorkspacePattern[];\n\n\t\t/**\n\t\tDesigned to solve the problem of packages which break when their `node_modules` are moved to the root workspace directory - a process known as hoisting. For these packages, both within your workspace, and also some that have been installed via `node_modules`, it is important to have a mechanism for preventing the default Yarn workspace behavior. By adding workspace pattern strings here, Yarn will resume non-workspace behavior for any package which matches the defined patterns.\n\n\t\t[Supported](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/) by Yarn.\n\t\t[Not supported](https://github.com/npm/rfcs/issues/287) by npm.\n\t\t*/\n\t\tnohoist?: WorkspacePattern[];\n\t};\n\n\t/**\n\tA workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.\n\n\tThe patterns are handled with [minimatch](https://github.com/isaacs/minimatch).\n\n\t@example\n\t`docs` → Include the docs directory and install its dependencies.\n\t`packages/*` → Include all nested directories within the packages directory, like `packages/cli` and `packages/core`.\n\t*/\n\ttype WorkspacePattern = string;\n\n\ttype YarnConfiguration = {\n\t\t/**\n\t\tIf your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`.\n\n\t\tNote that if your `package.json` contains `\"flat\": true` and other packages depend on yours (e.g. you are building a library rather than an app), those other packages will also need `\"flat\": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.\n\t\t*/\n\t\tflat?: boolean;\n\n\t\t/**\n\t\tSelective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.\n\t\t*/\n\t\tresolutions?: Dependency;\n\t};\n\n\ttype JSPMConfiguration = {\n\t\t/**\n\t\tJSPM configuration.\n\t\t*/\n\t\tjspm?: PackageJson;\n\t};\n\n\t/**\n\tType for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties.\n\t*/\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n\tinterface PackageJsonStandard {\n\t\t/**\n\t\tThe name of the package.\n\t\t*/\n\t\tname?: string;\n\n\t\t/**\n\t\tPackage version, parseable by [`node-semver`](https://github.com/npm/node-semver).\n\t\t*/\n\t\tversion?: string;\n\n\t\t/**\n\t\tPackage description, listed in `npm search`.\n\t\t*/\n\t\tdescription?: string;\n\n\t\t/**\n\t\tKeywords associated with package, listed in `npm search`.\n\t\t*/\n\t\tkeywords?: string[];\n\n\t\t/**\n\t\tThe URL to the package's homepage.\n\t\t*/\n\t\thomepage?: LiteralUnion<'.', string>;\n\n\t\t/**\n\t\tThe URL to the package's issue tracker and/or the email address to which issues should be reported.\n\t\t*/\n\t\tbugs?: BugsLocation;\n\n\t\t/**\n\t\tThe license for the package.\n\t\t*/\n\t\tlicense?: string;\n\n\t\t/**\n\t\tThe licenses for the package.\n\t\t*/\n\t\tlicenses?: Array<{\n\t\t\ttype?: string;\n\t\t\turl?: string;\n\t\t}>;\n\n\t\tauthor?: Person;\n\n\t\t/**\n\t\tA list of people who contributed to the package.\n\t\t*/\n\t\tcontributors?: Person[];\n\n\t\t/**\n\t\tA list of people who maintain the package.\n\t\t*/\n\t\tmaintainers?: Person[];\n\n\t\t/**\n\t\tThe files included in the package.\n\t\t*/\n\t\tfiles?: string[];\n\n\t\t/**\n\t\tResolution algorithm for importing \".js\" files from the package's scope.\n\n\t\t[Read more.](https://nodejs.org/api/esm.html#esm_package_json_type_field)\n\t\t*/\n\t\ttype?: 'module' | 'commonjs';\n\n\t\t/**\n\t\tThe module ID that is the primary entry point to the program.\n\t\t*/\n\t\tmain?: string;\n\n\t\t/**\n\t\tSubpath exports to define entry points of the package.\n\n\t\t[Read more.](https://nodejs.org/api/packages.html#subpath-exports)\n\t\t*/\n\t\texports?: Exports;\n\n\t\t/**\n\t\tSubpath imports to define internal package import maps that only apply to import specifiers from within the package itself.\n\n\t\t[Read more.](https://nodejs.org/api/packages.html#subpath-imports)\n\t\t*/\n\t\timports?: Imports;\n\n\t\t/**\n\t\tThe executable files that should be installed into the `PATH`.\n\t\t*/\n\t\tbin?:\n\t\t\t| string\n\t\t\t| Partial<Record<string, string>>;\n\n\t\t/**\n\t\tFilenames to put in place for the `man` program to find.\n\t\t*/\n\t\tman?: string | string[];\n\n\t\t/**\n\t\tIndicates the structure of the package.\n\t\t*/\n\t\tdirectories?: DirectoryLocations;\n\n\t\t/**\n\t\tLocation for the code repository.\n\t\t*/\n\t\trepository?:\n\t\t\t| string\n\t\t\t| {\n\t\t\t\ttype: string;\n\t\t\t\turl: string;\n\n\t\t\t\t/**\n\t\t\tRelative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).\n\n\t\t\t[Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)\n\t\t\t*/\n\t\t\t\tdirectory?: string;\n\t\t\t};\n\n\t\t/**\n\t\tScript commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.\n\t\t*/\n\t\tscripts?: Scripts;\n\n\t\t/**\n\t\tIs used to set configuration parameters used in package scripts that persist across upgrades.\n\t\t*/\n\t\tconfig?: JsonObject;\n\n\t\t/**\n\t\tThe dependencies of the package.\n\t\t*/\n\t\tdependencies?: Dependency;\n\n\t\t/**\n\t\tAdditional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.\n\t\t*/\n\t\tdevDependencies?: Dependency;\n\n\t\t/**\n\t\tDependencies that are skipped if they fail to install.\n\t\t*/\n\t\toptionalDependencies?: Dependency;\n\n\t\t/**\n\t\tDependencies that will usually be required by the package user directly or via another dependency.\n\t\t*/\n\t\tpeerDependencies?: Dependency;\n\n\t\t/**\n\t\tIndicate peer dependencies that are optional.\n\t\t*/\n\t\tpeerDependenciesMeta?: Partial<Record<string, {optional: true}>>;\n\n\t\t/**\n\t\tPackage names that are bundled when the package is published.\n\t\t*/\n\t\tbundledDependencies?: string[];\n\n\t\t/**\n\t\tAlias of `bundledDependencies`.\n\t\t*/\n\t\tbundleDependencies?: string[];\n\n\t\t/**\n\t\tOverrides is used to support selective version overrides using npm, which lets you define custom package versions or ranges inside your dependencies.\n\t\t*/\n\t\toverrides?: DependencyOverrides;\n\n\t\t/**\n\t\tEngines that this package runs on.\n\t\t*/\n\t\tengines?: {\n\t\t\t[EngineName in LiteralUnion<'npm' | 'node', string>]?: string;\n\t\t};\n\n\t\t/**\n\t\t@deprecated\n\t\t*/\n\t\tengineStrict?: boolean;\n\n\t\t/**\n\t\tOperating systems the module runs on.\n\t\t*/\n\t\tos?: Array<LiteralUnion<\n\t\t\t| 'aix'\n\t\t\t| 'darwin'\n\t\t\t| 'freebsd'\n\t\t\t| 'linux'\n\t\t\t| 'openbsd'\n\t\t\t| 'sunos'\n\t\t\t| 'win32'\n\t\t\t| '!aix'\n\t\t\t| '!darwin'\n\t\t\t| '!freebsd'\n\t\t\t| '!linux'\n\t\t\t| '!openbsd'\n\t\t\t| '!sunos'\n\t\t\t| '!win32',\n\t\t\tstring\n\t\t>>;\n\n\t\t/**\n\t\tCPU architectures the module runs on.\n\t\t*/\n\t\tcpu?: Array<LiteralUnion<\n\t\t\t| 'arm'\n\t\t\t| 'arm64'\n\t\t\t| 'ia32'\n\t\t\t| 'mips'\n\t\t\t| 'mipsel'\n\t\t\t| 'ppc'\n\t\t\t| 'ppc64'\n\t\t\t| 's390'\n\t\t\t| 's390x'\n\t\t\t| 'x32'\n\t\t\t| 'x64'\n\t\t\t| '!arm'\n\t\t\t| '!arm64'\n\t\t\t| '!ia32'\n\t\t\t| '!mips'\n\t\t\t| '!mipsel'\n\t\t\t| '!ppc'\n\t\t\t| '!ppc64'\n\t\t\t| '!s390'\n\t\t\t| '!s390x'\n\t\t\t| '!x32'\n\t\t\t| '!x64',\n\t\t\tstring\n\t\t>>;\n\n\t\t/**\n\t\tDefine the runtime and package manager for developing the current project.\n\t\t*/\n\t\tdevEngines?: {\n\t\t\tos?: DevEngineDependency | DevEngineDependency[];\n\t\t\tcpu?: DevEngineDependency | DevEngineDependency[];\n\t\t\tlibc?: DevEngineDependency | DevEngineDependency[];\n\t\t\truntime?: DevEngineDependency | DevEngineDependency[];\n\t\t\tpackageManager?: DevEngineDependency | DevEngineDependency[];\n\t\t};\n\n\t\t/**\n\t\tIf set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.\n\n\t\t@deprecated\n\t\t*/\n\t\tpreferGlobal?: boolean;\n\n\t\t/**\n\t\tIf set to `true`, then npm will refuse to publish it.\n\t\t*/\n\t\tprivate?: boolean;\n\n\t\t/**\n\t\tA set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.\n\t\t*/\n\t\tpublishConfig?: PublishConfig;\n\n\t\t/**\n\t\tDescribes and notifies consumers of a package's monetary support information.\n\n\t\t[Read more.](https://github.com/npm/rfcs/blob/main/implemented/0017-add-funding-support.md)\n\t\t*/\n\t\tfunding?: string | {\n\t\t\t/**\n\t\t\tThe type of funding.\n\t\t\t*/\n\t\t\ttype?: LiteralUnion<\n\t\t\t\t| 'github'\n\t\t\t\t| 'opencollective'\n\t\t\t\t| 'patreon'\n\t\t\t\t| 'individual'\n\t\t\t\t| 'foundation'\n\t\t\t\t| 'corporation',\n\t\t\t\tstring\n\t\t\t>;\n\n\t\t\t/**\n\t\t\tThe URL to the funding page.\n\t\t\t*/\n\t\t\turl: string;\n\t\t};\n\n\t\t/**\n\t\tUsed to configure [npm workspaces](https://docs.npmjs.com/cli/using-npm/workspaces) / [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).\n\n\t\tWorkspaces allow you to manage multiple packages within the same repository in such a way that you only need to run your install command once in order to install all of them in a single pass.\n\n\t\tPlease note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.\n\t\t*/\n\t\tworkspaces?: WorkspacePattern[] | WorkspaceConfig;\n\t}\n\n\t/**\n\tType for [`package.json` file used by the Node.js runtime](https://nodejs.org/api/packages.html#nodejs-packagejson-field-definitions).\n\t*/\n\ttype NodeJsStandard = {\n\t\t/**\n\t\tDefines which package manager is expected to be used when working on the current project. It can set to any of the [supported package managers](https://nodejs.org/api/corepack.html#supported-package-managers), and will ensure that your teams use the exact same package manager versions without having to install anything else than Node.js.\n\n\t\t__This field is currently experimental and needs to be opted-in; check the [Corepack](https://nodejs.org/api/corepack.html) page for details about the procedure.__\n\n\t\t@example\n\t\t```json\n\t\t{\n\t\t\t\"packageManager\": \"<package manager name>@<version>\"\n\t\t}\n\t\t```\n\t\t*/\n\t\tpackageManager?: string;\n\t};\n\n\ttype PublishConfig = {\n\t\t/**\n\t\tAdditional, less common properties from the [npm docs on `publishConfig`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#publishconfig).\n\t\t*/\n\t\t[additionalProperties: string]: JsonValue | undefined;\n\n\t\t/**\n\t\tWhen publishing scoped packages, the access level defaults to restricted. If you want your scoped package to be publicly viewable (and installable) set `--access=public`. The only valid values for access are public and restricted. Unscoped packages always have an access level of public.\n\t\t*/\n\t\taccess?: 'public' | 'restricted';\n\n\t\t/**\n\t\tThe base URL of the npm registry.\n\n\t\tDefault: `'https://registry.npmjs.org/'`\n\t\t*/\n\t\tregistry?: string;\n\n\t\t/**\n\t\tThe tag to publish the package under.\n\n\t\tDefault: `'latest'`\n\t\t*/\n\t\ttag?: string;\n\t};\n}\n\n/**\nType for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.\n\n@category File\n*/\nexport type PackageJson =\n\tJsonObject &\n\tPackageJson.NodeJsStandard &\n\tPackageJson.PackageJsonStandard &\n\tPackageJson.NonStandardEntryPoints &\n\tPackageJson.TypeScriptConfiguration &\n\tPackageJson.YarnConfiguration &\n\tPackageJson.JSPMConfiguration;\n\nexport {};\n"
  },
  {
    "path": "source/partial-deep.d.ts",
    "content": "import type {ApplyDefaultOptions, BuiltIns, HasMultipleCallSignatures} from './internal/index.d.ts';\nimport type {IsNever} from './is-never.d.ts';\n\n/**\n@see {@link PartialDeep}\n*/\nexport type PartialDeepOptions = {\n\t/**\n\tWhether to affect the individual elements of arrays and tuples.\n\n\t@default false\n\t*/\n\treadonly recurseIntoArrays?: boolean;\n\n\t/**\n\tAllows `undefined` values in non-tuple arrays.\n\n\t- When set to `true`, elements of non-tuple arrays can be `undefined`.\n\t- When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.\n\n\t@default false\n\n\t@example\n\tYou can allow `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}` as the second type argument:\n\n\t```\n\timport type {PartialDeep} from 'type-fest';\n\n\ttype Settings = {\n\t\tlanguages: string[];\n\t};\n\n\tdeclare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}>;\n\n\tpartialSettings.languages = [undefined]; // OK\n\t```\n\t*/\n\treadonly allowUndefinedInNonTupleArrays?: boolean;\n};\n\ntype DefaultPartialDeepOptions = {\n\trecurseIntoArrays: false;\n\tallowUndefinedInNonTupleArrays: false;\n};\n\n/**\nCreate a type from another type with all keys and nested keys set to optional.\n\nUse-cases:\n- Merging a default settings/config object with another object, the second object would be a deep partial of the default object.\n- Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.\n\n@example\n```\nimport type {PartialDeep} from 'type-fest';\n\nlet settings = {\n\ttextEditor: {\n\t\tfontSize: 14,\n\t\tfontColor: '#000000',\n\t\tfontWeight: 400,\n\t},\n\tautocomplete: false,\n\tautosave: true,\n};\n\nconst applySavedSettings = (savedSettings: PartialDeep<typeof settings>) => (\n\t{...settings, ...savedSettings, textEditor: {...settings.textEditor, ...savedSettings.textEditor}}\n);\n\nsettings = applySavedSettings({textEditor: {fontWeight: 500}});\n```\n\nBy default, this does not affect elements in array and tuple types. You can change this by passing `{recurseIntoArrays: true}` as the second type argument:\n\n```\nimport type {PartialDeep} from 'type-fest';\n\ntype Shape = {\n\tdimensions: [number, number];\n};\n\nconst partialShape: PartialDeep<Shape, {recurseIntoArrays: true}> = {\n\tdimensions: [], // OK\n};\n\npartialShape.dimensions = [15]; // OK\n```\n\n@see {@link PartialDeepOptions}\n\n@category Object\n@category Array\n@category Set\n@category Map\n*/\nexport type PartialDeep<T, Options extends PartialDeepOptions = {}> =\n\t_PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;\n\ntype _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown))\n\t? T\n\t: T extends Map<infer KeyType, infer ValueType>\n\t\t? PartialMapDeep<KeyType, ValueType, Options>\n\t\t: T extends Set<infer ItemType>\n\t\t\t? PartialSetDeep<ItemType, Options>\n\t\t\t: T extends ReadonlyMap<infer KeyType, infer ValueType>\n\t\t\t\t? PartialReadonlyMapDeep<KeyType, ValueType, Options>\n\t\t\t\t: T extends ReadonlySet<infer ItemType>\n\t\t\t\t\t? PartialReadonlySetDeep<ItemType, Options>\n\t\t\t\t\t: T extends (...arguments_: any[]) => unknown\n\t\t\t\t\t\t? IsNever<keyof T> extends true\n\t\t\t\t\t\t\t? T // For functions with no properties\n\t\t\t\t\t\t\t: HasMultipleCallSignatures<T> extends true\n\t\t\t\t\t\t\t\t? T\n\t\t\t\t\t\t\t\t: ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep<T, Options>\n\t\t\t\t\t\t: T extends object\n\t\t\t\t\t\t\t? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156\n\t\t\t\t\t\t\t\t? Options['recurseIntoArrays'] extends true\n\t\t\t\t\t\t\t\t\t? ItemType[] extends T // Test for arrays (non-tuples) specifically\n\t\t\t\t\t\t\t\t\t\t? readonly ItemType[] extends T // Differentiate readonly and mutable arrays\n\t\t\t\t\t\t\t\t\t\t\t? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>\n\t\t\t\t\t\t\t\t\t\t\t: Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>\n\t\t\t\t\t\t\t\t\t\t: PartialObjectDeep<T, Options> // Tuples behave properly\n\t\t\t\t\t\t\t\t\t: T // If they don't opt into array testing, just use the original type\n\t\t\t\t\t\t\t\t: PartialObjectDeep<T, Options>\n\t\t\t\t\t\t\t: unknown;\n\n/**\nSame as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.\n*/\ntype PartialMapDeep<KeyType, ValueType, Options extends Required<PartialDeepOptions>> = {} & Map<_PartialDeep<KeyType, Options>, _PartialDeep<ValueType, Options>>;\n\n/**\nSame as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.\n*/\ntype PartialSetDeep<T, Options extends Required<PartialDeepOptions>> = {} & Set<_PartialDeep<T, Options>>;\n\n/**\nSame as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.\n*/\ntype PartialReadonlyMapDeep<KeyType, ValueType, Options extends Required<PartialDeepOptions>> = {} & ReadonlyMap<_PartialDeep<KeyType, Options>, _PartialDeep<ValueType, Options>>;\n\n/**\nSame as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.\n*/\ntype PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {} & ReadonlySet<_PartialDeep<T, Options>>;\n\n/**\nSame as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.\n*/\ntype PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = {\n\t[KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>\n};\n\nexport {};\n"
  },
  {
    "path": "source/partial-on-undefined-deep.d.ts",
    "content": "import type {If} from './if.d.ts';\nimport type {ApplyDefaultOptions, BuiltIns, LiteralKeyOf} from './internal/index.d.ts';\nimport type {IsUnknown} from './is-unknown.d.ts';\nimport type {Merge} from './merge.d.ts';\n\n/**\n@see {@link PartialOnUndefinedDeep}\n*/\nexport type PartialOnUndefinedDeepOptions = {\n\t/**\n\tWhether to affect the individual elements of arrays and tuples.\n\n\t@default false\n\t*/\n\treadonly recurseIntoArrays?: boolean;\n};\n\ntype DefaultPartialOnUndefinedDeepOptions = {\n\trecurseIntoArrays: false;\n};\n\n/**\nCreate a deep version of another type where all keys accepting `undefined` type are set to optional.\n\nThis utility type is recursive, transforming at any level deep. By default, it does not affect arrays and tuples items unless you explicitly pass `{recurseIntoArrays: true}` as the second type argument.\n\nUse-cases:\n- Make all properties of a type that can be undefined optional to not have to specify keys with undefined value.\n\n@example\n```\nimport type {PartialOnUndefinedDeep} from 'type-fest';\n\ntype Settings = {\n\toptionA: string;\n\toptionB: number | undefined;\n\tsubOption: {\n\t\tsubOptionA: boolean;\n\t\tsubOptionB: boolean | undefined;\n\t};\n};\n\nconst testSettings: PartialOnUndefinedDeep<Settings> = {\n\toptionA: 'foo',\n\t// 👉 optionB is now optional and can be omitted\n\tsubOption: {\n\t\tsubOptionA: true,\n\t\t// 👉 subOptionB is now optional as well and can be omitted\n\t},\n};\n```\n\n@category Object\n*/\nexport type PartialOnUndefinedDeep<T, Options extends PartialOnUndefinedDeepOptions = {}> =\n\t_PartialOnUndefinedDeep<T, ApplyDefaultOptions<PartialOnUndefinedDeepOptions, DefaultPartialOnUndefinedDeepOptions, Options>>;\n\ntype _PartialOnUndefinedDeep<T, Options extends Required<PartialOnUndefinedDeepOptions>> = T extends Record<any, any> | undefined\n\t? {[KeyType in keyof T as undefined extends T[KeyType] ? If<IsUnknown<T[KeyType]>, never, KeyType> : never]?: PartialOnUndefinedDeepValue<T[KeyType], Options>} extends infer U // Make a partial type with all value types accepting undefined (and set them optional)\n\t\t? Merge<{[KeyType in keyof T as KeyType extends LiteralKeyOf<U> ? never : KeyType]: PartialOnUndefinedDeepValue<T[KeyType], Options>}, U> // Join all remaining keys not treated in U\n\t\t: never // Should not happen\n\t: T;\n\n/**\nUtility type to get the value type by key and recursively call `PartialOnUndefinedDeep` to transform sub-objects.\n*/\ntype PartialOnUndefinedDeepValue<T, Options extends Required<PartialOnUndefinedDeepOptions>> = T extends BuiltIns | ((...arguments_: any[]) => unknown)\n\t? T\n\t: T extends ReadonlyArray<infer U> // Test if type is array or tuple\n\t\t? Options['recurseIntoArrays'] extends true // Check if option is activated\n\t\t\t? U[] extends T // Check if array not tuple\n\t\t\t\t? readonly U[] extends T\n\t\t\t\t\t? ReadonlyArray<_PartialOnUndefinedDeep<U, Options>> // Readonly array treatment\n\t\t\t\t\t: Array<_PartialOnUndefinedDeep<U, Options>> // Mutable array treatment\n\t\t\t\t: _PartialOnUndefinedDeep<{[Key in keyof T]: _PartialOnUndefinedDeep<T[Key], Options>}, Options> // Tuple treatment\n\t\t\t: T\n\t\t: T extends Record<any, any> | undefined\n\t\t\t? _PartialOnUndefinedDeep<T, Options>\n\t\t\t: unknown;\n\nexport {};\n"
  },
  {
    "path": "source/pascal-case.d.ts",
    "content": "import type {CamelCase, CamelCaseOptions, _DefaultCamelCaseOptions} from './camel-case.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\n\n/**\nConvert a string literal to pascal-case.\n\n@example\n```\nimport type {PascalCase} from 'type-fest';\n\n// Simple\n\nconst someVariable: PascalCase<'foo-bar'> = 'FooBar';\nconst preserveConsecutiveUppercase: PascalCase<'foo-BAR-baz', {preserveConsecutiveUppercase: true}> = 'FooBARBaz';\n\n// Advanced\n\ntype PascalCasedProperties<T> = {\n\t[K in keyof T as PascalCase<K>]: T[K]\n};\n\ntype RawOptions = {\n\t'dry-run': boolean;\n\t'full_family_name': string;\n\tfoo: number;\n\tBAR: string;\n\tQUZ_QUX: number;\n\t'OTHER-FIELD': boolean;\n};\n\nconst dbResult: PascalCasedProperties<RawOptions> = {\n\tDryRun: true,\n\tFullFamilyName: 'bar.js',\n\tFoo: 123,\n\tBar: 'foo',\n\tQuzQux: 6,\n\tOtherField: false,\n};\n```\n\n@category Change case\n@category Template literal\n*/\nexport type PascalCase<Value, Options extends CamelCaseOptions = {}> =\n\t_PascalCase<Value, ApplyDefaultOptions<CamelCaseOptions, _DefaultCamelCaseOptions, Options>>;\n\ntype _PascalCase<Value, Options extends Required<CamelCaseOptions>> = CamelCase<Value, Options> extends string\n\t? Capitalize<CamelCase<Value, Options>>\n\t: CamelCase<Value, Options>;\n\nexport {};\n"
  },
  {
    "path": "source/pascal-cased-properties-deep.d.ts",
    "content": "import type {CamelCaseOptions, _DefaultCamelCaseOptions} from './camel-case.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {PascalCase} from './pascal-case.d.ts';\n\n/**\nConvert object properties to pascal case recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link PascalCase}\n@see {@link PascalCasedProperties}\n\n@example\n```\nimport type {PascalCasedPropertiesDeep} from 'type-fest';\n\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\n\ntype UserWithFriends = {\n\tuserInfo: User;\n\tuserFriends: User[];\n};\n\nconst result: PascalCasedPropertiesDeep<UserWithFriends> = {\n\tUserInfo: {\n\t\tUserId: 1,\n\t\tUserName: 'Tom',\n\t},\n\tUserFriends: [\n\t\t{\n\t\t\tUserId: 2,\n\t\t\tUserName: 'Jerry',\n\t\t},\n\t\t{\n\t\t\tUserId: 3,\n\t\t\tUserName: 'Spike',\n\t\t},\n\t],\n};\n\nconst preserveConsecutiveUppercase: PascalCasedPropertiesDeep<{fooBAR: {fooBARBiz: [{fooBARBaz: string}]}}, {preserveConsecutiveUppercase: true}> = {\n\tFooBAR: {\n\t\tFooBARBiz: [{\n\t\t\tFooBARBaz: 'string',\n\t\t}],\n\t},\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type PascalCasedPropertiesDeep<Value, Options extends CamelCaseOptions = {}> =\n\t_PascalCasedPropertiesDeep<Value, ApplyDefaultOptions<CamelCaseOptions, _DefaultCamelCaseOptions, Options>>;\n\ntype _PascalCasedPropertiesDeep<Value, Options extends Required<CamelCaseOptions>> = Value extends Function | Date | RegExp\n\t? Value\n\t: Value extends Array<infer U>\n\t\t? Array<_PascalCasedPropertiesDeep<U, Options>>\n\t\t: Value extends Set<infer U>\n\t\t\t? Set<_PascalCasedPropertiesDeep<U, Options>>\n\t\t\t: Value extends object\n\t\t\t\t? {\n\t\t\t\t\t[K in keyof Value as PascalCase<K, Options>]: _PascalCasedPropertiesDeep<Value[K], Options>;\n\t\t\t\t}\n\t\t\t\t: Value;\n\nexport {};\n"
  },
  {
    "path": "source/pascal-cased-properties.d.ts",
    "content": "import type {CamelCaseOptions, _DefaultCamelCaseOptions} from './camel-case.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {PascalCase} from './pascal-case.d.ts';\n\n/**\nConvert object properties to pascal case but not recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link PascalCase}\n@see {@link PascalCasedPropertiesDeep}\n\n@example\n```\nimport type {PascalCasedProperties} from 'type-fest';\n\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\n\nconst result: PascalCasedProperties<User> = {\n\tUserId: 1,\n\tUserName: 'Tom',\n};\n\nconst preserveConsecutiveUppercase: PascalCasedProperties<{fooBAR: string}, {preserveConsecutiveUppercase: true}> = {\n\tFooBAR: 'string',\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type PascalCasedProperties<Value, Options extends CamelCaseOptions = {}> = Value extends Function\n\t? Value\n\t: Value extends Array<infer U>\n\t\t? Value\n\t\t: {[K in keyof Value as PascalCase<K, ApplyDefaultOptions<CamelCaseOptions, _DefaultCamelCaseOptions, Options>>]: Value[K]};\n\nexport {};\n"
  },
  {
    "path": "source/paths.d.ts",
    "content": "import type {NonRecursiveType, ToString, IsNumberLike, ApplyDefaultOptions, MapsSetsOrArrays} from './internal/index.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\nimport type {GreaterThan} from './greater-than.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {Sum} from './sum.d.ts';\nimport type {And} from './and.d.ts';\n\n/**\nPaths options.\n\n@see {@link Paths}\n*/\nexport type PathsOptions = {\n\t/**\n\tThe maximum depth to recurse when searching for paths. Range: 0 ~ 10.\n\n\t@default 5\n\t*/\n\tmaxRecursionDepth?: number;\n\n\t/**\n\tUse bracket notation for array indices and numeric object keys.\n\n\t@default false\n\n\t@example\n\t```\n\timport type {Paths} from 'type-fest';\n\n\ttype ArrayExample = {\n\t\tarray: ['foo'];\n\t};\n\n\ttype A = Paths<ArrayExample, {bracketNotation: false}>;\n\t//=> 'array' | 'array.0'\n\n\ttype B = Paths<ArrayExample, {bracketNotation: true}>;\n\t//=> 'array' | 'array[0]'\n\t```\n\n\t@example\n\t```\n\timport type {Paths} from 'type-fest';\n\n\ttype NumberKeyExample = {\n\t\t1: ['foo'];\n\t};\n\n\ttype A = Paths<NumberKeyExample, {bracketNotation: false}>;\n\t//=> 1 | '1' | '1.0'\n\n\ttype B = Paths<NumberKeyExample, {bracketNotation: true}>;\n\t//=> '[1]' | '[1][0]'\n\t```\n\t*/\n\tbracketNotation?: boolean;\n\n\t/**\n\tOnly include leaf paths in the output.\n\n\t@default false\n\n\t@example\n\t```\n\timport type {Paths} from 'type-fest';\n\n\ttype Post = {\n\t\tid: number;\n\t\tauthor: {\n\t\t\tid: number;\n\t\t\tname: {\n\t\t\t\tfirst: string;\n\t\t\t\tlast: string;\n\t\t\t};\n\t\t};\n\t};\n\n\ttype AllPaths = Paths<Post, {leavesOnly: false}>;\n\t//=> 'id' | 'author' | 'author.id' | 'author.name' | 'author.name.first' | 'author.name.last'\n\n\ttype LeafPaths = Paths<Post, {leavesOnly: true}>;\n\t//=> 'id' | 'author.id' | 'author.name.first' | 'author.name.last'\n\t```\n\n\t@example\n\t```\n\timport type {Paths} from 'type-fest';\n\n\ttype ArrayExample = {\n\t\tarray: Array<{foo: string}>;\n\t\ttuple: [string, {bar: string}];\n\t};\n\n\ttype AllPaths = Paths<ArrayExample, {leavesOnly: false}>;\n\t//=> 'array' | 'tuple' | `array.${number}` | `array.${number}.foo` | 'tuple.0' | 'tuple.1' | 'tuple.1.bar'\n\n\ttype LeafPaths = Paths<ArrayExample, {leavesOnly: true}>;\n\t//=> `array.${number}.foo` | 'tuple.0' | 'tuple.1.bar'\n\t```\n\t*/\n\tleavesOnly?: boolean;\n\n\t/**\n\tOnly include paths at the specified depth. By default all paths up to {@link PathsOptions.maxRecursionDepth | `maxRecursionDepth`} are included.\n\n\tNote: Depth starts at `0` for root properties.\n\n\t@default number\n\n\t@example\n\t```\n\timport type {Paths} from 'type-fest';\n\n\ttype Post = {\n\t\tid: number;\n\t\tauthor: {\n\t\t\tid: number;\n\t\t\tname: {\n\t\t\t\tfirst: string;\n\t\t\t\tlast: string;\n\t\t\t};\n\t\t};\n\t};\n\n\ttype DepthZero = Paths<Post, {depth: 0}>;\n\t//=> 'id' | 'author'\n\n\ttype DepthOne = Paths<Post, {depth: 1}>;\n\t//=> 'author.id' | 'author.name'\n\n\ttype DepthTwo = Paths<Post, {depth: 2}>;\n\t//=> 'author.name.first' | 'author.name.last'\n\n\ttype LeavesAtDepthOne = Paths<Post, {leavesOnly: true; depth: 1}>;\n\t//=> 'author.id'\n\t```\n\t*/\n\tdepth?: number;\n};\n\ntype DefaultPathsOptions = {\n\tmaxRecursionDepth: 5;\n\tbracketNotation: false;\n\tleavesOnly: false;\n\tdepth: number;\n};\n\n/**\nGenerate a union of all possible paths to properties in the given object.\n\nIt also works with arrays.\n\nUse-case: You want a type-safe way to access deeply nested properties in an object.\n\n@example\n```\nimport type {Paths} from 'type-fest';\n\ntype Project = {\n\tfilename: string;\n\tlistA: string[];\n\tlistB: [{filename: string}];\n\tfolder: {\n\t\tsubfolder: {\n\t\t\tfilename: string;\n\t\t};\n\t};\n};\n\ntype ProjectPaths = Paths<Project>;\n//=> 'filename' | 'listA' | 'listB' | 'folder' | `listA.${number}` | 'listB.0' | 'listB.0.filename' | 'folder.subfolder' | 'folder.subfolder.filename'\n\ndeclare function open<Path extends ProjectPaths>(path: Path): void;\n\nopen('filename'); // Pass\nopen('folder.subfolder'); // Pass\nopen('folder.subfolder.filename'); // Pass\n// @ts-expect-error\nopen('foo'); // TypeError\n\n// Also works with arrays\nopen('listA.1'); // Pass\nopen('listB.0'); // Pass\n// @ts-expect-error\nopen('listB.1'); // TypeError. Because listB only has one element.\n```\n\n@category Object\n@category Array\n*/\nexport type Paths<T, Options extends PathsOptions = {}> = _Paths<T, ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, Options>>;\n\ntype _Paths<T, Options extends Required<PathsOptions>, CurrentDepth extends number = 0> =\n\tT extends NonRecursiveType | Exclude<MapsSetsOrArrays, UnknownArray>\n\t\t? never\n\t\t: IsAny<T> extends true\n\t\t\t? never\n\t\t\t: T extends object\n\t\t\t\t? InternalPaths<Required<T>, Options, CurrentDepth>\n\t\t\t\t: never;\n\ntype InternalPaths<T, Options extends Required<PathsOptions>, CurrentDepth extends number> =\n\t{[Key in keyof T]: Key extends string | number // Limit `Key` to `string | number`\n\t\t? (\n\t\t\tAnd<Options['bracketNotation'], IsNumberLike<Key>> extends true\n\t\t\t\t? `[${Key}]`\n\t\t\t\t: CurrentDepth extends 0\n\t\t\t\t\t// Return both `Key` and `ToString<Key>` because for number keys, like `1`, both `1` and `'1'` are valid keys.\n\t\t\t\t\t? Key | ToString<Key>\n\t\t\t\t\t: `.${(Key | ToString<Key>)}`\n\t\t) extends infer TransformedKey extends string | number\n\t\t\t? ((Options['leavesOnly'] extends true\n\t\t\t\t? Options['maxRecursionDepth'] extends CurrentDepth\n\t\t\t\t\t? TransformedKey\n\t\t\t\t\t: IsNever<T[Key]> extends true\n\t\t\t\t\t\t? TransformedKey\n\t\t\t\t\t\t: T[Key] extends infer Value // For distributing `T[Key]`\n\t\t\t\t\t\t\t? (Value extends readonly [] | NonRecursiveType | Exclude<MapsSetsOrArrays, UnknownArray>\n\t\t\t\t\t\t\t\t? TransformedKey\n\t\t\t\t\t\t\t\t: IsNever<keyof Value> extends true // Check for empty object & `unknown`, because `keyof unknown` is `never`.\n\t\t\t\t\t\t\t\t\t? TransformedKey\n\t\t\t\t\t\t\t\t\t: never)\n\t\t\t\t\t\t\t: never // Should never happen\n\t\t\t\t: TransformedKey\n\t\t\t) extends infer _TransformedKey\n\t\t\t\t// If `depth` is provided, the condition becomes truthy only when it matches `CurrentDepth`.\n\t\t\t\t// Otherwise, since `depth` defaults to `number`, the condition is always truthy, returning paths at all depths.\n\t\t\t\t? CurrentDepth extends Options['depth']\n\t\t\t\t\t? _TransformedKey\n\t\t\t\t\t: never\n\t\t\t\t: never)\n\t\t\t// Recursively generate paths for the current key\n\t\t\t| (GreaterThan<Options['maxRecursionDepth'], CurrentDepth> extends true // Limit the depth to prevent infinite recursion\n\t\t\t\t? `${TransformedKey}${_Paths<T[Key], Options, Sum<CurrentDepth, 1>> & (string | number)}`\n\t\t\t\t: never)\n\t\t\t: never\n\t\t: never\n\t}[keyof T & (T extends UnknownArray ? number : unknown)];\n\nexport {};\n"
  },
  {
    "path": "source/pick-deep.d.ts",
    "content": "import type {TupleOf} from './tuple-of.d.ts';\nimport type {BuildObject, NonRecursiveType, ObjectValue} from './internal/index.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {Paths} from './paths.d.ts';\nimport type {Simplify} from './simplify.d.ts';\nimport type {UnionToIntersection} from './union-to-intersection.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\nimport type {SimplifyDeep} from './simplify-deep.d.ts';\n\n/**\nPick properties from a deeply-nested object.\n\nIt supports recursing into arrays.\n\nUse-case: Distill complex objects down to the components you need to target.\n\n@example\n```\nimport type {PickDeep, PartialDeep} from 'type-fest';\n\ntype Configuration = {\n\tuserConfig: {\n\t\tname: string;\n\t\tage: number;\n\t\taddress: [\n\t\t\t{\n\t\t\t\tcity1: string;\n\t\t\t\tstreet1: string;\n\t\t\t},\n\t\t\t{\n\t\t\t\tcity2: string;\n\t\t\t\tstreet2: string;\n\t\t\t},\n\t\t];\n\t};\n\totherConfig: any;\n};\n\ntype NameConfig = PickDeep<Configuration, 'userConfig.name'>;\n//=> {userConfig: {name: string}}\n\n// Supports optional properties\ntype User = PickDeep<PartialDeep<Configuration>, 'userConfig.name' | 'userConfig.age'>;\n//=> {userConfig?: {name?: string; age?: number}}\n\n// Supports array\ntype AddressConfig = PickDeep<Configuration, 'userConfig.address.0'>;\n//=> {\n// \tuserConfig: {\n// \t\taddress: [{\n// \t\t\tcity1: string;\n// \t\t\tstreet1: string;\n// \t\t}];\n// \t};\n// }\n\n// Supports recurse into array\ntype Street = PickDeep<Configuration, 'userConfig.address.1.street2'>;\n//=> {userConfig: {address: [unknown, {street2: string}]}}\n```\n\n@category Object\n@category Array\n*/\nexport type PickDeep<T, PathUnion extends Paths<T>> =\n\tT extends NonRecursiveType\n\t\t? never\n\t\t: T extends UnknownArray\n\t\t\t? UnionToIntersection<{\n\t\t\t\t[P in PathUnion]: InternalPickDeep<T, P>;\n\t\t\t}[PathUnion]\n\t\t\t>\n\t\t\t: T extends object\n\t\t\t\t? SimplifyDeep<UnionToIntersection<{\n\t\t\t\t\t[P in PathUnion]: InternalPickDeep<T, P>;\n\t\t\t\t}[PathUnion]>>\n\t\t\t\t: never;\n\n/**\nPick an object/array from the given object/array by one path.\n*/\ntype InternalPickDeep<T, Path extends string | number> =\n\tT extends NonRecursiveType\n\t\t? never\n\t\t: T extends UnknownArray ? PickDeepArray<T, Path>\n\t\t\t: T extends object ? Simplify<PickDeepObject<T, Path>>\n\t\t\t\t: never;\n\n/**\nPick an object from the given object by one path.\n*/\ntype PickDeepObject<RecordType extends object, P extends string | number> =\n\tP extends `${infer RecordKeyInPath}.${infer SubPath}`\n\t\t? ObjectValue<RecordType, RecordKeyInPath> extends infer ObjectV\n\t\t\t? IsNever<ObjectV> extends false\n\t\t\t\t? BuildObject<RecordKeyInPath, InternalPickDeep<NonNullable<ObjectV>, SubPath>, RecordType>\n\t\t\t\t: never\n\t\t\t: never\n\t\t: ObjectValue<RecordType, P> extends infer ObjectV\n\t\t\t? IsNever<ObjectV> extends false\n\t\t\t\t? BuildObject<P, ObjectV, RecordType>\n\t\t\t\t: never\n\t\t\t: never;\n\n/**\nPick an array from the given array by one path.\n*/\ntype PickDeepArray<ArrayType extends UnknownArray, P extends string | number> =\n\t// Handle paths that are `${number}.${string}`\n\tP extends `${infer ArrayIndex extends number}.${infer SubPath}`\n\t\t// When `ArrayIndex` is equal to `number`\n\t\t? number extends ArrayIndex\n\t\t\t? ArrayType extends unknown[]\n\t\t\t\t? Array<InternalPickDeep<NonNullable<ArrayType[number]>, SubPath>>\n\t\t\t\t: ArrayType extends readonly unknown[]\n\t\t\t\t\t? ReadonlyArray<InternalPickDeep<NonNullable<ArrayType[number]>, SubPath>>\n\t\t\t\t\t: never\n\t\t\t// When `ArrayIndex` is a number literal\n\t\t\t: ArrayType extends unknown[]\n\t\t\t\t? [...TupleOf<ArrayIndex>, InternalPickDeep<NonNullable<ArrayType[ArrayIndex]>, SubPath>]\n\t\t\t\t: ArrayType extends readonly unknown[]\n\t\t\t\t\t? readonly [...TupleOf<ArrayIndex>, InternalPickDeep<NonNullable<ArrayType[ArrayIndex]>, SubPath>]\n\t\t\t\t\t: never\n\t\t// When the path is equal to `number`\n\t\t: P extends `${infer ArrayIndex extends number}`\n\t\t\t// When `ArrayIndex` is `number`\n\t\t\t? number extends ArrayIndex\n\t\t\t\t? ArrayType\n\t\t\t\t// When `ArrayIndex` is a number literal\n\t\t\t\t: ArrayType extends unknown[]\n\t\t\t\t\t? [...TupleOf<ArrayIndex>, ArrayType[ArrayIndex]]\n\t\t\t\t\t: ArrayType extends readonly unknown[]\n\t\t\t\t\t\t? readonly [...TupleOf<ArrayIndex>, ArrayType[ArrayIndex]]\n\t\t\t\t\t\t: never\n\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/pick-index-signature.d.ts",
    "content": "/**\nPick only index signatures from the given object type, leaving out all explicitly defined properties.\n\nThis is the counterpart of `OmitIndexSignature`.\n\n@example\n```\nimport type {PickIndexSignature} from 'type-fest';\n\ndeclare const symbolKey: unique symbol;\n\ntype Example = {\n\t// These index signatures will remain.\n\t[x: string]: unknown;\n\t[x: number]: unknown;\n\t[x: symbol]: unknown;\n\t[x: `head-${string}`]: string;\n\t[x: `${string}-tail`]: string;\n\t[x: `head-${string}-tail`]: string;\n\t[x: `${bigint}`]: string;\n\t[x: `embedded-${number}`]: string;\n\n\t// These explicitly defined keys will be removed.\n\t['kebab-case-key']: string;\n\t[symbolKey]: string;\n\tfoo: 'bar';\n\tqux?: 'baz';\n};\n\ntype ExampleIndexSignature = PickIndexSignature<Example>;\n// {\n// \t[x: string]: unknown;\n// \t[x: number]: unknown;\n// \t[x: symbol]: unknown;\n// \t[x: `head-${string}`]: string;\n// \t[x: `${string}-tail`]: string;\n// \t[x: `head-${string}-tail`]: string;\n// \t[x: `${bigint}`]: string;\n// \t[x: `embedded-${number}`]: string;\n// }\n```\n\n@see {@link OmitIndexSignature}\n@category Object\n*/\nexport type PickIndexSignature<ObjectType> = {\n\t[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>\n\t\t? KeyType\n\t\t: never]: ObjectType[KeyType];\n};\n\nexport {};\n"
  },
  {
    "path": "source/primitive.d.ts",
    "content": "/**\nMatches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).\n\n@category Type\n*/\nexport type Primitive =\n\t| null\n\t| undefined\n\t| string\n\t| number\n\t| boolean\n\t| symbol\n\t| bigint;\n\nexport {};\n"
  },
  {
    "path": "source/promisable.d.ts",
    "content": "/**\nCreate a type that represents either the value or the value wrapped in `PromiseLike`.\n\nUse-cases:\n- A function accepts a callback that may either return a value synchronously or may return a promised value.\n- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.\n\nPlease upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.\n\n@example\n```\nimport type {Promisable} from 'type-fest';\n\nasync function logger(getLogEntry: () => Promisable<string>): Promise<void> {\n\tconst entry = await getLogEntry();\n\tconsole.log(entry);\n}\n\nawait logger(() => 'foo');\nawait logger(() => Promise.resolve('bar'));\n```\n\n@category Async\n*/\nexport type Promisable<T> = T | PromiseLike<T>;\n\nexport {};\n"
  },
  {
    "path": "source/readonly-deep.d.ts",
    "content": "import type {BuiltIns, HasMultipleCallSignatures} from './internal/index.d.ts';\n\n/**\nConvert `object`s, `Map`s, `Set`s, and `Array`s and all of their keys/elements into immutable structures recursively.\n\nThis is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around.\n\nPlease upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript.\n\n@example\n```\nimport type {ReadonlyDeep} from 'type-fest';\n\ndeclare const foo: {\n\ta: string;\n\tb: {c: number};\n\td: Array<{e: number}>;\n};\n\nfoo.a = 'bar'; // Allowed\n\nfoo.b = {c: 3}; // Allowed\n\nfoo.b.c = 4; // Allowed\n\nfoo.d = [{e: 5}]; // Allowed\n\nfoo.d.push({e: 6}); // Allowed\n\nconst last = foo.d.at(-1);\nif (last) {\n\tlast.e = 7; // Allowed\n}\n\ndeclare const readonlyFoo: ReadonlyDeep<typeof foo>;\n\n// @ts-expect-error\nreadonlyFoo.a = 'bar';\n// Error: Cannot assign to 'a' because it is a read-only property.\n\n// @ts-expect-error\nreadonlyFoo.b = {c: 3};\n// Error: Cannot assign to 'b' because it is a read-only property.\n\n// @ts-expect-error\nreadonlyFoo.b.c = 4;\n// Error: Cannot assign to 'c' because it is a read-only property.\n\n// @ts-expect-error\nreadonlyFoo.d = [{e: 5}];\n// Error: Cannot assign to 'd' because it is a read-only property.\n\n// @ts-expect-error\nreadonlyFoo.d.push({e: 6});\n// Error: Property 'push' does not exist on type 'ReadonlyArray<{readonly e: number}>'.\n\nconst readonlyLast = readonlyFoo.d.at(-1);\nif (readonlyLast) {\n\t// @ts-expect-error\n\treadonlyLast.e = 8;\n\t// Error: Cannot assign to 'e' because it is a read-only property.\n}\n```\n\nNote that types containing overloaded functions are not made deeply readonly due to a [TypeScript limitation](https://github.com/microsoft/TypeScript/issues/29732).\n\n@category Object\n@category Array\n@category Set\n@category Map\n*/\nexport type ReadonlyDeep<T> = T extends BuiltIns\n\t? T\n\t: T extends new (...arguments_: any[]) => unknown\n\t\t? T // Skip class constructors\n\t\t: T extends (...arguments_: any[]) => unknown\n\t\t\t? {} extends _ReadonlyObjectDeep<T>\n\t\t\t\t? T\n\t\t\t\t: HasMultipleCallSignatures<T> extends true\n\t\t\t\t\t? T\n\t\t\t\t\t: ((...arguments_: Parameters<T>) => ReturnType<T>) & _ReadonlyObjectDeep<T>\n\t\t\t: T extends Readonly<ReadonlyMap<infer KeyType, infer ValueType>>\n\t\t\t\t? ReadonlyMapDeep<KeyType, ValueType>\n\t\t\t\t: T extends Readonly<ReadonlySet<infer ItemType>>\n\t\t\t\t\t? ReadonlySetDeep<ItemType>\n\t\t\t\t\t: // Identify tuples to avoid converting them to arrays inadvertently; special case `readonly [...never[]]`, as it emerges undesirably from recursive invocations of ReadonlyDeep below.\n\t\t\t\t\tT extends readonly [] | readonly [...never[]]\n\t\t\t\t\t\t? readonly []\n\t\t\t\t\t\t: T extends readonly [infer U, ...infer V]\n\t\t\t\t\t\t\t? readonly [ReadonlyDeep<U>, ...ReadonlyDeep<V>]\n\t\t\t\t\t\t\t: T extends readonly [...infer U, infer V]\n\t\t\t\t\t\t\t\t? readonly [...ReadonlyDeep<U>, ReadonlyDeep<V>]\n\t\t\t\t\t\t\t\t: T extends ReadonlyArray<infer ItemType>\n\t\t\t\t\t\t\t\t\t? ReadonlyArray<ReadonlyDeep<ItemType>>\n\t\t\t\t\t\t\t\t\t: T extends object\n\t\t\t\t\t\t\t\t\t\t? _ReadonlyObjectDeep<T>\n\t\t\t\t\t\t\t\t\t\t: unknown;\n\n/**\nSame as `ReadonlyDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `ReadonlyDeep`.\n*/\ntype ReadonlyMapDeep<KeyType, ValueType> = {} & Readonly<ReadonlyMap<ReadonlyDeep<KeyType>, ReadonlyDeep<ValueType>>>;\n\n/**\nSame as `ReadonlyDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `ReadonlyDeep`.\n*/\ntype ReadonlySetDeep<ItemType> = {} & Readonly<ReadonlySet<ReadonlyDeep<ItemType>>>;\n\n/**\nSame as `ReadonlyDeep`, but accepts only `object`s as inputs. Internal helper for `ReadonlyDeep`.\n*/\nexport type _ReadonlyObjectDeep<ObjectType extends object> = {\n\treadonly [KeyType in keyof ObjectType]: ReadonlyDeep<ObjectType[KeyType]>\n};\n\nexport {};\n"
  },
  {
    "path": "source/readonly-keys-of.d.ts",
    "content": "import type {IsReadonlyKeyOf} from './is-readonly-key-of.d.ts';\n\n/**\nExtract all readonly keys from the given type.\n\nThis is useful when you want to create a new type that contains readonly keys only.\n\n@example\n```\nimport type {ReadonlyKeysOf} from 'type-fest';\n\ntype User = {\n\tname: string;\n\tsurname: string;\n\n\treadonly id: number;\n};\n\ntype UpdateResponse<Entity extends object> = Pick<Entity, ReadonlyKeysOf<Entity>>;\n\nconst update1: UpdateResponse<User> = {\n\tid: 123,\n};\n```\n\n@category Utilities\n*/\nexport type ReadonlyKeysOf<Type extends object> =\n\tType extends unknown // For distributing `Type`\n\t\t? (keyof {[Key in keyof Type as\n\t\t\tIsReadonlyKeyOf<Type, Key> extends false\n\t\t\t\t? never\n\t\t\t\t: Key\n\t\t\t]: never\n\t\t}) & keyof Type // Intersect with `keyof Type` to ensure result of `ReadonlyKeysOf<Type>` is always assignable to `keyof Type`\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/readonly-tuple.d.ts",
    "content": "import type {TupleOf} from './tuple-of.d.ts';\n\n/**\nCreate a type that represents a read-only tuple of the given type and length.\n\nUse-cases:\n- Declaring fixed-length tuples with a large number of items.\n- Creating a range union (for example, `0 | 1 | 2 | 3 | 4` from the keys of such a type) without having to resort to recursive types.\n- Creating a tuple of coordinates with a static length, for example, length of 3 for a 3D vector.\n\n@example\n```\nimport type {ReadonlyTuple} from 'type-fest';\n\ntype FencingTeam = ReadonlyTuple<string, 3>;\n\nconst guestFencingTeam: FencingTeam = ['Josh', 'Michael', 'Robert'];\n\n// @ts-expect-error\nconst homeFencingTeam: FencingTeam = ['George', 'John'];\n// Error: Type '[string, string]' is not assignable to type 'readonly [string, string, string]'.\n\n// @ts-expect-error\nguestFencingTeam.push('Sam');\n// Error: Property 'push' does not exist on type 'readonly [string, string, string]'.\n```\n\n@deprecated This type will be removed in the next major version. Use the built-in `Readonly` type in combination with the {@link TupleOf} type instead, like `Readonly<TupleOf<Length, Element>>`.\n\n@category Utilities\n*/\nexport type ReadonlyTuple<Element, Length extends number> = Readonly<TupleOf<Length, Element>>;\n\nexport {};\n"
  },
  {
    "path": "source/remove-prefix.d.ts",
    "content": "import type {ApplyDefaultOptions} from './internal/object.d.ts';\nimport type {IfNotAnyOrNever, Not} from './internal/type.d.ts';\nimport type {IsStringLiteral} from './is-literal.d.ts';\nimport type {Or} from './or.d.ts';\n\n/**\n@see {@link RemovePrefix}\n*/\nexport type RemovePrefixOptions = {\n\t/**\n\tWhen enabled, instantiations with non-literal prefixes (e.g., `string`, `Uppercase<string>`, `` `on${string}` ``) simply return `string`, since their precise structure cannot be statically determined.\n\n\tNote: Disabling this option can produce misleading results that might not reflect the actual runtime behavior.\n\tFor example, ``RemovePrefix<'on-change', `${string}-`, {strict: false}>`` returns `'change'`, but at runtime, prefix could be `'handle-'` (which satisfies `` `${string}-` ``) and removing `'handle-'` from `'on-change'` would not result in `'change'`.\n\n\tSo, it is recommended to not disable this option unless you are aware of the implications.\n\n\t@default true\n\n\t@example\n\t```\n\timport type {RemovePrefix} from 'type-fest';\n\n\ttype A = RemovePrefix<'on-change', `${string}-`, {strict: true}>;\n\t//=> string\n\n\ttype B = RemovePrefix<'on-change', `${string}-`, {strict: false}>;\n\t//=> 'change'\n\n\ttype C = RemovePrefix<'on-change', string, {strict: true}>;\n\t//=> string\n\n\ttype D = RemovePrefix<'on-change', string, {strict: false}>;\n\t//=> 'n-change'\n\n\ttype E = RemovePrefix<`${string}/${number}`, `${string}/`, {strict: true}>;\n\t//=> string\n\n\ttype F = RemovePrefix<`${string}/${number}`, `${string}/`, {strict: false}>;\n\t//=> `${number}`\n\t```\n\n\tNote: This option has no effect when only the input string type is non-literal. For example, ``RemovePrefix<`on-${string}`, 'on-'>`` will always return `string`.\n\n\t@example\n\t```\n\timport type {RemovePrefix} from 'type-fest';\n\n\ttype A = RemovePrefix<`on-${string}`, 'on-', {strict: true}>;\n\t//=> string\n\n\ttype B = RemovePrefix<`on-${string}`, 'on-', {strict: false}>;\n\t//=> string\n\n\ttype C = RemovePrefix<`id-${number}`, 'id-', {strict: true}>;\n\t//=> `${number}`\n\n\ttype D = RemovePrefix<`id-${number}`, 'id-', {strict: false}>;\n\t//=> `${number}`\n\t```\n\n\tNote: If it can be statically determined that the input string can never start with the specified non-literal prefix, then the input string is returned as-is, regardless of the value of this option.\n\tFor example, ``RemovePrefix<`${string}/${number}`, `${string}:`>`` returns `` `${string}/${number}` ``, since a string of type `` `${string}/${number}` `` can never start with a prefix of type `` `${string}:` ``.\n\t```\n\timport type {RemovePrefix} from 'type-fest';\n\n\ttype A = RemovePrefix<`${string}/${number}`, `${string}:`, {strict: true}>;\n\t//=> `${string}/${number}`\n\n\ttype B = RemovePrefix<`${string}/${number}`, `${string}:`, {strict: false}>;\n\t//=> `${string}/${number}`\n\n\ttype C = RemovePrefix<'on-change', `${number}-`, {strict: true}>;\n\t//=> 'on-change'\n\n\ttype D = RemovePrefix<'on-change', `${number}-`, {strict: false}>;\n\t//=> 'on-change'\n\t```\n\t*/\n\tstrict?: boolean;\n};\n\ntype DefaultRemovePrefixOptions = {\n\tstrict: true;\n};\n\n/**\nRemove the specified prefix from the start of a string.\n\n@example\n```\nimport type {RemovePrefix} from 'type-fest';\n\ntype A = RemovePrefix<'on-change', 'on-'>;\n//=> 'change'\n\ntype B = RemovePrefix<'sm:flex' | 'sm:p-4' | 'sm:gap-2', 'sm:'>;\n//=> 'flex' | 'p-4' | 'gap-2'\n\ntype C = RemovePrefix<'on-change', 'off-'>;\n//=> 'on-change'\n\ntype D = RemovePrefix<`handle${Capitalize<string>}`, 'handle'>;\n//=> Capitalize<string>\n```\n\n@see {@link RemovePrefixOptions}\n\n@category String\n@category Template literal\n*/\nexport type RemovePrefix<S extends string, Prefix extends string, Options extends RemovePrefixOptions = {}> =\nIfNotAnyOrNever<\n\tS,\n\tIfNotAnyOrNever<\n\t\tPrefix,\n\t\t_RemovePrefix<S, Prefix, ApplyDefaultOptions<RemovePrefixOptions, DefaultRemovePrefixOptions, Options>>,\n\t\tstring,\n\t\tS\n\t>\n>;\n\ntype _RemovePrefix<S extends string, Prefix extends string, Options extends Required<RemovePrefixOptions>> =\nPrefix extends string // For distributing `Prefix`\n\t? S extends `${Prefix}${infer Rest}`\n\t\t? Or<IsStringLiteral<Prefix>, Not<Options['strict']>> extends true\n\t\t\t? Rest\n\t\t\t: string // Fallback to `string` when `Prefix` is non-literal and `strict` is disabled\n\t\t: S // Return back `S` when `Prefix` is not present at the start of `S`\n\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/replace.d.ts",
    "content": "import type {ApplyDefaultOptions} from './internal/index.d.ts';\n\nexport type ReplaceOptions = {\n\tall?: boolean;\n};\n\ntype DefaultReplaceOptions = {\n\tall: false;\n};\n\n/**\nRepresents a string with some or all matches replaced by a replacement.\n\nUse-case:\n- `kebab-case-path` to `dotted.path.notation`\n- Changing date/time format: `01-08-2042` → `01/08/2042`\n- Manipulation of type properties, for example, removal of prefixes\n\n@example\n```\nimport type {Replace} from 'type-fest';\n\ndeclare function replace<\n\tInput extends string,\n\tSearch extends string,\n\tReplacement extends string,\n>(\n\tinput: Input,\n\tsearch: Search,\n\treplacement: Replacement\n): Replace<Input, Search, Replacement>;\n\ndeclare function replaceAll<\n\tInput extends string,\n\tSearch extends string,\n\tReplacement extends string,\n>(\n\tinput: Input,\n\tsearch: Search,\n\treplacement: Replacement\n): Replace<Input, Search, Replacement, {all: true}>;\n\n// The return type is the exact string literal, not just `string`.\n\nreplace('hello ?', '?', '🦄');\n//=> 'hello 🦄'\n\nreplace('hello ??', '?', '❓');\n//=> 'hello ❓?'\n\nreplaceAll('10:42:00', ':', '-');\n//=> '10-42-00'\n\nreplaceAll('__userName__', '__', '');\n//=> 'userName'\n\nreplaceAll('My Cool Title', ' ', '');\n//=> 'MyCoolTitle'\n```\n\n@category String\n@category Template literal\n*/\nexport type Replace<\n\tInput extends string,\n\tSearch extends string,\n\tReplacement extends string,\n\tOptions extends ReplaceOptions = {},\n> = _Replace<Input, Search, Replacement, ApplyDefaultOptions<ReplaceOptions, DefaultReplaceOptions, Options>>;\n\ntype _Replace<\n\tInput extends string,\n\tSearch extends string,\n\tReplacement extends string,\n\tOptions extends Required<ReplaceOptions>,\n\tAccumulator extends string = '',\n> = Search extends string // For distributing `Search`\n\t? Replacement extends string // For distributing `Replacement`\n\t\t? Input extends `${infer Head}${Search}${infer Tail}`\n\t\t\t? Options['all'] extends true\n\t\t\t\t? _Replace<Tail, Search, Replacement, Options, `${Accumulator}${Head}${Replacement}`>\n\t\t\t\t: `${Head}${Replacement}${Tail}`\n\t\t\t: `${Accumulator}${Input}`\n\t\t: never\n\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/require-all-or-none.d.ts",
    "content": "import type {If} from './if.d.ts';\nimport type {IfNotAnyOrNever, RequireNone} from './internal/index.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {IsNever} from './is-never.d.ts';\n\n/**\nRequires all of the keys in the given object.\n*/\ntype RequireAll<ObjectType, KeysType extends keyof ObjectType> = Required<Pick<ObjectType, KeysType>>;\n\n/**\nCreate a type that requires all of the given keys or none of the given keys. The remaining keys are kept as is.\n\nUse-cases:\n- Creating interfaces for components with mutually-inclusive keys.\n\nThe caveat with `RequireAllOrNone` is that TypeScript doesn't always know at compile time every key that will exist at runtime. Therefore `RequireAllOrNone` can't do anything to prevent extra keys it doesn't know about.\n\n@example\n```\nimport type {RequireAllOrNone} from 'type-fest';\n\ntype Responder = {\n\ttext?: () => string;\n\tjson?: () => string;\n\tsecure: boolean;\n};\n\nconst responder1: RequireAllOrNone<Responder, 'text' | 'json'> = {\n\tsecure: true,\n};\n\nconst responder2: RequireAllOrNone<Responder, 'text' | 'json'> = {\n\ttext: () => '{\"message\": \"hi\"}',\n\tjson: () => '{\"message\": \"ok\"}',\n\tsecure: true,\n};\n```\n\n@category Object\n*/\nexport type RequireAllOrNone<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =\n\tIfNotAnyOrNever<ObjectType,\n\t\tIf<IsNever<KeysType>,\n\t\t\tObjectType,\n\t\t\t_RequireAllOrNone<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>\n\t\t>>;\n\ntype _RequireAllOrNone<ObjectType, KeysType extends keyof ObjectType> = (\n\t| RequireAll<ObjectType, KeysType>\n\t| RequireNone<KeysType>\n) & Omit<ObjectType, KeysType>; // The rest of the keys.\n\nexport {};\n"
  },
  {
    "path": "source/require-at-least-one.d.ts",
    "content": "import type {Except} from './except.d.ts';\nimport type {If} from './if.d.ts';\nimport type {IfNotAnyOrNever} from './internal/index.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {IsNever} from './is-never.d.ts';\n\n/**\nCreate a type that requires at least one of the given keys. The remaining keys are kept as is.\n\n@example\n```\nimport type {RequireAtLeastOne} from 'type-fest';\n\ntype Responder = {\n\ttext?: () => string;\n\tjson?: () => string;\n\tsecure?: boolean;\n};\n\nconst responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {\n\tjson: () => '{\"message\": \"ok\"}',\n\tsecure: true,\n};\n```\n\n@category Object\n*/\nexport type RequireAtLeastOne<\n\tObjectType,\n\tKeysType extends keyof ObjectType = keyof ObjectType,\n> =\n\tIfNotAnyOrNever<ObjectType,\n\t\tIf<IsNever<KeysType>,\n\t\t\tnever,\n\t\t\t_RequireAtLeastOne<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>\n\t\t>>;\n\ntype _RequireAtLeastOne<\n\tObjectType,\n\tKeysType extends keyof ObjectType,\n> = {\n\t// For each `Key` in `KeysType` make a mapped type:\n\t[Key in KeysType]-?: Required<Pick<ObjectType, Key>> & // 1. Make `Key`'s type required\n\t// 2. Make all other keys in `KeysType` optional\n\t\tPartial<Pick<ObjectType, Exclude<KeysType, Key>>>;\n}[KeysType] &\n// 3. Add the remaining keys not in `KeysType`\nExcept<ObjectType, KeysType>;\n\nexport {};\n"
  },
  {
    "path": "source/require-exactly-one.d.ts",
    "content": "import type {If} from './if.d.ts';\nimport type {IfNotAnyOrNever} from './internal/index.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {IsNever} from './is-never.d.ts';\n\n/**\nCreate a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is.\n\nUse-cases:\n- Creating interfaces for components that only need one of the keys to display properly.\n- Declaring generic keys in a single place for a single use-case that gets narrowed down via `RequireExactlyOne`.\n\nThe caveat with `RequireExactlyOne` is that TypeScript doesn't always know at compile time every key that will exist at runtime. Therefore `RequireExactlyOne` can't do anything to prevent extra keys it doesn't know about.\n\n@example\n```\nimport type {RequireExactlyOne} from 'type-fest';\n\ntype Responder = {\n\ttext: () => string;\n\tjson: () => string;\n\tsecure: boolean;\n};\n\nconst responder: RequireExactlyOne<Responder, 'text' | 'json'> = {\n\t// Adding a `text` key here would cause a compile error.\n\n\tjson: () => '{\"message\": \"ok\"}',\n\tsecure: true,\n};\n```\n\n@category Object\n*/\nexport type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =\n\tIfNotAnyOrNever<ObjectType,\n\t\tIf<IsNever<KeysType>,\n\t\t\tnever,\n\t\t\t_RequireExactlyOne<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>\n\t\t>>;\n\ntype _RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType> =\n\t{[Key in KeysType]: (\n\t\tRequired<Pick<ObjectType, Key>> &\n\t\tPartial<Record<Exclude<KeysType, Key>, never>>\n\t)}[KeysType] & Omit<ObjectType, KeysType>;\n\nexport {};\n"
  },
  {
    "path": "source/require-one-or-none.d.ts",
    "content": "import type {RequireExactlyOne} from './require-exactly-one.d.ts';\nimport type {IfNotAnyOrNever, RequireNone} from './internal/index.d.ts';\nimport type {If} from './if.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {IsNever} from './is-never.d.ts';\n\n/**\nCreate a type that requires exactly one of the given keys and disallows more, or none of the given keys. The remaining keys are kept as is.\n\n@example\n```\nimport type {RequireOneOrNone} from 'type-fest';\n\ntype Responder = RequireOneOrNone<{\n\ttext: () => string;\n\tjson: () => string;\n\tsecure: boolean;\n}, 'text' | 'json'>;\n\nconst responder1: Responder = {\n\tsecure: true,\n};\n\nconst responder2: Responder = {\n\ttext: () => '{\"message\": \"hi\"}',\n\tsecure: true,\n};\n\nconst responder3: Responder = {\n\tjson: () => '{\"message\": \"ok\"}',\n\tsecure: true,\n};\n```\n\n@category Object\n*/\nexport type RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =\n\tIfNotAnyOrNever<ObjectType,\n\t\tIf<IsNever<KeysType>,\n\t\t\tObjectType,\n\t\t\t_RequireOneOrNone<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>\n\t\t>>;\n\ntype _RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType> = (\n\t| RequireExactlyOne<ObjectType, KeysType>\n\t| RequireNone<KeysType>\n) & Omit<ObjectType, KeysType>; // Ignore unspecified keys.\n\nexport {};\n"
  },
  {
    "path": "source/required-deep.d.ts",
    "content": "import type {BuiltIns, HasMultipleCallSignatures} from './internal/index.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {Simplify} from './simplify.d.ts';\n\n/**\nCreate a type from another type with all keys and nested keys set to required.\n\nUse-cases:\n- Creating optional configuration interfaces where the underlying implementation still requires all options to be fully specified.\n- Modeling the resulting type after a deep merge with a set of defaults.\n\n@example\n```\nimport type {RequiredDeep} from 'type-fest';\n\ntype Settings = {\n\ttextEditor?: {\n\t\tfontSize?: number;\n\t\tfontColor?: string;\n\t\tfontWeight?: number | undefined;\n\t};\n\tautocomplete?: boolean;\n\tautosave?: boolean | undefined;\n};\n\ntype RequiredSettings = RequiredDeep<Settings>;\n//=> {\n// \ttextEditor: {\n// \t\tfontSize: number;\n// \t\tfontColor: string;\n// \t\tfontWeight: number | undefined;\n// \t};\n// \tautocomplete: boolean;\n// \tautosave: boolean | undefined;\n// }\n```\n\nNote that types containing overloaded functions are not made deeply required due to a [TypeScript limitation](https://github.com/microsoft/TypeScript/issues/29732).\n\n@category Utilities\n@category Object\n@category Array\n@category Set\n@category Map\n*/\nexport type RequiredDeep<T> = T extends BuiltIns\n\t? T\n\t: T extends Map<infer KeyType, infer ValueType>\n\t\t? Map<RequiredDeep<KeyType>, RequiredDeep<ValueType>>\n\t\t: T extends Set<infer ItemType>\n\t\t\t? Set<RequiredDeep<ItemType>>\n\t\t\t: T extends ReadonlyMap<infer KeyType, infer ValueType>\n\t\t\t\t? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>>\n\t\t\t\t: T extends ReadonlySet<infer ItemType>\n\t\t\t\t\t? ReadonlySet<RequiredDeep<ItemType>>\n\t\t\t\t\t: T extends WeakMap<infer KeyType, infer ValueType>\n\t\t\t\t\t\t? WeakMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>>\n\t\t\t\t\t\t: T extends WeakSet<infer ItemType>\n\t\t\t\t\t\t\t? WeakSet<RequiredDeep<ItemType>>\n\t\t\t\t\t\t\t: T extends Promise<infer ValueType>\n\t\t\t\t\t\t\t\t? Promise<RequiredDeep<ValueType>>\n\t\t\t\t\t\t\t\t: T extends (...arguments_: any[]) => unknown\n\t\t\t\t\t\t\t\t\t? IsNever<keyof T> extends true\n\t\t\t\t\t\t\t\t\t\t? T\n\t\t\t\t\t\t\t\t\t\t: HasMultipleCallSignatures<T> extends true\n\t\t\t\t\t\t\t\t\t\t\t? T\n\t\t\t\t\t\t\t\t\t\t\t: ((...arguments_: Parameters<T>) => ReturnType<T>) & RequiredObjectDeep<T>\n\t\t\t\t\t\t\t\t\t: T extends object\n\t\t\t\t\t\t\t\t\t\t? Simplify<RequiredObjectDeep<T>> // `Simplify` to prevent `RequiredObjectDeep` from appearing in the resulting type\n\t\t\t\t\t\t\t\t\t\t: unknown;\n\ntype RequiredObjectDeep<ObjectType extends object> = {\n\t[KeyType in keyof ObjectType]-?: RequiredDeep<ObjectType[KeyType]>\n};\n\nexport {};\n"
  },
  {
    "path": "source/required-keys-of.d.ts",
    "content": "import type {OptionalKeysOf} from './optional-keys-of.d.ts';\n\n/**\nExtract all required keys from the given type.\n\nThis is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...\n\n@example\n```\nimport type {RequiredKeysOf} from 'type-fest';\n\ndeclare function createValidation<\n\tEntity extends object,\n\tKey extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,\n>(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;\n\ntype User = {\n\tname: string;\n\tsurname: string;\n\tluckyNumber?: number;\n};\n\nconst validator1 = createValidation<User>('name', value => value.length < 25);\nconst validator2 = createValidation<User>('surname', value => value.length < 25);\n\n// @ts-expect-error\nconst validator3 = createValidation<User>('luckyNumber', value => value > 0);\n// Error: Argument of type '\"luckyNumber\"' is not assignable to parameter of type '\"name\" | \"surname\"'.\n```\n\n@category Utilities\n*/\nexport type RequiredKeysOf<Type extends object> =\n\tType extends unknown // For distributing `Type`\n\t\t? Exclude<keyof Type, OptionalKeysOf<Type>>\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/schema.d.ts",
    "content": "import type {ApplyDefaultOptions} from './internal/object.d.ts';\nimport type {IfNotAnyOrNever, NonRecursiveType} from './internal/type.d.ts';\nimport type {OptionalKeysOf} from './optional-keys-of.d.ts';\nimport type {Simplify} from './simplify.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\n@see {@link Schema}\n*/\nexport type SchemaOptions = {\n\t/**\n\tBy default, this affects elements in array and tuple types. You can change this by passing `{recurseIntoArrays: false}` as the third type argument:\n\t- If `recurseIntoArrays` is set to `true` (default), array elements will be recursively processed as well.\n\t- If `recurseIntoArrays` is set to `false`, arrays will not be recursively processed, and the entire array will be replaced with the given value type.\n\n\t@example\n\t```\n\timport type {Schema} from 'type-fest';\n\n\ttype Participants = {\n\t\tattendees: string[];\n\t\tspeakers: string[];\n\t};\n\n\ttype ParticipantsWithMetadata = Schema<Participants, {id: number; name: string}, {recurseIntoArrays: true}>;\n\t//=> {\n\t// \tattendees: {\n\t// \t\tid: number;\n\t// \t\tname: string;\n\t// \t}[];\n\t// \tspeakers: {\n\t// \t\tid: number;\n\t// \t\tname: string;\n\t// \t}[];\n\t// }\n\n\ttype ParticipantsCount = Schema<Participants, number, {recurseIntoArrays: false}>;\n\t//=> {attendees: number; speakers: number}\n\t```\n\n\t@default true\n\t*/\n\trecurseIntoArrays?: boolean;\n};\n\ntype DefaultSchemaOptions = {\n\trecurseIntoArrays: true;\n};\n\n/**\nCreate a deep version of another object type where property values are recursively replaced into a given value type.\n\nUse-cases:\n- Form validation: Define how each field should be validated.\n- Form settings: Define configuration for input fields.\n- Parsing: Define types that specify special behavior for specific fields.\n\n@example\n```\nimport type {Schema} from 'type-fest';\n\ntype User = {\n\tid: string;\n\tname: {\n\t\tfirstname: string;\n\t\tlastname: string;\n\t};\n\tcreated: Date;\n\tactive: boolean;\n\tpasswordHash: string;\n\tlocation: [latitude: number, longitude: number];\n};\n\ntype UserMask = Schema<User, 'mask' | 'hide' | 'show'>;\n\nconst userMaskSettings: UserMask = {\n\tid: 'show',\n\tname: {\n\t\tfirstname: 'show',\n\t\tlastname: 'mask',\n\t},\n\tcreated: 'show',\n\tactive: 'show',\n\tpasswordHash: 'hide',\n\tlocation: ['hide', 'hide'],\n};\n```\n\n@see {@link SchemaOptions}\n\n@category Object\n*/\nexport type Schema<Type, Value, Options extends SchemaOptions = {}> =\n\tIfNotAnyOrNever<Type,\n\t\t_Schema<Type, Value, ApplyDefaultOptions<SchemaOptions, DefaultSchemaOptions, Options>>,\n\t\tValue, Value>;\n\ntype _Schema<Type, Value, Options extends Required<SchemaOptions>> =\n\tType extends NonRecursiveType | Map<unknown, unknown> | Set<unknown> | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>\n\t\t? Value\n\t\t: Type extends UnknownArray\n\t\t\t? Options['recurseIntoArrays'] extends false\n\t\t\t\t? Value\n\t\t\t\t: SchemaHelper<Type, Value, Options>\n\t\t\t: SchemaHelper<Type, Value, Options>;\n\n/**\nInternal helper for {@link _Schema}.\n\nRecursively transforms the value of each property in objects and arrays.\n*/\ntype SchemaHelper<Type, Value, Options extends Required<SchemaOptions>> = Simplify<{\n\t[Key in keyof Type]: _Schema<\n\t\tKey extends OptionalKeysOf<Type & object> ? Exclude<Type[Key], undefined> : Type[Key], // Remove `| undefined` when accessing optional properties\n\t\tValue,\n\t\tOptions>\n}>;\n\nexport {};\n"
  },
  {
    "path": "source/screaming-snake-case.d.ts",
    "content": "import type {_DefaultDelimiterCaseOptions} from './delimiter-case.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {SnakeCase} from './snake-case.d.ts';\nimport type {WordsOptions} from './words.d.ts';\n\n/**\nConvert a string literal to screaming-snake-case.\n\nThis can be useful when, for example, converting a camel-cased object property to a screaming-snake-cased SQL column name.\n\n@example\n```\nimport type {ScreamingSnakeCase} from 'type-fest';\n\nconst someVariable: ScreamingSnakeCase<'fooBar'> = 'FOO_BAR';\nconst someVariableNoSplitOnNumbers: ScreamingSnakeCase<'p2pNetwork', {splitOnNumbers: false}> = 'P2P_NETWORK';\n\n```\n\n@category Change case\n@category Template literal\n */\nexport type ScreamingSnakeCase<\n\tValue,\n\tOptions extends WordsOptions = {},\n> = Value extends string\n\t? Uppercase<SnakeCase<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>>\n\t: Value;\n\nexport {};\n"
  },
  {
    "path": "source/set-field-type.d.ts",
    "content": "import type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {Simplify} from './simplify.d.ts';\n\nexport type SetFieldTypeOptions = {\n\t/**\n\tPreserve optional and readonly modifiers for properties being updated.\n\n\tNOTE: Property modifiers will always be preserved for properties that are not being updated.\n\n\t@default true\n\t*/\n\tpreservePropertyModifiers?: boolean;\n};\n\ntype DefaultSetFieldTypeOptions = {\n\tpreservePropertyModifiers: true;\n};\n\n/**\nCreate a type that changes the type of the given keys.\n\nUse-cases:\n- Creating variations of a base model.\n- Fixing incorrect external types.\n\n@see `Merge` if you need to change multiple properties to different types.\n\n@example\n```\nimport type {SetFieldType} from 'type-fest';\n\ntype MyModel = {\n\treadonly id: number;\n\treadonly createdAt: Date;\n\tupdatedAt?: Date;\n};\n\ntype MyModelApi1 = SetFieldType<MyModel, 'createdAt' | 'updatedAt', string>;\n// {\n// \treadonly id: number;\n// \treadonly createdAt: string;\n// \tupdatedAt?: string;\n// }\n\n// `preservePropertyModifiers` option can be set to `false` if you want to remove property modifiers for properties being updated\ntype MyModelApi2 = SetFieldType<MyModel, 'createdAt' | 'updatedAt', string, {preservePropertyModifiers: false}>;\n// {\n// \treadonly id: number;\n// \tcreatedAt: string; // no longer readonly\n// \tupdatedAt: string; // no longer optional\n// }\n```\n\n@category Object\n*/\nexport type SetFieldType<BaseType, Keys extends keyof BaseType, NewType, Options extends SetFieldTypeOptions = {}> =\n\t_SetFieldType<BaseType, Keys, NewType, ApplyDefaultOptions<SetFieldTypeOptions, DefaultSetFieldTypeOptions, Options>>;\n\ntype _SetFieldType<BaseType, Keys extends keyof BaseType, NewType, Options extends Required<SetFieldTypeOptions>> =\n\tSimplify<{\n\t\t[P in keyof BaseType]: P extends Keys ? NewType : BaseType[P];\n\t} & (\n\t\t// `Record` is used to remove property modifiers\n\t\tOptions['preservePropertyModifiers'] extends false ? Record<Keys, NewType> : unknown\n\t)>;\n\nexport {};\n"
  },
  {
    "path": "source/set-non-nullable-deep.d.ts",
    "content": "import type {NonRecursiveType, StringToNumber} from './internal/index.d.ts';\nimport type {Paths} from './paths.d.ts';\nimport type {SetNonNullable} from './set-non-nullable.d.ts';\nimport type {Simplify} from './simplify.d.ts';\nimport type {UnionToTuple} from './union-to-tuple.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nCreate a type that makes the specified keys non-nullable (removes `null` and `undefined`), supports deeply nested key paths, and leaves all other keys unchanged.\n\nNOTE: Optional modifiers (`?`) are not removed from properties. For example, `SetNonNullableDeep<{foo?: string | null | undefined}, 'foo'>` will result in `{foo?: string}`.\n\n@example\n```\nimport type {SetNonNullableDeep} from 'type-fest';\n\ntype User = {\n\tname: string;\n\taddress: {\n\t\tcity: string | undefined;\n\t\tstreet?: string | null;\n\t};\n\tcontact: {\n\t\temail?: string | null | undefined;\n\t\tphone: string | undefined;\n\t};\n};\n\ntype UpdatedUser = SetNonNullableDeep<User, 'address.street' | 'contact.email' | 'contact.phone'>;\n//=> {\n// \tname: string;\n// \taddress: {\n// \t\tcity: string | undefined;\n// \t\tstreet?: string;\n// \t};\n// \tcontact: {\n// \t\temail?: string;\n// \t\tphone: string;\n// \t};\n// }\n```\n\n@example\n```\nimport type {SetNonNullableDeep} from 'type-fest';\n\n// Set specific indices in an array to be non-nullable.\ntype ArrayExample1 = SetNonNullableDeep<{a: [number | null, number | null, number | undefined]}, 'a.1' | 'a.2'>;\n//=> {a: [number | null, number, number]}\n\n// Optional modifier (`?`) is not removed.\ntype ArrayExample2 = SetNonNullableDeep<{a: [(number | null)?, (number | null)?]}, 'a.1'>;\n//=> {a: [(number | null)?, number?]}\n```\n\n@category Object\n*/\nexport type SetNonNullableDeep<BaseType, KeyPaths extends Paths<BaseType>> =\n\tSetNonNullableDeepHelper<BaseType, UnionToTuple<KeyPaths>>;\n\n/**\nInternal helper for {@link SetNonNullableDeep}.\n\nRecursively transforms the `BaseType` by applying {@link SetNonNullableDeepSinglePath} for each path in `KeyPathsTuple`.\n*/\ntype SetNonNullableDeepHelper<BaseType, KeyPathsTuple extends UnknownArray> =\n\tKeyPathsTuple extends [infer KeyPath, ...infer RestPaths]\n\t\t? SetNonNullableDeepHelper<SetNonNullableDeepSinglePath<BaseType, KeyPath>, RestPaths>\n\t\t: BaseType;\n\n/**\nMakes a single path non-nullable in `BaseType`.\n*/\ntype SetNonNullableDeepSinglePath<BaseType, KeyPath> =\n\tBaseType extends NonRecursiveType | ReadonlySet<unknown> | ReadonlyMap<unknown, unknown> // Also distributes `BaseType`\n\t\t? BaseType\n\t\t: KeyPath extends `${infer Property}.${infer RestPath}`\n\t\t\t? {\n\t\t\t\t[Key in keyof BaseType]: Property extends `${Key & (string | number)}`\n\t\t\t\t\t? SetNonNullableDeepSinglePath<BaseType[Key], RestPath>\n\t\t\t\t\t: BaseType[Key];\n\t\t\t}\n\t\t\t: Simplify<SetNonNullable<BaseType, (KeyPath | StringToNumber<KeyPath & string>) & keyof BaseType>>;\n\nexport {};\n"
  },
  {
    "path": "source/set-non-nullable.d.ts",
    "content": "/**\nCreate a type that makes the given keys non-nullable, where the remaining keys are kept as is.\n\nIf no keys are given, all keys will be made non-nullable.\n\nUse-case: You want to define a single model where the only thing that changes is whether or not some or all of the keys are non-nullable.\n\n@example\n```\nimport type {SetNonNullable} from 'type-fest';\n\ntype Foo = {\n\ta: number | null;\n\tb: string | undefined;\n\tc?: boolean | null;\n};\n\n// Note: In the following example, `c` can no longer be `null`, but it's still optional.\ntype SomeNonNullable = SetNonNullable<Foo, 'b' | 'c'>;\n//=> {a: null | number; b: string; c?: boolean}\n\ntype AllNonNullable = SetNonNullable<Foo>;\n//=> {a: number; b: string; c?: boolean}\n```\n\n@category Object\n*/\nexport type SetNonNullable<BaseType, Keys extends keyof BaseType = keyof BaseType> = {\n\t[Key in keyof BaseType]: Key extends Keys\n\t\t? NonNullable<BaseType[Key]>\n\t\t: BaseType[Key];\n};\n\nexport {};\n"
  },
  {
    "path": "source/set-optional.d.ts",
    "content": "import type {Except} from './except.d.ts';\nimport type {HomomorphicPick} from './internal/index.d.ts';\nimport type {Simplify} from './simplify.d.ts';\n\n/**\nCreate a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type.\n\nUse-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.\n\n@example\n```\nimport type {SetOptional} from 'type-fest';\n\ntype Foo = {\n\ta: number;\n\tb?: string;\n\tc: boolean;\n};\n\ntype SomeOptional = SetOptional<Foo, 'b' | 'c'>;\n//=> {a: number; b?: string; c?: boolean}\n```\n\n@category Object\n*/\nexport type SetOptional<BaseType, Keys extends keyof BaseType> =\n\t(BaseType extends (...arguments_: never) => any\n\t\t? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType>\n\t\t: unknown)\n\t& _SetOptional<BaseType, Keys>;\n\ntype _SetOptional<BaseType, Keys extends keyof BaseType> =\n\tBaseType extends unknown // To distribute `BaseType` when it's a union type.\n\t\t? Simplify<\n\t\t// Pick just the keys that are readonly from the base type.\n\t\t\tExcept<BaseType, Keys> &\n\t\t// Pick the keys that should be mutable from the base type and make them mutable.\n\t\t\tPartial<HomomorphicPick<BaseType, Keys>>\n\t\t>\n\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/set-parameter-type.d.ts",
    "content": "import type {IsUnknown} from './is-unknown.d.ts';\nimport type {StaticPartOfArray, VariablePartOfArray} from './internal/index.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nCreate an array that replaces the given `TArray`'s elements with the given `TObject`'s values at the given indices.\n\n`TArray` and `TObject` supports tailing spread array like `[string, ...boolean[]]`, but does not support `[string, ...boolean[], number]`.\n\n@example:\n```ts\n// object\ntype A = MergeObjectToArray<[string, number], {0: boolean}>;\n//=> [boolean, number]\n\n// array\ntype B = MergeObjectToArray<[string, number], [boolean]>;\n//=> [boolean, number]\n\n// tailing spread array\ntype C = MergeObjectToArray<[string, ...boolean[]], {1: number}>;\n//=> [string, ...number[]]\n\ntype D = MergeObjectToArray<[string, ...boolean[]], [number, ...string[]]>;\n//=> [number, ...string[]]\n```\n*/\ntype MergeObjectToArray<TArray extends UnknownArray, TObject, TArrayCopy extends UnknownArray = TArray> =\n\t// If `TObject` is an array like `[0, 1, 2]`\n\tTObject extends UnknownArray\n\t\t// If `TObject` is a variable length array, we should use `TObject`'s type as the result type.\n\t\t? number extends TObject['length']\n\t\t\t? TObject\n\t\t\t: {\n\t\t\t\t[K in keyof TArray]:\n\t\t\t\tnumber extends K\n\t\t\t\t\t? VariablePartOfArray<TArray>[number]\n\t\t\t\t\t: K extends keyof TObject ? TObject[K] : TArray[K]\n\t\t\t}\n\t\t: TObject extends object\n\t\t\t// If `TObject` is an object with number keys like `{0: string, 1: number}`\n\t\t\t? {\n\t\t\t\t[K in keyof TArray]:\n\t\t\t\tK extends `${infer NumberK extends number}`\n\t\t\t\t\t? NumberK extends keyof TObject ? TObject[NumberK] : TArray[K]\n\t\t\t\t\t: number extends K\n\t\t\t\t\t// If array key `K` is `number`, means it's a rest parameter, we should set the rest parameter type to corresponding type in `TObject`.\n\t\t\t\t\t// example: `MergeObjectToArray<[string, ...boolean[]], {1: number}>` => `[string, ...number[]]`\n\t\t\t\t\t\t? StaticPartOfArray<TArrayCopy>['length'] extends keyof TObject\n\t\t\t\t\t\t\t? TObject[StaticPartOfArray<TArrayCopy>['length']]\n\t\t\t\t\t\t\t: TArray[K]\n\t\t\t\t\t\t: never\n\t\t\t} : never;\n\n/**\nCreate a function that replaces some parameters with the given parameters.\n\nThe parameters that are not specified will be kept as-is.\n\nNote:\n- This type will ignore the given function's generic type.\n- If you change the parameter type that return type depends on, the return type will not change:\n\t```\n\timport type {SetParameterType} from 'type-fest';\n\n\tconst fn = (a: number) => a;\n\t//=> (a: number) => number\n\n \t// We change type of `a` to `string`, but return type is still `number`.\n\ttype Fn = SetParameterType<typeof fn, {0: string}>;\n \t//=> (a: string) => number\n\t```\n\nUse-case:\n- Define a wrapped function that receives something different while returning the same type.\n- Mocking and testing.\n- Overload function type. (See example)\n\n@example\n```\nimport type {SetParameterType} from 'type-fest';\n\ntype SuccessData = {success: true; value: number};\ntype ErrorData = {success: false; error: string};\ntype Data = SuccessData | ErrorData;\n\ntype HandleMessage = (data: Data, message: string, ...arguments_: any[]) => void;\n\ntype HandleOk = SetParameterType<HandleMessage, {0: SuccessData; 1: 'ok'}>;\n//=> (data: SuccessData, message: 'ok', ...arguments_: any[]) => void\n\n// Another way to define the parameters to replace.\ntype HandleError = SetParameterType<HandleMessage, [data: ErrorData, message: 'error']>;\n//=> (data: ErrorData, message: 'error', ...arguments_: any[]) => void\n\n// Change single parameter type.\ntype HandleWarn = SetParameterType<HandleMessage, {1: 'warn'}>;\n//=> (data: Data, message: 'warn', ...arguments_: any[]) => void\n\n// Change rest parameter type.\n\n// Way 1: Input full parameter type.\ntype HandleLog = SetParameterType<HandleMessage, [data: Data, message: 'log', ...arguments_: string[]]>;\n//=> (data: Data, message: 'log', ...arguments_: string[]) => void\n\n// Way 2: Input rest parameter type by Object index.\ntype HandleLog2 = SetParameterType<HandleMessage, {2: string}>;\n//=> (data: Data, message: string, ...arguments_: string[]) => void\n```\n\n@category Function\n*/\nexport type SetParameterType<Function_ extends (...arguments_: any[]) => unknown, P extends Record<number, unknown>> =\n\t// Just using `Parameters<Fn>` isn't ideal because it doesn't handle the `this` fake parameter.\n\tFunction_ extends (this: infer ThisArgument, ...arguments_: infer Arguments) => unknown\n\t\t? (\n\t\t\t// If a function did not specify the `this` fake parameter, it will be inferred to `unknown`.\n\t\t\t// We want to detect this situation just to display a friendlier type upon hovering on an IntelliSense-powered IDE.\n\t\t\tIsUnknown<ThisArgument> extends true\n\t\t\t\t? (...arguments_: MergeObjectToArray<Arguments, P>) => ReturnType<Function_>\n\t\t\t\t: (this: ThisArgument, ...arguments_: MergeObjectToArray<Arguments, P>) => ReturnType<Function_>\n\t\t)\n\t\t: Function_;\t// This part should be unreachable\n\nexport {};\n"
  },
  {
    "path": "source/set-readonly.d.ts",
    "content": "import type {Except} from './except.d.ts';\nimport type {HomomorphicPick} from './internal/index.d.ts';\nimport type {Simplify} from './simplify.d.ts';\n\n/**\nCreate a type that makes the given keys readonly. The remaining keys are kept as is.\n\nUse-case: You want to define a single model where the only thing that changes is whether or not some of the keys are readonly.\n\n@example\n```\nimport type {SetReadonly} from 'type-fest';\n\ntype Foo = {\n\ta: number;\n\treadonly b: string;\n\tc: boolean;\n};\n\ntype SomeReadonly = SetReadonly<Foo, 'b' | 'c'>;\n//=> {a: number; readonly b: string; readonly c: boolean}\n```\n\n@category Object\n*/\nexport type SetReadonly<BaseType, Keys extends keyof BaseType> =\n\t(BaseType extends (...arguments_: never) => any\n\t\t? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType>\n\t\t: unknown)\n\t& _SetReadonly<BaseType, Keys>;\n\nexport type _SetReadonly<BaseType, Keys extends keyof BaseType> =\n\tBaseType extends unknown // To distribute `BaseType` when it's a union type.\n\t\t? Simplify<\n\t\t\tExcept<BaseType, Keys> &\n\t\t\tReadonly<HomomorphicPick<BaseType, Keys>>\n\t\t>\n\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/set-required-deep.d.ts",
    "content": "import type {IsAny} from './is-any.d.ts';\nimport type {NonRecursiveType, StringToNumber} from './internal/index.d.ts';\nimport type {Paths} from './paths.d.ts';\nimport type {SetRequired} from './set-required.d.ts';\nimport type {SimplifyDeep} from './simplify-deep.d.ts';\nimport type {UnionToTuple} from './union-to-tuple.d.ts';\nimport type {RequiredDeep} from './required-deep.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nCreate a type that makes the given keys required. You can specify deeply nested key paths. The remaining keys are kept as is.\n\nUse-case: Selectively make nested properties required in complex types like models.\n\n@example\n```\nimport type {SetRequiredDeep} from 'type-fest';\n\ntype Foo = {\n\ta?: number;\n\tb?: string;\n\tc?: Array<{\n\t\td?: number;\n\t}>;\n};\n\ntype SomeRequiredDeep = SetRequiredDeep<Foo, 'a' | `c.${number}.d`>;\n//=> {b?: string; c?: {d: number}[]; a: number}\n\n// Set specific indices in an array to be required.\ntype ArrayExample = SetRequiredDeep<{a: [number?, number?, number?]}, 'a.0' | 'a.1'>;\n//=> {a: [number, number, number?]}\n```\n\n@category Object\n*/\nexport type SetRequiredDeep<BaseType, KeyPaths extends Paths<BaseType>> = IsAny<KeyPaths> extends true\n\t? SimplifyDeep<RequiredDeep<BaseType>>\n\t: SetRequiredDeepHelper<BaseType, UnionToTuple<KeyPaths>>;\n\n/**\nInternal helper for {@link SetRequiredDeep}.\n\nRecursively transforms the `BaseType` by applying {@link SetRequiredDeepSinglePath} for each path in `KeyPathsTuple`.\n*/\ntype SetRequiredDeepHelper<BaseType, KeyPathsTuple extends UnknownArray> =\n\tKeyPathsTuple extends [infer KeyPath, ...infer RestPaths]\n\t\t? SetRequiredDeepHelper<SetRequiredDeepSinglePath<BaseType, KeyPath>, RestPaths>\n\t\t: BaseType;\n\n/**\nMakes a single path required in `BaseType`.\n*/\ntype SetRequiredDeepSinglePath<BaseType, KeyPath> = BaseType extends NonRecursiveType\n\t? BaseType\n\t: KeyPath extends `${infer Property}.${infer RestPath}`\n\t\t? {\n\t\t\t[Key in keyof BaseType]: Property extends `${Key & (string | number)}`\n\t\t\t\t? SetRequiredDeepSinglePath<BaseType[Key], RestPath>\n\t\t\t\t: BaseType[Key];\n\t\t}\n\t\t: SetRequired<BaseType, (KeyPath | StringToNumber<KeyPath & string>) & keyof BaseType>;\n\nexport {};\n"
  },
  {
    "path": "source/set-required.d.ts",
    "content": "import type {Except} from './except.d.ts';\nimport type {If} from './if.d.ts';\nimport type {HomomorphicPick, IsArrayReadonly} from './internal/index.d.ts';\nimport type {OptionalKeysOf} from './optional-keys-of.d.ts';\nimport type {Simplify} from './simplify.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nCreate a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.\n\nUse-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.\n\n@example\n```\nimport type {SetRequired} from 'type-fest';\n\ntype Foo = {\n\ta?: number;\n\tb: string;\n\tc?: boolean;\n};\n\ntype SomeRequired = SetRequired<Foo, 'b' | 'c'>;\n//=> {a?: number; b: string; c: boolean}\n\n// Set specific indices in an array to be required.\ntype ArrayExample = SetRequired<[number?, number?, number?], 0 | 1>;\n//=> [number, number, number?]\n```\n\n@category Object\n*/\nexport type SetRequired<BaseType, Keys extends keyof BaseType> =\n\t(BaseType extends (...arguments_: never) => any\n\t\t? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType>\n\t\t: unknown)\n\t& _SetRequired<BaseType, Keys>;\n\ntype _SetRequired<BaseType, Keys extends keyof BaseType> =\n\tBaseType extends UnknownArray\n\t\t? SetArrayRequired<BaseType, Keys> extends infer ResultantArray\n\t\t\t? If<IsArrayReadonly<BaseType>, Readonly<ResultantArray>, ResultantArray>\n\t\t\t: never\n\t\t: Simplify<\n\t\t// Pick just the keys that are optional from the base type.\n\t\t\tExcept<BaseType, Keys> &\n\t\t// Pick the keys that should be required from the base type and make them required.\n\t\t\tRequired<HomomorphicPick<BaseType, Keys>>\n\t\t>;\n\n/**\nRemove the optional modifier from the specified keys in an array.\n*/\ntype SetArrayRequired<\n\tTArray extends UnknownArray,\n\tKeys,\n\tCounter extends any[] = [],\n\tAccumulator extends UnknownArray = [],\n> = TArray extends unknown // For distributing `TArray` when it's a union\n\t? keyof TArray & `${number}` extends never\n\t\t// Exit if `TArray` is empty (e.g., []), or\n\t\t// `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).\n\t\t? [...Accumulator, ...TArray]\n\t\t: TArray extends readonly [(infer First)?, ...infer Rest]\n\t\t\t? '0' extends OptionalKeysOf<TArray> // If the first element of `TArray` is optional\n\t\t\t\t? `${Counter['length']}` extends `${Keys & (string | number)}` // If the current index needs to be required\n\t\t\t\t\t? SetArrayRequired<Rest, Keys, [...Counter, any], [...Accumulator, First]>\n\t\t\t\t\t// If the current element is optional, but it doesn't need to be required,\n\t\t\t\t\t// then we can exit early, since no further elements can now be made required.\n\t\t\t\t\t: [...Accumulator, ...TArray]\n\t\t\t\t: SetArrayRequired<Rest, Keys, [...Counter, any], [...Accumulator, TArray[0]]>\n\t\t\t: never // Should never happen, since `[(infer F)?, ...infer R]` is a top-type for arrays.\n\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/set-return-type.d.ts",
    "content": "import type {IsUnknown} from './is-unknown.d.ts';\n\n/**\nCreate a function type with a return type of your choice and the same parameters as the given function type.\n\nUse-case: You want to define a wrapped function that returns something different while receiving the same parameters. For example, you might want to wrap a function that can throw an error into one that will return `undefined` instead.\n\n@example\n```\nimport type {SetReturnType} from 'type-fest';\n\ntype MyFunctionThatCanThrow = (foo: string, bar: number) => boolean;\n\ntype MyWrappedFunction = SetReturnType<MyFunctionThatCanThrow, ReturnType<MyFunctionThatCanThrow> | undefined>;\n//=> (foo: string, bar: number) => boolean | undefined\n```\n\n@category Function\n*/\nexport type SetReturnType<Function_ extends (...arguments_: any[]) => any, TypeToReturn> =\n\t// Just using `Parameters<Fn>` isn't ideal because it doesn't handle the `this` fake parameter.\n\tFunction_ extends (this: infer ThisArgument, ...arguments_: infer Arguments) => any ? (\n\t\t// If a function did not specify the `this` fake parameter, it will be inferred to `unknown`.\n\t\t// We want to detect this situation just to display a friendlier type upon hovering on an IntelliSense-powered IDE.\n\t\tIsUnknown<ThisArgument> extends true ? (...arguments_: Arguments) => TypeToReturn : (this: ThisArgument, ...arguments_: Arguments) => TypeToReturn\n\t) : (\n\t\t// This part should be unreachable, but we make it meaningful just in case…\n\t\t(...arguments_: Parameters<Function_>) => TypeToReturn\n\t);\n\nexport {};\n"
  },
  {
    "path": "source/shared-union-fields-deep.d.ts",
    "content": "import type {NonRecursiveType, UnionMin, UnionMax, TupleLength, StaticPartOfArray, VariablePartOfArray, IsArrayReadonly, SetArrayAccess, ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nSharedUnionFieldsDeep options.\n\n@see {@link SharedUnionFieldsDeep}\n*/\nexport type SharedUnionFieldsDeepOptions = {\n\t/**\n\tWhen set to true, this option impacts each element within arrays or tuples. If all union values are arrays or tuples, it constructs an array of the shortest possible length, ensuring every element exists in the union array.\n\n\t@default false\n \t*/\n\trecurseIntoArrays?: boolean;\n};\n\ntype DefaultSharedUnionFieldsDeepOptions = {\n\trecurseIntoArrays: false;\n};\n\n/**\nCreate a type with shared fields from a union of object types, deeply traversing nested structures.\n\nUse the {@link SharedUnionFieldsDeepOptions `Options`} to specify the behavior for arrays.\n\nUse-cases:\n- You want a safe object type where each key exists in the union object.\n- You want to focus on the common fields of the union type and don't want to have to care about the other fields.\n\n@example\n```\nimport type {SharedUnionFieldsDeep} from 'type-fest';\n\ntype Cat = {\n\tinfo: {\n\t\tname: string;\n\t\ttype: 'cat';\n\t\tcatType: string;\n\t};\n};\n\ntype Dog = {\n\tinfo: {\n\t\tname: string;\n\t\ttype: 'dog';\n\t\tdogType: string;\n\t};\n};\n\nfunction displayPetInfo(petInfo: (Cat | Dog)['info']) {\n\t// typeof petInfo =>\n\t// {\n\t// \tname: string;\n\t// \ttype: 'cat';\n\t// \tcatType: string; // Needn't care about this field, because it's not a common pet info field.\n\t// } | {\n\t// \tname: string;\n\t// \ttype: 'dog';\n\t// \tdogType: string; // Needn't care about this field, because it's not a common pet info field.\n\t// }\n\n\t// petInfo type is complex and have some needless fields\n\n\tconsole.log('name:', petInfo.name);\n\tconsole.log('type:', petInfo.type);\n}\n\nfunction displayPetInfoWithSharedUnionFieldsDeep(petInfo: SharedUnionFieldsDeep<Cat | Dog>['info']) {\n\t// typeof petInfo =>\n\t// {\n\t// \tname: string;\n\t// \ttype: 'cat' | 'dog';\n\t// }\n\n\t// petInfo type is simple and clear\n\n\tconsole.log('name:', petInfo.name);\n\tconsole.log('type:', petInfo.type);\n}\n```\n\n@see {@link SharedUnionFields}\n\n@category Object\n@category Union\n*/\nexport type SharedUnionFieldsDeep<Union, Options extends SharedUnionFieldsDeepOptions = {}> =\n\tApplyDefaultOptions<SharedUnionFieldsDeepOptions, DefaultSharedUnionFieldsDeepOptions, Options> extends infer OptionsWithDefaults extends Required<SharedUnionFieldsDeepOptions>\n\t// `Union extends` will convert `Union`\n\t// to a [distributive conditional type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).\n\t// But this is not what we want, so we need to wrap `Union` with `[]` to prevent it.\n\t\t? [Union] extends [NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>]\n\t\t\t? Union\n\t\t\t: [Union] extends [UnknownArray]\n\t\t\t\t? OptionsWithDefaults['recurseIntoArrays'] extends true\n\t\t\t\t\t? SetArrayAccess<SharedArrayUnionFieldsDeep<Union, OptionsWithDefaults>, IsArrayReadonly<Union>>\n\t\t\t\t\t: Union\n\t\t\t\t: [Union] extends [object]\n\t\t\t\t\t? SharedObjectUnionFieldsDeep<Union, OptionsWithDefaults>\n\t\t\t\t\t: Union\n\t\t: never;\n\n/**\nSame as `SharedUnionFieldsDeep`, but accepts only `object`s and as inputs. Internal helper for `SharedUnionFieldsDeep`.\n*/\ntype SharedObjectUnionFieldsDeep<Union, Options extends Required<SharedUnionFieldsDeepOptions>> =\n\t// `keyof Union` can extract the same key in union type, if there is no same key, return never.\n\tkeyof Union extends infer Keys\n\t\t? IsNever<Keys> extends false\n\t\t\t? {\n\t\t\t\t[Key in keyof Union]:\n\t\t\t\tUnion[Key] extends NonRecursiveType\n\t\t\t\t\t? Union[Key]\n\t\t\t\t\t// Remove `undefined` from the union to support optional\n\t\t\t\t\t// fields, then recover `undefined` if union was already undefined.\n\t\t\t\t\t: SharedUnionFieldsDeep<Exclude<Union[Key], undefined>, Options> | (\n\t\t\t\t\t\tundefined extends Required<Union>[Key] ? undefined : never\n\t\t\t\t\t)\n\t\t\t}\n\t\t\t: {}\n\t\t: Union;\n\n/**\nSame as `SharedUnionFieldsDeep`, but accepts only `UnknownArray`s and as inputs. Internal helper for `SharedUnionFieldsDeep`.\n*/\ntype SharedArrayUnionFieldsDeep<Union extends UnknownArray, Options extends Required<SharedUnionFieldsDeepOptions>> =\n\t// Restore the readonly modifier of the array.\n\tSetArrayAccess<\n\t\tInternalSharedArrayUnionFieldsDeep<Union, Options>,\n\t\tIsArrayReadonly<Union>\n\t>;\n\n/**\nInternal helper for `SharedArrayUnionFieldsDeep`. Needn't care the `readonly` modifier of arrays.\n*/\ntype InternalSharedArrayUnionFieldsDeep<\n\tUnion extends UnknownArray,\n\tOptions extends Required<SharedUnionFieldsDeepOptions>,\n\tResultTuple extends UnknownArray = [],\n> =\n\t// We should build a minimum possible length tuple where each element in the tuple exists in the union tuple.\n\tIsNever<TupleLength<Union>> extends true\n\t\t// Rule 1: If all the arrays in the union have non-fixed lengths,\n\t\t// like `Array<string> | [number, ...string[]]`\n\t\t// we should build a tuple that is [the_fixed_parts_of_union, ...the_rest_of_union[]].\n\t\t// For example: `InternalSharedArrayUnionFieldsDeep<Array<string> | [number, ...string[]]>`\n\t\t// => `[string | number, ...string[]]`.\n\t\t? ResultTuple['length'] extends UnionMax<StaticPartOfArray<Union>['length']>\n\t\t\t? [\n\t\t\t\t// The fixed-length part of the tuple.\n\t\t\t\t...ResultTuple,\n\t\t\t\t// The rest of the union.\n\t\t\t\t// Due to `ResultTuple` is the maximum possible fixed-length part of the tuple,\n\t\t\t\t// so we can use `StaticPartOfArray` to get the rest of the union.\n\t\t\t\t...Array<\n\t\t\t\t\tSharedUnionFieldsDeep<VariablePartOfArray<Union>[number], Options>\n\t\t\t\t>,\n\t\t\t]\n\t\t\t// Build the fixed-length tuple recursively.\n\t\t\t: InternalSharedArrayUnionFieldsDeep<\n\t\t\t\tUnion, Options,\n\t\t\t\t[...ResultTuple, SharedUnionFieldsDeep<Union[ResultTuple['length']], Options>]\n\t\t\t>\n\t\t// Rule 2: If at least one of the arrays in the union have fixed lengths,\n\t\t// like `Array<string> | [number, string]`,\n\t\t// we should build a tuple of the smallest possible length to ensure any\n\t\t// item in the result tuple exists in the union tuple.\n\t\t// For example: `InternalSharedArrayUnionFieldsDeep<Array<string> | [number, string]>`\n\t\t// => `[string | number, string]`.\n\t\t: ResultTuple['length'] extends UnionMin<TupleLength<Union>>\n\t\t\t? ResultTuple\n\t\t\t// As above, build tuple recursively.\n\t\t\t: InternalSharedArrayUnionFieldsDeep<\n\t\t\t\tUnion, Options,\n\t\t\t\t[...ResultTuple, SharedUnionFieldsDeep<Union[ResultTuple['length']], Options>]\n\t\t\t>;\n\nexport {};\n"
  },
  {
    "path": "source/shared-union-fields.d.ts",
    "content": "import type {NonRecursiveType} from './internal/index.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {IsUnion} from './is-union.d.ts';\nimport type {Simplify} from './simplify.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nCreate a type with shared fields from a union of object types.\n\nUse-cases:\n- You want a safe object type where each key exists in the union object.\n- You want to focus on the common fields of the union type and don't want to have to care about the other fields.\n\n@example\n```\nimport type {SharedUnionFields} from 'type-fest';\n\ntype Cat = {\n\tname: string;\n\ttype: 'cat';\n\tcatType: string;\n};\n\ntype Dog = {\n\tname: string;\n\ttype: 'dog';\n\tdogType: string;\n};\n\nfunction displayPetInfo(petInfo: Cat | Dog) {\n\t// typeof petInfo =>\n\t// {\n\t// \tname: string;\n\t// \ttype: 'cat';\n\t// \tcatType: string; // Needn't care about this field, because it's not a common pet info field.\n\t// } | {\n\t// \tname: string;\n\t// \ttype: 'dog';\n\t// \tdogType: string; // Needn't care about this field, because it's not a common pet info field.\n\t// }\n\n\t// petInfo type is complex and have some needless fields\n\n\tconsole.log('name:', petInfo.name);\n\tconsole.log('type:', petInfo.type);\n}\n\nfunction displayPetInfoWithSharedUnionFields(petInfo: SharedUnionFields<Cat | Dog>) {\n\t// typeof petInfo =>\n\t// {\n\t// \tname: string;\n\t// \ttype: 'cat' | 'dog';\n\t// }\n\n\t// petInfo type is simple and clear\n\n\tconsole.log('name:', petInfo.name);\n\tconsole.log('type:', petInfo.type);\n}\n```\n\n@see {@link SharedUnionFieldsDeep}\n@see {@link AllUnionFields}\n\n@category Object\n@category Union\n*/\nexport type SharedUnionFields<Union> =\nExtract<Union, NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown> | UnknownArray> extends infer SkippedMembers\n\t? Exclude<Union, SkippedMembers> extends infer RelevantMembers\n\t\t?\n\t\t| SkippedMembers\n\t\t| (IsNever<RelevantMembers> extends true\n\t\t\t? never\n\t\t\t: Simplify<Pick<RelevantMembers, keyof RelevantMembers>>)\n\t\t: never\n\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/simplify-deep.d.ts",
    "content": "import type {ConditionalSimplifyDeep} from './conditional-simplify-deep.d.ts';\nimport type {MapsSetsOrArrays, NonRecursiveType} from './internal/index.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nDeeply simplifies an object type.\n\nYou can exclude certain types from being simplified by providing them in the second generic `ExcludeType`.\n\nUseful to flatten the type output to improve type hints shown in editors.\n\n@example\n```\nimport type {SimplifyDeep} from 'type-fest';\n\ntype PositionX = {\n\tleft: number;\n\tright: number;\n};\n\ntype PositionY = {\n\ttop: number;\n\tbottom: number;\n};\n\ntype Properties1 = {\n\theight: number;\n\tposition: PositionY;\n};\n\ntype Properties2 = {\n\twidth: number;\n\tposition: PositionX;\n};\n\ntype Properties = Properties1 & Properties2;\n// In your editor, hovering over `Props` will show the following:\n//\n// type Properties = Properties1 & Properties2;\n\ntype SimplifyDeepProperties = SimplifyDeep<Properties1 & Properties2>;\n// But if wrapped in SimplifyDeep, hovering over `SimplifyDeepProperties` will show a flattened object with all the properties:\n//\n// SimplifyDeepProperties = {\n// \theight: number;\n// \twidth: number;\n// \tposition: {\n// \t\ttop: number;\n// \t\tbottom: number;\n// \t\tleft: number;\n// \t\tright: number;\n// \t};\n// };\n```\n\n@example\n```\nimport type {SimplifyDeep} from 'type-fest';\n\n// A complex type that you don't want or need to simplify\ntype ComplexType = {\n\ta: string;\n\tb: 'b';\n\tc: number;\n};\n\ntype PositionX = {\n\tleft: number;\n\tright: number;\n};\n\ntype PositionY = {\n\ttop: number;\n\tbottom: number;\n};\n\n// You want to simplify all other types\ntype Properties1 = {\n\theight: number;\n\tposition: PositionY;\n\tfoo: ComplexType;\n};\n\ntype Properties2 = {\n\twidth: number;\n\tposition: PositionX;\n\tfoo: ComplexType;\n};\n\ntype SimplifyDeepProperties = SimplifyDeep<Properties1 & Properties2, ComplexType>;\n// If wrapped in `SimplifyDeep` and set `ComplexType` to exclude, hovering over `SimplifyDeepProperties` will\n// show a flattened object with all the properties except `ComplexType`:\n//\n// SimplifyDeepProperties = {\n// \theight: number;\n// \twidth: number;\n// \tposition: {\n// \t\ttop: number;\n// \t\tbottom: number;\n// \t\tleft: number;\n// \t\tright: number;\n// \t};\n//\tfoo: ComplexType;\n// };\n```\n\n@see {@link Simplify}\n@category Object\n*/\nexport type SimplifyDeep<Type, ExcludeType = never> =\n\tConditionalSimplifyDeep<\n\t\tType,\n\tExcludeType | NonRecursiveType | Exclude<MapsSetsOrArrays, UnknownArray>,\n\tobject\n\t>;\n\nexport {};\n"
  },
  {
    "path": "source/simplify.d.ts",
    "content": "/**\nUseful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.\n\n@example\n```\nimport type {Simplify} from 'type-fest';\n\ntype PositionProps = {\n\ttop: number;\n\tleft: number;\n};\n\ntype SizeProps = {\n\twidth: number;\n\theight: number;\n};\n\n// In your editor, hovering over `Props` will show a flattened object with all the properties.\ntype Props = Simplify<PositionProps & SizeProps>;\n```\n\nSometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable.  But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.\n\nIf the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument.  Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.\n\n@example\n```\nimport type {Simplify} from 'type-fest';\n\ninterface SomeInterface {\n\tfoo: number;\n\tbar?: string;\n\tbaz: number | undefined;\n}\n\ntype SomeType = {\n\tfoo: number;\n\tbar?: string;\n\tbaz: number | undefined;\n};\n\nconst literal = {foo: 123, bar: 'hello', baz: 456};\nconst someType: SomeType = literal;\nconst someInterface: SomeInterface = literal;\n\ndeclare function fn(object: Record<string, unknown>): void;\n\nfn(literal); // Good: literal object type is sealed\nfn(someType); // Good: type is sealed\n// @ts-expect-error\nfn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened\nfn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`\n```\n\n@link https://github.com/microsoft/TypeScript/issues/15300\n@see {@link SimplifyDeep}\n@category Object\n*/\nexport type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};\n\nexport {};\n"
  },
  {
    "path": "source/single-key-object.d.ts",
    "content": "import type {IsEmptyObject} from './empty-object.d.ts';\nimport type {If} from './if.d.ts';\nimport type {IsUnion} from './is-union.d.ts';\n\n/**\nCreate a type that only accepts an object with a single key.\n\n@example\n```\nimport type {SingleKeyObject} from 'type-fest';\n\ndeclare function someFunction<T>(parameter: SingleKeyObject<T>): void;\n\nsomeFunction({value: true});\n\n// @ts-expect-error\nsomeFunction({value: true, otherKey: true});\n// Error: Argument of type '{value: boolean; otherKey: boolean}' is not assignable to parameter of type 'never'.ts(2345)\n```\n\n@category Object\n*/\nexport type SingleKeyObject<ObjectType> =\n\tIsUnion<keyof ObjectType> extends true\n\t\t? never\n\t\t: If<IsEmptyObject<ObjectType>, never, ObjectType>;\n\nexport {};\n"
  },
  {
    "path": "source/snake-case.d.ts",
    "content": "import type {_DefaultDelimiterCaseOptions, DelimiterCase} from './delimiter-case.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {WordsOptions} from './words.d.ts';\n\n/**\nConvert a string literal to snake-case.\n\nThis can be useful when, for example, converting a camel-cased object property to a snake-cased SQL column name.\n\n@example\n```\nimport type {SnakeCase} from 'type-fest';\n\n// Simple\n\nconst someVariable: SnakeCase<'fooBar'> = 'foo_bar';\nconst noSplitOnNumbers: SnakeCase<'p2pNetwork'> = 'p2p_network';\nconst splitOnNumbers: SnakeCase<'p2pNetwork', {splitOnNumbers: true}> = 'p_2_p_network';\n\n// Advanced\n\ntype SnakeCasedProperties<T> = {\n\t[K in keyof T as SnakeCase<K>]: T[K]\n};\n\ntype ModelProps = {\n\tisHappy: boolean;\n\tfullFamilyName: string;\n\tfoo: number;\n};\n\nconst dbResult: SnakeCasedProperties<ModelProps> = {\n\t'is_happy': true,\n\t'full_family_name': 'Carla Smith',\n\tfoo: 123,\n};\n```\n\n@category Change case\n@category Template literal\n*/\nexport type SnakeCase<\n\tValue,\n\tOptions extends WordsOptions = {},\n> = DelimiterCase<Value, '_', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;\n\nexport {};\n"
  },
  {
    "path": "source/snake-cased-properties-deep.d.ts",
    "content": "import type {_DefaultDelimiterCaseOptions} from './delimiter-case.d.ts';\nimport type {DelimiterCasedPropertiesDeep} from './delimiter-cased-properties-deep.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {WordsOptions} from './words.d.ts';\n\n/**\nConvert object properties to snake case recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link SnakeCase}\n@see {@link SnakeCasedProperties}\n\n@example\n```\nimport type {SnakeCasedPropertiesDeep} from 'type-fest';\n\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\n\ntype UserWithFriends = {\n\tuserInfo: User;\n\tuserFriends: User[];\n};\n\nconst result: SnakeCasedPropertiesDeep<UserWithFriends> = {\n\tuser_info: {\n\t\tuser_id: 1,\n\t\tuser_name: 'Tom',\n\t},\n\tuser_friends: [\n\t\t{\n\t\t\tuser_id: 2,\n\t\t\tuser_name: 'Jerry',\n\t\t},\n\t\t{\n\t\t\tuser_id: 3,\n\t\t\tuser_name: 'Spike',\n\t\t},\n\t],\n};\n\nconst splitOnNumbers: SnakeCasedPropertiesDeep<{line1: {line2: [{line3: string}]}}, {splitOnNumbers: true}> = {\n\tline_1: {\n\t\tline_2: [\n\t\t\t{\n\t\t\t\tline_3: 'string',\n\t\t\t},\n\t\t],\n\t},\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type SnakeCasedPropertiesDeep<\n\tValue,\n\tOptions extends WordsOptions = {},\n> = DelimiterCasedPropertiesDeep<Value, '_', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;\n\nexport {};\n"
  },
  {
    "path": "source/snake-cased-properties.d.ts",
    "content": "import type {_DefaultDelimiterCaseOptions} from './delimiter-case.d.ts';\nimport type {DelimiterCasedProperties} from './delimiter-cased-properties.d.ts';\nimport type {ApplyDefaultOptions} from './internal/index.d.ts';\nimport type {WordsOptions} from './words.d.ts';\n\n/**\nConvert object properties to snake case but not recursively.\n\nThis can be useful when, for example, converting some API types from a different style.\n\n@see {@link SnakeCase}\n@see {@link SnakeCasedPropertiesDeep}\n\n@example\n```\nimport type {SnakeCasedProperties} from 'type-fest';\n\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\n\nconst result: SnakeCasedProperties<User> = {\n\tuser_id: 1,\n\tuser_name: 'Tom',\n};\n\nconst splitOnNumbers: SnakeCasedProperties<{line1: string}, {splitOnNumbers: true}> = {\n\t'line_1': 'string',\n};\n```\n\n@category Change case\n@category Template literal\n@category Object\n*/\nexport type SnakeCasedProperties<\n\tValue,\n\tOptions extends WordsOptions = {},\n> = DelimiterCasedProperties<Value, '_', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;\n\nexport {};\n"
  },
  {
    "path": "source/some-extend.d.ts",
    "content": "import type {CollapseRestElement} from './internal/array.d.ts';\nimport type {ApplyDefaultOptions} from './internal/object.d.ts';\nimport type {IfNotAnyOrNever, Not} from './internal/type.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {Or} from './or.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\n@see {@link SomeExtend}\n*/\nexport type SomeExtendOptions = {\n\t/**\n\tConsider `never` elements to match the target type only if the target type itself is `never` (or `any`).\n\n\t- When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).\n\t- When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.\n\n\t@default true\n\n\t@example\n\t```\n\timport type {SomeExtend} from 'type-fest';\n\n\ttype A = SomeExtend<[1, 2, never], string, {strictNever: true}>;\n\t//=> false\n\n\ttype B = SomeExtend<[1, 2, never], string, {strictNever: false}>;\n\t//=> true\n\n\ttype C = SomeExtend<[1, never], never, {strictNever: true}>;\n\t//=> true\n\n\ttype D = SomeExtend<[1, never], never, {strictNever: false}>;\n\t//=> true\n\n\ttype E = SomeExtend<[never], any, {strictNever: true}>;\n\t//=> true\n\n\ttype F = SomeExtend<[never], any, {strictNever: false}>;\n\t//=> true\n\t```\n\t*/\n\tstrictNever?: boolean;\n};\n\ntype DefaultSomeExtendOptions = {\n\tstrictNever: true;\n};\n\n/**\nReturns a boolean for whether some element in an array type extends another type.\n\n@example\n```\nimport type {SomeExtend} from 'type-fest';\n\ntype A = SomeExtend<['1', '2', 3], number>;\n//=> true\n\ntype B = SomeExtend<[1, 2, 3], string>;\n//=> false\n\ntype C = SomeExtend<[string, number | string], number>;\n//=> boolean\n\ntype D = SomeExtend<[true, boolean, true], false>;\n//=> boolean\n```\n\nNote: Behaviour of optional elements depend on the `exactOptionalPropertyTypes` compiler option. When the option is disabled, the target type must include `undefined` for a successful match.\n\n```\n// @exactOptionalPropertyTypes: true\nimport type {SomeExtend} from 'type-fest';\n\ntype A = SomeExtend<[1?, 2?, '3'?], string>;\n//=> true\n```\n\n```\n// @exactOptionalPropertyTypes: false\nimport type {SomeExtend} from 'type-fest';\n\ntype A = SomeExtend<[1?, 2?, '3'?], string>;\n//=> boolean\n\ntype B = SomeExtend<[1?, 2?, '3'?], string | undefined>;\n//=> true\n```\n\n@see {@link SomeExtendOptions}\n\n@category Utilities\n@category Array\n*/\nexport type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> =\n\t_SomeExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<SomeExtendOptions, DefaultSomeExtendOptions, Options>>;\n\ntype _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = IfNotAnyOrNever<TArray,\n\tTArray extends readonly [infer First, ...infer Rest]\n\t\t? IsNever<First> extends true\n\t\t\t? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true\n\t\t\t\t// If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.\n\t\t\t\t? true\n\t\t\t\t: _SomeExtend<Rest, Type, Options>\n\t\t\t: First extends Type\n\t\t\t\t? true\n\t\t\t\t: _SomeExtend<Rest, Type, Options>\n\t\t: false,\n\tfalse, false>;\n\nexport {};\n"
  },
  {
    "path": "source/split-on-rest-element.d.ts",
    "content": "import type {IfNotAnyOrNever, IsExactOptionalPropertyTypesEnabled} from './internal/type.d.ts';\nimport type {ApplyDefaultOptions} from './internal/object.d.ts';\nimport type {IsOptionalKeyOf} from './is-optional-key-of.d.ts';\nimport type {IsArrayReadonly} from './internal/array.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\nimport type {If} from './if.d.ts';\n\n/**\n{@link SplitOnRestElement} options.\n*/\ntype SplitOnRestElementOptions = {\n\t/**\n\tWhether to preserve the optional modifier (`?`).\n\n\t- When set to `true`, the optional modifiers are preserved as-is. For example:\n\t\t`SplitOnRestElement<[number, string?, ...boolean[]], {preserveOptionalModifier: true}>` returns `[[number, string?], boolean[], []]`.\n\n\t- When set to `false`, optional elements like `T?` are transformed to `T | undefined` or simply `T` depending on the `exactOptionalPropertyTypes` compiler option. For example:\n\t\t- With `exactOptionalPropertyTypes` enabled: `SplitOnRestElement<[number, string?, ...boolean[]], {preserveOptionalModifier: false}>` returns `[[number, string], boolean[], []]`\n\t\t- And, with it disabled, the result is: `[[number, string | undefined], boolean[], []]`\n\n\t@default true\n\t*/\n\tpreserveOptionalModifier?: boolean;\n};\n\ntype DefaultSplitOnRestElementOptions = {\n\tpreserveOptionalModifier: true;\n};\n\n/**\nSplits an array into three parts, where the first contains all elements before the rest element, the second is the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element itself, and the third contains all elements after the rest element.\n\nNote: If any of the parts are missing, then they will be represented as empty arrays. For example, `SplitOnRestElement<[string, number]>` returns `[[string, number], [], []]`, where parts corresponding to the rest element and elements after it are empty.\n\nBy default, the optional modifier (`?`) is preserved.\nSee {@link SplitOnRestElementOptions `SplitOnRestElementOptions`}.\n\n@example\n```ts\nimport type {SplitOnRestElement} from 'type-fest';\n\ntype T1 = SplitOnRestElement<[number, ...string[], boolean]>;\n//=> [[number], string[], [boolean]]\n\ntype T2 = SplitOnRestElement<readonly [...boolean[], string]>;\n//=> readonly [[], boolean[], [string]]\n\ntype T3 = SplitOnRestElement<[number, string?]>;\n//=> [[number, string?], [], []]\n\ntype T4 = SplitOnRestElement<[number, string?], {preserveOptionalModifier: false}>;\n//=> [[number, string], [], []]\n\ntype T5 = SplitOnRestElement<readonly [string?, ...number[]], {preserveOptionalModifier: false}>;\n//=> readonly [[string], number[], []]\n```\n\n@see {@link ExtractRestElement}\n@see {@link ExcludeRestElement}\n@category Array\n*/\nexport type SplitOnRestElement<\n\tArray_ extends UnknownArray,\n\tOptions extends SplitOnRestElementOptions = {},\n> =\n\tArray_ extends unknown // For distributing `Array_`\n\t\t? IfNotAnyOrNever<Array_, _SplitOnRestElement<\n\t\t\tArray_,\n\t\t\tApplyDefaultOptions<SplitOnRestElementOptions, DefaultSplitOnRestElementOptions, Options>\n\t\t>> extends infer Result extends UnknownArray\n\t\t\t? If<IsArrayReadonly<Array_>, Readonly<Result>, Result>\n\t\t\t: never // Should never happen\n\t\t: never; // Should never happen\n\n/**\nDeconstructs an array on its rest element and returns the split portions.\n*/\nexport type _SplitOnRestElement<\n\tArray_ extends UnknownArray,\n\tOptions extends Required<SplitOnRestElementOptions>,\n\tHeadAcc extends UnknownArray = [],\n\tTailAcc extends UnknownArray = [],\n> =\n\tkeyof Array_ & `${number}` extends never\n\t\t// Enters this branch, if `Array_` is empty (e.g., []),\n\t\t// or `Array_` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).\n\t\t? Array_ extends readonly [...infer Rest, infer Last]\n\t\t\t? _SplitOnRestElement<Rest, Options, HeadAcc, [Last, ...TailAcc]> // Accumulate elements that are present after the rest element.\n\t\t\t: [HeadAcc, Array_ extends readonly [] ? [] : Array_, TailAcc] // Add the rest element between the accumulated elements.\n\t\t: Array_ extends readonly [(infer First)?, ...infer Rest]\n\t\t\t? _SplitOnRestElement<\n\t\t\t\tRest, Options,\n\t\t\t\t[\n\t\t\t\t\t...HeadAcc,\n\t\t\t\t\t...IsOptionalKeyOf<Array_, '0'> extends true\n\t\t\t\t\t\t? Options['preserveOptionalModifier'] extends false\n\t\t\t\t\t\t\t? [If<IsExactOptionalPropertyTypesEnabled, First, First | undefined>] // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.\n\t\t\t\t\t\t\t: [First?]\n\t\t\t\t\t\t: [First],\n\t\t\t\t],\n\t\t\t\tTailAcc\n\t\t\t> // Accumulate elements that are present before the rest element.\n\t\t\t: never; // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.\n\nexport {};\n"
  },
  {
    "path": "source/split.d.ts",
    "content": "import type {And} from './and.d.ts';\nimport type {ApplyDefaultOptions, Not} from './internal/index.d.ts';\nimport type {IsStringLiteral} from './is-literal.d.ts';\nimport type {Or} from './or.d.ts';\n\n/**\nSplit options.\n\n@see {@link Split}\n*/\nexport type SplitOptions = {\n\t/**\n\tWhen enabled, instantiations with non-literal string types (e.g., `string`, `Uppercase<string>`, `on${string}`) simply return back `string[]` without performing any splitting, as the exact structure cannot be statically determined.\n\n\t@default true\n\n\t@example\n\t```ts\n\timport type {Split} from 'type-fest';\n\n\ttype Example1 = Split<`foo.${string}.bar`, '.', {strictLiteralChecks: false}>;\n\t//=> ['foo', string, 'bar']\n\n\ttype Example2 = Split<`foo.${string}`, '.', {strictLiteralChecks: true}>;\n\t//=> string[]\n\n\ttype Example3 = Split<'foobarbaz', `b${string}`, {strictLiteralChecks: false}>;\n\t//=> ['foo', 'r', 'z']\n\n\ttype Example4 = Split<'foobarbaz', `b${string}`, {strictLiteralChecks: true}>;\n\t//=> string[]\n\t```\n\t*/\n\tstrictLiteralChecks?: boolean;\n};\n\ntype DefaultSplitOptions = {\n\tstrictLiteralChecks: true;\n};\n\n/**\nRepresents an array of strings split using a given character or character set.\n\nUse-case: Defining the return type of a method like `String.prototype.split`.\n\n@example\n```\nimport type {Split} from 'type-fest';\n\ndeclare function split<S extends string, D extends string>(string: S, separator: D): Split<S, D>;\n\ntype Item = 'foo' | 'bar' | 'baz' | 'waldo';\nconst items = 'foo,bar,baz,waldo';\nconst array: Item[] = split(items, ',');\n```\n\n@see {@link SplitOptions}\n\n@category String\n@category Template literal\n*/\nexport type Split<\n\tS extends string,\n\tDelimiter extends string,\n\tOptions extends SplitOptions = {},\n> =\n\tSplitHelper<S, Delimiter, ApplyDefaultOptions<SplitOptions, DefaultSplitOptions, Options>>;\n\ntype SplitHelper<\n\tS extends string,\n\tDelimiter extends string,\n\tOptions extends Required<SplitOptions>,\n\tAccumulator extends string[] = [],\n> = S extends string // For distributing `S`\n\t? Delimiter extends string // For distributing `Delimiter`\n\t\t// If `strictLiteralChecks` is `false` OR `S` and `Delimiter` both are string literals, then perform the split\n\t\t? Or<Not<Options['strictLiteralChecks']>, And<IsStringLiteral<S>, IsStringLiteral<Delimiter>>> extends true\n\t\t\t? S extends `${infer Head}${Delimiter}${infer Tail}`\n\t\t\t\t? SplitHelper<Tail, Delimiter, Options, [...Accumulator, Head]>\n\t\t\t\t: Delimiter extends ''\n\t\t\t\t\t? S extends ''\n\t\t\t\t\t\t? Accumulator\n\t\t\t\t\t\t: [...Accumulator, S]\n\t\t\t\t\t: [...Accumulator, S]\n\t\t\t// Otherwise, return `string[]`\n\t\t\t: string[]\n\t\t: never // Should never happen\n\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/spread.d.ts",
    "content": "import type {RequiredKeysOf} from './required-keys-of.d.ts';\nimport type {Simplify} from './simplify.d.ts';\n\ntype SpreadObject<FirstType extends object, SecondType extends object> = {\n\t[Key in keyof FirstType]: Key extends keyof SecondType\n\t\t? FirstType[Key] | Required<SecondType>[Key]\n\t\t: FirstType[Key];\n} & Pick<\n\tSecondType,\nRequiredKeysOf<SecondType> | Exclude<keyof SecondType, keyof FirstType>\n>;\n\ntype TupleOrArray = readonly [...unknown[]];\n\ntype SpreadTupleOrArray<\n\tFirstType extends TupleOrArray,\n\tSecondType extends TupleOrArray,\n> = Array<FirstType[number] | SecondType[number]>;\n\ntype Spreadable = object | TupleOrArray;\n\n/**\nMimic the type inferred by TypeScript when merging two objects or two arrays/tuples using the spread syntax.\n\n@example\n```\nimport type {Spread} from 'type-fest';\n\ntype Foo = {\n\ta: number;\n\tb?: string;\n};\n\ntype Bar = {\n\tb?: number;\n\tc: boolean;\n};\n\nconst foo = {a: 1, b: '2'};\nconst bar = {c: false};\nconst fooBar = {...foo, ...bar};\n\ntype FooBar = Spread<Foo, Bar>;\n//=> {a: number; b?: string | number; c: boolean}\n\ndeclare function baz(argument: FooBar): void;\n\nbaz(fooBar);\n```\n\n@example\n```\nimport type {Spread} from 'type-fest';\n\nconst foo = [1, 2, 3];\nconst bar = ['4', '5', '6'];\n\nconst fooBar = [...foo, ...bar];\ntype FooBar = Spread<typeof foo, typeof bar>;\n// FooBar = (string | number)[]\n\ndeclare function baz(argument: FooBar): void;\n\nbaz(fooBar);\n```\n\n@category Object\n*/\nexport type Spread<\n\tFirstType extends Spreadable,\n\tSecondType extends Spreadable,\n> = FirstType extends TupleOrArray\n\t? SecondType extends TupleOrArray\n\t\t? SpreadTupleOrArray<FirstType, SecondType>\n\t\t: Simplify<SpreadObject<FirstType, SecondType>>\n\t: Simplify<SpreadObject<FirstType, SecondType>>;\n\nexport {};\n"
  },
  {
    "path": "source/string-repeat.d.ts",
    "content": "import type {IsNumericLiteral} from './is-literal.d.ts';\nimport type {IsNegative} from './numeric.d.ts';\n\n/**\nReturns a new string which contains the specified number of copies of a given string, just like `String#repeat()`.\n\n@example\n```\nimport type {StringRepeat} from 'type-fest';\n\ndeclare function stringRepeat<\n\tInput extends string,\n\tCount extends number,\n>(input: Input, count: Count): StringRepeat<Input, Count>;\n\n// The return type is the exact string literal, not just `string`.\n\nstringRepeat('foo', 2);\n//=> 'foofoo'\n\nstringRepeat('=', 3);\n//=> '==='\n```\n\n@category String\n@category Template literal\n*/\nexport type StringRepeat<\n\tInput extends string,\n\tCount extends number,\n> = StringRepeatHelper<Input, Count>;\n\ntype StringRepeatHelper<\n\tInput extends string,\n\tCount extends number,\n\tCounter extends never[] = [],\n\tAccumulator extends string = '',\n> =\n\tIsNegative<Count> extends true\n\t\t? never\n\t\t: Input extends ''\n\t\t\t? ''\n\t\t\t: Count extends Counter['length']\n\t\t\t\t? Accumulator\n\t\t\t\t: IsNumericLiteral<Count> extends false\n\t\t\t\t\t? string\n\t\t\t\t\t: StringRepeatHelper<Input, Count, [...Counter, never], `${Accumulator}${Input}`>;\n\nexport {};\n"
  },
  {
    "path": "source/string-slice.d.ts",
    "content": "import type {Join} from './join.d.ts';\nimport type {ArraySlice} from './array-slice.d.ts';\nimport type {StringToArray} from './internal/index.d.ts';\n\n/**\nReturns a string slice of a given range, just like `String#slice()`.\n\n@see {ArraySlice}\n\n@example\n```\nimport type {StringSlice} from 'type-fest';\n\ntype A = StringSlice<'abcde', 0, 2>;\n//=> 'ab'\n\ntype B = StringSlice<'abcde', 1>;\n//=> 'bcde'\n\ntype C = StringSlice<'abcde', 0, -1>;\n//=> 'abcd'\n\ntype D = StringSlice<'abcde', -2, -1>;\n//=> 'd'\n```\n\n@category String\n*/\nexport type StringSlice<\n\tS extends string,\n\tStart extends number = never,\n\tEnd extends number = never,\n> = string extends S\n\t? string\n\t: ArraySlice<StringToArray<S>, Start, End> extends infer R extends readonly string[]\n\t\t? Join<R, ''>\n\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/stringified.d.ts",
    "content": "/**\nCreate a type with the keys of the given type changed to `string` type.\n\nUse-case: Changing interface values to strings in order to use them in a form model.\n\n@example\n```\nimport type {Stringified} from 'type-fest';\n\ntype Car = {\n\tmodel: string;\n\tspeed: number;\n};\n\nconst carForm: Stringified<Car> = {\n\tmodel: 'Foo',\n\tspeed: '101',\n};\n```\n\n@category Object\n*/\nexport type Stringified<ObjectType> = {[KeyType in keyof ObjectType]: string};\n\nexport {};\n"
  },
  {
    "path": "source/structured-cloneable.d.ts",
    "content": "import type {TypedArray} from './typed-array.d.ts';\nimport type {FindGlobalInstanceType} from './find-global-type.d.ts';\n\ntype StructuredCloneablePrimitive =\n\t| string\n\t| number\n\t| bigint\n\t| boolean\n\t| null\n\t| undefined\n\t| Boolean\n\t| Number\n\t| String;\n\ntype StructuredCloneableData =\n\t| ArrayBuffer\n\t| DataView\n\t| Date\n\t| Error\n\t| RegExp\n\t| TypedArray\n\t| FindGlobalInstanceType<\n\t// DOM or Node types\n\t\t| 'Blob'\n\t\t| 'File'\n\t// DOM exclusive types\n\t\t| 'AudioData'\n\t\t| 'CropTarget'\n\t\t| 'CryptoKey'\n\t\t| 'DOMException'\n\t\t| 'DOMMatrix'\n\t\t| 'DOMMatrixReadOnly'\n\t\t| 'DOMPoint'\n\t\t| 'DOMPointReadOnly'\n\t\t| 'DOMQuad'\n\t\t| 'DOMRect'\n\t\t| 'DOMRectReadOnly'\n\t\t| 'FileList'\n\t\t| 'FileSystemDirectoryHandle'\n\t\t| 'FileSystemFileHandle'\n\t\t| 'FileSystemHandle'\n\t\t| 'GPUCompilationInfo'\n\t\t| 'GPUCompilationMessage'\n\t\t| 'ImageBitmap'\n\t\t| 'ImageData'\n\t\t| 'RTCCertificate'\n\t\t| 'VideoFrame'\n\t>;\n\ntype StructuredCloneableCollection =\n\t| readonly StructuredCloneable[]\n\t| {readonly [key: string]: StructuredCloneable; readonly [key: number]: StructuredCloneable}\n\t| ReadonlyMap<StructuredCloneable, StructuredCloneable>\n\t| ReadonlySet<StructuredCloneable>;\n\n/**\nMatches a value that can be losslessly cloned using `structuredClone`.\n\nNote:\n- Custom error types will be cloned as the base `Error` type\n\n@see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n@example\n```\nimport type {StructuredCloneable} from 'type-fest';\n\nclass CustomClass {}\n\nconst error = {\n\tcustom: new CustomClass(),\n\t// @ts-expect-error\n} satisfies StructuredCloneable;\n\nconst good = {\n\tnumber: 3,\n\tdate: new Date(),\n\tmap: new Map<string, number>(),\n} satisfies StructuredCloneable;\n\nconst clonedGood = structuredClone(good);\n//=> {number: number; date: Date; map: Map<string, number>}\n```\n\n@category Structured clone\n*/\nexport type StructuredCloneable = StructuredCloneablePrimitive | StructuredCloneableData | StructuredCloneableCollection;\n\nexport {};\n"
  },
  {
    "path": "source/subtract.d.ts",
    "content": "import type {NumberAbsolute, ReverseSign} from './internal/index.d.ts';\nimport type {PositiveInfinity, NegativeInfinity, IsNegative} from './numeric.d.ts';\nimport type {LessThan} from './less-than.d.ts';\nimport type {TupleOf} from './tuple-of.d.ts';\n\n/**\nReturns the difference between two numbers.\n\nNote:\n- A or B can only support `-999` ~ `999`.\n\n@example\n```\nimport type {Subtract, PositiveInfinity} from 'type-fest';\n\ntype A = Subtract<333, 222>;\n//=> 111\n\ntype B = Subtract<111, -222>;\n//=> 333\n\ntype C = Subtract<-111, 222>;\n//=> -333\n\ntype D = Subtract<18, 96>;\n//=> -78\n\ntype E = Subtract<PositiveInfinity, 9999>;\n//=> Infinity\n\ntype F = Subtract<PositiveInfinity, PositiveInfinity>;\n//=> number\n```\n\n@category Numeric\n*/\n// TODO: Support big integer.\nexport type Subtract<A extends number, B extends number> =\n\t// Handle cases when A or B is the actual \"number\" type\n\tnumber extends A | B ? number\n\t\t// Handle cases when A and B are both +/- infinity\n\t\t: A extends B & (PositiveInfinity | NegativeInfinity) ? number\n\t\t\t// Handle cases when A is - infinity or B is + infinity\n\t\t\t: A extends NegativeInfinity ? NegativeInfinity : B extends PositiveInfinity ? NegativeInfinity\n\t\t\t\t// Handle cases when A is + infinity or B is - infinity\n\t\t\t\t: A extends PositiveInfinity ? PositiveInfinity : B extends NegativeInfinity ? PositiveInfinity\n\t\t\t\t\t// Handle case when numbers are equal to each other\n\t\t\t\t\t: A extends B ? 0\n\t\t\t\t\t\t// Handle cases when A or B is 0\n\t\t\t\t\t\t: A extends 0 ? ReverseSign<B> : B extends 0 ? A\n\t\t\t\t\t\t\t// Handle remaining regular cases\n\t\t\t\t\t\t\t: SubtractPostChecks<A, B>;\n\n/**\nSubtracts two numbers A and B, such that they are not equal and neither of them are 0, +/- infinity or the `number` type\n*/\ntype SubtractPostChecks<A extends number, B extends number, AreNegative = [IsNegative<A>, IsNegative<B>]> =\n\tAreNegative extends [false, false]\n\t\t? SubtractPositives<A, B>\n\t\t: AreNegative extends [true, true]\n\t\t\t// When both numbers are negative we subtract the absolute values and then reverse the sign\n\t\t\t? ReverseSign<SubtractPositives<NumberAbsolute<A>, NumberAbsolute<B>>>\n\t\t\t// When the signs are different we can add the absolute values and then reverse the sign if A < B\n\t\t\t: [...TupleOf<NumberAbsolute<A>>, ...TupleOf<NumberAbsolute<B>>] extends infer R extends unknown[]\n\t\t\t\t? LessThan<A, B> extends true ? ReverseSign<R['length']> : R['length']\n\t\t\t\t: never;\n\n/**\nSubtracts two positive numbers.\n*/\ntype SubtractPositives<A extends number, B extends number> =\n\tLessThan<A, B> extends true\n\t\t// When A < B we can reverse the result of B - A\n\t\t? ReverseSign<SubtractIfAGreaterThanB<B, A>>\n\t\t: SubtractIfAGreaterThanB<A, B>;\n\n/**\nSubtracts two positive numbers A and B such that A > B.\n*/\ntype SubtractIfAGreaterThanB<A extends number, B extends number> =\n\t// This is where we always want to end up and do the actual subtraction\n\tTupleOf<A> extends [...TupleOf<B>, ...infer R]\n\t\t? R['length']\n\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/sum.d.ts",
    "content": "import type {TupleOf} from './tuple-of.d.ts';\nimport type {NumberAbsolute, TupleMax, ReverseSign} from './internal/index.d.ts';\nimport type {PositiveInfinity, NegativeInfinity, IsNegative} from './numeric.d.ts';\nimport type {Subtract} from './subtract.d.ts';\n\n/**\nReturns the sum of two numbers.\n\nNote:\n- A or B can only support `-999` ~ `999`.\n\n@example\n```\nimport type {Sum, PositiveInfinity, NegativeInfinity} from 'type-fest';\n\ntype A = Sum<111, 222>;\n//=> 333\n\ntype B = Sum<-111, 222>;\n//=> 111\n\ntype C = Sum<111, -222>;\n//=> -111\n\ntype D = Sum<PositiveInfinity, -9999>;\n//=> Infinity\n\ntype E = Sum<PositiveInfinity, NegativeInfinity>;\n//=> number\n```\n\n@category Numeric\n*/\n// TODO: Support big integer.\nexport type Sum<A extends number, B extends number> =\n\t// Handle cases when A or B is the actual \"number\" type\n\tnumber extends A | B ? number\n\t\t// Handle cases when A and B are both +/- infinity\n\t\t: A extends B & (PositiveInfinity | NegativeInfinity) ? A // A or B could be used here as they are equal\n\t\t\t// Handle cases when A and B are opposite infinities\n\t\t\t: A | B extends PositiveInfinity | NegativeInfinity ? number\n\t\t\t\t// Handle cases when A is +/- infinity\n\t\t\t\t: A extends PositiveInfinity | NegativeInfinity ? A\n\t\t\t\t\t// Handle cases when B is +/- infinity\n\t\t\t\t\t: B extends PositiveInfinity | NegativeInfinity ? B\n\t\t\t\t\t\t// Handle cases when A or B is 0 or it's the same number with different signs\n\t\t\t\t\t\t: A extends 0 ? B : B extends 0 ? A : A extends ReverseSign<B> ? 0\n\t\t\t\t\t\t\t// Handle remaining regular cases\n\t\t\t\t\t\t\t: SumPostChecks<A, B>;\n\n/**\nAdds two numbers A and B, such that they are not equal with different signs and neither of them are 0, +/- infinity or the `number` type\n*/\ntype SumPostChecks<A extends number, B extends number, AreNegative = [IsNegative<A>, IsNegative<B>]> =\n\tAreNegative extends [false, false]\n\t\t// When both numbers are positive we can add them together\n\t\t? SumPositives<A, B>\n\t\t: AreNegative extends [true, true]\n\t\t\t// When both numbers are negative we add the absolute values and then reverse the sign\n\t\t\t? ReverseSign<SumPositives<NumberAbsolute<A>, NumberAbsolute<B>>>\n\t\t\t// When the signs are different we can subtract the absolute values, remove the sign\n\t\t\t// and then reverse the sign if the larger absolute value is negative\n\t\t\t: NumberAbsolute<Subtract<NumberAbsolute<A>, NumberAbsolute<B>>> extends infer Result extends number\n\t\t\t\t? TupleMax<[NumberAbsolute<A>, NumberAbsolute<B>]> extends infer Max_ extends number\n\t\t\t\t\t? Max_ extends A | B\n\t\t\t\t\t\t// The larger absolute value is positive, so the result is positive\n\t\t\t\t\t\t? Result\n\t\t\t\t\t\t// The larger absolute value is negative, so the result is negative\n\t\t\t\t\t\t: ReverseSign<Result>\n\t\t\t\t\t: never\n\t\t\t\t: never;\n\n/**\nAdds two positive numbers.\n*/\ntype SumPositives<A extends number, B extends number> =\n\t[...TupleOf<A>, ...TupleOf<B>]['length'] extends infer Result extends number\n\t\t? Result\n\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/tagged-union.d.ts",
    "content": "/**\nCreate a union of types that share a common discriminant property.\n\nUse-case: A shorter way to declare tagged unions with multiple members.\n\n@example\n```\nimport type {TaggedUnion} from 'type-fest';\n\ntype Tagged<Fields extends Record<string, Record<string, unknown>>> = TaggedUnion<'type', Fields>;\n\n// The TaggedUnion utility reduces the amount of boilerplate needed to create a tagged union with multiple members, making the code more concise.\ntype EventMessage = Tagged<{\n\tOpenExternalUrl: {\n\t\turl: string;\n\t\tid: number;\n\t\tlanguage: string;\n\t};\n\tToggleBackButtonVisibility: {\n\t\tvisible: boolean;\n\t};\n\tPurchaseButtonPressed: {\n\t\tprice: number;\n\t\ttime: Date;\n\t};\n\tNavigationStateChanged: {\n\t\tnavigation?: string;\n\t};\n}>;\n\n// Here is the same type created without this utility.\ntype ManualEventMessage =\n\t| {\n\t\ttype: 'OpenExternalUrl';\n\t\turl: string;\n\t\tid: number;\n\t\tlanguage: string;\n\t}\n\t| {type: 'ToggleBackButtonVisibility'; visible: boolean}\n\t| {type: 'PurchaseButtonPressed'; price: number; time: Date}\n\t| {type: 'NavigationStateChanged'; navigation?: string};\n```\n\n@category Utilities\n*/\nexport type TaggedUnion<\n\tTagKey extends string,\n\tUnionMembers extends Record<string, Record<string, unknown>>,\n> = {\n\t[Name in keyof UnionMembers]: {[Key in TagKey]: Name} & UnionMembers[Name];\n}[keyof UnionMembers];\n\nexport {};\n"
  },
  {
    "path": "source/tagged.d.ts",
    "content": "import type tag from 'tagged-tag';\n\n// eslint-disable-next-line type-fest/require-exported-types\nexport type TagContainer<Token> = {\n\treadonly [tag]: Token;\n};\n\ntype Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{[K in Token]: TagMetadata}>;\n\n/**\nAttach a \"tag\" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for distinct concepts in your program that should not be interchangeable, even if their runtime values have the same type. (See examples.)\n\nA type returned by `Tagged` can be passed to `Tagged` again, to create a type with multiple tags.\n\n[Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)\n\nA tag's name is usually a string (and must be a string, number, or symbol), but each application of a tag can also contain an arbitrary type as its \"metadata\". See {@link GetTagMetadata} for examples and explanation.\n\nA type `A` returned by `Tagged` is assignable to another type `B` returned by `Tagged` if and only if:\n  - the underlying (untagged) type of `A` is assignable to the underlying type of `B`;\n\t- `A` contains at least all the tags `B` has;\n\t- and the metadata type for each of `A`'s tags is assignable to the metadata type of `B`'s corresponding tag.\n\nThere have been several discussions about adding similar features to TypeScript. Unfortunately, nothing has (yet) moved forward:\n\t- [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)\n\t- [Microsoft/TypeScript#4895](https://github.com/microsoft/TypeScript/issues/4895)\n\t- [Microsoft/TypeScript#33290](https://github.com/microsoft/TypeScript/pull/33290)\n\n@example\n```\nimport type {Tagged} from 'type-fest';\n\ntype AccountNumber = Tagged<number, 'AccountNumber'>;\ntype AccountBalance = Tagged<number, 'AccountBalance'>;\n\nfunction createAccountNumber(): AccountNumber {\n\t// As you can see, casting from a `number` (the underlying type being tagged) is allowed.\n\treturn 2 as AccountNumber;\n}\n\ndeclare function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance;\n\n// This will compile successfully.\ngetMoneyForAccount(createAccountNumber());\n\n// But this won't, because it has to be explicitly passed as an `AccountNumber` type!\n// Critically, you could not accidentally use an `AccountBalance` as an `AccountNumber`.\n// @ts-expect-error\ngetMoneyForAccount(2);\n\n// You can also use tagged values like their underlying, untagged type.\n// I.e., this will compile successfully because an `AccountNumber` can be used as a regular `number`.\n// In this sense, the underlying base type is not hidden, which differentiates tagged types from opaque types in other languages.\nconst accountNumber = createAccountNumber() + 2;\n```\n\n@example\n```\nimport type {Tagged} from 'type-fest';\n\n// You can apply multiple tags to a type by using `Tagged` repeatedly.\ntype Url = Tagged<string, 'URL'>;\ntype SpecialCacheKey = Tagged<Url, 'SpecialCacheKey'>;\n\n// You can also pass a union of tag names, so this is equivalent to the above, although it doesn't give you the ability to assign distinct metadata to each tag.\ntype SpecialCacheKey2 = Tagged<string, 'URL' | 'SpecialCacheKey'>;\n```\n\n@category Type\n*/\nexport type Tagged<Type, TagName extends PropertyKey, TagMetadata = never> = Type & Tag<TagName, TagMetadata>;\n\n/**\nGiven a type and a tag name, returns the metadata associated with that tag on that type.\n\nIn the example below, one could use `Tagged<string, 'JSON'>` to represent \"a string that is valid JSON\". That type might be useful -- for instance, it communicates that the value can be safely passed to `JSON.parse` without it throwing an exception. However, it doesn't indicate what type of value will be produced on parse (which is sometimes known). `JsonOf<T>` solves this; it represents \"a string that is valid JSON and that, if parsed, would produce a value of type T\". The type T is held in the metadata associated with the `'JSON'` tag.\n\nThis article explains more about [how tag metadata works and when it can be useful](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf).\n\n@example\n```\nimport type {Tagged, GetTagMetadata} from 'type-fest';\n\ntype JsonOf<T> = Tagged<string, 'JSON', T>;\n\nfunction stringify<T>(it: T) {\n\treturn JSON.stringify(it) as JsonOf<T>;\n}\n\nfunction parse<T extends JsonOf<unknown>>(it: T) {\n\treturn JSON.parse(it) as GetTagMetadata<T, 'JSON'>;\n}\n\nconst x = stringify({hello: 'world'});\nconst parsed = parse(x); // The type of `parsed` is { hello: string }\n```\n\n@category Type\n*/\nexport type GetTagMetadata<Type extends Tag<TagName, unknown>, TagName extends PropertyKey> = Type[typeof tag][TagName];\n\n/**\nRevert a tagged type back to its original type by removing all tags.\n\nWhy is this necessary?\n\n1. Use a `Tagged` type as object keys\n2. Prevent TS4058 error: \"Return type of exported function has or is using name X from external module Y but cannot be named\"\n\n@example\n```\nimport type {Tagged, UnwrapTagged} from 'type-fest';\n\ntype AccountType = Tagged<'SAVINGS' | 'CHECKING', 'AccountType'>;\n\nconst moneyByAccountType: Record<UnwrapTagged<AccountType>, number> = {\n\tSAVINGS: 99,\n\tCHECKING: 0.1,\n};\n\n// Without UnwrapTagged, the following expression would throw a type error.\nconst money = moneyByAccountType.SAVINGS; // TS error: Property 'SAVINGS' does not exist\n\n// Attempting to pass a non-Tagged type to UnwrapTagged will raise a type error.\n// @ts-expect-error\ntype WontWork = UnwrapTagged<string>;\n```\n\n@category Type\n*/\nexport type UnwrapTagged<TaggedType extends Tag<PropertyKey, any>> =\nRemoveAllTags<TaggedType>;\n\ntype RemoveAllTags<T> = T extends Tag<PropertyKey, any>\n\t? {\n\t\t[ThisTag in keyof T[typeof tag]]: T extends Tagged<infer Type, ThisTag, T[typeof tag][ThisTag]>\n\t\t\t? RemoveAllTags<Type>\n\t\t\t: never\n\t}[keyof T[typeof tag]]\n\t: T;\n\n/**\nNote: The `Opaque` type is deprecated in favor of `Tagged`.\n\nAttach a \"tag\" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for runtime values that would otherwise have the same type. (See examples.)\n\nThe generic type parameters can be anything.\n\nNote that `Opaque` is somewhat of a misnomer here, in that, unlike [some alternative implementations](https://github.com/microsoft/TypeScript/issues/4895#issuecomment-425132582), the original, untagged type is not actually hidden. (E.g., functions that accept the untagged type can still be called with the \"opaque\" version -- but not vice-versa.)\n\nAlso note that this implementation is limited to a single tag. If you want to allow multiple tags, use `Tagged` instead.\n\n[Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)\n\nThere have been several discussions about adding similar features to TypeScript. Unfortunately, nothing has (yet) moved forward:\n\t- [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)\n\t- [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408)\n\t- [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807)\n\n@example\n```\nimport type {Opaque} from 'type-fest';\n\ntype AccountNumber = Opaque<number, 'AccountNumber'>;\ntype AccountBalance = Opaque<number, 'AccountBalance'>;\n\n// The `Token` parameter allows the compiler to differentiate between types, whereas \"unknown\" will not. For example, consider the following structures:\ntype ThingOne = Opaque<string>;\ntype ThingTwo = Opaque<string>;\n\n// To the compiler, these types are allowed to be cast to each other as they have the same underlying type. They are both `string & { __opaque__: unknown }`.\n// To avoid this behaviour, you would instead pass the \"Token\" parameter, like so.\ntype NewThingOne = Opaque<string, 'ThingOne'>;\ntype NewThingTwo = Opaque<string, 'ThingTwo'>;\n\n// Now they're completely separate types, so the following will fail to compile.\nfunction createNewThingOne(): NewThingOne {\n\t// As you can see, casting from a string is still allowed. However, you may not cast NewThingOne to NewThingTwo, and vice versa.\n\treturn 'new thing one' as NewThingOne;\n}\n\n// This will fail to compile, as they are fundamentally different types.\n// @ts-expect-error\nconst thingTwo = createNewThingOne() as NewThingTwo;\n\n// Here's another example of opaque typing.\nfunction createAccountNumber(): AccountNumber {\n\treturn 2 as AccountNumber;\n}\n\ndeclare function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance;\n\n// This will compile successfully.\ngetMoneyForAccount(createAccountNumber());\n\n// But this won't, because it has to be explicitly passed as an `AccountNumber` type.\n// @ts-expect-error\ngetMoneyForAccount(2);\n\n// You can use opaque values like they aren't opaque too.\nconst accountNumber = createAccountNumber();\n\n// This will compile successfully.\nconst newAccountNumber = accountNumber + 2;\n\n// As a side note, you can (and should) use recursive types for your opaque types to make them stronger and hopefully easier to type.\ntype Person = {\n\tid: Opaque<number, Person>;\n\tname: string;\n};\n```\n\n@category Type\n@deprecated Use {@link Tagged} instead\n*/\nexport type Opaque<Type, Token = unknown> = Type & TagContainer<Token>;\n\n/**\nNote: The `UnwrapOpaque` type is deprecated in favor of `UnwrapTagged`.\n\nRevert an opaque or tagged type back to its original type by removing the readonly `[tag]`.\n\nWhy is this necessary?\n\n1. Use an `Opaque` type as object keys\n2. Prevent TS4058 error: \"Return type of exported function has or is using name X from external module Y but cannot be named\"\n\n@example\n```\nimport type {Opaque, UnwrapOpaque} from 'type-fest';\n\ntype AccountType = Opaque<'SAVINGS' | 'CHECKING', 'AccountType'>;\n\nconst moneyByAccountType: Record<UnwrapOpaque<AccountType>, number> = {\n\tSAVINGS: 99,\n\tCHECKING: 0.1,\n};\n\n// Without UnwrapOpaque, the following expression would throw a type error.\nconst money = moneyByAccountType.SAVINGS; // TS error: Property 'SAVINGS' does not exist\n\n// Attempting to pass a non-Opaque type to UnwrapOpaque will raise a type error.\n// @ts-expect-error\ntype WontWork = UnwrapOpaque<string>;\n\n// Using a Tagged type will work too.\n// @ts-expect-error\ntype WillWork = UnwrapOpaque<Tagged<number, 'AccountNumber'>>; // number\n```\n\n@category Type\n@deprecated Use {@link UnwrapTagged} instead\n*/\nexport type UnwrapOpaque<OpaqueType extends TagContainer<unknown>> =\n\tOpaqueType extends Tag<PropertyKey, any>\n\t\t? RemoveAllTags<OpaqueType>\n\t\t: OpaqueType extends Opaque<infer Type, OpaqueType[typeof tag]>\n\t\t\t? Type\n\t\t\t: OpaqueType;\n\nexport {type default as tag} from 'tagged-tag';\n\nexport {};\n"
  },
  {
    "path": "source/trim.d.ts",
    "content": "import type {Whitespace} from './internal/index.d.ts';\n\n/**\nRemove spaces from the left side.\n*/\ntype TrimLeft<V extends string> = V extends `${Whitespace}${infer R}` ? TrimLeft<R> : V;\n\n/**\nRemove spaces from the right side.\n*/\ntype TrimRight<V extends string> = V extends `${infer R}${Whitespace}` ? TrimRight<R> : V;\n\n/**\nRemove leading and trailing spaces from a string.\n\n@example\n```\nimport type {Trim} from 'type-fest';\n\ntype Example = Trim<' foo '>;\n//=> 'foo'\n```\n\n@category String\n@category Template literal\n*/\nexport type Trim<V extends string> = TrimLeft<TrimRight<V>>;\n\nexport {};\n"
  },
  {
    "path": "source/tsconfig-json.d.ts",
    "content": "export namespace TsConfigJson {\n\tnamespace CompilerOptions {\n\t\ttype JSX =\n\t\t\t| 'preserve'\n\t\t\t| 'react'\n\t\t\t| 'react-jsx'\n\t\t\t| 'react-jsxdev'\n\t\t\t| 'react-native';\n\n\t\ttype Module =\n\t\t\t| 'CommonJS'\n\t\t\t| 'AMD'\n\t\t\t| 'System'\n\t\t\t| 'UMD'\n\t\t\t| 'ES6'\n\t\t\t| 'ES2015'\n\t\t\t| 'ES2020'\n\t\t\t| 'ES2022'\n\t\t\t| 'ESNext'\n\t\t\t| 'Node16'\n\t\t\t| 'Node18'\n\t\t\t| 'Node20'\n\t\t\t| 'NodeNext'\n\t\t\t| 'Preserve'\n\t\t\t| 'None'\n\t\t\t// Lowercase alternatives\n\t\t\t| 'commonjs'\n\t\t\t| 'amd'\n\t\t\t| 'system'\n\t\t\t| 'umd'\n\t\t\t| 'es6'\n\t\t\t| 'es2015'\n\t\t\t| 'es2020'\n\t\t\t| 'es2022'\n\t\t\t| 'esnext'\n\t\t\t| 'node16'\n\t\t\t| 'node18'\n\t\t\t| 'node20'\n\t\t\t| 'nodenext'\n\t\t\t| 'preserve'\n\t\t\t| 'none';\n\n\t\ttype NewLine =\n\t\t\t| 'CRLF'\n\t\t\t| 'LF'\n\t\t\t// Lowercase alternatives\n\t\t\t| 'crlf'\n\t\t\t| 'lf';\n\n\t\ttype Target =\n\t\t\t| 'ES3'\n\t\t\t| 'ES5'\n\t\t\t| 'ES6'\n\t\t\t| 'ES2015'\n\t\t\t| 'ES2016'\n\t\t\t| 'ES2017'\n\t\t\t| 'ES2018'\n\t\t\t| 'ES2019'\n\t\t\t| 'ES2020'\n\t\t\t| 'ES2021'\n\t\t\t| 'ES2022'\n\t\t\t| 'ES2023'\n\t\t\t| 'ES2024'\n\t\t\t| 'ESNext'\n\t\t\t// Lowercase alternatives\n\t\t\t| 'es3'\n\t\t\t| 'es5'\n\t\t\t| 'es6'\n\t\t\t| 'es2015'\n\t\t\t| 'es2016'\n\t\t\t| 'es2017'\n\t\t\t| 'es2018'\n\t\t\t| 'es2019'\n\t\t\t| 'es2020'\n\t\t\t| 'es2021'\n\t\t\t| 'es2022'\n\t\t\t| 'es2023'\n\t\t\t| 'es2024'\n\t\t\t| 'esnext';\n\n\t\ttype Lib =\n\t\t\t| 'ES5'\n\t\t\t| 'ES6'\n\t\t\t| 'ES7'\n\t\t\t| 'ES2015'\n\t\t\t| 'ES2015.Collection'\n\t\t\t| 'ES2015.Core'\n\t\t\t| 'ES2015.Generator'\n\t\t\t| 'ES2015.Iterable'\n\t\t\t| 'ES2015.Promise'\n\t\t\t| 'ES2015.Proxy'\n\t\t\t| 'ES2015.Reflect'\n\t\t\t| 'ES2015.Symbol.WellKnown'\n\t\t\t| 'ES2015.Symbol'\n\t\t\t| 'ES2016'\n\t\t\t| 'ES2016.Array.Include'\n\t\t\t| 'ES2017'\n\t\t\t| 'ES2017.ArrayBuffer'\n\t\t\t| 'ES2017.Date'\n\t\t\t| 'ES2017.Intl'\n\t\t\t| 'ES2017.Object'\n\t\t\t| 'ES2017.SharedMemory'\n\t\t\t| 'ES2017.String'\n\t\t\t| 'ES2017.TypedArrays'\n\t\t\t| 'ES2018'\n\t\t\t| 'ES2018.AsyncGenerator'\n\t\t\t| 'ES2018.AsyncIterable'\n\t\t\t| 'ES2018.Intl'\n\t\t\t| 'ES2018.Promise'\n\t\t\t| 'ES2018.Regexp'\n\t\t\t| 'ES2019'\n\t\t\t| 'ES2019.Array'\n\t\t\t| 'ES2019.Intl'\n\t\t\t| 'ES2019.Object'\n\t\t\t| 'ES2019.String'\n\t\t\t| 'ES2019.Symbol'\n\t\t\t| 'ES2020'\n\t\t\t| 'ES2020.BigInt'\n\t\t\t| 'ES2020.Date'\n\t\t\t| 'ES2020.Intl'\n\t\t\t| 'ES2020.Number'\n\t\t\t| 'ES2020.Promise'\n\t\t\t| 'ES2020.SharedMemory'\n\t\t\t| 'ES2020.String'\n\t\t\t| 'ES2020.Symbol.WellKnown'\n\t\t\t| 'ES2021'\n\t\t\t| 'ES2021.Intl'\n\t\t\t| 'ES2021.Promise'\n\t\t\t| 'ES2021.String'\n\t\t\t| 'ES2021.WeakRef'\n\t\t\t| 'ES2022'\n\t\t\t| 'ES2022.Array'\n\t\t\t| 'ES2022.Error'\n\t\t\t| 'ES2022.Intl'\n\t\t\t| 'ES2022.Object'\n\t\t\t| 'ES2022.RegExp'\n\t\t\t| 'ES2022.SharedMemory'\n\t\t\t| 'ES2022.String'\n\t\t\t| 'ES2023'\n\t\t\t| 'ES2023.Array'\n\t\t\t| 'ES2023.Collection'\n\t\t\t| 'ES2023.Intl'\n\t\t\t| 'ES2024'\n\t\t\t| 'ES2024.ArrayBuffer'\n\t\t\t| 'ES2024.Collection'\n\t\t\t| 'ES2024.Object'\n\t\t\t| 'ES2024.Promise'\n\t\t\t| 'ES2024.Regexp'\n\t\t\t| 'ES2024.SharedMemory'\n\t\t\t| 'ES2024.String'\n\t\t\t| 'ESNext'\n\t\t\t| 'ESNext.Array'\n\t\t\t| 'ESNext.AsyncIterable'\n\t\t\t| 'ESNext.BigInt'\n\t\t\t| 'ESNext.Collection'\n\t\t\t| 'ESNext.Decorators'\n\t\t\t| 'ESNext.Disposable'\n\t\t\t| 'ESNext.Error'\n\t\t\t| 'ESNext.Intl'\n\t\t\t| 'ESNext.Iterator'\n\t\t\t| 'ESNext.Object'\n\t\t\t| 'ESNext.Promise'\n\t\t\t| 'ESNext.Regexp'\n\t\t\t| 'ESNext.String'\n\t\t\t| 'ESNext.Symbol'\n\t\t\t| 'ESNext.WeakRef'\n\t\t\t| 'DOM'\n\t\t\t| 'DOM.AsyncIterable'\n\t\t\t| 'DOM.Iterable'\n\t\t\t| 'Decorators'\n\t\t\t| 'Decorators.Legacy'\n\t\t\t| 'ScriptHost'\n\t\t\t| 'WebWorker'\n\t\t\t| 'WebWorker.AsyncIterable'\n\t\t\t| 'WebWorker.ImportScripts'\n\t\t\t| 'WebWorker.Iterable'\n\t\t\t// Lowercase alternatives\n\t\t\t| 'es5'\n\t\t\t| 'es6'\n\t\t\t| 'es7'\n\t\t\t| 'es2015'\n\t\t\t| 'es2015.collection'\n\t\t\t| 'es2015.core'\n\t\t\t| 'es2015.generator'\n\t\t\t| 'es2015.iterable'\n\t\t\t| 'es2015.promise'\n\t\t\t| 'es2015.proxy'\n\t\t\t| 'es2015.reflect'\n\t\t\t| 'es2015.symbol.wellknown'\n\t\t\t| 'es2015.symbol'\n\t\t\t| 'es2016'\n\t\t\t| 'es2016.array.include'\n\t\t\t| 'es2017'\n\t\t\t| 'es2017.arraybuffer'\n\t\t\t| 'es2017.date'\n\t\t\t| 'es2017.intl'\n\t\t\t| 'es2017.object'\n\t\t\t| 'es2017.sharedmemory'\n\t\t\t| 'es2017.string'\n\t\t\t| 'es2017.typedarrays'\n\t\t\t| 'es2018'\n\t\t\t| 'es2018.asyncgenerator'\n\t\t\t| 'es2018.asynciterable'\n\t\t\t| 'es2018.intl'\n\t\t\t| 'es2018.promise'\n\t\t\t| 'es2018.regexp'\n\t\t\t| 'es2019'\n\t\t\t| 'es2019.array'\n\t\t\t| 'es2019.intl'\n\t\t\t| 'es2019.object'\n\t\t\t| 'es2019.string'\n\t\t\t| 'es2019.symbol'\n\t\t\t| 'es2020'\n\t\t\t| 'es2020.bigint'\n\t\t\t| 'es2020.date'\n\t\t\t| 'es2020.intl'\n\t\t\t| 'es2020.number'\n\t\t\t| 'es2020.promise'\n\t\t\t| 'es2020.sharedmemory'\n\t\t\t| 'es2020.string'\n\t\t\t| 'es2020.symbol.wellknown'\n\t\t\t| 'es2021'\n\t\t\t| 'es2021.intl'\n\t\t\t| 'es2021.promise'\n\t\t\t| 'es2021.string'\n\t\t\t| 'es2021.weakref'\n\t\t\t| 'es2022'\n\t\t\t| 'es2022.array'\n\t\t\t| 'es2022.error'\n\t\t\t| 'es2022.intl'\n\t\t\t| 'es2022.object'\n\t\t\t| 'es2022.regexp'\n\t\t\t| 'es2022.sharedmemory'\n\t\t\t| 'es2022.string'\n\t\t\t| 'es2023'\n\t\t\t| 'es2023.array'\n\t\t\t| 'es2023.collection'\n\t\t\t| 'es2023.intl'\n\t\t\t| 'es2024'\n\t\t\t| 'es2024.arraybuffer'\n\t\t\t| 'es2024.collection'\n\t\t\t| 'es2024.object'\n\t\t\t| 'es2024.promise'\n\t\t\t| 'es2024.regexp'\n\t\t\t| 'es2024.sharedmemory'\n\t\t\t| 'es2024.string'\n\t\t\t| 'esnext'\n\t\t\t| 'esnext.array'\n\t\t\t| 'esnext.asynciterable'\n\t\t\t| 'esnext.bigint'\n\t\t\t| 'esnext.collection'\n\t\t\t| 'esnext.decorators'\n\t\t\t| 'esnext.disposable'\n\t\t\t| 'esnext.error'\n\t\t\t| 'esnext.intl'\n\t\t\t| 'esnext.iterator'\n\t\t\t| 'esnext.object'\n\t\t\t| 'esnext.promise'\n\t\t\t| 'esnext.regexp'\n\t\t\t| 'esnext.string'\n\t\t\t| 'esnext.symbol'\n\t\t\t| 'esnext.weakref'\n\t\t\t| 'dom'\n\t\t\t| 'dom.asynciterable'\n\t\t\t| 'dom.iterable'\n\t\t\t| 'decorators'\n\t\t\t| 'decorators.legacy'\n\t\t\t| 'scripthost'\n\t\t\t| 'webworker'\n\t\t\t| 'webworker.asynciterable'\n\t\t\t| 'webworker.importscripts'\n\t\t\t| 'webworker.iterable';\n\n\t\ttype Plugin = {\n\t\t\t/**\n\t\t\tPlugin name.\n\t\t\t*/\n\t\t\tname: string;\n\t\t};\n\n\t\ttype ImportsNotUsedAsValues =\n\t\t\t| 'remove'\n\t\t\t| 'preserve'\n\t\t\t| 'error';\n\n\t\ttype FallbackPolling =\n\t\t\t| 'fixedPollingInterval'\n\t\t\t| 'priorityPollingInterval'\n\t\t\t| 'dynamicPriorityPolling'\n\t\t\t| 'fixedInterval'\n\t\t\t| 'priorityInterval'\n\t\t\t| 'dynamicPriority'\n\t\t\t| 'fixedChunkSize';\n\n\t\ttype WatchDirectory =\n\t\t\t| 'useFsEvents'\n\t\t\t| 'fixedPollingInterval'\n\t\t\t| 'dynamicPriorityPolling'\n\t\t\t| 'fixedChunkSizePolling';\n\n\t\ttype WatchFile =\n\t\t\t| 'fixedPollingInterval'\n\t\t\t| 'priorityPollingInterval'\n\t\t\t| 'dynamicPriorityPolling'\n\t\t\t| 'useFsEvents'\n\t\t\t| 'useFsEventsOnParentDirectory'\n\t\t\t| 'fixedChunkSizePolling';\n\n\t\ttype ModuleResolution =\n\t\t\t| 'classic'\n\t\t\t| 'node'\n\t\t\t| 'node10'\n\t\t\t| 'node16'\n\t\t\t| 'nodenext'\n\t\t\t| 'bundler'\n\t\t\t// Pascal-cased alternatives\n\t\t\t| 'Classic'\n\t\t\t| 'Node'\n\t\t\t| 'Node10'\n\t\t\t| 'Node16'\n\t\t\t| 'NodeNext'\n\t\t\t| 'Bundler';\n\n\t\ttype ModuleDetection =\n\t\t\t| 'auto'\n\t\t\t| 'legacy'\n\t\t\t| 'force';\n\n\t\ttype IgnoreDeprecations = '5.0';\n\t}\n\n\ttype CompilerOptions = {\n\t\t/**\n\t\tThe character set of the input files.\n\n\t\t@default 'utf8'\n\t\t@deprecated This option will be removed in TypeScript 5.5.\n\t\t*/\n\t\tcharset?: string;\n\n\t\t/**\n\t\tEnables building for project references.\n\n\t\t@default true\n\t\t*/\n\t\tcomposite?: boolean;\n\n\t\t/**\n\t\tGenerates corresponding d.ts files.\n\n\t\t@default false\n\t\t*/\n\t\tdeclaration?: boolean;\n\n\t\t/**\n\t\tSpecify output directory for generated declaration files.\n\t\t*/\n\t\tdeclarationDir?: string;\n\n\t\t/**\n\t\tShow diagnostic information.\n\n\t\t@default false\n\t\t*/\n\t\tdiagnostics?: boolean;\n\n\t\t/**\n\t\tReduce the number of projects loaded automatically by TypeScript.\n\n\t\t@default false\n\t\t*/\n\t\tdisableReferencedProjectLoad?: boolean;\n\n\t\t/**\n\t\tEnforces using indexed accessors for keys declared using an indexed type.\n\n\t\t@default false\n\t\t*/\n\t\tnoPropertyAccessFromIndexSignature?: boolean;\n\n\t\t/**\n\t\tEmit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.\n\n\t\t@default false\n\t\t*/\n\t\temitBOM?: boolean;\n\n\t\t/**\n\t\tOnly emit `.d.ts` declaration files.\n\n\t\t@default false\n\t\t*/\n\t\temitDeclarationOnly?: boolean;\n\n\t\t/**\n\t\tDifferentiate between undefined and not present when type checking.\n\n\t\t@default false\n\t\t*/\n\t\texactOptionalPropertyTypes?: boolean;\n\n\t\t/**\n\t\tEnable incremental compilation.\n\n\t\t@default `composite`\n\t\t*/\n\t\tincremental?: boolean;\n\n\t\t/**\n\t\tSpecify file to store incremental compilation information.\n\n\t\t@default '.tsbuildinfo'\n\t\t*/\n\t\ttsBuildInfoFile?: string;\n\n\t\t/**\n\t\tEmit a single file with source maps instead of having a separate file.\n\n\t\t@default false\n\t\t*/\n\t\tinlineSourceMap?: boolean;\n\n\t\t/**\n\t\tEmit the source alongside the sourcemaps within a single file.\n\n\t\tRequires `--inlineSourceMap` to be set.\n\n\t\t@default false\n\t\t*/\n\t\tinlineSources?: boolean;\n\n\t\t/**\n\t\tSpecify what JSX code is generated.\n\n\t\t@default 'preserve'\n\t\t*/\n\t\tjsx?: CompilerOptions.JSX;\n\n\t\t/**\n\t\tSpecifies the object invoked for `createElement` and `__spread` when targeting `'react'` JSX emit.\n\n\t\t@default 'React'\n\t\t*/\n\t\treactNamespace?: string;\n\n\t\t/**\n\t\tSpecify the JSX factory function to use when targeting React JSX emit, e.g. `React.createElement` or `h`.\n\n\t\t@default 'React.createElement'\n\t\t*/\n\t\tjsxFactory?: string;\n\n\t\t/**\n\t\tSpecify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.\n\n\t\t@default 'React.Fragment'\n\t\t*/\n\t\tjsxFragmentFactory?: string;\n\n\t\t/**\n\t\tSpecify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.\n\n\t\t@default 'react'\n\t\t*/\n\t\tjsxImportSource?: string;\n\n\t\t/**\n\t\tPrint names of files part of the compilation.\n\n\t\t@default false\n\t\t*/\n\t\tlistFiles?: boolean;\n\n\t\t/**\n\t\tSpecifies the location where debugger should locate map files instead of generated locations.\n\t\t*/\n\t\tmapRoot?: string;\n\n\t\t/**\n\t\tSpecify module code generation: 'None', 'CommonJS', 'AMD', 'System', 'UMD', 'ES6', 'ES2015' or 'ESNext'. Only 'AMD' and 'System' can be used in conjunction with `--outFile`. 'ES6' and 'ES2015' values may be used when targeting 'ES5' or lower.\n\n\t\t@default ['ES3', 'ES5'].includes(target) ? 'CommonJS' : 'ES6'\n\t\t*/\n\t\tmodule?: CompilerOptions.Module;\n\n\t\t/**\n\t\tSpecifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6).\n\n\t\t@default ['AMD', 'System', 'ES6'].includes(module) ? 'classic' : 'node'\n\t\t*/\n\t\tmoduleResolution?: CompilerOptions.ModuleResolution;\n\n\t\t/**\n\t\tSpecifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix).\n\n\t\t@default 'LF'\n\t\t*/\n\t\tnewLine?: CompilerOptions.NewLine;\n\n\t\t/**\n\t\tDisable full type checking (only critical parse and emit errors will be reported).\n\n\t\t@default false\n\t\t*/\n\t\tnoCheck?: boolean;\n\n\t\t/**\n\t\tDo not emit output.\n\n\t\t@default false\n\t\t*/\n\t\tnoEmit?: boolean;\n\n\t\t/**\n\t\tDo not generate custom helper functions like `__extends` in compiled output.\n\n\t\t@default false\n\t\t*/\n\t\tnoEmitHelpers?: boolean;\n\n\t\t/**\n\t\tDo not emit outputs if any type checking errors were reported.\n\n\t\t@default false\n\t\t*/\n\t\tnoEmitOnError?: boolean;\n\n\t\t/**\n\t\tWarn on expressions and declarations with an implied 'any' type.\n\n\t\t@default false\n\t\t*/\n\t\tnoImplicitAny?: boolean;\n\n\t\t/**\n\t\tRaise error on 'this' expressions with an implied any type.\n\n\t\t@default false\n\t\t*/\n\t\tnoImplicitThis?: boolean;\n\n\t\t/**\n\t\tReport errors on unused locals.\n\n\t\t@default false\n\t\t*/\n\t\tnoUnusedLocals?: boolean;\n\n\t\t/**\n\t\tReport errors on unused parameters.\n\n\t\t@default false\n\t\t*/\n\t\tnoUnusedParameters?: boolean;\n\n\t\t/**\n\t\tDo not include the default library file (lib.d.ts).\n\n\t\t@default false\n\t\t*/\n\t\tnoLib?: boolean;\n\n\t\t/**\n\t\tDo not add triple-slash references or module import targets to the list of compiled files.\n\n\t\t@default false\n\t\t*/\n\t\tnoResolve?: boolean;\n\n\t\t/**\n\t\tDisable strict checking of generic signatures in function types.\n\n\t\t@default false\n\t\t@deprecated This option will be removed in TypeScript 5.5.\n\t\t*/\n\t\tnoStrictGenericChecks?: boolean;\n\n\t\t/**\n\t\t@deprecated use `skipLibCheck` instead.\n\t\t*/\n\t\tskipDefaultLibCheck?: boolean;\n\n\t\t/**\n\t\tSkip type checking of declaration files.\n\n\t\t@default false\n\t\t*/\n\t\tskipLibCheck?: boolean;\n\n\t\t/**\n\t\tConcatenate and emit output to single file.\n\t\t*/\n\t\toutFile?: string;\n\n\t\t/**\n\t\tRedirect output structure to the directory.\n\t\t*/\n\t\toutDir?: string;\n\n\t\t/**\n\t\tDo not erase const enum declarations in generated code.\n\n\t\t@default false\n\t\t*/\n\t\tpreserveConstEnums?: boolean;\n\n\t\t/**\n\t\tDo not resolve symlinks to their real path; treat a symlinked file like a real one.\n\n\t\t@default false\n\t\t*/\n\t\tpreserveSymlinks?: boolean;\n\n\t\t/**\n\t\tKeep outdated console output in watch mode instead of clearing the screen.\n\n\t\t@default false\n\t\t*/\n\t\tpreserveWatchOutput?: boolean;\n\n\t\t/**\n\t\tStylize errors and messages using color and context (experimental).\n\n\t\t@default true // Unless piping to another program or redirecting output to a file.\n\t\t*/\n\t\tpretty?: boolean;\n\n\t\t/**\n\t\tDo not emit comments to output.\n\n\t\t@default false\n\t\t*/\n\t\tremoveComments?: boolean;\n\n\t\t/**\n\t\tRewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files.\n\n\t\t@default false\n\t\t*/\n\t\trewriteRelativeImportExtensions?: boolean;\n\n\t\t/**\n\t\tSpecifies the root directory of input files.\n\n\t\tUse to control the output directory structure with `--outDir`.\n\t\t*/\n\t\trootDir?: string;\n\n\t\t/**\n\t\tUnconditionally emit imports for unresolved files.\n\n\t\t@default false\n\t\t*/\n\t\tisolatedModules?: boolean;\n\n\t\t/**\n\t\tRequire sufficient annotation on exports so other tools can trivially generate declaration files.\n\n\t\t@default false\n\t\t*/\n\t\tisolatedDeclarations?: boolean;\n\n\t\t/**\n\t\tGenerates corresponding '.map' file.\n\n\t\t@default false\n\t\t*/\n\t\tsourceMap?: boolean;\n\n\t\t/**\n\t\tSpecifies the location where debugger should locate TypeScript files instead of source locations.\n\t\t*/\n\t\tsourceRoot?: string;\n\n\t\t/**\n\t\tSuppress excess property checks for object literals.\n\n\t\t@default false\n\t\t@deprecated This option will be removed in TypeScript 5.5.\n\t\t*/\n\t\tsuppressExcessPropertyErrors?: boolean;\n\n\t\t/**\n\t\tSuppress noImplicitAny errors for indexing objects lacking index signatures.\n\n\t\t@default false\n\t\t@deprecated This option will be removed in TypeScript 5.5.\n\t\t*/\n\t\tsuppressImplicitAnyIndexErrors?: boolean;\n\n\t\t/**\n\t\tDo not emit declarations for code that has an `@internal` annotation.\n\t\t*/\n\t\tstripInternal?: boolean;\n\n\t\t/**\n\t\tSpecify ECMAScript target version.\n\n\t\t@default 'es3'\n\t\t*/\n\t\ttarget?: CompilerOptions.Target;\n\n\t\t/**\n\t\tDefault catch clause variables as `unknown` instead of `any`.\n\n\t\t@default false\n\t\t*/\n\t\tuseUnknownInCatchVariables?: boolean;\n\n\t\t/**\n\t\tWatch input files.\n\n\t\t@default false\n\t\t@deprecated Use watchOptions instead.\n\t\t*/\n\t\twatch?: boolean;\n\n\t\t/**\n\t\tSpecify the polling strategy to use when the system runs out of or doesn't support native file watchers.\n\n\t\t@deprecated Use watchOptions.fallbackPolling instead.\n\t\t*/\n\t\tfallbackPolling?: CompilerOptions.FallbackPolling;\n\n\t\t/**\n\t\tSpecify the strategy for watching directories under systems that lack recursive file-watching functionality.\n\n\t\t@default 'useFsEvents'\n\t\t@deprecated Use watchOptions.watchDirectory instead.\n\t\t*/\n\t\twatchDirectory?: CompilerOptions.WatchDirectory;\n\n\t\t/**\n\t\tSpecify the strategy for watching individual files.\n\n\t\t@default 'useFsEvents'\n\t\t@deprecated Use watchOptions.watchFile instead.\n\t\t*/\n\t\twatchFile?: CompilerOptions.WatchFile;\n\n\t\t/**\n\t\tEnables experimental support for ES7 decorators.\n\n\t\t@default false\n\t\t*/\n\t\texperimentalDecorators?: boolean;\n\n\t\t/**\n\t\tEmit design-type metadata for decorated declarations in source.\n\n\t\t@default false\n\t\t*/\n\t\temitDecoratorMetadata?: boolean;\n\n\t\t/**\n\t\tDo not report errors on unused labels.\n\n\t\t@default false\n\t\t*/\n\t\tallowUnusedLabels?: boolean;\n\n\t\t/**\n\t\tReport error when not all code paths in function return a value.\n\n\t\t@default false\n\t\t*/\n\t\tnoImplicitReturns?: boolean;\n\n\t\t/**\n\t\tAdd `undefined` to a type when accessed using an index.\n\n\t\t@default false\n\t\t*/\n\t\tnoUncheckedIndexedAccess?: boolean;\n\n\t\t/**\n\t\tReport error if failed to find a source file for a side effect import.\n\n\t\t@default false\n\t\t*/\n\t\tnoUncheckedSideEffectImports?: boolean;\n\n\t\t/**\n\t\tReport errors for fallthrough cases in switch statement.\n\n\t\t@default false\n\t\t*/\n\t\tnoFallthroughCasesInSwitch?: boolean;\n\n\t\t/**\n\t\tEnsure overriding members in derived classes are marked with an override modifier.\n\n\t\t@default false\n\t\t*/\n\t\tnoImplicitOverride?: boolean;\n\n\t\t/**\n\t\tDo not report errors on unreachable code.\n\n\t\t@default false\n\t\t*/\n\t\tallowUnreachableCode?: boolean;\n\n\t\t/**\n\t\tDisallow inconsistently-cased references to the same file.\n\n\t\t@default true\n\t\t*/\n\t\tforceConsistentCasingInFileNames?: boolean;\n\n\t\t/**\n\t\tEmit a v8 CPU profile of the compiler run for debugging.\n\n\t\t@default 'profile.cpuprofile'\n\t\t*/\n\t\tgenerateCpuProfile?: string;\n\n\t\t/**\n\t\tGenerates an event trace and a list of types.\n\t\t*/\n\t\tgenerateTrace?: boolean;\n\n\t\t/**\n\t\tBase directory to resolve non-relative module names.\n\t\t*/\n\t\tbaseUrl?: string;\n\n\t\t/**\n\t\tSpecify path mapping to be computed relative to baseUrl option.\n\t\t*/\n\t\tpaths?: Record<string, string[]>;\n\n\t\t/**\n\t\tList of TypeScript language server plugins to load.\n\t\t*/\n\t\tplugins?: CompilerOptions.Plugin[];\n\n\t\t/**\n\t\tSpecify list of root directories to be used when resolving modules.\n\t\t*/\n\t\trootDirs?: string[];\n\n\t\t/**\n\t\tSpecify list of directories for type definition files to be included.\n\t\t*/\n\t\ttypeRoots?: string[];\n\n\t\t/**\n\t\tType declaration files to be included in compilation.\n\t\t*/\n\t\ttypes?: string[];\n\n\t\t/**\n\t\tEnable tracing of the name resolution process.\n\n\t\t@default false\n\t\t*/\n\t\ttraceResolution?: boolean;\n\n\t\t/**\n\t\tAllow javascript files to be compiled.\n\n\t\t@default false\n\t\t*/\n\t\tallowJs?: boolean;\n\n\t\t/**\n\t\tDo not truncate error messages.\n\n\t\t@default false\n\t\t*/\n\t\tnoErrorTruncation?: boolean;\n\n\t\t/**\n\t\tAllow default imports from modules with no default export. This does not affect code emit, just typechecking.\n\n\t\t@default module === 'system' || esModuleInterop\n\t\t*/\n\t\tallowSyntheticDefaultImports?: boolean;\n\n\t\t/**\n\t\tDo not emit `'use strict'` directives in module output.\n\n\t\t@default false\n\t\t@deprecated This option will be removed in TypeScript 5.5.\n\t\t*/\n\t\tnoImplicitUseStrict?: boolean;\n\n\t\t/**\n\t\tEnable to list all emitted files.\n\n\t\t@default false\n\t\t*/\n\t\tlistEmittedFiles?: boolean;\n\n\t\t/**\n\t\tDisable size limit for JavaScript project.\n\n\t\t@default false\n\t\t*/\n\t\tdisableSizeLimit?: boolean;\n\n\t\t/**\n\t\tList of library files to be included in the compilation.\n\t\t*/\n\t\tlib?: CompilerOptions.Lib[];\n\n\t\t/**\n\t\tEnable strict null checks.\n\n\t\t@default false\n\t\t*/\n\t\tstrictNullChecks?: boolean;\n\n\t\t/**\n\t\tThe maximum dependency depth to search under `node_modules` and load JavaScript files. Only applicable with `--allowJs`.\n\n\t\t@default 0\n\t\t*/\n\t\tmaxNodeModuleJsDepth?: number;\n\n\t\t/**\n\t\tImport emit helpers (e.g. `__extends`, `__rest`, etc..) from tslib.\n\n\t\t@default false\n\t\t*/\n\t\timportHelpers?: boolean;\n\n\t\t/**\n\t\tSpecify emit/checking behavior for imports that are only used for types.\n\n\t\t@default 'remove'\n\t\t@deprecated Use `verbatimModuleSyntax` instead.\n\t\t*/\n\t\timportsNotUsedAsValues?: CompilerOptions.ImportsNotUsedAsValues;\n\n\t\t/**\n\t\tParse in strict mode and emit `'use strict'` for each source file.\n\n\t\t@default false\n\t\t*/\n\t\talwaysStrict?: boolean;\n\n\t\t/**\n\t\tEnable all strict type checking options.\n\n\t\t@default false\n\t\t*/\n\t\tstrict?: boolean;\n\n\t\t/**\n\t\tEnable stricter checking of of the `bind`, `call`, and `apply` methods on functions.\n\n\t\t@default false\n\t\t*/\n\t\tstrictBindCallApply?: boolean;\n\n\t\t/**\n\t\tProvide full support for iterables in `for-of`, spread, and destructuring when targeting `ES5` or `ES3`.\n\n\t\t@default false\n\t\t*/\n\t\tdownlevelIteration?: boolean;\n\n\t\t/**\n\t\tReport errors in `.js` files.\n\n\t\t@default false\n\t\t*/\n\t\tcheckJs?: boolean;\n\n\t\t/**\n\t\tBuilt-in iterators are instantiated with a `TReturn` type of undefined instead of `any`.\n\n\t\t@default false\n\t\t*/\n\t\tstrictBuiltinIteratorReturn?: boolean;\n\n\t\t/**\n\t\tDisable bivariant parameter checking for function types.\n\n\t\t@default false\n\t\t*/\n\t\tstrictFunctionTypes?: boolean;\n\n\t\t/**\n\t\tEnsure non-undefined class properties are initialized in the constructor.\n\n\t\t@default false\n\t\t*/\n\t\tstrictPropertyInitialization?: boolean;\n\n\t\t/**\n\t\tEmit `__importStar` and `__importDefault` helpers for runtime Babel ecosystem compatibility and enable `--allowSyntheticDefaultImports` for typesystem compatibility.\n\n\t\t@default false\n\t\t*/\n\t\tesModuleInterop?: boolean;\n\n\t\t/**\n\t\tAllow accessing UMD globals from modules.\n\n\t\t@default false\n\t\t*/\n\t\tallowUmdGlobalAccess?: boolean;\n\n\t\t/**\n\t\tResolve `keyof` to string valued property names only (no numbers or symbols).\n\n\t\t@default false\n\t\t@deprecated This option will be removed in TypeScript 5.5.\n\t\t*/\n\t\tkeyofStringsOnly?: boolean;\n\n\t\t/**\n\t\tEmit ECMAScript standard class fields.\n\n\t\t@default false\n\t\t*/\n\t\tuseDefineForClassFields?: boolean;\n\n\t\t/**\n\t\tGenerates a sourcemap for each corresponding `.d.ts` file.\n\n\t\t@default false\n\t\t*/\n\t\tdeclarationMap?: boolean;\n\n\t\t/**\n\t\tInclude modules imported with `.json` extension.\n\n\t\t@default false\n\t\t*/\n\t\tresolveJsonModule?: boolean;\n\n\t\t/**\n\t\tHave recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.\n\n\t\t@default false\n\t\t*/\n\t\tassumeChangesOnlyAffectDirectDependencies?: boolean;\n\n\t\t/**\n\t\tOutput more detailed compiler performance information after building.\n\n\t\t@default false\n\t\t*/\n\t\textendedDiagnostics?: boolean;\n\n\t\t/**\n\t\tPrint names of files that are part of the compilation and then stop processing.\n\n\t\t@default false\n\t\t*/\n\t\tlistFilesOnly?: boolean;\n\n\t\t/**\n\t\tDisable preferring source files instead of declaration files when referencing composite projects.\n\n\t\t@default true if composite, false otherwise\n\t\t*/\n\t\tdisableSourceOfProjectReferenceRedirect?: boolean;\n\n\t\t/**\n\t\tOpt a project out of multi-project reference checking when editing.\n\n\t\t@default false\n\t\t*/\n\t\tdisableSolutionSearching?: boolean;\n\n\t\t/**\n\t\tPrint names of files which TypeScript sees as a part of your project and the reason they are part of the compilation.\n\n\t\t@default false\n\t\t*/\n\t\texplainFiles?: boolean;\n\n\t\t/**\n\t\tPreserve unused imported values in the JavaScript output that would otherwise be removed.\n\n\t\t@default true\n\t\t@deprecated Use `verbatimModuleSyntax` instead.\n\t\t*/\n\t\tpreserveValueImports?: boolean;\n\n\t\t/**\n\t\tList of file name suffixes to search when resolving a module.\n\t\t*/\n\t\tmoduleSuffixes?: string[];\n\n\t\t/**\n\t\tControl what method is used to detect module-format JS files.\n\n\t\t@default 'auto'\n\t\t*/\n\t\tmoduleDetection?: CompilerOptions.ModuleDetection;\n\n\t\t/**\n\t\tAllows TypeScript files to import each other with a TypeScript-specific extension like .ts, .mts, or .tsx.\n\n\t\t@default false\n\t\t*/\n\t\tallowImportingTsExtensions?: boolean;\n\n\t\t/**\n\t\tForces TypeScript to consult the exports field of package.json files if it ever reads from a package in node_modules.\n\n\t\t@default false\n\t\t*/\n\t\tresolvePackageJsonExports?: boolean;\n\n\t\t/**\n\t\tForces TypeScript to consult the imports field of package.json files when performing a lookup that starts with # from a file whose ancestor directory contains a package.json.\n\n\t\t@default false\n\t\t*/\n\t\tresolvePackageJsonImports?: boolean;\n\n\t\t/**\n\t\tSuppress errors for file formats that TypeScript does not understand.\n\n\t\t@default false\n\t\t*/\n\t\tallowArbitraryExtensions?: boolean;\n\n\t\t/**\n\t\tList of additional conditions that should succeed when TypeScript resolves from package.json.\n\t\t*/\n\t\tcustomConditions?: string[];\n\n\t\t/**\n\t\tAnything that uses the type modifier is dropped entirely.\n\n\t\t@default false\n\t\t*/\n\t\tverbatimModuleSyntax?: boolean;\n\n\t\t/**\n\t\tSuppress deprecation warnings\n\t\t*/\n\t\tignoreDeprecations?: CompilerOptions.IgnoreDeprecations;\n\n\t\t/**\n\t\tDo not allow runtime constructs that are not part of ECMAScript.\n\n\t\t@default false\n\t\t*/\n\t\terasableSyntaxOnly?: boolean;\n\n\t\t/**\n\t\tEnable lib replacement.\n\n\t\t@default true\n\t\t*/\n\t\tlibReplacement?: boolean;\n\t};\n\n\tnamespace WatchOptions {\n\t\ttype WatchFileKind =\n\t\t\t| 'FixedPollingInterval'\n\t\t\t| 'PriorityPollingInterval'\n\t\t\t| 'DynamicPriorityPolling'\n\t\t\t| 'FixedChunkSizePolling'\n\t\t\t| 'UseFsEvents'\n\t\t\t| 'UseFsEventsOnParentDirectory';\n\n\t\ttype WatchDirectoryKind =\n\t\t\t| 'UseFsEvents'\n\t\t\t| 'FixedPollingInterval'\n\t\t\t| 'DynamicPriorityPolling'\n\t\t\t| 'FixedChunkSizePolling';\n\n\t\ttype PollingWatchKind =\n\t\t\t| 'FixedInterval'\n\t\t\t| 'PriorityInterval'\n\t\t\t| 'DynamicPriority'\n\t\t\t| 'FixedChunkSize';\n\t}\n\n\ttype WatchOptions = {\n\n\t\t/**\n\t\tSpecify the strategy for watching individual files.\n\n\t\t@default 'UseFsEvents'\n\t\t*/\n\t\twatchFile?: WatchOptions.WatchFileKind | Lowercase<WatchOptions.WatchFileKind>;\n\n\t\t/**\n\t\tSpecify the strategy for watching directories under systems that lack recursive file-watching functionality.\n\n\t\t@default 'UseFsEvents'\n\t\t*/\n\t\twatchDirectory?: WatchOptions.WatchDirectoryKind | Lowercase<WatchOptions.WatchDirectoryKind>;\n\n\t\t/**\n\t\tSpecify the polling strategy to use when the system runs out of or doesn't support native file watchers.\n\t\t*/\n\t\tfallbackPolling?: WatchOptions.PollingWatchKind | Lowercase<WatchOptions.PollingWatchKind>;\n\n\t\t/**\n\t\tEnable synchronous updates on directory watchers for platforms that don't support recursive watching natively.\n\t\t*/\n\t\tsynchronousWatchDirectory?: boolean;\n\n\t\t/**\n\t\tSpecifies a list of directories to exclude from watch.\n\t\t*/\n\t\texcludeDirectories?: string[];\n\n\t\t/**\n\t\tSpecifies a list of files to exclude from watch.\n\t\t*/\n\t\texcludeFiles?: string[];\n\t};\n\n\t/**\n\tAuto type (.d.ts) acquisition options for this project.\n\t*/\n\ttype TypeAcquisition = {\n\t\t/**\n\t\tEnable auto type acquisition.\n\t\t*/\n\t\tenable?: boolean;\n\n\t\t/**\n\t\tSpecifies a list of type declarations to be included in auto type acquisition. For example, `['jquery', 'lodash']`.\n\t\t*/\n\t\tinclude?: string[];\n\n\t\t/**\n\t\tSpecifies a list of type declarations to be excluded from auto type acquisition. For example, `['jquery', 'lodash']`.\n\t\t*/\n\t\texclude?: string[];\n\n\t\t/**\n\t\tDisable infering what types should be added based on filenames in a project.\n\t\t*/\n\t\tdisableFilenameBasedTypeAcquisition?: boolean;\n\t};\n\n\ttype References = {\n\t\t/**\n\t\tA normalized path on disk.\n\t\t*/\n\t\tpath: string;\n\n\t\t/**\n\t\tThe path as the user originally wrote it.\n\t\t*/\n\t\toriginalPath?: string;\n\n\t\t/**\n\t\tTrue if the output of this reference should be prepended to the output of this project.\n\n\t\tOnly valid for `--outFile` compilations.\n\t\t@deprecated This option will be removed in TypeScript 5.5.\n\t\t*/\n\t\tprepend?: boolean;\n\n\t\t/**\n\t\tTrue if it is intended that this reference form a circularity.\n\t\t*/\n\t\tcircular?: boolean;\n\t};\n}\n\n/**\nType for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7).\n\n@category File\n*/\nexport type TsConfigJson = {\n\t/**\n\tInstructs the TypeScript compiler how to compile `.ts` files.\n\t*/\n\tcompilerOptions?: TsConfigJson.CompilerOptions;\n\n\t/**\n\tInstructs the TypeScript compiler how to watch files.\n\t*/\n\twatchOptions?: TsConfigJson.WatchOptions;\n\n\t/**\n\tAuto type (.d.ts) acquisition options for this project.\n\t*/\n\ttypeAcquisition?: TsConfigJson.TypeAcquisition;\n\n\t/**\n\tEnable Compile-on-Save for this project.\n\t*/\n\tcompileOnSave?: boolean;\n\n\t/**\n\tPath to base configuration file to inherit from.\n\t*/\n\textends?: string | string[];\n\n\t/**\n\tIf no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. When a `files` property is specified, only those files and those specified by `include` are included.\n\t*/\n\tfiles?: string[];\n\n\t/**\n\tSpecifies a list of files to be excluded from compilation. The `exclude` property only affects the files included via the `include` property and not the `files` property.\n\n\tGlob patterns require TypeScript version 2.0 or later.\n\t*/\n\texclude?: string[];\n\n\t/**\n\tSpecifies a list of glob patterns that match files to be included in compilation.\n\n\tIf no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`.\n\t*/\n\tinclude?: string[];\n\n\t/**\n\tReferenced projects.\n\t*/\n\treferences?: TsConfigJson.References[];\n};\n\nexport {};\n"
  },
  {
    "path": "source/tuple-of.d.ts",
    "content": "import type {If} from './if.d.ts';\nimport type {IfNotAnyOrNever} from './internal/type.d.ts';\nimport type {IsNegative} from './numeric.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\n\n/**\nCreate a tuple type of the specified length with elements of the specified type.\n\n@example\n```\nimport type {TupleOf} from 'type-fest';\n\ntype RGB = TupleOf<3, number>;\n//=> [number, number, number]\n\ntype Line = TupleOf<2, {x: number; y: number}>;\n//=> [{x: number; y: number}, {x: number; y: number}]\n\ntype TicTacToeBoard = TupleOf<3, TupleOf<3, 'X' | 'O' | null>>;\n//=> [['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null], ['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null], ['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null]]\n```\n\n@example\n```\nimport type {TupleOf} from 'type-fest';\n\ntype Range<Start extends number, End extends number> = Exclude<keyof TupleOf<End>, keyof TupleOf<Start>>;\n\ntype ZeroToFour = Range<0, 5>;\n//=> '0' | '1' | '2' | '3' | '4'\n\ntype ThreeToEight = Range<3, 9>;\n//=> '5' | '3' | '4' | '6' | '7' | '8'\n```\n\nNote: If the specified length is the non-literal `number` type, the result will not be a tuple but a regular array.\n\n@example\n```\nimport type {TupleOf} from 'type-fest';\n\ntype StringArray = TupleOf<number, string>;\n//=> string[]\n```\n\nNote: If the type for elements is not specified, it will default to `unknown`.\n\n@example\n```\nimport type {TupleOf} from 'type-fest';\n\ntype UnknownTriplet = TupleOf<3>;\n//=> [unknown, unknown, unknown]\n```\n\nNote: If the specified length is negative, the result will be an empty tuple.\n\n@example\n```\nimport type {TupleOf} from 'type-fest';\n\ntype EmptyTuple = TupleOf<-3, string>;\n//=> []\n```\n\nNote: If you need a readonly tuple, simply wrap this type with `Readonly`, for example, to create `readonly [number, number, number]` use `Readonly<TupleOf<3, number>>`.\n\n@category Array\n*/\nexport type TupleOf<Length extends number, Fill = unknown> = IfNotAnyOrNever<Length,\n\t_TupleOf<If<IsNegative<Length>, 0, Length>, Fill, []>,\n\tFill[], []>;\n\ntype _TupleOf<L extends number, Fill, Accumulator extends UnknownArray> = number extends L\n\t? Fill[]\n\t: L extends Accumulator['length']\n\t\t? Accumulator\n\t\t: _TupleOf<L, Fill, [...Accumulator, Fill]>;\n\nexport {};\n"
  },
  {
    "path": "source/tuple-to-object.d.ts",
    "content": "import type {IsTuple} from './is-tuple.d.ts';\nimport type {UnknownArray} from './unknown-array.d.ts';\nimport type {IsAny} from './is-any.d.ts';\nimport type {If} from './if.d.ts';\n\n/**\nTransforms a tuple into an object, mapping each tuple index to its corresponding type as a key-value pair.\n\nNote: Tuple labels are [lost in the transformation process](https://stackoverflow.com/a/70398429/11719314). For example, `TupleToObject<[x: number, y: number]>` produces `{0: number; 1: number}`, and not `{x: number; y: number}`.\n\n@example\n```\nimport type {TupleToObject} from 'type-fest';\n\ntype Example1 = TupleToObject<[number, string, boolean]>;\n//=> {0: number; 1: string; 2: boolean}\n\n// Tuples with optional indices\ntype Example2 = TupleToObject<[number, string?, boolean?]>;\n//=> {0: number; 1?: string; 2?: boolean}\n\n// Readonly tuples\ntype Example3 = TupleToObject<readonly [number, string?]>;\n//=> {readonly 0: number; readonly 1?: string}\n\n// Non-tuple arrays get transformed into index signatures\ntype Example4 = TupleToObject<string[]>;\n//=> {[x: number]: string}\n\n// Tuples with rest elements\ntype Example5 = TupleToObject<[number, string, ...boolean[]]>;\n//=> {[x: number]: string | number | boolean; 0: number; 1: string}\n\n// Tuple labels are not preserved\ntype Example6 = TupleToObject<[x: number, y: number]>;\n//=> {0: number; 1: number}\n```\n\n@category Array\n*/\nexport type TupleToObject<TArray extends UnknownArray> = If<IsAny<TArray>, any, {\n\t[\n\tKey in keyof TArray as Key & (`${number}` | (IsTuple<TArray> extends true ? never : number))\n\t]: TArray[Key];\n}>;\n\nexport {};\n"
  },
  {
    "path": "source/tuple-to-union.d.ts",
    "content": "/**\nConvert a tuple/array into a union type of its elements.\n\nThis can be useful when you have a fixed set of allowed values and want a type defining only the allowed values, but do not want to repeat yourself.\n\n@example\n```\nimport type {TupleToUnion} from 'type-fest';\n\nconst destinations = ['a', 'b', 'c'] as const;\n\ntype Destination = TupleToUnion<typeof destinations>;\n//=> 'a' | 'b' | 'c'\n\nfunction verifyDestination(destination: unknown): destination is Destination {\n\treturn destinations.includes(destination as any);\n}\n\ntype RequestBody = {\n\tdeliverTo: Destination;\n};\n\nfunction verifyRequestBody(body: unknown): body is RequestBody {\n\tconst {deliverTo} = (body as any);\n\treturn typeof body === 'object' && body !== null && verifyDestination(deliverTo);\n}\n```\n\nAlternatively, you may use `typeof destinations[number]`. If `destinations` is a tuple, there is no difference. However if `destinations` is a string, the resulting type will the union of the characters in the string. Other types of `destinations` may result in a compile error. In comparison, TupleToUnion will return `never` if a tuple is not provided.\n\n@example\n```\nconst destinations = ['a', 'b', 'c'] as const;\n\ntype Destination = typeof destinations[number];\n//=> 'a' | 'b' | 'c'\n\nconst erroringType = new Set(['a', 'b', 'c']);\n\n// @ts-expect-error\ntype ErroringType = typeof erroringType[number];\n// Error: Type 'Set<string>' has no matching index signature for type 'number'. ts(2537)\n\nconst numberBool: {[n: number]: boolean} = {1: true};\n\ntype NumberBool = typeof numberBool[number];\n//=> boolean\n```\n\n@category Array\n*/\nexport type TupleToUnion<ArrayType> = ArrayType extends readonly unknown[] ? ArrayType[number] : never;\n\nexport {};\n"
  },
  {
    "path": "source/typed-array.d.ts",
    "content": "/**\nMatches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.\n\n@category Array\n*/\nexport type TypedArray =\n\t| Int8Array\n\t| Uint8Array\n\t| Uint8ClampedArray\n\t| Int16Array\n\t| Uint16Array\n\t| Int32Array\n\t| Uint32Array\n\t| Float32Array\n\t| Float64Array\n\t| BigInt64Array\n\t| BigUint64Array;\n\nexport {};\n"
  },
  {
    "path": "source/undefined-on-partial-deep.d.ts",
    "content": "import type {BuiltIns} from './internal/index.d.ts';\n\n/**\nCreate a deep version of another type where all optional keys are set to also accept `undefined`.\n\nNote: This is only needed when the [`exactOptionalPropertyTypes`](https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes) TSConfig setting is enabled.\n\nUse-cases:\n- When `exactOptionalPropertyTypes` is enabled, an object like `{a: undefined}` is not assignable to the type `{a?: number}`. You can use `UndefinedOnPartialDeep<{a?: number}>` to make it assignable.\n\n@example\n```\nimport type {UndefinedOnPartialDeep} from 'type-fest';\n\ntype Settings = {\n\toptionA: string;\n\toptionB?: number;\n\tsubOption: {\n\t\tsubOptionA: boolean;\n\t\tsubOptionB?: boolean;\n\t};\n};\n\nconst testSettingsA: Settings = {\n\toptionA: 'foo',\n\toptionB: undefined, // TypeScript error if `exactOptionalPropertyTypes` is true.\n\t// @ts-expect-error\n\tsubOption: {\n\t\tsubOptionA: true,\n\t\tsubOptionB: undefined, // TypeScript error if `exactOptionalPropertyTypes` is true\n\t},\n};\n\nconst testSettingsB: UndefinedOnPartialDeep<Settings> = {\n\toptionA: 'foo',\n\toptionB: undefined, // `optionB` can be set to `undefined` now.\n\tsubOption: {\n\t\tsubOptionA: true,\n\t\tsubOptionB: undefined, // `subOptionB` can be set to `undefined` now.\n\t},\n};\n```\n*/\nexport type UndefinedOnPartialDeep<T> =\n\t// Handle built-in type and function\n\tT extends BuiltIns | Function\n\t\t? T\n\t\t// Handle tuple and array\n\t\t: T extends readonly unknown[]\n\t\t\t? UndefinedOnPartialList<T>\n\t\t\t// Handle map and readonly map\n\t\t\t: T extends Map<infer K, infer V>\n\t\t\t\t? Map<K, UndefinedOnPartialDeep<V>>\n\t\t\t\t: T extends ReadonlyMap<infer K, infer V>\n\t\t\t\t\t? ReadonlyMap<K, UndefinedOnPartialDeep<V>>\n\t\t\t\t\t// Handle set and readonly set\n\t\t\t\t\t: T extends Set<infer K>\n\t\t\t\t\t\t? Set<UndefinedOnPartialDeep<K>>\n\t\t\t\t\t\t: T extends ReadonlySet<infer K>\n\t\t\t\t\t\t\t? ReadonlySet<UndefinedOnPartialDeep<K>>\n\t\t\t\t\t\t\t// Handle object\n\t\t\t\t\t\t\t: T extends Record<any, any>\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t[KeyType in keyof T]: undefined extends T[KeyType]\n\t\t\t\t\t\t\t\t\t\t? UndefinedOnPartialDeep<T[KeyType]> | undefined\n\t\t\t\t\t\t\t\t\t\t: UndefinedOnPartialDeep<T[KeyType]>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: T; // If T is not builtins / function / array / map / set / object, return T\n\n// Handle tuples and arrays\ntype UndefinedOnPartialList<T extends readonly unknown[]> = T extends []\n\t? []\n\t: T extends [infer F, ...infer R]\n\t\t? [UndefinedOnPartialDeep<F>, ...UndefinedOnPartialDeep<R>]\n\t\t: T extends readonly [infer F, ...infer R]\n\t\t\t? readonly [UndefinedOnPartialDeep<F>, ...UndefinedOnPartialDeep<R>]\n\t\t\t: T extends Array<infer F>\n\t\t\t\t? Array<UndefinedOnPartialDeep<F>>\n\t\t\t\t: T extends ReadonlyArray<infer F>\n\t\t\t\t\t? ReadonlyArray<UndefinedOnPartialDeep<F>>\n\t\t\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/union-member.d.ts",
    "content": "import type {UnionToIntersection} from './union-to-intersection.d.ts';\nimport type {IsNever} from './is-never.d.ts';\n\n/**\nReturns an arbitrary member of a union type.\n\nUse-cases:\n- Implementing recursive type functions that accept a union type.\n\n@example\n```\nimport type {UnionMember, IsNever} from 'type-fest';\n\ntype UnionLength<T, Acc extends any[] = []> =\n\tUnionMember<T> extends infer Member\n\t\t? IsNever<Member> extends false\n\t\t\t? UnionLength<Exclude<T, Member>, [...Acc, Member]>\n\t\t\t: Acc['length']\n\t\t: never;\n\ntype T1 = UnionLength<'foo' | 'bar' | 'baz'>;\n//=> 3\n\ntype T2 = UnionLength<{a: string}>;\n//=> 1\n```\n\n- Picking an arbitrary member from a union\n\n@example\n```\nimport type {UnionMember, Primitive, LiteralToPrimitive} from 'type-fest';\n\ntype IsHomogenous<T extends Primitive> = [T] extends [LiteralToPrimitive<UnionMember<T>>] ? true : false;\n\ntype T1 = IsHomogenous<1 | 2 | 3 | 4>;\n//=> true\n\ntype T2 = IsHomogenous<'foo' | 'bar'>;\n//=> true\n\ntype T3 = IsHomogenous<'foo' | 'bar' | 1>;\n//=> false\n```\n\nReturns `never` when the input is `never`.\n\n@example\n```\nimport type {UnionMember} from 'type-fest';\n\ntype LastNever = UnionMember<never>;\n//=> never\n```\n\n@category Type\n*/\nexport type UnionMember<T> =\n\tIsNever<T> extends true\n\t\t? never\n\t\t: UnionToIntersection<T extends any ? () => T : never> extends () => (infer R)\n\t\t\t? R\n\t\t\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/union-to-intersection.d.ts",
    "content": "/**\nConvert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).\n\nInspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).\n\n@example\n```\nimport type {UnionToIntersection} from 'type-fest';\n\ntype Union = {the(): void} | {great(arg: string): void} | {escape: boolean};\n\ntype Intersection = UnionToIntersection<Union>;\n//=> {the(): void} & {great(arg: string): void} & {escape: boolean}\n```\n\n@category Type\n*/\nexport type UnionToIntersection<Union> = (\n\t// `extends unknown` is always going to be the case and is used to convert the\n\t// `Union` into a [distributive conditional\n\t// type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).\n\tUnion extends unknown\n\t\t// The union type is used as the only argument to a function since the union\n\t\t// of function arguments is an intersection.\n\t\t? (distributedUnion: Union) => void\n\t\t// This won't happen.\n\t\t: never\n\t\t// Infer the `Intersection` type since TypeScript represents the positional\n\t\t// arguments of unions of functions as an intersection of the union.\n) extends ((mergedIntersection: infer Intersection) => void)\n\t// The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`\n\t? Intersection & Union\n\t: never;\n\nexport {};\n"
  },
  {
    "path": "source/union-to-tuple.d.ts",
    "content": "import type {ExcludeExactly} from './exclude-exactly.d.ts';\nimport type {IsNever} from './is-never.d.ts';\nimport type {UnionMember} from './union-member.d.ts';\n\n/**\nConvert a union type into an unordered tuple type of its elements.\n\n\"Unordered\" means the elements of the tuple are not guaranteed to be in the same order as in the union type. The arrangement can appear random and may change at any time.\n\nThis can be useful when you have objects with a finite set of keys and want a type defining only the allowed keys, but do not want to repeat yourself.\n\n@example\n```\nimport type {UnionToTuple} from 'type-fest';\n\ntype Numbers = 1 | 2 | 3;\ntype NumbersTuple = UnionToTuple<Numbers>;\n//=> [1, 2, 3]\n```\n\n@example\n```\nimport type {UnionToTuple} from 'type-fest';\n\nconst pets = {\n\tdog: '🐶',\n\tcat: '🐱',\n\tsnake: '🐍',\n};\n\ntype Pet = keyof typeof pets;\n//=> 'dog' | 'cat' | 'snake'\n\nconst petList = Object.keys(pets) as UnionToTuple<Pet>;\n//=> ['dog', 'cat', 'snake']\n```\n\n@category Array\n*/\nexport type UnionToTuple<T, L = UnionMember<T>> =\nIsNever<T> extends false\n\t? [...UnionToTuple<ExcludeExactly<T, L>>, L]\n\t: [];\n\nexport {};\n"
  },
  {
    "path": "source/unknown-array.d.ts",
    "content": "/**\nRepresents an array with `unknown` value.\n\nUse case: You want a type that all arrays can be assigned to, but you don't care about the value.\n\n@example\n```\nimport type {UnknownArray} from 'type-fest';\n\ntype IsArray<T> = T extends UnknownArray ? true : false;\n\ntype A = IsArray<['foo']>;\n//=> true\n\ntype B = IsArray<readonly number[]>;\n//=> true\n\ntype C = IsArray<string>;\n//=> false\n```\n\n@category Type\n@category Array\n*/\nexport type UnknownArray = readonly unknown[];\n\nexport {};\n"
  },
  {
    "path": "source/unknown-map.d.ts",
    "content": "/**\nRepresents a map with `unknown` key and value.\n\nUse case: You want a type that all maps can be assigned to, but you don't care about the value.\n\n@example\n```\nimport type {UnknownMap} from 'type-fest';\n\ntype IsMap<T> = T extends UnknownMap ? true : false;\n\ntype A = IsMap<Map<string, number>>;\n//=> true\n\ntype B = IsMap<ReadonlyMap<number, string>>;\n//=> true\n\ntype C = IsMap<string>;\n//=> false\n```\n\n@category Type\n*/\nexport type UnknownMap = ReadonlyMap<unknown, unknown>;\n\nexport {};\n"
  },
  {
    "path": "source/unknown-record.d.ts",
    "content": "/**\nRepresents an object with `unknown` value. You probably want this instead of `{}`.\n\nUse case: You have an object whose keys and values are unknown to you.\n\n@example\n```\nimport type {UnknownRecord} from 'type-fest';\n\nfunction toJson(object: UnknownRecord) {\n\treturn JSON.stringify(object);\n}\n\ntoJson({hello: 'world'}); // Ok\n\nfunction isObject(value: unknown): value is UnknownRecord {\n\treturn typeof value === 'object' && value !== null;\n}\n\nconst value: unknown = {hello: 'world'};\n\nif (isObject(value)) {\n\tconst v = value;\n\t//=> UnknownRecord\n}\n```\n\n@category Type\n@category Object\n*/\nexport type UnknownRecord = Record<PropertyKey, unknown>;\n\nexport {};\n"
  },
  {
    "path": "source/unknown-set.d.ts",
    "content": "/**\nRepresents a set with `unknown` value.\n\nUse case: You want a type that all sets can be assigned to, but you don't care about the value.\n\n@example\n```\nimport type {UnknownSet} from 'type-fest';\n\ntype IsSet<T> = T extends UnknownSet ? true : false;\n\ntype A = IsSet<Set<string>>;\n//=> true\n\ntype B = IsSet<ReadonlySet<number>>;\n//=> true\n\ntype C = IsSet<string>;\n//=> false\n```\n\n@category Type\n*/\nexport type UnknownSet = ReadonlySet<unknown>;\n\nexport {};\n"
  },
  {
    "path": "source/unwrap-partial.d.ts",
    "content": "/**\nRevert the `Partial` modifier on an object type.\n\nUse-case: Infer the underlying type `T` when only `Partial<T>` is available or the original type may not be directly accessible.\n\n@example\n```\nimport type {UnwrapPartial} from 'type-fest';\n\ntype Config = Partial<{\n\tport: number;\n\thost: string;\n\tsecure?: boolean;\n}>;\n\ntype InitializedConfig = UnwrapPartial<Config>;\n//=> {port: number; host: string; secure?: boolean}\n```\n\nNote: If the provided type isn’t of `Partial<T>`, `UnwrapPartial` has no effect on the original type.\n\n@category Object\n*/\nexport type UnwrapPartial<PartialObjectType> =\n\tPartialObjectType extends Partial<infer ObjectType>\n\t\t? (\n\t\t\tPartial<ObjectType> extends PartialObjectType\n\t\t\t\t? ObjectType\n\t\t\t\t: PartialObjectType\n\t\t)\n\t\t: PartialObjectType;\n\nexport {};\n"
  },
  {
    "path": "source/value-of.d.ts",
    "content": "/**\nCreate a union of the given object's values, and optionally specify which keys to get the values from.\n\nPlease upvote [this issue](https://github.com/microsoft/TypeScript/issues/31438) if you want to have this type as a built-in in TypeScript.\n\n@example\n```\nimport type {ValueOf} from 'type-fest';\n\ntype A = ValueOf<{id: number; name: string; active: boolean}>;\n//=> string | number | boolean\n\ntype B = ValueOf<{id: number; name: string; active: boolean}, 'name'>;\n//=> string\n\ntype C = ValueOf<{id: number; name: string; active: boolean}, 'id' | 'name'>;\n//=> string | number\n```\n\n@category Object\n*/\nexport type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];\n\nexport {};\n"
  },
  {
    "path": "source/words.d.ts",
    "content": "import type {\n\tApplyDefaultOptions,\n\tIsNumeric,\n\tWordSeparators,\n} from './internal/index.d.ts';\nimport type {IsLowercase} from './is-lowercase.d.ts';\nimport type {IsUppercase} from './is-uppercase.d.ts';\n\ntype SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];\n\ntype RemoveLastCharacter<\n\tSentence extends string,\n\tCharacter extends string,\n> = Sentence extends `${infer LeftSide}${Character}`\n\t? SkipEmptyWord<LeftSide>\n\t: never;\n\n/**\nWords options.\n\n@see {@link Words}\n*/\nexport type WordsOptions = {\n\t/**\n\tSplit on numeric sequence.\n\n\t@default true\n\n\t@example\n\t```\n\timport type {Words} from 'type-fest';\n\n\ttype Example1 = Words<'p2pNetwork', {splitOnNumbers: true}>;\n\t//=> ['p', '2', 'p', 'Network']\n\n\ttype Example2 = Words<'p2pNetwork', {splitOnNumbers: false}>;\n\t//=> ['p2p', 'Network']\n\t```\n\t*/\n\tsplitOnNumbers?: boolean;\n};\n\nexport type _DefaultWordsOptions = {\n\tsplitOnNumbers: true;\n};\n\n/**\nSplit a string (almost) like Lodash's `_.words()` function.\n\n- Split on each word that begins with a capital letter.\n- Split on each {@link WordSeparators}.\n- Split on numeric sequence.\n\n@example\n```\nimport type {Words} from 'type-fest';\n\ntype Words0 = Words<'helloWorld'>;\n//=> ['hello', 'World']\n\ntype Words1 = Words<'helloWORLD'>;\n//=> ['hello', 'WORLD']\n\ntype Words2 = Words<'hello-world'>;\n//=> ['hello', 'world']\n\ntype Words3 = Words<'--hello the_world'>;\n//=> ['hello', 'the', 'world']\n\ntype Words4 = Words<'lifeIs42'>;\n//=> ['life', 'Is', '42']\n\ntype Words5 = Words<'p2pNetwork', {splitOnNumbers: false}>;\n//=> ['p2p', 'Network']\n```\n\n@category Change case\n@category Template literal\n*/\nexport type Words<Sentence extends string, Options extends WordsOptions = {}> =\n\tWordsImplementation<Sentence, ApplyDefaultOptions<WordsOptions, _DefaultWordsOptions, Options>>;\n\ntype WordsImplementation<\n\tSentence extends string,\n\tOptions extends Required<WordsOptions>,\n\tLastCharacter extends string = '',\n\tCurrentWord extends string = '',\n> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}`\n\t? FirstCharacter extends WordSeparators\n\t\t// Skip word separator\n\t\t? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options>]\n\t\t: LastCharacter extends ''\n\t\t\t// Fist char of word\n\t\t\t? WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>\n\t\t\t// Case change: non-numeric to numeric\n\t\t\t: [false, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>]\n\t\t\t\t? Options['splitOnNumbers'] extends true\n\t\t\t\t\t// Split on number: push word\n\t\t\t\t\t? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>]\n\t\t\t\t\t// No split on number: concat word\n\t\t\t\t\t: WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`>\n\t\t\t\t// Case change: numeric to non-numeric\n\t\t\t\t: [true, false] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>]\n\t\t\t\t\t? Options['splitOnNumbers'] extends true\n\t\t\t\t\t\t// Split on number: push word\n\t\t\t\t\t\t? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>]\n\t\t\t\t\t\t// No split on number: concat word\n\t\t\t\t\t\t: WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`>\n\t\t\t\t\t// No case change: concat word\n\t\t\t\t\t: [true, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>]\n\t\t\t\t\t\t? WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`>\n\t\t\t\t\t// Case change: lower to upper, push word\n\t\t\t\t\t\t: [true, true] extends [IsLowercase<LastCharacter>, IsUppercase<FirstCharacter>]\n\t\t\t\t\t\t\t? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>]\n\t\t\t\t\t\t// Case change: upper to lower, brings back the last character, push word\n\t\t\t\t\t\t\t: [true, true] extends [IsUppercase<LastCharacter>, IsLowercase<FirstCharacter>]\n\t\t\t\t\t\t\t\t? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${LastCharacter}${FirstCharacter}`>]\n\t\t\t\t\t\t\t// No case change: concat word\n\t\t\t\t\t\t\t\t: WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`>\n\t: [...SkipEmptyWord<CurrentWord>];\n\nexport {};\n"
  },
  {
    "path": "source/writable-deep.d.ts",
    "content": "import type {BuiltIns, HasMultipleCallSignatures} from './internal/index.d.ts';\n\n/**\nCreate a deeply mutable version of an `object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray` type. The inverse of `ReadonlyDeep<T>`. Use `Writable<T>` if you only need one level deep.\n\nThis can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509), or to define a single model where the only thing that changes is whether or not some of the keys are writable.\n\n@example\n```\nimport type {WritableDeep} from 'type-fest';\n\ntype Foo = {\n\treadonly a: number;\n\treadonly b: readonly string[]; // To show that mutability is deeply affected.\n\treadonly c: boolean;\n};\n\nconst writableDeepFoo: WritableDeep<Foo> = {a: 1, b: ['2'], c: true};\nwritableDeepFoo.a = 3;\nwritableDeepFoo.b[0] = 'new value';\nwritableDeepFoo.b = ['something'];\n```\n\nNote that types containing overloaded functions are not made deeply writable due to a [TypeScript limitation](https://github.com/microsoft/TypeScript/issues/29732).\n\n@see {@link Writable}\n@category Object\n@category Array\n@category Set\n@category Map\n*/\nexport type WritableDeep<T> = T extends BuiltIns\n\t? T\n\t: T extends (...arguments_: any[]) => unknown\n\t\t? {} extends _WritableObjectDeep<T>\n\t\t\t? T\n\t\t\t: HasMultipleCallSignatures<T> extends true\n\t\t\t\t? T\n\t\t\t\t: ((...arguments_: Parameters<T>) => ReturnType<T>) & _WritableObjectDeep<T>\n\t\t: T extends ReadonlyMap<unknown, unknown>\n\t\t\t? WritableMapDeep<T>\n\t\t\t: T extends ReadonlySet<unknown>\n\t\t\t\t? WritableSetDeep<T>\n\t\t\t\t: T extends readonly unknown[]\n\t\t\t\t\t? WritableArrayDeep<T>\n\t\t\t\t\t: T extends object\n\t\t\t\t\t\t? _WritableObjectDeep<T>\n\t\t\t\t\t\t: unknown;\n\n/**\nSame as `WritableDeep`, but accepts only `Map`s as inputs. Internal helper for `WritableDeep`.\n*/\ntype WritableMapDeep<MapType extends ReadonlyMap<unknown, unknown>> =\n\tMapType extends ReadonlyMap<infer KeyType, infer ValueType>\n\t\t? Map<WritableDeep<KeyType>, WritableDeep<ValueType>>\n\t\t: MapType; // Should not heppen\n\n/**\nSame as `WritableDeep`, but accepts only `Set`s as inputs. Internal helper for `WritableDeep`.\n*/\ntype WritableSetDeep<SetType extends ReadonlySet<unknown>> =\n\tSetType extends ReadonlySet<infer ItemType>\n\t\t? Set<WritableDeep<ItemType>>\n\t\t: SetType; // Should not heppen\n\n/**\nSame as `WritableDeep`, but accepts only `object`s as inputs. Internal helper for `WritableDeep`.\n*/\nexport type _WritableObjectDeep<ObjectType extends object> = {\n\t-readonly [KeyType in keyof ObjectType]: WritableDeep<ObjectType[KeyType]>\n};\n\n/**\nSame as `WritableDeep`, but accepts only `Array`s as inputs. Internal helper for `WritableDeep`.\n*/\ntype WritableArrayDeep<ArrayType extends readonly unknown[]> =\n\tArrayType extends readonly [] ? []\n\t\t: ArrayType extends readonly [...infer U, infer V] ? [...WritableArrayDeep<U>, WritableDeep<V>]\n\t\t\t: ArrayType extends readonly [infer U, ...infer V] ? [WritableDeep<U>, ...WritableArrayDeep<V>]\n\t\t\t\t: ArrayType extends ReadonlyArray<infer U> ? Array<WritableDeep<U>>\n\t\t\t\t\t: ArrayType extends Array<infer U> ? Array<WritableDeep<U>>\n\t\t\t\t\t\t: ArrayType;\n\nexport {};\n"
  },
  {
    "path": "source/writable-keys-of.d.ts",
    "content": "import type {ReadonlyKeysOf} from './readonly-keys-of.d.ts';\n\n/**\nExtract all writable keys from the given type.\n\nThis is useful when you want to create a new type that contains writable keys only.\n\n@example\n```\nimport type {WritableKeysOf} from 'type-fest';\n\ntype User = {\n\tname: string;\n\tsurname: string;\n\n\treadonly id: number;\n};\n\ntype UpdateRequest<Entity extends object> = Pick<Entity, WritableKeysOf<Entity>>;\n\nconst update1: UpdateRequest<User> = {\n\tname: 'Alice',\n\tsurname: 'Acme',\n};\n```\n\n@category Utilities\n*/\nexport type WritableKeysOf<Type extends object> =\n\tType extends unknown // For distributing `Type`\n\t\t? Exclude<keyof Type, ReadonlyKeysOf<Type>>\n\t\t: never; // Should never happen\n\nexport {};\n"
  },
  {
    "path": "source/writable.d.ts",
    "content": "import type {Except} from './except.d.ts';\nimport type {Simplify} from './simplify.d.ts';\n\n/**\nCreate a writable version of the given array type.\n*/\ntype WritableArray<ArrayType extends readonly unknown[]> =\n\tArrayType extends readonly [] ? []\n\t\t: ArrayType extends readonly [...infer U, infer V] ? [...U, V]\n\t\t\t: ArrayType extends readonly [infer U, ...infer V] ? [U, ...V]\n\t\t\t\t: ArrayType extends ReadonlyArray<infer U> ? U[]\n\t\t\t\t\t: ArrayType;\n\n/**\nCreate a type that strips `readonly` from the given type. Inverse of `Readonly<T>`.\n\nThe 2nd argument will be ignored if the input type is not an object.\n\nNote: This type can make readonly `Set` and `Map` writable. This behavior is different from `Readonly<T>` (as of TypeScript 5.2.2). See: https://github.com/microsoft/TypeScript/issues/29655\n\nThis can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509), or to define a single model where the only thing that changes is whether or not some of the keys are writable.\n\n@example\n```\nimport type {Writable} from 'type-fest';\n\ntype Foo = {\n\treadonly a: number;\n\treadonly b: readonly string[]; // To show that only the mutability status of the properties, not their values, are affected.\n\treadonly c: boolean;\n};\n\nconst writableFoo: Writable<Foo> = {a: 1, b: ['2'], c: true};\nwritableFoo.a = 3;\n// @ts-expect-error\nwritableFoo.b[0] = 'new value'; // Will still fail as the value of property \"b\" is still a readonly type.\nwritableFoo.b = ['something']; // Will work as the \"b\" property itself is no longer readonly.\n\ntype SomeWritable = Writable<Foo, 'b' | 'c'>;\n//=> {readonly a: number; b: readonly string[]; c: boolean}\n\n// Also supports array\nconst readonlyArray: readonly number[] = [1, 2, 3];\n// @ts-expect-error\nreadonlyArray.push(4); // Will fail as the array itself is readonly.\nconst writableArray: Writable<typeof readonlyArray> = readonlyArray as Writable<typeof readonlyArray>;\nwritableArray.push(4); // Will work as the array itself is now writable.\n```\n\n@category Object\n*/\nexport type Writable<BaseType, Keys extends keyof BaseType = keyof BaseType> =\nBaseType extends ReadonlyMap<infer KeyType, infer ValueType>\n\t? Map<KeyType, ValueType>\n\t: BaseType extends ReadonlySet<infer ItemType>\n\t\t? Set<ItemType>\n\t\t: BaseType extends readonly unknown[]\n\t\t\t// Handle array\n\t\t\t? WritableArray<BaseType>\n\t\t\t// Handle object\n\t\t\t: Simplify<\n\t\t\t// Pick just the keys that are not writable from the base type.\n\t\t\t\tExcept<BaseType, Keys> &\n\t\t\t// Pick the keys that should be writable from the base type and make them writable by removing the `readonly` modifier from the key.\n\t\t\t\t{-readonly [KeyType in keyof Pick<BaseType, Keys>]: Pick<BaseType, Keys>[KeyType]}\n\t\t\t>;\n\nexport {};\n"
  },
  {
    "path": "source/xor.d.ts",
    "content": "import type {Not} from './internal/type.d.ts';\nimport type {And} from './and.d.ts';\nimport type {Or} from './or.d.ts';\n\n/**\nReturns a boolean for whether only one of two given types is true.\n\nUse-case: Constructing complex conditional types where one single condition must be satisfied.\n\n@example\n```\nimport type {Xor} from 'type-fest';\n\ntype TT = Xor<true, true>;\n//=> false\n\ntype TF = Xor<true, false>;\n//=> true\n\ntype FT = Xor<false, true>;\n//=> true\n\ntype FF = Xor<false, false>;\n//=> false\n```\n\nNote: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.\nFor example, `Xor<false, boolean>` expands to `Xor<false, true> | Xor<false, false>`, which simplifies to `true | false` (i.e., `boolean`).\n\n@example\n```\nimport type {Xor} from 'type-fest';\n\ntype A = Xor<false, boolean>;\n//=> boolean\n\ntype B = Xor<boolean, false>;\n//=> boolean\n\ntype C = Xor<true, boolean>;\n//=> boolean\n\ntype D = Xor<boolean, true>;\n//=> boolean\n\ntype E = Xor<boolean, boolean>;\n//=> boolean\n```\n\nNote: If `never` is passed as an argument, it is treated as `false` and the result is computed accordingly.\n\n@example\n```\nimport type {Xor} from 'type-fest';\n\ntype A = Xor<true, never>;\n//=> true\n\ntype B = Xor<never, true>;\n//=> true\n\ntype C = Xor<false, never>;\n//=> false\n\ntype D = Xor<never, false>;\n//=> false\n\ntype E = Xor<boolean, never>;\n//=> boolean\n\ntype F = Xor<never, boolean>;\n//=> boolean\n\ntype G = Xor<never, never>;\n//=> false\n```\n\n@see {@link And}\n@see {@link Or}\n*/\nexport type Xor<A extends boolean, B extends boolean> = And<Or<A, B>, Not<And<A, B>>>;\n\nexport {};\n"
  },
  {
    "path": "test-d/abstract-class.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {AbstractConstructor, AbstractClass, IsAny} from '../index.d.ts';\n\nabstract class Foo {\n\tconstructor(x: number) {\n\t\tvoid (x);\n\t}\n\n\tabstract fooMethod(): void;\n}\n\nabstract class Bar {\n\tabstract barMethod(): void;\n}\n\nfunction functionReceivingAbsClass<T>(cls: AbstractClass<T>) {\n\treturn cls;\n}\n\nfunction withBar<T extends AbstractConstructor<object>>(Ctor: T) {\n\tabstract class ExtendedBar extends Ctor {\n\t\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\t\textendedBarMethod() {}\n\t}\n\treturn ExtendedBar;\n}\n\n// This lacks `barMethod`.\n// @ts-expect-error\nclass WrongConcreteExtendedBar extends withBar(Bar) {}\n\n// This should be alright since `barMethod` is implemented.\nclass CorrectConcreteExtendedBar extends withBar(Bar) {\n\tconstructor(x: number, y: number) {\n\t\tsuper();\n\t\tvoid (x);\n\t\tvoid (y);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tbarMethod() {}\n}\n\nfunction assertWithBar() {\n\tfunctionReceivingAbsClass<Bar>(withBar(Bar));\n\tfunctionReceivingAbsClass<Bar>(CorrectConcreteExtendedBar);\n}\n\nfunctionReceivingAbsClass(Foo);\n// @ts-expect-error\nfunctionReceivingAbsClass<Bar>(Foo);\nassertWithBar();\n\nexpectAssignable<AbstractConstructor<{barMethod(): void}, []>>(Bar);\nexpectAssignable<AbstractClass<{barMethod(): void}, []>>(Bar);\n\n// Prototype test\nexpectAssignable<{barMethod(): void}>(Bar.prototype);\nexpectNotAssignable<{fooMethod(): void}>(Bar.prototype);\n// @ts-expect-error\nconst _a = new CorrectConcreteExtendedBar(12);\nexpectAssignable<{barMethod(): void}>(new CorrectConcreteExtendedBar(12, 15));\n// /Prototype test\n\n// Prototype test with type parameter\nabstract class AbstractBuilding<T = unknown> {\n\towners: T;\n\tconstructor(buildingOwners: T) {\n\t\tthis.owners = buildingOwners;\n\t}\n}\n\ntype Census = {\n\tcount: number;\n};\n\nabstract class House<OwnerCount extends Census = Census> extends AbstractBuilding<OwnerCount> {}\n\nclass CityBlock<BuildingType extends AbstractBuilding<Census>> {\n\tresidence: BuildingType;\n\n\tconstructor(HousingType: AbstractClass<BuildingType, [Census]>) {\n\t\tclass Building extends HousingType {}\n\t\tthis.residence = new Building({count: 2});\n\t}\n}\n\nconst Family = (new CityBlock(House)).residence.owners;\nexpectType<IsAny<typeof Family>>(false);\nexpectAssignable<number>(Family.count);\n// /Prototype test with type parameter\n"
  },
  {
    "path": "test-d/all-extend.ts",
    "content": "import {expectType} from 'tsd';\nimport type {AllExtend} from '../source/all-extend.d.ts';\nimport type {UnknownArray} from '../source/unknown-array.d.ts';\n\nexpectType<AllExtend<[], number>>(true);\nexpectType<AllExtend<[1, 2, 3], number>>(true);\nexpectType<AllExtend<[1, 2, 3], number | bigint>>(true);\nexpectType<AllExtend<[true, false, true, false, boolean], boolean>>(true);\nexpectType<AllExtend<[string, '1', '2', `${number}`], string>>(true);\nexpectType<AllExtend<[1, 2, 3, ...number[]], number>>(true);\nexpectType<AllExtend<[number, number, ...Array<1 | -1>], number>>(true);\nexpectType<AllExtend<[...number[], number, string], number | string>>(true);\nexpectType<AllExtend<['^', ...string[], '$'], string>>(true);\n\nexpectType<AllExtend<[1, 2, '3'], number>>(false);\nexpectType<AllExtend<['1', 2, 3], number>>(false);\nexpectType<AllExtend<['1', '2', '3', 4, '5'], string>>(false);\nexpectType<AllExtend<[1, 2, 3, ...string[]], number>>(false);\nexpectType<AllExtend<[...bigint[], number, string], number | string>>(false);\nexpectType<AllExtend<[1, 2, ...number[], '1', 3], number>>(false);\nexpectType<AllExtend<[1, 2, ...string[], 3, 4], number>>(false);\n\n// Union type elements\nexpectType<AllExtend<[string, string | number], string>>({} as boolean);\nexpectType<AllExtend<[true, true, true, boolean], true>>({} as boolean);\nexpectType<AllExtend<[false, false, boolean, false], false>>({} as boolean);\nexpectType<AllExtend<['1', '2', number | bigint, '3'], string>>(false);\nexpectType<AllExtend<[1, 2, number | bigint, 3], number | bigint>>(true);\nexpectType<AllExtend<[1, 2, 3, ...Array<string | undefined>], string | number>>({} as boolean);\nexpectType<AllExtend<['foo', ...Array<string | undefined>, 'bar'], string | undefined>>(true);\n\n// Readonly arrays\nexpectType<AllExtend<readonly [], number>>(true);\nexpectType<AllExtend<readonly [1, 2, 3], number>>(true);\nexpectType<AllExtend<readonly [1, 2, '3'], number>>(false);\nexpectType<AllExtend<readonly ['^', ...string[], '$'], string>>(true);\nexpectType<AllExtend<readonly [number, ...readonly string[], number], string>>(false);\nexpectType<AllExtend<readonly [...bigint[], number, string], number | string>>(false);\nexpectType<AllExtend<readonly [...ReadonlyArray<string | undefined>, string, string], string | undefined>>(true);\n\n// Optional elements\n// If `exactOptionalPropertyTypes` were disabled, the target type would need an additional `| undefined` for a successful match.\n// For example, `AllExtend<[1?, 2?], number>` would return `boolean`. To make it return `true`, the target type must be `number | undefined`.\nexpectType<AllExtend<[1?, 2?, 3?], number>>(true);\nexpectType<AllExtend<[1?, (2 | undefined)?], number>>({} as boolean);\nexpectType<AllExtend<[1?, 2?, 3?], number | undefined>>(true);\nexpectType<AllExtend<[1, 2?, 3?, ...number[]], number>>(true);\nexpectType<AllExtend<[1, 2?, 3?, ...Array<number | undefined>], number>>({} as boolean);\nexpectType<AllExtend<[1?, 2?, 3?, ...string[]], number>>(false);\n\n// Labelled tuples\nexpectType<AllExtend<[x: string, y: string], string>>(true);\nexpectType<AllExtend<[x?: string, y?: number], string>>(false);\nexpectType<AllExtend<[x?: number, y?: number, ...rest: number[]], number>>(true);\nexpectType<AllExtend<[...rest: number[], z: string], number>>(false);\n\n// Non-tuple arrays\nexpectType<AllExtend<string[], string>>(true);\nexpectType<AllExtend<Array<string | number>, number>>({} as boolean);\nexpectType<AllExtend<ReadonlyArray<string | undefined>, string>>({} as boolean);\nexpectType<AllExtend<[...readonly boolean[]], string>>(false);\n\n// Unions\nexpectType<AllExtend<[1, 2, 3] | [4, 5, 6], number>>(true); // Both `true`\nexpectType<AllExtend<[1, 2, '3'] | [4, 5, '6'], number>>(false); // Both `false`\nexpectType<AllExtend<[1, 2, 3] | ['1', '2', 3], number>>({} as boolean); // One `true`, one `false`\nexpectType<AllExtend<[true, true] | [true, boolean], true>>({} as boolean); // One `true`, one `boolean`\nexpectType<AllExtend<[true, false] | [true, boolean], true>>({} as boolean); // One `false`, one `boolean`\n\nexpectType<AllExtend<[string, string, ...string[]] | [number, number, ...number[]], number | string>>(true);\nexpectType<AllExtend<readonly [(number | bigint)?, ...string[]] | [0, 'a', 'b'] | [...ReadonlyArray<string | number>, 1], string>>(false);\nexpectType<AllExtend<string[] | [...ReadonlyArray<string | number>, string], string>>({} as boolean);\nexpectType<AllExtend<readonly number[] | [...rest: number[], l1: number, l2: number] | [number?, string?, ...string[]], number>>(\n\t{} as boolean,\n);\n\n// Boundary cases\nexpectType<AllExtend<[], any>>(true);\nexpectType<AllExtend<[], never>>(true);\nexpectType<AllExtend<[1, 2, '3', true, false, string[], never], any>>(true);\nexpectType<AllExtend<[any, any], any>>(true);\nexpectType<AllExtend<[never, never], any>>(true);\nexpectType<AllExtend<[never, 1], any>>(true);\nexpectType<AllExtend<[1, never], any>>(true);\nexpectType<AllExtend<unknown[], any>>(true);\nexpectType<AllExtend<[1, 2], never>>(false);\nexpectType<AllExtend<[never, never], never>>(true);\nexpectType<AllExtend<[never, never, number], never>>(false);\nexpectType<AllExtend<[number, never, never], never>>(false);\nexpectType<AllExtend<[never, number, never, any, never], never>>(false);\nexpectType<AllExtend<[never, any, never, any], never>>({} as boolean);\nexpectType<AllExtend<[1, 2, any], number>>({} as boolean);\nexpectType<AllExtend<[1, 2, never], number>>(false);\nexpectType<AllExtend<[1, 2, ...never[]], number>>(false);\n\nexpectType<AllExtend<[1, 2, ...any[]], number>>({} as boolean);\nexpectType<AllExtend<[...any[], 1, 2], number>>({} as boolean);\nexpectType<AllExtend<['a', 'b', ...any[], Uppercase<string>, `${number}`], string>>({} as boolean);\nexpectType<AllExtend<[1, 2, ...string[]], any>>(true);\nexpectType<AllExtend<[...number[], never, never], any>>(true);\nexpectType<AllExtend<['a', 'b', ...any[], 1, 2], any>>(true);\nexpectType<AllExtend<[never, ...never[], never], any>>(true);\nexpectType<AllExtend<[never, never, ...number[]], never>>(false);\nexpectType<AllExtend<[never, ...never[], never], never>>(true);\nexpectType<AllExtend<[...never[], never, string], never>>(false);\nexpectType<AllExtend<[never, ...any[], never], never>>({} as boolean);\n\n// === strictNever: false ===\ntype NonStrictNeverAllExtend<TArray extends UnknownArray, Type> = AllExtend<TArray, Type, {strictNever: false}>;\n\nexpectType<NonStrictNeverAllExtend<[1, 2, never], number>>(true);\nexpectType<NonStrictNeverAllExtend<[1, 2, ...never[]], number>>(true);\nexpectType<NonStrictNeverAllExtend<[...never[], 'a', 'b'], string>>(true);\nexpectType<NonStrictNeverAllExtend<[never, never], never>>(true);\nexpectType<NonStrictNeverAllExtend<[never, ...never[], never], any>>(true);\nexpectType<NonStrictNeverAllExtend<[1, 2, never, ...never[]], any>>(true);\nexpectType<NonStrictNeverAllExtend<[never, number], never>>(false);\nexpectType<NonStrictNeverAllExtend<[never, any, never, any], never>>({} as boolean);\n\nexpectType<AllExtend<any, never>>(false);\nexpectType<AllExtend<never, any>>(false);\n"
  },
  {
    "path": "test-d/all-union-fields.ts",
    "content": "import {expectType} from 'tsd';\nimport type {AllUnionFields, Simplify} from '../index.d.ts';\nimport type {NonRecursiveType} from '../source/internal/index.d.ts';\n\ntype TestingType = {\n\tfunction: () => void;\n\trecord: Record<\n\t\tstring,\n\t\t{\n\t\t\tpropertyA: string;\n\t\t}\n\t>;\n\tobject: {\n\t\tsubObject: {\n\t\t\tsubSubObject: {\n\t\t\t\tpropertyA: string;\n\t\t\t};\n\t\t};\n\t};\n\tstring: string;\n\tunion: 'test1' | 'test2';\n\tnumber: number;\n\tboolean: boolean;\n\tdate: Date;\n\tregexp: RegExp;\n\tsymbol: symbol;\n\tnull: null;\n\tundefined: undefined;\n\toptional?: boolean | undefined;\n\treadonly propertyWithKeyword: boolean;\n\tmap: Map<string, {propertyA: string; propertyB: string}>;\n\tset: Set<string>;\n\tobjectSet: Set<{propertyA: string; propertyB: string}>;\n};\n\ndeclare const normal: AllUnionFields<\nTestingType | {string: string; number: number; foo: any}\n>;\nexpectType<Simplify<\n\t{\n\t\tstring: string;\n\t\tnumber: number;\n\t\tfoo?: any;\n\t} & Partial<Omit<TestingType, 'string' | 'number'>>\n>>(normal);\n\ndeclare const unMatched: AllUnionFields<TestingType | {foo: any}>;\nexpectType<Simplify<\n\t{\n\t\tfoo?: any;\n\t} & Partial<TestingType>\n>>(unMatched);\n\ndeclare const number: AllUnionFields<TestingType | {number: number; foo: any}>;\nexpectType<Simplify<{\n\tnumber: number;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'number'>>\n>>(number);\n\ndeclare const string: AllUnionFields<TestingType | {string: string; foo: any}>;\nexpectType<Simplify<{\n\tstring: string;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'string'>>\n>>(string);\n\ndeclare const boolean: AllUnionFields<TestingType | {boolean: boolean; foo: any}>;\nexpectType<Simplify<{\n\tboolean: boolean;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'boolean'>>\n>>(boolean);\n\ndeclare const date: AllUnionFields<TestingType | {date: Date; foo: any}>;\nexpectType<Simplify<{\n\tdate: Date;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'date'>>\n>>(date);\n\ndeclare const regexp: AllUnionFields<TestingType | {regexp: RegExp; foo: any}>;\nexpectType<Simplify<{\n\tregexp: RegExp;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'regexp'>>\n>>(regexp);\n\ndeclare const symbol: AllUnionFields<TestingType | {symbol: symbol; foo: any}>;\nexpectType<Simplify<{\n\tsymbol: symbol;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'symbol'>>\n>>(symbol);\n\ndeclare const null_: AllUnionFields<TestingType | {null: null; foo: any}>;\nexpectType<Simplify<{\n\tnull: null;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'null'>>\n>>(null_);\n\ndeclare const undefined_: AllUnionFields<TestingType | {undefined: undefined; foo: any}>;\nexpectType<Simplify<{\n\tundefined: undefined;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'undefined'>>\n>>(undefined_);\n\ndeclare const optional: AllUnionFields<TestingType | {optional: string; foo: any}>;\nexpectType<Simplify<{\n\toptional?: string | boolean | undefined;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'optional'>>\n>>(optional);\n\ndeclare const propertyWithKeyword: AllUnionFields<TestingType | {readonly propertyWithKeyword: string; foo: any}>;\nexpectType<Simplify<{\n\treadonly propertyWithKeyword: boolean | string;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'propertyWithKeyword'>>\n>>(propertyWithKeyword);\n\ndeclare const map: AllUnionFields<TestingType | {map: Map<string, {propertyA: string}>; foo: any}>;\nexpectType<Simplify<{\n\tmap: TestingType['map'] | Map<string, {propertyA: string}>;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'map'>>\n>>(map);\n\ndeclare const set: AllUnionFields<TestingType | {set: Set<number>; foo: any}>;\nexpectType<Simplify<{\n\tset: TestingType['set'] | Set<number>;\n\tfoo?: any;\n} & Partial<Omit<TestingType, 'set'>>\n>>(set);\n\ndeclare const moreUnion: AllUnionFields<TestingType | {string: string; number: number; foo: any} | {string: string; bar: any}>;\nexpectType<Simplify<{\n\tstring: string;\n\tfoo?: any;\n\tbar?: any;\n} & Partial<Omit<TestingType, 'string'>>\n>>(moreUnion);\n\ndeclare const union: AllUnionFields<TestingType | {union: {a: number}}>;\nexpectType<Simplify<{\n\tunion: 'test1' | 'test2' | {a: number};\n} & Partial<Omit<TestingType, 'union'>>\n>>(union);\n\ndeclare const unionWithOptional: AllUnionFields<{a?: string; foo: number} | {a: string; bar: string}>;\nexpectType<{\n\ta?: string;\n\tfoo?: number;\n\tbar?: string;\n}>(unionWithOptional);\n\ndeclare const mixedKeywords: AllUnionFields<{readonly a: string; b: number} | {a: string; readonly b: string}>;\nexpectType<{\n\treadonly a: string;\n\treadonly b: string | number;\n}>(mixedKeywords);\n\ndeclare const mixedKeywords2: AllUnionFields<{readonly a: string; b: number} | {a: string; readonly b: string} | {readonly c: number}>;\nexpectType<{\n\treadonly a?: string;\n\treadonly b?: string | number;\n\treadonly c?: number;\n}>(mixedKeywords2);\n\n// Non-recursive types\nexpectType<Set<string> | Map<string, string>>({} as AllUnionFields<Set<string> | Map<string, string>>);\nexpectType<string[] | Set<string>>({} as AllUnionFields<string[] | Set<string>>);\nexpectType<NonRecursiveType>({} as AllUnionFields<NonRecursiveType>);\n\n// Mix of non-recursive and recursive types\nexpectType<{a: string | number; b?: true} | undefined>({} as AllUnionFields<{a: string} | {a: number; b: true} | undefined>);\nexpectType<RegExp | {test: string}>({} as AllUnionFields<RegExp | {test: string}>);\nexpectType<RegExp | null | {test: string | number; foo?: any}>({} as AllUnionFields<RegExp | null | {test: string} | {test: number; foo: any}>);\n\n// Boundary types\nexpectType<any>({} as AllUnionFields<any>);\nexpectType<never>({} as AllUnionFields<never>);\n"
  },
  {
    "path": "test-d/and-all.ts",
    "content": "import {expectType} from 'tsd';\nimport type {AndAll} from '../source/and-all.d.ts';\n\ndeclare const boolean: boolean;\n\n// Basic boolean combinations\nexpectType<AndAll<[true, true]>>(true);\nexpectType<AndAll<[true, false]>>(false);\nexpectType<AndAll<[false, true]>>(false);\nexpectType<AndAll<[false, false]>>(false);\n\n// Multiple elements in a tuple\nexpectType<AndAll<[true, true, true, true]>>(true);\nexpectType<AndAll<[true, true, true, false]>>(false);\nexpectType<AndAll<[true, true, false, true]>>(false);\n\n// `boolean` element\nexpectType<AndAll<[true, true, boolean]>>(boolean);\nexpectType<AndAll<[true, boolean, false]>>(false);\nexpectType<AndAll<[boolean, boolean, boolean]>>(boolean);\n\n// Unions\nexpectType<AndAll<[true, true, true] | [true, true, false]>>(boolean); // `true` | `false`\nexpectType<AndAll<[true, true] | [true]>>(true); // `true` | `true`\nexpectType<AndAll<[false] | [true, false, true]>>(false); // `false` | `false`\nexpectType<AndAll<[true, true] | [true, boolean]>>(boolean); // `true` | `boolean`\nexpectType<AndAll<[false, true] | [true, true, boolean]>>(boolean); // `false` | `boolean`\nexpectType<AndAll<[boolean, true, true] | [boolean]>>(boolean); // `boolean` | `boolean`\n\n// Tuples with rest element\nexpectType<AndAll<[true, ...Array<true>]>>(true);\nexpectType<AndAll<[...Array<true>, false]>>(false);\nexpectType<AndAll<[true, ...Array<true>, boolean]>>(boolean);\n\n// Non-tuple arrays\nexpectType<AndAll<Array<true>>>(true);\nexpectType<AndAll<Array<false>>>(false);\nexpectType<AndAll<boolean[]>>(boolean);\n\n// Readonly arrays\nexpectType<AndAll<readonly [true, true, true]>>(true);\nexpectType<AndAll<readonly [true, true, false]>>(false);\nexpectType<AndAll<readonly [true, true, boolean]>>(boolean);\nexpectType<AndAll<ReadonlyArray<true>>>(true);\nexpectType<AndAll<ReadonlyArray<false>>>(false);\nexpectType<AndAll<readonly boolean[]>>(boolean);\n\n// Boundary cases\nexpectType<AndAll<[]>>(true);\n\nexpectType<AndAll<[any, any, false]>>(false);\nexpectType<AndAll<[any, any, true]>>(boolean);\nexpectType<AndAll<[any, any, any]>>(boolean);\n\nexpectType<AndAll<[false, never, never]>>(false);\nexpectType<AndAll<[true, true, never]>>(false);\nexpectType<AndAll<[never, never, never]>>(false);\n\n// Errors with non-boolean or optional elements\n// @ts-expect-error\ntype Error1 = AndAll<[1, 0]>;\n// @ts-expect-error\ntype Error2 = AndAll<[true, false?]>;\n"
  },
  {
    "path": "test-d/and.ts",
    "content": "import {expectType} from 'tsd';\nimport type {And} from '../source/and.d.ts';\n\ndeclare const boolean: boolean;\n\nexpectType<And<true, true>>(true);\nexpectType<And<true, false>>(false);\nexpectType<And<false, true>>(false);\nexpectType<And<false, false>>(false);\n\nexpectType<And<true, boolean>>(boolean);\nexpectType<And<boolean, true>>(boolean);\nexpectType<And<false, boolean>>(false);\nexpectType<And<boolean, false>>(false);\nexpectType<And<boolean, boolean>>(boolean);\n\n// Boundary cases\nexpectType<And<any, true>>(boolean);\nexpectType<And<true, any>>(boolean);\nexpectType<And<any, false>>(false);\nexpectType<And<false, any>>(false);\nexpectType<And<any, boolean>>(boolean);\nexpectType<And<boolean, any>>(boolean);\nexpectType<And<any, any>>(boolean);\n\nexpectType<And<never, true>>(false);\nexpectType<And<true, never>>(false);\nexpectType<And<never, false>>(false);\nexpectType<And<false, never>>(false);\nexpectType<And<never, boolean>>(false);\nexpectType<And<boolean, never>>(false);\nexpectType<And<never, never>>(false);\n"
  },
  {
    "path": "test-d/array-element.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ArrayElement} from '../index.d.ts';\n\n// Basic array\nexpectType<string>({} as ArrayElement<string[]>);\nexpectType<number>({} as ArrayElement<number[]>);\n\n// Tuple\nexpectType<1 | 2 | 3>({} as ArrayElement<[1, 2, 3]>);\nexpectType<'a' | 'b' | 'c'>({} as ArrayElement<['a', 'b', 'c']>);\n\n// Const tuple\nexpectType<'foo' | 'bar' | 'baz'>({} as ArrayElement<readonly ['foo', 'bar', 'baz']>);\nexpectType<1 | 2 | 3>({} as ArrayElement<readonly [1, 2, 3]>);\n\n// Mixed types\nexpectType<string | number>({} as ArrayElement<[string, number]>);\nexpectType<string | number>({} as ArrayElement<[string, number]>);\n\n// Readonly array\nexpectType<string>({} as ArrayElement<readonly string[]>);\nexpectType<1 | 2 | 3>({} as ArrayElement<readonly [1, 2, 3]>);\n\n// Empty array\nexpectType<never>({} as ArrayElement<[]>);\nexpectType<never>({} as ArrayElement<readonly []>);\n\n// Union of arrays\nexpectType<1 | 2 | 3 | 4>({} as ArrayElement<[1, 2] | [3, 4]>);\n\n// Function use case\ndeclare function getRandomElement<T extends readonly unknown[]>(array: T): ArrayElement<T>;\n\nexpectType<number>(getRandomElement([1, 2, 3]));\nexpectType<'foo' | 'bar' | 'baz'>(getRandomElement(['foo', 'bar', 'baz'] as const));\nexpectType<string>(getRandomElement(['foo', 'bar', 'baz']));\n\n// Edge cases\nexpectType<any>({} as ArrayElement<any>);\nexpectType<never>({} as ArrayElement<never>);\nexpectType<unknown>({} as ArrayElement<unknown[]>);\n\n// Non-arrays return never\nexpectType<never>({} as ArrayElement<string>);\nexpectType<never>({} as ArrayElement<{a: string}>);\n\n// Optional and rest elements\nexpectType<1 | 2 | 3 | undefined>(1 as ArrayElement<[1, 2, 3?]>);\nexpectType<string | number>(1 as ArrayElement<[string, ...number[]]>);\nexpectType<1 | 2 | string>(1 as ArrayElement<[1, 2, ...string[]]>);\nexpectType<1 | 2 | undefined | string>(1 as ArrayElement<[1, 2?, ...string[]]>);\n"
  },
  {
    "path": "test-d/array-indices.ts",
    "content": "import {expectNotAssignable, expectType, expectAssignable} from 'tsd';\nimport type {ArrayIndices} from '../index.d.ts';\n\nconst values = ['a', 'b', 'c'] as const;\ntype ValueKeys = ArrayIndices<typeof values>;\n\ndeclare const test: 0 | 1 | 2;\nexpectType<ValueKeys>(test);\n\nexpectAssignable<ValueKeys>(0);\nexpectAssignable<ValueKeys>(1);\nexpectAssignable<ValueKeys>(2);\n\nexpectNotAssignable<ValueKeys>(-1);\nexpectNotAssignable<ValueKeys>(3);\n\ntype TupleKeys = ArrayIndices<['a', 2]>;\n\ndeclare const testTuple: 0 | 1;\nexpectType<TupleKeys>(testTuple);\n\nexpectAssignable<TupleKeys>(0);\nexpectAssignable<TupleKeys>(1);\n\nexpectNotAssignable<TupleKeys>(-1);\nexpectNotAssignable<TupleKeys>(2);\n"
  },
  {
    "path": "test-d/array-length.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ArrayLength, Primitive} from '../index.d.ts';\n\n// Non-tuples\nexpectType<number>({} as ArrayLength<unknown[]>);\n\n// Tuples\nexpectType<0>({} as ArrayLength<[]>);\nexpectType<1>({} as ArrayLength<[never]>);\nexpectType<3>({} as ArrayLength<['one', 2, true]>);\nexpectType<2 | 3 | 4>({} as ArrayLength<[number, string, boolean?, boolean?]>);\n\nexpectType<number>({} as ArrayLength<[1, 2, ...unknown[]]>);\nexpectType<number>({} as ArrayLength<[1, 2?, ...unknown[]]>);\nexpectType<number>({} as ArrayLength<[...unknown[], 1, 2]>);\nexpectType<number>({} as ArrayLength<[0, ...unknown[], 1, 2]>);\n\n// Read-only arrays\nexpectType<number>({} as ArrayLength<readonly unknown[]>);\nexpectType<number>({} as ArrayLength<readonly never[]>);\nexpectType<0>({} as ArrayLength<readonly []>);\nexpectType<1>({} as ArrayLength<readonly [never]>);\nexpectType<3>({} as ArrayLength<readonly ['one', 2, true]>);\nexpectType<2 | 3 | 4>({} as ArrayLength<readonly [number, string, boolean?, boolean?]>);\n\nexpectType<number>({} as ArrayLength<readonly [1, 2, ...unknown[]]>);\nexpectType<number>({} as ArrayLength<readonly [1, 2?, ...unknown[]]>);\nexpectType<number>({} as ArrayLength<readonly [...unknown[], 1, 2]>);\nexpectType<number>({} as ArrayLength<readonly [0, ...unknown[], 1, 2]>);\n\n// Unions\nexpectType<0 | 2>({} as ArrayLength<[] | [1, 2]>);\nexpectType<0 | 2>({} as ArrayLength<readonly [] | readonly [1, 2]>);\nexpectType<0 | 2>({} as ArrayLength<[] | readonly [1, 2]>);\nexpectType<1 | 2 | 3 | 4>({} as ArrayLength<[1, 2?, 3?] | ['one', 'two', 'three', 'four']>);\nexpectType<number>({} as ArrayLength<readonly [1] | [1, ...number[]]>);\n\n// Edge cases and disallowed types\nexpectType<never>({} as ArrayLength<never>);\nexpectType<any>({} as ArrayLength<any>);\n\n// @ts-expect-error\ntype DisallowedPrimitive = ArrayLength<string>;\n// @ts-expect-error\ntype DisallowedPrimitives = ArrayLength<Primitive>;\n// @ts-expect-error\ntype DisallowedObject = ArrayLength<{}>;\n// @ts-expect-error\ntype DisallowedMap = ArrayLength<Map<string, number>>;\n// @ts-expect-error\ntype DisallowedSet = ArrayLength<Set<number>>;\n// @ts-expect-error\ntype DisallowedRecord = ArrayLength<Record<string, unknown>>;\n// @ts-expect-error\ntype DisallowedObjectWithLength = ArrayLength<{length: number}>;\n"
  },
  {
    "path": "test-d/array-reverse.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ArrayReverse} from '../source/array-reverse.d.ts';\nimport type {TupleOf} from '../source/tuple-of.d.ts';\nimport type {IntRange} from '../source/int-range.d.ts';\n\n// Empty & single-element tuples\nexpectType<[]>({} as ArrayReverse<[]>);\nexpectType<readonly []>({} as ArrayReverse<readonly []>);\nexpectType<[string]>({} as ArrayReverse<[string]>);\nexpectType<readonly [number]>({} as ArrayReverse<readonly [number]>);\nexpectType<[any]>({} as ArrayReverse<[any]>);\nexpectType<[never]>({} as ArrayReverse<[never]>);\n\n// Only required elements\nexpectType<[3, 2, 1]>({} as ArrayReverse<[1, 2, 3]>);\nexpectType<readonly [string, number, boolean, bigint]>({} as ArrayReverse<readonly [bigint, boolean, number, string]>);\nexpectType<['a' | 1, 2, 'c' | 3]>({} as ArrayReverse<['c' | 3, 2, 'a' | 1]>);\n\n// Required and rest element\nexpectType<readonly [...string[], 3, 2, 1]>({} as ArrayReverse<readonly [1, 2, 3, ...string[]]>); // Rest element at the end\nexpectType<['z', 'y', 'x', ...boolean[], 3, 2, 1]>({} as ArrayReverse<[1, 2, 3, ...boolean[], 'x', 'y', 'z']>); // Rest element in the middle\nexpectType<readonly [string, ...bigint[]]>({} as ArrayReverse<readonly [...bigint[], string]>); // Rest element at the start\n\n// Required and optional elements\nexpectType<[3, 2, 1] | [2, 1]>({} as ArrayReverse<[1, 2, 3?]>);\nexpectType<readonly [3, 2, 1] | readonly [2, 1] | readonly [1]>({} as ArrayReverse<readonly [1, 2?, 3?]>);\nexpectType<[number, boolean, bigint, number, string] | [boolean, bigint, number, string] | [bigint, number, string] | [number, string]>(\n\t{} as ArrayReverse<[string, number, bigint?, boolean?, number?]>,\n);\n\n// Only optional elements\nexpectType<['a'] | []>({} as ArrayReverse<['a'?]>);\nexpectType<readonly [{data: string[]}] | readonly []>({} as ArrayReverse<readonly [{data: string[]}?]>);\nexpectType<[bigint, boolean, string] | [boolean, string] | [string] | []>({} as ArrayReverse<[string?, boolean?, bigint?]>);\n\n// Required, optional, and rest element\nexpectType<[...string[], 3, 2, 1] | [2, 1]>({} as ArrayReverse<[1, 2, 3?, ...string[]]>);\nexpectType<readonly [...string[], string, number] | readonly [number]>({} as ArrayReverse<readonly [number, string?, ...string[]]>);\n\n// Optional and rest element\nexpectType<readonly [...string[], 1] | readonly []>({} as ArrayReverse<readonly [1?, ...string[]]>);\nexpectType<[...number[], 3, 2, 1] | [2, 1] | [1] | []>({} as ArrayReverse<[1?, 2?, 3?, ...number[]]>);\n\n// Nested tuples\nexpectType<[6, 5, [3, 4], [1, 2]]>({} as ArrayReverse<[[1, 2], [3, 4], 5, 6]>);\nexpectType<[Array<{y: string}>, Array<{x: string}>]>({} as ArrayReverse<[Array<{x: string}>, Array<{y: string}>]>);\nexpectType<[3, [1, 2]] | [[1, 2]] | []>({} as ArrayReverse<[[1, 2]?, 3?]>);\n\n// Unions\nexpectType<[3, 2, 1] | readonly ['b', 'a']>({} as ArrayReverse<[1, 2, 3] | readonly ['a', 'b']>);\nexpectType<readonly [number, string] | number[]>({} as ArrayReverse<readonly [string, number] | number[]>);\nexpectType<readonly [3, 2, 1] | readonly [2, 1] | readonly [1] | ['b', 'a'] | ['a'] | [] | [number, string]>(\n\t{} as ArrayReverse<readonly [1, 2?, 3?] | ['a'?, 'b'?] | [string, number]>,\n);\n\n// Labelled tuples\nexpectType<[number, number]>({} as ArrayReverse<[x: number, y: number]>);\nexpectType<readonly [number, string] | readonly [string]>({} as ArrayReverse<readonly [x: string, y?: number]>);\nexpectType<[...number[], string]>({} as ArrayReverse<[x: string, ...rest: number[]]>);\n\n// Non-tuple arrays\nexpectType<string[]>({} as ArrayReverse<string[]>);\nexpectType<readonly number[]>({} as ArrayReverse<readonly number[]>);\nexpectType<ReadonlyArray<number | bigint>>({} as ArrayReverse<ReadonlyArray<number | bigint>>);\nexpectType<any[]>({} as ArrayReverse<any[]>);\nexpectType<never[]>({} as ArrayReverse<never[]>);\n\n// Long Tuples\ntype FirstFiftyIntegers = [\n\t1, 2, 3, 4, 5, 6, 7, 8, 9, 10,\n\t11, 12, 13, 14, 15, 16, 17, 18, 19, 20,\n\t21, 22, 23, 24, 25, 26, 27, 28, 29, 30,\n\t31, 32, 33, 34, 35, 36, 37, 38, 39, 40,\n\t41, 42, 43, 44, 45, 46, 47, 48, 49, 50,\n];\n\ntype FirstFiftyIntegersReversed = [\n\t50, 49, 48, 47, 46, 45, 44, 43, 42, 41,\n\t40, 39, 38, 37, 36, 35, 34, 33, 32, 31,\n\t30, 29, 28, 27, 26, 25, 24, 23, 22, 21,\n\t20, 19, 18, 17, 16, 15, 14, 13, 12, 11,\n\t10, 9, 8, 7, 6, 5, 4, 3, 2, 1,\n];\n\nexpectType<FirstFiftyIntegersReversed>({} as ArrayReverse<FirstFiftyIntegers>);\n\nexpectType<TupleOf<IntRange<0, 51>, number>>({} as ArrayReverse<Partial<TupleOf<50, number>>>);\n\ntype FirstNineHundredNinetyNineIntegers = [\n\t1, 2, 3, 4, 5, 6, 7, 8, 9, 10,\n\t11, 12, 13, 14, 15, 16, 17, 18, 19, 20,\n\t21, 22, 23, 24, 25, 26, 27, 28, 29, 30,\n\t31, 32, 33, 34, 35, 36, 37, 38, 39, 40,\n\t41, 42, 43, 44, 45, 46, 47, 48, 49, 50,\n\t51, 52, 53, 54, 55, 56, 57, 58, 59, 60,\n\t61, 62, 63, 64, 65, 66, 67, 68, 69, 70,\n\t71, 72, 73, 74, 75, 76, 77, 78, 79, 80,\n\t81, 82, 83, 84, 85, 86, 87, 88, 89, 90,\n\t91, 92, 93, 94, 95, 96, 97, 98, 99, 100,\n\t101, 102, 103, 104, 105, 106, 107, 108, 109, 110,\n\t111, 112, 113, 114, 115, 116, 117, 118, 119, 120,\n\t121, 122, 123, 124, 125, 126, 127, 128, 129, 130,\n\t131, 132, 133, 134, 135, 136, 137, 138, 139, 140,\n\t141, 142, 143, 144, 145, 146, 147, 148, 149, 150,\n\t151, 152, 153, 154, 155, 156, 157, 158, 159, 160,\n\t161, 162, 163, 164, 165, 166, 167, 168, 169, 170,\n\t171, 172, 173, 174, 175, 176, 177, 178, 179, 180,\n\t181, 182, 183, 184, 185, 186, 187, 188, 189, 190,\n\t191, 192, 193, 194, 195, 196, 197, 198, 199, 200,\n\t201, 202, 203, 204, 205, 206, 207, 208, 209, 210,\n\t211, 212, 213, 214, 215, 216, 217, 218, 219, 220,\n\t221, 222, 223, 224, 225, 226, 227, 228, 229, 230,\n\t231, 232, 233, 234, 235, 236, 237, 238, 239, 240,\n\t241, 242, 243, 244, 245, 246, 247, 248, 249, 250,\n\t251, 252, 253, 254, 255, 256, 257, 258, 259, 260,\n\t261, 262, 263, 264, 265, 266, 267, 268, 269, 270,\n\t271, 272, 273, 274, 275, 276, 277, 278, 279, 280,\n\t281, 282, 283, 284, 285, 286, 287, 288, 289, 290,\n\t291, 292, 293, 294, 295, 296, 297, 298, 299, 300,\n\t301, 302, 303, 304, 305, 306, 307, 308, 309, 310,\n\t311, 312, 313, 314, 315, 316, 317, 318, 319, 320,\n\t321, 322, 323, 324, 325, 326, 327, 328, 329, 330,\n\t331, 332, 333, 334, 335, 336, 337, 338, 339, 340,\n\t341, 342, 343, 344, 345, 346, 347, 348, 349, 350,\n\t351, 352, 353, 354, 355, 356, 357, 358, 359, 360,\n\t361, 362, 363, 364, 365, 366, 367, 368, 369, 370,\n\t371, 372, 373, 374, 375, 376, 377, 378, 379, 380,\n\t381, 382, 383, 384, 385, 386, 387, 388, 389, 390,\n\t391, 392, 393, 394, 395, 396, 397, 398, 399, 400,\n\t401, 402, 403, 404, 405, 406, 407, 408, 409, 410,\n\t411, 412, 413, 414, 415, 416, 417, 418, 419, 420,\n\t421, 422, 423, 424, 425, 426, 427, 428, 429, 430,\n\t431, 432, 433, 434, 435, 436, 437, 438, 439, 440,\n\t441, 442, 443, 444, 445, 446, 447, 448, 449, 450,\n\t451, 452, 453, 454, 455, 456, 457, 458, 459, 460,\n\t461, 462, 463, 464, 465, 466, 467, 468, 469, 470,\n\t471, 472, 473, 474, 475, 476, 477, 478, 479, 480,\n\t481, 482, 483, 484, 485, 486, 487, 488, 489, 490,\n\t491, 492, 493, 494, 495, 496, 497, 498, 499, 500,\n\t501, 502, 503, 504, 505, 506, 507, 508, 509, 510,\n\t511, 512, 513, 514, 515, 516, 517, 518, 519, 520,\n\t521, 522, 523, 524, 525, 526, 527, 528, 529, 530,\n\t531, 532, 533, 534, 535, 536, 537, 538, 539, 540,\n\t541, 542, 543, 544, 545, 546, 547, 548, 549, 550,\n\t551, 552, 553, 554, 555, 556, 557, 558, 559, 560,\n\t561, 562, 563, 564, 565, 566, 567, 568, 569, 570,\n\t571, 572, 573, 574, 575, 576, 577, 578, 579, 580,\n\t581, 582, 583, 584, 585, 586, 587, 588, 589, 590,\n\t591, 592, 593, 594, 595, 596, 597, 598, 599, 600,\n\t601, 602, 603, 604, 605, 606, 607, 608, 609, 610,\n\t611, 612, 613, 614, 615, 616, 617, 618, 619, 620,\n\t621, 622, 623, 624, 625, 626, 627, 628, 629, 630,\n\t631, 632, 633, 634, 635, 636, 637, 638, 639, 640,\n\t641, 642, 643, 644, 645, 646, 647, 648, 649, 650,\n\t651, 652, 653, 654, 655, 656, 657, 658, 659, 660,\n\t661, 662, 663, 664, 665, 666, 667, 668, 669, 670,\n\t671, 672, 673, 674, 675, 676, 677, 678, 679, 680,\n\t681, 682, 683, 684, 685, 686, 687, 688, 689, 690,\n\t691, 692, 693, 694, 695, 696, 697, 698, 699, 700,\n\t701, 702, 703, 704, 705, 706, 707, 708, 709, 710,\n\t711, 712, 713, 714, 715, 716, 717, 718, 719, 720,\n\t721, 722, 723, 724, 725, 726, 727, 728, 729, 730,\n\t731, 732, 733, 734, 735, 736, 737, 738, 739, 740,\n\t741, 742, 743, 744, 745, 746, 747, 748, 749, 750,\n\t751, 752, 753, 754, 755, 756, 757, 758, 759, 760,\n\t761, 762, 763, 764, 765, 766, 767, 768, 769, 770,\n\t771, 772, 773, 774, 775, 776, 777, 778, 779, 780,\n\t781, 782, 783, 784, 785, 786, 787, 788, 789, 790,\n\t791, 792, 793, 794, 795, 796, 797, 798, 799, 800,\n\t801, 802, 803, 804, 805, 806, 807, 808, 809, 810,\n\t811, 812, 813, 814, 815, 816, 817, 818, 819, 820,\n\t821, 822, 823, 824, 825, 826, 827, 828, 829, 830,\n\t831, 832, 833, 834, 835, 836, 837, 838, 839, 840,\n\t841, 842, 843, 844, 845, 846, 847, 848, 849, 850,\n\t851, 852, 853, 854, 855, 856, 857, 858, 859, 860,\n\t861, 862, 863, 864, 865, 866, 867, 868, 869, 870,\n\t871, 872, 873, 874, 875, 876, 877, 878, 879, 880,\n\t881, 882, 883, 884, 885, 886, 887, 888, 889, 890,\n\t891, 892, 893, 894, 895, 896, 897, 898, 899, 900,\n\t901, 902, 903, 904, 905, 906, 907, 908, 909, 910,\n\t911, 912, 913, 914, 915, 916, 917, 918, 919, 920,\n\t921, 922, 923, 924, 925, 926, 927, 928, 929, 930,\n\t931, 932, 933, 934, 935, 936, 937, 938, 939, 940,\n\t941, 942, 943, 944, 945, 946, 947, 948, 949, 950,\n\t951, 952, 953, 954, 955, 956, 957, 958, 959, 960,\n\t961, 962, 963, 964, 965, 966, 967, 968, 969, 970,\n\t971, 972, 973, 974, 975, 976, 977, 978, 979, 980,\n\t981, 982, 983, 984, 985, 986, 987, 988, 989, 990,\n\t991, 992, 993, 994, 995, 996, 997, 998, 999,\n];\n\ntype FirstNineHundredNinetyNineIntegersReversed = [\n\t999, 998, 997, 996, 995, 994, 993, 992, 991, 990,\n\t989, 988, 987, 986, 985, 984, 983, 982, 981, 980,\n\t979, 978, 977, 976, 975, 974, 973, 972, 971, 970,\n\t969, 968, 967, 966, 965, 964, 963, 962, 961, 960,\n\t959, 958, 957, 956, 955, 954, 953, 952, 951, 950,\n\t949, 948, 947, 946, 945, 944, 943, 942, 941, 940,\n\t939, 938, 937, 936, 935, 934, 933, 932, 931, 930,\n\t929, 928, 927, 926, 925, 924, 923, 922, 921, 920,\n\t919, 918, 917, 916, 915, 914, 913, 912, 911, 910,\n\t909, 908, 907, 906, 905, 904, 903, 902, 901, 900,\n\t899, 898, 897, 896, 895, 894, 893, 892, 891, 890,\n\t889, 888, 887, 886, 885, 884, 883, 882, 881, 880,\n\t879, 878, 877, 876, 875, 874, 873, 872, 871, 870,\n\t869, 868, 867, 866, 865, 864, 863, 862, 861, 860,\n\t859, 858, 857, 856, 855, 854, 853, 852, 851, 850,\n\t849, 848, 847, 846, 845, 844, 843, 842, 841, 840,\n\t839, 838, 837, 836, 835, 834, 833, 832, 831, 830,\n\t829, 828, 827, 826, 825, 824, 823, 822, 821, 820,\n\t819, 818, 817, 816, 815, 814, 813, 812, 811, 810,\n\t809, 808, 807, 806, 805, 804, 803, 802, 801, 800,\n\t799, 798, 797, 796, 795, 794, 793, 792, 791, 790,\n\t789, 788, 787, 786, 785, 784, 783, 782, 781, 780,\n\t779, 778, 777, 776, 775, 774, 773, 772, 771, 770,\n\t769, 768, 767, 766, 765, 764, 763, 762, 761, 760,\n\t759, 758, 757, 756, 755, 754, 753, 752, 751, 750,\n\t749, 748, 747, 746, 745, 744, 743, 742, 741, 740,\n\t739, 738, 737, 736, 735, 734, 733, 732, 731, 730,\n\t729, 728, 727, 726, 725, 724, 723, 722, 721, 720,\n\t719, 718, 717, 716, 715, 714, 713, 712, 711, 710,\n\t709, 708, 707, 706, 705, 704, 703, 702, 701, 700,\n\t699, 698, 697, 696, 695, 694, 693, 692, 691, 690,\n\t689, 688, 687, 686, 685, 684, 683, 682, 681, 680,\n\t679, 678, 677, 676, 675, 674, 673, 672, 671, 670,\n\t669, 668, 667, 666, 665, 664, 663, 662, 661, 660,\n\t659, 658, 657, 656, 655, 654, 653, 652, 651, 650,\n\t649, 648, 647, 646, 645, 644, 643, 642, 641, 640,\n\t639, 638, 637, 636, 635, 634, 633, 632, 631, 630,\n\t629, 628, 627, 626, 625, 624, 623, 622, 621, 620,\n\t619, 618, 617, 616, 615, 614, 613, 612, 611, 610,\n\t609, 608, 607, 606, 605, 604, 603, 602, 601, 600,\n\t599, 598, 597, 596, 595, 594, 593, 592, 591, 590,\n\t589, 588, 587, 586, 585, 584, 583, 582, 581, 580,\n\t579, 578, 577, 576, 575, 574, 573, 572, 571, 570,\n\t569, 568, 567, 566, 565, 564, 563, 562, 561, 560,\n\t559, 558, 557, 556, 555, 554, 553, 552, 551, 550,\n\t549, 548, 547, 546, 545, 544, 543, 542, 541, 540,\n\t539, 538, 537, 536, 535, 534, 533, 532, 531, 530,\n\t529, 528, 527, 526, 525, 524, 523, 522, 521, 520,\n\t519, 518, 517, 516, 515, 514, 513, 512, 511, 510,\n\t509, 508, 507, 506, 505, 504, 503, 502, 501, 500,\n\t499, 498, 497, 496, 495, 494, 493, 492, 491, 490,\n\t489, 488, 487, 486, 485, 484, 483, 482, 481, 480,\n\t479, 478, 477, 476, 475, 474, 473, 472, 471, 470,\n\t469, 468, 467, 466, 465, 464, 463, 462, 461, 460,\n\t459, 458, 457, 456, 455, 454, 453, 452, 451, 450,\n\t449, 448, 447, 446, 445, 444, 443, 442, 441, 440,\n\t439, 438, 437, 436, 435, 434, 433, 432, 431, 430,\n\t429, 428, 427, 426, 425, 424, 423, 422, 421, 420,\n\t419, 418, 417, 416, 415, 414, 413, 412, 411, 410,\n\t409, 408, 407, 406, 405, 404, 403, 402, 401, 400,\n\t399, 398, 397, 396, 395, 394, 393, 392, 391, 390,\n\t389, 388, 387, 386, 385, 384, 383, 382, 381, 380,\n\t379, 378, 377, 376, 375, 374, 373, 372, 371, 370,\n\t369, 368, 367, 366, 365, 364, 363, 362, 361, 360,\n\t359, 358, 357, 356, 355, 354, 353, 352, 351, 350,\n\t349, 348, 347, 346, 345, 344, 343, 342, 341, 340,\n\t339, 338, 337, 336, 335, 334, 333, 332, 331, 330,\n\t329, 328, 327, 326, 325, 324, 323, 322, 321, 320,\n\t319, 318, 317, 316, 315, 314, 313, 312, 311, 310,\n\t309, 308, 307, 306, 305, 304, 303, 302, 301, 300,\n\t299, 298, 297, 296, 295, 294, 293, 292, 291, 290,\n\t289, 288, 287, 286, 285, 284, 283, 282, 281, 280,\n\t279, 278, 277, 276, 275, 274, 273, 272, 271, 270,\n\t269, 268, 267, 266, 265, 264, 263, 262, 261, 260,\n\t259, 258, 257, 256, 255, 254, 253, 252, 251, 250,\n\t249, 248, 247, 246, 245, 244, 243, 242, 241, 240,\n\t239, 238, 237, 236, 235, 234, 233, 232, 231, 230,\n\t229, 228, 227, 226, 225, 224, 223, 222, 221, 220,\n\t219, 218, 217, 216, 215, 214, 213, 212, 211, 210,\n\t209, 208, 207, 206, 205, 204, 203, 202, 201, 200,\n\t199, 198, 197, 196, 195, 194, 193, 192, 191, 190,\n\t189, 188, 187, 186, 185, 184, 183, 182, 181, 180,\n\t179, 178, 177, 176, 175, 174, 173, 172, 171, 170,\n\t169, 168, 167, 166, 165, 164, 163, 162, 161, 160,\n\t159, 158, 157, 156, 155, 154, 153, 152, 151, 150,\n\t149, 148, 147, 146, 145, 144, 143, 142, 141, 140,\n\t139, 138, 137, 136, 135, 134, 133, 132, 131, 130,\n\t129, 128, 127, 126, 125, 124, 123, 122, 121, 120,\n\t119, 118, 117, 116, 115, 114, 113, 112, 111, 110,\n\t109, 108, 107, 106, 105, 104, 103, 102, 101, 100,\n\t99, 98, 97, 96, 95, 94, 93, 92, 91, 90,\n\t89, 88, 87, 86, 85, 84, 83, 82, 81, 80,\n\t79, 78, 77, 76, 75, 74, 73, 72, 71, 70,\n\t69, 68, 67, 66, 65, 64, 63, 62, 61, 60,\n\t59, 58, 57, 56, 55, 54, 53, 52, 51, 50,\n\t49, 48, 47, 46, 45, 44, 43, 42, 41, 40,\n\t39, 38, 37, 36, 35, 34, 33, 32, 31, 30,\n\t29, 28, 27, 26, 25, 24, 23, 22, 21, 20,\n\t19, 18, 17, 16, 15, 14, 13, 12, 11, 10,\n\t9, 8, 7, 6, 5, 4, 3, 2, 1,\n];\n\nexpectType<FirstNineHundredNinetyNineIntegersReversed>({} as ArrayReverse<FirstNineHundredNinetyNineIntegers>);\n\n// Boundary cases\nexpectType<never>({} as ArrayReverse<never>);\nexpectType<any>({} as ArrayReverse<any>);\n"
  },
  {
    "path": "test-d/array-slice.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ArraySlice} from '../index.d.ts';\n\nexpectType<ArraySlice<[0, 1, 2, 3]>>([0, 1, 2, 3]);\nexpectType<ArraySlice<[0, 1, 2] | [0, 1, 2, 3], 0>>({} as [0, 1, 2] | [0, 1, 2, 3]);\nexpectType<ArraySlice<[0, 1, 2] | [3, 2, 1, 0], 0, 2>>({} as [0, 1] | [3, 2]);\nexpectType<ArraySlice<[0, 1, 2, 3]>>([0, 1, 2, 3]);\nexpectType<ArraySlice<[0, 1, 2, 3], 1>>([1, 2, 3]);\nexpectType<ArraySlice<[0, 1, 2, 3], 1, 2>>([1]);\nexpectType<ArraySlice<[0, 1, 2, 3], 1, -1>>([1, 2]);\nexpectType<ArraySlice<[0, 1, 2, 3], -1, -1>>([]);\nexpectType<ArraySlice<[0, 1, 2, 3], -2, -1>>([2]);\nexpectType<ArraySlice<[0, 1, 2, 3], -100>>([0, 1, 2, 3]);\nexpectType<ArraySlice<[0, 1, 2, 3], -100, 4>>([0, 1, 2, 3]);\nexpectType<ArraySlice<[0, 1, 2, 3], -100, 3>>([0, 1, 2]);\nexpectType<ArraySlice<[0, 1, 2, 3], -100, -1>>([0, 1, 2]);\nexpectType<ArraySlice<[0, 1, 2, 3], 2, 1>>([]);\nexpectType<ArraySlice<[0, 1, 2, 3], -10, 1>>([0]);\nexpectType<ArraySlice<[0, 1, 2, 3], 0, -3>>([0]);\nexpectType<ArraySlice<[0, 1, 2, 3], 0, -4>>([]);\nexpectType<ArraySlice<[], -10, 1>>([]);\nexpectType<ArraySlice<[]>>([]);\n\nexpectType<ArraySlice<[...string[], 1, 2]>>([...(null! as string[]), 1, 2]);\nexpectType<ArraySlice<[...string[], 1, 2], 0>>([...(null! as string[]), 1, 2]);\nexpectType<ArraySlice<[...string[], 1, 2], 0, 2>>([null! as (string | 1 | 2), null! as (string | 1 | 2)]);\nexpectType<ArraySlice<[...string[], 1, 2], 1, 4>>([null! as (string | 1 | 2), null! as (string | 1 | 2), null! as (string | 1 | 2)]);\n\nexpectType<ArraySlice<[1, 2, 3, ...string[]]>>([1, 2, 3, ...(null! as string[])]);\nexpectType<ArraySlice<[1, 2, 3, ...string[]], 0>>([1, 2, 3, ...(null! as string[])]);\nexpectType<ArraySlice<[1, 2, 3, ...string[]], 0, 3>>([1, 2, 3]);\nexpectType<ArraySlice<[1, 2, 3, ...string[]], 1, 5>>([2, 3, null! as string, null! as string]);\n\nexpectType<ArraySlice<[1, 2, 3, ...string[], 4, 5]>>([1, 2, 3, ...(null! as string[]), 4, 5]);\nexpectType<ArraySlice<[1, 2, 3, ...string[], 4, 5], 0>>([1, 2, 3, ...(null! as string[]), 4, 5]);\nexpectType<ArraySlice<[1, 2, 3, ...string[], 4, 5], 1, 5>>([2, 3, null! as (string | 4 | 5), null! as (string | 4 | 5)]);\nexpectType<ArraySlice<[1, 2, 3, ...string[], 4, 5], 0>>([1, 2, 3, ...(null! as string[]), 4, 5]);\nexpectType<ArraySlice<[1, 2, 3, ...string[], 4, 5], 1>>([2, 3, ...(null! as string[]), 4, 5]);\nexpectType<ArraySlice<[1, 2, 3, ...string[], 4, 5], 3>>([...(null! as string[]), 4, 5]);\nexpectType<ArraySlice<[1, 2, 3, ...string[], 4, 5], 10>>([...(null! as string[]), 4, 5]);\n\n// Unions\n// Array is union\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], 0>>({} as [0, 1, 2] | ['a', 'b', 'c', 'd']); // Positive start, no end\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], -2>>({} as [1, 2] | ['c', 'd']); // Negative start, no end\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], 0, 2>>({} as [0, 1] | ['a', 'b']); // Positive start, positive end\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], -2, -1>>({} as [1] | ['c']); // Negative start, negative end\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], -3, 2>>({} as [0, 1] | ['b']); // Negative start, positive end\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], 1, -1>>({} as [1] | ['b', 'c']); // Positive start, negative end\n\n// Start is union\nexpectType<ArraySlice<[0, 1, 2, 3], 1 | -2>>({} as [1, 2, 3] | [2, 3]); // Positive/Negative start, no end\nexpectType<ArraySlice<[0, 1, 2, 3], 2 | -3, 3>>({} as [2] | [1, 2]); // Positive/Negative start, positive end\nexpectType<ArraySlice<[0, 1, 2, 3], 0 | -2, -1>>({} as [2] | [0, 1, 2]); // Positive/Negative start, negative end\n\n// End is union\nexpectType<ArraySlice<[0, 1, 2, 3], 0, 1 | -2>>({} as [0] | [0, 1]); // Positive start, positive/negative end\nexpectType<ArraySlice<[0, 1, 2, 3], -2, 2 | -1>>({} as [] | [2]); // Negative start, positive/negative end\n\n// Array and start are unions\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], 1 | -1>>({} as [1, 2] | [2] | ['b', 'c', 'd'] | ['d']); // Positive/Negative start, no end\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], 1 | -2, 2>>({} as [1] | ['b'] | []); // Positive/Negative start, positive end\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], 0 | -2, -1>>({} as [0, 1] | [1] | ['a', 'b', 'c'] | ['c']); // Positive/Negative start, negative end\n\n// Array and end are unions\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], 2, 3 | -1>>({} as [2] | [] | ['c']); // Positive start, positive/negative end\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], -3, 3 | -2>>({} as [0, 1, 2] | [0] | ['b', 'c'] | ['b']); // Negative start, positive/negative end\n\n// Start and end are unions\nexpectType<ArraySlice<[0, 1, 2, 3], -5 | 0 | 1, -2 | 0 | 3>>( // Positive/Negative start, positive/negative end\n\t{} as [0, 1] | [0, 1, 2] | [] | [1] | [1, 2],\n);\n\n// Array, start and end are unions\nexpectType<ArraySlice<[0, 1, 2] | ['a', 'b', 'c', 'd'], 1 | -4, 4 | -1>>( // Positive/Negative start, positive/negative end\n\t{} as [1] | [1, 2] | [0, 1] | [0, 1, 2] | ['a', 'b', 'c', 'd'] | ['a', 'b', 'c'] | ['b', 'c'] | ['b', 'c', 'd'],\n);\n"
  },
  {
    "path": "test-d/array-splice.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ArraySplice} from '../index.d.ts';\n\n// Test fixed array\ntype TestTuple = ['a', 'b', 'c', 'd'];\n\ndeclare const tuple0: ArraySplice<TestTuple, 2, 1>;\nexpectType<['a', 'b', 'd']>(tuple0);\n\ndeclare const tuple1: ArraySplice<TestTuple, 2, 1, ['e', 'f']>;\nexpectType<['a', 'b', 'e', 'f', 'd']>(tuple1);\n\ndeclare const tuple2: ArraySplice<TestTuple, 2, 0, ['e', 'f']>;\nexpectType<['a', 'b', 'e', 'f', 'c', 'd']>(tuple2);\n\ndeclare const tuple3: ArraySplice<TestTuple, 0, 1>;\nexpectType<['b', 'c', 'd']>(tuple3);\n\ndeclare const tuple4: ArraySplice<TestTuple, 0, 1, ['e', 'f']>;\nexpectType<['e', 'f', 'b', 'c', 'd']>(tuple4);\n\n// Test variable array\ntype TestArray = ['a', 'b', 'c', 'd', ...number[]];\n\ndeclare const array0: ArraySplice<TestArray, 2, 1>;\nexpectType<['a', 'b', 'd', ...number[]]>(array0);\n\ndeclare const array1: ArraySplice<TestArray, 2, 1, ['e', 'f']>;\nexpectType<['a', 'b', 'e', 'f', 'd', ...number[]]>(array1);\n\ndeclare const array2: ArraySplice<TestArray, 6, 0, ['e', 'f']>;\nexpectType<['a', 'b', 'c', 'd', number, number, 'e', 'f', ...number[]]>(array2);\n"
  },
  {
    "path": "test-d/array-tail.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ArrayTail} from '../index.d.ts';\n\ndeclare const getArrayTail: <T extends readonly unknown[]>(array: T) => ArrayTail<T>;\n\nexpectType<[]>(getArrayTail([] as []));\nexpectType<[]>(getArrayTail(['a'] as ['a']));\nexpectType<['b', 'c']>(getArrayTail(['a', 'b', 'c'] as ['a', 'b', 'c']));\n\nexpectType<readonly []>(getArrayTail([] as const));\nexpectType<readonly []>(getArrayTail(['a'] as const));\nexpectType<readonly ['b', 'c']>(getArrayTail(['a', 'b', 'c'] as const));\n\n// Optional elements\nexpectType<readonly [undefined, 'c'?]>(getArrayTail(['a', undefined, 'c'] as readonly ['a', undefined, 'c'?]));\nexpectType<[undefined?, number?]>(getArrayTail(['hello'] as [string, undefined?, number?]));\nexpectType<readonly [undefined?, 3?]>(getArrayTail([1, undefined, 3] as readonly [1, undefined?, 3?]));\nexpectType<[boolean, number?, string?]>(getArrayTail(['test', false] as [string, boolean, number?, string?]));\n\n// All optional elements\nexpectType<['b'?]>({} as ArrayTail<['a'?, 'b'?]>);\nexpectType<readonly [number?]>({} as ArrayTail<readonly [string?, number?]>);\n\n// Rest element\nexpectType<readonly [number, boolean, ...string[]]>({} as ArrayTail<readonly [string, number, boolean, ...string[]]>); // Required & Rest\nexpectType<readonly [number?, boolean?, ...string[]]>({} as ArrayTail<readonly [string?, number?, boolean?, ...string[]]>); // Optional & Rest\nexpectType<readonly [number, boolean?, ...string[]]>({} as ArrayTail<readonly [string, number, boolean?, ...string[]]>); // Required, Optional & Rest\n// expectType<readonly [...string[], string, number]>({} as ArrayTail<readonly [...string[], string, number]>); // Rest & Required\nexpectType<readonly [number, ...string[], boolean, bigint]>({} as ArrayTail<readonly [string, number, ...string[], boolean, bigint]>); // Required, Rest & Required\n\n// Labelled tuples\nexpectType<[y: string]>({} as ArrayTail<[x: number, y: string]>);\nexpectType<[bar: string, ...rest: boolean[]]>({} as ArrayTail<[foo: number, bar: string, ...rest: boolean[]]>);\nexpectType<[...rest: boolean[], foo: number, bar: string]>({} as ArrayTail<[...rest: boolean[], foo: number, bar: string]>);\n\n// Union of tuples\nexpectType<[] | ['b']>({} as ArrayTail<[] | ['a', 'b']>);\nexpectType<readonly ['y'?] | ['b', ...string[]] | readonly string[]>({} as ArrayTail<readonly ['x'?, 'y'?] | ['a', 'b', ...string[]] | readonly string[]>);\nexpectType<[number] | readonly [boolean, string?]>({} as ArrayTail<[string, number] | readonly [number, boolean, string?]>);\nexpectType<readonly [number] | readonly string[]>({} as ArrayTail<readonly [string, number] | readonly string[]>);\n\n// Non tuple arrays\nexpectType<string[]>({} as ArrayTail<string[]>);\nexpectType<readonly string[]>({} as ArrayTail<readonly string[]>);\nexpectType<never[]>({} as ArrayTail<never[]>);\nexpectType<any[]>({} as ArrayTail<any[]>);\n\n// Boundary cases\nexpectType<never>({} as ArrayTail<never>);\nexpectType<any>({} as ArrayTail<any>);\n"
  },
  {
    "path": "test-d/array-values.ts",
    "content": "import {expectNotAssignable, expectType, expectAssignable} from 'tsd';\nimport type {ArrayValues} from '../index.d.ts';\n\nconst values = ['a', 'b', 'c'] as const;\ntype Values = ArrayValues<typeof values>;\n\ndeclare const test: 'a' | 'b' | 'c';\nexpectType<Values>(test);\n\nexpectAssignable<Values>('a');\nexpectAssignable<Values>('b');\nexpectAssignable<Values>('c');\n\nexpectNotAssignable<Values>('');\nexpectNotAssignable<Values>(0);\n\ntype TupleValues = ArrayValues<['1', 2, {c: true}]>;\n\ndeclare const testTuple: '1' | 2 | {c: true};\nexpectType<TupleValues>(testTuple);\n\nexpectAssignable<TupleValues>('1');\nexpectAssignable<TupleValues>(2);\nexpectAssignable<TupleValues>({c: true});\n\nexpectNotAssignable<TupleValues>({});\nexpectNotAssignable<TupleValues>(1);\nexpectNotAssignable<TupleValues>('2');\n\ntype AnyStringValues = ArrayValues<string[]>;\nexpectAssignable<AnyStringValues>('');\nexpectAssignable<AnyStringValues>('123');\nexpectNotAssignable<AnyStringValues>(123);\nexpectNotAssignable<AnyStringValues>(undefined);\nexpectNotAssignable<AnyStringValues>(null);\n"
  },
  {
    "path": "test-d/arrayable.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Arrayable} from '../index.d.ts';\n\ndeclare const unknown: unknown;\n\nexpectType<Arrayable<string>>(unknown as string | string[]);\nexpectType<Arrayable<string | {foo: number}>>(unknown as (string | {foo: number}) | Array<string | {foo: number}>);\nexpectType<Arrayable<never>>(unknown as /* never | */ never[]);\nexpectType<Arrayable<string[]>>(unknown as string[] | string[][]);\n\n// Test for issue https://github.com/sindresorhus/type-fest/issues/952\ntype Item = number;\nfunction castArray1(value: Arrayable<Item>): Item[] {\n\treturn Array.isArray(value) ? value : [value];\n}\n\nexpectType<Item[]>(unknown as ReturnType<typeof castArray1>);\n\nfunction castArray2<T>(value: Arrayable<T>): T[] {\n\treturn Array.isArray(value) ? value : [value];\n}\n\nexpectType<number[]>(castArray2(1));\nexpectType<number[]>(castArray2([1, 2, 3]));\n"
  },
  {
    "path": "test-d/async-return-type.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {AsyncReturnType} from '../index.d.ts';\n\nasync function asyncFunction(): Promise<number> {\n\treturn 2;\n}\n\ntype Value = AsyncReturnType<typeof asyncFunction>;\n\nasyncFunction().then(value => { // eslint-disable-line unicorn/prefer-top-level-await, @typescript-eslint/no-floating-promises\n\texpectType<Value>(value);\n\texpectNotAssignable<string>(value);\n});\n\nfunction asyncPromiseLike(): PromiseLike<number> {\n\treturn Promise.resolve(2);\n}\n\ntype ValuePromiseLike = AsyncReturnType<typeof asyncPromiseLike>;\n\nasyncPromiseLike().then(value => { // eslint-disable-line unicorn/prefer-top-level-await, @typescript-eslint/no-floating-promises\n\texpectType<ValuePromiseLike>(value);\n\texpectNotAssignable<string>(value);\n});\n"
  },
  {
    "path": "test-d/asyncify.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Asyncify} from '../index.d.ts';\n\ndeclare function getFooSync(name: string): RegExp;\ndeclare function getFooWithThisArgumentSync(this: Date, name: string): RegExp;\n\n// Basic usage.\ndeclare const getFooAsync1: Asyncify<typeof getFooSync>;\nexpectType<(name: string) => Promise<RegExp>>(getFooAsync1);\n\n// Noops with async functions.\ndeclare const getFooAsync2: Asyncify<typeof getFooAsync1>;\nexpectType<typeof getFooAsync1>(getFooAsync2);\n\n// Respects `thisArg`.\ndeclare const getFooWithThisArgumentAsync1: Asyncify<typeof getFooWithThisArgumentSync>;\nconst callResult = getFooWithThisArgumentAsync1.call(new Date(), 'foo');\nexpectType<Promise<RegExp>>(callResult);\n\n// @ts-expect-error\n// eslint-disable-next-line @typescript-eslint/no-floating-promises\ngetFooWithThisArgumentAsync1.call('not-date', 'foo');\n"
  },
  {
    "path": "test-d/camel-case.ts",
    "content": "import {expectType, expectAssignable} from 'tsd';\nimport type {CamelCase} from '../index.d.ts';\n\n// CamelCase\nconst camelFromPascal: CamelCase<'FooBar'> = 'fooBar';\nexpectType<'fooBar'>(camelFromPascal);\n\nconst camelFromKebab: CamelCase<'foo-bar'> = 'fooBar';\nexpectType<'fooBar'>(camelFromKebab);\n\nconst camelFromComplexKebab: CamelCase<'foo-bar-abc-123'> = 'fooBarAbc123';\nexpectType<'fooBarAbc123'>(camelFromComplexKebab);\n\nconst camelFromSpace: CamelCase<'foo bar'> = 'fooBar';\nexpectType<'fooBar'>(camelFromSpace);\n\nconst camelFromSnake: CamelCase<'foo_bar'> = 'fooBar';\nexpectType<'fooBar'>(camelFromSnake);\n\nconst noDelimiterFromMono: CamelCase<'foobar'> = 'foobar';\nexpectType<'foobar'>(noDelimiterFromMono);\n\nconst camelFromMixed: CamelCase<'foo-bar_abc xyzBarFoo'> = 'fooBarAbcXyzBarFoo';\nexpectType<'fooBarAbcXyzBarFoo'>(camelFromMixed);\n\nconst camelFromVendorPrefixedCssProperty: CamelCase<'-webkit-animation'> = 'webkitAnimation';\nexpectType<'webkitAnimation'>(camelFromVendorPrefixedCssProperty);\n\nconst camelFromDoublePrefixedKebab: CamelCase<'--very-prefixed'> = 'veryPrefixed';\nexpectType<'veryPrefixed'>(camelFromDoublePrefixedKebab);\n\nconst camelFromRepeatedSeparators: CamelCase<'foo____bar'> = 'fooBar';\nexpectType<'fooBar'>(camelFromRepeatedSeparators);\n\nconst camelFromUppercase: CamelCase<'FOO'> = 'foo';\nexpectType<'foo'>(camelFromUppercase);\n\nconst camelFromLowercase: CamelCase<'foo'> = 'foo';\nexpectType<'foo'>(camelFromLowercase);\n\nconst camelFromScreamingSnakeCase: CamelCase<'FOO_BAR'> = 'fooBar';\nexpectType<'fooBar'>(camelFromScreamingSnakeCase);\n\nconst camelFromScreamingKebabCase: CamelCase<'FOO-BAR'> = 'fooBar';\nexpectType<'fooBar'>(camelFromScreamingKebabCase);\n\n// Verifying example\ntype CamelCasedProperties<T> = {\n\t[K in keyof T as CamelCase<K>]: T[K]\n};\n\ntype RawOptions = {\n\t'dry-run': boolean;\n\t'full_family_name': string;\n\tfoo: number;\n\tBAR: string;\n\tQUZ_QUX: number;\n\t'OTHER-FIELD': boolean;\n};\n\nexpectAssignable<CamelCasedProperties<RawOptions>>({\n\tdryRun: true,\n\tfullFamilyName: 'bar.js',\n\tfoo: 123,\n\tbar: 'foo',\n\tquzQux: 6,\n\totherField: false,\n});\n\nexpectType<CamelCase<'fooBAR'>>('fooBar');\nexpectType<CamelCase<'fooBAR', {preserveConsecutiveUppercase: true}>>('fooBAR');\n\nexpectType<CamelCase<'fooBARBiz'>>('fooBarBiz');\nexpectType<CamelCase<'fooBARBiz', {preserveConsecutiveUppercase: true}>>('fooBARBiz');\n\nexpectType<CamelCase<'foo BAR-Biz_BUZZ', {preserveConsecutiveUppercase: true}>>('fooBARBizBUZZ');\nexpectType<CamelCase<'foo BAR-Biz_BUZZ', {preserveConsecutiveUppercase: false}>>('fooBarBizBuzz');\nexpectType<CamelCase<'foo\\tBAR-Biz_BUZZ'>>('fooBarBizBuzz');\n\nexpectType<CamelCase<string, {preserveConsecutiveUppercase: true}>>('string' as string);\nexpectType<CamelCase<string>>('string' as string);\n\n// Test splitOnNumbers option\nexpectType<'a1bText'>('' as CamelCase<'a1b_text', {splitOnNumbers: false}>);\nexpectType<'a1BText'>('' as CamelCase<'a1b_text', {splitOnNumbers: true}>);\nexpectType<'a1BText'>('' as CamelCase<'a1b_text'>);\n\nexpectType<'p2pNetwork'>('' as CamelCase<'p2pNetwork', {splitOnNumbers: false}>);\nexpectType<'p2PNetwork'>('' as CamelCase<'p2pNetwork', {splitOnNumbers: true}>);\n"
  },
  {
    "path": "test-d/camel-cased-properties-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {CamelCasedPropertiesDeep, Tagged} from '../index.d.ts';\n\ndeclare const foo: CamelCasedPropertiesDeep<{A: {B: number; C: Array<{D: string}>}}>;\n\nexpectType<{a: {b: number; c: Array<{d: string}>}}>(foo);\n\ndeclare const fooBar: CamelCasedPropertiesDeep<() => {a: string}>;\nexpectType<() => {a: string}>(fooBar);\n\ndeclare const bar: CamelCasedPropertiesDeep<Set<{fooBar: string}>>;\nexpectType<Set<{fooBar: string}>>(bar);\n\ntype bazBizDeep = {fooBAR: number; baz: {fooBAR: Array<{BARFoo: string}>}};\n\ndeclare const baz: CamelCasedPropertiesDeep<bazBizDeep, {preserveConsecutiveUppercase: true}>;\nexpectType<{fooBAR: number; baz: {fooBAR: Array<{bARFoo: string}>}}>(baz);\n\ndeclare const biz: CamelCasedPropertiesDeep<bazBizDeep>;\nexpectType<{fooBar: number; baz: {fooBar: Array<{barFoo: string}>}}>(biz);\n\ndeclare const tuple: CamelCasedPropertiesDeep<{tuple: [number, string, {D: string}]}>;\nexpectType<{tuple: [number, string, {d: string}]}>(tuple);\n\n// Verify example\ntype UserRole = Tagged<string, 'Role'>;\n\ntype User = {\n\tUserId: number;\n\tUserName: string;\n\tDate: Date;\n\tRegExp: RegExp;\n\tRole: UserRole;\n};\n\ntype UserWithFriends = {\n\tUserInfo: User;\n\tUserFriends: User[];\n};\n\nconst role = 'someRole' as UserRole;\n\nconst result: CamelCasedPropertiesDeep<UserWithFriends> = {\n\tuserInfo: {\n\t\tuserId: 1,\n\t\tuserName: 'Tom',\n\t\tdate: new Date(),\n\t\tregExp: /.*/,\n\t\trole,\n\t},\n\tuserFriends: [\n\t\t{\n\t\t\tuserId: 2,\n\t\t\tuserName: 'Jerry',\n\t\t\tdate: new Date(),\n\t\t\tregExp: /.*/,\n\t\t\trole,\n\t\t},\n\t\t{\n\t\t\tuserId: 3,\n\t\t\tuserName: 'Spike',\n\t\t\tdate: new Date(),\n\t\t\tregExp: /.*/,\n\t\t\trole,\n\t\t},\n\t],\n};\nexpectType<CamelCasedPropertiesDeep<UserWithFriends>>(result);\n\nexpectType<{fooBar: unknown}>({} as CamelCasedPropertiesDeep<{foo_bar: unknown}>);\nexpectType<{fooBar: {barBaz: unknown}; biz: unknown}>({} as CamelCasedPropertiesDeep<{foo_bar: {bar_baz: unknown}; biz: unknown}>);\n\nexpectType<{fooBar: any}>({} as CamelCasedPropertiesDeep<{foo_bar: any}>);\nexpectType<{fooBar: {barBaz: any}; biz: any}>({} as CamelCasedPropertiesDeep<{foo_bar: {bar_baz: any}; biz: any}>);\n"
  },
  {
    "path": "test-d/camel-cased-properties.ts",
    "content": "import {expectType} from 'tsd';\nimport type {CamelCasedProperties} from '../index.d.ts';\n\ndeclare const foo: CamelCasedProperties<{A: number; B: {C: string}}>;\nexpectType<{a: number; b: {C: string}}>(foo);\n\ndeclare const bar: CamelCasedProperties<Array<{helloWorld: string}>>;\nexpectType<Array<{helloWorld: string}>>(bar);\n\ndeclare const fooBar: CamelCasedProperties<() => {a: string}>;\nexpectType<() => {a: string}>(fooBar);\n\ndeclare const baz: CamelCasedProperties<{fooBAR: number; BARFoo: string}, {preserveConsecutiveUppercase: true}>;\nexpectType<{fooBAR: number; bARFoo: string}>(baz);\n\ndeclare const biz: CamelCasedProperties<{fooBAR: number; BARFoo: string}>;\nexpectType<{fooBar: number; barFoo: string}>(biz);\n\n// Verify example\ntype User = {\n\tUserId: number;\n\tUserName: string;\n};\n\nconst result: CamelCasedProperties<User> = {\n\tuserId: 1,\n\tuserName: 'Tom',\n};\nexpectType<CamelCasedProperties<User>>(result);\n"
  },
  {
    "path": "test-d/class.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {Class, Constructor, IsAny} from '../index.d.ts';\n\nclass Foo {\n\t// eslint-disable-next-line @typescript-eslint/no-useless-constructor, @typescript-eslint/no-empty-function\n\tconstructor(_x: number, _y: any) {}\n\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tmethod(): void {}\n}\n\nfunction function_(Cls: Constructor<Foo>): Foo {\n\treturn new Cls(1, '', 123);\n}\n\nfunction function2(Cls: Constructor<Foo, [number, number]>): Foo {\n\t// @ts-expect-error\n\tconst _ = new Cls(1, '');\n\treturn new Cls(1, 2);\n}\n\nfunction_(Foo);\nfunction2(Foo);\n\n// Prototype test\ntype PositionProperties = {\n\ttop: number;\n\tleft: number;\n};\n\nclass Position {\n\tpublic top: number;\n\n\tpublic left: number;\n\n\tconstructor(parameterTop: number, parameterLeft: number) {\n\t\tthis.top = parameterTop;\n\t\tthis.left = parameterLeft;\n\t}\n}\n\ndeclare const Bar: Class<PositionProperties>;\n\nexpectAssignable<Class<PositionProperties>>(Position);\n\nexpectNotAssignable<Class<PositionProperties, [number]>>(Position);\n\nexpectAssignable<Class<PositionProperties, [number, number]>>(Position);\nexpectAssignable<Constructor<PositionProperties, [number, number]>>(Position);\n\nexpectType<IsAny<typeof Bar['prototype']>>(false);\nexpectType<PositionProperties>(Position.prototype);\n// /Prototype test\n\n// @ts-expect-error\nconst _a = new Position(17);\nexpectAssignable<PositionProperties>(new Position(17, 34));\n\n// Prototype test with type parameter\nclass Building<T = unknown> {\n\towners: T;\n\tconstructor(buildingOwners: T) {\n\t\tthis.owners = buildingOwners;\n\t}\n}\n\ntype Census = {\n\tcount: number;\n};\n\nclass House<OwnerCount extends Census = Census> extends Building<OwnerCount> {}\n\nclass CityBlock<BuildingType extends Building> {\n\tresidence: BuildingType;\n\n\tconstructor(HousingType: Class<BuildingType, [Census]>) {\n\t\tthis.residence = new HousingType({count: 2});\n\t}\n}\n\nconst Family = (new CityBlock(House)).residence.owners;\nexpectType<IsAny<typeof Family>>(false);\nexpectAssignable<number>(Family.count);\n// /Prototype test with type parameter\n"
  },
  {
    "path": "test-d/conditional-except.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ConditionalExcept, Primitive} from '../index.d.ts';\n\nclass Awesome {\n\tname!: string;\n\tsuccesses!: number;\n\tfailures!: bigint;\n\n\trun(): void {\n\t\t// Empty\n\t}\n}\n\ntype Example = {\n\ta: string;\n\tb?: string | number;\n\tc?: string;\n\td: Record<string, unknown>;\n};\n\ndeclare const exampleConditionalExcept: ConditionalExcept<Example, string>;\nexpectType<{b?: string | number; c?: string; d: Record<string, unknown>}>(exampleConditionalExcept);\n\ndeclare const awesomeConditionalExcept: ConditionalExcept<Awesome, Primitive>;\nexpectType<{run: () => void}>(awesomeConditionalExcept);\n\ndeclare const exampleConditionalExceptWithUndefined: ConditionalExcept<Example, string | undefined>;\nexpectType<{b?: string | number; d: Record<string, unknown>}>(exampleConditionalExceptWithUndefined);\n"
  },
  {
    "path": "test-d/conditional-keys.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ConditionalKeys} from '../index.d.ts';\n\ntype Example = {\n\ta: string;\n\tb?: string | number;\n\tc?: string;\n\td: Record<string, unknown>;\n\te: never;\n};\n\ndeclare const exampleConditionalKeys: ConditionalKeys<Example, string>;\nexpectType<'a'>(exampleConditionalKeys);\n\ndeclare const exampleConditionalKeysWithUndefined: ConditionalKeys<Example, string | undefined>;\nexpectType<'a' | 'c'>(exampleConditionalKeysWithUndefined);\n\ndeclare const exampleConditionalKeysTargetingNever: ConditionalKeys<Example, never>;\nexpectType<'e'>(exampleConditionalKeysTargetingNever);\n\n// Readonly modifiers\nexpectType<'a' | 'c'>({} as ConditionalKeys<{readonly a: string; readonly b: number; c: Uppercase<string>}, string>);\nexpectType<never>({} as ConditionalKeys<{readonly a?: string; readonly b: number}, string>);\nexpectType<'a'>({} as ConditionalKeys<{readonly a?: string; readonly b?: number}, string | undefined>);\n\n// Optional modifiers\nexpectType<'b'>({} as ConditionalKeys<{a?: string; b: string}, string>);\nexpectType<never>({} as ConditionalKeys<{a?: string; b?: string}, string>);\nexpectType<never>({} as ConditionalKeys<{a?: string; b: string}, undefined>);\nexpectType<'a' | 'b'>({} as ConditionalKeys<{a?: string; b: string}, string | undefined>);\nexpectType<'a' | 'b'>({} as ConditionalKeys<{readonly a?: string; readonly b: string}, string | undefined>);\n\n// Union in property values\nexpectType<never>({} as ConditionalKeys<{a: boolean | number}, boolean>);\nexpectType<'a' | 'b' | 'c'>({} as ConditionalKeys<{a: boolean | number; b: boolean; c: number}, boolean | number>);\nexpectType<'b'>({} as ConditionalKeys<{a?: boolean | number; readonly b: boolean | number}, boolean | number>);\nexpectType<'a' | 'b'>(\n\t{} as ConditionalKeys<{a?: boolean | number; readonly b?: boolean; c: bigint | number}, boolean | number | undefined>,\n);\n\n// `never` as condition\nexpectType<never>({} as ConditionalKeys<{a: string; b: number}, never>);\nexpectType<never>({} as ConditionalKeys<{readonly a?: string; readonly b?: number}, never>);\nexpectType<'a' | 'b'>({} as ConditionalKeys<{a: never; b: never}, never>);\nexpectType<'a' | 'b'>({} as ConditionalKeys<{a: never; b: never}, any>);\nexpectType<never>({} as ConditionalKeys<{a?: never; b?: never}, never>);\nexpectType<'a' | 'b'>({} as ConditionalKeys<{a?: never; b?: never}, undefined>);\n\n// Unions\nexpectType<never>({} as ConditionalKeys<{a: string} | {b: number}, string | number>);\nexpectType<never>({} as ConditionalKeys<{a: string} | {b: number}, string>);\nexpectType<never>({} as ConditionalKeys<{a: string} | {b: number}, number>);\nexpectType<never>({} as ConditionalKeys<{a: string} | {a: number}, number>);\nexpectType<'a'>({} as ConditionalKeys<{a: string} | {a: number}, string | number>);\nexpectType<'a' | 'b'>(\n\t{} as ConditionalKeys<{a: string; b: bigint} | {a: number; b: string; c: boolean}, string | number | bigint>,\n);\nexpectType<'a'>({} as ConditionalKeys<{a: string} | {a: Lowercase<string>; b: Uppercase<string>}, string>);\nexpectType<never>({} as ConditionalKeys<{length: number} | [number], number>);\n\n// `any`/`unknown` as condition\nexpectType<'a' | 'b' | 'c' | 'd' | 'e'>(\n\t{} as ConditionalKeys<{a?: string; b: string | number; readonly c: boolean; readonly d?: bigint; e: never}, any>,\n);\nexpectType<'a' | 'b' | 'c' | 'd'>(\n\t{} as ConditionalKeys<{a?: string; b: string | number; readonly c: boolean; readonly d?: bigint; e: never}, unknown>,\n);\n\n// Index signatures\nexpectType<string | number>({} as ConditionalKeys<{[x: string]: boolean}, boolean>);\nexpectType<string | number>({} as ConditionalKeys<{[x: string]: string; a: string}, string>);\nexpectType<Uppercase<string> | 'a'>({} as ConditionalKeys<{[x: Uppercase<string>]: string; a: string}, string>);\nexpectType<number | 'a'>({} as ConditionalKeys<{[x: Uppercase<string>]: string; [x: number]: number; a: number}, number>);\n\n// Arrays and tuples\nexpectType<'0' | '2'>({} as ConditionalKeys<[string, number, string], string>);\nexpectType<'0' | '1'>({} as ConditionalKeys<[string, string, string | number], string>);\nexpectType<'0' | '1' | '2'>({} as ConditionalKeys<[string, number, string], any>);\nexpectType<'0'>({} as ConditionalKeys<[string, string?, string?], string>);\nexpectType<'0' | '1' | '2'>({} as ConditionalKeys<[string, string?, string?], string | undefined>);\nexpectType<never>({} as ConditionalKeys<[string, number, ...boolean[]], boolean>);\nexpectType<'0'>({} as ConditionalKeys<[string, number?, ...boolean[]], string | number | boolean>);\nexpectType<'1'>({} as ConditionalKeys<[string?, number?, ...boolean[]], number | undefined>);\nexpectType<'0' | '1' | number>({} as ConditionalKeys<[string, number, ...boolean[]], string | number | boolean>);\nexpectType<'0'>({} as ConditionalKeys<[bigint, ...number[], bigint], bigint>);\nexpectType<never>({} as ConditionalKeys<[...boolean[], string, string], string>);\nexpectType<number>({} as ConditionalKeys<[...string[], string, string], string>);\nexpectType<number>({} as ConditionalKeys<string[], string>);\nexpectType<never>({} as ConditionalKeys<string[], number>);\n\n// Primitives\nexpectType<'length'>({} as ConditionalKeys<string, number>);\nexpectType<'valueOf'>({} as ConditionalKeys<number, () => number>);\n\n// Boundary cases\nexpectType<never>({} as ConditionalKeys<{}, boolean>);\nexpectType<PropertyKey>({} as ConditionalKeys<any, boolean>);\nexpectType<never>({} as ConditionalKeys<never, boolean>);\n"
  },
  {
    "path": "test-d/conditional-pick-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ConditionalPickDeep} from '../index.d.ts';\n\ndeclare class ClassA {\n\tpublic a: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ninterface InterfaceA {\n\ta: number;\n}\n\ntype Example = {\n\toptional?: boolean;\n\toptionalWithUndefined?: boolean | undefined;\n\tliteral: 'foo';\n\tstring: string;\n\tmap: Map<string, string>;\n\treadonlyMap: ReadonlyMap<string, string>;\n\tweakMap: WeakMap<WeakKey, string>;\n\tset: Set<string>;\n\treadonlySet: ReadonlySet<string>;\n\tweakSet: WeakSet<WeakKey>;\n\tdate: Date;\n\tnumber: 1;\n\tarray: string[];\n\treadonlyArray: readonly string[];\n\ttuples: ['foo', 'bar'];\n\tinterface: InterfaceA;\n\tinstanceA: ClassA;\n\tClassA: typeof ClassA;\n\tfunction: (...arguments_: string[]) => string;\n\tpromise: Promise<string>;\n\tstringOrBoolean: string | boolean;\n\tnever: never;\n\tobject: {\n\t\tstring: string;\n\t\tsubObject: {\n\t\t\toptional?: string;\n\t\t\tstring: string;\n\t\t};\n\t};\n};\n\ndeclare const stringPick: ConditionalPickDeep<Example, string>;\nexpectType<{\n\tliteral: 'foo';\n\tstring: string;\n\tinstanceA: {\n\t\ta: string;\n\t};\n\tnever: never;\n\tobject: {\n\t\tstring: string;\n\t\tsubObject: {\n\t\t\tstring: string;\n\t\t};\n\t};\n}>(stringPick);\n\ndeclare const stringEqualityPick: ConditionalPickDeep<Example, string, {condition: 'equality'}>;\nexpectType<{\n\tstring: string;\n\tinstanceA: {\n\t\ta: string;\n\t};\n\tobject: {\n\t\tstring: string;\n\t\tsubObject: {\n\t\t\tstring: string;\n\t\t};\n\t};\n}>(stringEqualityPick);\n\ndeclare const stringPickOptional: ConditionalPickDeep<Example, string | undefined>;\nexpectType<{\n\tliteral: 'foo';\n\tstring: string;\n\tinstanceA: {\n\t\ta: string;\n\t};\n\tnever: never;\n\tobject: {\n\t\tstring: string;\n\t\tsubObject: {\n\t\t\toptional?: string;\n\t\t\tstring: string;\n\t\t};\n\t};\n}>(stringPickOptional);\n\ndeclare const stringPickOptionalOnly: ConditionalPickDeep<Example, string | undefined, {condition: 'equality'}>;\nexpectType<{object: {subObject: {optional?: string}}}>(stringPickOptionalOnly);\n\ndeclare const booleanPick: ConditionalPickDeep<Example, boolean | undefined>;\nexpectType<{optional?: boolean; optionalWithUndefined?: boolean | undefined; never: never}>(booleanPick);\n\ndeclare const numberPick: ConditionalPickDeep<Example, number>;\nexpectType<{number: 1; interface: {a: number}; never: never}>(numberPick);\n\ndeclare const emptyPick: ConditionalPickDeep<Example, 'abcdefg'>;\nexpectType<{never: never}>(emptyPick);\n\ndeclare const emptyEqualityPick: ConditionalPickDeep<Example, 'abcdefg', {condition: 'equality'}>;\nexpectType<never>(emptyEqualityPick);\n\n// Returns `never` when no keys match the condition\ndeclare const noMatchingKeys: ConditionalPickDeep<{a: string; b: number}, boolean>;\nexpectType<never>(noMatchingKeys);\n\n// Union with no common properties\ndeclare const unionNoCommon: ConditionalPickDeep<{a: string} | {b: string}, string>;\nexpectType<{a: string} | {b: string}>(unionNoCommon);\n\ndeclare const stringOrBooleanPick: ConditionalPickDeep<Example, string | boolean>;\nexpectType<{\n\tliteral: 'foo';\n\tstring: string;\n\tstringOrBoolean: string | boolean;\n\tinstanceA: {\n\t\ta: string;\n\t};\n\tnever: never;\n\tobject: {\n\t\tstring: string;\n\t\tsubObject: {\n\t\t\tstring: string;\n\t\t};\n\t};\n}>(stringOrBooleanPick);\n\ndeclare const stringOrBooleanPickOnly: ConditionalPickDeep<Example, string | boolean, {condition: 'equality'}>;\nexpectType<{stringOrBoolean: string | boolean}>(stringOrBooleanPickOnly);\n\ndeclare const arrayPick: ConditionalPickDeep<Example, string[]>;\nexpectType<{array: string[]; tuples: ['foo', 'bar']; never: never}>(arrayPick);\n\ndeclare const arrayEqualityPick: ConditionalPickDeep<Example, string[], {condition: 'equality'}>;\nexpectType<{array: string[]}>(arrayEqualityPick);\n\ndeclare const tuplePick: ConditionalPickDeep<Example, ['foo', 'bar']>;\nexpectType<{tuples: ['foo', 'bar']; never: never}>(tuplePick);\n\ndeclare const instancePick: ConditionalPickDeep<Example, ClassA>;\nexpectType<{instanceA: ClassA; never: never}>(instancePick);\n\ndeclare const classPick: ConditionalPickDeep<Example, typeof ClassA>;\nexpectType<{ClassA: typeof ClassA; never: never}>(classPick);\n\ndeclare const functionPick: ConditionalPickDeep<Example, (...arguments_: string[]) => string>;\nexpectType<{function: (...arguments_: string[]) => string; never: never}>(functionPick);\n\ndeclare const mapPick: ConditionalPickDeep<Example, Map<string, string>>;\nexpectType<{map: Map<string, string>; never: never}>(mapPick);\n\ndeclare const setPick: ConditionalPickDeep<Example, Set<string>>;\nexpectType<{set: Set<string>; never: never}>(setPick);\n\ndeclare const interfaceTest: ConditionalPickDeep<Example, InterfaceA>;\nexpectType<{interface: InterfaceA; never: never}>(interfaceTest);\n"
  },
  {
    "path": "test-d/conditional-pick.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ConditionalPick, Primitive} from '../index.d.ts';\n\nclass Awesome {\n\tname!: string;\n\tsuccesses!: number;\n\tfailures!: bigint;\n\n\trun(): void {\n\t\t// Empty\n\t}\n}\n\ntype Example = {\n\ta: string;\n\tb?: string | number;\n\tc?: string;\n\td: Record<string, unknown>;\n};\n\ndeclare const exampleConditionalPick: ConditionalPick<Example, string>;\nexpectType<{a: string}>(exampleConditionalPick);\n\ndeclare const awesomeConditionalPick: ConditionalPick<Awesome, Primitive>;\nexpectType<{name: string; successes: number; failures: bigint}>(awesomeConditionalPick);\n\ndeclare const exampleConditionalPickWithUndefined: ConditionalPick<Example, string | undefined>;\nexpectType<{a: string; c?: string}>(exampleConditionalPickWithUndefined);\n\n// Returns `never` when no keys match the condition\ndeclare const noMatchingKeys: ConditionalPick<Example, number>;\nexpectType<never>(noMatchingKeys);\n\ndeclare const noMatchingKeys2: ConditionalPick<{a: string; b: number}, boolean>;\nexpectType<never>(noMatchingKeys2);\n"
  },
  {
    "path": "test-d/conditional-simplify-deep.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {ConditionalSimplifyDeep} from '../index.d.ts';\n\ntype Position = {top: number; left: number};\ntype Size = {width: number; height: number};\n\n// In your editor, hovering over `PositionAndSizeSimplified` will show a simplified object with all the properties.\ntype PositionAndSizeIntersection = Position & Size;\n\nconst position = {top: 120, left: 240};\nconst size = {width: 480, height: 600};\nconst positionAndSize = {...position, ...size};\n\n// Should simplify interface deeply.\ntype SomeNode = {\n\tparent: PositionAndSizeIntersection;\n\tchilds: Array<{parent: PositionAndSizeIntersection}>;\n};\n\n// In your editor, hovering over `SomeNodeSimplified` will show a simplified object with all the properties.\ntype SomeNodeSimplified = ConditionalSimplifyDeep<SomeNode>;\n\nconst someNode = {parent: positionAndSize, childs: [{parent: positionAndSize}, {parent: positionAndSize}]};\nexpectType<SomeNodeSimplified>(someNode);\n\n// Should simplify interface deeply excluding Function type.\n// TODO: Convert this to a `type`.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ninterface MovablePosition extends Position {\n\tmove(position: Position): Position;\n}\n\ntype MovableCollection = {\n\tposition: MovablePosition;\n\ttop: {position: MovablePosition; size: Size};\n\tleft: {position: MovablePosition; size: Size};\n};\n\ntype MovableNodeSimplifiedFail = ConditionalSimplifyDeep<MovableCollection>;\ntype MovableNodeSimplifiedPass = ConditionalSimplifyDeep<MovableCollection, Function>;\n\ndeclare const movableNodeSimplifiedFail: MovableNodeSimplifiedFail;\ndeclare const movableNodeSimplifiedPass: MovableNodeSimplifiedPass;\n\nexpectNotAssignable<MovableCollection>(movableNodeSimplifiedFail);\nexpectType<MovableCollection>(movableNodeSimplifiedPass);\n\nconst movablePosition = {\n\ttop: 42,\n\tleft: 42,\n\tmove(position: Position) {\n\t\treturn position;\n\t},\n};\n\nconst movableNode = {\n\tposition: movablePosition,\n\ttop: {position: movablePosition, size},\n\tleft: {position: movablePosition, size},\n};\n\nexpectType<MovableNodeSimplifiedPass>(movableNode);\n\n// Should exclude `Function` and `Size` type (mainly visual, mouse over the statement).\ntype ExcludeFunctionAndSize1 = ConditionalSimplifyDeep<MovableCollection, Function | Size>;\nexpectType<ExcludeFunctionAndSize1>(movableNode);\n\n// Same as above but using `IncludeType` parameter (mainly visual, mouse over the statement).\ntype ExcludeFunctionAndSize2 = ConditionalSimplifyDeep<MovableCollection, Function, MovableCollection | Position>;\nexpectType<ExcludeFunctionAndSize2>(movableNode);\n"
  },
  {
    "path": "test-d/conditional-simplify.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {ConditionalSimplify} from '../index.d.ts';\n\ntype Position = {top: number; left: number};\ntype Size = {width: number; height: number};\n\n// In your editor, hovering over `PositionAndSizeSimplified` will show a simplified object with all the properties.\ntype PositionAndSizeIntersection = Position & Size;\ntype PositionAndSizeSimplified = ConditionalSimplify<PositionAndSizeIntersection>;\n\nconst position = {top: 120, left: 240};\nconst size = {width: 480, height: 600};\nconst positionAndSize = {...position, ...size};\nexpectType<PositionAndSizeSimplified>(positionAndSize);\n\n// Exclude function type to be simplified.\ntype SomeFunction = (type: string) => string;\ntype SimplifiedFunctionFail = ConditionalSimplify<SomeFunction>; // Return '{}'\ntype SimplifiedFunctionPass = ConditionalSimplify<SomeFunction, Function>; // Return '(type: string) => string'\n\ndeclare const simplifiedFunctionFail: SimplifiedFunctionFail;\ndeclare const simplifiedFunctionPass: SimplifiedFunctionPass;\n\nexpectNotAssignable<SomeFunction>(simplifiedFunctionFail);\nexpectType<SomeFunction>(simplifiedFunctionPass);\n"
  },
  {
    "path": "test-d/delimiter-case.ts",
    "content": "import {expectType, expectAssignable} from 'tsd';\nimport type {DelimiterCase} from '../source/delimiter-case.d.ts';\n\n// DelimiterCase\nconst delimiterFromCamel: DelimiterCase<'fooBar', '#'> = 'foo#bar';\nexpectType<'foo#bar'>(delimiterFromCamel);\n\nconst delimiterFromComplexCamel: DelimiterCase<'fooBarAbc123', '#'> = 'foo#bar#abc123';\nexpectType<'foo#bar#abc123'>(delimiterFromComplexCamel);\n\nconst delimiterFromComplexCamelSplitOnNumbers: DelimiterCase<\n\t'fooBarAbc123',\n\t'#',\n\t{splitOnNumbers: true}\n> = 'foo#bar#abc#123';\nexpectType<'foo#bar#abc#123'>(delimiterFromComplexCamelSplitOnNumbers);\n\nconst delimiterFromComplexCamelNoSplitOnNumbers: DelimiterCase<'fooBarAbc123', '#'> = 'foo#bar#abc123';\nexpectType<'foo#bar#abc123'>(delimiterFromComplexCamelNoSplitOnNumbers);\n\nconst delimiterNumberInTheMiddle: DelimiterCase<'p2pNetwork', '#', {splitOnNumbers: true}> = 'p#2#p#network';\nexpectType<'p#2#p#network'>(delimiterNumberInTheMiddle);\n\nconst delimiterNumberInTheMiddleNoSplitOnNumbers: DelimiterCase<'p2pNetwork', '#'> = 'p2p#network';\nexpectType<'p2p#network'>(delimiterNumberInTheMiddleNoSplitOnNumbers);\n\nconst delimiterFromPascal: DelimiterCase<'FooBar', '#'> = 'foo#bar';\nexpectType<'foo#bar'>(delimiterFromPascal);\n\nconst delimiterFromKebab: DelimiterCase<'foo-bar', '#'> = 'foo#bar';\nexpectType<'foo#bar'>(delimiterFromKebab);\n\nconst delimiterFromComplexKebab: DelimiterCase<'foo-bar-abc-123', '#'>\n\t= 'foo#bar#abc#123';\nexpectType<'foo#bar#abc#123'>(delimiterFromComplexKebab);\n\nconst delimiterFromSpace: DelimiterCase<'foo bar', '#'> = 'foo#bar';\nexpectType<'foo#bar'>(delimiterFromSpace);\n\nconst delimiterFromTab: DelimiterCase<'foo\\tbar', '#'> = 'foo#bar';\nexpectType<'foo#bar'>(delimiterFromTab);\n\nconst delimiterFromSnake: DelimiterCase<'foo_bar', '#'> = 'foo#bar';\nexpectType<'foo#bar'>(delimiterFromSnake);\n\nconst noDelimiterFromMono: DelimiterCase<'foobar', '#'> = 'foobar';\nexpectType<'foobar'>(noDelimiterFromMono);\n\nconst delimiterFromMixed: DelimiterCase<'foo-bar_abc xyzBarFoo', '#'>\n\t= 'foo#bar#abc#xyz#bar#foo';\nexpectType<'foo#bar#abc#xyz#bar#foo'>(delimiterFromMixed);\n\nconst delimiterFromVendorPrefixedCssProperty: DelimiterCase<\n\t'-webkit-animation',\n\t'#'\n> = 'webkit#animation';\nexpectType<'webkit#animation'>(delimiterFromVendorPrefixedCssProperty);\n\nconst delimiterFromDoublePrefixedKebab: DelimiterCase<'--very-prefixed', '#'>\n\t= 'very#prefixed';\nexpectType<'very#prefixed'>(delimiterFromDoublePrefixedKebab);\n\nconst delimiterFromRepeatedSeparators: DelimiterCase<'foo____bar', '#'>\n\t= 'foo#bar';\nexpectType<'foo#bar'>(delimiterFromRepeatedSeparators);\n\nconst delimiterFromString: DelimiterCase<string, '#'> = 'foobar';\nexpectType<string>(delimiterFromString);\n\nconst delimiterFromScreamingSnake: DelimiterCase<'FOO_BAR', '#'> = 'foo#bar';\nexpectType<'foo#bar'>(delimiterFromScreamingSnake);\n\nconst delimiterFromMixed2: DelimiterCase<'parseHTML', '#'> = 'parse#html';\nexpectType<'parse#html'>(delimiterFromMixed2);\n\nconst delimiterFromMixed3: DelimiterCase<'parseHTMLItem', '#'>\n\t= 'parse#html#item';\nexpectType<'parse#html#item'>(delimiterFromMixed3);\n\nconst delimiterFromNumberInTheMiddleSplitOnNumbers: DelimiterCase<'foo2bar', '#', {splitOnNumbers: true}> = 'foo#2#bar';\nexpectType<'foo#2#bar'>(delimiterFromNumberInTheMiddleSplitOnNumbers);\n\nconst delimiterFromNumberInTheMiddleSplitOnNumbersEdgeCase: DelimiterCase<'foO2Bar', '#', {splitOnNumbers: true}> = 'fo#o#2#bar';\nexpectType<'fo#o#2#bar'>(delimiterFromNumberInTheMiddleSplitOnNumbersEdgeCase);\n\nconst delimiterFromNumberInTheMiddleSplitOnNumbersEdgeCase2: DelimiterCase<'foO2bar', '#', {splitOnNumbers: true}> = 'fo#o#2#bar';\nexpectType<'fo#o#2#bar'>(delimiterFromNumberInTheMiddleSplitOnNumbersEdgeCase2);\n\nconst delimiterFromNumberInTheMiddleNoSplitOnNumbers: DelimiterCase<'foo2bar', '#'> = 'foo2bar';\nexpectType<'foo2bar'>(delimiterFromNumberInTheMiddleNoSplitOnNumbers);\n\nconst delimiterFromNumberInTheMiddleNoSplitOnNumbersEdgeCase: DelimiterCase<'foo2Bar', '#'> = 'foo2#bar';\nexpectType<'foo2#bar'>(delimiterFromNumberInTheMiddleNoSplitOnNumbersEdgeCase);\n\nconst delimiterFromNumberInTheMiddleNoSplitOnNumbersEdgeCase2: DelimiterCase<'foO2bar', '#'> = 'fo#o2bar';\nexpectType<'fo#o2bar'>(delimiterFromNumberInTheMiddleNoSplitOnNumbersEdgeCase2);\n\nconst delimiterFromNumberInTheMiddleNoSplitOnNumbersEdgeCase3: DelimiterCase<'FOO22Bar', '#'> = 'foo22#bar';\nexpectType<'foo22#bar'>(\n\tdelimiterFromNumberInTheMiddleNoSplitOnNumbersEdgeCase3,\n);\n\ndeclare const unionValue: DelimiterCase<'fooBar' | 'barBaz', '#'>;\nexpectType<'foo#bar' | 'bar#baz'>(unionValue);\n\ndeclare const unionDelimiter: DelimiterCase<'fooBar', '#' | '$'>;\nexpectType<'foo#bar' | 'foo$bar'>(unionDelimiter);\n\ndeclare const unionValueAndDelimiter: DelimiterCase<'fooBar' | 'barBaz', '#' | '$'>;\nexpectType<'foo#bar' | 'bar#baz' | 'foo$bar' | 'bar$baz'>(unionValueAndDelimiter);\n\nconst stringPart: DelimiterCase<`foo${string}`, '#'> = 'fooSomeString';\nexpectType<`foo${string}`>(stringPart);\n\ndeclare const withPunctuation: DelimiterCase<'onDialog:close', '#'>;\nexpectType<'on#dialog:close'>(withPunctuation);\n\ndeclare const withPunctuation2: DelimiterCase<'foo-bar>>baz', '#'>;\nexpectType<'foo#bar>>baz'>(withPunctuation2);\n\ndeclare const withPunctuation3: DelimiterCase<'card::after', '#'>;\nexpectType<'card::after'>(withPunctuation3);\n\ndeclare const withPunctuation4: DelimiterCase<'div.card::after', '#'>;\nexpectType<'div.card::after'>(withPunctuation4);\n\ndeclare const withPunctuationAndNumber: DelimiterCase<'foo-bar::01', '#'>;\nexpectType<'foo#bar::01'>(withPunctuationAndNumber);\n\ndeclare const withPunctuationAndNumber2: DelimiterCase<'foo-bar::01', '#', {splitOnNumbers: true}>;\nexpectType<'foo#bar::#01'>(withPunctuationAndNumber2);\n\n// Verifying example\ntype OddCasedProperties<T> = {\n\t[K in keyof T as DelimiterCase<K, '#'>]: T[K];\n};\n\ntype CliOptions = {\n\tdryRun: boolean;\n\tincludeFile: string;\n\tfoo: number;\n};\n\nexpectAssignable<OddCasedProperties<CliOptions>>({\n\t'dry#run': true,\n\t'include#file': 'bar.js',\n\tfoo: 123,\n});\n"
  },
  {
    "path": "test-d/delimiter-cased-properties-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {DelimiterCasedPropertiesDeep} from '../index.d.ts';\n\ndeclare const foo: DelimiterCasedPropertiesDeep<{helloWorld: {fooBar: string}}, '/'>;\nexpectType<{'hello/world': {'foo/bar': string}}>(foo);\n\ndeclare const fooBar: DelimiterCasedPropertiesDeep<() => {a: string}, '/'>;\nexpectType<() => {a: string}>(fooBar);\n\ndeclare const bar: DelimiterCasedPropertiesDeep<Set<{fooBar: string}>, '-'>;\nexpectType<Set<{'foo-bar': string}>>(bar);\n\ndeclare const withOptions: DelimiterCasedPropertiesDeep<Set<{helloWorld: {p2p: Array<{addressLine1: string}>}}>, '.', {splitOnNumbers: true}>;\nexpectType<Set<{'hello.world': {'p.2.p': Array<{'address.line.1': string}>}}>>(withOptions);\n\n// Verify example\ntype User = {\n\tuserId: number;\n\tuserName: string;\n\tdate: Date;\n\tregExp: RegExp;\n};\n\ntype UserWithFriends = {\n\tuserInfo: User;\n\tuserFriends: User[];\n};\n\nconst result: DelimiterCasedPropertiesDeep<UserWithFriends, '-'> = {\n\t'user-info': {\n\t\t'user-id': 1,\n\t\t'user-name': 'Tom',\n\t\tdate: new Date(),\n\t\t'reg-exp': /.*/,\n\t},\n\t'user-friends': [\n\t\t{\n\t\t\t'user-id': 2,\n\t\t\t'user-name': 'Jerry',\n\t\t\tdate: new Date(),\n\t\t\t'reg-exp': /.*/,\n\t\t},\n\t\t{\n\t\t\t'user-id': 3,\n\t\t\t'user-name': 'Spike',\n\t\t\tdate: new Date(),\n\t\t\t'reg-exp': /.*/,\n\t\t},\n\t],\n};\nexpectType<DelimiterCasedPropertiesDeep<UserWithFriends, '-'>>(result);\n\n// Test object key properties\ndeclare const key: DelimiterCasedPropertiesDeep<{readonly userId?: number}, '-'>;\nexpectType<{readonly 'user-id'?: number}>(key);\n\n/** Test Array */\n// Test for tuple\ndeclare const tuple: DelimiterCasedPropertiesDeep<[User], '-'>;\nexpectType<[{'user-id': number; 'user-name': string; date: Date; 'reg-exp': RegExp}]>(tuple);\ndeclare const tuple2: DelimiterCasedPropertiesDeep<['UserId', 'UserAge', string], '-'>;\nexpectType<['UserId', 'UserAge', string]>(tuple2);\n// Test for readonly tuple\ndeclare const readonlyTuple: DelimiterCasedPropertiesDeep<readonly [{userId: string}, {userName: number}], '-'>;\nexpectType<readonly [{'user-id': string}, {'user-name': number}]>(readonlyTuple);\n// Test for array\ndeclare const array: DelimiterCasedPropertiesDeep<User[], '-'>;\nexpectType<Array<{'user-id': number; 'user-name': string; date: Date; 'reg-exp': RegExp}>>(array);\n// Test for readonly array\ndeclare const readonlyArray: DelimiterCasedPropertiesDeep<ReadonlyArray<{userId: string}>, '-'>;\nexpectType<ReadonlyArray<{'user-id': string}>>(readonlyArray);\n// Test for tailing spread array\ndeclare const tailingSpreadArray: DelimiterCasedPropertiesDeep<[{userId: string}, {userName: number}, ...Array<{userAge: number}>], '-'>;\nexpectType<[{'user-id': string}, {'user-name': number}, ...Array<{'user-age': number}>]>(tailingSpreadArray);\n// Test for leading spread array\ndeclare const leadingSpreadArray: DelimiterCasedPropertiesDeep<[...Array<{userId: string}>, {userName: number}, {userAge: number}], '-'>;\nexpectType<[...Array<{'user-id': string}>, {'user-name': number}, {'user-age': number}]>(leadingSpreadArray);\n// Test for enum\nenum UserType {\n\tAdminUser = 'adminUser',\n\tNormalUser = 'normalUser',\n}\ndeclare const enumTest: DelimiterCasedPropertiesDeep<{userType: UserType}, '-'>;\nexpectType<{['user-type']: UserType}>(enumTest);\nenumTest['user-type'] = UserType.AdminUser;\n\nexpectType<{'foo-bar': unknown}>({} as DelimiterCasedPropertiesDeep<{fooBar: unknown}, '-'>);\nexpectType<{'foo_bar': {'bar_baz': unknown}; biz: unknown}>({} as DelimiterCasedPropertiesDeep<{fooBar: {barBaz: unknown}; biz: unknown}, '_'>);\n\nexpectType<{'foo-bar': any}>({} as DelimiterCasedPropertiesDeep<{fooBar: any}, '-'>);\nexpectType<{'foo_bar': {'bar_baz': any}; biz: any}>({} as DelimiterCasedPropertiesDeep<{fooBar: {barBaz: any}; biz: any}, '_'>);\n"
  },
  {
    "path": "test-d/delimiter-cased-properties.ts",
    "content": "import {expectType} from 'tsd';\nimport type {DelimiterCasedProperties} from '../index.d.ts';\n\ndeclare const foo: DelimiterCasedProperties<{helloWorld: {fooBar: string}}, '/'>;\nexpectType<{'hello/world': {fooBar: string}}>(foo);\n\ndeclare const bar: DelimiterCasedProperties<Array<{helloWorld: string}>, '-'>;\nexpectType<Array<{helloWorld: string}>>(bar);\n\ndeclare const fooBar: DelimiterCasedProperties<() => {a: string}, '-'>;\nexpectType<() => {a: string}>(fooBar);\n\ndeclare const withOptions: DelimiterCasedProperties<{helloWorld1: {fooBar: string}}, '.', {splitOnNumbers: true}>;\nexpectType<{'hello.world.1': {fooBar: string}}>(withOptions);\n\n// Verify example\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\nconst result: DelimiterCasedProperties<User, '-'> = {\n\t'user-id': 1,\n\t'user-name': 'Tom',\n};\nexpectType<DelimiterCasedProperties<User, '-'>>(result);\n"
  },
  {
    "path": "test-d/distributed-omit.ts",
    "content": "import {expectType} from 'tsd';\nimport type {DistributedOmit, Except} from '../index.d.ts';\n\n// When passing a non-union type, and\n// omitting keys that are present in the type.\n// It behaves exactly like `Except`.\n\ntype Example1 = {\n\ta: number;\n\tb: string;\n};\n\ntype Actual1 = DistributedOmit<Example1, 'a'>;\ntype Actual2 = DistributedOmit<Example1, 'b'>;\ntype Actual3 = DistributedOmit<Example1, 'a' | 'b'>;\n\ntype Expected1 = Except<Example1, 'a'>;\ntype Expected2 = Except<Example1, 'b'>;\ntype Expected3 = Except<Example1, 'a' | 'b'>;\n\ndeclare const expected1: Expected1;\ndeclare const expected2: Expected2;\ndeclare const expected3: Expected3;\n\nexpectType<Actual1>(expected1);\nexpectType<Actual2>(expected2);\nexpectType<Actual3>(expected3);\n\n// When passing a non-union type, and\n// omitting keys that are NOT present in the type.\n// It behaves exactly like `Except`, by not letting you\n// omit keys that are not present in the type.\n\ntype Example2 = {\n\ta: number;\n\tb: string;\n};\n\n// @ts-expect-error\ntype Actual4 = DistributedOmit<Example2, 'c'>;\n\n// When passing a union type, and\n// omitting keys that are present in some union members.\n// It lets you omit keys that are present in some union members,\n// and distributes over the union.\n\ntype A = {\n\tdiscriminant: 'A';\n\tfoo: string;\n\ta: number;\n};\n\ntype B = {\n\tdiscriminant: 'B';\n\tfoo: string;\n\tbar: string;\n\tb: string;\n};\n\ntype C = {\n\tdiscriminant: 'C';\n\tbar: string;\n\tc: boolean;\n};\n\ntype Union = A | B | C;\n\ntype OmittedUnion = DistributedOmit<Union, 'foo' | 'bar'>;\n\ndeclare const omittedUnion: OmittedUnion;\n\nif (omittedUnion.discriminant === 'A') {\n\texpectType<{discriminant: 'A'; a: number}>(omittedUnion);\n\t// @ts-expect-error\n\tconst _a: unknown = omittedUnion.foo;\n\t// @ts-expect-error\n\tconst _b: unknown = omittedUnion.bar;\n}\n"
  },
  {
    "path": "test-d/distributed-pick.ts",
    "content": "import {expectType} from 'tsd';\nimport type {DistributedPick} from '../index.d.ts';\n\n// When passing a non-union type, and\n// picking keys that are present in the type.\n// It behaves exactly like `Pick`.\n\ntype Example1 = {\n\ta: number;\n\tb: string;\n};\n\ntype Actual1 = DistributedPick<Example1, 'a'>;\ntype Actual2 = DistributedPick<Example1, 'b'>;\ntype Actual3 = DistributedPick<Example1, 'a' | 'b'>;\n\ntype Expected1 = Pick<Example1, 'a'>;\ntype Expected2 = Pick<Example1, 'b'>;\ntype Expected3 = Pick<Example1, 'a' | 'b'>;\n\ndeclare const expected1: Expected1;\ndeclare const expected2: Expected2;\ndeclare const expected3: Expected3;\n\nexpectType<Actual1>(expected1);\nexpectType<Actual2>(expected2);\nexpectType<Actual3>(expected3);\n\n// When passing a non-union type, and\n// picking keys that are NOT present in the type.\n// It behaves exactly like `Pick`, by not letting you\n// pick keys that are not present in the type.\n\ntype Example2 = {\n\ta: number;\n\tb: string;\n};\n\n// @ts-expect-error\ntype Actual4 = DistributedPick<Example2, 'c'>;\n\n// When passing a union type, and\n// picking keys that are present in some union members.\n// It lets you pick keys that are present in some union members,\n// and distributes over the union.\n\ntype A = {\n\tdiscriminant: 'A';\n\tfoo: string;\n\ta: number;\n};\n\ntype B = {\n\tdiscriminant: 'B';\n\tfoo: string;\n\tbar: string;\n\tb: string;\n};\n\ntype C = {\n\tdiscriminant: 'C';\n\tbar: string;\n\tc: boolean;\n};\n\ntype Union = A | B | C;\n\ntype PickedUnion = DistributedPick<Union, 'discriminant' | 'a' | 'b' | 'c'>;\n\ndeclare const pickedUnion: PickedUnion;\n\nif (pickedUnion.discriminant === 'A') {\n\texpectType<{discriminant: 'A'; a: number}>(pickedUnion);\n\t// @ts-expect-error\n\tconst _foo = pickedUnion.foo; // eslint-disable-line @typescript-eslint/no-unsafe-assignment\n\t// @ts-expect-error\n\tconst _bar = pickedUnion.bar; // eslint-disable-line @typescript-eslint/no-unsafe-assignment\n}\n\n// Preserves property modifiers\ndeclare const test1: DistributedPick<{readonly 'a': 1; 'b'?: 2; readonly 'c'?: 3}, 'a' | 'b' | 'c'>;\nexpectType<{readonly 'a': 1; 'b'?: 2; readonly 'c'?: 3}>(test1);\n\ndeclare const test2: DistributedPick<{readonly 'a': 1; 'b'?: 2} | {readonly 'c'?: 3}, 'a' | 'b' | 'c'>;\nexpectType<{readonly 'a': 1; 'b'?: 2} | {readonly 'c'?: 3}>(test2);\n\n// Works with index signatures\ndeclare const test4: DistributedPick<{[k: string]: unknown; a?: number; b: string}, 'a' | 'b'>;\nexpectType<{a?: number; b: string}>(test4);\n"
  },
  {
    "path": "test-d/empty-object.ts",
    "content": "import {expectAssignable, expectType} from 'tsd';\nimport type {EmptyObject, IsEmptyObject} from '../index.d.ts';\n\ndeclare let foo: EmptyObject;\n\nexpectAssignable<{}>(foo);\nexpectAssignable<{}>(foo = {});\n\n// @ts-expect-error\nfoo = [];\n// @ts-expect-error\nfoo = {x: 1};\n// @ts-expect-error\nfoo = 42;\n// @ts-expect-error\nfoo = null;\n// @ts-expect-error\nfoo.bar = 42;\n// @ts-expect-error\nfoo.bar = {};\n\nexpectType<IsEmptyObject<{}>>(true);\nexpectType<IsEmptyObject<typeof foo>>(true);\n\nexpectType<IsEmptyObject<[]>>(false);\nexpectType<IsEmptyObject<null>>(false);\nexpectType<IsEmptyObject<() => void>>(false);\n\ntype Union = EmptyObject | {id: number};\n\nconst bar: Union = {};\n// @ts-expect-error\nconst _a: unknown = bar.id;\n\nconst baz: Union = {id: 42};\nexpectType<{id: number}>(baz);\n"
  },
  {
    "path": "test-d/entries.ts",
    "content": "import {expectAssignable} from 'tsd';\nimport type {Entries} from '../index.d.ts';\nimport type {Entry} from '../source/entry.d.ts';\n\n// Objects\nconst objectExample = {a: 1};\n\nconst objectEntry: Entry<typeof objectExample> = ['a', 1];\nexpectAssignable<[string, number]>(objectEntry);\n\nconst objectEntries: Entries<typeof objectExample> = [objectEntry];\nexpectAssignable<Array<[string, number]>>(objectEntries);\n\n// Maps\nconst mapExample = new Map([['a', 1]]);\n\nconst mapEntry: Entry<typeof mapExample> = ['a', 1];\nexpectAssignable<[string, number]>(mapEntry);\n\nconst mapEntries: Entries<typeof mapExample> = [mapEntry];\nexpectAssignable<Array<[string, number]>>(mapEntries);\n\n// Arrays\nconst arrayExample = ['a', 1];\n\nconst arrayEntryString: Entry<typeof arrayExample> = [0, 'a'];\nexpectAssignable<[number, (string | number)]>(arrayEntryString);\n\nconst arrayEntryNumber: Entry<typeof arrayExample> = [1, 1];\nexpectAssignable<[number, (string | number)]>(arrayEntryNumber);\n\nconst arrayEntries: Entries<typeof arrayExample> = [\n\tarrayEntryString,\n\tarrayEntryNumber,\n];\nexpectAssignable<Array<[number, (string | number)]>>(arrayEntries);\n\n// Sets\nconst setExample = new Set(['a', 1]);\n\nconst setEntryString: Entry<typeof setExample> = ['a', 'a'];\nexpectAssignable<[(string | number), (string | number)]>(setEntryString);\n\nconst setEntryNumber: Entry<typeof setExample> = [1, 1];\nexpectAssignable<[(string | number), (string | number)]>(setEntryNumber);\n\nconst setEntries: Entries<typeof setExample> = [\n\tsetEntryString,\n\tsetEntryNumber,\n];\nexpectAssignable<Array<[(string | number), (string | number)]>>(setEntries);\n"
  },
  {
    "path": "test-d/exact.ts",
    "content": "import type {Exact, Opaque} from '../index.d.ts';\n\n{ // Spec - string type\n\ttype Type = string;\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept string\n\t\tconst input = '';\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject number\n\t\tconst input = 1;\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject object\n\t\tconst input = {};\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - bigint type\n\ttype Type = bigint;\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept bigint\n\t\tconst input = BigInt(9_007_199_254_740_991);\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject number\n\t\tconst input = 1;\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject unknown\n\t\tconst input = {} as unknown;\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - array\n\ttype Type = Array<{code: string; name?: string}>;\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept array with required property only\n\t\tconst input = [{code: ''}];\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject readonly array\n\t\tconst input = [{code: ''}] as ReadonlyArray<{code: string}>;\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should accept array with optional property\n\t\tconst input = [{code: '', name: ''}];\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject array with excess property\n\t\tconst input = [{code: '', name: '', excessProperty: ''}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject invalid type\n\t\tconst input = '';\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - readonly array\n\ttype Type = ReadonlyArray<{code: string; name?: string}>;\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept array with required property only\n\t\tconst input = [{code: ''}];\n\t\tfunction_(input);\n\t}\n\n\t{ // It should accept readonly array\n\t\tconst input = [{code: ''}] as ReadonlyArray<{code: string}>;\n\t\tfunction_(input);\n\t}\n\n\t{ // It should accept array with optional property\n\t\tconst input = [{code: '', name: ''}];\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject array with excess property\n\t\tconst input = [{code: '', name: '', excessProperty: ''}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject invalid type\n\t\tconst input = '';\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - object\n\ttype Type = {code: string; name?: string};\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept object with required property only\n\t\tconst input = {code: ''};\n\t\tfunction_(input);\n\t}\n\n\t{ // It should accept object with optional property\n\t\tconst input = {code: '', name: ''};\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject object with excess property\n\t\tconst input = {code: '', name: '', excessProperty: ''};\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject invalid type\n\t\tconst input = '';\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - object with optional outer object @see https://github.com/sindresorhus/type-fest/pull/546#issuecomment-1385620838\n\ttype Type = {\n\t\touter?: {\n\t\t\tinner: {\n\t\t\t\tfield: string;\n\t\t\t};\n\t\t};\n\t};\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\tfunction_({\n\t\touter: {\n\t\t\tinner: {\n\t\t\t\tfield: 'foo',\n\t\t\t},\n\t\t},\n\t});\n}\n\n{ // Spec - union - only object\n\ttype Type = {code: string} | {name: string};\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept type a\n\t\tconst input = {code: ''};\n\t\tfunction_(input);\n\t}\n\n\t{ // It should accept type b\n\t\tconst input = {name: ''};\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject intersection\n\t\tconst input = {name: '', code: ''};\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - union - mixture object/primitive\n\ttype Type = {code: string} | string;\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept type a\n\t\tconst input = {code: ''};\n\t\tfunction_(input);\n\t}\n\n\t{ // It should accept type b\n\t\tconst input = '';\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject intersection\n\t\tconst input = {name: '', code: ''};\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - jsonschema2ts generated request type with additionalProperties: true\n\ttype Type = {\n\t\tbody: {\n\t\t\t[k: string]: unknown;\n\t\t\tcode: string;\n\t\t\tname?: string;\n\t\t};\n\t};\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept input with required property only\n\t\tconst input = {body: {code: ''}};\n\t\tfunction_(input);\n\t}\n\n\t{ // It should accept input with optional property\n\t\tconst input = {body: {code: '', name: ''}};\n\t\tfunction_(input);\n\t}\n\n\t{ // It should allow input with excess property\n\t\tconst input = {body: {code: '', name: '', excessProperty: 1}};\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - check index signature type\n\ttype Type = {\n\t\tbody: {\n\t\t\t[k: string]: string;\n\t\t\tcode: string;\n\t\t\tname?: string;\n\t\t};\n\t};\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should allow input with an excess property\n\t\tconst input = {body: {code: '', name: '', excessProperty: 1}};\n\t\t// Expects error because the excess property is not string\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - union of array\n\ttype Type = Array<{x: string}> & Array<{z: number}>;\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept valid input\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t\tz: 1,\n\t\t}];\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject missing field\n\t\tconst input = [{\n\t\t\tz: 1,\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject missing field\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject incorrect type\n\t\tconst input = [{\n\t\t\tx: 1,\n\t\t\tz: 1,\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject excess field\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t\ty: '',\n\t\t\tz: 1,\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - union of readonly array + non readonly array\n\ttype Type = ReadonlyArray<{x: string}> & Array<{z: number}>;\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept valid input\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t\tz: 1,\n\t\t}];\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject missing field\n\t\tconst input = [{\n\t\t\tz: 1,\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject missing field\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject incorrect type\n\t\tconst input = [{\n\t\t\tx: 1,\n\t\t\tz: 1,\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject excess field\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t\ty: '',\n\t\t\tz: 1,\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n{ // Spec - union of array with nested fields\n\ttype Type = Array<{x: string}> & Array<{z: number; d: {e: string; f: boolean}}>;\n\tconst function_ = <T extends Exact<Type, T>>(arguments_: T) => arguments_;\n\n\t{ // It should accept valid input\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t\tz: 1,\n\t\t\td: {\n\t\t\t\te: 'test',\n\t\t\t\tf: true,\n\t\t\t},\n\t\t}];\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject excess field\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t\tz: 1,\n\t\t\td: {\n\t\t\t\te: 'test',\n\t\t\t\tf: true,\n\t\t\t\tg: '', // Excess field\n\t\t\t},\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject missing field\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t\tz: 1,\n\t\t\td: {\n\t\t\t\te: 'test',\n\t\t\t\t// Missing f: boolean\n\t\t\t},\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n\n\t{ // It should reject missing field\n\t\tconst input = [{\n\t\t\tx: '',\n\t\t\tz: 1,\n\t\t\td: {\n\t\t\t\te: 'test',\n\t\t\t\tf: '', // Type mismatch\n\t\t\t},\n\t\t}];\n\t\t// @ts-expect-error\n\t\tfunction_(input);\n\t}\n}\n\n// Spec - special test case for Opaque types\n// @see https://github.com/sindresorhus/type-fest/issues/508\n{\n\ttype SpecialName = Opaque<string, 'special name'>;\n\n\ttype OnlyAcceptName = {\n\t\tname: SpecialName;\n\t};\n\n\tconst onlyAcceptNameImproved = <T extends Exact<OnlyAcceptName, T>>(arguments_: T) => arguments_;\n\n\tonlyAcceptNameImproved({\n\t\t// The error before the workaround:\n\t\t// Error: Type 'SpecialName' is not assignable to type 'never'\n\t\tname: 'name' as SpecialName,\n\t});\n}\n\n// Spec - special test case for Opaque type\n// @see https://github.com/sindresorhus/type-fest/issues/508\n{\n\t// Test for number Opaque type\n\ttype SpecialName = Opaque<number, 'special name'>;\n\n\ttype OnlyAcceptName = {\n\t\tname: SpecialName;\n\t};\n\n\tconst function_ = <T extends Exact<OnlyAcceptName, T>>(arguments_: T) => arguments_;\n\n\tfunction_({\n\t\t// The error before the workaround:\n\t\t// Error: Type 'SpecialName' is not assignable to type 'never'\n\t\tname: 1 as SpecialName,\n\t});\n}\n\n// Spec - test the above for tagged types too.\n{\n\ttype TaggedNumber = Opaque<number, 'tag'>;\n\n\tconst function_ = <T extends Exact<{a: TaggedNumber}, T>>(arguments_: T) => arguments_;\n\n\tfunction_({a: 1 as TaggedNumber});\n\t// @ts-expect-error\n\tfunction_({a: 1 as TaggedNumber, b: true});\n}\n\n// Spec - special test case for deep optional union\n// https://github.com/sindresorhus/type-fest/issues/545\n{\n\ttype ParameterType = {\n\t\touter?: {\n\t\t\tinner?: {\n\t\t\t\tunion: 'foo' | 'bar';\n\t\t\t};\n\t\t};\n\t};\n\n\tconst function_ = <InputT extends Exact<ParameterType, InputT>>(arguments_: InputT) => arguments_;\n\n\t// Test input with declared type\n\ttype Input = {\n\t\touter?: {\n\t\t\tinner?: {\n\t\t\t\tunion: 'foo' | 'bar';\n\t\t\t};\n\t\t};\n\t};\n\tconst variableWithDeclaredType: Input = {\n\t\touter: {\n\t\t\tinner: {\n\t\t\t\tunion: 'foo',\n\t\t\t},\n\t\t},\n\t};\n\tfunction_(variableWithDeclaredType);\n\n\t// Test input without declared type\n\tconst variableWithoutDeclaredType = {\n\t\touter: {\n\t\t\tinner: {\n\t\t\t\tunion: 'foo' as const,\n\t\t\t},\n\t\t},\n\t};\n\tfunction_(variableWithoutDeclaredType);\n\n\t// Test input with plain object\n\tfunction_({\n\t\touter: {\n\t\t\tinner: {\n\t\t\t\tunion: 'foo',\n\t\t\t},\n\t\t},\n\t});\n}\n\n// Spec - special test case for Date type + union\n// @see https://github.com/sindresorhus/type-fest/issues/896\n{\n\ttype A = {\n\t\ta: string;\n\t\tb?: Date | null;\n\t};\n\n\tconst function_ = <T extends Exact<A, T>>(arguments_: T) => arguments_;\n\n\tfunction_({a: 'a'});\n\tfunction_({a: 'a', b: new Date()});\n\tfunction_({a: 'a', b: new Date() as Date | null});\n\t// @ts-expect-error\n\tfunction_({a: 'a', b: 1});\n}\n\n// Spec - special test case for Date type\n// @see https://github.com/sindresorhus/type-fest/issues/909\n{\n\ttype UserType = {\n\t\tid: string;\n\t\tname: string;\n\t\tcreatedAt: Date;\n\t\temail?: string;\n\t};\n\n\tconst function_ = <T extends Exact<UserType, T>>(arguments_: T) => arguments_;\n\n\tfunction_({\n\t\tid: 'asd',\n\t\tname: 'John',\n\t\tcreatedAt: new Date(),\n\t});\n\n\tconst withExcessSurname = {\n\t\tid: 'asd',\n\t\tname: 'John',\n\t\tcreatedAt: new Date(),\n\t\tsurname: 'Doe',\n\t};\n\n\t// Expects error due to surname is an excess field\n\t// @ts-expect-error\n\tfunction_(withExcessSurname);\n}\n\n// Spec - recursive type with union\n// @see https://github.com/sindresorhus/type-fest/issues/948\n{\n\ttype A = {\n\t\ta: Expected;\n\t};\n\ttype B = {\n\t\tb: string;\n\t};\n\ttype Expected = A | B;\n\n\tconst function_ = <T extends Exact<Expected, T>>(arguments_: T) => arguments_;\n\n\tfunction_({} as Expected);\n}\n"
  },
  {
    "path": "test-d/except.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Except} from '../index.d.ts';\n\ndeclare const except: Except<{a: number; b: string}, 'b'>;\nexpectType<{a: number}>(except);\n// @ts-expect-error\nconst _a: unknown = except.b;\n\nconst nonStrict = {\n\ta: 1,\n\tb: '2',\n};\n\nconst nonStrictAssignment: typeof except = nonStrict; // No error\n\ndeclare const strictExcept: Except<{a: number; b: string}, 'b', {requireExactProps: true}>;\n\n// @ts-expect-error\nconst strictAssignment: typeof strictExcept = nonStrict;\n\n// Generic properties\ntype Example = {\n\t[key: string]: unknown;\n\tfoo: number;\n\tbar: string;\n};\n\nconst test: Except<Example, 'bar', {requireExactProps: false}> = {foo: 123, bar: 'asdf'};\nexpectType<number>(test.foo);\nexpectType<unknown>(test['bar']);\n"
  },
  {
    "path": "test-d/exclude-exactly.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ExcludeExactly} from '../index.d.ts';\n\nexpectType<number>({} as ExcludeExactly<number, '1'>);\nexpectType<never>({} as ExcludeExactly<number, number>);\nexpectType<0>({} as ExcludeExactly<0, number>);\nexpectType<string>({} as ExcludeExactly<string, '1'>);\nexpectType<never>({} as ExcludeExactly<string, string>);\nexpectType<'0'>({} as ExcludeExactly<'0', string>);\n\nexpectType<{a: 0}>({} as ExcludeExactly<{a: 0} | {readonly a: 0}, {readonly a: 0}>);\nexpectType<{readonly a: 0}>({} as ExcludeExactly<{a: 0} | {readonly a: 0}, {a: 0}>);\nexpectType<never>({} as ExcludeExactly<{readonly a: 0}, {readonly a: 0}>);\n\n// `never` excludes nothing\nexpectType<0 | 1 | 2>({} as ExcludeExactly<0 | 1 | 2, never>);\nexpectType<never>({} as ExcludeExactly<never, never>);\nexpectType<any>({} as ExcludeExactly<any, never>);\nexpectType<unknown>({} as ExcludeExactly<unknown, never>);\n\n// Excluding from `unknown`/`any`\nexpectType<unknown>({} as ExcludeExactly<unknown, string>);\nexpectType<[unknown]>({} as ExcludeExactly<[unknown], [number]>);\nexpectType<unknown[]>({} as ExcludeExactly<unknown[], number[]>);\nexpectType<{a: unknown}>({} as ExcludeExactly<{a: unknown}, {a: number}>);\nexpectType<unknown[]>({} as ExcludeExactly<number[] | unknown[], number[]>);\nexpectType<any>({} as ExcludeExactly<any, string>);\nexpectType<[any]>({} as ExcludeExactly<[any], [number]>);\nexpectType<any[]>({} as ExcludeExactly<any[], number[]>);\nexpectType<{a: any}>({} as ExcludeExactly<{a: any}, {a: number}>);\nexpectType<any[]>({} as ExcludeExactly<number[] | any[], number[]>);\n\n// Excluding `unknown`/`any`\nexpectType<never>({} as ExcludeExactly<unknown, unknown>);\nexpectType<never>({} as ExcludeExactly<any, any>);\nexpectType<unknown>({} as ExcludeExactly<unknown, any>);\nexpectType<any>({} as ExcludeExactly<any, unknown>);\nexpectType<string | number>({} as ExcludeExactly<string | number, unknown>);\nexpectType<string | number>({} as ExcludeExactly<string | number, any>);\nexpectType<never>({} as ExcludeExactly<never, any>);\nexpectType<never>({} as ExcludeExactly<never, unknown>);\n\n// Unions\nexpectType<2>({} as ExcludeExactly<0 | 1 | 2, 0 | 1>);\nexpectType<never>({} as ExcludeExactly<0 | 1 | 2, 0 | 1 | 2>);\nexpectType<{readonly a?: 0}>({} as ExcludeExactly<\n\t{a: 0} | {readonly a: 0} | {a?: 0} | {readonly a?: 0}, {a: 0} | {readonly a: 0} | {a?: 0}\n>);\nexpectType<never>({} as ExcludeExactly<\n\t{a: 0} | {readonly a: 0} | {a?: 0} | {readonly a?: 0}, {a: 0} | {readonly a: 0} | {a?: 0} | {readonly a?: 0}\n>);\n"
  },
  {
    "path": "test-d/exclude-rest-element.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ExcludeRestElement, TupleOf, UnknownArray} from '../index.d.ts';\n\n// Basic static tuples (No rest element)\nexpectType<ExcludeRestElement<[]>>({} as []);\nexpectType<ExcludeRestElement<[1]>>({} as [1]);\nexpectType<ExcludeRestElement<[1, 2, 3]>>({} as [1, 2, 3]);\nexpectType<ExcludeRestElement<readonly ['a', 'b']>>({} as readonly ['a', 'b']);\n\n// Leading rest element\nexpectType<ExcludeRestElement<[...string[], 1]>>({} as [1]);\nexpectType<ExcludeRestElement<[...number[], 'a', 'b']>>({} as ['a', 'b']);\nexpectType<ExcludeRestElement<[...any[], true]>>({} as [true]);\nexpectType<ExcludeRestElement<[...never[], 'end']>>({} as ['end']);\nexpectType<ExcludeRestElement<[...unknown[], 2, 3]>>({} as [2, 3]);\n\n// Middle rest element\nexpectType<ExcludeRestElement<['a', ...string[], 'z']>>({} as ['a', 'z']);\nexpectType<ExcludeRestElement<['x', ...boolean[], true]>>({} as ['x', true]);\nexpectType<ExcludeRestElement<['x', ...any[], 'y']>>({} as ['x', 'y']);\nexpectType<ExcludeRestElement<['x', ...readonly number[], 'y']>>({} as ['x', 'y']);\n\n// Trailing rest element\nexpectType<ExcludeRestElement<[1, 2, ...string[]]>>({} as [1, 2]);\nexpectType<ExcludeRestElement<['foo', ...Array<'bar'>]>>({} as ['foo']);\nexpectType<ExcludeRestElement<[number, ...number[]]>>({} as [number]);\n\n// Only rest element\nexpectType<ExcludeRestElement<string[]>>({} as []);\nexpectType<ExcludeRestElement<readonly number[]>>({} as readonly []);\nexpectType<ExcludeRestElement<readonly [...boolean[]]>>({} as readonly []);\nexpectType<ExcludeRestElement<[...string[]]>>({} as []);\n\n// Optional & mixed optional\nexpectType<ExcludeRestElement<[string?, boolean?, ...number[]]>>({} as [string?, boolean?]);\nexpectType<ExcludeRestElement<[number, boolean?, ...number[]]>>({} as [number, boolean?]);\nexpectType<ExcludeRestElement<[1?, ...string[]]>>({} as [1?]);\n\n// Unions\nexpectType<ExcludeRestElement<[1, ...string[]] | [2, ...number[]]>>({} as [1] | [2]);\nexpectType<ExcludeRestElement<[...boolean[], 'end'] | ['start', ...string[]]>>({} as ['end'] | ['start']);\n\n// Readonly\nexpectType<ExcludeRestElement<readonly [...number[], 'done']>>({} as readonly ['done']);\nexpectType<ExcludeRestElement<readonly [1, ...string[], 2]>>({} as readonly [1, 2]);\n\n// Nested Arrays\nexpectType<ExcludeRestElement<[[1, 2], ...number[], [3, 4]]>>({} as [[1, 2], [3, 4]]);\nexpectType<ExcludeRestElement<[['a'], ...string[], ['z']]>>({} as [['a'], ['z']]);\n\n// Edge: `never` / `any`\nexpectType<ExcludeRestElement<any>>({} as any);\nexpectType<ExcludeRestElement<never>>({} as never);\n\n// Long tuples\ntype FiftyZeroes = TupleOf<50, '0'>;\nexpectType<ExcludeRestElement<[...FiftyZeroes, ...number[]]>>({} as FiftyZeroes);\n\ntype NineHundredNinetyNineZeroes = TupleOf<999, '0'>;\nexpectType<ExcludeRestElement<[...NineHundredNinetyNineZeroes, ...number[]]>>({} as NineHundredNinetyNineZeroes);\n\n// Generic instantiations\ntype Assignability<_T extends UnknownArray> = unknown;\ntype TestAssignability<T extends UnknownArray> = Assignability<ExcludeRestElement<T>>;\n"
  },
  {
    "path": "test-d/exclude-strict.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ExcludeStrict} from '../source/exclude-strict.d.ts';\n\n// Primitive union tests\n\ntype ShirtSize = 'xxxl' | 'xxl' | 'xl' | 'l' | 'm' | 's' | 'xs' | 'xxs';\ntype LargeShirtSize = 'xxxl' | 'xxl' | 'xl' | 'l';\ntype SmallShirtSize = 's' | 'xs' | 'xxs';\n\ndeclare const nonLargeShirtSizes: ExcludeStrict<ShirtSize, LargeShirtSize>;\nexpectType<'m' | SmallShirtSize>(nonLargeShirtSizes);\n\ndeclare const nonSmallShirtSizes: ExcludeStrict<ShirtSize, SmallShirtSize>;\nexpectType<LargeShirtSize | 'm'>(nonSmallShirtSizes);\n\n// @ts-expect-error\ndeclare const allInvalidShirtSizes: ExcludeStrict<ShirtSize, 'skyscraper-large' | 'atom-small'>;\n\n// @ts-expect-error\ndeclare const someInvalidShirtSizes: ExcludeStrict<ShirtSize, 'm' | 'atom-small'>;\n\n// Object union tests\n\ntype Foo = {\n\tkind: 'foo';\n\ta: string;\n\tb: string;\n};\n\ntype Bar = {\n\tkind: 'bar';\n\ta: string;\n\tb: number;\n\tc: boolean;\n};\n\ntype Foobar = Foo | Bar;\n\nexpectType<never>({} as ExcludeStrict<Foobar, {a: string}>);\nexpectType<Bar>({} as ExcludeStrict<Foobar, {kind: 'foo'}>);\nexpectType<Bar>({} as ExcludeStrict<Foobar, {b: string}>);\nexpectType<Foo>({} as ExcludeStrict<Foobar, {c: boolean}>);\nexpectType<never>({} as ExcludeStrict<Foobar, {b: string} | {c: boolean}>);\n\n// @ts-expect-error\ndeclare const invalidLoneField: ExcludeStrict<Foobar, {d: string}>;\n\n// @ts-expect-error\ndeclare const invalidMixedFields: ExcludeStrict<Foobar, {kind: 'foo'; d: string}>;\n\n// @ts-expect-error\ndeclare const undefinedField: ExcludeStrict<Foobar, undefined>;\n\n// Primitives\nexpectType<number>({} as ExcludeStrict<string | number, string>);\nexpectType<string>({} as ExcludeStrict<string | number | bigint, number | bigint>);\nexpectType<'foo'>({} as ExcludeStrict<'foo' | 'bar' | 'baz', `b${string}`>);\n\n// @ts-expect-error\ntype invalid1 = ExcludeStrict<string | number | boolean, number | bigint>;\n// @ts-expect-error\ntype invalid2 = ExcludeStrict<string, Uppercase<string>>;\n\n// Optional and readonly modifiers\nexpectType<never>({} as ExcludeStrict<{a: string; b: number}, {a?: string}>);\nexpectType<{c: string; d: number}>({} as ExcludeStrict<{a: string; b: number} | {c: string; d: number}, {a?: string}>);\nexpectType<never>({} as ExcludeStrict<string[], readonly string[]>);\n\n// @ts-expect-error\ntype invalid3 = ExcludeStrict<{a?: string; b: number}, {a: string}>;\n// @ts-expect-error\ntype invalid4 = ExcludeStrict<readonly string[], string[]>;\n\n// Index signatures\nexpectType<{a: string; b: number}>(\n\t{} as ExcludeStrict<{a: string; b: number} | {c: true; d: false}, Record<string, boolean>>,\n);\n\n// @ts-expect-error\ntype invalid5 = ExcludeStrict<{a: string; b: number} | {c: true; d: false}, Record<string, string>>;\n\n// `any` and `never`\nexpectType<never>(\n\t{} as ExcludeStrict<string | {a: string; b: number} | string[], any>,\n);\nexpectType<string | {a: string; b: number} | string[]>(\n\t{} as ExcludeStrict<string | {a: string; b: number} | string[], never>,\n);\n\n// Miscellaneous\nexpectType<{x: number; y: number}>({} as ExcludeStrict<[number, number] | {x: number; y: number}, unknown[]>);\nexpectType<[number, number, number]>({} as ExcludeStrict<[number, number] | [number, number, number], {length: 2}>);\nexpectType<string | string[]>({} as ExcludeStrict<string | string[] | {data: string | string[]}, {data: unknown}>);\n"
  },
  {
    "path": "test-d/exclusify-union.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ExclusifyUnion} from '../source/exclusify-union.d.ts';\nimport type {MapsSetsOrArrays, NonRecursiveType} from '../source/internal/type.d.ts';\n\nexpectType<{a: string; b?: never} | {a?: never; b: number}>({} as ExclusifyUnion<{a: string} | {b: number}>);\nexpectType<{a: string; b?: never; c?: never} | {a?: never; b: number; c?: never} | {a?: never; b?: never; c: boolean}>(\n\t{} as ExclusifyUnion<{a: string} | {b: number} | {c: boolean}>,\n);\nexpectType<{a: string; b: number; c?: never; d?: never} | {a?: never; b?: never; c: string; d: number}>(\n\t{} as ExclusifyUnion<{a: string; b: number} | {c: string; d: number}>,\n);\nexpectType<\n\t| {a: string; b?: never; c?: never; d?: never; e?: never; f?: never}\n\t| {a?: never; b: string; c: number; d?: never; e?: never; f?: never}\n\t| {a?: never; b?: never; c?: never; d: 1; e: 2; f: 3}\n>(\n\t{} as ExclusifyUnion<{a: string} | {b: string; c: number} | {d: 1; e: 2; f: 3}>,\n);\n\n// Single member union\nexpectType<{a: string}>({} as ExclusifyUnion<{a: string}>);\nexpectType<{a?: string; readonly b?: number}>({} as ExclusifyUnion<{a?: string; readonly b?: number}>);\n\n// Shared keys\nexpectType<{a: string; b?: never} | {a: string; b: number}>({} as ExclusifyUnion<{a: string} | {a: string; b: number}>);\nexpectType<{a: string; b?: never; c?: never} | {a: string; b: number; c?: never} | {a?: never; b: string; c: boolean}>(\n\t{} as ExclusifyUnion<{a: string} | {a: string; b: number} | {b: string; c: boolean}>,\n);\n\n// Already exclusive unions\nexpectType<{a: string; b?: never} | {a?: never; b: number}>({} as ExclusifyUnion<{a: string; b?: never} | {a?: never; b: number}>);\nexpectType<{a: string} | {a: number}>({} as ExclusifyUnion<{a: string} | {a: number}>);\n\n// Preserves property modifiers\nexpectType<{a?: 1; readonly b: 2; readonly c?: 3; d?: never; e?: never} | {a?: never; b?: never; c?: never; d: 4; readonly e?: 5}>(\n\t{} as ExclusifyUnion<{a?: 1; readonly b: 2; readonly c?: 3} | {d: 4; readonly e?: 5}>,\n);\nexpectType<{a?: string; readonly b: number} | {readonly a: string; b?: number}>(\n\t{} as ExclusifyUnion<{a?: string; readonly b: number} | {readonly a: string; b?: number}>,\n);\n\n// Non-recursive types\nexpectType<Set<string> | Map<string, string>>({} as ExclusifyUnion<Set<string> | Map<string, string>>);\nexpectType<WeakSet<{a: string}> | WeakMap<{a: string}, string>>({} as ExclusifyUnion<WeakSet<{a: string}> | WeakMap<{a: string}, string>>);\nexpectType<string[] | Set<string>>({} as ExclusifyUnion<string[] | Set<string>>);\nexpectType<NonRecursiveType>({} as ExclusifyUnion<NonRecursiveType>);\nexpectType<MapsSetsOrArrays>({} as ExclusifyUnion<MapsSetsOrArrays>);\n\n// Mix of non-recursive and recursive types\nexpectType<{a: string; b?: never} | {a: number; b: true} | undefined>({} as ExclusifyUnion<{a: string} | {a: number; b: true} | undefined>);\nexpectType<Date | {DDMMYYYY: string; MMDDYYYY?: never} | {DDMMYYYY?: never; MMDDYYYY: string}>(\n\t{} as ExclusifyUnion<Date | {DDMMYYYY: string} | {MMDDYYYY: string}>,\n);\nexpectType<RegExp | null | {foo: string; bar?: never; baz?: never} | {foo?: never; bar: number; baz: {qux: string}}>(\n\t{} as ExclusifyUnion<RegExp | null | {foo: string} | {bar: number; baz: {qux: string}}>,\n);\n\n// Practical test cases\ntype FileConfig = {filePath: string};\ntype InlineConfig = {content: string};\n\ntype Config = ExclusifyUnion<FileConfig | InlineConfig>;\n//=> {filePath: string; content?: never} | {content: string; filePath?: never}\n\ndeclare function loadConfig(options: Config): void;\n\n// @ts-expect-error\nloadConfig({filePath: './config.json', content: '{ \"name\": \"app\" }'}); // Cannot provide both properties\nloadConfig({filePath: './config.json'}); // Ok\nloadConfig({content: '{ \"name\": \"app\" }'}); // Ok\n\ntype CardPayment = {amount: number; cardNumber: string};\ntype PaypalPayment = {amount: number; paypalId: string};\n\nfunction processPayment(payment: ExclusifyUnion<CardPayment | PaypalPayment>) {\n\t// Can access `cardNumber` or `paypalId` directly\n\t// And, the resulting type is also correctly `string`\n\tconst details = payment.cardNumber ?? payment.paypalId;\n\texpectType<string>(details);\n}\n\n// Boundary types\nexpectType<unknown>({} as ExclusifyUnion<unknown>);\nexpectType<any>({} as ExclusifyUnion<any>);\nexpectType<never>({} as ExclusifyUnion<never>);\n"
  },
  {
    "path": "test-d/extends-strict.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Tagged} from '../source/tagged.d.ts';\nimport type {ExtendsStrict} from '../source/extends-strict.d.ts';\n\n// Basic\nexpectType<ExtendsStrict<string, string>>(true);\nexpectType<ExtendsStrict<number, number>>(true);\nexpectType<ExtendsStrict<1, number>>(true);\nexpectType<ExtendsStrict<number, 1>>(false);\nexpectType<ExtendsStrict<'foo', 'foo' | 'bar'>>(true);\nexpectType<ExtendsStrict<'foo' | 'bar', 'foo'>>(false);\n\n// Union behavior\nexpectType<ExtendsStrict<string | number, string>>(false);\nexpectType<ExtendsStrict<string, string | number>>(true);\nexpectType<ExtendsStrict<string | string[], string>>(false);\nexpectType<ExtendsStrict<string, string | string[]>>(true);\n\n// Never handling\nexpectType<ExtendsStrict<never, never>>(true);\nexpectType<ExtendsStrict<never, string>>(false);\nexpectType<ExtendsStrict<string, never>>(false);\n\n// Any and unknown\nexpectType<ExtendsStrict<any, any>>(true);\nexpectType<ExtendsStrict<any, never>>(true);\nexpectType<ExtendsStrict<never, any>>(true);\nexpectType<ExtendsStrict<any, number>>(true);\nexpectType<ExtendsStrict<any, unknown>>(true); // `any` is assignable to `unknown`\nexpectType<ExtendsStrict<unknown, any>>(true); // `unknown` is assignable to `any`\nexpectType<ExtendsStrict<unknown, unknown>>(true);\nexpectType<ExtendsStrict<string, unknown>>(true);\nexpectType<ExtendsStrict<unknown, string>>(false);\n\n// Tuples\nexpectType<ExtendsStrict<[1, 2], number[]>>(true);\nexpectType<ExtendsStrict<number[], [1, 2]>>(false);\nexpectType<ExtendsStrict<[], []>>(true);\n\n// Objects\nexpectType<ExtendsStrict<{a: 1}, {a: number}>>(true);\nexpectType<ExtendsStrict<{a: number}, {a: 1}>>(false);\nexpectType<ExtendsStrict<{a: number}, {a: number; b: string}>>(false);\nexpectType<ExtendsStrict<{a: number; b: string}, {a: number}>>(true);\n\n// Functions\nexpectType<ExtendsStrict<() => void, Function>>(true);\nexpectType<ExtendsStrict<Function, () => void>>(false);\nexpectType<ExtendsStrict<() => void, () => void>>(true);\nexpectType<ExtendsStrict<(...args: any[]) => unknown, Function>>(true);\n\n// Intersections\nexpectType<ExtendsStrict<string & {bar: string}, string>>(true);\nexpectType<ExtendsStrict<string, string & {bar: string}>>(false);\n\n// Literal vs primitive\nexpectType<ExtendsStrict<'foo', string>>(true);\nexpectType<ExtendsStrict<string, 'foo'>>(false);\n\n// Arrays\nexpectType<ExtendsStrict<string[], string[]>>(true);\nexpectType<ExtendsStrict<[string], string[]>>(true); // Tuple is assignable to array\nexpectType<ExtendsStrict<string[], [string]>>(false); // Array not assignable to fixed tuple\n\n// Branded types\ntype UserId = Tagged<string, 'UserId'>;\n\nexpectType<ExtendsStrict<UserId, string>>(true);\nexpectType<ExtendsStrict<string, UserId>>(false);\nexpectType<ExtendsStrict<UserId, UserId>>(true);\n\n// Edge meta-types\nexpectType<ExtendsStrict<null, any>>(true);\nexpectType<ExtendsStrict<undefined, any>>(true);\nexpectType<ExtendsStrict<null, undefined>>(false);\nexpectType<ExtendsStrict<undefined, null>>(false);\nexpectType<ExtendsStrict<undefined, unknown>>(true);\nexpectType<ExtendsStrict<null, unknown>>(true);\n"
  },
  {
    "path": "test-d/extract-rest-element.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ExtractRestElement, TupleOf} from '../index.d.ts';\n\n// Leading rest element\nexpectType<ExtractRestElement<[...string[], 1]>>({} as string);\nexpectType<ExtractRestElement<[...number[], 'a', 'b']>>({} as number);\nexpectType<ExtractRestElement<[...any[], true]>>({} as any);\nexpectType<ExtractRestElement<[...never[], 'end']>>({} as never);\nexpectType<ExtractRestElement<[...unknown[], 2, 3]>>({} as unknown);\n\n// Middle rest element\nexpectType<ExtractRestElement<['a', ...string[], 'z']>>({} as string);\nexpectType<ExtractRestElement<['x', ...boolean[], true]>>({} as boolean);\nexpectType<ExtractRestElement<['x', ...any[], 'y']>>({} as any);\n\n// Trailing rest element\nexpectType<ExtractRestElement<[1, 2, ...string[]]>>({} as string);\nexpectType<ExtractRestElement<['foo', ...Array<'bar'>]>>({} as 'bar');\nexpectType<ExtractRestElement<[number, ...number[]]>>({} as number);\n\n// Rest element only\nexpectType<ExtractRestElement<string[]>>({} as string);\nexpectType<ExtractRestElement<readonly number[]>>({} as number);\nexpectType<ExtractRestElement<readonly [...boolean[]]>>({} as boolean);\nexpectType<ExtractRestElement<[...string[]]>>({} as string);\n\n// Optional\nexpectType<ExtractRestElement<[string?, boolean?, ...number[]]>>({} as number);\nexpectType<ExtractRestElement<[number, boolean?, ...number[]]>>({} as number);\nexpectType<ExtractRestElement<[1?, ...string[]]>>({} as string);\n\n// No rest element\nexpectType<ExtractRestElement<[1, 2, 3]>>({} as never);\nexpectType<ExtractRestElement<readonly ['a', 'b']>>({} as never);\nexpectType<ExtractRestElement<[]>>({} as never);\n\n// Union\nexpectType<ExtractRestElement<[1, ...string[]] | [2, ...number[]]>>({} as string | number);\nexpectType<ExtractRestElement<[...boolean[], 'end'] | ['start', ...string[]]>>({} as boolean | string);\n\n// Readonly\nexpectType<ExtractRestElement<readonly [...number[], 'done']>>({} as number);\nexpectType<ExtractRestElement<readonly [1, ...string[], 2]>>({} as string);\n\n// Nested arrays\nexpectType<ExtractRestElement<[[1, 2], ...string[], [3, 4]]>>({} as string);\nexpectType<ExtractRestElement<[['a'], ...boolean[], ['z']]>>({} as boolean);\n\n// Edge: `never` / `any`\nexpectType<ExtractRestElement<any>>({} as any);\nexpectType<ExtractRestElement<never>>({} as never);\n\n// Long tuples\ntype FiftyZeroes = TupleOf<50, '0'>;\nexpectType<ExtractRestElement<[...FiftyZeroes, ...number[]]>>({} as number);\n\ntype NineHundredNinetyNineZeroes = TupleOf<999, '0'>;\nexpectType<ExtractRestElement<[...NineHundredNinetyNineZeroes, ...number[]]>>({} as number);\n"
  },
  {
    "path": "test-d/extract-strict.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ExtractStrict} from '../source/extract-strict.d.ts';\n\n// Primitive union tests\n\ntype ShirtSize = 'xxxl' | 'xxl' | 'xl' | 'l' | 'm' | 's' | 'xs' | 'xxs';\ntype LargeShirtSize = 'xxxl' | 'xxl' | 'xl' | 'l';\ntype SmallShirtSize = 's' | 'xs' | 'xxs';\n\ndeclare const largeShirtSizes: ExtractStrict<ShirtSize, LargeShirtSize>;\nexpectType<LargeShirtSize>(largeShirtSizes);\n\ndeclare const smallShirtSizes: ExtractStrict<ShirtSize, SmallShirtSize>;\nexpectType<SmallShirtSize>(smallShirtSizes);\n\n// @ts-expect-error\ndeclare const allInvalidShirtSizes: ExtractStrict<ShirtSize, 'skyscraper-large' | 'atom-small'>;\n\n// @ts-expect-error\ndeclare const someInvalidShirtSizes: ExtractStrict<ShirtSize, 'm' | 'atom-small'>;\n\n// Object union tests\n\ntype Foo = {\n\tkind: 'foo';\n\ta: string;\n\tb: string;\n};\n\ntype Bar = {\n\tkind: 'bar';\n\ta: string;\n\tb: number;\n\tc: boolean;\n};\n\ntype Foobar = Foo | Bar;\n\ndeclare const foobarByA: ExtractStrict<Foobar, {a: string}>;\nexpectType<Foobar>(foobarByA);\n\ndeclare const onlyFooByKind: ExtractStrict<Foobar, {kind: 'foo'}>;\nexpectType<Foo>(onlyFooByKind);\n\ndeclare const onlyFooByB: ExtractStrict<Foobar, {b: string}>;\nexpectType<Foo>(onlyFooByB);\n\ndeclare const onlyBarByC: ExtractStrict<Foobar, {c: boolean}>;\nexpectType<Bar>(onlyBarByC);\n\ndeclare const foobarByUnionBC: ExtractStrict<Foobar, {b: string} | {c: boolean}>;\nexpectType<Foobar>(foobarByUnionBC);\n\n// @ts-expect-error\ndeclare const invalidLoneField: ExtractStrict<Foobar, {d: string}>;\n\n// @ts-expect-error\ndeclare const invalidMixedFields: ExtractStrict<Foobar, {kind: 'foo'; d: string}>;\n\n// @ts-expect-error\ndeclare const undefinedField: ExtractStrict<Foobar, undefined>;\n\n// Primitives\nexpectType<number>({} as ExtractStrict<string | number, number>);\nexpectType<number | bigint>({} as ExtractStrict<string | number | bigint, number | bigint>);\nexpectType<'bar' | 'baz'>({} as ExtractStrict<'foo' | 'bar' | 'baz', `b${string}`>);\n\n// @ts-expect-error\ntype invalid1 = ExtractStrict<string | number | boolean, number | bigint>;\n// @ts-expect-error\ntype invalid2 = ExtractStrict<string, Uppercase<string>>;\n\n// Optional and readonly modifiers\nexpectType<{a: string; b: number}>({} as ExtractStrict<{a: string; b: number}, {a?: string}>);\nexpectType<string[]>({} as ExtractStrict<string[], readonly string[]>);\n\n// @ts-expect-error\ntype invalid3 = ExtractStrict<{a?: string; b: number}, {a: string}>;\n// @ts-expect-error\ntype invalid4 = ExtractStrict<readonly string[], string[]>;\n\n// Index signatures\nexpectType<{c: true; d: false}>(\n\t{} as ExtractStrict<{a: string; b: number} | {c: true; d: false}, Record<string, boolean>>,\n);\n\n// @ts-expect-error\ntype invalid5 = ExtractStrict<{a: string; b: number} | {c: true; d: false}, Record<string, string>>;\n\n// `any` and `never`\nexpectType<string | {a: string; b: number} | string[]>(\n\t{} as ExtractStrict<string | {a: string; b: number} | string[], any>,\n);\nexpectType<never>(\n\t{} as ExtractStrict<string | {a: string; b: number} | string[], never>,\n);\n\n// Miscellaneous\nexpectType<[number, number]>({} as ExtractStrict<[number, number] | {x: number; y: number}, unknown[]>);\nexpectType<[number, number]>({} as ExtractStrict<[number, number] | [number, number, number], {length: 2}>);\nexpectType<{data: string | string[]}>({} as ExtractStrict<string | string[] | {data: string | string[]}, {data: unknown}>);\n"
  },
  {
    "path": "test-d/find-global-type.ts",
    "content": "/* eslint-disable no-var */\nimport {expectType} from 'tsd';\nimport type {FindGlobalInstanceType, FindGlobalType} from '../index.d.ts';\n\ndeclare class NonGlobalES6Class {}\ndeclare var nonGlobalVar: number;\ndeclare let nonGlobalLet: number;\ndeclare const nonGlobalConst: number;\n\ndeclare global {\n\tclass GlobalES6Class {}\n\tvar globalVar: string;\n\tlet globalLet: number;\n\tconst globalConst: number;\n\n\ttype GlobalClass = {foo: string};\n\tvar GlobalConstructorVarStyle: new () => GlobalClass;\n\tlet GlobalConstructorLetStyle: new () => GlobalClass;\n\tconst GlobalConstructorConstStyle: new () => GlobalClass;\n\n\ttype GlobalTypeAlias = {value: string};\n\n\tvar nonConstructorFunction: () => Date;\n}\n\n// === FindGlobalType ===\n\n// Success\ndeclare const foundGlobalVar: FindGlobalType<'globalVar'>;\nexpectType<string>(foundGlobalVar);\n\n// Failures\ndeclare const foundNonGlobalES6Class: FindGlobalType<'nonGlobalVar'>;\nexpectType<never>(foundNonGlobalVar);\ndeclare const foundNonGlobalVar: FindGlobalType<'nonGlobalVar'>;\nexpectType<never>(foundNonGlobalVar);\ndeclare const foundNonGlobalLet: FindGlobalType<'nonGlobalLet'>;\nexpectType<never>(foundNonGlobalLet);\ndeclare const foundNonGlobalConst: FindGlobalType<'nonGlobalConst'>;\nexpectType<never>(foundNonGlobalConst);\n\ndeclare const foundGlobalLet: FindGlobalType<'globalLet'>;\nexpectType<never>(foundGlobalLet);\ndeclare const foundGlobalConst: FindGlobalType<'globalConst'>;\nexpectType<never>(foundGlobalConst);\n\n// === FindGlobalInstanceType ===\n\n// Success\ndeclare const foundInstanceDate: FindGlobalInstanceType<'Date'>;\nexpectType<Date>(foundInstanceDate);\ndeclare const foundInstanceMultiple: FindGlobalInstanceType<'Date' | 'Error'>;\nexpectType<Date | Error>(foundInstanceMultiple);\ndeclare const foundInstanceMultiplePartial: FindGlobalInstanceType<'Date' | 'Error' | 'NonExistentType'>;\nexpectType<Date | Error>(foundInstanceMultiplePartial);\ndeclare const foundInstanceGlobalConstructorVarStyle: FindGlobalInstanceType<'GlobalConstructorVarStyle'>;\nexpectType<GlobalClass>(foundInstanceGlobalConstructorVarStyle);\n\n// Failures\ndeclare const foundInstanceNonExistentType: FindGlobalInstanceType<'NonExistentType'>;\nexpectType<never>(foundInstanceNonExistentType);\ndeclare const foundInstanceNonGlobalES6Class: FindGlobalInstanceType<'NonGlobalES6Class'>;\nexpectType<never>(foundInstanceNonGlobalES6Class);\n\ndeclare const foundInstanceGlobalTypeAlias: FindGlobalInstanceType<'GlobalTypeAlias'>;\nexpectType<never>(foundInstanceGlobalTypeAlias);\ndeclare const foundInstanceGlobalES6Class: FindGlobalInstanceType<'GlobalES6Class'>;\nexpectType<never>(foundInstanceGlobalES6Class);\ndeclare const foundInstanceGlobalConstructorLetStyle: FindGlobalInstanceType<'GlobalConstructorLetStyle'>;\nexpectType<never>(foundInstanceGlobalConstructorLetStyle);\ndeclare const foundInstanceGlobalConstructorConstStyle: FindGlobalInstanceType<'GlobalConstructorConstStyle'>;\nexpectType<never>(foundInstanceGlobalConstructorConstStyle);\ndeclare const foundInstanceGlobalNonConstructorFunction: FindGlobalInstanceType<'nonConstructorFunction'>;\nexpectType<never>(foundInstanceGlobalNonConstructorFunction);\n"
  },
  {
    "path": "test-d/fixed-length-array.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {FixedLengthArray} from '../index.d.ts';\n\ntype FixedToThreeStrings = FixedLengthArray<string, 3>;\ndeclare const fixedToThreeStrings: FixedToThreeStrings;\n\nexpectAssignable<FixedToThreeStrings>(['a', 'b', 'c']);\nexpectAssignable<readonly [string, string, string]>({} as FixedToThreeStrings);\nexpectAssignable<readonly string[]>({} as FixedToThreeStrings);\n\n// Reading within bounds\nexpectType<string>({} as FixedToThreeStrings[0]);\nexpectType<string>({} as FixedToThreeStrings[1]);\nexpectType<string>({} as FixedToThreeStrings[2]);\n\n// Reading out of bounds\n// @ts-expect-error\ntype OutOfBounds = FixedToThreeStrings[3];\n\n// Writing within bounds\nfixedToThreeStrings[0] = 'a';\nfixedToThreeStrings[1] = 'b';\nfixedToThreeStrings[2] = 'c';\n\n// Writing out of bounds\n// @ts-expect-error\nfixedToThreeStrings[3] = 'd';\n\nexpectType<3>({} as FixedToThreeStrings['length']);\n\n// @ts-expect-error\ntype NoSplice = FixedToThreeStrings['splice'];\n// @ts-expect-error\ntype NoPush = FixedToThreeStrings['push'];\n// @ts-expect-error\ntype NoPop = FixedToThreeStrings['pop'];\n// @ts-expect-error\ntype NoShift = FixedToThreeStrings['shift'];\n// @ts-expect-error\ntype NoUnshift = FixedToThreeStrings['unshift'];\n\nexpectNotAssignable<FixedToThreeStrings>(['a', 'b', 123]);\nexpectNotAssignable<FixedToThreeStrings>(['a']);\nexpectNotAssignable<FixedToThreeStrings>(['a', 'b']);\nexpectNotAssignable<FixedToThreeStrings>(['a', 'b', 'c', 'd']);\n\ntype FixedLength = FixedLengthArray<string, number>;\ndeclare const fixedLength: FixedLength;\n\nexpectAssignable<FixedLength>({} as string[]);\nexpectAssignable<readonly string[]>({} as FixedLength);\n\n// Reading\n// Note: The extra `undefined` is only present when `noUncheckedIndexedAccess` is enabled.\nexpectType<string | undefined>(fixedLength[0]);\nexpectType<string | undefined>(fixedLength[100]);\n// Note: Reading directly from the type doesn't include `undefined`.\nexpectType<string>({} as FixedLength[100]);\n\n// Writing\n// This is allowed for now, refer https://github.com/sindresorhus/type-fest/pull/1246#discussion_r2384018774\nfixedLength[0] = 'a';\nfixedLength[100] = 'b';\n\n// @ts-expect-error\ntype NoSplice = FixedLength['splice'];\n// @ts-expect-error\ntype NoPush = FixedLength['push'];\n// @ts-expect-error\ntype NoPop = FixedLength['pop'];\n// @ts-expect-error\ntype NoShift = FixedLength['shift'];\n// @ts-expect-error\ntype NoUnshift = FixedLength['unshift'];\n\nexpectAssignable<FixedLengthArray<string | number, 3>>(['a', 'b', 'c']);\nexpectAssignable<FixedLengthArray<string | number, 3>>([3, 2, 1]);\nexpectAssignable<FixedLengthArray<string | number, 3>>(['a', 'b', 3]);\nexpectAssignable<FixedLengthArray<string | number, 3>>([1, 'b', 3]);\nexpectNotAssignable<FixedLengthArray<string | number, 3>>([1, 'b', 3, 4]);\nexpectNotAssignable<FixedLengthArray<string | number, 3>>([1, 'b', true]);\n\nexpectAssignable<FixedLengthArray<string, 2 | 3>>(['a', 'b']);\nexpectAssignable<FixedLengthArray<string, 2 | 3>>(['a', 'b', 'c']);\nexpectNotAssignable<FixedLengthArray<string, 2 | 3>>(['a']);\nexpectNotAssignable<FixedLengthArray<string, 2 | 3>>([1, 2]);\n"
  },
  {
    "path": "test-d/get.ts",
    "content": "import {expectTypeOf} from 'expect-type';\nimport type {Get} from '../index.d.ts';\n\ntype NonStrict = {strict: false};\n\ndeclare const get: <ObjectType, Path extends string | readonly string[]>(object: ObjectType, path: Path) => Get<ObjectType, Path, NonStrict>;\n\ntype ApiResponse = {\n\thits: {\n\t\thits: Array<{\n\t\t\t_id: string;\n\t\t\t_source: {\n\t\t\t\tname: Array<{\n\t\t\t\t\tgiven: string[];\n\t\t\t\t\tfamily: string;\n\t\t\t\t}>;\n\t\t\t\tbirthDate: string;\n\t\t\t};\n\t\t}>;\n\t};\n};\n\ndeclare const apiResponse: ApiResponse;\n\nexpectTypeOf(get(apiResponse, 'hits.hits[0]._source.name')).toEqualTypeOf<Array<{given: string[]; family: string}>>();\nexpectTypeOf(get(apiResponse, 'hits.hits.0._source.name')).toEqualTypeOf<Array<{given: string[]; family: string}>>();\n\nexpectTypeOf(get(apiResponse, 'hits.hits[0]._source.name[0].given[0]')).toBeString();\n\n// TypeScript is structurally typed. It's *possible* this value exists even though it's not on the parent interface, so the type is `unknown`.\nexpectTypeOf(get(apiResponse, 'hits.someNonsense.notTheRightPath')).toBeUnknown();\n\ntype WithDictionary = {\n\tfoo: Record<string, {\n\t\tbar: number;\n\t}>;\n\tbaz: Record<string, {\n\t\tqux: Array<{x: boolean}>;\n\t}>;\n};\n\ndeclare const withDictionary: WithDictionary;\n\n// Should work with const array literal (non-const array is just a `string[]` and isn't useful)\nexpectTypeOf(get(withDictionary, ['baz', 'something', 'qux', '0', 'x'] as const)).toBeBoolean();\n\n// Should work with dynamic keys\ndeclare const someKey: string;\nexpectTypeOf(get(withDictionary, ['foo', someKey, 'bar'] as const)).toBeNumber();\n\n// This interface uses a tuple type (as opposed to an array).\ntype WithTuples = {\n\tfoo: [\n\t\t{\n\t\t\tbar: number;\n\t\t},\n\t\t{\n\t\t\tbaz: boolean;\n\t\t},\n\t];\n};\n\nexpectTypeOf<Get<WithTuples, 'foo[0].bar', NonStrict>>().toBeNumber();\nexpectTypeOf<Get<WithTuples, 'foo.0.bar', NonStrict>>().toBeNumber();\n\nexpectTypeOf<Get<WithTuples, 'foo[1].baz', NonStrict>>().toBeBoolean();\nexpectTypeOf<Get<WithTuples, 'foo[1].bar', NonStrict>>().toBeUnknown();\n\nexpectTypeOf<Get<WithTuples, 'foo[-1]', NonStrict>>().toBeUnknown();\nexpectTypeOf<Get<WithTuples, 'foo[999]', NonStrict>>().toBeUnknown();\n\ntype EmptyTuple = Parameters<() => {}>;\n\nexpectTypeOf<Get<EmptyTuple, '-1', NonStrict>>().toBeUnknown();\nexpectTypeOf<Get<EmptyTuple, '0', NonStrict>>().toBeUnknown();\nexpectTypeOf<Get<EmptyTuple, '1', NonStrict>>().toBeUnknown();\nexpectTypeOf<Get<EmptyTuple, 'length', NonStrict>>().toEqualTypeOf<0>();\n\ntype WithNumberKeys = {\n\tfoo: {\n\t\t1: {\n\t\t\tbar: number;\n\t\t};\n\t};\n};\n\nexpectTypeOf<Get<WithNumberKeys, 'foo[1].bar', NonStrict>>().toBeNumber();\nexpectTypeOf<Get<WithNumberKeys, 'foo.1.bar', NonStrict>>().toBeNumber();\n\nexpectTypeOf<Get<WithNumberKeys, 'foo[2].bar', NonStrict>>().toBeUnknown();\nexpectTypeOf<Get<WithNumberKeys, 'foo.2.bar', NonStrict>>().toBeUnknown();\n\n// Test `readonly`, `ReadonlyArray`, optional properties, and unions with null.\n\ntype WithModifiers = {\n\tfoo: ReadonlyArray<{\n\t\tbar?: {\n\t\t\treadonly baz: {\n\t\t\t\tqux: number;\n\t\t\t};\n\t\t};\n\t\tabc: {\n\t\t\tdef: {\n\t\t\t\tghi: string;\n\t\t\t};\n\t\t} | null;\n\t}>;\n};\n\nexpectTypeOf<Get<WithModifiers, 'foo[0].bar.baz', NonStrict>>().toEqualTypeOf<{qux: number} | undefined>();\nexpectTypeOf<Get<WithModifiers, 'foo[0].abc.def.ghi', NonStrict>>().toEqualTypeOf<string | undefined>();\n// Test bracket notation\nexpectTypeOf<Get<number[], '[0]', NonStrict>>().toBeNumber();\n// NOTE: This would fail if `[0][0]` was converted into `00`:\nexpectTypeOf<Get<number[], '[0][0]', NonStrict>>().toBeUnknown();\nexpectTypeOf<Get<number[][][], '[0][0][0]', NonStrict>>().toBeNumber();\nexpectTypeOf<Get<number[][][], '[0][0][0][0]', NonStrict>>().toBeUnknown();\nexpectTypeOf<Get<{a: {b: Array<Array<Array<{id: number}>>>}}, 'a.b[0][0][0].id', NonStrict>>().toBeNumber();\nexpectTypeOf<Get<{a: {b: Array<Array<Array<{id: number}>>>}}, ['a', 'b', '0', '0', '0', 'id'], NonStrict>>().toBeNumber();\n\n// Test strict version:\nexpectTypeOf<Get<string[], '0'>>().toEqualTypeOf<string | undefined>();\nexpectTypeOf<Get<Record<string, number>, 'foo'>>().toEqualTypeOf<number | undefined>();\nexpectTypeOf<Get<Record<'a' | 'b', number>, 'a'>>().toEqualTypeOf<number>();\nexpectTypeOf<Get<Record<1 | 2, string>, '1'>>().toEqualTypeOf<string>();\nexpectTypeOf<Get<{1: boolean}, '1'>>().toBeBoolean();\nexpectTypeOf<Get<[number, string], '0'>>().toBeNumber();\nexpectTypeOf<Get<{[key: string]: string; a: string}, 'a'>>().toBeString();\n\nexpectTypeOf<Get<WithDictionary, 'foo.whatever'>>().toEqualTypeOf<{bar: number} | undefined>();\nexpectTypeOf<Get<WithDictionary, 'foo.whatever.bar'>>().toEqualTypeOf<number | undefined>();\nexpectTypeOf<Get<WithDictionary, 'baz.whatever.qux[3].x'>>().toEqualTypeOf<boolean | undefined>();\nexpectTypeOf<Get<WithDictionary, ['baz', 'whatever', 'qux', '3', 'x']>>().toEqualTypeOf<boolean | undefined>();\n\n// Test array index out of bounds\nexpectTypeOf<Get<{a: []}, 'a[0]'>>().toEqualTypeOf<unknown>();\nexpectTypeOf<Get<{a: readonly []}, 'a[0]'>>().toEqualTypeOf<unknown>();\n\n// Test empty path array\nexpectTypeOf<WithDictionary>().toEqualTypeOf<Get<WithDictionary, []>>();\nexpectTypeOf<WithDictionary>().toEqualTypeOf<Get<WithDictionary, readonly []>>();\n\n// eslint-disable-next-line no-lone-blocks\n{\n\ttype Foo = {\n\t\tarray: string[];\n\t};\n\n\ttype FooPaths = `array.${number}`;\n\texpectTypeOf<Get<Foo, FooPaths>>().toEqualTypeOf<string | undefined>();\n\n\ttype FooPaths2 = 'array.1';\n\texpectTypeOf<Get<Foo, FooPaths2>>().toEqualTypeOf<string | undefined>();\n}\n"
  },
  {
    "path": "test-d/global-this.ts",
    "content": "import {expectType} from 'tsd';\nimport type {GlobalThis} from '../index.d.ts';\n\ntype ExtraProperties = GlobalThis & {\n\treadonly GLOBAL_TOKEN: string;\n};\n\n// Verify `globalThis` can be cast to a type which extends `GlobalThis`.\nexpectType<string>((globalThis as ExtraProperties).GLOBAL_TOKEN);\n\n// Verify that object literals cannot be cast to a type which extends `GlobalThis`.\ndeclare function consumeExtraProperties(extraProperties: ExtraProperties): void;\n// @ts-expect-error\nconsumeExtraProperties(({something: 'value'}) as ExtraProperties);\n"
  },
  {
    "path": "test-d/greater-than-or-equal.ts",
    "content": "import {expectType} from 'tsd';\nimport type {GreaterThanOrEqual} from '../index.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../source/numeric.d.ts';\n\ndeclare const never: never;\n\nexpectType<GreaterThanOrEqual<1, 2>>(false);\nexpectType<GreaterThanOrEqual<2, 1>>(true);\nexpectType<GreaterThanOrEqual<10, 2>>(true);\nexpectType<GreaterThanOrEqual<10, -2>>(true);\nexpectType<GreaterThanOrEqual<2, 2>>(true);\nexpectType<GreaterThanOrEqual<-2, -2>>(true);\nexpectType<GreaterThanOrEqual<-2, -3>>(true);\n\n// === unions ===\nexpectType<GreaterThanOrEqual<100 | 200, 50>>(true);\nexpectType<GreaterThanOrEqual<25, -100 | -15 | 2 | 21>>(true);\nexpectType<GreaterThanOrEqual<10 | 15, -5 | 10>>(true);\n\nexpectType<GreaterThanOrEqual<10, 50 | 100>>(false);\nexpectType<GreaterThanOrEqual<50 | 25 | 0 | -16, 100>>(false);\nexpectType<GreaterThanOrEqual<1 | 2, 3 | 4>>(false);\n\nexpectType<GreaterThanOrEqual<-10, -90 | 90>>({} as boolean);\nexpectType<GreaterThanOrEqual<-16 | 16, 0>>({} as boolean);\nexpectType<GreaterThanOrEqual<-4 | 45, 20 | 30>>({} as boolean);\nexpectType<GreaterThanOrEqual<1 | -1 | 3, 0 | 2>>({} as boolean);\nexpectType<GreaterThanOrEqual<1 | 2 | 3, 3 | 4>>({} as boolean);\nexpectType<GreaterThanOrEqual<1, 1 | 2>>({} as boolean);\n\nexpectType<GreaterThanOrEqual<PositiveInfinity, -999>>(true);\nexpectType<GreaterThanOrEqual<PositiveInfinity, 999>>(true);\nexpectType<GreaterThanOrEqual<999, PositiveInfinity>>(false);\nexpectType<GreaterThanOrEqual<999, NegativeInfinity>>(true);\nexpectType<GreaterThanOrEqual<-999, NegativeInfinity>>(true);\nexpectType<GreaterThanOrEqual<PositiveInfinity, PositiveInfinity>>(true);\nexpectType<GreaterThanOrEqual<NegativeInfinity, NegativeInfinity>>(true);\nexpectType<GreaterThanOrEqual<PositiveInfinity, NegativeInfinity>>(true);\n\n// Non-literal `number`\nexpectType<GreaterThanOrEqual<number, number>>({} as boolean);\nexpectType<GreaterThanOrEqual<number, 1>>({} as boolean);\nexpectType<GreaterThanOrEqual<1, number>>({} as boolean);\n"
  },
  {
    "path": "test-d/greater-than.ts",
    "content": "import {expectType} from 'tsd';\nimport type {GreaterThan} from '../index.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../source/numeric.d.ts';\n\ndeclare const never: never;\n\nexpectType<GreaterThan<1, 2>>(false);\nexpectType<GreaterThan<2, 1>>(true);\nexpectType<GreaterThan<10, 2>>(true);\nexpectType<GreaterThan<10, -2>>(true);\nexpectType<GreaterThan<2, 2>>(false);\nexpectType<GreaterThan<-2, -2>>(false);\nexpectType<GreaterThan<-2, -3>>(true);\n\n// === unions ===\nexpectType<GreaterThan<100 | 200, 50>>(true);\nexpectType<GreaterThan<25, -100 | -15 | 2 | 21>>(true);\nexpectType<GreaterThan<10 | 15, -5 | 5>>(true);\n\nexpectType<GreaterThan<10, 50 | 100>>(false);\nexpectType<GreaterThan<50 | 25 | 0 | -16, 100>>(false);\nexpectType<GreaterThan<1 | 2 | 3, 3 | 4>>(false);\n\nexpectType<GreaterThan<-10, -90 | 90>>({} as boolean);\nexpectType<GreaterThan<-16 | 16, 0>>({} as boolean);\nexpectType<GreaterThan<-4 | 45, 20 | 30>>({} as boolean);\nexpectType<GreaterThan<1 | -1 | 3, 0 | 2>>({} as boolean);\n\nexpectType<GreaterThan<PositiveInfinity, -999>>(true);\nexpectType<GreaterThan<PositiveInfinity, 999>>(true);\nexpectType<GreaterThan<999, PositiveInfinity>>(false);\nexpectType<GreaterThan<999, NegativeInfinity>>(true);\nexpectType<GreaterThan<-999, NegativeInfinity>>(true);\nexpectType<GreaterThan<PositiveInfinity, PositiveInfinity>>(false);\nexpectType<GreaterThan<NegativeInfinity, NegativeInfinity>>(false);\nexpectType<GreaterThan<PositiveInfinity, NegativeInfinity>>(true);\n\n// Non-literal `number`\nexpectType<GreaterThan<number, number>>({} as boolean);\nexpectType<GreaterThan<number, 1>>({} as boolean);\nexpectType<GreaterThan<1, number>>({} as boolean);\n"
  },
  {
    "path": "test-d/has-optional-keys.ts",
    "content": "import {expectType} from 'tsd';\nimport type {HasOptionalKeys} from '../index.d.ts';\n\ntype TestType1 = {\n\ta: string;\n\tb?: boolean;\n};\n\ntype TestType2 = {\n\ta?: string;\n\tb?: boolean;\n};\n\ntype TestType3 = {\n\ta: string;\n\tb: boolean;\n};\n\ntype HasOptionalKeys1 = HasOptionalKeys<TestType1>;\ntype HasOptionalKeys2 = HasOptionalKeys<TestType2>;\ntype HasOptionalKeys3 = HasOptionalKeys<TestType3>;\n\ndeclare const test1: HasOptionalKeys1;\ndeclare const test2: HasOptionalKeys2;\ndeclare const test3: HasOptionalKeys3;\n\nexpectType<true>(test1);\nexpectType<true>(test2);\nexpectType<false>(test3);\n"
  },
  {
    "path": "test-d/has-readonly-keys.ts",
    "content": "import {expectType} from 'tsd';\nimport type {HasReadonlyKeys} from '../index.d.ts';\n\ntype TestType1 = {\n\ta: string;\n\treadonly b: boolean;\n};\n\ntype TestType2 = {\n\treadonly a: string;\n\treadonly b: boolean;\n};\n\ntype TestType3 = {\n\ta: string;\n\tb: boolean;\n};\n\ntype HasReadonlyKeys1 = HasReadonlyKeys<TestType1>;\ntype HasReadonlyKeys2 = HasReadonlyKeys<TestType2>;\ntype HasReadonlyKeys3 = HasReadonlyKeys<TestType3>;\n\ndeclare const test1: HasReadonlyKeys1;\ndeclare const test2: HasReadonlyKeys2;\ndeclare const test3: HasReadonlyKeys3;\n\nexpectType<true>(test1);\nexpectType<true>(test2);\nexpectType<false>(test3);\n"
  },
  {
    "path": "test-d/has-required-keys.ts",
    "content": "import {expectType} from 'tsd';\nimport type {HasRequiredKeys} from '../index.d.ts';\n\ntype TestType1 = {\n\ta: string;\n\tb?: boolean;\n};\n\ntype TestType2 = {\n\ta?: string;\n\tb?: boolean;\n};\n\ntype TestType3 = {\n\ta: string;\n\tb: boolean;\n};\n\ntype HasRequiredKeys1 = HasRequiredKeys<TestType1>;\ntype HasRequiredKeys2 = HasRequiredKeys<TestType2>;\ntype HasRequiredKeys3 = HasRequiredKeys<TestType3>;\n\ndeclare const test1: HasRequiredKeys1;\ndeclare const test2: HasRequiredKeys2;\ndeclare const test3: HasRequiredKeys3;\n\nexpectType<true>(test1);\nexpectType<false>(test2);\nexpectType<true>(test3);\n"
  },
  {
    "path": "test-d/has-writable-keys.ts",
    "content": "import {expectType} from 'tsd';\nimport type {HasWritableKeys} from '../index.d.ts';\n\ntype TestType1 = {\n\ta: string;\n\treadonly b: boolean;\n};\n\ntype TestType2 = {\n\treadonly a: string;\n\treadonly b: boolean;\n};\n\ntype TestType3 = {\n\ta: string;\n\tb: boolean;\n};\n\ntype HasWritableKeys1 = HasWritableKeys<TestType1>;\ntype HasWritableKeys2 = HasWritableKeys<TestType2>;\ntype HasWritableKeys3 = HasWritableKeys<TestType3>;\n\ndeclare const test1: HasWritableKeys1;\ndeclare const test2: HasWritableKeys2;\ndeclare const test3: HasWritableKeys3;\n\nexpectType<true>(test1);\nexpectType<false>(test2);\nexpectType<true>(test3);\n"
  },
  {
    "path": "test-d/if-any.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IfAny} from '../index.d.ts';\n\ndeclare const _any: any;\n\n// `IfAny` should return `true`/`false` if only `T` is specified\nexpectType<IfAny<any>>(true);\nexpectType<IfAny<string>>(false);\nexpectType<IfAny<any, 'T', 'F'>>('T');\nexpectType<IfAny<string, 'T', 'F'>>('F');\n\n// Missing generic parameter\n// @ts-expect-error\ntype A = IfAny;\n"
  },
  {
    "path": "test-d/if-never.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IfNever} from '../index.d.ts';\n\n// `IfNever` should return `true`/`false` if only `T` is specified\nexpectType<IfNever<never>>(true);\nexpectType<IfNever<string>>(false);\nexpectType<IfNever<never, 'T', 'F'>>('T');\nexpectType<IfNever<string, 'T', 'F'>>('F');\n\n// Missing generic parameter\n// @ts-expect-error\ntype A = IfNever;\n"
  },
  {
    "path": "test-d/if-unknown.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IfUnknown} from '../index.d.ts';\n\n// `IfUnknown` should return `true`/`false` if only `T` is specified\nexpectType<IfUnknown<unknown>>(true);\nexpectType<IfUnknown<string>>(false);\nexpectType<IfUnknown<unknown, 'T', 'F'>>('T');\nexpectType<IfUnknown<string, 'T', 'F'>>('F');\n\n// Missing generic parameter\n// @ts-expect-error\ntype A = IfUnknown;\n"
  },
  {
    "path": "test-d/if.ts",
    "content": "import {expectType} from 'tsd';\nimport type {If} from '../source/if.d.ts';\n\nexpectType<string>({} as If<true, string, number>);\nexpectType<number>({} as If<false, string, number>);\nexpectType<string | number>({} as If<boolean, string, number>);\nexpectType<string | number>({} as If<any, string, number>);\nexpectType<number>({} as If<never, string, number>);\n"
  },
  {
    "path": "test-d/includes.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Includes} from '../index.d.ts';\n\nconst includesEmptyArray: Includes<[], 'abc'> = false;\nexpectType<false>(includesEmptyArray);\n\nconst includesSingleItemArray: Includes<['colors'], 'colors'> = true;\nexpectType<true>(includesSingleItemArray);\n\nconst readonlyArray = ['a', 'b', 'c'] as const;\nconst includesReadonlyArray: Includes<typeof readonlyArray, 'a'> = true;\nexpectType<true>(includesReadonlyArray);\n\nconst includesComplexMultiTypeArray: Includes<[\n\t{\n\t\tprop: 'value';\n\t\tnum: 5;\n\t\tanotherArr: [1, '5', false];\n\t},\n\ttrue,\n\tnull,\n\t'abcd',\n], 'abc'> = false;\nexpectType<false>(includesComplexMultiTypeArray);\n\nconst noExtendsProblem: Includes<[boolean], true> = false;\nexpectType<false>(noExtendsProblem);\n\nconst objectIncludes: Includes<[{}], {a: 1}> = false;\nexpectType<false>(objectIncludes);\n\nconst objectIncludesPass: Includes<[{a: 1}], {a: 1}> = true;\nexpectType<true>(objectIncludesPass);\n\nconst nullIncludesUndefined: Includes<[null], undefined> = false;\nexpectType<false>(nullIncludesUndefined);\n\nconst nullIncludesNullPass: Includes<[null], null> = true;\nexpectType<true>(nullIncludesNullPass);\n\n// Verify that incorrect usage of `Includes` produces an error.\n\n// Missing all generic parameters.\n// @ts-expect-error\ntype A0 = Includes;\n\n// Missing `Item` generic parameter.\n// @ts-expect-error\ntype A1 = Includes<['my', 'array', 'has', 'stuff']>;\n\n// Value generic parameter is a string not an array.\n// @ts-expect-error\ntype A2 = Includes<'why a string?', 5>;\n\n// Value generic parameter is an object not an array.\n// @ts-expect-error\ntype A3 = Includes<{key: 'value'}, 7>;\n"
  },
  {
    "path": "test-d/int-closed-range.ts",
    "content": "import {expectType, expectAssignable} from 'tsd';\nimport type {IntClosedRange} from '../source/int-closed-range.d.ts';\n\ndeclare const test: IntClosedRange<0, 5>;\nexpectType<0 | 1 | 2 | 3 | 4 | 5>(test);\n\ndeclare const startTest: IntClosedRange<5, 10>;\nexpectType<5 | 6 | 7 | 8 | 9 | 10>(startTest);\n\ndeclare const stepTest1: IntClosedRange<10, 20, 2>;\nexpectType<10 | 12 | 14 | 16 | 18 | 20>(stepTest1);\n\n// Test for step > end - start\ndeclare const stepTest2: IntClosedRange<10, 20, 100>;\nexpectType<10>(stepTest2);\n\ntype Int0_998 = IntClosedRange<0, 998>;\ndeclare const maxNumberTest: Int0_998;\nexpectAssignable<number>(maxNumberTest);\nexpectAssignable<Int0_998>(998);\n"
  },
  {
    "path": "test-d/int-range.ts",
    "content": "import {expectType, expectAssignable} from 'tsd';\nimport type {IntRange} from '../source/int-range.d.ts';\n\ndeclare const test: IntRange<0, 5>;\nexpectType<0 | 1 | 2 | 3 | 4>(test);\n\ndeclare const startTest: IntRange<5, 10>;\nexpectType<5 | 6 | 7 | 8 | 9>(startTest);\n\ndeclare const stepTest1: IntRange<10, 20, 2>;\nexpectType<10 | 12 | 14 | 16 | 18>(stepTest1);\n\n// Test for step > end - start\ndeclare const stepTest2: IntRange<10, 20, 100>;\nexpectType<10>(stepTest2);\n\ndeclare const maxNumberTest: IntRange<0, 999>;\nexpectAssignable<number>(maxNumberTest);\n\n// Not yet supported.\n// declare const negative: IntRange<-1, 1>;\n// expectType<-1 | 0 | 1>(negative);\n\n// declare const negative2: IntRange<1, -1>;\n// expectType<-1 | 0 | 1>(negative2);\n"
  },
  {
    "path": "test-d/internal/apply-default-options.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ApplyDefaultOptions} from '../../source/internal/index.d.ts';\n\ntype PathsOptions = {\n\tmaxRecursionDepth?: number;\n\tbracketNotation?: boolean;\n\tleavesOnly?: boolean;\n\tdepth?: number;\n};\n\ntype DefaultPathsOptions = {\n\tmaxRecursionDepth: 10;\n\tbracketNotation: false;\n\tleavesOnly: false;\n\tdepth: number;\n};\n\ndeclare const noOptionsSpecified: ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, {}>;\nexpectType<DefaultPathsOptions>(noOptionsSpecified);\n\ndeclare const someOptionsSpecified: ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, {leavesOnly: true; depth: 2}>;\nexpectType<{maxRecursionDepth: 10; bracketNotation: false; leavesOnly: true; depth: 2}>(someOptionsSpecified);\n\ndeclare const someOptionsSpecified2: ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, {maxRecursionDepth: 5}>;\nexpectType<{maxRecursionDepth: 5; bracketNotation: false; leavesOnly: false; depth: number}>(someOptionsSpecified2);\n\ndeclare const allOptionsSpecified: ApplyDefaultOptions<\n\tPathsOptions, DefaultPathsOptions, {maxRecursionDepth: 5; bracketNotation: false; leavesOnly: false; depth: 1}\n>;\nexpectType<{maxRecursionDepth: 5; bracketNotation: false; leavesOnly: false; depth: 1}>(allOptionsSpecified);\n\ndeclare const requiredOptions: ApplyDefaultOptions<{fixedLengthOnly?: boolean; strict: boolean}, {fixedLengthOnly: false}, {strict: true}>;\nexpectType<{fixedLengthOnly: false; strict: true}>(requiredOptions);\n\n// @ts-ignore\ndeclare const undefinedsGetOverwritten: ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, {maxRecursionDepth: undefined}>; // Possible when `exactOptionalPropertyTypes` is disabled\nexpectType<DefaultPathsOptions>(undefinedsGetOverwritten);\n\n// Caveat: User specified `undefined` for optional properties with explicit undefined also gets overwritten\ndeclare const undefinedsGetOverwritten2: ApplyDefaultOptions<{recurseIntoArrays?: boolean | undefined}, {recurseIntoArrays: true}, {recurseIntoArrays: undefined}>;\nexpectType<{recurseIntoArrays: true}>(undefinedsGetOverwritten2);\n\ndeclare const undefinedAsValidValue: ApplyDefaultOptions<{recurseIntoArrays: boolean | undefined}, {}, {recurseIntoArrays: undefined}>;\nexpectType<{recurseIntoArrays: undefined}>(undefinedAsValidValue);\n\ndeclare const optionalOptionsGetOverwritten: ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, {maxRecursionDepth?: 5; bracketNotation?: true}>;\nexpectType<DefaultPathsOptions>(optionalOptionsGetOverwritten);\n\ndeclare const neverAsOptionsGetOverwritten: ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, never>;\nexpectType<DefaultPathsOptions>(neverAsOptionsGetOverwritten);\n\ndeclare const anyAsOptionsGetOverwritten: ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, any>;\nexpectType<DefaultPathsOptions>(anyAsOptionsGetOverwritten);\n\n// @ts-expect-error - `Defaults` should be compatible with `Options`\ndeclare const defaultsShouldBeCompatible: ApplyDefaultOptions<{fixedLengthOnly?: boolean}, {fixedLengthOnly: 'no'}, {}>;\n\n// @ts-expect-error - `SpecifiedOptions` should be compatible with `Options`\ndeclare const specifiedOptionsShouldBeCompatible: ApplyDefaultOptions<{fixedLengthOnly?: boolean}, {fixedLengthOnly: false}, {fixedLengthOnly: 'yes'}>;\n\n// @ts-expect-error - Optional options should have a default value\ndeclare const defaultForOptionalOptions: ApplyDefaultOptions<PathsOptions, Omit<DefaultPathsOptions, 'depth'>, {}>;\n\n// @ts-expect-error - Required options should be specified\ndeclare const requiredOptionsShouldBeSpecified: ApplyDefaultOptions<{fixedLengthOnly: boolean}, {}, {}>;\n\n// @ts-expect-error - Required options should not have a default value\ndeclare const noDefaultForRequiredOptions: ApplyDefaultOptions<{fixedLengthOnly: boolean}, {fixedLengthOnly: false}, {fixedLengthOnly: false}>;\n\n// The output of `ApplyDefaultOptions<SomeOption, ...>` should be assignable to `Required<SomeOption>`\ntype SomeType<Options extends PathsOptions = {}> = _SomeType<ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, Options>>;\ntype _SomeType<Options extends Required<PathsOptions>> = Options;\n"
  },
  {
    "path": "test-d/internal/collapse-literals-in-union.ts",
    "content": "import {expectType} from 'tsd';\nimport type {CollapseLiterals} from '../../source/internal/object.d.ts';\n\ndeclare const sym1: unique symbol;\ndeclare const sym2: unique symbol;\n\n// Uncollapsed unions\nexpectType<string>({} as CollapseLiterals<'foo' | 'bar' | (string & {})>);\nexpectType<number>({} as CollapseLiterals<1 | 2 | (number & {})>);\nexpectType<symbol>({} as CollapseLiterals<typeof sym1 | typeof sym2 | (symbol & {})>);\nexpectType<bigint>({} as CollapseLiterals<1n | 2n | (bigint & {})>);\nexpectType<`on${string}`>({} as CollapseLiterals<'onChange' | 'onClick' | (`on${string}` & {})>);\nexpectType<'change' | 'click' | `on${string}`>({} as CollapseLiterals<'change' | 'click' | (`on${string}` & {})>);\nexpectType<'drag' | `on${string}`>({} as CollapseLiterals<'drag' | 'onChange' | 'onClick' | (`on${string}` & {})>);\n\nexpectType<null | undefined | string>({} as CollapseLiterals<null | undefined | 'foo' | 'bar' | (string & {})>);\nexpectType<'foo' | Uppercase<string> | number>({} as CollapseLiterals<'foo' | 'BAR' | (Uppercase<string> & {}) | number>);\nexpectType<typeof sym1 | 'foo' | 'bar' | number>({} as CollapseLiterals<typeof sym1 | 'foo' | 'bar' | (number & {})>);\n\n// Already collapsed unions are returned as-is\nexpectType<string>({} as CollapseLiterals<string>);\nexpectType<bigint>({} as CollapseLiterals<bigint>);\nexpectType<false>({} as CollapseLiterals<false>);\nexpectType<number | bigint>({} as CollapseLiterals<number | bigint>);\nexpectType<null | undefined>({} as any as CollapseLiterals<null | undefined>);\nexpectType<'foo' | 'bar'>({} as CollapseLiterals<'foo' | 'bar'>);\nexpectType<string | number | boolean>({} as CollapseLiterals<string | number | boolean>);\nexpectType<unknown>({} as CollapseLiterals<unknown>);\nexpectType<string[] | [string, string]>({} as CollapseLiterals<string[] | [string, string]>);\nexpectType<Record<string, string> | {a: string; b: number}>(\n\t{} as CollapseLiterals<Record<string, string> | {a: string; b: number}>,\n);\n\n// Boundary types\nexpectType<{}>({} as CollapseLiterals<{}>);\nexpectType<never>({} as CollapseLiterals<never>);\nexpectType<any>({} as CollapseLiterals<any>);\n"
  },
  {
    "path": "test-d/internal/collapse-rest-element.ts",
    "content": "import {expectType} from 'tsd';\nimport type {CollapseRestElement} from '../../source/internal/array.d.ts';\n\n// Simple arrays\nexpectType<[]>({} as CollapseRestElement<[]>);\nexpectType<[string]>({} as CollapseRestElement<[string]>);\nexpectType<[1, 2, 'a', 'b']>({} as CollapseRestElement<[1, 2, 'a', 'b']>);\nexpectType<[string | null, number | bigint, boolean]>({} as CollapseRestElement<[string | null, number | bigint, boolean]>);\n\n// Optional elements\n// If `exactOptionalPropertyTypes` were disabled, there would have been an additional `| undefined` for optional elements.\n// For example, `CollapseRestElement<[string?, number?]>` would have returned `[string | undefined, number | undefined]`.\nexpectType<[string]>({} as CollapseRestElement<[string?]>);\nexpectType<[1, 2, 'a' | 'b', 'c' | 'd']>({} as CollapseRestElement<[1, 2, ('a' | 'b')?, ('c' | 'd')?]>);\nexpectType<[string, number, boolean]>({} as CollapseRestElement<[string?, number?, boolean?]>);\nexpectType<[string | null | undefined, number | undefined, boolean | null]>(\n\t{} as CollapseRestElement<[(string | null | undefined)?, (number | undefined)?, (boolean | null)?]>,\n);\n\n// Trailing rest element\nexpectType<[1, 2, number]>({} as CollapseRestElement<[1, 2, ...number[]]>);\nexpectType<[1, 2, number | undefined]>({} as CollapseRestElement<[1, 2, ...Array<number | undefined>]>);\n\n// Trailing rest element with optional elements\nexpectType<[true, false, boolean]>({} as CollapseRestElement<[true, false?, ...boolean[]]>);\nexpectType<[string, string, number]>({} as CollapseRestElement<[string?, string?, ...number[]]>);\nexpectType<[1, 2, number | undefined]>({} as CollapseRestElement<[1?, 2?, ...Array<number | undefined>]>);\n\n// Leading rest element (these cannot have any optional elements)\nexpectType<[number, 1, 2]>({} as CollapseRestElement<[...number[], 1, 2]>);\nexpectType<[string | undefined, bigint, bigint]>({} as CollapseRestElement<[...Array<string | undefined>, bigint, bigint]>);\n\n// Rest element in the middle (these cannot have any optional elements)\nexpectType<[1, 2, number, 3, 4]>({} as CollapseRestElement<[1, 2, ...number[], 3, 4]>);\nexpectType<[string | number, number | undefined, boolean]>({} as CollapseRestElement<[string | number, ...Array<number | undefined>, boolean]>);\n\n// Readonly arrays\nexpectType<[string]>({} as CollapseRestElement<readonly [string]>);\nexpectType<[1, 2, 'a' | 'b', 'c' | 'd']>({} as CollapseRestElement<readonly [1, 2, ('a' | 'b')?, ('c' | 'd')?]>);\nexpectType<[1, 2, number]>({} as CollapseRestElement<readonly [1, 2, ...number[]]>);\nexpectType<[1, 2, number]>({} as CollapseRestElement<[1, 2, ...readonly number[]]>);\nexpectType<[1, 2, number | undefined]>({} as CollapseRestElement<readonly [1?, 2?, ...ReadonlyArray<number | undefined>]>);\nexpectType<[1, 2, number, 3, 4]>({} as CollapseRestElement<readonly [1, 2, ...readonly number[], 3, 4]>);\n\n// Non-tuple arrays\nexpectType<[string]>({} as CollapseRestElement<string[]>);\nexpectType<[string | number | {p: string}]>({} as CollapseRestElement<Array<string | number | {p: string}>>);\nexpectType<[string | undefined]>({} as CollapseRestElement<ReadonlyArray<string | undefined>>);\nexpectType<[boolean]>({} as CollapseRestElement<[...readonly boolean[]]>);\n\n// `any` and `never` elements\nexpectType<[any]>({} as CollapseRestElement<any[]>);\nexpectType<[never]>({} as CollapseRestElement<never[]>);\nexpectType<[bigint, bigint, any]>({} as CollapseRestElement<[bigint, bigint, ...any[]]>);\nexpectType<[any, never, never]>({} as CollapseRestElement<[any, never, ...never[]]>);\nexpectType<[any, any, never]>({} as CollapseRestElement<[...any[], any, never]>);\n\n// Labelled tuples\nexpectType<[string, number]>({} as CollapseRestElement<[x?: string, y?: number]>);\nexpectType<[number, number, string, number]>(\n\t{} as CollapseRestElement<readonly [x?: number, y?: number, z?: string, ...rest: number[]]>,\n);\n\n// Unions\nexpectType<[string, string, string] | [number, number, number]>(\n\t{} as CollapseRestElement<[string, string, ...string[]] | [number, number, ...number[]]>,\n);\nexpectType<[string, number, boolean] | [string]>(\n\t{} as CollapseRestElement<[string, number, boolean] | string[]>,\n);\nexpectType<[string, number, number] | [string, boolean, number] | [string, number | undefined, boolean, string]>(\n\t{} as CollapseRestElement<readonly [string, ...number[], number] | [string, boolean?, ...number[]] | readonly [string, (number | undefined)?, boolean?, string?]>,\n);\nexpectType<[string] | [number, number, number] | [string, number, string]>(\n\t{} as CollapseRestElement<readonly string[] | [...rest: number[], l1: number, l2: number] | [string?, number?, ...string[]]>,\n);\n\n// Boundary cases\nexpectType<any>({} as CollapseRestElement<any>);\nexpectType<never>({} as CollapseRestElement<never>);\n"
  },
  {
    "path": "test-d/internal/enforce-optional.ts",
    "content": "import {expectType} from 'tsd';\nimport type {EnforceOptional} from '../../source/internal/index.d.ts';\n\ntype Foo = {\n\ta: string;\n\tb?: string;\n\tc: undefined;\n\td: number | undefined;\n};\n\ntype EnforcedOptionalFoo = EnforceOptional<Foo>;\n\ndeclare const enforcedOptionalFoo: EnforcedOptionalFoo;\n\nexpectType<{\n\ta: string;\n\tb?: string;\n\tc: undefined;\n\td?: number;\n}>(enforcedOptionalFoo);\n"
  },
  {
    "path": "test-d/internal/has-multiple-call-signatures.ts",
    "content": "import {expectType} from 'tsd';\nimport type {HasMultipleCallSignatures} from '../../source/internal/index.d.ts';\n\ntype Overloaded = {\n\t(foo: number): string;\n\t(foo: string, bar: number): number;\n};\n\ntype Overloaded2 = {\n\t(foo: number | undefined): string;\n\t// eslint-disable-next-line @typescript-eslint/unified-signatures\n\t(foo: number): string;\n};\n\ntype Namespace = {\n\t(foo: number): string;\n\tbaz: boolean[];\n};\n\nexpectType<true>({} as HasMultipleCallSignatures<Overloaded>);\nexpectType<true>({} as HasMultipleCallSignatures<Overloaded2>);\nexpectType<false>({} as HasMultipleCallSignatures<Namespace>);\n"
  },
  {
    "path": "test-d/internal/homomorphic-pick.ts",
    "content": "import {expectType} from 'tsd';\nimport type {HomomorphicPick} from '../../source/internal/index.d.ts';\n\n// Picks specified keys\ndeclare const test1: HomomorphicPick<{a: 1; b: 2; c: 3}, 'a' | 'b'>;\nexpectType<{a: 1; b: 2}>(test1);\n\n// Works with unions\ndeclare const test2: HomomorphicPick<{a: 1; b: 2} | {a: 3; c: 4}, 'a'>;\nexpectType<{a: 1} | {a: 3}>(test2);\n\ndeclare const test3: HomomorphicPick<{a: 1; b: 2} | {c: 3; d: 4}, 'a' | 'c'>;\nexpectType<{a: 1} | {c: 3}>(test3);\n\n// Preserves property modifiers\ndeclare const test4: HomomorphicPick<{readonly a: 1; b?: 2; readonly c?: 3}, 'a' | 'c'>;\nexpectType<{readonly a: 1; readonly c?: 3}>(test4);\n\ndeclare const test5: HomomorphicPick<{readonly a: 1; b?: 2} | {readonly c?: 3; d?: 4}, 'a' | 'c'>;\nexpectType<{readonly a: 1} | {readonly c?: 3}>(test5);\n\n// Passes through primitives unchanged\ndeclare const test6: HomomorphicPick<string, never>;\nexpectType<string>(test6);\n\ndeclare const test7: HomomorphicPick<number, never>;\nexpectType<number>(test7);\n\ndeclare const test8: HomomorphicPick<boolean, never>;\nexpectType<boolean>(test8);\n\ndeclare const test9: HomomorphicPick<bigint, never>;\nexpectType<bigint>(test9);\n\ndeclare const test10: HomomorphicPick<symbol, never>;\nexpectType<symbol>(test10);\n\n// Picks all keys, if `KeyType` is `any`\ndeclare const test11: HomomorphicPick<{readonly a: 1; b?: 2} | {readonly c?: 3}, any>;\nexpectType<{readonly a: 1; b?: 2} | {readonly c?: 3}>(test11);\n\n// Picks no keys, if `KeyType` is `never`\ndeclare const test12: HomomorphicPick<{a: 1; b: 2}, never>;\nexpectType<{}>(test12);\n\n// Works with index signatures\ndeclare const test13: HomomorphicPick<{[k: string]: unknown; a: 1; b: 2}, 'a' | 'b'>;\nexpectType<{a: 1; b: 2}>(test13);\n\n// Doesn't pick `number` from a `string` index signature\ndeclare const test14: HomomorphicPick<{[k: string]: unknown}, number>;\nexpectType<{}>(test14);\n"
  },
  {
    "path": "test-d/internal/if-not-any-or-never.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IfNotAnyOrNever} from '../../source/internal/index.d.ts';\n\nexpectType<any>({} as IfNotAnyOrNever<any, string>);\nexpectType<never>({} as IfNotAnyOrNever<never, string>);\nexpectType<number>({} as IfNotAnyOrNever<any, string, number>);\nexpectType<number>({} as IfNotAnyOrNever<any, string, number, boolean>);\nexpectType<never>({} as IfNotAnyOrNever<never, string, number>);\nexpectType<boolean>({} as IfNotAnyOrNever<never, string, number, boolean>);\nexpectType<number>({} as IfNotAnyOrNever<string, number>);\nexpectType<number>({} as IfNotAnyOrNever<string | number, number, boolean>);\nexpectType<number>({} as IfNotAnyOrNever<object, number, boolean, string>);\n"
  },
  {
    "path": "test-d/internal/is-array-readonly.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsArrayReadonly} from '../../source/internal/index.d.ts';\n\n// Non-readonly arrays\nexpectType<IsArrayReadonly<[]>>(false);\nexpectType<IsArrayReadonly<number[]>>(false);\nexpectType<IsArrayReadonly<[string, number?, ...string[]]>>(false);\nexpectType<IsArrayReadonly<[x: number, y: number, z?: number]>>(false);\nexpectType<IsArrayReadonly<[...string[], number, string]>>(false);\n\n// Readonly arrays\nexpectType<IsArrayReadonly<readonly []>>(true);\nexpectType<IsArrayReadonly<readonly number[]>>(true);\nexpectType<IsArrayReadonly<readonly [string, number?, ...string[]]>>(true);\nexpectType<IsArrayReadonly<readonly [x: number, y: number, z?: number]>>(true);\nexpectType<IsArrayReadonly<readonly [...string[], number, string]>>(true);\n\n// Union\nexpectType<IsArrayReadonly<[] | readonly []>>({} as boolean);\nexpectType<IsArrayReadonly<[string, number] | readonly [string, number, ...string[]]>>({} as boolean);\nexpectType<IsArrayReadonly<[] | [string, number]>>(false);\nexpectType<IsArrayReadonly<readonly [] | readonly [string, number]>>(true);\n\n// Boundary types\nexpectType<IsArrayReadonly<any>>({} as boolean);\nexpectType<IsArrayReadonly<never>>(false);\n"
  },
  {
    "path": "test-d/internal/is-not-false.ts",
    "content": "/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\nimport {expectType} from 'tsd';\nimport type {IsNotFalse} from '../../source/internal/index.d.ts';\n\nexpectType<IsNotFalse<true>>(true);\nexpectType<IsNotFalse<boolean>>(true);\nexpectType<IsNotFalse<true | false>>(true);\nexpectType<IsNotFalse<true | false | false | false>>(true);\nexpectType<IsNotFalse<false>>(false);\nexpectType<IsNotFalse<false | false>>(false);\nexpectType<IsNotFalse<false | false | false | false>>(false);\n"
  },
  {
    "path": "test-d/internal/is-number-like.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsNumberLike} from '../../source/internal/numeric.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../../index.d.ts';\n\n// Integer\nexpectType<IsNumberLike<'-1'>>(true);\nexpectType<IsNumberLike<-1>>(true);\nexpectType<IsNumberLike<'+1'>>(true);\nexpectType<IsNumberLike<'1'>>(true);\nexpectType<IsNumberLike<1>>(true);\n\n// Float\nexpectType<IsNumberLike<'-1.1'>>(true);\nexpectType<IsNumberLike<-1.1>>(true);\nexpectType<IsNumberLike<'+1.1'>>(true);\nexpectType<IsNumberLike<'1.1'>>(true);\nexpectType<IsNumberLike<1.1>>(true);\n\n// Scientific\nexpectType<IsNumberLike<'+1.2e+3'>>(true);\nexpectType<IsNumberLike<'1.2e+3'>>(true);\nexpectType<IsNumberLike<1.2e+3>>(true);\nexpectType<IsNumberLike<'+5e-3'>>(true);\nexpectType<IsNumberLike<'5e-3'>>(true);\nexpectType<IsNumberLike<5e-3>>(true);\n\nexpectType<IsNumberLike<'-1.2e+3'>>(true);\nexpectType<IsNumberLike<-1.2e+3>>(true);\nexpectType<IsNumberLike<'-5e-3'>>(true);\nexpectType<IsNumberLike<-5e-3>>(true);\n\n// Invalid numeric\nexpectType<IsNumberLike<'foo'>>(false);\nexpectType<IsNumberLike<'1.2.3'>>(false);\nexpectType<IsNumberLike<'5+1.2'>>(false);\nexpectType<IsNumberLike<'5e-3.1'>>(false);\n\n// Edge cases\nexpectType<IsNumberLike<never>>(false);\nexpectType<IsNumberLike<any>>({} as boolean);\nexpectType<IsNumberLike<number>>(true);\nexpectType<IsNumberLike<PositiveInfinity>>(true);\nexpectType<IsNumberLike<NegativeInfinity>>(true);\n"
  },
  {
    "path": "test-d/internal/is-numeric.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsNumeric} from '../../source/internal/index.d.ts';\n\nexpectType<IsNumeric<''>>(false);\nexpectType<IsNumeric<'0'>>(true);\nexpectType<IsNumeric<'1'>>(true);\nexpectType<IsNumeric<'-1'>>(true);\nexpectType<IsNumeric<'123'>>(true);\nexpectType<IsNumeric<'1e2'>>(true);\nexpectType<IsNumeric<'1.23'>>(true);\nexpectType<IsNumeric<'123.456'>>(true);\nexpectType<IsNumeric<'1.23e4'>>(true);\nexpectType<IsNumeric<'1.23e-4'>>(true);\nexpectType<IsNumeric<' '>>(false);\nexpectType<IsNumeric<'\\n'>>(false);\nexpectType<IsNumeric<'\\u{9}'>>(false);\nexpectType<IsNumeric<' 1.2'>>(false);\nexpectType<IsNumeric<'1 2'>>(false);\nexpectType<IsNumeric<'1_200'>>(false);\nexpectType<IsNumeric<' 1 '>>(false);\n"
  },
  {
    "path": "test-d/internal/is-whitespace.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsWhitespace} from '../../source/internal/index.d.ts';\n\nexpectType<IsWhitespace<''>>(false);\nexpectType<IsWhitespace<' '>>(true);\nexpectType<IsWhitespace<'\\n'>>(true);\nexpectType<IsWhitespace<'\\u{9}'>>(true);\nexpectType<IsWhitespace<'a'>>(false);\nexpectType<IsWhitespace<'a '>>(false);\nexpectType<IsWhitespace<'   '>>(true);\nexpectType<IsWhitespace<' \\t '>>(true);\n"
  },
  {
    "path": "test-d/internal/normalized-keys.ts",
    "content": "import {expectType} from 'tsd';\nimport type {NormalizedKeys} from '../../source/internal/object.d.ts';\n\ndeclare const sym: unique symbol;\n\nexpectType<0 | '0' | 1 | '1'>({} as NormalizedKeys<0 | '1'>);\nexpectType<-1 | '-1' | '-1.5' | -1.5 | 'foo' | typeof sym>({} as NormalizedKeys<-1 | '-1.5' | 'foo' | typeof sym>);\nexpectType<string | number>({} as NormalizedKeys<string>);\nexpectType<number | `${number}`>({} as NormalizedKeys<number>);\nexpectType<number | `${number}`>({} as NormalizedKeys<`${number}`>);\nexpectType<symbol>({} as NormalizedKeys<symbol>);\n\n// Boundary cases\nexpectType<any>({} as NormalizedKeys<any>);\nexpectType<never>({} as NormalizedKeys<never>);\n\n// Can only be `PropertyKey`\n// @ts-expect-error\ntype T1 = NormalizedKeys<boolean>;\n// @ts-expect-error\ntype T2 = NormalizedKeys<string[]>;\n// @ts-expect-error\ntype T3 = NormalizedKeys<unknown>;\n"
  },
  {
    "path": "test-d/internal/not.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Not} from '../../source/internal/index.d.ts';\n\nexpectType<Not<true>>(false);\nexpectType<Not<false>>(true);\nexpectType<Not<boolean>>({} as boolean);\n"
  },
  {
    "path": "test-d/internal/number-absolute.ts",
    "content": "import {expectType} from 'tsd';\nimport type {NumberAbsolute} from '../../source/internal/index.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../../source/numeric.d.ts';\n\nexpectType<NumberAbsolute<3>>(3);\nexpectType<NumberAbsolute<-3>>(3);\nexpectType<NumberAbsolute<0>>(0);\nexpectType<NumberAbsolute<-0>>(0);\nexpectType<NumberAbsolute<NegativeInfinity>>(null! as PositiveInfinity);\nexpectType<NumberAbsolute<PositiveInfinity>>(null! as PositiveInfinity);\n"
  },
  {
    "path": "test-d/internal/object-value.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ObjectValue} from '../../source/internal/index.d.ts';\n\ntype ObjectT = {\n\tstring: string;\n\t0: number;\n\t'1': number;\n};\n\ndeclare const normal: ObjectValue<ObjectT, 'string'>;\nexpectType<string>(normal);\n\ndeclare const test0: ObjectValue<ObjectT, 0>;\nexpectType<number>(test0);\ndeclare const teststring0: ObjectValue<ObjectT, '0'>;\nexpectType<number>(teststring0);\ndeclare const test1: ObjectValue<ObjectT, 1>;\nexpectType<number>(test1);\ndeclare const teststring1: ObjectValue<ObjectT, '1'>;\nexpectType<number>(teststring1);\n"
  },
  {
    "path": "test-d/internal/readonly-keys-of-union.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ReadonlyKeysOfUnion} from '../../source/internal/index.d.ts';\n\ndeclare const test1: ReadonlyKeysOfUnion<{readonly a: 1; b: 2}>;\nexpectType<'a'>(test1);\n\ndeclare const test2: ReadonlyKeysOfUnion<{readonly a: 1; b?: 2} | {readonly c?: 3; d: 4}>;\nexpectType<'a' | 'c'>(test2);\n\ndeclare const test3: ReadonlyKeysOfUnion<{readonly a: 1; b?: 2} | {readonly c?: 3; d: 4} | {readonly c: 5} | {d: 6}>;\nexpectType<'a' | 'c'>(test3);\n\n// Returns `never` if there's no readonly key\ndeclare const test4: ReadonlyKeysOfUnion<{a: 1; b?: 2} | {c?: 3; d: 4}>;\nexpectType<never>(test4);\n\n// Works with index signatures\ndeclare const test5: ReadonlyKeysOfUnion<{readonly [x: string]: number; a: 1} | {readonly [x: symbol]: number; a: 2}>;\nexpectType<string | number | symbol>(test5);\n\n// Works with arrays\ndeclare const test7: ReadonlyKeysOfUnion<readonly string[] | readonly [number, number]>;\nexpectType<number | typeof Symbol.unscopables | '0' | '1' | 'length'>(test7);\n\n// Works with functions\ndeclare const test8: ReadonlyKeysOfUnion<(() => void) | {(): void; readonly a: 1}>;\nexpectType<'a'>(test8);\n"
  },
  {
    "path": "test-d/internal/require-none.ts",
    "content": "import {expectAssignable, expectNotAssignable} from 'tsd';\nimport type {RequireNone} from '../../source/internal/index.d.ts';\n\ntype NoneAllowed = RequireNone<'foo' | 'bar'>;\n\nexpectAssignable<NoneAllowed>({});\nexpectNotAssignable<NoneAllowed>({foo: 'foo'});\nexpectNotAssignable<NoneAllowed>({bar: 'bar'});\nexpectNotAssignable<NoneAllowed>({foo: 'foo', bar: 'bar'});\n\ntype SomeAllowed = Record<'bar', string> & RequireNone<'foo'>;\n\nexpectAssignable<SomeAllowed>({bar: 'bar'});\nexpectNotAssignable<SomeAllowed>({foo: 'foo'});\nexpectNotAssignable<SomeAllowed>({foo: 'foo', bar: 'bar'});\n"
  },
  {
    "path": "test-d/internal/tuple-max.ts",
    "content": "import {expectType} from 'tsd';\nimport type {TupleMax} from '../../source/internal/index.d.ts';\nimport type {PositiveInfinity} from '../../source/numeric.d.ts';\n\nexpectType<TupleMax<[1, 2, 5, 3, 7, -9, -5, 0]>>(7);\nexpectType<TupleMax<[1, 2, 5, 3, 7, -9, -5, 0, PositiveInfinity]>>(null! as PositiveInfinity);\nexpectType<TupleMax<[1, 1, 1, 1, 1, 1]>>(1);\nexpectType<TupleMax<[-1, -2, -5]>>(-1);\nexpectType<TupleMax<[10, 2]>>(10);\n"
  },
  {
    "path": "test-d/internal/tuple-min.ts",
    "content": "import {expectType} from 'tsd';\nimport type {TupleMin} from '../../source/internal/index.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../../source/numeric.d.ts';\n\ndeclare const never: never;\n\nexpectType<TupleMin<[1, 2, 5, 3, 7, -9, -5, 0]>>(-9);\nexpectType<TupleMin<[1, 2, 5, 3, 7, -9, -5, 0, PositiveInfinity, NegativeInfinity]>>(null! as NegativeInfinity);\nexpectType<TupleMin<[1, 1, 1, 1, 1, 1]>>(1);\nexpectType<TupleMin<[-1, -2, -5]>>(-5);\nexpectType<TupleMin<[-1, -2, number, -5]>>(never);\n"
  },
  {
    "path": "test-d/internal/union-max.ts",
    "content": "import {expectType} from 'tsd';\nimport type {UnionMax} from '../../source/internal/numeric.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../../index.d.ts';\n\nexpectType<UnionMax<1 | 3 | 2>>(3);\nexpectType<UnionMax<10 | 5 | 2>>(10);\nexpectType<UnionMax<0 | 5 | 2 | 1>>(5);\nexpectType<UnionMax<1 | 2 | 5 | 3 | 7 | 9 | 0>>(9);\n\n// TODO: push `negative-union-max-min` branch\n// Negatives are not supported yet (infinite).\n// expectType<UnionMax<-1 | -3 | -2>>(-1);\n// expectType<UnionMax<0 | -5 | -2>>(0);\n\n// Edge cases\nexpectType<UnionMax<any>>({} as any);\nexpectType<UnionMax<never>>({} as never);\nexpectType<UnionMax<number>>({} as number);\nexpectType<UnionMax<(number & {})>>({} as number);\nexpectType<UnionMax<(number & {}) | 1 | 5>>({} as number);\nexpectType<UnionMax<PositiveInfinity>>({} as PositiveInfinity);\nexpectType<UnionMax<NegativeInfinity>>({} as NegativeInfinity);\nexpectType<UnionMax<1 | PositiveInfinity>>({} as PositiveInfinity);\nexpectType<UnionMax<1 | NegativeInfinity>>({} as 1);\n"
  },
  {
    "path": "test-d/internal/union-min.ts",
    "content": "import {expectType} from 'tsd';\nimport type {UnionMin} from '../../source/internal/numeric.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../../index.d.ts';\n\nexpectType<UnionMin<1 | 3 | 2>>(1);\nexpectType<UnionMin<10 | 5 | 2>>(2);\nexpectType<UnionMin<0 | 5 | 2 | 1>>(0);\nexpectType<UnionMin<1 | 2 | 5 | 3 | 7 | 9 | 0>>(0);\n\n// TODO: push `negative-union-max-min` branch\n// Negatives are not supported yet (skipped)\n// expectType<UnionMin<-1 | -3 | -2>>(-3);\n// expectType<UnionMin<0 | -5 | -2>>(-5);\n\n// Edge cases\nexpectType<UnionMin<any>>({} as any);\nexpectType<UnionMin<never>>({} as never);\nexpectType<UnionMin<number>>({} as number);\nexpectType<UnionMin<(number & {})>>({} as number);\nexpectType<UnionMin<(number & {}) | 1 | 5>>({} as number);\nexpectType<UnionMin<PositiveInfinity>>({} as PositiveInfinity);\nexpectType<UnionMin<NegativeInfinity>>({} as NegativeInfinity);\nexpectType<UnionMin<1 | PositiveInfinity>>({} as 1);\nexpectType<UnionMin<1 | NegativeInfinity>>({} as NegativeInfinity);\n"
  },
  {
    "path": "test-d/internal/value-of-union.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ValueOfUnion} from '../../source/internal/index.d.ts';\n\n// Works with objects\ndeclare const test1: ValueOfUnion<{a: 1; b: 2} | {a: 3; c: 4}, 'a'>;\nexpectType<1 | 3>(test1);\n\n// Works with arrays\ndeclare const test2: ValueOfUnion<string[] | [number, boolean], number>;\nexpectType<string | number | boolean>(test2);\n\n// Works with index signatures\ndeclare const test3: ValueOfUnion<{[x: string]: string; a: 'a'} | {[x: number]: number; a: 'a'}, string>;\nexpectType<string>(test3);\n\ndeclare const test4: ValueOfUnion<{[x: string]: string; a: 'a'} | {[x: number]: number; a: 'a'}, number>;\nexpectType<string | number>(test4);\n\n// Works with functions\ndeclare const test5: ValueOfUnion<(() => void) | {(): void; a: 1} | {(): void; a: 2}, 'a'>;\nexpectType<1 | 2>(test5);\n\n// Ignores objects where `Key` is missing\ndeclare const test6: ValueOfUnion<{a: 1; b: 2} | {a: 3; c: 4} | {a: 5; d: 6} | {e: 7}, 'a'>;\nexpectType<1 | 3 | 5>(test6);\n\n// Adds `undefined` when the key is optional\ndeclare const test7: ValueOfUnion<{readonly a?: 1; b: 2} | {a: 3; c: 4}, 'a'>;\nexpectType<1 | 3 | undefined>(test7);\n\n// Works when `Key` is a union\ndeclare const test8: ValueOfUnion<{a: 1; b: 2} | {a: 3; c: 4} | {a: 5; b: 6} | {e: 7}, 'a' | 'b'>;\nexpectType<1 | 2 | 3 | 5 | 6>(test8);\n\n// @ts-expect-error - Errors if `Key` is missing from all of the objects\ndeclare const test9: ValueOfUnion<{a: 1; b: 2} | {a: 3; c: 4}, 'd'>;\n\n// Returns `any` when `Key` is `any`\ndeclare const test10: ValueOfUnion<{a: 1; b: 2} | {a: 3; c: 4}, any>;\nexpectType<any>(test10);\n\n// Returns `never` when `Key` is `never`\ndeclare const test11: ValueOfUnion<{a: 1; b: 2} | {a: 3; c: 4}, never>;\nexpectType<never>(test11);\n"
  },
  {
    "path": "test-d/invariant-of.ts",
    "content": "import {expectAssignable, expectNotAssignable} from 'tsd';\nimport type {InvariantOf} from '../index.d.ts';\n\ntype FooBar = InvariantOf<{\n\tfoo: number;\n\tbar: string;\n}>;\n\ntype FooBarBaz = InvariantOf<{\n\tfoo: number;\n\tbar: string;\n\tbaz: boolean;\n}>;\n\n// We make an explicit cast so we can test the value.\nconst fooBar: FooBar = {foo: 123, bar: 'hello'} as FooBar; // eslint-disable-line @typescript-eslint/consistent-type-assertions\nconst fooBarBaz: FooBarBaz = {foo: 123, bar: 'hello', baz: true} as FooBarBaz; // eslint-disable-line @typescript-eslint/consistent-type-assertions\n\n// The invariantOf<Type> is assignable to Type.\nexpectAssignable<{\n\tfoo: number;\n\tbar: string;\n}>(fooBar);\n\nexpectNotAssignable<FooBarBaz>(fooBar); // Invariance does not accept supertypes.\nexpectNotAssignable<FooBar>(fooBarBaz); // Invariance does not accept subtypes.\n"
  },
  {
    "path": "test-d/is-any.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsAny} from '../index.d.ts';\n\ndeclare const anything: any;\ndeclare const something = 'something';\n\n// `IsAny` should only be true for `any`\nexpectType<IsAny<any>>(true);\nexpectType<IsAny<typeof anything>>(true);\nexpectType<IsAny<string>>(false);\nexpectType<IsAny<typeof something>>(false);\nexpectType<IsAny<never>>(false);\nexpectType<IsAny<unknown>>(false);\nexpectType<IsAny<null>>(false);\nexpectType<IsAny<undefined>>(false);\nexpectType<IsAny<void>>(false);\n\n// Missing generic parameter\n// @ts-expect-error\ntype A = IsAny;\n\n// Verify that are no circular reference issues\n// https://github.com/sindresorhus/type-fest/issues/846\ntype OnlyAny<T extends IsAny<T> extends true ? any : never> = T;\ntype B = OnlyAny<any>;\n// @ts-expect-error\ntype C = OnlyAny<string>;\n"
  },
  {
    "path": "test-d/is-equal.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsEqual, TupleOf} from '../index.d.ts';\n\nexpectType<false>({} as IsEqual<number, string>);\nexpectType<true>({} as IsEqual<1, 1>);\nexpectType<false>({} as IsEqual<'A', 'B'>);\nexpectType<true>({} as IsEqual<'foo', 'foo'>);\nexpectType<false>({} as IsEqual<true, false>);\nexpectType<true>({} as IsEqual<false, false>);\n\nexpectType<false>({} as IsEqual<any, number>);\nexpectType<false>({} as IsEqual<'', never>);\nexpectType<true>({} as IsEqual<any, any>);\nexpectType<true>({} as IsEqual<never, never>);\nexpectType<false>({} as IsEqual<any, never>);\nexpectType<false>({} as IsEqual<never, any>);\nexpectType<false>({} as IsEqual<any, unknown>);\nexpectType<false>({} as IsEqual<never, unknown>);\nexpectType<false>({} as IsEqual<unknown, never>);\nexpectType<false>({} as IsEqual<[never], [unknown]>);\nexpectType<false>({} as IsEqual<[unknown], [never]>);\nexpectType<false>({} as IsEqual<[any], [never]>);\nexpectType<true>({} as IsEqual<[any], [any]>);\nexpectType<true>({} as IsEqual<[never], [never]>);\n\nexpectType<false>({} as IsEqual<1 | 2, 1>);\nexpectType<false>({} as IsEqual<1 | 2, 2 | 3>);\nexpectType<true>({} as IsEqual<1 | 2, 2 | 1>);\nexpectType<false>({} as IsEqual<boolean, true>);\n\nexpectType<true>({} as IsEqual<{a: 1}, {a: 1}>);\nexpectType<false>({} as IsEqual<{a: 1}, {a?: 1}>);\nexpectType<false>({} as IsEqual<{a: 1}, {readonly a: 1}>);\n\nexpectType<true>({} as IsEqual<[], []>);\nexpectType<true>({} as IsEqual<readonly [], readonly []>);\nexpectType<false>({} as IsEqual<readonly [], []>);\nexpectType<true>({} as IsEqual<number[], number[]>);\nexpectType<true>({} as IsEqual<readonly number[], readonly number[]>);\nexpectType<false>({} as IsEqual<readonly number[], number[]>);\nexpectType<true>({} as IsEqual<[string], [string]>);\nexpectType<false>({} as IsEqual<[string], [string, number]>);\nexpectType<false>({} as IsEqual<[0, 1] | [0, 2], [0, 2]>);\n\ntype LongTupleNumber = TupleOf<50, 0>;\nexpectType<true>({} as IsEqual<LongTupleNumber, LongTupleNumber>);\n\ntype ReadonlyLongTupleNumber = Readonly<TupleOf<50, 0>>;\nexpectType<true>({} as IsEqual<ReadonlyLongTupleNumber, ReadonlyLongTupleNumber>);\n\nexpectType<false>({} as IsEqual<ReadonlyLongTupleNumber, LongTupleNumber>);\n\n// Missing all generic parameters.\n// @ts-expect-error\ntype A = IsEqual;\n\n// Missing `Y` generic parameter.\n// @ts-expect-error\ntype B = IsEqual<number>;\n\n// Test for issue https://github.com/sindresorhus/type-fest/issues/537\ntype UnionType = IsEqual<{a: 1} | {a: 1}, {a: 1}>; // eslint-disable-line @typescript-eslint/no-duplicate-type-constituents\nexpectType<UnionType>(true);\n\ntype IntersectionType = IsEqual<{a: 1} & {a: 1}, {a: 1}>; // eslint-disable-line @typescript-eslint/no-duplicate-type-constituents\nexpectType<IntersectionType>(true);\n\n// Test for PR https://github.com/sindresorhus/type-fest/pull/1231\ntype BranchOnWrappedTupleMatches<Tpl> = (Tpl extends [[0, 2]] ? 'Foo' : 'Bar');\ntype BranchOnWrappedTupleDoesNotMatch<Tpl> = (Tpl extends [[0, 1]] ? 'Foo' : 'Bar');\ntype BranchOnTupleMatches<Tpl> = (Tpl extends [0, 2] ? 'Foo' : 'Bar');\ntype BranchOnTupleDoesNotMatch<Tpl> = (Tpl extends [0, 1] ? 'Foo' : 'Bar');\n\ndeclare const equalWrappedTupleIntersectionToBeNeverAndNever: IsEqual<(BranchOnWrappedTupleMatches<[[0, 2]]> & BranchOnWrappedTupleDoesNotMatch<[[0, 2]]>), never>;\nexpectType<true>(equalWrappedTupleIntersectionToBeNeverAndNever);\n\ndeclare const equalWrappedTupleIntersectionToBeNeverAndNeverExpanded: [0, 2] extends infer Tpl ? IsEqual<(BranchOnWrappedTupleMatches<[Tpl]> & BranchOnWrappedTupleDoesNotMatch<[Tpl]>), never> : never;\nexpectType<true>(equalWrappedTupleIntersectionToBeNeverAndNeverExpanded);\n\ndeclare const equalTupleIntersectionToBeNeverAndNever: IsEqual<(BranchOnTupleMatches<[0, 2]> & BranchOnTupleDoesNotMatch<[0, 2]>), never>;\nexpectType<true>(equalTupleIntersectionToBeNeverAndNever);\n\ndeclare const equalTupleIntersectionToBeNeverAndNeverExpanded: [0, 2] extends infer Tpl ? IsEqual<(BranchOnTupleMatches<Tpl> & BranchOnTupleDoesNotMatch<Tpl>), never> : never;\nexpectType<true>(equalTupleIntersectionToBeNeverAndNeverExpanded);\n\ndeclare const equalTupleIntersectionAndTuple: IsEqual<[{a: 1}] & [{a: 1}], [{a: 1}]>; // eslint-disable-line @typescript-eslint/no-duplicate-type-constituents\nexpectType<true>(equalTupleIntersectionAndTuple);\n\n// Test for Issue https://github.com/sindresorhus/type-fest/issues/1305\ntype Assignability<T, U, _V extends IsEqual<T, U>> = any;\ntype TestAssignability<T> = Assignability<T, T, true>;\n"
  },
  {
    "path": "test-d/is-float.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsFloat, PositiveInfinity} from '../index.d.ts';\n\ndeclare const x: unknown;\n\nexpectType<true>(x as IsFloat<1.5>);\nexpectType<true>(x as IsFloat<999_999_999_999_999.9>);\nexpectType<true>(x as IsFloat<0.000_000_1>);\nexpectType<true>(x as IsFloat<-1e-7>);\n\nexpectType<false>(x as IsFloat<0>);\nexpectType<false>(x as IsFloat<1>);\nexpectType<false>(x as IsFloat<1.0>); // eslint-disable-line unicorn/no-zero-fractions\nexpectType<false>(x as IsFloat<-1>);\nexpectType<false>(x as IsFloat<number>);\nexpectType<false>(x as IsFloat<0o10>);\nexpectType<false>(x as IsFloat<1n>);\nexpectType<false>(x as IsFloat<0n>);\nexpectType<false>(x as IsFloat<0b10>);\nexpectType<false>(x as IsFloat<0x10>);\nexpectType<false>(x as IsFloat<1e+100>);\nexpectType<false>(x as IsFloat<1.23e+21>);\nexpectType<false>(x as IsFloat<-1.23e+21>);\nexpectType<false>(x as IsFloat<'1.23'>);\nexpectType<false>(x as IsFloat<PositiveInfinity>);\n"
  },
  {
    "path": "test-d/is-integer.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsInteger, PositiveInfinity} from '../index.d.ts';\n\ndeclare const x: unknown;\n\nexpectType<true>(x as IsInteger<0>);\nexpectType<true>(x as IsInteger<1>);\nexpectType<true>(x as IsInteger<1.0>); // eslint-disable-line unicorn/no-zero-fractions\nexpectType<true>(x as IsInteger<-1>);\nexpectType<true>(x as IsInteger<0o10>);\nexpectType<true>(x as IsInteger<1n>);\nexpectType<true>(x as IsInteger<0n>);\nexpectType<true>(x as IsInteger<0b10>);\nexpectType<true>(x as IsInteger<0x10>);\nexpectType<true>(x as IsInteger<1e+100>);\nexpectType<true>(x as IsInteger<1.23e+21>);\nexpectType<true>(x as IsInteger<-1.23e+21>);\n\nexpectType<false>(x as IsInteger<1.5>);\nexpectType<false>(x as IsInteger<-1.5>);\nexpectType<false>(x as IsInteger<number>);\nexpectType<false>(x as IsInteger<PositiveInfinity>);\nexpectType<false>(x as IsInteger<0.000_000_1>);\nexpectType<false>(x as IsInteger<-1e-7>);\n"
  },
  {
    "path": "test-d/is-literal.ts",
    "content": "import {expectType} from 'tsd';\nimport type {\n\tIsLiteral,\n\tIsStringLiteral,\n\tIsNumericLiteral,\n\tIsBooleanLiteral,\n\tIsSymbolLiteral,\n\tTagged,\n\tLiteralUnion,\n} from '../index.d.ts';\n\nconst stringLiteral = '';\nconst numberLiteral = 1;\n// Note: tsd warns on direct literal usage so we cast to the literal type\nconst bigintLiteral = BigInt(1) as 1n;\nconst booleanLiteral = true;\nconst symbolLiteral = Symbol('');\n\ndeclare const _string: string;\ndeclare const _number: number;\ndeclare const _bigint: bigint;\ndeclare const _boolean: boolean;\ndeclare const _symbol: symbol;\n\n// Literals should be true\nexpectType<IsLiteral<typeof stringLiteral>>(true);\nexpectType<IsLiteral<typeof numberLiteral>>(true);\nexpectType<IsLiteral<typeof bigintLiteral>>(true);\nexpectType<IsLiteral<typeof booleanLiteral>>(true);\nexpectType<IsLiteral<typeof symbolLiteral>>(true);\n\n// Primitives should be false\nexpectType<IsLiteral<typeof _string>>(false);\nexpectType<IsLiteral<typeof _number>>(false);\nexpectType<IsLiteral<typeof _bigint>>(false);\nexpectType<IsLiteral<typeof _boolean>>(false);\nexpectType<IsLiteral<typeof _symbol>>(false);\n\n// Null, undefined, and non-primitives should fail all literal checks\nexpectType<IsLiteral<null>>(false);\nexpectType<IsLiteral<undefined>>(false);\nexpectType<IsLiteral<any>>(false);\nexpectType<IsLiteral<never>>(false);\n\nexpectType<IsStringLiteral<typeof stringLiteral>>(true);\nexpectType<IsStringLiteral<typeof _string>>(false);\n\n// Strings with infinite set of possible values return `false`\nexpectType<IsStringLiteral<Uppercase<string>>>(false);\nexpectType<IsStringLiteral<Lowercase<string>>>(false);\nexpectType<IsStringLiteral<Capitalize<string>>>(false);\nexpectType<IsStringLiteral<Uncapitalize<string>>>(false);\nexpectType<IsStringLiteral<Capitalize<Lowercase<string>>>>(false);\nexpectType<IsStringLiteral<Uncapitalize<Uppercase<string>>>>(false);\nexpectType<IsStringLiteral<`abc${string}`>>(false);\nexpectType<IsStringLiteral<`${string}abc`>>(false);\nexpectType<IsStringLiteral<`${number}:${string}`>>(false);\nexpectType<IsStringLiteral<`abc${Uppercase<string>}`>>(false);\nexpectType<IsStringLiteral<`${Lowercase<string>}abc`>>(false);\nexpectType<IsStringLiteral<`${number}`>>(false);\nexpectType<IsStringLiteral<`${number}${string}`>>(false);\nexpectType<IsStringLiteral<`${number}` | Uppercase<string>>>(false);\nexpectType<IsStringLiteral<Capitalize<string> | Uppercase<string>>>(false);\nexpectType<IsStringLiteral<`abc${string}` | `${string}abc`>>(false);\n\n// Strings with finite set of possible values return `true`\nexpectType<IsStringLiteral<'a' | 'b'>>(true);\nexpectType<IsStringLiteral<Uppercase<'a'>>>(true);\nexpectType<IsStringLiteral<Lowercase<'a'>>>(true);\nexpectType<IsStringLiteral<Uppercase<'a' | 'b'>>>(true);\nexpectType<IsStringLiteral<Lowercase<'a' | 'b'>>>(true);\nexpectType<IsStringLiteral<Capitalize<'abc' | 'xyz'>>>(true);\nexpectType<IsStringLiteral<Uncapitalize<'Abc' | 'Xyz'>>>(true);\nexpectType<IsStringLiteral<`ab${'c' | 'd' | 'e'}`>>(true);\nexpectType<IsStringLiteral<Uppercase<'a' | 'b'> | 'C' | 'D'>>(true);\nexpectType<IsStringLiteral<Lowercase<'xyz'> | Capitalize<'abc'>>>(true);\n\n// Strings with union of literals and non-literals return `boolean`\nexpectType<IsStringLiteral<Uppercase<string> | 'abc'>>({} as boolean);\nexpectType<IsStringLiteral<Lowercase<string> | 'Abc'>>({} as boolean);\nexpectType<IsStringLiteral<null | '1' | '2' | '3'>>({} as boolean);\nexpectType<IsStringLiteral<1 | 2 | '3'>>({} as boolean);\nexpectType<IsStringLiteral<'foo' | 'bar' | number>>({} as boolean);\n\n// Types other than string return `false`\nexpectType<IsStringLiteral<bigint>>(false);\nexpectType<IsStringLiteral<1 | 2 | 3>>(false);\nexpectType<IsStringLiteral<object>>(false);\nexpectType<IsStringLiteral<false | undefined | null>>(false);\n\n// Boundary types\nexpectType<IsStringLiteral<{}>>(false);\nexpectType<IsStringLiteral<any>>(false);\nexpectType<IsStringLiteral<never>>(false);\n\nexpectType<IsNumericLiteral<typeof numberLiteral>>(true);\nexpectType<IsNumericLiteral<typeof bigintLiteral>>(true);\nexpectType<IsNumericLiteral<typeof _number>>(false);\nexpectType<IsNumericLiteral<typeof _bigint>>(false);\n\nexpectType<IsBooleanLiteral<typeof booleanLiteral>>(true);\nexpectType<IsBooleanLiteral<typeof _boolean>>(false);\n\nexpectType<IsSymbolLiteral<typeof symbolLiteral>>(true);\nexpectType<IsSymbolLiteral<typeof _symbol>>(false);\n\n// Missing generic parameter\n// @ts-expect-error\ntype A0 = IsLiteral;\n// @ts-expect-error\ntype A1 = IsStringLiteral;\n// @ts-expect-error\ntype A2 = IsNumericLiteral;\n// @ts-expect-error\ntype A3 = IsBooleanLiteral;\n// @ts-expect-error\ntype A4 = IsSymbolLiteral;\n\n// Tagged types\nexpectType<IsStringLiteral<Tagged<string, 'Tag'>>>(false);\nexpectType<IsStringLiteral<Tagged<Uppercase<string>, 'Tag'>>>(false);\nexpectType<IsStringLiteral<Tagged<number, 'Tag'>>>(false);\nexpectType<IsStringLiteral<Tagged<'foo' | 'bar', 'Tag'>>>(true);\nexpectType<IsStringLiteral<Tagged<'foo' | 'bar' | `on${string}`, 'Tag'>>>({} as boolean);\nexpectType<IsStringLiteral<Tagged<'1st' | '2nd' | '3rd' | number, 'Tag'>>>({} as boolean);\n\nexpectType<IsStringLiteral<Tagged<string, 'Tag'> | Tagged<number, 'Tag'>>>(false);\nexpectType<IsStringLiteral<Tagged<'foo', 'Tag'> | Tagged<'bar', 'Tag'>>>(true);\nexpectType<IsStringLiteral<Tagged<'foo' | 'bar', 'Tag'> | Tagged<number, 'Tag'>>>({} as boolean);\nexpectType<IsStringLiteral<Tagged<'foo' | 'bar', 'Tag'> | number>>({} as boolean);\n\n// Uncollapsed unions (e.g., `'foo' | 'bar' | (string & {})`)\nexpectType<IsStringLiteral<'foo' | 'bar' | (string & {})>>(false);\nexpectType<IsStringLiteral<LiteralUnion<'foo' | 'bar', string>>>(false);\nexpectType<IsStringLiteral<LiteralUnion<'onClick' | 'onMouseDown', `on${string}`>>>(false);\nexpectType<IsStringLiteral<LiteralUnion<'press' | 'onClick' | 'onMouseDown', `on${string}`>>>({} as boolean);\nexpectType<IsStringLiteral<LiteralUnion<'foo' | 'bar', number>>>({} as boolean);\nexpectType<IsStringLiteral<Tagged<LiteralUnion<'foo' | 'bar', string>, 'Tag'>>>(false);\nexpectType<IsStringLiteral<Tagged<LiteralUnion<'click' | 'onMouseDown', `on${string}`>, 'Tag'>>>({} as boolean);\n\nexpectType<IsNumericLiteral<Tagged<number, 'Tag'>>>(false);\nexpectType<IsBooleanLiteral<Tagged<boolean, 'Tag'>>>(false);\n"
  },
  {
    "path": "test-d/is-lowercase.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsLowercase} from '../index.d.ts';\n\n// Literals\nexpectType<IsLowercase<'abc'>>(true);\nexpectType<IsLowercase<''>>(true);\nexpectType<IsLowercase<'123'>>(true);\nexpectType<IsLowercase<'!@#'>>(true);\n\nexpectType<IsLowercase<'Abc'>>(false);\nexpectType<IsLowercase<'ABC'>>(false);\n\n// Non-literals\nexpectType<IsLowercase<Lowercase<string>>>(true);\nexpectType<IsLowercase<Lowercase<`on${string}`>>>(true);\n\nexpectType<IsLowercase<Uppercase<string>>>(false);\nexpectType<IsLowercase<Capitalize<`on${string}`>>>(false);\nexpectType<IsLowercase<`on${Capitalize<string>}`>>(false);\nexpectType<IsLowercase<Capitalize<`${string}end`>>>(false);\n\nexpectType<IsLowercase<string>>({} as boolean);\nexpectType<IsLowercase<`on${string}`>>({} as boolean);\nexpectType<IsLowercase<Uncapitalize<string>>>({} as boolean);\nexpectType<IsLowercase<Uncapitalize<`on${string}`>>>({} as boolean);\nexpectType<IsLowercase<`on${Uncapitalize<string>}`>>({} as boolean);\nexpectType<IsLowercase<`${number}`>>({} as boolean);\n\nexpectType<IsLowercase<`Start${string}`>>(false);\nexpectType<IsLowercase<`${string}End`>>(false);\nexpectType<IsLowercase<`${string}Mid${string}`>>(false);\n\n// Complex non-literals\nexpectType<IsLowercase<`${Lowercase<string>}${Lowercase<string>}`>>(true);\n\nexpectType<IsLowercase<`${Uppercase<string>}${Lowercase<string>}`>>(false);\nexpectType<IsLowercase<`${Lowercase<string>}${Uppercase<string>}`>>(false);\nexpectType<IsLowercase<`${Lowercase<string>}${Uppercase<string>}${Lowercase<string>}`>>(false);\nexpectType<IsLowercase<`${Capitalize<string>}${Lowercase<string>}`>>(false);\nexpectType<IsLowercase<`${Lowercase<string>}${Capitalize<string>}`>>(false);\nexpectType<IsLowercase<`${string}${Capitalize<string>}`>>(false);\nexpectType<IsLowercase<`${number}${Capitalize<string>}`>>(false);\n\nexpectType<IsLowercase<`${string}${Lowercase<string>}`>>({} as boolean);\nexpectType<IsLowercase<`${string}${string}`>>({} as boolean);\nexpectType<IsLowercase<`${Lowercase<string>}${Lowercase<string>}${string}`>>({} as boolean);\nexpectType<IsLowercase<`${string}${Uncapitalize<string>}`>>({} as boolean);\nexpectType<IsLowercase<`${number}/${number}`>>({} as boolean);\nexpectType<IsLowercase<`${string}${number}`>>({} as boolean);\n\n// Unions\nexpectType<IsLowercase<'abc' | 'xyz'>>(true); // Both `true`\nexpectType<IsLowercase<'abC' | 'xYz'>>(false); // Both `false`\nexpectType<IsLowercase<'abc' | 'Abc'>>({} as boolean); // One `true`, one `false`\nexpectType<IsLowercase<'abc' | `${Uncapitalize<string>}end`>>({} as boolean); // One `true`, one `boolean`\nexpectType<IsLowercase<'xYz' | `abc${string}`>>({} as boolean); // One `false`, one `boolean`\n"
  },
  {
    "path": "test-d/is-never.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsNever} from '../index.d.ts';\n\ndeclare const _never: never;\ndeclare const something = 'something';\n\n// `IsNever` should only be true for `any`\nexpectType<IsNever<never>>(true);\nexpectType<IsNever<typeof _never>>(true);\nexpectType<IsNever<string>>(false);\nexpectType<IsNever<typeof something>>(false);\nexpectType<IsNever<any>>(false);\nexpectType<IsNever<unknown>>(false);\nexpectType<IsNever<null>>(false);\nexpectType<IsNever<undefined>>(false);\nexpectType<IsNever<void>>(false);\n\n// Missing generic parameter\n// @ts-expect-error\ntype A = IsNever;\n"
  },
  {
    "path": "test-d/is-null.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsNull} from '../source/is-null.d.ts';\n\n// https://www.typescriptlang.org/docs/handbook/type-compatibility.html\nexpectType<IsNull<null>>(true);\nexpectType<IsNull<any>>(true);\nexpectType<IsNull<never>>(true);\nexpectType<IsNull<undefined>>(false); // Depends on `strictNullChecks`\nexpectType<IsNull<unknown>>(false);\nexpectType<IsNull<void>>(false);\nexpectType<IsNull<{}>>(false);\n"
  },
  {
    "path": "test-d/is-nullable.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsNullable} from '../source/is-nullable.d.ts';\n\nexpectType<IsNullable<any>>(true);\nexpectType<IsNullable<null>>(true);\nexpectType<IsNullable<null | undefined>>(true);\nexpectType<IsNullable<string | null>>(true);\nexpectType<IsNullable<string | null | undefined>>(true);\n\nexpectType<IsNullable<string>>(false);\nexpectType<IsNullable<string | undefined>>(false);\n\nexpectType<IsNullable<void>>(false);\nexpectType<IsNullable<undefined>>(false);\nexpectType<IsNullable<never>>(false);\nexpectType<IsNullable<unknown>>(false);\nexpectType<IsNullable<() => void>>(false);\nexpectType<IsNullable<string & null>>(false);\n"
  },
  {
    "path": "test-d/is-optional-key-of.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsOptionalKeyOf} from '../source/is-optional-key-of.d.ts';\n\ndeclare const never: never;\ndeclare const boolean: boolean;\ndeclare const symbol: unique symbol;\n\n// Base object\ntype A = {\n\ta: string;\n\tb?: number;\n\tc: boolean;\n};\n\nexpectType<IsOptionalKeyOf<A, 'a'>>(false);\nexpectType<IsOptionalKeyOf<A, 'b'>>(true);\nexpectType<IsOptionalKeyOf<A, 'c'>>(false);\n\n// @ts-expect-error `d` is not in `keyof T`\nexpectType<IsOptionalKeyOf<A, 'd'>>(false);\n\n// Index signature with optional keys\ntype B = {\n\t[k: string]: string;\n};\n\nexpectType<IsOptionalKeyOf<B, string>>(false);\nexpectType<IsOptionalKeyOf<B, 'anything'>>(true);\n\n// Optional + readonly\ntype C = {\n\treadonly a?: number;\n\tb: string;\n};\n\nexpectType<IsOptionalKeyOf<C, 'a'>>(true);\nexpectType<IsOptionalKeyOf<C, 'b'>>(false);\n\n// Required + readonly\ntype D = {\n\treadonly x: boolean;\n\ty?: string;\n};\n\nexpectType<IsOptionalKeyOf<D, 'x'>>(false);\nexpectType<IsOptionalKeyOf<D, 'y'>>(true);\n\n// Union\ntype E1 = {a?: number};\ntype E2 = {a: number};\ntype E = E1 | E2;\n\nexpectType<IsOptionalKeyOf<E, 'a'>>(boolean);\n\n// Intersection\ntype F1 = {a?: number};\ntype F2 = {a: number};\ntype F = F1 & F2;\n\nexpectType<IsOptionalKeyOf<F, 'a'>>(false);\n\n// Class\nclass G {\n\tx?: string;\n\ty = 5;\n}\n\nexpectType<IsOptionalKeyOf<G, 'x'>>(true);\nexpectType<IsOptionalKeyOf<G, 'y'>>(false);\n\ntype H = {\n\t[symbol]?: number;\n\ta: string;\n};\n\nexpectType<IsOptionalKeyOf<H, typeof symbol>>(true);\nexpectType<IsOptionalKeyOf<H, 'a'>>(false);\n\n// Method and optional prop\ntype I = {\n\tname: string;\n\trun?(): void;\n};\n\nexpectType<IsOptionalKeyOf<I, 'run'>>(true);\nexpectType<IsOptionalKeyOf<I, 'name'>>(false);\n\n// Fully optional object\ntype J = Partial<{\n\ta: number;\n\tb: string;\n}>;\n\nexpectType<IsOptionalKeyOf<J, 'a'>>(true);\nexpectType<IsOptionalKeyOf<J, 'b'>>(true);\n\n// Non-optional but union with undefined\ntype L = {\n\ta: string | undefined;\n\tb?: number;\n};\n\nexpectType<IsOptionalKeyOf<L, 'a'>>(false);\nexpectType<IsOptionalKeyOf<L, 'b'>>(true);\n\n// Union of keys\nexpectType<IsOptionalKeyOf<A, 'b' | 'c'>>(boolean);\nexpectType<IsOptionalKeyOf<A, 'a' | 'b'>>(boolean);\n// @ts-expect-error\nexpectType<IsOptionalKeyOf<A, 'a' | 'd'>>(false);\nexpectType<IsOptionalKeyOf<A, 'a' | 'c'>>(false);\n\ntype FullKeyUnion = keyof A; // 'a' | 'b' | 'c'\nexpectType<IsOptionalKeyOf<A, FullKeyUnion>>(boolean);\n// @ts-expect-error\nexpectType<IsOptionalKeyOf<A, 'b' | 'x'>>(boolean); // 'x' is not in A, so filtered as false\n\n// `never` / `any\ntype K = {a?: string};\nexpectType<IsOptionalKeyOf<K, any>>(never);\nexpectType<IsOptionalKeyOf<any, any>>(never);\nexpectType<IsOptionalKeyOf<any, 'a'>>(never);\nexpectType<IsOptionalKeyOf<K, never>>(never);\nexpectType<IsOptionalKeyOf<any, never>>(never);\nexpectType<IsOptionalKeyOf<never, 'a'>>(never);\n"
  },
  {
    "path": "test-d/is-optional.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsOptional} from '../source/is-optional.d.ts';\n\nexpectType<IsOptional<any>>(true);\nexpectType<IsOptional<undefined>>(true);\nexpectType<IsOptional<null | undefined>>(true);\nexpectType<IsOptional<string | undefined>>(true);\nexpectType<IsOptional<string | null | undefined>>(true);\n\nexpectType<IsOptional<string>>(false);\nexpectType<IsOptional<string | null>>(false);\n\nexpectType<IsOptional<void>>(false);\nexpectType<IsOptional<null>>(false);\nexpectType<IsOptional<never>>(false);\nexpectType<IsOptional<unknown>>(false);\nexpectType<IsOptional<() => void>>(false);\nexpectType<IsOptional<string & undefined>>(false);\n"
  },
  {
    "path": "test-d/is-readonly-key-of.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsReadonlyKeyOf} from '../source/is-readonly-key-of.d.ts';\n\ndeclare const never: never;\ndeclare const boolean: boolean;\ndeclare const symbol: unique symbol;\n\n// Simple object\ntype A = {\n\ta: string;\n\treadonly b: number;\n\tc?: boolean;\n};\n\nexpectType<IsReadonlyKeyOf<A, 'a'>>(false);\nexpectType<IsReadonlyKeyOf<A, 'b'>>(true);\nexpectType<IsReadonlyKeyOf<A, 'c'>>(false);\n\n// @ts-expect-error `d` is not in `keyof T`\nexpectType<IsReadonlyKeyOf<A, 'd'>>(false);\n\n// Index signature\ntype B = {\n\t[k: string]: number;\n};\n\nexpectType<IsReadonlyKeyOf<B, 'anything'>>(false);\n\n// Fully readonly index\ntype C = {\n\treadonly [k: string]: number;\n};\n\nexpectType<IsReadonlyKeyOf<C, string>>(true);\nexpectType<IsReadonlyKeyOf<C, 'anything'>>(false);\n\n// Optional + readonly\ntype D = {\n\treadonly a?: string;\n\tb: number;\n};\n\nexpectType<IsReadonlyKeyOf<D, 'a'>>(true);\nexpectType<IsReadonlyKeyOf<D, 'b'>>(false);\n\n// Union\ntype E1 = {a: number};\ntype E2 = {readonly a: number};\ntype E = E1 | E2;\n\nexpectType<IsReadonlyKeyOf<E, 'a'>>(boolean);\n\n// Intersection\ntype F1 = {readonly a: string};\ntype F2 = {a: string};\ntype F = F1 & F2;\n\nexpectType<IsReadonlyKeyOf<F, 'a'>>(false);\n\n// Class instance\nclass G {\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\treadonly x = 1;\n\ty = '';\n}\n\nexpectType<IsReadonlyKeyOf<G, 'x'>>(true);\nexpectType<IsReadonlyKeyOf<G, 'y'>>(false);\n\ntype H = {\n\t[symbol]: number;\n\treadonly x: string;\n};\n\nexpectType<IsReadonlyKeyOf<H, typeof symbol>>(false);\nexpectType<IsReadonlyKeyOf<H, 'x'>>(true);\n\n// Full readonly object\ntype I = Readonly<{\n\ta: number;\n\tb: string;\n}>;\n\nexpectType<IsReadonlyKeyOf<I, 'a'>>(true);\nexpectType<IsReadonlyKeyOf<I, 'b'>>(true);\n\n// Object with method\ntype J = {\n\treadonly id: string;\n\trun(): void;\n};\n\nexpectType<IsReadonlyKeyOf<J, 'run'>>(false);\nexpectType<IsReadonlyKeyOf<J, 'id'>>(true);\n\n// Record\ntype K = Record<'a' | 'b', string>;\n\nexpectType<IsReadonlyKeyOf<K, 'a'>>(false);\nexpectType<IsReadonlyKeyOf<K, 'b'>>(false);\n\n// Union of keys\nexpectType<IsReadonlyKeyOf<A, 'b' | 'c'>>(boolean);\nexpectType<IsReadonlyKeyOf<A, 'a' | 'b'>>(boolean);\n// @ts-expect-error\nexpectType<IsReadonlyKeyOf<A, 'a' | 'd'>>(false);\nexpectType<IsReadonlyKeyOf<A, 'a' | 'c'>>(false);\n\ntype FullKeyUnion = keyof A; // 'a' | 'b' | 'c'\nexpectType<IsReadonlyKeyOf<A, FullKeyUnion>>(boolean);\n// @ts-expect-error\nexpectType<IsReadonlyKeyOf<A, 'b' | 'x'>>(boolean); // 'x' is not in A, so filtered as false\n\n// `never` / `any\ntype L = {readonly a: string};\nexpectType<IsReadonlyKeyOf<K, any>>(never);\nexpectType<IsReadonlyKeyOf<any, any>>(never);\nexpectType<IsReadonlyKeyOf<any, 'a'>>(never);\nexpectType<IsReadonlyKeyOf<K, never>>(never);\nexpectType<IsReadonlyKeyOf<any, never>>(never);\nexpectType<IsReadonlyKeyOf<never, 'a'>>(never);\n"
  },
  {
    "path": "test-d/is-required-key-of.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsRequiredKeyOf} from '../source/is-required-key-of.d.ts';\n\ndeclare const never: never;\ndeclare const boolean: boolean;\ndeclare const symbol: unique symbol;\n\n// Base object\ntype A = {\n\ta: string;\n\tb?: number;\n\tc: boolean;\n};\n\nexpectType<IsRequiredKeyOf<A, 'a'>>(true);\nexpectType<IsRequiredKeyOf<A, 'b'>>(false);\nexpectType<IsRequiredKeyOf<A, 'c'>>(true);\n\n// @ts-expect-error `d` is not in `keyof T`\nexpectType<IsRequiredKeyOf<A, 'd'>>(false);\n\n// Index signature with required keys\ntype B = {\n\t[k: string]: string;\n};\n\nexpectType<IsRequiredKeyOf<B, string>>(true);\nexpectType<IsRequiredKeyOf<B, 'anything'>>(false);\n\n// Required and readonly combo\ntype C = {\n\treadonly a?: number;\n\tb: string;\n};\n\nexpectType<IsRequiredKeyOf<C, 'a'>>(false);\nexpectType<IsRequiredKeyOf<C, 'b'>>(true);\n\n// Required + readonly\ntype D = {\n\treadonly x: boolean;\n\ty?: string;\n};\n\nexpectType<IsRequiredKeyOf<D, 'x'>>(true);\nexpectType<IsRequiredKeyOf<D, 'y'>>(false);\n\n// Union\ntype E1 = {a?: number};\ntype E2 = {a: number};\ntype E = E1 | E2;\n\nexpectType<IsRequiredKeyOf<E, 'a'>>(boolean);\n\n// Intersection\ntype F1 = {a?: number};\ntype F2 = {a: number};\ntype F = F1 & F2;\n\nexpectType<IsRequiredKeyOf<F, 'a'>>(true);\n\n// Class\nclass G {\n\tx?: string;\n\ty = 5;\n}\n\nexpectType<IsRequiredKeyOf<G, 'x'>>(false);\nexpectType<IsRequiredKeyOf<G, 'y'>>(true);\n\ntype H = {\n\t[symbol]?: number;\n\ta: string;\n};\n\nexpectType<IsRequiredKeyOf<H, typeof symbol>>(false);\nexpectType<IsRequiredKeyOf<H, 'a'>>(true);\n\n// Method and required prop\ntype I = {\n\tname: string;\n\trun?(): void;\n};\n\nexpectType<IsRequiredKeyOf<I, 'run'>>(false);\nexpectType<IsRequiredKeyOf<I, 'name'>>(true);\n\n// Fully required object\ntype J = Partial<{\n\ta: number;\n\tb: string;\n}>;\n\nexpectType<IsRequiredKeyOf<J, 'a'>>(false);\nexpectType<IsRequiredKeyOf<J, 'b'>>(false);\n\n// Non-required but union with undefined\ntype L = {\n\ta: string | undefined;\n\tb?: number;\n};\n\nexpectType<IsRequiredKeyOf<L, 'a'>>(true);\nexpectType<IsRequiredKeyOf<L, 'b'>>(false);\n\n// Union of keys\nexpectType<IsRequiredKeyOf<A, 'b' | 'c'>>(boolean);\nexpectType<IsRequiredKeyOf<A, 'a' | 'c'>>(true);\n// @ts-expect-error\nexpectType<IsRequiredKeyOf<A, 'a' | 'd'>>(boolean);\nexpectType<IsRequiredKeyOf<A, 'a' | 'c'>>(true);\n\ntype FullKeyUnion = keyof A; // 'a' | 'b' | 'c'\nexpectType<IsRequiredKeyOf<A, FullKeyUnion>>(boolean);\n// @ts-expect-error\nexpectType<IsRequiredKeyOf<A, 'a' | 'x'>>(boolean); // 'x' is not in A, so filtered as false\n\n// `never` / `any\ntype K = {a: string};\nexpectType<IsRequiredKeyOf<K, any>>(never);\nexpectType<IsRequiredKeyOf<any, any>>(never);\nexpectType<IsRequiredKeyOf<any, 'a'>>(never);\nexpectType<IsRequiredKeyOf<K, never>>(never);\nexpectType<IsRequiredKeyOf<any, never>>(never);\nexpectType<IsRequiredKeyOf<never, 'a'>>(never);\n"
  },
  {
    "path": "test-d/is-tuple.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsTuple} from '../index.d.ts';\n\n// Tuples\nexpectType<IsTuple<[]>>(true);\nexpectType<IsTuple<[number]>>(true);\nexpectType<IsTuple<[number, string]>>(true);\nexpectType<IsTuple<[number, string, ...number[]], {fixedLengthOnly: false}>>(true);\nexpectType<IsTuple<[number?]>>(true);\nexpectType<IsTuple<[number?, string?]>>(true);\nexpectType<IsTuple<[number?, string?, ...number[]], {fixedLengthOnly: false}>>(true);\nexpectType<IsTuple<[...number[], string, number], {fixedLengthOnly: false}>>(true);\nexpectType<IsTuple<[never]>>(true);\n\n// Readonly tuples\nexpectType<IsTuple<readonly []>>(true);\nexpectType<IsTuple<readonly [number]>>(true);\nexpectType<IsTuple<readonly [number, string, ...number[]], {fixedLengthOnly: false}>>(true);\nexpectType<IsTuple<readonly [number?, string?, ...number[]], {fixedLengthOnly: false}>>(true);\nexpectType<IsTuple<readonly [...number[], string, number], {fixedLengthOnly: false}>>(true);\nexpectType<IsTuple<readonly [number?]>>(true);\nexpectType<IsTuple<readonly [never]>>(true);\n\n// Non-tuples\nexpectType<IsTuple<number[]>>(false);\nexpectType<IsTuple<readonly number[]>>(false);\nexpectType<IsTuple<[...number[]]>>(false);\nexpectType<IsTuple<[number, string, ...number[]]>>(false);\nexpectType<IsTuple<readonly [number?, string?, ...number[]]>>(false);\nexpectType<IsTuple<[...number[], string, number]>>(false);\nexpectType<IsTuple<readonly [...number[], string, number]>>(false);\nexpectType<IsTuple<never[]>>(false);\nexpectType<IsTuple<any[]>>(false);\n\n// Boundary types\nexpectType<IsTuple<any>>({} as boolean);\nexpectType<IsTuple<any, {fixedLengthOnly: true}>>({} as boolean);\nexpectType<IsTuple<never>>(false);\n\n// Unions\nexpectType<IsTuple<[number] | [number, string, boolean]>>(true);\nexpectType<IsTuple<[number?, string?] | [] | [number, string, ...number[]], {fixedLengthOnly: false}>>(true);\nexpectType<IsTuple<[number?, string?] | [] | [number, string, ...number[]]>>({} as boolean);\nexpectType<IsTuple<number[] | string[]>>(false);\nexpectType<IsTuple<[number, string] | string[]>>({} as boolean);\nexpectType<IsTuple<[string] | [number] | number[]>>({} as boolean);\nexpectType<IsTuple<[string, ...number[]] | [number?, string?, ...number[]]>>(false);\nexpectType<IsTuple<[string, ...number[]] | [number?, string?, ...number[]], {fixedLengthOnly: false}>>(true);\nexpectType<IsTuple<[] | [number] | readonly [string]>>(true);\n\n// Labeled tuples\nexpectType<IsTuple<[x: string, y: number]>>(true);\nexpectType<IsTuple<[first: string, ...rest: number[]]>>(false);\nexpectType<IsTuple<[first: string, ...rest: number[]], {fixedLengthOnly: false}>>(true);\nexpectType<IsTuple<readonly [name: string, age?: number]>>(true);\n\n// Mixed optional/required elements\nexpectType<IsTuple<[string, number?]>>(true);\nexpectType<IsTuple<readonly [string, number?, ...boolean[]]>>(false);\nexpectType<IsTuple<readonly [string, number?, ...boolean[]], {fixedLengthOnly: false}>>(true);\n\n// Setting `fixedLengthOnly` to `boolean` falls back to it's default value of `true`\nexpectType<IsTuple<[number, string, ...number[]], {fixedLengthOnly: boolean}>>(false);\n\n// @ts-expect-error only works with arrays\ntype T = IsTuple<{}>;\n"
  },
  {
    "path": "test-d/is-undefined.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsUndefined} from '../source/is-undefined.d.ts';\n\nexpectType<IsUndefined<undefined>>(true);\nexpectType<IsUndefined<any>>(true);\nexpectType<IsUndefined<never>>(true);\nexpectType<IsUndefined<null>>(false); // Depends on `strictNullChecks`\nexpectType<IsUndefined<unknown>>(false);\nexpectType<IsUndefined<void>>(false);\nexpectType<IsUndefined<{}>>(false);\n"
  },
  {
    "path": "test-d/is-union.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsUnion} from '../index.d.ts';\n\nexpectType<IsUnion<1>>(false);\nexpectType<IsUnion<true>>(false);\nexpectType<IsUnion<'foo'>>(false);\nexpectType<IsUnion<[]>>(false);\nexpectType<IsUnion<{}>>(false);\nexpectType<IsUnion<1 & {}>>(false);\nexpectType<IsUnion<never>>(false);\nexpectType<IsUnion<unknown>>(false);\nexpectType<IsUnion<any>>(false);\n\nexpectType<IsUnion<1 | 2>>(true);\nexpectType<IsUnion<'foo' | 'bar'>>(true);\nexpectType<IsUnion<'foo' | 'bar' | 1>>(true);\nexpectType<IsUnion<'foo' | 1>>(true);\nexpectType<IsUnion<[] | {}>>(true);\n\ntype TestUnion =\n\t// Here, the entire union extends both the individual members:\n\t// So, `TestUnion` extends `{opt?: number; a: number; b: string}`, and\n\t// `TestUnion` extends `{a: number; b: string}`.\n\t| {opt?: number; a: number; b: string}\n\t| {a: number; b: string};\n\nexpectType<IsUnion<TestUnion>>(true);\n"
  },
  {
    "path": "test-d/is-unknown.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsUnknown} from '../index.d.ts';\n\ndeclare const _unknown: unknown;\ndeclare const something = 'something';\n\n// `IsUnknown` should only be true for `any`\nexpectType<IsUnknown<unknown>>(true);\nexpectType<IsUnknown<typeof _unknown>>(true);\nexpectType<IsUnknown<string>>(false);\nexpectType<IsUnknown<typeof something>>(false);\nexpectType<IsUnknown<any>>(false);\nexpectType<IsUnknown<never>>(false);\nexpectType<IsUnknown<null>>(false);\nexpectType<IsUnknown<undefined>>(false);\nexpectType<IsUnknown<void>>(false);\n\n// Missing generic parameter\n// @ts-expect-error\ntype A = IsUnknown;\n"
  },
  {
    "path": "test-d/is-uppercase.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsUppercase} from '../index.d.ts';\n\n// Literals\nexpectType<IsUppercase<'ABC'>>(true);\nexpectType<IsUppercase<''>>(true);\nexpectType<IsUppercase<'123'>>(true);\nexpectType<IsUppercase<'!@#'>>(true);\n\nexpectType<IsUppercase<'Abc'>>(false);\nexpectType<IsUppercase<'abc'>>(false);\n\n// Non-literals\nexpectType<IsUppercase<Uppercase<string>>>(true);\nexpectType<IsUppercase<Uppercase<`on${string}`>>>(true);\n\nexpectType<IsUppercase<Lowercase<string>>>(false);\nexpectType<IsUppercase<Uncapitalize<`ON${string}`>>>(false);\nexpectType<IsUppercase<`ON${Uncapitalize<string>}`>>(false);\nexpectType<IsUppercase<Uncapitalize<`${string}END`>>>(false);\n\nexpectType<IsUppercase<string>>({} as boolean);\nexpectType<IsUppercase<`ON${string}`>>({} as boolean);\nexpectType<IsUppercase<Capitalize<string>>>({} as boolean);\nexpectType<IsUppercase<Capitalize<`ON${string}`>>>({} as boolean);\nexpectType<IsUppercase<`ON${Capitalize<string>}`>>({} as boolean);\nexpectType<IsUppercase<`${number}`>>({} as boolean);\n\nexpectType<IsUppercase<`sTART${string}`>>(false);\nexpectType<IsUppercase<`${string}eND`>>(false);\nexpectType<IsUppercase<`${string}mID${string}`>>(false);\n\n// Complex non-literals\nexpectType<IsUppercase<`${Uppercase<string>}${Uppercase<string>}`>>(true);\n\nexpectType<IsUppercase<`${Lowercase<string>}${Uppercase<string>}`>>(false);\nexpectType<IsUppercase<`${Uppercase<string>}${Lowercase<string>}`>>(false);\nexpectType<IsUppercase<`${Uppercase<string>}${Lowercase<string>}${Uppercase<string>}`>>(false);\nexpectType<IsUppercase<`${Uncapitalize<string>}${Uppercase<string>}`>>(false);\nexpectType<IsUppercase<`${Uppercase<string>}${Uncapitalize<string>}`>>(false);\nexpectType<IsUppercase<`${string}${Uncapitalize<string>}`>>(false);\nexpectType<IsUppercase<`${number}${Uncapitalize<string>}`>>(false);\n\nexpectType<IsUppercase<`${string}${Uppercase<string>}`>>({} as boolean);\nexpectType<IsUppercase<`${string}${string}`>>({} as boolean);\nexpectType<IsUppercase<`${Uppercase<string>}${Uppercase<string>}${string}`>>({} as boolean);\nexpectType<IsUppercase<`${string}${Capitalize<string>}`>>({} as boolean);\nexpectType<IsUppercase<`${number}/${number}`>>({} as boolean);\nexpectType<IsUppercase<`${string}${number}`>>({} as boolean);\n\n// Unions\nexpectType<IsUppercase<'ABC' | 'XYZ'>>(true); // Both `true`\nexpectType<IsUppercase<'ABc' | 'XyZ'>>(false); // Both `false`\nexpectType<IsUppercase<'ABC' | 'aBC'>>({} as boolean); // One `true`, one `false`\nexpectType<IsUppercase<'ABC' | `${Capitalize<string>}END`>>({} as boolean); // One `true`, one `boolean`\nexpectType<IsUppercase<'XyZ' | `ABC${string}`>>({} as boolean); // One `false`, one `boolean`\n"
  },
  {
    "path": "test-d/is-writable-key-of.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsWritableKeyOf} from '../source/is-writable-key-of.d.ts';\n\ndeclare const never: never;\ndeclare const boolean: boolean;\ndeclare const symbol: unique symbol;\n\n// Simple object\ntype A = {\n\ta: string;\n\treadonly b: number;\n\tc?: boolean;\n};\n\nexpectType<IsWritableKeyOf<A, 'a'>>(true);\nexpectType<IsWritableKeyOf<A, 'b'>>(false);\nexpectType<IsWritableKeyOf<A, 'c'>>(true);\n\n// @ts-expect-error `d` is not in `keyof T`\nexpectType<IsWritableKeyOf<A, 'd'>>(false);\n\n// Index signature\ntype B = {\n\t[k: string]: number;\n};\n\nexpectType<IsWritableKeyOf<B, 'anything'>>(true);\n\n// Fully readonly index\ntype C = {\n\treadonly [k: string]: number;\n};\n\nexpectType<IsWritableKeyOf<C, string>>(false);\nexpectType<IsWritableKeyOf<C, 'anything'>>(true);\n\n// Optional + readonly\ntype D = {\n\treadonly a?: string;\n\tb: number;\n};\n\nexpectType<IsWritableKeyOf<D, 'a'>>(false);\nexpectType<IsWritableKeyOf<D, 'b'>>(true);\n\n// Union\ntype E1 = {a: number};\ntype E2 = {readonly a: number};\ntype E = E1 | E2;\n\nexpectType<IsWritableKeyOf<E, 'a'>>(boolean);\n\n// Intersection\ntype F1 = {readonly a: string};\ntype F2 = {a: string};\ntype F = F1 & F2;\n\nexpectType<IsWritableKeyOf<F, 'a'>>(true);\n\n// Class instance\nclass G {\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\treadonly x = 1;\n\ty = '';\n}\n\nexpectType<IsWritableKeyOf<G, 'x'>>(false);\nexpectType<IsWritableKeyOf<G, 'y'>>(true);\n\ntype H = {\n\t[symbol]: number;\n\treadonly x: string;\n};\n\nexpectType<IsWritableKeyOf<H, typeof symbol>>(true);\nexpectType<IsWritableKeyOf<H, 'x'>>(false);\n\n// Full readonly object\ntype I = Readonly<{\n\ta: number;\n\tb: string;\n}>;\n\nexpectType<IsWritableKeyOf<I, 'a'>>(false);\nexpectType<IsWritableKeyOf<I, 'b'>>(false);\n\n// Object with method\ntype J = {\n\treadonly id: string;\n\trun(): void;\n};\n\nexpectType<IsWritableKeyOf<J, 'run'>>(true);\nexpectType<IsWritableKeyOf<J, 'id'>>(false);\n\n// Record\ntype K = Record<'a' | 'b', string>;\n\nexpectType<IsWritableKeyOf<K, 'a'>>(true);\nexpectType<IsWritableKeyOf<K, 'b'>>(true);\n\n// Union of keys\nexpectType<IsWritableKeyOf<A, 'b' | 'c'>>(boolean);\nexpectType<IsWritableKeyOf<A, 'a' | 'b'>>(boolean);\n// @ts-expect-error\nexpectType<IsWritableKeyOf<A, 'a' | 'd'>>(boolean);\nexpectType<IsWritableKeyOf<A, 'a' | 'c'>>(true);\n\ntype FullKeyUnion = keyof A; // 'a' | 'b' | 'c'\nexpectType<IsWritableKeyOf<A, FullKeyUnion>>(boolean);\n// @ts-expect-error\nexpectType<IsWritableKeyOf<A, 'b' | 'x'>>(false); // 'x' is not in A, so filtered as false\n\n// `never` / `any\ntype L = {readonly a: string};\nexpectType<IsWritableKeyOf<K, any>>(never);\nexpectType<IsWritableKeyOf<any, any>>(never);\nexpectType<IsWritableKeyOf<any, 'a'>>(never);\nexpectType<IsWritableKeyOf<K, never>>(never);\nexpectType<IsWritableKeyOf<any, never>>(never);\nexpectType<IsWritableKeyOf<never, 'a'>>(never);\n"
  },
  {
    "path": "test-d/iterable-element.ts",
    "content": "import {expectAssignable, expectType} from 'tsd';\nimport type {IterableElement} from '../index.d.ts';\n\ndeclare const iterableElement: IterableElement<ReturnType<typeof secretGenerator>>;\nexpectType<1 | 'two'>(iterableElement);\n\ndeclare const iterableElementAsync: IterableElement<ReturnType<typeof secretGeneratorAsync>>;\nexpectType<true | Date>(iterableElementAsync);\n\nfunction * secretGenerator() {\n\tyield 1;\n\tyield 'two';\n}\n\nasync function * secretGeneratorAsync() {\n\tyield true;\n\tyield new Date();\n}\n\nconst fruits = new Set(['🍎', '🍌', '🍉'] as const);\n\ntype Fruit = IterableElement<typeof fruits>;\n\nexpectAssignable<Fruit>('🍎');\nexpectAssignable<Fruit>('🍌');\nexpectAssignable<Fruit>('🍉');\n\ntype VegetableSet = Set<'🥦' | '🥕' | '🌶'>;\ntype Vegetable = IterableElement<VegetableSet>;\n\nexpectAssignable<Vegetable>('🥦');\nexpectAssignable<Vegetable>('🥕');\nexpectAssignable<Vegetable>('🌶');\n\ntype UserRolesSet = ReadonlySet<'regular' | 'contributor' | 'maintainer'>;\ntype UserRole = IterableElement<UserRolesSet>;\n\nexpectAssignable<UserRole>('regular');\nexpectAssignable<UserRole>('contributor');\nexpectAssignable<UserRole>('maintainer');\n"
  },
  {
    "path": "test-d/join.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {Join} from '../index.d.ts';\n\n// General use.\nconst generalTestVariantMixed: Join<['foo', 0, 'baz'], '.'> = 'foo.0.baz';\nconst generalTestVariantOnlyStrings: Join<['foo', 'bar', 'baz'], '.'> = 'foo.bar.baz';\nconst generalTestVariantOnlyNumbers: Join<[1, 2, 3], '.'> = '1.2.3';\nconst generalTestVariantOnlyBigints: Join<[1n, 2n, 3n], '.'> = '1.2.3';\nconst generalTestVariantOnlyBooleans: Join<[true, false, true], '.'> = 'true.false.true';\nconst generalTestVariantOnlyNullish: Join<[undefined, null, undefined], '.'> = '..';\nconst generalTestVariantNullish: Join<['foo', undefined, 'baz', null, 'xyz'], '.'> = 'foo..baz..xyz';\nexpectType<'foo.0.baz'>(generalTestVariantMixed);\nexpectType<'foo.bar.baz'>(generalTestVariantOnlyStrings);\nexpectType<'1.2.3'>(generalTestVariantOnlyNumbers);\nexpectType<'1.2.3'>(generalTestVariantOnlyBigints);\nexpectType<'true.false.true'>(generalTestVariantOnlyBooleans);\nexpectType<'..'>(generalTestVariantOnlyNullish);\nexpectType<'foo..baz..xyz'>(generalTestVariantNullish);\n\nexpectNotAssignable<'foo'>(generalTestVariantOnlyStrings);\nexpectNotAssignable<'foo.bar'>(generalTestVariantOnlyStrings);\nexpectNotAssignable<'foo.bar.ham'>(generalTestVariantOnlyStrings);\n\n// Empty string delimiter.\nconst emptyDelimiter: Join<['foo', 'bar', 'baz'], ''> = 'foobarbaz';\nexpectType<'foobarbaz'>(emptyDelimiter);\nexpectNotAssignable<'foo.bar.baz'>(emptyDelimiter);\n\n// Empty input.\nconst emptyInput: Join<[], '.'> = '';\nexpectType<''>(emptyInput);\nexpectNotAssignable<'foo'>(emptyInput);\n\n// Single input with string[].\nconst singleStringArray = ['test'];\nconst singleInput: Join<typeof singleStringArray, '.'> = 'test';\nexpectType<string>(singleInput);\nexpectNotAssignable<'test'>(singleInput);\n\n// Single input with const tuple.\nconst singleTuple = ['test'] as const;\nconst singleTupleJoined: Join<typeof singleTuple, '.'> = 'test';\nexpectType<'test'>(singleTupleJoined);\nexpectNotAssignable<'test.'>(singleTupleJoined);\n\n// Typeof of const tuple.\nconst tuple = ['foo', 'bar', 'baz'] as const;\nconst joinedTuple: Join<typeof tuple, ','> = 'foo,bar,baz';\nexpectType<'foo,bar,baz'>(joinedTuple);\n\n// Typeof of const empty tuple.\nconst emptyTuple = [] as const;\nconst joinedEmptyTuple: Join<typeof emptyTuple, ','> = '';\nexpectType<''>(joinedEmptyTuple);\n\n// Typeof of string[].\nconst stringArray = ['foo', 'bar', 'baz'];\nconst joinedStringArray: Join<typeof stringArray, ','> = '';\nexpectType<string>(joinedStringArray);\nexpectNotAssignable<'foo,bar,baz'>(joinedStringArray);\n\n// Partial tuple shapes (rest param last).\nconst prefixTuple: ['prefix', ...string[]] = ['prefix', 'item1', 'item2'];\nconst joinedPrefixTuple: Join<typeof prefixTuple, '.'> = 'prefix.item1.item2';\nexpectType<`prefix.${string}`>(joinedPrefixTuple);\n\n// Partial tuple shapes (rest param first).\nconst suffixTuple: [...string[], 'suffix'] = ['item1', 'item2', 'suffix'];\nconst joinedSuffixTuple: Join<typeof suffixTuple, '.'> = 'item1.item2.suffix';\nexpectType<`${string}.suffix`>(joinedSuffixTuple);\n\n// Tuple with optional elements.\nconst optionalTuple: ['hello' | undefined, 'world' | undefined] = ['hello', undefined];\nconst joinedOptionalTuple: Join<typeof optionalTuple, '.'> = 'hello.';\nexpectType<'hello.'>(joinedOptionalTuple);\n"
  },
  {
    "path": "test-d/jsonifiable.ts",
    "content": "import {expectAssignable, expectNotAssignable} from 'tsd';\nimport type {Jsonifiable} from '../index.d.ts';\n\nexpectAssignable<Jsonifiable>(1);\nexpectAssignable<Jsonifiable>('');\nexpectAssignable<Jsonifiable>(null);\nexpectAssignable<Jsonifiable>(new Date());\nexpectAssignable<Jsonifiable>({a: new Date()});\nexpectAssignable<Jsonifiable>([new Date()]);\nexpectAssignable<Jsonifiable>({a: undefined});\nexpectAssignable<Jsonifiable>([1, 2, 3] as const);\nexpectAssignable<Jsonifiable>({a: new Date()} as const);\nexpectAssignable<Jsonifiable>({a: {deeply: {nested: {toJsonObject: new Date()}}}});\nexpectAssignable<Jsonifiable>({toJSON: () => new Date()});\nexpectAssignable<Jsonifiable>({\n\ttoJSON() {\n\t\treturn {\n\t\t\tfoo: {\n\t\t\t\ttoJSON() {\n\t\t\t\t\treturn {bar: 'bar'};\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t},\n});\n\nexpectNotAssignable<Jsonifiable>(undefined);\nexpectNotAssignable<Jsonifiable>(new Map());\nexpectNotAssignable<Jsonifiable>({a: new Map()});\nexpectNotAssignable<Jsonifiable>([new Map()]);\n"
  },
  {
    "path": "test-d/jsonify.ts",
    "content": "/* eslint-disable @typescript-eslint/consistent-type-definitions */\n// TODO: Convert the `interface`'s to `type`s.\nimport {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {EmptyObject, Jsonify, JsonObject, JsonValue, NegativeInfinity, PositiveInfinity} from '../index.d.ts';\n\ninterface A {\n\ta: number;\n}\n\nclass B {\n\ta!: number;\n}\n\ninterface V {\n\ta?: number;\n}\n\ninterface X {\n\ta: Date;\n}\n\ninterface Y {\n\ta?: Date;\n}\n\ninterface Z {\n\ta: number | undefined;\n}\n\ninterface W {\n\ta?: () => any;\n}\n\ndeclare const a: Jsonify<A>;\ndeclare const b: Jsonify<B>;\n\ndeclare const v: V; // Not assignable to JsonValue because it is defined as interface\n\ndeclare const x: X; // Not assignable to JsonValue because it contains Date value\ndeclare const y: Y; // Not assignable to JsonValue because it contains Date value\n\ndeclare const z: Z; // Not assignable to JsonValue because undefined is not valid Json value\ndeclare const w: W; // Not assignable to JsonValue because a function is not valid Json value\n\nexpectAssignable<JsonValue>(null);\nexpectAssignable<JsonValue>(false);\nexpectAssignable<JsonValue>(0);\nexpectAssignable<JsonValue>('');\nexpectAssignable<JsonValue>([]);\nexpectAssignable<JsonValue>([] as const);\nexpectAssignable<JsonValue>({});\nexpectAssignable<JsonValue>([0]);\nexpectAssignable<JsonValue>({a: 0});\nexpectAssignable<JsonValue>(a);\nexpectAssignable<JsonValue>(b);\nexpectAssignable<JsonValue>({a: {b: true, c: {}}, d: [{}, 2, 'hi']});\nexpectAssignable<JsonValue>([{}, {a: 'hi'}, null, 3]);\n\nexpectNotAssignable<JsonValue>(new Date());\nexpectNotAssignable<JsonValue>([new Date()]);\nexpectNotAssignable<JsonValue>({a: new Date()});\nexpectNotAssignable<JsonValue>(v);\nexpectNotAssignable<JsonValue>(x);\nexpectNotAssignable<JsonValue>(y);\nexpectNotAssignable<JsonValue>(z);\nexpectNotAssignable<JsonValue>(w);\nexpectNotAssignable<JsonValue>(undefined);\nexpectNotAssignable<JsonValue>(5 as number | undefined);\n\n// TODO: Convert this to a `type`.\ninterface Geometry {\n\ttype: 'Point' | 'Polygon';\n\tcoordinates: [number, number];\n}\n\nconst point: Geometry = {\n\ttype: 'Point',\n\tcoordinates: [1, 1],\n};\n\nexpectNotAssignable<JsonValue>(point);\nexpectAssignable<Jsonify<Geometry>>(point);\n\n// The following const values are examples of values `v` that are not JSON, but are *jsonable* using\n// `v.toJSON()` or `JSON.parse(JSON.stringify(v))`\ndeclare const dateToJSON: Jsonify<Date>;\nexpectAssignable<string>(dateToJSON);\nexpectAssignable<JsonValue>(dateToJSON);\n\n// The following commented `= JSON.parse(JSON.stringify(x))` is an example of how `parsedStringifiedX` could be created.\n// * Note that this would be an unsafe assignment because `JSON.parse()` returns type `any`.\n//   But by inspection `JSON.stringify(x)` will use `x.a.toJSON()`. So the `JSON.parse()` result can be\n//   assigned to `Jsonify<X>` if the `@typescript-eslint/no-unsafe-assignment` ESLint rule is ignored\n//   or an `as Jsonify<X>` is added.\n// * This test is not about how `parsedStringifiedX` is created, but about its type, so the `const` value is declared.\ndeclare const parsedStringifiedX: Jsonify<X>; // = JSON.parse(JSON.stringify(x));\nexpectAssignable<JsonValue>(parsedStringifiedX);\nexpectAssignable<string>(parsedStringifiedX.a);\n\nclass NonJsonWithToJSON {\n\tpublic fixture = new Map<string, number>([['a', 1], ['b', 2]]);\n\n\tpublic toJSON(): {fixture: Array<[string, number]>} {\n\t\treturn {\n\t\t\tfixture: [...this.fixture.entries()],\n\t\t};\n\t}\n}\n\nconst nonJsonWithToJSON = new NonJsonWithToJSON();\nexpectNotAssignable<JsonValue>(nonJsonWithToJSON);\nexpectAssignable<JsonValue>(nonJsonWithToJSON.toJSON());\nexpectAssignable<Jsonify<NonJsonWithToJSON>>(nonJsonWithToJSON.toJSON());\n\nclass NonJsonExtendPrimitiveWithToJSON extends Number {\n\tpublic fixture = BigInt('42');\n\n\tpublic toJSON(): {fixture: string} {\n\t\treturn {\n\t\t\tfixture: '42n',\n\t\t};\n\t}\n}\n\nconst nonJsonExtendPrimitiveWithToJSON = new NonJsonExtendPrimitiveWithToJSON();\nexpectNotAssignable<JsonValue>(nonJsonExtendPrimitiveWithToJSON);\nexpectAssignable<JsonValue>(nonJsonExtendPrimitiveWithToJSON.toJSON());\nexpectAssignable<Jsonify<NonJsonExtendPrimitiveWithToJSON>>(nonJsonExtendPrimitiveWithToJSON.toJSON());\n\nclass NonJsonWithToJSONWrapper {\n\tpublic inner: NonJsonWithToJSON = nonJsonWithToJSON;\n\tpublic override = 42;\n\n\tpublic toJSON() {\n\t\tconst stringOverride = 'override';\n\n\t\treturn {\n\t\t\toverride: stringOverride,\n\t\t\tinner: this.inner,\n\t\t\tinnerDeep: {inner: this.inner},\n\t\t};\n\t}\n}\n\nexpectNotAssignable<JsonValue>(new NonJsonWithToJSONWrapper());\n\ntype InnerFixture = {fixture: Array<[string, number]>};\n\nexpectType<{\n\toverride: string;\n\tinner: InnerFixture;\n\tinnerDeep: {inner: InnerFixture};\n}>({} as Jsonify<NonJsonWithToJSONWrapper>);\n\nclass NonJsonWithInvalidToJSON {\n\tpublic fixture = new Map<string, number>([['a', 1], ['b', 2]]);\n\n\t// This is intentionally invalid `.toJSON()`.\n\t// It is invalid because the result is not assignable to `JsonValue`.\n\tpublic toJSON(): {fixture: Map<string, number>} {\n\t\treturn {\n\t\t\tfixture: this.fixture,\n\t\t};\n\t}\n}\n\nconst nonJsonWithInvalidToJSON = new NonJsonWithInvalidToJSON();\nexpectNotAssignable<JsonValue>(nonJsonWithInvalidToJSON);\nexpectNotAssignable<JsonValue>(nonJsonWithInvalidToJSON.toJSON());\n\n// Not jsonable types; these types behave differently when used as plain values, as members of arrays and as values of objects\ndeclare const undefined: undefined;\nexpectNotAssignable<JsonValue>(undefined);\n\ndeclare const function_: (_: any) => void;\nexpectNotAssignable<JsonValue>(function_);\n\ndeclare const symbol: symbol;\nexpectNotAssignable<JsonValue>(symbol);\n\n// Plain values fail JSON.stringify()\ndeclare const plainUndefined: Jsonify<typeof undefined>;\nexpectType<never>(plainUndefined);\n\ndeclare const plainFunction: Jsonify<typeof function_>;\nexpectType<never>(plainFunction);\n\ndeclare const plainSymbol: Jsonify<typeof symbol>;\nexpectType<never>(plainSymbol);\n\n// Array members become null\ndeclare const arrayMemberUndefined: Jsonify<Array<typeof undefined>>;\nexpectType<null[]>(arrayMemberUndefined);\n\ndeclare const arrayMemberUnionWithUndefined: Jsonify<Array<typeof undefined | typeof number>>;\nexpectType<Array<null | number>>(arrayMemberUnionWithUndefined);\n\ndeclare const arrayMemberUnionWithUndefinedDeep: Jsonify<Array<Array<typeof undefined | typeof number>> | {foo: Array<typeof undefined | typeof number>}>;\nexpectType<Array<Array<null | number>> | {foo: Array<null | number>}>(arrayMemberUnionWithUndefinedDeep);\n\ndeclare const arrayMemberFunction: Jsonify<Array<typeof function_>>;\nexpectType<null[]>(arrayMemberFunction);\n\ndeclare const arrayMemberSymbol: Jsonify<Array<typeof symbol>>;\nexpectType<null[]>(arrayMemberSymbol);\n\n// When used in object values, these keys are filtered\ndeclare const objectValueUndefined: Jsonify<{keep: string; undefined: typeof undefined}>;\nexpectType<{keep: string}>(objectValueUndefined);\n\ndeclare const objectValueFunction: Jsonify<{keep: string; fn: typeof function_}>;\nexpectType<{keep: string}>(objectValueFunction);\n\ndeclare const objectValueSymbol: Jsonify<{keep: string; symbol: typeof symbol}>;\nexpectType<{keep: string}>(objectValueSymbol);\n\n// Symbol keys are filtered\ndeclare const objectKeySymbol: Jsonify<{[key: typeof symbol]: number; keep: string}>;\nexpectType<{keep: string}>(objectKeySymbol);\n\n// Number, String and Boolean values are turned into primitive counterparts\ndeclare const number: Number;\nexpectNotAssignable<JsonValue>(number);\n\ndeclare const string: String;\nexpectNotAssignable<JsonValue>(string);\n\ndeclare const boolean: Boolean;\nexpectNotAssignable<JsonValue>(boolean);\n\ndeclare const numberJson: Jsonify<typeof number>;\nexpectType<number>(numberJson);\n\ndeclare const stringJson: Jsonify<typeof string>;\nexpectType<string>(stringJson);\n\ndeclare const booleanJson: Jsonify<typeof boolean>;\nexpectType<boolean>(booleanJson);\n\ndeclare const tupleJson: Jsonify<[string, Date]>;\nexpectType<[string, string]>(tupleJson);\n\ndeclare const tupleRestJson: Jsonify<[string, ...Date[]]>;\nexpectType<[string, ...string[]]>(tupleRestJson);\n\ndeclare const mixTupleJson: Jsonify<['1', (_: any) => void, 2]>;\nexpectType<['1', null, 2]>(mixTupleJson);\n\ndeclare const tupleStringJson: Jsonify<string[] & ['some value']>;\nexpectType<['some value']>(tupleStringJson);\n\n// BigInt fails JSON.stringify\ndeclare const bigInt: Jsonify<bigint>;\nexpectType<never>(bigInt);\n\ndeclare const int8Array: Int8Array;\ndeclare const int8ArrayJson: Jsonify<typeof int8Array>;\nexpectType<Record<string, number>>(int8ArrayJson);\n\ndeclare const map: Map<string, number>;\ndeclare const mapJson: Jsonify<typeof map>;\nexpectType<EmptyObject>(mapJson);\nexpectAssignable<Jsonify<typeof map>>({});\n\n// Regression test for https://github.com/sindresorhus/type-fest/issues/466\nexpectNotAssignable<Jsonify<typeof map>>(42);\nexpectNotAssignable<Jsonify<typeof map>>({foo: 42});\n\ndeclare const set: Set<string>;\ndeclare const setJson: Jsonify<typeof set>;\nexpectType<EmptyObject>(setJson);\nexpectAssignable<Jsonify<typeof set>>({});\n\n// Regression test for https://github.com/sindresorhus/type-fest/issues/466\nexpectNotAssignable<Jsonify<typeof set>>(42);\nexpectNotAssignable<Jsonify<typeof set>>({foo: 42});\n\n// Positive and negative Infinity, NaN and null are turned into null\n// NOTE: NaN is not detectable in TypeScript, so it is not tested; see https://github.com/sindresorhus/type-fest/issues/406\ndeclare const positiveInfinity: PositiveInfinity;\ndeclare const positiveInfJson: Jsonify<typeof positiveInfinity>;\nexpectType<null>(positiveInfJson);\ndeclare const negativeInf: NegativeInfinity;\ndeclare const negativeInfJson: Jsonify<typeof negativeInf>;\nexpectType<null>(negativeInfJson);\n\n// Test that optional type members are not discarded wholesale.\ntype OptionalPrimitive = {\n\ta?: string;\n};\n\ntype OptionalTypeUnion = {\n\ta?: string | (() => any);\n};\n\ntype NonOptionalTypeUnion = {\n\ta: string | undefined;\n};\n\ndeclare const jsonifiedOptionalPrimitive: Jsonify<OptionalPrimitive>;\ndeclare const jsonifiedOptionalTypeUnion: Jsonify<OptionalTypeUnion>;\ndeclare const jsonifiedNonOptionalTypeUnion: Jsonify<NonOptionalTypeUnion>;\n\nexpectType<{a?: string}>(jsonifiedOptionalPrimitive);\nexpectType<{}>(jsonifiedOptionalTypeUnion);\nexpectType<{a?: string}>(jsonifiedNonOptionalTypeUnion);\n\n// Test for 'Jsonify support for optional object keys, unserializable object values' #424\n// See https://github.com/sindresorhus/type-fest/issues/424\ntype AppData = {\n\t// Should be kept\n\trequiredString: string;\n\trequiredUnion: number | boolean;\n\n\t// Should be kept and set to optional\n\toptionalString?: string;\n\toptionalUnion?: number | string;\n\toptionalStringUndefined: string | undefined;\n\toptionalUnionUndefined: number | string | undefined;\n\n\t// Should be omitted\n\trequiredFunction: () => any;\n\toptionalFunction?: () => any;\n\trequiredFunctionUnion: string | (() => any);\n\toptionalFunctionUnion?: string | (() => any);\n\toptionalFunctionUndefined: (() => any) | undefined;\n\toptionalFunctionUnionUndefined: string | (() => any) | undefined;\n};\n\ntype ExpectedAppDataJson = {\n\trequiredString: string;\n\trequiredUnion: number | boolean;\n\n\toptionalString?: string;\n\toptionalUnion?: string | number;\n\toptionalStringUndefined?: string;\n\toptionalUnionUndefined?: string | number;\n};\n\ndeclare const response: Jsonify<AppData>;\n\nexpectType<ExpectedAppDataJson>(response);\n\nexpectType<any>({} as Jsonify<any>);\n\ndeclare const objectWithAnyProperty: Jsonify<{\n\ta: any;\n}>;\nexpectType<{a: any}>(objectWithAnyProperty);\n\ndeclare const objectWithAnyProperties: Jsonify<Record<string, any>>;\nexpectType<Record<string, any>>(objectWithAnyProperties);\n\n// Test for `Jsonify` support for nested objects with _only_ a name property.\n// See https://github.com/sindresorhus/type-fest/issues/657\ndeclare const nestedObjectWithNameProperty: {\n\tfirst: {\n\t\tname: string;\n\t};\n};\ndeclare const jsonifiedNestedObjectWithNameProperty: Jsonify<\n\ttypeof nestedObjectWithNameProperty\n>;\n\nexpectType<typeof nestedObjectWithNameProperty>(\n\tjsonifiedNestedObjectWithNameProperty,\n);\n\n// Regression test for https://github.com/sindresorhus/type-fest/issues/629\ndeclare const readonlyTuple: Jsonify<readonly [1, 2, 3]>;\nexpectType<[1, 2, 3]>(readonlyTuple);\n\n// `unknown` values\ndeclare const unknownValue: Jsonify<unknown>;\ndeclare const unknownArray: Jsonify<unknown[]>;\ndeclare const unknownTuple: Jsonify<[unknown, unknown]>;\ndeclare const objectWithUnknownValue: Jsonify<{key: unknown}>;\nexpectType<JsonValue>(unknownValue);\nexpectAssignable<Jsonify<unknown>>('foo');\nexpectAssignable<Jsonify<unknown>>(['foo']);\nexpectNotAssignable<Jsonify<unknown>>(new Date());\nexpectType<JsonValue[]>(unknownArray);\nexpectAssignable<Jsonify<unknown[]>>(['foo']);\nexpectNotAssignable<Jsonify<unknown[]>>([new Date()]);\nexpectType<[JsonValue, JsonValue]>(unknownTuple);\nexpectAssignable<Jsonify<[unknown, unknown]>>(['foo', 'foo']);\nexpectNotAssignable<Jsonify<[unknown, unknown]>>([new Date(), new Date()]);\nexpectType<{key: JsonValue}>(objectWithUnknownValue);\nexpectAssignable<Jsonify<{key: unknown}>>({key: []});\nexpectNotAssignable<Jsonify<{key: unknown}>>({key: new Date()});\n\nexpectAssignable<JsonObject>({} as {a: string});\nexpectNotAssignable<JsonObject>({} as {a: string | undefined});\nexpectAssignable<JsonObject>({} as {a?: string});\nexpectNotAssignable<JsonObject>({} as {a?: string | undefined}); // Requires `exactOptionalPropertyTypes` to be enabled\n"
  },
  {
    "path": "test-d/kebab-case.ts",
    "content": "import {expectType} from 'tsd';\nimport type {KebabCase} from '../index.d.ts';\n\nconst kebabFromCamel: KebabCase<'fooBar'> = 'foo-bar';\nexpectType<'foo-bar'>(kebabFromCamel);\n\nconst kebabFromPascal: KebabCase<'FooBar'> = 'foo-bar';\nexpectType<'foo-bar'>(kebabFromPascal);\n\nconst kebabFromKebab: KebabCase<'foo-bar'> = 'foo-bar';\nexpectType<'foo-bar'>(kebabFromKebab);\n\nconst kebabFromSpace: KebabCase<'foo bar'> = 'foo-bar';\nexpectType<'foo-bar'>(kebabFromSpace);\n\nconst kebabFromSnake: KebabCase<'foo_bar'> = 'foo-bar';\nexpectType<'foo-bar'>(kebabFromSnake);\n\nconst noKebabFromMono: KebabCase<'foobar'> = 'foobar';\nexpectType<'foobar'>(noKebabFromMono);\n\nconst kebabFromCamelPascal: KebabCase<'FooBar'> = 'foo-bar';\nexpectType<'foo-bar'>(kebabFromCamelPascal);\n\nconst kebabFromComplexKebab: KebabCase<'foo-bar-abc-123'> = 'foo-bar-abc-123';\nexpectType<'foo-bar-abc-123'>(kebabFromComplexKebab);\n\nconst kebabFromMixed: KebabCase<'foo-bar_abc xyzBarFoo'>\n\t= 'foo-bar-abc-xyz-bar-foo';\nexpectType<'foo-bar-abc-xyz-bar-foo'>(kebabFromMixed);\n\nconst kebabFromVendorPrefixedCssProperty: KebabCase<'-webkit-animation'>\n\t= 'webkit-animation';\nexpectType<'webkit-animation'>(kebabFromVendorPrefixedCssProperty);\n\nconst kebabFromDoublePrefixedKebab: KebabCase<'--very-prefixed'>\n\t= 'very-prefixed';\nexpectType<'very-prefixed'>(kebabFromDoublePrefixedKebab);\n\nconst kebabFromRepeatedSeparators: KebabCase<'foo____bar'> = 'foo-bar';\nexpectType<'foo-bar'>(kebabFromRepeatedSeparators);\n\nconst kebabFromUppercase: KebabCase<'FOO'> = 'foo';\nexpectType<'foo'>(kebabFromUppercase);\n\nconst kebabFromLowercase: KebabCase<'foo'> = 'foo';\nexpectType<'foo'>(kebabFromLowercase);\n\nconst kebabFromScreamingSnakeCase: KebabCase<'FOO_BAR'> = 'foo-bar';\nexpectType<'foo-bar'>(kebabFromScreamingSnakeCase);\n\nconst kebabFromScreamingKebabCase: KebabCase<'FOO-BAR'> = 'foo-bar';\nexpectType<'foo-bar'>(kebabFromScreamingKebabCase);\n\nconst kebabFromMixed2: KebabCase<'parseHTML'> = 'parse-html';\nexpectType<'parse-html'>(kebabFromMixed2);\n\nconst kebabFromMixed3: KebabCase<'parseHTMLItem'> = 'parse-html-item';\nexpectType<'parse-html-item'>(kebabFromMixed3);\n\nconst kebabFromNumberInTheMiddleSplitOnNumbers: KebabCase<'foo2bar', {splitOnNumbers: true}> = 'foo-2-bar';\nexpectType<'foo-2-bar'>(kebabFromNumberInTheMiddleSplitOnNumbers);\n\nconst kebabFromNumberInTheMiddleSplitOnNumbersEdgeCase: KebabCase<'foO2Bar', {splitOnNumbers: true}> = 'fo-o-2-bar';\nexpectType<'fo-o-2-bar'>(kebabFromNumberInTheMiddleSplitOnNumbersEdgeCase);\n\nconst kebabFromNumberInTheMiddleSplitOnNumbersEdgeCase2: KebabCase<'foO2bar', {splitOnNumbers: true}> = 'fo-o-2-bar';\nexpectType<'fo-o-2-bar'>(kebabFromNumberInTheMiddleSplitOnNumbersEdgeCase2);\n\nconst kebabFromNumberInTheMiddleNoSplitOnNumbers: KebabCase<'foo2bar'> = 'foo2bar';\nexpectType<'foo2bar'>(kebabFromNumberInTheMiddleNoSplitOnNumbers);\n\nconst kebabFromNumberInTheMiddleNoSplitOnNumbersEdgeCase: KebabCase<'foo2Bar'> = 'foo2-bar';\nexpectType<'foo2-bar'>(kebabFromNumberInTheMiddleNoSplitOnNumbersEdgeCase);\n\nconst kebabFromNumberInTheMiddleNoSplitOnNumbersEdgeCase2: KebabCase<'foO2bar'> = 'fo-o2bar';\nexpectType<'fo-o2bar'>(kebabFromNumberInTheMiddleNoSplitOnNumbersEdgeCase2);\n\nconst kebabFromNumberInTheMiddleNoSplitOnNumbersEdgeCase3: KebabCase<'FOO22Bar'> = 'foo22-bar';\nexpectType<'foo22-bar'>(kebabFromNumberInTheMiddleNoSplitOnNumbersEdgeCase3);\n\ndeclare const withPunctuation: KebabCase<'onDialog:close'>;\nexpectType<'on-dialog:close'>(withPunctuation);\n\ndeclare const withPunctuation2: KebabCase<'foo-bar>>baz'>;\nexpectType<'foo-bar>>baz'>(withPunctuation2);\n\ndeclare const withPunctuation3: KebabCase<'card::after'>;\nexpectType<'card::after'>(withPunctuation3);\n\ndeclare const withPunctuation4: KebabCase<'div.card::after'>;\nexpectType<'div.card::after'>(withPunctuation4);\n\ndeclare const withPunctuationAndNumber: KebabCase<'foo-bar::01'>;\nexpectType<'foo-bar::01'>(withPunctuationAndNumber);\n\ndeclare const withPunctuationAndNumber2: KebabCase<'foo-bar::01', {splitOnNumbers: true}>;\nexpectType<'foo-bar::-01'>(withPunctuationAndNumber2);\n"
  },
  {
    "path": "test-d/kebab-cased-properties-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {KebabCasedPropertiesDeep} from '../index.d.ts';\n\ntype FooBar = {helloWorld: {p2p: Array<{addressLine1: string}>}};\n\ndeclare const foo: KebabCasedPropertiesDeep<FooBar>;\nexpectType<{'hello-world': {p2p: Array<{'address-line1': string}>}}>(foo);\n\ndeclare const bar: KebabCasedPropertiesDeep<FooBar, {splitOnNumbers: true}>;\nexpectType<{'hello-world': {'p-2-p': Array<{'address-line-1': string}>}}>(bar);\n\n// Verify example\ntype User = {\n\tuserId: number;\n\tuserName: string;\n\tdate: Date;\n\tregExp: RegExp;\n};\n\ntype UserWithFriends = {\n\tuserInfo: User;\n\tuserFriends: User[];\n};\n\nconst result: KebabCasedPropertiesDeep<UserWithFriends> = {\n\t'user-info': {\n\t\t'user-id': 1,\n\t\t'user-name': 'Tom',\n\t\tdate: new Date(),\n\t\t'reg-exp': /.*/,\n\t},\n\t'user-friends': [\n\t\t{\n\t\t\t'user-id': 2,\n\t\t\t'user-name': 'Jerry',\n\t\t\tdate: new Date(),\n\t\t\t'reg-exp': /.*/,\n\t\t},\n\t\t{\n\t\t\t'user-id': 3,\n\t\t\t'user-name': 'Spike',\n\t\t\tdate: new Date(),\n\t\t\t'reg-exp': /.*/,\n\t\t},\n\t],\n};\nexpectType<KebabCasedPropertiesDeep<UserWithFriends>>(result);\n\nexpectType<{'foo-bar': unknown}>({} as KebabCasedPropertiesDeep<{foo_bar: unknown}>);\nexpectType<{'foo-bar': {'bar-baz': unknown}; biz: unknown}>({} as KebabCasedPropertiesDeep<{foo_bar: {bar_baz: unknown}; biz: unknown}>);\n\nexpectType<{'foo-bar': any}>({} as KebabCasedPropertiesDeep<{foo_bar: any}>);\nexpectType<{'foo-bar': {'bar-baz': any}; biz: any}>({} as KebabCasedPropertiesDeep<{foo_bar: {bar_baz: any}; biz: any}>);\n"
  },
  {
    "path": "test-d/kebab-cased-properties.ts",
    "content": "import {expectType} from 'tsd';\nimport type {KebabCasedProperties} from '../index.d.ts';\n\ntype Foobar = {helloWorld1: {fooBar: string}};\n\ndeclare const foo: KebabCasedProperties<Foobar>;\nexpectType<{'hello-world1': {fooBar: string}}>(foo);\n\ndeclare const bar: KebabCasedProperties<Foobar, {splitOnNumbers: true}>;\nexpectType<{'hello-world-1': {fooBar: string}}>(bar);\n\n// Verify example\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\nconst result: KebabCasedProperties<User> = {\n\t'user-id': 1,\n\t'user-name': 'Tom',\n};\nexpectType<KebabCasedProperties<User>>(result);\n"
  },
  {
    "path": "test-d/key-as-string.ts",
    "content": "import {expectType} from 'tsd';\nimport type {KeyAsString} from '../source/key-as-string.d.ts';\n\ndeclare const foo: KeyAsString<{\n\t1: number;\n\tstringKey: string;\n}>;\n\nexpectType<'1' | 'stringKey'>(foo);\n\ndeclare const sym: unique symbol;\nexpectType<'1' | 'foo'>({} as KeyAsString<{[sym]: unknown; 1: number; foo: string}>); // Ignores symbol keys\n\n// Index signatures\nexpectType<string>({} as KeyAsString<{[x: string]: unknown}>);\nexpectType<`${number}`>({} as KeyAsString<{[x: number]: unknown}>);\nexpectType<`foo${string}` | `${number}`>({} as KeyAsString<{[x: `foo${string}`]: unknown; [y: number]: unknown}>);\nexpectType<string>({} as KeyAsString<{[x: string]: unknown; [y: symbol]: unknown}>);\nexpectType<never>({} as KeyAsString<{[x: symbol]: unknown}>);\n\n// Unions\nexpectType<'1'>({} as KeyAsString<{1: number; foo: string} | {1: number; bar: string}>); // Only grabs the common keys, just like `keyof`.\nexpectType<never>({} as KeyAsString<{foo: string} | {bar: string}>);\n\n// Boundary cases\nexpectType<string>({} as KeyAsString<any>);\nexpectType<string>({} as KeyAsString<never>);\n"
  },
  {
    "path": "test-d/keys-of-union.ts",
    "content": "import {expectType} from 'tsd';\nimport type {KeysOfUnion, UnknownRecord} from '../index.d.ts';\n\n// When passing types that are not unions, it behaves exactly as the `keyof` operator.\n\ntype Example1 = {\n\tstring: string;\n\tnumber: number;\n\tboolean: boolean;\n\tnull: null;\n\tarray: number[];\n};\n\ntype Expected1 = keyof Example1;\n\ndeclare const actual1: KeysOfUnion<Example1>;\n\nexpectType<Expected1>(actual1);\n\n// When passing a type that is a union, it returns a union of all keys of all union members.\n\ntype Example2 = {\n\tcommon: string;\n\ta: number;\n} | {\n\tcommon: string;\n\tb: string;\n} | {\n\tcommon: string;\n\tc: boolean;\n};\n\ntype Expected2 = 'common' | 'a' | 'b' | 'c';\n\ndeclare const actual2: KeysOfUnion<Example2>;\n\nexpectType<Expected2>(actual2);\n\n// With property modifiers\ndeclare const actual3: KeysOfUnion<{a?: string; readonly b: number} | {a: number; b: string}>;\nexpectType<'a' | 'b'>(actual3);\n\n// `KeysOfUnion<T>` should NOT be assignable to `keyof T`\ntype Assignability1<T, _K extends keyof T> = unknown;\n// @ts-expect-error\ntype Test1<T> = Assignability1<T, KeysOfUnion<T>>;\n\n// `keyof T` should be assignable to `KeysOfUnion<T>`\ntype Assignability2<T, _K extends KeysOfUnion<T>> = unknown;\ntype Test2<T> = Assignability2<T, keyof T>;\n\n// `KeysOfUnion<T>` should be assignable to `PropertyKey`\ntype Assignability3<_T, _K extends PropertyKey> = unknown;\ntype Test3<T> = Assignability3<T, KeysOfUnion<T>>;\n\n// `PropertyKey` should NOT be assignable to `KeysOfUnion<T>`\ntype Assignability4<T, _K extends KeysOfUnion<T>> = unknown;\n// @ts-expect-error\ntype Test4<T> = Assignability4<T, PropertyKey>;\n\n// `keyof T` should be assignable to `KeysOfUnion<T>` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability5<T extends Record<string, unknown>, _K extends KeysOfUnion<T>> = unknown;\ntype Test5<T extends Record<string, unknown>> = Assignability5<T, keyof T>;\n\n// `keyof T` should be assignable to `KeysOfUnion<T>` even when `T` is constrained to `object`\ntype Assignability6<T extends object, _K extends KeysOfUnion<T>> = unknown;\ntype Test6<T extends object> = Assignability6<T, keyof T>;\n\n// `keyof T` should be assignable to `KeysOfUnion<T>` even when `T` is constrained to `UnknownRecord`\ntype Assignability7<T extends UnknownRecord, _K extends KeysOfUnion<T>> = unknown;\ntype Test7<T extends UnknownRecord> = Assignability7<T, keyof T>;\n\n// `KeysOfUnion<T>` should NOT be assignable to `keyof T` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability8<T extends Record<string, unknown>, _K extends keyof T> = unknown;\n// @ts-expect-error\ntype Test8<T extends Record<string, unknown>> = Assignability8<T, KeysOfUnion<T>>;\n\n// `KeysOfUnion<T>` should NOT be assignable to `keyof T` even when `T` is constrained to `object`\ntype Assignability9<T extends object, _K extends keyof T> = unknown;\n// @ts-expect-error\ntype Test9<T extends object> = Assignability9<T, KeysOfUnion<T>>;\n\n// `KeysOfUnion<T>` should NOT be assignable to `keyof T` even when `T` is constrained to `UnknownRecord`\n// type Assignability10<T extends UnknownRecord, _K extends keyof T> = unknown;\n// The following line should error but it doesn't, this is an issue with the existing implementation of `KeysOfUnion`\n// type Test10<T extends UnknownRecord> = Assignability10<T, KeysOfUnion<T>>;\n"
  },
  {
    "path": "test-d/last-array-element.ts",
    "content": "import {expectType} from 'tsd';\nimport type {LastArrayElement} from '../index.d.ts';\n\ndeclare function lastOf<V extends readonly unknown[]>(array: V): LastArrayElement<V>;\nconst array: ['foo', 2, 'bar'] = ['foo', 2, 'bar'];\nconst mixedArray: ['bar', 'foo', 2] = ['bar', 'foo', 2];\n\nexpectType<'bar'>(lastOf(array));\nexpectType<2>(lastOf(mixedArray));\nexpectType<string>(lastOf(['a', 'b', 'c']));\nexpectType<string | number>(lastOf(['a', 'b', 1]));\nexpectType<1>(lastOf(['a', 'b', 1] as const));\n\ndeclare const leadingSpreadTuple: [...string[], object, number];\nexpectType<number>(lastOf(leadingSpreadTuple));\n\ndeclare const trailingSpreadTuple1: [string, ...number[]];\nexpectType<number | string>(lastOf(trailingSpreadTuple1));\n\ndeclare const trailingSpreadTuple2: [string, boolean, ...number[]];\nexpectType<number | boolean>(lastOf(trailingSpreadTuple2));\n\n// eslint-disable-next-line @typescript-eslint/array-type\ndeclare const trailingSpreadTuple3: ['foo', true, ...(1 | '2')[]];\nexpectType<true | 1 | '2'>(lastOf(trailingSpreadTuple3));\n"
  },
  {
    "path": "test-d/less-than-or-equal.ts",
    "content": "import {expectType} from 'tsd';\nimport type {LessThanOrEqual} from '../index.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../source/numeric.d.ts';\n\ndeclare const never: never;\n\nexpectType<LessThanOrEqual<1, 2>>(true);\nexpectType<LessThanOrEqual<2, 1>>(false);\nexpectType<LessThanOrEqual<10, 2>>(false);\nexpectType<LessThanOrEqual<10, -2>>(false);\nexpectType<LessThanOrEqual<2, 2>>(true);\nexpectType<LessThanOrEqual<-2, -2>>(true);\nexpectType<LessThanOrEqual<-2, -3>>(false);\nexpectType<LessThanOrEqual<PositiveInfinity, -999>>(false);\nexpectType<LessThanOrEqual<PositiveInfinity, 999>>(false);\nexpectType<LessThanOrEqual<999, PositiveInfinity>>(true);\nexpectType<LessThanOrEqual<999, NegativeInfinity>>(false);\nexpectType<LessThanOrEqual<-999, NegativeInfinity>>(false);\nexpectType<LessThanOrEqual<PositiveInfinity, PositiveInfinity>>(true);\nexpectType<LessThanOrEqual<NegativeInfinity, NegativeInfinity>>(true);\nexpectType<LessThanOrEqual<PositiveInfinity, NegativeInfinity>>(false);\n\n// Non-literal `number`\nexpectType<LessThanOrEqual<number, number>>({} as boolean);\nexpectType<LessThanOrEqual<number, 1>>({} as boolean);\nexpectType<LessThanOrEqual<1, number>>({} as boolean);\n"
  },
  {
    "path": "test-d/less-than.ts",
    "content": "import {expectType} from 'tsd';\nimport type {LessThan} from '../index.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../source/numeric.d.ts';\n\ndeclare const never: never;\n\nexpectType<LessThan<1, 2>>(true);\nexpectType<LessThan<2, 1>>(false);\nexpectType<LessThan<10, 2>>(false);\nexpectType<LessThan<10, -2>>(false);\nexpectType<LessThan<2, 2>>(false);\nexpectType<LessThan<-2, -2>>(false);\nexpectType<LessThan<-2, -3>>(false);\n\n// === unions ===\nexpectType<LessThan<10, 50 | 100>>(true);\nexpectType<LessThan<50 | 25 | 0 | -16, 100>>(true);\nexpectType<LessThan<1 | 2, 3 | 4>>(true);\n\nexpectType<LessThan<100 | 200, 50>>(false);\nexpectType<LessThan<25, -100 | -15 | 2 | 21>>(false);\nexpectType<LessThan<10 | 15, -5 | 10>>(false);\n\nexpectType<LessThan<-10, -90 | 90>>({} as boolean);\nexpectType<LessThan<-16 | 16, 0>>({} as boolean);\nexpectType<LessThan<-4 | 45, 20 | 30>>({} as boolean);\nexpectType<LessThan<1 | -1 | 3, 0 | 2>>({} as boolean);\nexpectType<LessThan<1, 1 | 2>>({} as boolean);\n\nexpectType<LessThan<PositiveInfinity, -999>>(false);\nexpectType<LessThan<PositiveInfinity, 999>>(false);\nexpectType<LessThan<999, PositiveInfinity>>(true);\nexpectType<LessThan<999, NegativeInfinity>>(false);\nexpectType<LessThan<-999, NegativeInfinity>>(false);\nexpectType<LessThan<PositiveInfinity, PositiveInfinity>>(false);\nexpectType<LessThan<NegativeInfinity, NegativeInfinity>>(false);\nexpectType<LessThan<PositiveInfinity, NegativeInfinity>>(false);\n\n// Non-literal `number`\nexpectType<LessThan<number, number>>({} as boolean);\nexpectType<LessThan<number, 1>>({} as boolean);\nexpectType<LessThan<1, number>>({} as boolean);\n"
  },
  {
    "path": "test-d/literal-to-primitive-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {IsEqual, LiteralToPrimitiveDeep} from '../index.d.ts';\n\ntype LiteralObject = {\n\ta: string;\n\tb: number;\n\tc: boolean;\n\td: {\n\t\te: bigint;\n\t\tf: symbol;\n\t\tg: {\n\t\t\th: string[];\n\t\t\ti: {\n\t\t\t\tj: boolean;\n\t\t\t\tk: {\n\t\t\t\t\tl: 1;\n\t\t\t\t\tm: 'hello';\n\t\t\t\t\to: [1, 2, 3];\n\t\t\t\t\tp: ['a', 'b', 'c'];\n\t\t\t\t\tq: [1, 'a', true];\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n};\n\ntype PrimitiveObject = {\n\ta: string;\n\tb: number;\n\tc: boolean;\n\td: {\n\t\te: bigint;\n\t\tf: symbol;\n\t\tg: {\n\t\t\th: string[];\n\t\t\ti: {\n\t\t\t\tj: boolean;\n\t\t\t\tk: {\n\t\t\t\t\tl: number;\n\t\t\t\t\tm: string;\n\t\t\t\t\to: number[];\n\t\t\t\t\tp: string[];\n\t\t\t\t\tq: Array<number | string | boolean>;\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n};\n\nconst typeEqual: IsEqual<\n\tLiteralToPrimitiveDeep<LiteralObject>,\n\tPrimitiveObject\n> = true;\nexpectType<true>(typeEqual);\n"
  },
  {
    "path": "test-d/literal-to-primitive.ts",
    "content": "import {expectType} from 'tsd';\nimport type {LiteralToPrimitive} from '../index.d.ts';\n\n// Simple usage\ndeclare const numberPrimitive: LiteralToPrimitive<123>;\nexpectType<number>(numberPrimitive);\n\nconst symbol = Symbol('foo');\n\n// Union\ndeclare const kitchenSink: LiteralToPrimitive<123 | 123n | 'hello' | true | undefined | typeof symbol | null | {key: string}>;\nexpectType<number | bigint | string | boolean | undefined | symbol | null>(kitchenSink);\n"
  },
  {
    "path": "test-d/merge-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {MergeDeep, MergeDeepOptions} from '../index.d.ts';\n\n// Test helper.\ndeclare function mergeDeep<\n\tDestination,\n\tSource,\n\tOptions extends MergeDeepOptions = {},\n>(destination: Destination, source: Source, options?: Options): MergeDeep<Destination, Source, Options>;\n\n// Test valid signatures for objects.\nexpectType<{}>(mergeDeep({}, {}));\nexpectType<{}>(mergeDeep({} as const, {}));\nexpectType<{}>(mergeDeep({}, {} as const));\nexpectType<{}>(mergeDeep({} as const, {} as const));\n\n// Test valid signatures for arrays/tuples.\nexpectType<never[]>(mergeDeep([], []));\nexpectType<never[]>(mergeDeep([] as const, []));\nexpectType<never[]>(mergeDeep([], [] as const));\nexpectType<never[]>(mergeDeep([] as const, [] as const));\n\n// Test invalid signatures.\nexpectType<never>(mergeDeep({}, []));\nexpectType<never>(mergeDeep([], {}));\nexpectType<never>(mergeDeep(null, {}));\nexpectType<never>(mergeDeep([], 'life'));\nexpectType<never>(mergeDeep([], new Set()));\nexpectType<never>(mergeDeep(new Set(), new Set()));\nexpectType<never>(mergeDeep(new Map(), new Map()));\nexpectType<never>(mergeDeep(undefined, undefined));\nexpectType<never>(mergeDeep({}, undefined));\nexpectType<never>(mergeDeep(undefined, {}));\n\n// Should merge simple objects\nexpectType<{a: string; b: number}>(mergeDeep({a: 'life'}, {b: 42}));\nexpectType<{readonly a: 'life'; b: number}>(mergeDeep({a: 'life'} as const, {b: 42}));\nexpectType<{a: string; readonly b: 42}>(mergeDeep({a: 'life'}, {b: 42} as const));\nexpectType<{readonly a: 'life'; readonly b: 42}>(mergeDeep({a: 'life'} as const, {b: 42} as const));\n\n// Should spread simple arrays/tuples (default mode)\nexpectType<Array<string | number>>(mergeDeep(['life'], [42]));\nexpectType<Array<'life' | number>>(mergeDeep(['life'] as const, [42]));\nexpectType<Array<string | 42>>(mergeDeep(['life'], [42] as const));\nexpectType<Array<'life' | 42>>(mergeDeep(['life'] as const, [42] as const));\n\nexpectType<Array<string | number>>(mergeDeep(['life'], [42], {arrayMergeMode: 'spread'}));\nexpectType<Array<'life' | number>>(mergeDeep(['life'] as const, [42], {arrayMergeMode: 'spread'}));\nexpectType<Array<string | 42>>(mergeDeep(['life'], [42] as const, {arrayMergeMode: 'spread'}));\nexpectType<Array<'life' | 42>>(mergeDeep(['life'] as const, [42] as const, {arrayMergeMode: 'spread'}));\n\n// Should replace simple arrays/tuples\nexpectType<Array<string | number>>(mergeDeep(['life'], [42], {arrayMergeMode: 'replace'}));\nexpectType<Array<'life' | number>>(mergeDeep(['life'] as const, [42], {arrayMergeMode: 'replace'}));\nexpectType<Array<string | 42>>(mergeDeep(['life'], [42] as const, {arrayMergeMode: 'replace'}));\nexpectType<Array<'life' | 42>>(mergeDeep(['life'] as const, [42] as const, {arrayMergeMode: 'replace'}));\n\n// Should merge tuples with union\nexpectType<Array<number | string | boolean>>(mergeDeep(['life', true], [42], {arrayMergeMode: 'spread'}));\nexpectType<Array<number | string | true>>(mergeDeep(['life'], [42, true], {arrayMergeMode: 'spread'}));\n\n// Should not deep merge classes\nclass ClassA {\n\tpublic foo = 1;\n\tpublic bar = 'bar';\n}\nclass ClassB {\n\tpublic foo = 'foo';\n}\nconst mergedClass = mergeDeep({ClassConstructor: ClassA}, {ClassConstructor: ClassB});\nconst instance = new mergedClass.ClassConstructor();\nexpectType<{ClassConstructor: typeof ClassB}>(mergedClass);\nexpectType<ClassB>(instance);\n// @ts-expect-error\nconst _a: unknown = instance.bar;\n\n// Should merge simple types\ntype Foo = {foo: string; fooBar: unknown; items: string[]};\ntype Bar = {bar: number; fooBar: boolean; items: number[]};\n\ndeclare const fooBar: MergeDeep<Foo, Bar>;\nexpectType<{foo: string; bar: number; fooBar: boolean; items: number[]}>(fooBar);\n\ndeclare const fooBarSpread: MergeDeep<Foo, Bar, {arrayMergeMode: 'spread'}>;\nexpectType<{foo: string; bar: number; fooBar: boolean; items: Array<string | number>}>(fooBarSpread);\n\ndeclare const fooBarReplace: MergeDeep<Foo, Bar, {arrayMergeMode: 'replace'}>;\nexpectType<{foo: string; bar: number; fooBar: boolean; items: number[]}>(fooBarReplace);\n\n// Should merge types deep\ntype FooDeep = {foo: Foo; fooBar: Foo; items: {foo: Foo[]; fooBar: Foo}};\ntype BarDeep = {bar: Bar; fooBar: Bar; items: {bar: Bar[]; fooBar: Bar}};\n\ndeclare const fooBarDeep: MergeDeep<FooDeep, BarDeep>;\nexpectType<{\n\tfoo: {\n\t\tfoo: string;\n\t\tfooBar: unknown;\n\t\titems: string[];\n\t};\n\tbar: {\n\t\tbar: number;\n\t\tfooBar: boolean;\n\t\titems: number[];\n\t};\n\tfooBar: {\n\t\tfoo: string;\n\t\tbar: number;\n\t\tfooBar: boolean;\n\t\titems: number[];\n\t};\n\titems: {\n\t\tfoo: Foo[];\n\t\tbar: Bar[];\n\t\tfooBar: {\n\t\t\tfoo: string;\n\t\t\tbar: number;\n\t\t\tfooBar: boolean;\n\t\t\titems: number[];\n\t\t};\n\t};\n}>(fooBarDeep);\n\n// Should merge types with index signatures deep\ntype FooWithIndexSignature = {[x: number]: number; foo: string; items: string[]};\ntype BarWithIndexSignature = {[x: symbol]: symbol; bar: number; items: number[]};\ntype FooWithIndexSignatureDeep = {[x: number]: number; foo: string; fooBar: FooWithIndexSignature; items: string[]};\ntype BarWithIndexSignatureDeep = {[x: symbol]: symbol; bar: number; fooBar: BarWithIndexSignature; items: number[]};\n\ndeclare const fooBarWithIndexSignature: MergeDeep<FooWithIndexSignatureDeep, BarWithIndexSignatureDeep>;\nexpectType<{\n\t[x: number]: number;\n\t[x: symbol]: symbol;\n\tfoo: string;\n\tbar: number;\n\tfooBar: {\n\t\t[x: number]: number;\n\t\t[x: symbol]: symbol;\n\t\tfoo: string;\n\t\tbar: number;\n\t\titems: number[];\n\t};\n\titems: number[];\n}>(fooBarWithIndexSignature);\n\n// Should merge types with optional properties deep\ntype FooWithOptional = {foo: string; fooOptional?: string; fooBar: Foo; fooBarOptional: Foo | undefined};\ntype BarWithOptional = {bar: number; barOptional?: number; fooBar: Bar; fooBarOptional: Bar | undefined};\n\ndeclare const fooBarWithOptional: MergeDeep<FooWithOptional, BarWithOptional>;\nexpectType<{\n\tfoo: string;\n\tbar: number;\n\tfooOptional?: string;\n\tbarOptional?: number;\n\tfooBar: {\n\t\tfoo: string;\n\t\tbar: number;\n\t\tfooBar: boolean;\n\t\titems: number[];\n\t};\n\tfooBarOptional: {\n\t\tfoo: string;\n\t\tbar: number;\n\t\tfooBar: boolean;\n\t\titems: number[];\n\t} | undefined;\n}>(fooBarWithOptional);\n\n// Test for optional\ntype FooOptional = {\n\tstring?: string;\n\tany?: any;\n\tnever?: never;\n};\ntype BarOptional = {\n\tnumber?: number;\n};\ntype MergedFooBar = {\n\tstring?: string;\n\tany?: any;\n\tnever?: never;\n\tnumber?: number;\n};\ndeclare const mergedFooBar: MergeDeep<FooOptional, BarOptional>;\nexpectType<MergedFooBar>(mergedFooBar);\ndeclare const mergedBarFoo: MergeDeep<FooOptional, BarOptional>;\nexpectType<MergedFooBar>(mergedBarFoo);\n\n// Test for readonly\ntype ReadonlyFoo = {\n\treadonly string: string;\n\treadonly number: number;\n\tboolean: boolean;\n};\ntype ReadonlyBar = {\n\tnumber: number;\n\treadonly boolean: boolean;\n};\ndeclare const readonlyTest: MergeDeep<ReadonlyFoo, ReadonlyBar>;\nexpectType<{\n\treadonly string: string;\n\tnumber: number;\n\treadonly boolean: boolean;\n}>(readonlyTest);\n\n// Should merge arrays with object entries\ntype FooArray = Foo[];\ntype BarArray = Bar[];\n\ndeclare const fooBarArray: MergeDeep<FooArray, BarArray>;\nexpectType<Array<Foo | Bar>>(fooBarArray);\n\ndeclare const fooBarArraySpread: MergeDeep<FooArray, BarArray, {arrayMergeMode: 'spread'}>;\nexpectType<Array<Foo | Bar>>(fooBarArraySpread);\n\ndeclare const fooBarArrayReplace: MergeDeep<FooArray, BarArray, {arrayMergeMode: 'replace'}>;\nexpectType<Array<Foo | Bar>>(fooBarArrayReplace);\n\ndeclare const fooBarArraySpreadRecursive: MergeDeep<FooArray, BarArray, {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<Array<{\n\tfoo: string;\n\tbar: number;\n\tfooBar: boolean;\n\titems: Array<string | number>;\n}>>(fooBarArraySpreadRecursive);\n\ndeclare const fooBarArrayReplaceRecursive: MergeDeep<FooArray, BarArray, {arrayMergeMode: 'replace'; recurseIntoArrays: true}>;\nexpectType<Array<{\n\tfoo: string;\n\tbar: number;\n\tfooBar: boolean;\n\titems: number[];\n}>>(fooBarArrayReplaceRecursive);\n\ndeclare const fooBarArraySpreadRecursiveFallback: MergeDeep<FooArray, string[], {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<Array<string | Foo>>(fooBarArraySpreadRecursiveFallback);\n\ndeclare const fooBarArrayReplaceRecursiveFallback: MergeDeep<FooArray, string[], {arrayMergeMode: 'replace'; recurseIntoArrays: true}>;\nexpectType<Array<string | Foo>>(fooBarArrayReplaceRecursiveFallback);\n\ndeclare const fooBarArrayDeepUnionRecursive: MergeDeep<FooArray[][], BarArray[][], {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<Array<Array<Array<{\n\tfoo: string;\n\tbar: number;\n\tfooBar: boolean;\n\titems: Array<string | number>;\n}>>>>(fooBarArrayDeepUnionRecursive);\n\ndeclare const fooBarArrayDeepUnionRecursiveFallback: MergeDeep<FooArray[], BarArray[][], {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<Array<Array<Foo | BarArray>>>(fooBarArrayDeepUnionRecursiveFallback);\n\n// Should merge tuples with object entries\ntype FooTuple = [Foo, [Foo[], 42], 'foo'];\ntype BarTuple = [Bar, [Bar[], 'a', 'b'], 'bar', true];\n\ntype FooBarSpread = typeof fooBarSpread;\ntype FooBarReplace = typeof fooBarReplace;\n\ndeclare const fooBarTupleSpread: MergeDeep<FooTuple, BarTuple, {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<[FooBarSpread, [FooBarSpread[], 'a', 'b'], 'bar', true]>(fooBarTupleSpread);\n\ndeclare const fooBarTupleReplace: MergeDeep<FooTuple, BarTuple, {arrayMergeMode: 'replace'; recurseIntoArrays: true}>;\nexpectType<[FooBarReplace, [FooBarReplace[], 'a', 'b'], 'bar', true]>(fooBarTupleReplace);\n\n// Should merge array into tuple with object entries\ntype FooNumberTuple = [Foo[], number[]];\ntype BarArray2D = Bar[][];\n\ndeclare const fooNumberTupleBarArray2DSpread: MergeDeep<FooNumberTuple, BarArray2D, {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<[FooBarSpread[], Array<number | Bar>, ...BarArray2D]>(fooNumberTupleBarArray2DSpread);\n\ndeclare const fooNumberTupleBarArray2DReplace: MergeDeep<FooNumberTuple, BarArray2D, {arrayMergeMode: 'replace'; recurseIntoArrays: true}>;\nexpectType<[FooBarReplace[], Bar[], ...BarArray2D]>(fooNumberTupleBarArray2DReplace);\n\n// Should merge tuple into array with object entries\ntype FooArray2D = Foo[][];\ntype BarNumberTuple = [Bar[], number[]];\n\ndeclare const fooArray2DBarNumberTupleSpread: MergeDeep<FooArray2D, BarNumberTuple, {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<[FooBarSpread[], Array<Foo | number>, ...FooArray2D]>(fooArray2DBarNumberTupleSpread);\n\ndeclare const fooArray2DBarNumberTupleReplace: MergeDeep<FooArray2D, BarNumberTuple, {arrayMergeMode: 'replace'; recurseIntoArrays: true}>;\nexpectType<[FooBarReplace[], number[], ...FooArray2D]>(fooArray2DBarNumberTupleReplace);\n\n// Should merge array into tuple with object entries and variadic length\ndeclare const arrayIntoTupleWithVariadicSpread: MergeDeep<[number, Foo, ...Foo[]], Bar[], {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<[Bar, FooBarSpread, ...FooBarSpread[]]>(arrayIntoTupleWithVariadicSpread);\n\ndeclare const arrayIntoTupleWithVariadicReplace: MergeDeep<[number, Foo, ...Foo[]], Bar[], {arrayMergeMode: 'replace'; recurseIntoArrays: true}>;\nexpectType<[Bar, FooBarReplace, ...FooBarReplace[]]>(arrayIntoTupleWithVariadicReplace);\n\n// Should merge tuple into array with object entries and variadic length\ndeclare const tupleIntoArrayWithVariadicSpread: MergeDeep<Foo[], [number, Bar, ...Bar[]], {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<[number, FooBarSpread, ...FooBarSpread[]]>(tupleIntoArrayWithVariadicSpread);\n\ndeclare const tupleIntoArrayWithVariadicReplace: MergeDeep<Foo[], [number, Bar, ...Bar[]], {arrayMergeMode: 'replace'; recurseIntoArrays: true}>;\nexpectType<[number, FooBarReplace, ...FooBarReplace[]]>(tupleIntoArrayWithVariadicReplace);\n\n// Should merge tuple into tuple with object entries and variadic length\ndeclare const tupleIntoTupleWithVariadicSpread: MergeDeep<[number, ...Foo[]], [Bar, Bar, ...Bar[]], {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<[Bar, FooBarSpread, ...FooBarSpread[]]>(tupleIntoTupleWithVariadicSpread);\n\ndeclare const tupleIntoTupleWithVariadicSpreadReversed: MergeDeep<[Foo, ...Foo[]], [number, Bar, ...Bar[]], {arrayMergeMode: 'spread'; recurseIntoArrays: true}>;\nexpectType<[number, FooBarSpread, ...FooBarSpread[]]>(tupleIntoTupleWithVariadicSpreadReversed);\n\ndeclare const tupleIntoTupleWithVariadicReplace: MergeDeep<[number, ...Foo[]], [Bar, Bar, ...Bar[]], {arrayMergeMode: 'replace'; recurseIntoArrays: true}>;\nexpectType<[Bar, FooBarReplace, ...FooBarReplace[]]>(tupleIntoTupleWithVariadicReplace);\n\ndeclare const tupleIntoTupleWithVariadicReplaceReversed: MergeDeep<[Foo, ...Foo[]], [number, Bar, ...Bar[]], {arrayMergeMode: 'replace'; recurseIntoArrays: true}>;\nexpectType<[number, FooBarReplace, ...FooBarReplace[]]>(tupleIntoTupleWithVariadicReplaceReversed);\n\ntype RecordNotPartial = {\n\tname: string;\n\ttype: string;\n\tb: {bb?: string; cc: string};\n};\ntype RecordPartial = Partial<RecordNotPartial>;\n\nexpectType<RecordNotPartial>({} as MergeDeep<RecordPartial, RecordNotPartial>);\nexpectType<RecordPartial>({} as MergeDeep<RecordNotPartial, RecordPartial>);\n\ntype NotOptional = {a: string; b: number; c: boolean};\ntype OptionalWithUndefined = {a: string | undefined; b?: number; c?: boolean | undefined};\n\nexpectType<OptionalWithUndefined>({} as MergeDeep<NotOptional, OptionalWithUndefined>);\nexpectType<NotOptional>({} as MergeDeep<OptionalWithUndefined, NotOptional>);\n"
  },
  {
    "path": "test-d/merge-exclusive.ts",
    "content": "import {expectNotAssignable, expectAssignable} from 'tsd';\nimport type {MergeExclusive} from '../index.d.ts';\n\ntype BaseOptions = {\n\toption?: string;\n};\n\ntype ExclusiveVariation1 = {\n\texclusive1: boolean;\n} & BaseOptions;\n\ntype ExclusiveVariation2 = {\n\texclusive2: number;\n} & BaseOptions;\n\ntype Options = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>;\n\nconst exclusiveVariation1: Options = {exclusive1: true};\nconst exclusiveVariation2: Options = {exclusive2: 1};\n\nexpectAssignable<{option?: string; exclusive1: boolean; exclusive2?: string}>(\n\texclusiveVariation1,\n);\nexpectAssignable<{option?: string; exclusive1?: string; exclusive2: number}>(\n\texclusiveVariation2,\n);\n\nexpectNotAssignable<Options>({exclusive1: true, exclusive2: 1});\n"
  },
  {
    "path": "test-d/merge.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Merge} from '../index.d.ts';\n\ntype Foo = {\n\ta: number;\n\tb: string;\n};\n\ntype Bar = {\n\tb: number;\n};\n\nconst ab: Merge<Foo, Bar> = {a: 1, b: 2};\nexpectType<{a: number; b: number}>(ab);\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ninterface FooInterface {\n\t[x: string]: unknown;\n\t[x: number]: unknown;\n\tfoo: string;\n\tbar: symbol;\n}\n\ntype BarType = {\n\t[x: number]: number;\n\t[x: symbol]: boolean;\n\tbar: Date;\n\tbaz: boolean;\n};\n\ntype FooBar = Merge<FooInterface, BarType>;\n\nconst fooBar: FooBar = {\n\t'foo-string': 'foo',\n\t42: 24,\n\t[Symbol(42)]: true,\n\tfoo: 'foo',\n\tbar: new Date(),\n\tbaz: true,\n};\n\nexpectType<{\n\t[x: string]: unknown;\n\t[x: number]: number;\n\t[x: symbol]: boolean;\n\tfoo: string;\n\tbar: Date;\n\tbaz: boolean;\n}>(fooBar);\n\ndeclare function setFooBar(fooBar: FooBar): void;\n\n// @ts-expect-error\nsetFooBar({\n\t[Symbol(42)]: 'life',\n\tfoo: 'foo',\n\tbar: new Date(),\n\tbaz: true,\n});\n\n// Checks that a property can be replaced by another property that is not of the same type. This issue was encountered in `MergeDeep' with the default options.\ntype FooDefaultOptions = {\n\tstripUndefinedValues: false;\n};\n\ntype FooOptions = Merge<FooDefaultOptions, {stripUndefinedValues: true}>;\n\nexpectType<FooOptions>({stripUndefinedValues: true});\n\n// Test that optional keys are enforced.\ntype FooWithOptionaKeys = {\n\t[x: string]: unknown;\n\t[x: number]: unknown;\n\ta: string;\n\tb?: string;\n\tc: undefined;\n\td: string;\n\te: number | undefined;\n};\n\ntype BarWithOptionaKeys = {\n\t[x: number]: number;\n\t[x: symbol]: boolean;\n\ta?: string;\n\tb: string;\n\td?: string;\n\tf: number | undefined;\n\tg: undefined;\n};\n\ntype FooBarWithOptionalKeys = Merge<FooWithOptionaKeys, BarWithOptionaKeys>;\n\ndeclare const fooBarWithOptionalKeys: FooBarWithOptionalKeys;\n\n// Note that `c` and `g` is not marked as optional and this is deliberate, as this is the behaviour expected by the older version of Merge. This may change in a later version.\nexpectType<{\n\t[x: number]: number;\n\t[x: symbol]: boolean;\n\t[x: string]: unknown;\n\tb: string;\n\tc: undefined;\n\ta?: string;\n\td?: string;\n\te: number | undefined;\n\tf: number | undefined;\n\tg: undefined;\n}>(fooBarWithOptionalKeys);\n\n// Checks that an indexed key type can be overwritten.\ntype FooWithIndexSignature = {\n\t[x: string]: unknown;\n\t[x: number]: boolean;\n\t[x: symbol]: number;\n\tfoo: boolean;\n\tfooBar: boolean;\n};\n\ntype BarWithIndexSignatureOverwrite = {\n\t[x: string]: number | string | boolean;\n\t[x: number]: number | string;\n\t[x: symbol]: symbol;\n\tbar: string;\n\tfooBar: string;\n};\n\ntype FooBarWithIndexSignature = Merge<FooWithIndexSignature, BarWithIndexSignatureOverwrite>;\n\ndeclare const fooBarWithIndexSignature: FooBarWithIndexSignature;\n\nexpectType<{\n\t[x: string]: string | number | boolean;\n\t[x: number]: string | number;\n\t[x: symbol]: symbol;\n\tfoo: boolean;\n\tbar: string;\n\tfooBar: string;\n}>(fooBarWithIndexSignature);\n\ndeclare const destinationWithAny: Merge<{foo?: any}, {bar: true}>;\n\nexpectType<{\n\tfoo?: any;\n\tbar: true;\n}>(destinationWithAny);\n\ndeclare const sourceWithAny: Merge<{foo: true}, {bar?: any}>;\n\nexpectType<{\n\tfoo: true;\n\tbar?: any;\n}>(sourceWithAny);\n\n// Test for issue https://github.com/sindresorhus/type-fest/issues/601\ntype Baz = {\n\tt1?: number;\n\tt2?: number;\n\tt3?: number;\n\tt4?: number;\n};\ndeclare const baz: Merge<Pick<Baz, 't2' | 't4'>, {\n\tlist: string[];\n}>;\nexpectType<{\n\tt2?: number;\n\tt4?: number;\n\tlist: string[];\n}>(baz);\n\n// Unions\nexpectType<{foo: number} | {foo: string; bar: boolean}>(\n\t{} as Merge<{foo: string}, {foo: number} | {bar: boolean}>,\n);\nexpectType<{foo: string} | {bar: boolean; foo: string}>(\n\t{} as Merge<{foo: number} | {bar: boolean}, {foo: string}>,\n);\nexpectType<{foo: number} | {foo: string; baz: boolean} | {bar: number; foo: number} | {bar: number; baz: boolean}>(\n\t{} as Merge<{foo: string} | {bar: number}, {foo: number} | {baz: boolean}>,\n);\nexpectType<\n\t| {[x: number]: number; foo: number; bar: string}\n\t| {[x: number]: number; bar: bigint; foo: number}\n\t| {foo: string; bar: boolean; baz: boolean}\n\t| {[x: number]: bigint; bar: boolean; baz: boolean}\n>(\n\t{} as Merge<\n\t\t{foo: string; bar: string} | {[x: number]: bigint; bar: bigint},\n\t\t{[x: number]: number; foo: number} | {bar: boolean; baz: boolean}\n\t>,\n);\n\n// Idempotency\ntype TestIntersectionObject = {a: string} & {b: string};\n// Note: If `Merge` simplified `TestIntersectionObject` to `{a: string; b: string}` then the following test would fail,\n// because `expectType` doesn't consider `{a: string; b: string}` equal to `{a: string} & {b: string}`.\nexpectType<TestIntersectionObject>({} as Merge<TestIntersectionObject, TestIntersectionObject>);\n\n// Idempotency: Unions\nexpectType<TestIntersectionObject | {a: string; b: string; c: string}>({} as Merge<TestIntersectionObject | {c: string}, TestIntersectionObject>);\nexpectType<TestIntersectionObject | {a: string; b: string; c: string}>({} as Merge<TestIntersectionObject, TestIntersectionObject | {c: string}>);\n"
  },
  {
    "path": "test-d/multidimensional-array.ts",
    "content": "import {expectType} from 'tsd';\nimport type {MultidimensionalArray} from '../index.d.ts';\n\nfunction createArray<T extends number>(dimensions: T): MultidimensionalArray<unknown, T> {\n\tconst root: unknown[] = [];\n\n\tlet array = root;\n\tfor (let dimension = 1; dimension < dimensions; ++dimension) {\n\t\tarray[0] = [];\n\t\tarray = array[0] as unknown[];\n\t}\n\n\treturn root as MultidimensionalArray<unknown, T>;\n}\n\nconst a: MultidimensionalArray<number, 3> = [];\nconst b: MultidimensionalArray<boolean, number> = [];\nconst c = createArray(2);\nconst d = createArray(7);\n\n// @ts-expect-error\na[0][0][0] = 42;\n\ntype RecursiveArray<T> = Array<RecursiveArray<T>>;\n\nexpectType<number[][][]>(a);\nexpectType<RecursiveArray<boolean>>(b);\nexpectType<unknown[][]>(c);\nexpectType<unknown[][][][][][][]>(d);\n"
  },
  {
    "path": "test-d/multidimensional-readonly-array.ts",
    "content": "import {expectType} from 'tsd';\nimport type {MultidimensionalReadonlyArray} from '../index.d.ts';\n\nfunction createArray<T extends number>(dimensions: T): MultidimensionalReadonlyArray<string, T> {\n\tconst root: unknown[] = [];\n\n\tlet array = root;\n\tfor (let dimension = 1; dimension < dimensions; ++dimension) {\n\t\tarray[0] = [];\n\t\tif (dimension < dimensions - 1) {\n\t\t\tarray = array[0] as unknown[];\n\t\t} else {\n\t\t\tarray[0] = '42';\n\t\t}\n\t}\n\n\treturn root as MultidimensionalReadonlyArray<unknown, T> as MultidimensionalReadonlyArray<string, T>;\n}\n\nconst a: MultidimensionalReadonlyArray<number, 3> = [];\nconst b: MultidimensionalReadonlyArray<boolean, number> = [];\nconst c = createArray(2);\n\nconst answer = c?.[0]?.[0]; // '42'\n\ntype RecursiveArray<T> = ReadonlyArray<RecursiveArray<T>>;\n\nexpectType<string | undefined>(answer);\n\nexpectType<ReadonlyArray<ReadonlyArray<readonly number[]>>>(a);\nexpectType<RecursiveArray<boolean>>(b);\nexpectType<ReadonlyArray<readonly string[]>>(c);\n"
  },
  {
    "path": "test-d/non-empty-object.ts",
    "content": "import {expectNever, expectType} from 'tsd';\nimport type {NonEmptyObject, RequireAtLeastOne} from '../index.d.ts';\n\ntype TestType1 = {\n\ta: string;\n\tb: boolean;\n};\n\ntype TestType2 = {\n\ta?: string;\n\tb?: boolean;\n};\n\ntype TestType3 = {\n\ta: string;\n\tb?: boolean;\n};\n\ntype TestType4 = {};\n\ndeclare const test1: NonEmptyObject<TestType1>;\ndeclare const test2: NonEmptyObject<TestType2>;\ndeclare const test3: NonEmptyObject<TestType3>;\ndeclare const test4: NonEmptyObject<TestType4>;\n\nexpectType<TestType1>(test1);\nexpectType<RequireAtLeastOne<TestType2>>(test2);\nexpectType<TestType3>(test3);\nexpectNever(test4);\n"
  },
  {
    "path": "test-d/non-empty-string.ts",
    "content": "import {expectType} from 'tsd';\nimport type {NonEmptyString} from '../index.d.ts';\n\nexpectType<never>({} as NonEmptyString<''>);\n\nexpectType<'a'>({} as NonEmptyString<'a'>);\n\nexpectType<never>({} as NonEmptyString<string>);\nexpectType<never>({} as NonEmptyString<Uppercase<string>>);\nexpectType<`on${string}`>({} as NonEmptyString<`on${string}`>);\n\nexpectType<'a' | 'b'>({} as NonEmptyString<'a' | 'b'>);\nexpectType<'a' | `${number}.${number}`>({} as NonEmptyString<'a' | `${number}.${number}`>);\nexpectType<never>({} as NonEmptyString<'' | 'a'>);\nexpectType<never>({} as NonEmptyString<'a' | Uppercase<string>>);\nexpectType<never>({} as NonEmptyString<'' | `on${string}`>);\n\n// `NonEmptyString<S>` should be assignable to `string`\ntype Assignability1<_S extends string> = unknown;\ntype Test1<S extends string> = Assignability1<NonEmptyString<S>>;\n\n// `string` should NOT be assignable to `NonEmptyString<S>`\ntype Assignability2<_S extends string, _SS extends NonEmptyString<_S>> = unknown;\n// @ts-expect-error\ntype Test2<S extends string> = Assignability2<S, S>;\n"
  },
  {
    "path": "test-d/non-empty-tuple.ts",
    "content": "import {expectType} from 'tsd';\nimport type {NonEmptyTuple} from '../index.d.ts';\n\ndeclare const sum: (...numbers: NonEmptyTuple<number>) => number;\n\nexpectType<number>(sum(1, 2, 3));\nexpectType<number>(sum(1));\n\n// @ts-expect-error\nsum();\n"
  },
  {
    "path": "test-d/numeric.ts",
    "content": "import {expectType} from 'tsd';\nimport type {\n\tFinite,\n\tFloat,\n\tInteger,\n\tNegative,\n\tNegativeFloat,\n\tNegativeInfinity,\n\tNegativeInteger,\n\tNonNegative,\n\tNonNegativeInteger,\n\tPositiveInfinity,\n} from '../index.d.ts';\n\n// Finite\ndeclare const infinity: Finite<PositiveInfinity | NegativeInfinity>;\ndeclare const infinityMixed: Finite<1 | PositiveInfinity | NegativeInfinity>;\n\nexpectType<never>(infinity);\nexpectType<1>(infinityMixed);\n\n// Integer\ndeclare const integer: Integer<1>;\ndeclare const integerWithDecimal: Integer<1.0>; // eslint-disable-line unicorn/no-zero-fractions\ndeclare const numberType: Integer<number>;\ndeclare const integerMixed: Integer<1 | 1.5 | -1>;\ndeclare const bigInteger: Integer<1e+100>;\ndeclare const octalInteger: Integer<0o10>;\ndeclare const binaryInteger: Integer<0b10>;\ndeclare const hexadecimalInteger: Integer<0x10>;\ndeclare const nonInteger: Integer<1.5>;\ndeclare const infinityInteger: Integer<PositiveInfinity | NegativeInfinity>;\nconst infinityValue = Number.POSITIVE_INFINITY;\ndeclare const infinityInteger2: Integer<typeof infinityValue>;\n\nexpectType<1>(integer);\nexpectType<1>(integerWithDecimal);\nexpectType<never>(numberType);\nexpectType<1 | -1>(integerMixed);\nexpectType<1e+100>(bigInteger);\nexpectType<0o10>(octalInteger);\nexpectType<0b10>(binaryInteger);\nexpectType<0x10>(hexadecimalInteger);\nexpectType<never>(nonInteger);\nexpectType<never>(infinityInteger);\nexpectType<never>(infinityInteger2);\n\n// Float\ndeclare const float: Float<1.5>;\ndeclare const floatMixed: Float<1 | 1.5 | -1.5>;\ndeclare const nonFloat: Float<1>;\ndeclare const infinityFloat: Float<PositiveInfinity | NegativeInfinity>;\n\nexpectType<1.5>(float);\nexpectType<1.5 | -1.5>(floatMixed);\nexpectType<never>(nonFloat);\nexpectType<never>(infinityFloat);\n\n// Negative\ndeclare const negative: Negative<-1 | -1n | 0 | 0n | 1 | 1n>;\n\nexpectType<-1 | -1n>(negative);\n\n// NegativeInteger\ndeclare const negativeInteger: NegativeInteger<-1 | 0 | 1>;\n\nexpectType<-1>(negativeInteger);\n\n// NegativeFloat\ndeclare const negativeFloat: NegativeFloat<-1.5 | -1 | 0 | 1 | 1.5>;\n\nexpectType<-1.5>(negativeFloat);\n\n// NonNegative\ndeclare const nonNegative: NonNegative<-1 | -1n | 0 | 0n | 1 | 1n>;\n\nexpectType<0 | 0n | 1 | 1n>(nonNegative);\n\n// NonNegativeInteger\ndeclare const nonNegativeInteger: NonNegativeInteger<-1 | 0 | 1>;\n\nexpectType<0 | 1>(nonNegativeInteger);\n"
  },
  {
    "path": "test-d/object-merge.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ObjectMerge} from '../source/object-merge.d.ts';\n\ndeclare const sym: unique symbol;\n\n// === Simple cases ===\nexpectType<{a: number; b: string}>({} as ObjectMerge<{a: number}, {b: string}>);\nexpectType<{a: string}>({} as ObjectMerge<{a: number}, {a: string}>);\nexpectType<{a: string; b: boolean}>({} as ObjectMerge<{a: number}, {a: string; b: boolean}>);\nexpectType<{a: string; b: boolean}>({} as ObjectMerge<{a: number; b: boolean}, {a: string}>);\nexpectType<{a: string; b: string; c: number}>({} as ObjectMerge<{a: number; b: string}, {a: string; c: number}>);\nexpectType<{a: string; b: boolean}>({} as ObjectMerge<{}, {a: string; b: boolean}>);\nexpectType<{a: string; b: boolean}>({} as ObjectMerge<{a: string; b: boolean}, {}>);\n\n// === Optional properties ===\n// Optional in second\nexpectType<{a: number | string; b: number; c: boolean}>(\n\t{} as ObjectMerge<{a: number; b: number}, {a?: string; c: boolean}>,\n);\n// Optional in first\nexpectType<{a: string; b: number; c: boolean}>(\n\t{} as ObjectMerge<{a?: number; b: number}, {a: string; c: boolean}>,\n);\n// Optional in both\nexpectType<{a?: number | string; b: number; c: boolean}>(\n\t{} as ObjectMerge<{a?: number; b: number}, {a?: string; c: boolean}>,\n);\n// Optionality preserved for non-overlapping keys\nexpectType<{a: string; b?: number; c?: string}>(\n\t{} as ObjectMerge<{a: number; b?: number}, {a: string; c?: string}>,\n);\n// Mix\nexpectType<{a?: number | string; b: string | number; c: string; d: boolean; e?: bigint; f: boolean; g?: bigint}>(\n\t{} as ObjectMerge<\n\t\t{a?: number; b: string; c?: number; d: boolean; e?: bigint},\n\t\t{a?: string; b?: number; c: string; f: boolean; g?: bigint}\n\t>,\n);\n\n// === Readonly properties ===\n// Readonly in second\nexpectType<{a: string; b: number; c: boolean}>(\n\t{} as ObjectMerge<{a: number; b: number}, {readonly a: string; c: boolean}>,\n);\nexpectType<{[x: string]: number | string; a: string | number}>(\n\t{} as ObjectMerge<{a: string}, {readonly [x: string]: number}>,\n);\n// Readonly in first\nexpectType<{a: string; b: number; c: boolean}>(\n\t{} as ObjectMerge<{readonly a: number; b: number}, {a: string; c: boolean}>,\n);\nexpectType<{[x: string]: number | string; b: string}>(\n\t{} as ObjectMerge<{readonly [x: string]: number}, {b: string}>,\n);\n// Readonly in both\nexpectType<{a: string; b: number; c: boolean}>(\n\t{} as ObjectMerge<{readonly a: number; b: number}, {readonly a: string; c: boolean}>,\n);\nexpectType<{[x: string]: number | string; b: number | string; c: string}>(\n\t{} as ObjectMerge<{readonly [x: string]: number; b: number}, {readonly [x: string]: string; c: string}>,\n);\n// Readonly is not preserved even for non-overlapping keys\nexpectType<{a: string; b: number; c: string}>(\n\t{} as ObjectMerge<{a: number; readonly b: number}, {a: string; readonly c: string}>,\n);\nexpectType<{[x: string]: string; [x: symbol]: number}>(\n\t{} as ObjectMerge<{readonly [x: string]: string}, {readonly [x: symbol]: number}>,\n);\n// Mix\nexpectType<{a: string; b: number; c: string; d: boolean; e: bigint; f: boolean; g: bigint}>(\n\t{} as ObjectMerge<\n\t\t{readonly a: number; b: string; readonly c: number; d: boolean; readonly e: bigint},\n\t\t{readonly a: string; readonly b: number; c: string; f: boolean; readonly g: bigint}\n\t>,\n);\n\n// === Optional and readonly properties ===\nexpectType<{a: string; b: number | string}>(\n\t{} as ObjectMerge<{a?: number; readonly b: number}, {readonly a: string; b?: string}>,\n);\nexpectType<{[x: string]: string | number; [x: symbol]: number | string; [sym]: string | number; a?: string | number}>(\n\t{} as ObjectMerge<{readonly [x: string]: number; [sym]: string}, {[x: symbol]: number; a?: string}>,\n);\nexpectType<{a?: number | string; b: string | number; c: string; d: boolean; e?: bigint; f: boolean; g?: bigint}>(\n\t{} as ObjectMerge<\n\t\t{readonly a?: number; b: string; readonly c?: number; d: boolean; readonly e?: bigint},\n\t\t{readonly a?: string; readonly b?: number; c: string; f: boolean; readonly g?: bigint}\n\t>,\n);\n\n// === Index signatures ===\n// Index signature in second\nexpectType<{[x: string]: string | number; a: string | number; b: 1; c: 2}>(\n\t{} as ObjectMerge<{a: string; b: boolean}, {[x: string]: number; b: 1; c: 2}>,\n);\nexpectType<\n\t{[x: `is${string}`]: boolean | 'y' | 'n'; isLoading: boolean | 'y' | 'n'; isOpen: boolean | 'y' | 'n'; foo: string; bar: number}\n>(\n\t{} as ObjectMerge<\n\t\t{isLoading: 'y' | 'n'; isOpen: 'y' | 'n'; foo: string; bar: number},\n\t\t{[x: `is${string}`]: boolean}\n\t>,\n);\n// Index signature in first\nexpectType<{[x: string]: number | string | boolean; a: string; b: 2; c: boolean}>(\n\t{} as ObjectMerge<{[x: string]: number; a: 1; b: 2}, {a: string; c: boolean}>,\n);\nexpectType<\n\t{[x: `is${string}`]: boolean | 'y' | 'n'; isLoading: 'y' | 'n'; isOpen: 'y' | 'n'; foo: string; bar: number}\n>(\n\t{} as ObjectMerge<\n\t\t{[x: `is${string}`]: boolean},\n\t\t{isLoading: 'y' | 'n'; isOpen: 'y' | 'n'; foo: string; bar: number}\n\t>,\n);\n// Index signature in both\nexpectType<{[x: string]: number | string; [sym]: boolean; a: 1 | string; b: 'b'; c: 'c'}>(\n\t{} as ObjectMerge<{[x: string]: number; [sym]: boolean; a: 1; b: 2}, {[x: string]: string; b: 'b'; c: 'c'}>,\n);\n// Multiple index signatures\nexpectType<\n\t{[x: `on${string}`]: string | string[]; [x: `handle${string}`]: number | number[]; onChange: string | string[]; handleClick: number | number[]}\n>(\n\t{} as ObjectMerge<\n\t\t{onChange: string[]; handleClick: number[]},\n\t\t{[x: `on${string}`]: string; [x: `handle${string}`]: number}\n\t>,\n);\nexpectType<\n\t{[x: `on${string}`]: string | string[]; [x: `handle${string}`]: number | number[]; onChange: string[]; handleClick: number[]}\n>(\n\t{} as ObjectMerge<\n\t\t{[x: `on${string}`]: string; [x: `handle${string}`]: number},\n\t\t{onChange: string[]; handleClick: number[]}\n\t>,\n);\nexpectType<\n\t{[x: string]: string | boolean | bigint; [x: symbol]: number; [x: number]: string | boolean; [x: `is${string}`]: bigint | string}\n>(\n\t{} as ObjectMerge<\n\t\t{[x: string]: string; [x: symbol]: number},\n\t\t{[x: number]: boolean; [x: `is${string}`]: bigint}\n\t>,\n);\n// Indexor in `First` is same as in `Second`\nexpectType<{[x: string]: string | number}>(\n\t{} as ObjectMerge<{[x: string]: string}, {[x: string]: number}>,\n);\nexpectType<{[x: `${number}`]: number | string; [x: number]: string | number}>(\n\t{} as ObjectMerge<{[x: `${number}`]: number}, {[x: number]: string}>,\n);\n// Indexor in `First` is supertype of indexor in `Second`\nexpectType<{[x: string]: string | number; [x: Lowercase<string>]: string | number}>(\n\t{} as ObjectMerge<{[x: string]: string}, {[x: Lowercase<string>]: number}>,\n);\nexpectType<{[x: string]: number | string; [x: number]: string | number}>(\n\t{} as ObjectMerge<{[x: string]: number}, {[x: number]: string}>,\n);\nexpectType<{[x: string]: string | boolean; [x: `is${string}`]: boolean | string}>(\n\t{} as ObjectMerge<{[x: string]: string}, {[x: `is${string}`]: boolean}>,\n);\n// Indexor in `First` is subtype of indexor in `Second`\nexpectType<{[x: string]: string | number; [x: Lowercase<string>]: string | number}>(\n\t{} as ObjectMerge<{[x: Lowercase<string>]: string}, {[x: string]: number}>,\n);\nexpectType<{[x: number]: number | string; [x: string]: string | number}>(\n\t{} as ObjectMerge<{[x: number]: number}, {[x: string]: string}>,\n);\n// No overlap b/w indexors\nexpectType<{[x: symbol]: number; [x: number]: string}>(\n\t{} as ObjectMerge<{[x: symbol]: number}, {[x: number]: string}>,\n);\n// Partial overlap b/w indexors\nexpectType<{[x: Lowercase<string>]: string | number; [x: Uppercase<string>]: string | number}>(\n\t{} as ObjectMerge<{[x: Lowercase<string>]: number}, {[x: Uppercase<string>]: string}>,\n);\n\n// === Index signatures and optional properties ===\nexpectType<{[x: string]: string | number; a?: string | number}>(\n\t{} as ObjectMerge<{a?: string}, {[x: string]: number}>,\n);\nexpectType<{[x: string]: string | number; a?: string | number}>(\n\t{} as ObjectMerge<{[x: string]: number}, {a?: string}>,\n);\nexpectType<{[x: string]: number | string; a: number | string}>(\n\t{} as ObjectMerge<{a: string}, {[x: string]: number; a?: number}>,\n);\nexpectType<{[x: string]: number | string; a: string}>(\n\t{} as ObjectMerge<{[x: string]: number; a?: number}, {a: string}>,\n);\nexpectType<{[x: string]: number | string; a?: number | string}>(\n\t{} as ObjectMerge<{[x: string]: number; a?: number}, {a?: string}>,\n);\n\n// === Normalized keys cases ===\n// ===== Cases covering branch that handles literal keys of `Second` =====\n// String/number key overwrites corresponding number/string key\nexpectType<{0: string; 1: string}>({} as ObjectMerge<{'0': number}, {0: string; 1: string}>);\nexpectType<{'0': string; '1': string}>({} as ObjectMerge<{0?: number}, {'0': string; '1': string}>);\n// String/number key with number/string index signature\nexpectType<{[x: string]: number | string; 0: string}>({} as ObjectMerge<{[x: string]: number}, {0: string}>);\nexpectType<{[x: number]: number | string; '0': string}>({} as ObjectMerge<{[x: number]: number}, {'0': string}>);\n// Optional number key with string index signature\nexpectType<{[x: string]: number | string; 0?: string | number}>({} as ObjectMerge<{[x: string]: number}, {0?: string}>);\n// Optional string key with number index signature\nexpectType<{[x: number]: number | string; [x: symbol]: boolean; '0'?: string | number}>(\n\t// The `symbol` index signature is added because\n\t// `{[x: number]: number}[never]` yields `number` instead of `never`,\n\t// but if we add a `symbol` index signature to it, then\n\t// `{[x: number]: number; [x: symbol]: boolean}[never]` yields `never` as expected.\n\t{} as ObjectMerge<{[x: number]: number; [x: symbol]: boolean}, {'0'?: string}>,\n);\n\n// ===== Cases covering branch that handles literal keys of `First` =====\n// String/number key from `First` doesn't show up in output if corresponding number/string key exists in `Second`\nexpectType<{0: string; '1': number}>({} as ObjectMerge<{'0': number; '1': number}, {0: string}>);\nexpectType<{'0': string; 1: number}>({} as ObjectMerge<{0: number; 1: number}, {'0': string}>);\n// Number/string key from `First` with string/number index signature in `Second`\nexpectType<{[x: string]: string | number; 0: number | string}>({} as ObjectMerge<{0: number}, {[x: string]: string}>);\nexpectType<{[x: number]: string | number; [x: symbol]: boolean; '0': number | string}>(\n\t{} as ObjectMerge<{'0': number}, {[x: number]: string; [x: symbol]: boolean}>,\n);\n\n// ===== Cases covering branch that handles non-literal keys of `Second` =====\n// String/number index signature in `Second` with number/string key in `First`\nexpectType<{[x: string]: number | string; 0: string | number}>({} as ObjectMerge<{0: string}, {[x: string]: number}>);\nexpectType<{[x: number]: number | string; '0': string | number}>({} as ObjectMerge<{'0': string}, {[x: number]: number}>);\n// Index signature in `Second` with overwritten key in `First`\nexpectType<{[x: string]: number; [x: symbol]: boolean; 0: 1 | 2 | 3}>(\n\t{} as ObjectMerge<{[x: symbol]: boolean; '0': string}, {[x: string]: number; 0: 1 | 2 | 3}>,\n);\n// Index signature in `Second` with non-overwritten key in `First`\nexpectType<{[x: string]: number | string; 0: string | 1 | 2 | 3}>({} as ObjectMerge<{0: string}, {[x: string]: number; '0'?: 1 | 2 | 3}>);\n\n// ===== Cases covering branch that handles non-literal keys of `First` =====\n// String/number index signature in `First` with number/string key in `Second`\nexpectType<{[x: string]: number | string; 0: string}>({} as ObjectMerge<{[x: string]: number}, {0: string}>);\nexpectType<{[x: number]: number | string; '0': string}>({} as ObjectMerge<{[x: number]: number}, {'0': string}>);\n\n// ===== Cases covering branch that handles optional keys of `Second` that are also present in `First` =====\n// Number/string optional key in `Second` with corresponding string/number key in `First`\nexpectType<{'0': number | string}>({} as ObjectMerge<{'0': number}, {0?: string}>);\nexpectType<{0: number | string}>({} as ObjectMerge<{0: number}, {'0'?: string}>);\n// Number/string optional key in `Second` with corresponding string/number optional key in `First`\nexpectType<{'0'?: number | string}>({} as ObjectMerge<{'0'?: number}, {0?: string}>);\nexpectType<{0?: number | string}>({} as ObjectMerge<{0?: number}, {'0'?: string}>);\n\n// === Unions ===\nexpectType<{a: number; b: string; c: number} | {a: number; c: number; d: string}>(\n\t{} as ObjectMerge<{a: string; b: string} | {c: string; d: string}, {a: number; c: number}>,\n);\nexpectType<{a: number; b: string} | {a: string; b: number}>(\n\t{} as ObjectMerge<{a: string; b: string}, {a: number} | {b: number}>,\n);\nexpectType<{a: number; b: string} | {a: string; b: string; c: number} | {c: number; d: string} | {a: number; c: string; d: string}>(\n\t{} as ObjectMerge<{a: string; b: string} | {c: string; d: string}, {a: number} | {c: number}>,\n);\n\n// === Functions ===\nexpectType<{a: string}>({} as ObjectMerge<{a: string}, (a1: string, a2: number) => void>);\nexpectType<{a: number}>({} as ObjectMerge<{a: string}, {(a1: string, a2: number): void; a: number}>);\nexpectType<{a: string}>({} as ObjectMerge<() => string, {a: string}>);\nexpectType<{a: string}>({} as ObjectMerge<{(): string; a: number}, {a: string}>);\n\n// === Non-objects ===\n// @ts-expect-error\ntype T1 = ObjectMerge<string, {a: string}>;\n// @ts-expect-error\ntype T2 = ObjectMerge<{a: string}, number>;\n// @ts-expect-error\ntype T3 = ObjectMerge<{a: string}, unknown>;\n// @ts-expect-error\ntype T4 = ObjectMerge<unknown, {a: string}>;\nexpectType<unknown>({} as ObjectMerge<string[], {0: string}>);\nexpectType<unknown>({} as ObjectMerge<{0: string}, string[]>);\nexpectType<unknown>({} as ObjectMerge<string[], number[]>);\nexpectType<unknown>({} as ObjectMerge<ReadonlyMap<string, number>, {a: string}>);\nexpectType<unknown>({} as ObjectMerge<{a: string}, ReadonlyMap<string, number>>);\nexpectType<unknown>({} as ObjectMerge<WeakMap<WeakKey, number>, {a: string}>);\nexpectType<unknown>({} as ObjectMerge<{a: string}, WeakMap<WeakKey, number>>);\nexpectType<unknown>({} as ObjectMerge<ReadonlySet<string>, {a: string}>);\nexpectType<unknown>({} as ObjectMerge<{a: string}, ReadonlySet<string>>);\nexpectType<unknown>({} as ObjectMerge<WeakSet<WeakKey>, {a: string}>);\nexpectType<unknown>({} as ObjectMerge<{a: string}, WeakSet<WeakKey>>);\n\n// === Boundary cases ===\nexpectType<any>({} as ObjectMerge<any, {a: string}>);\nexpectType<any>({} as ObjectMerge<{a: string}, any>);\nexpectType<never>({} as ObjectMerge<never, {a: string}>);\nexpectType<never>({} as ObjectMerge<{a: string}, never>);\nexpectType<never>({} as ObjectMerge<any, never>);\nexpectType<never>({} as ObjectMerge<never, any>);\n"
  },
  {
    "path": "test-d/observable-like.ts",
    "content": "import {expectType, expectAssignable} from 'tsd';\nimport type {ObservableLike} from '../source/globals/index.d.ts';\n\n// eslint-disable-next-line no-use-extend-native/no-use-extend-native\nexpectAssignable<symbol>(Symbol.observable);\n\nconst observable = (null as any) as ObservableLike;\n\nconst subscription = observable.subscribe({\n\tnext() {}, // eslint-disable-line @typescript-eslint/no-empty-function\n});\nexpectType<{unsubscribe(): void}>(subscription);\n\nobservable.subscribe({\n\tnext(value) {\n\t\texpectType<unknown>(value);\n\t},\n});\n\nconst observable2 = (null as any) as ObservableLike<string>;\n\nobservable2.subscribe({\n\tnext() {}, // eslint-disable-line @typescript-eslint/no-empty-function\n});\nobservable2.subscribe({\n\tnext(value) {\n\t\texpectType<string>(value);\n\t},\n});\n"
  },
  {
    "path": "test-d/omit-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {OmitDeep} from '../index.d.ts';\n\ndeclare class ClassA {\n\ta: string;\n}\n\ntype BaseType = {\n\tstring: string;\n\toptionalString?: string;\n\tarray: number[];\n\treadonlyArray: readonly number[];\n\ttuples: ['foo', 'bar'];\n\tobjectArray: Array<{a: 1; b: 2}>;\n\tleadingSpreadArray: [...Array<{a: 1}>, {b: 2}];\n\ttailingSpreadArray: [{a: 1}, {b: {c: 2; other: 2}}, ...Array<{d: 3}>];\n\tobjectTuple: [{a: 1}];\n\tnumber: number;\n\tboolean: boolean;\n\tdate: Date;\n\tClass: typeof ClassA;\n\tinstance: ClassA;\n\t0: number;\n\t1?: number;\n\toptionalObject?: {\n\t\toptionalString?: string;\n\t};\n};\n\ntype Testing = {\n\tobject: BaseType;\n};\n\ndeclare const normal: OmitDeep<Testing, 'object'>;\nexpectType<Omit<Testing, 'object'>>(normal);\n\ndeclare const normal2: OmitDeep<Testing, 'object.string'>;\nexpectType<{object: Omit<BaseType, 'string'>}>(normal2);\n\ndeclare const omitNotExistProperty: OmitDeep<Testing, 'not_in_Testing'>;\nexpectType<Testing>(omitNotExistProperty);\n\ndeclare const omitNotExistProperties: OmitDeep<Testing, 'not_in_Testing' | 'not_in_Testing2'>;\nexpectType<Testing>(omitNotExistProperties);\n\ndeclare const omitNotExistProperty2: OmitDeep<Testing, 'object.not_in_object'>;\nexpectType<Testing>(omitNotExistProperty2);\n\ndeclare const omitNotExistArrayProperty2: OmitDeep<[1, 2, 3], 'not_in_array'>;\nexpectType<[1, 2, 3]>(omitNotExistArrayProperty2);\n\ndeclare const number: OmitDeep<Testing, 'object.number'>;\nexpectType<{object: Omit<BaseType, 'number'>}>(number);\n\ndeclare const boolean: OmitDeep<Testing, 'object.boolean'>;\nexpectType<{object: Omit<BaseType, 'boolean'>}>(boolean);\n\ndeclare const date: OmitDeep<Testing, 'object.date'>;\nexpectType<{object: Omit<BaseType, 'date'>}>(date);\n\ndeclare const class_: OmitDeep<Testing, 'object.Class'>;\nexpectType<{object: Omit<BaseType, 'Class'>}>(class_);\n\ndeclare const instance: OmitDeep<Testing, 'object.instance'>;\nexpectType<{object: Omit<BaseType, 'instance'>}>(instance);\n\ndeclare const array: OmitDeep<Testing, 'object.array'>;\nexpectType<{object: Omit<BaseType, 'array'>}>(array);\n\ndeclare const numberKey: OmitDeep<Testing, 'object.1'>;\nexpectType<{object: Omit<BaseType, 1>}>(numberKey);\n\ndeclare const numberKey2: OmitDeep<Testing, 'object.0'>;\nexpectType<{object: Omit<BaseType, 0>}>(numberKey2);\n\ntype DeepType = {\n\tnested: {\n\t\tdeep: {\n\t\t\tdeeper: {\n\t\t\t\tvalue: string;\n\t\t\t\tvalue2: string;\n\t\t\t};\n\t\t};\n\t};\n\tfoo: string;\n};\ndeclare const deep: OmitDeep<DeepType, 'nested.deep.deeper.value'>;\nexpectType<{\n\tnested: {\n\t\tdeep: {\n\t\t\tdeeper: {\n\t\t\t\tvalue2: string;\n\t\t\t};\n\t\t};\n\t};\n\tfoo: string;\n}>(deep);\n\ndeclare const union: OmitDeep<DeepType, 'nested.deep.deeper.value' | 'nested.deep.deeper.value2'>;\nexpectType<{\n\tnested: {\n\t\tdeep: {\n\t\t\tdeeper: {};\n\t\t};\n\t};\n\tfoo: string;\n}>(union);\n\ntype Optional = {\n\tfoo?: {\n\t\tbar?: {\n\t\t\tbaz: string;\n\t\t};\n\t};\n};\n\ndeclare const optional: OmitDeep<Optional, 'foo.bar.baz'>;\nexpectType<{foo?: {bar?: {}}}>(optional);\n\n/** Test for arrays */\ndeclare const recurseIntoArray: OmitDeep<{array: BaseType['objectArray']}, `array.${number}.a`>;\nexpectType<{array: Array<{b: 2}>}>(recurseIntoArray);\n\ndeclare const recurseIntoArray2: OmitDeep<{array: BaseType['objectArray']}, 'array.0.a'>;\nexpectType<{array: [{b: 2}, ...Array<{a: 1; b: 2}>]}>(recurseIntoArray2);\n\ndeclare const recurseIntoArray3: OmitDeep<{array: BaseType['objectArray']}, 'array.3.a'>;\nexpectType<{array: [\n\t{a: 1; b: 2}, // 0\n\t{a: 1; b: 2}, // 1\n\t{a: 1; b: 2}, // 2\n\t{b: 2}, // 3\n\t...Array<{a: 1; b: 2}>,\n];}>(recurseIntoArray3);\n\ndeclare const tuple: OmitDeep<{array: BaseType['tuples']}, 'array.0'>;\nexpectType<{array: [unknown, 'bar']}>(tuple);\n\ndeclare const arrayWithMultiplePaths: OmitDeep<{array: Array<{a: string; b: number; c: string}>}, `array.${number}.a` | `array.${number}.b`>;\nexpectType<{array: Array<{c: string}>}>(arrayWithMultiplePaths);\n\ndeclare const tupleWithMultiplePaths: OmitDeep<{tuple: [{a: string; b: number; c: string}]}, 'tuple.0.a' | 'tuple.0.b'>;\nexpectType<{tuple: [{c: string}]}>(tupleWithMultiplePaths);\n"
  },
  {
    "path": "test-d/omit-index-signature.ts",
    "content": "import {expectType} from 'tsd';\nimport type {OmitIndexSignature} from '../index.d.ts';\n\ntype ExampleInterface = {\n\t// These index signatures will be removed.\n\t[x: string]: any;\n\t[x: number]: any;\n\t[x: symbol]: any;\n\t[x: `head-${string}`]: string;\n\t[x: `${string}-tail`]: string;\n\t[x: `head-${string}-tail`]: string;\n\t[x: `${bigint}`]: string;\n\t[x: `embedded-${number}`]: string;\n\n\t// These explicitly defined keys will remain.\n\tfoo: 'bar';\n\tqux?: 'baz';\n};\n\ntype MappedType<ObjectType> = {\n\t[Key in keyof ObjectType]: {\n\t\tkey: Key;\n\t\tvalue: Exclude<ObjectType[Key], undefined>;\n\t};\n};\n\ndeclare const exampleInterfaceKnownKeys: OmitIndexSignature<ExampleInterface>;\nexpectType<{\n\tfoo: 'bar';\n\tqux?: 'baz';\n}>(exampleInterfaceKnownKeys);\n\ndeclare const exampleMappedTypeKnownKeys: OmitIndexSignature<\n\tMappedType<ExampleInterface>\n>;\nexpectType<{\n\tfoo: {key: 'foo'; value: 'bar'};\n\tqux?: {key: 'qux'; value: 'baz'};\n}>(exampleMappedTypeKnownKeys);\n"
  },
  {
    "path": "test-d/opaque.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectNotType, expectType} from 'tsd';\nimport type {Opaque, UnwrapOpaque, Tagged, GetTagMetadata, UnwrapTagged, InvariantOf,\tSnakeCasedPropertiesDeep} from '../index.d.ts';\n\ntype Value = Opaque<number, 'Value'>;\n\n// We make an explicit cast so we can test the value.\nconst value: Value = 2 as Value;\n\n// The underlying type of the value is still a number.\nexpectAssignable<number>(value);\n\n// You cannot modify an opaque value (and still get back an opaque value).\nexpectNotAssignable<Value>(value + 2);\n\n// But you can modify one if you're just treating it as its underlying type.\nexpectAssignable<number>(value + 2);\n\ntype WithoutToken = Opaque<number>;\nexpectAssignable<WithoutToken>(2 as WithoutToken);\n\n// Verify that the Opaque's token can be the parent type itself.\ntype Person = {\n\tid: Opaque<number, Person>;\n\tname: string;\n};\nconst person = {\n\tid: 42 as Opaque<number, Person>,\n\tname: 'Arthur',\n};\nexpectType<Person>(person);\n\n// Failing test for https://github.com/sindresorhus/type-fest/issues/108\n// Use `Opaque` value as `Record` index type.\ntype UUID = Opaque<string, 'UUID'>;\ntype NormalizedDictionary<T> = Record<UUID, T>;\ntype Foo = {bar: string};\n\nconst userEntities: NormalizedDictionary<Foo> = {\n\t['7dd4a16e-d5ee-454c-b1d0-71e23d9fa70b' as UUID]: {bar: 'John'},\n\t['6ce31270-31eb-4a72-a9bf-43192d4ab436' as UUID]: {bar: 'Doe'},\n};\n\nconst johnsId = '7dd4a16e-d5ee-454c-b1d0-71e23d9fa70b' as UUID;\n\nconst userJohn = userEntities[johnsId];\nexpectType<Foo | undefined>(userJohn);\n\n// Remove tag from opaque value.\n// Note: This will simply return number as type.\ntype PlainValue = UnwrapOpaque<Value>;\nexpectAssignable<PlainValue>(123);\n\nconst plainValue: PlainValue = 123 as PlainValue;\nexpectNotType<Value>(plainValue);\n\n// UnwrapOpque should work even when the token _happens_ to make the Opaque type\n// have the same underlying structure as a Tagged type.\nexpectType<number>(4 as UnwrapOpaque<Opaque<number, {x: void}>>);\n\n// All the basic tests that apply to Opaque types should pass for Tagged types too.\n// See rationale for each test in the Opaque tests above.\n//\n// Tests around not providing a token, which Tagged requires, or using non-\n// `string | number | symbol` tags, which Tagged doesn't support, are excluded.\ntype TaggedValue = Tagged<number, 'Value'>;\ntype TaggedUUID = Tagged<string, 'UUID'>;\n\nconst taggedValue: TaggedValue = 2 as TaggedValue;\nexpectAssignable<number>(taggedValue);\nexpectNotAssignable<TaggedValue>(value + 2);\nexpectAssignable<number>(value + 2);\n\nconst userEntities2: Record<TaggedUUID, Foo> = {\n\t['7dd4a16e-d5ee-454c-b1d0-71e23d9fa70b' as UUID]: {bar: 'John'},\n\t['6ce31270-31eb-4a72-a9bf-43192d4ab436' as UUID]: {bar: 'Doe'},\n};\n\nconst johnsId2 = '7dd4a16e-d5ee-454c-b1d0-71e23d9fa70b' as TaggedUUID;\n\nconst userJohn2 = userEntities2[johnsId2];\nexpectType<Foo | undefined>(userJohn2);\n\n// Tagged types should support multiple tags,\n// by intersection or repeated application of Tagged.\ntype AbsolutePath = Tagged<string, 'AbsolutePath'>;\ntype NormalizedPath = Tagged<string, 'NormalizedPath'>;\ntype NormalizedAbsolutePath = AbsolutePath & NormalizedPath;\n\ntype UrlString = Tagged<string, 'URL'>;\ntype SpecialCacheKey = Tagged<UrlString, 'SpecialCacheKey'>;\n\nexpectNotAssignable<NormalizedPath>('' as AbsolutePath);\nexpectNotAssignable<NormalizedAbsolutePath>('' as AbsolutePath);\nexpectAssignable<AbsolutePath>('' as NormalizedAbsolutePath);\nexpectAssignable<NormalizedPath>('' as NormalizedAbsolutePath);\n\nexpectNotAssignable<SpecialCacheKey>('' as UrlString);\nexpectAssignable<UrlString>('' as SpecialCacheKey);\n\n// A tag that is a union type should be treated as multiple tags.\n// This is the only practical-to-implement behavior, given how we're storing the tags.\n// However, it's also arguably the desirable behavior, and it's what the TS team planned to implement:\n// https://github.com/microsoft/TypeScript/pull/33290#issuecomment-529710519\nexpectAssignable<Tagged<number, 'Y'>>(4 as Tagged<number, 'X' | 'Y'>);\n\n// UnwrapOpaque and UnwrapTagged both work on Tagged types.\ntype PlainValueUnwrapOpaque = UnwrapOpaque<TaggedValue>;\ntype PlainValueUnwrapTagged = UnwrapTagged<TaggedValue>;\n\nconst unwrapped1 = 123 as PlainValueUnwrapOpaque;\nconst unwrapped2 = 123 as PlainValueUnwrapTagged;\n\nexpectType<number>(unwrapped1);\nexpectType<number>(unwrapped2);\n\n// UnwrapTagged/UnwrapOpaque should work on types with multiple tags.\nconst unwrapped3 = '' as UnwrapTagged<NormalizedAbsolutePath>;\nconst unwrapped4 = '' as UnwrapOpaque<NormalizedAbsolutePath>;\nexpectType<string>(unwrapped3);\nexpectType<string>(unwrapped4);\n\n// Tags have no metadata by default\nexpectType<never>(undefined as unknown as GetTagMetadata<UrlString, 'URL'>);\n\n// Metadata can be accurately recovered\ntype JsonOf<T> = Tagged<string, 'JSON', T>;\nexpectType<number>(JSON.parse('43') as GetTagMetadata<JsonOf<number>, 'JSON'>);\n\n// It's a type error to try to get the metadata for a tag that doesn't exist on a type.\n// @ts-expect-error\nconst _a = '' as GetTagMetadata<UrlString, 'NonExistentTag'>;\n\n// Tagged types should be covariant in their metadata type\nexpectAssignable<JsonOf<number>>('' as JsonOf<42>);\nexpectAssignable<JsonOf<number>>('' as JsonOf<number>);\nexpectNotAssignable<JsonOf<number>>('' as JsonOf<number | string>);\n\n// InvariantOf should work with tag metadata.\nexpectNotAssignable<JsonOf<InvariantOf<number>>>('' as JsonOf<string | number>);\nexpectNotAssignable<JsonOf<InvariantOf<number>>>('' as JsonOf<42>);\nexpectAssignable<JsonOf<InvariantOf<number>>>(\n\t'' as JsonOf<InvariantOf<number>>,\n);\n\n// Test for issue https://github.com/sindresorhus/type-fest/issues/643\ntype IdType = Opaque<number, 'test'>;\ntype TestSnakeObject = SnakeCasedPropertiesDeep<{testId: IdType}>;\nexpectType<TestSnakeObject>({test_id: 2 as IdType});\n"
  },
  {
    "path": "test-d/optional-keys-of.ts",
    "content": "import {expectType} from 'tsd';\nimport type {OptionalKeysOf, UnknownRecord} from '../index.d.ts';\n\ntype TestType1 = {\n\ta: string;\n\tb?: boolean;\n};\n\ntype TestType2 = {\n\ta?: string;\n\tb?: boolean;\n};\n\ntype TestType3 = {\n\ta: string;\n\tb: boolean;\n};\n\ntype OptionalKeysOf1 = OptionalKeysOf<TestType1>;\ntype OptionalKeysOf2 = OptionalKeysOf<TestType2>;\ntype OptionalKeysOf3 = OptionalKeysOf<TestType3>;\n\ndeclare const test1: OptionalKeysOf1;\ndeclare const test2: OptionalKeysOf2;\ndeclare const test3: OptionalKeysOf3;\n\nexpectType<'b'>(test1);\nexpectType<'a' | 'b'>(test2);\nexpectType<never>(test3);\n\nexpectType<'a' | 'c'>({} as OptionalKeysOf<{readonly a?: string; readonly b: number; c?: boolean; d: string}>);\n\n// Unions\nexpectType<'b' | 'c'>({} as OptionalKeysOf<{a: string; b?: number} | {readonly c?: string; readonly d: number}>);\nexpectType<'a' | 'b'>({} as OptionalKeysOf<{a: string; b: number} | {a?: string; b?: number}>);\n\n// Arrays\nexpectType<never>({} as OptionalKeysOf<[]>);\nexpectType<never>({} as OptionalKeysOf<readonly [string, number, boolean]>);\nexpectType<'1' | '2'>({} as OptionalKeysOf<[string, number?, boolean?]>);\nexpectType<'0' | '1' | '2'>({} as OptionalKeysOf<[string?] | readonly [string, number?] | [string, number, boolean?]>);\n\n// `OptionalKeysOf<T>` should be assignable to `keyof T`\ntype Assignability1<T, _K extends keyof T> = unknown;\ntype Test1<T extends object> = Assignability1<T, OptionalKeysOf<T>>;\n\n// `keyof T` should NOT be assignable to `OptionalKeysOf<T>`\ntype Assignability2<T extends object, _K extends OptionalKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test2<T extends object> = Assignability2<T, keyof T>;\n\n// `OptionalKeysOf<T>` should be assignable to `PropertyKey`\ntype Assignability3<_T, _K extends PropertyKey> = unknown;\ntype Test3<T extends object> = Assignability3<T, OptionalKeysOf<T>>;\n\n// `PropertyKey` should NOT be assignable to `OptionalKeysOf<T>`\ntype Assignability4<T extends object, _K extends OptionalKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test4<T extends object> = Assignability4<T, PropertyKey>;\n\n// `OptionalKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability5<T extends Record<string, unknown>, _K extends keyof T> = unknown;\ntype Test5<T extends Record<string, unknown>> = Assignability5<T, OptionalKeysOf<T>>;\n\n// `OptionalKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `object`\ntype Assignability6<T extends object, _K extends keyof T> = unknown;\ntype Test6<T extends object> = Assignability6<T, OptionalKeysOf<T>>;\n\n// `OptionalKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `UnknownRecord`\ntype Assignability7<T extends UnknownRecord, _K extends keyof T> = unknown;\ntype Test7<T extends UnknownRecord> = Assignability7<T, OptionalKeysOf<T>>;\n\n// `keyof T` should NOT be assignable to `OptionalKeysOf<T>` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability8<T extends Record<string, unknown>, _K extends OptionalKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test8<T extends Record<string, unknown>> = Assignability8<T, keyof T>;\n\n// `keyof T` should NOT be assignable to `OptionalKeysOf<T>` even when `T` is constrained to `object`\ntype Assignability9<T extends object, _K extends OptionalKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test9<T extends object> = Assignability9<T, keyof T>;\n\n// `keyof T` should NOT be assignable to `OptionalKeysOf<T>` even when `T` is constrained to `UnknownRecord`\ntype Assignability10<T extends UnknownRecord, _K extends OptionalKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test10<T extends UnknownRecord> = Assignability10<T, keyof T>;\n"
  },
  {
    "path": "test-d/optional.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Optional} from '../index.d.ts';\n\n// Basic\nexpectType<string | undefined>({} as Optional<string>);\nexpectType<{foo: string} | undefined>({} as Optional<{foo: string}>);\nexpectType<'foo' | undefined>({} as Optional<'foo'>);\nexpectType<42 | undefined>({} as Optional<42>);\nexpectType<boolean | undefined>({} as Optional<boolean>);\nexpectType<string | number | undefined>({} as Optional<string | number>);\nexpectType<(() => void) | undefined>({} as Optional<() => void>);\n\n// Strips `null`\nexpectType<string | undefined>({} as Optional<string | null>);\nexpectType<string | undefined>({} as Optional<string | null | undefined>);\nexpectType<number | boolean | undefined>({} as Optional<number | null | boolean>);\nexpectType<true | undefined>({} as Optional<true | null>);\n\n// Already `undefined` (idempotent)\nexpectType<string | undefined>({} as Optional<string | undefined>);\n\n// Pure `null` becomes `undefined` (`null` is stripped, `undefined` remains)\ndeclare const pureNull: Optional<null>;\nexpectType<undefined>(pureNull);\n\n// `null | undefined` becomes `undefined`\ndeclare const nullOrUndefined: Optional<null | undefined>;\nexpectType<undefined>(nullOrUndefined);\n\n// Pure `undefined` stays `undefined`\ndeclare const pureUndefined: Optional<undefined>;\nexpectType<undefined>(pureUndefined);\n\n// Nested `Optional` is idempotent\nexpectType<string | undefined>({} as Optional<Optional<string>>);\n\n// `void`\ndeclare const voidOptional: Optional<void>;\nexpectType<void | undefined>(voidOptional);\n\n// Edge cases\nexpectType<any>({} as Optional<any>);\ndeclare const neverOptional: Optional<never>;\nexpectType<undefined>(neverOptional);\n// `unknown | undefined` simplifies to `unknown`\nexpectType<unknown>({} as Optional<unknown>);\n"
  },
  {
    "path": "test-d/or-all.ts",
    "content": "import {expectType} from 'tsd';\nimport type {OrAll} from '../source/or-all.d.ts';\n\ndeclare const boolean: boolean;\n\n// Basic boolean combinations\nexpectType<OrAll<[true, false]>>(true);\nexpectType<OrAll<[false, true]>>(true);\nexpectType<OrAll<[true, true]>>(true);\nexpectType<OrAll<[false, false]>>(false);\n\n// Multiple elements in a tuple\nexpectType<OrAll<[false, false, false, true]>>(true);\nexpectType<OrAll<[false, false, false, false]>>(false);\n\n// `boolean` element\nexpectType<OrAll<[false, false, boolean]>>(boolean);\nexpectType<OrAll<[false, boolean, true]>>(true);\nexpectType<OrAll<[boolean, boolean, boolean]>>(boolean);\n\n// Unions\nexpectType<OrAll<[false, false, true] | [false, false, false]>>(boolean); // `true` | `false`\nexpectType<OrAll<[false, true, false] | [true]>>(true); // `true` | `true`\nexpectType<OrAll<[false] | [false, false, false]>>(false); // `false` | `false`\nexpectType<OrAll<[true, false] | [false, boolean]>>(boolean); // `true` | `boolean`\nexpectType<OrAll<[false, false] | [false, false, boolean]>>(boolean); // `false` | `boolean`\nexpectType<OrAll<[boolean, false, false] | [boolean]>>(boolean); // `boolean` | `boolean`\n\n// Tuples with rest element\nexpectType<OrAll<[false, ...Array<false>]>>(false);\nexpectType<OrAll<[...Array<false>, true]>>(true);\nexpectType<OrAll<[false, ...Array<false>, boolean]>>(boolean);\n\n// Non-tuple arrays\nexpectType<OrAll<Array<true>>>(true);\nexpectType<OrAll<Array<false>>>(false);\nexpectType<OrAll<boolean[]>>(boolean);\n\n// Readonly arrays\nexpectType<OrAll<readonly [true, false, true]>>(true);\nexpectType<OrAll<readonly [false, false, false]>>(false);\nexpectType<OrAll<readonly [false, false, boolean]>>(boolean);\nexpectType<OrAll<ReadonlyArray<true>>>(true);\nexpectType<OrAll<ReadonlyArray<false>>>(false);\nexpectType<OrAll<readonly boolean[]>>(boolean);\n\n// Boundary cases\nexpectType<OrAll<[]>>(false);\n\nexpectType<OrAll<[any, any, false]>>(boolean);\nexpectType<OrAll<[any, any, true]>>(true);\nexpectType<OrAll<[any, any, any]>>(boolean);\n\nexpectType<OrAll<[never, never, false]>>(false);\nexpectType<OrAll<[never, never, true]>>(true);\nexpectType<OrAll<[never, never, never]>>(false);\n\n// Errors with non-boolean or optional elements\n// @ts-expect-error\ntype Error1 = OrAll<[1, 0]>;\n// @ts-expect-error\ntype Error2 = OrAll<[true, false?]>;\n"
  },
  {
    "path": "test-d/or.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Or} from '../source/or.d.ts';\n\ndeclare const boolean: boolean;\n\nexpectType<Or<true, true>>(true);\nexpectType<Or<true, false>>(true);\nexpectType<Or<false, true>>(true);\nexpectType<Or<false, false>>(false);\n\nexpectType<Or<true, boolean>>(true);\nexpectType<Or<boolean, true>>(true);\nexpectType<Or<false, boolean>>(boolean);\nexpectType<Or<boolean, false>>(boolean);\nexpectType<Or<boolean, boolean>>(boolean);\n\n// Boundary cases\nexpectType<Or<true, any>>(true);\nexpectType<Or<any, true>>(true);\nexpectType<Or<false, any>>(boolean);\nexpectType<Or<any, false>>(boolean);\nexpectType<Or<boolean, any>>(boolean);\nexpectType<Or<any, boolean>>(boolean);\nexpectType<Or<any, any>>(boolean);\n\nexpectType<Or<true, never>>(true);\nexpectType<Or<never, true>>(true);\nexpectType<Or<false, never>>(false);\nexpectType<Or<never, false>>(false);\nexpectType<Or<boolean, never>>(boolean);\nexpectType<Or<never, boolean>>(boolean);\nexpectType<Or<never, never>>(false);\n"
  },
  {
    "path": "test-d/override-properties.ts",
    "content": "import {expectType} from 'tsd';\nimport {expectTypeOf} from 'expect-type';\nimport type {OverrideProperties} from '../source/override-properties.d.ts';\n\ntype Foo = {\n\ta: number;\n\tb: string;\n};\n\nconst fixture: OverrideProperties<Foo, {b: number}> = {a: 1, b: 2};\nexpectType<{a: number; b: number}>(fixture);\n\n// @ts-expect-error\ntype Bar1 = OverrideProperties<Foo, {c: number}>;\n\n// @ts-expect-error\ntype Bar2 = OverrideProperties<Foo, {b: number; c: number}>;\n\n// Test for https://github.com/sindresorhus/type-fest/issues/858\n{ // eslint-disable-line no-lone-blocks\n\ttype Original = {\n\t\tfoo: string;\n\t\tbar: string;\n\t};\n\n\ttype Modified = {\n\t\tfoo: string | undefined;\n\t\tbar: string;\n\t};\n\n\ttype Final = OverrideProperties<Original, Modified>;\n\n\texpectTypeOf<Final>().toMatchTypeOf<{foo: string | undefined; bar: string}>();\n}\n"
  },
  {
    "path": "test-d/package-json.ts",
    "content": "import {expectType, expectAssignable, expectNotAssignable} from 'tsd';\nimport type {PackageJson, LiteralUnion, JsonObject} from '../index.d.ts';\n\nconst packageJson: PackageJson = {};\n\nexpectType<string | undefined>(packageJson.name);\nexpectType<string | undefined>(packageJson.version);\nexpectType<string | undefined>(packageJson.description);\nexpectType<string[] | undefined>(packageJson.keywords);\nexpectType<LiteralUnion<'.', string> | undefined>(packageJson.homepage);\nexpectType<PackageJson.BugsLocation | undefined>(packageJson.bugs);\nexpectType<string | undefined>(packageJson.license);\nexpectType<Array<{type?: string; url?: string}> | undefined>(packageJson.licenses);\nexpectType<PackageJson.Person | undefined>(packageJson.author);\nexpectType<PackageJson.Person[] | undefined>(packageJson.contributors);\nexpectType<PackageJson.Person[] | undefined>(packageJson.maintainers);\nexpectType<string[] | undefined>(packageJson.files);\nexpectType<string | undefined>(packageJson.main);\nexpectType<string | undefined>(packageJson.packageManager);\nexpectType<string | Partial<Record<string, string>> | undefined>(packageJson.bin);\nexpectType<string | undefined>(packageJson.types);\nexpectType<string | undefined>(packageJson.typings);\nexpectType<string | string[] | undefined>(packageJson.man);\nexpectType<PackageJson.DirectoryLocations | undefined>(packageJson.directories);\nexpectType<{type: string; url: string; directory?: string} | string | undefined>(\n\tpackageJson.repository,\n);\nexpectType<PackageJson.Scripts | undefined>(packageJson.scripts);\nexpectType<JsonObject | undefined>(packageJson.config);\nexpectType<PackageJson.Dependency | undefined>(packageJson.dependencies);\nexpectType<PackageJson.Dependency | undefined>(packageJson.devDependencies);\nexpectType<PackageJson.Dependency | undefined>(\n\tpackageJson.optionalDependencies,\n);\nexpectType<PackageJson.Dependency | undefined>(packageJson.peerDependencies);\nexpectType<string[] | undefined>(packageJson.bundleDependencies);\nexpectType<string[] | undefined>(packageJson.bundledDependencies);\nexpectType<PackageJson.Dependency | undefined>(packageJson.resolutions);\nexpectType<keyof PackageJson.Dependency>({} as string);\nexpectType<PackageJson.WorkspaceConfig | string[] | undefined>(packageJson.workspaces);\nexpectAssignable<PackageJson['overrides']>({foo: '1.0.0'});\nexpectAssignable<PackageJson['overrides']>({foo: {'.': '1.0.0', bar: '1.0.0'}});\nexpectAssignable<PackageJson['overrides']>({baz: {bar: {foo: '1.0.0'}}});\nexpectAssignable<PackageJson['overrides']>({foo: undefined});\nexpectAssignable<PackageJson['overrides']>({foo: {bar: undefined}});\nexpectType<keyof PackageJson.DependencyOverrides>({} as string);\nexpectAssignable<PackageJson.DevEngineDependency>({\n\tname: 'unicorn',\n\tversion: '>= 1.0.0',\n\tonFail: 'ignore',\n});\nexpectType<{[EngineName in LiteralUnion<'npm' | 'node', string>]?: string} | undefined>(packageJson.engines);\nexpectAssignable<Partial<Record<string, string>> | undefined>(packageJson.engines);\nexpectType<boolean | undefined>(packageJson.engineStrict);\nexpectAssignable<\n\t| undefined\n\t| Array<LiteralUnion<\n'darwin' | 'linux' | 'win32' | '!darwin' | '!linux' | '!win32',\n\t\tstring\n\t>>\n>(packageJson.os);\nexpectAssignable<\n\t| undefined\n\t| Array<LiteralUnion<\n'x64' | 'ia32' | 'arm' | 'mips' | '!x64' | '!ia32' | '!arm' | '!mips',\n\t\tstring\n\t>>\n>(packageJson.cpu);\nexpectAssignable<PackageJson.Imports>({'#unicorn': 'unicorn'});\nexpectAssignable<PackageJson.Imports>({\n\t'#unicorn': {\n\t\timport: {browser: 'unicorn', node: 'pony'},\n\t\trequire: ['./fallback-1', './fallback-2', {default: './fallback-3', browser: null}],\n\t\tcustom: null,\n\t\tdefault: 'horse',\n\t},\n});\nexpectAssignable<PackageJson.Exports>({\n\t'./unicorn': {\n\t\timport: {browser: './unicorn.js', node: './pony.js'},\n\t\trequire: ['./fallback-1', './fallback-2', {default: './fallback-3', browser: null}],\n\t\tcustom: null,\n\t\tdefault: './horse.js',\n\t},\n});\nexpectNotAssignable<PackageJson.Exports>({\n\t'./unicorn': undefined,\n});\nexpectNotAssignable<PackageJson.Imports>({unicorn: 'unicorn'});\nexpectType<boolean | undefined>(packageJson.preferGlobal);\nexpectType<boolean | undefined>(packageJson.private);\nexpectType<PackageJson.PublishConfig | undefined>(packageJson.publishConfig);\nexpectType<string | undefined>(packageJson.module);\nexpectType<\n\t| string\n\t| {\n\t\t[moduleName: string]: string | undefined;\n\t\tmain?: string;\n\t\tbrowser?: string;\n\t}\n\t| undefined\n>(packageJson.esnext);\nexpectType<PackageJson | undefined>(packageJson.jspm);\n\n// Undefined assigns\nexpectAssignable<PackageJson.Dependency>({dep: undefined});\nexpectAssignable<typeof packageJson['engines']>({engine: undefined});\nexpectAssignable<typeof packageJson['scripts']>({unknownScript: undefined});\nexpectAssignable<typeof packageJson['bin']>({bin: undefined});\nexpectAssignable<typeof packageJson['typesVersions']>({\n\t'>=4': {\n\t\t'*': ['src'],\n\t\tsomethingElse: undefined,\n\t},\n\t'<4': undefined,\n});\n\n// Must reject an object that contains properties with `undefined` values.\n// See https://github.com/sindresorhus/type-fest/issues/272\ndeclare function setConfig(config: JsonObject): void;\n\n// @ts-expect-error\nsetConfig({bugs: undefined});\n// @ts-expect-error\nsetConfig({bugs: {life: undefined}});\n\nexpectNotAssignable<JsonObject>({bugs: undefined});\nexpectNotAssignable<JsonObject>({bugs: {life: undefined}});\n\nexpectAssignable<JsonObject>({});\nexpectAssignable<JsonObject>({bugs: 42});\nexpectAssignable<JsonObject>({bugs: [42]});\nexpectAssignable<JsonObject>({bugs: {life: 42}});\n\n// `PackageJson` should be a valid `JsonObject`.\n// See https://github.com/sindresorhus/type-fest/issues/79\ntype UnknownRecord = Record<string, unknown>;\n\nconst unknownRecord: UnknownRecord = {};\nconst jsonObject: JsonObject = {};\n\nexpectAssignable<UnknownRecord>(packageJson);\nexpectNotAssignable<PackageJson>(unknownRecord);\n\nexpectAssignable<PackageJson>(jsonObject);\nexpectAssignable<JsonObject>(packageJson);\n"
  },
  {
    "path": "test-d/partial-deep.ts",
    "content": "import {expectType, expectAssignable, expectNotType} from 'tsd';\nimport type {PartialDeep, Simplify} from '../index.d.ts';\n\nclass ClassA {\n\tfoo = 1;\n}\n\nconst foo = {\n\tbaz: 'fred',\n\tbar: {\n\t\tfunction: (_: string): void => undefined,\n\t\tclassConstructor: ClassA,\n\t\tobject: {key: 'value'},\n\t\tstring: 'waldo',\n\t\tnumber: 1,\n\t\tboolean: false,\n\t\tdate: new Date(),\n\t\tregexp: /.*/,\n\t\tsymbol: Symbol('test'),\n\t\tnull: null,\n\t\tundefined: undefined, // eslint-disable-line object-shorthand\n\t\tmap: new Map<string, string>(),\n\t\tset: new Set<string>(),\n\t\tarray: ['foo'],\n\t\ttuple: ['foo'] as ['foo'],\n\t\treadonlyMap: new Map<string, string>() as ReadonlyMap<string, string>,\n\t\treadonlySet: new Set<string>() as ReadonlySet<string>,\n\t\treadonlyArray: ['foo'] as readonly string[],\n\t\treadonlyTuple: ['foo'] as const,\n\t},\n};\n\nlet partialDeepFoo: PartialDeep<typeof foo, {recurseIntoArrays: true}> = foo;\n\n// @ts-expect-error\nexpectType<Partial<typeof foo>>(partialDeepFoo);\nconst partialDeepBar: PartialDeep<typeof foo.bar, {recurseIntoArrays: true}> = foo.bar;\nexpectType<typeof partialDeepBar | undefined>(partialDeepFoo.bar);\n// Check for constructor\nexpectType<typeof ClassA | undefined>(partialDeepFoo.bar!.classConstructor);\nconst instance = new partialDeepFoo.bar!.classConstructor!();\ninstance.foo = 2;\nconst b = partialDeepFoo.bar!.constructor;\nexpectType<((_: string) => void) | undefined>(partialDeepFoo.bar!.function);\nexpectAssignable<object | undefined>(partialDeepFoo.bar!.object);\nexpectType<string | undefined>(partialDeepFoo.bar!.string);\nexpectType<number | undefined>(partialDeepFoo.bar!.number);\nexpectType<boolean | undefined>(partialDeepFoo.bar!.boolean);\nexpectType<Date | undefined>(partialDeepFoo.bar!.date);\nexpectType<RegExp | undefined>(partialDeepFoo.bar!.regexp);\nexpectType<symbol | undefined>(partialDeepFoo.bar!.symbol);\nexpectType<null | undefined>(partialDeepFoo.bar!.null);\nexpectType<undefined>(partialDeepFoo.bar!.undefined);\nexpectAssignable<Map<string | undefined, string | undefined> | undefined>(partialDeepFoo.bar!.map);\nexpectAssignable<Set<string | undefined> | undefined>(partialDeepFoo.bar!.set);\nexpectType<string[] | undefined>(partialDeepFoo.bar!.array);\nexpectType<['foo'?] | undefined>(partialDeepFoo.bar!.tuple);\nexpectAssignable<ReadonlyMap<string | undefined, string | undefined> | undefined>(partialDeepFoo.bar!.readonlyMap);\nexpectAssignable<ReadonlySet<string | undefined> | undefined>(partialDeepFoo.bar!.readonlySet);\nexpectType<readonly string[] | undefined>(partialDeepFoo.bar!.readonlyArray);\nexpectType<readonly ['foo'?] | undefined>(partialDeepFoo.bar!.readonlyTuple);\n// Check for compiling with omitting partial keys\npartialDeepFoo = {baz: 'fred'};\npartialDeepFoo = {bar: {string: 'waldo'}};\npartialDeepFoo = {bar: {date: new Date()}};\n// Check that recursive array evaluation isn't infinite depth\ntype Recurse =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| Record<string, Recurse[]>\n\t| Recurse[];\ntype RecurseObject = {value: Recurse};\nconst recurseObject: RecurseObject = {value: null};\nexpectAssignable<PartialDeep<RecurseObject>>(recurseObject);\n\n// Check that `{recurseIntoArrays: false}` is the default\nconst partialDeepNoRecurseIntoArraysFoo: PartialDeep<typeof foo> = foo;\n// Check that `{recurseIntoArrays: true}` behaves as intended\nexpectType<PartialDeep<typeof foo, {recurseIntoArrays: true}>>(partialDeepFoo);\n\n// Check that `{allowUndefinedInNonTupleArrays: false}` is the default\nconst partialDeepAllowUndefinedInNonTupleArraysFoo: PartialDeep<typeof foo, {recurseIntoArrays: true}> = foo;\nexpectType<string[] | undefined>(partialDeepAllowUndefinedInNonTupleArraysFoo.bar!.array);\n// Check that `{allowUndefinedInNonTupleArrays: true}` behaves as intended\nconst partialDeepDoNotAllowUndefinedInNonTupleArraysFoo: PartialDeep<typeof foo, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}> = foo;\nexpectType<Array<string | undefined> | undefined>(partialDeepDoNotAllowUndefinedInNonTupleArraysFoo.bar!.array);\n\n// These are mostly the same checks as before, but the array/tuple types are different.\n// @ts-expect-error\nexpectType<Partial<typeof foo>>(partialDeepNoRecurseIntoArraysFoo);\nconst partialDeepNoRecurseIntoArraysBar: PartialDeep<typeof foo.bar, {recurseIntoArrays: false}> = foo.bar;\nexpectType<typeof partialDeepNoRecurseIntoArraysBar | undefined>(partialDeepNoRecurseIntoArraysFoo.bar);\nexpectType<((_: string) => void) | undefined>(partialDeepNoRecurseIntoArraysBar.function);\nexpectAssignable<object | undefined>(partialDeepNoRecurseIntoArraysBar.object);\nexpectType<string | undefined>(partialDeepNoRecurseIntoArraysBar.string);\nexpectType<number | undefined>(partialDeepNoRecurseIntoArraysBar.number);\nexpectType<boolean | undefined>(partialDeepNoRecurseIntoArraysBar.boolean);\nexpectType<Date | undefined>(partialDeepNoRecurseIntoArraysBar.date);\nexpectType<RegExp | undefined>(partialDeepNoRecurseIntoArraysBar.regexp);\nexpectType<symbol | undefined>(partialDeepNoRecurseIntoArraysBar.symbol);\nexpectType<null | undefined>(partialDeepNoRecurseIntoArraysBar.null);\nexpectType<undefined>(partialDeepNoRecurseIntoArraysBar.undefined);\nexpectAssignable<Map<string | undefined, string | undefined> | undefined>(partialDeepNoRecurseIntoArraysBar.map);\nexpectAssignable<Set<string | undefined> | undefined>(partialDeepNoRecurseIntoArraysBar.set);\nexpectType<string[] | undefined>(partialDeepNoRecurseIntoArraysBar.array);\nexpectType<['foo'] | undefined>(partialDeepNoRecurseIntoArraysBar.tuple);\nexpectAssignable<ReadonlyMap<string | undefined, string | undefined> | undefined>(partialDeepNoRecurseIntoArraysBar.readonlyMap);\nexpectAssignable<ReadonlySet<string | undefined> | undefined>(partialDeepNoRecurseIntoArraysBar.readonlySet);\nexpectType<readonly string[] | undefined>(partialDeepNoRecurseIntoArraysBar.readonlyArray);\nexpectType<readonly ['foo'] | undefined>(partialDeepNoRecurseIntoArraysBar.readonlyTuple);\n\ntype FunctionWithProperties = {(a1: string, a2: number): boolean; p1: string; readonly p2: number};\ndeclare const functionWithProperties: PartialDeep<FunctionWithProperties>;\nexpectType<boolean>(functionWithProperties('foo', 1));\nexpectType<{p1?: string; readonly p2?: number}>({} as Simplify<typeof functionWithProperties>); // `Simplify` removes the call signature from `typeof functionWithProperties`\n\ntype FunctionWithProperties2 = {(a1: boolean, ...a2: string[]): number; p1: {p2?: string; p3: {readonly p4?: boolean}}};\ndeclare const functionWithProperties2: PartialDeep<FunctionWithProperties2>;\nexpectType<number>(functionWithProperties2(true, 'foo', 'bar'));\nexpectType<{p1?: {p2?: string; p3?: {readonly p4?: boolean}}}>({} as Simplify<typeof functionWithProperties2>);\n\ntype FunctionWithProperties3 = {(): void; p1: {p2?: string; p3: [{p4: number}, string]}};\ndeclare const functionWithProperties3: PartialDeep<FunctionWithProperties3, {recurseIntoArrays: true}>;\nexpectType<void>(functionWithProperties3());\nexpectType<{p1?: {p2?: string; p3?: [{p4?: number}?, string?]}}>({} as Simplify<typeof functionWithProperties3>);\n\nexpectType<{p1?: string[]}>({} as Simplify<PartialDeep<{(): void; p1: string[]}, {allowUndefinedInNonTupleArrays: false}>>);\nexpectType<{p1?: string[]}>({} as Simplify<PartialDeep<{(): void; p1: string[]}, {allowUndefinedInNonTupleArrays: true}>>);\n\n// Properties within functions containing multiple call signatures are not made partial due to TS limitations, refer https://github.com/microsoft/TypeScript/issues/29732\ntype FunctionWithProperties4 = {(a1: number): string; (a1: string, a2: number): number; p1: string};\ndeclare const functionWithProperties4: PartialDeep<FunctionWithProperties4>;\nexpectType<string>(functionWithProperties4(1));\nexpectType<number>(functionWithProperties4('foo', 1));\nexpectNotType<{p1?: string}>({} as Simplify<typeof functionWithProperties4>);\n"
  },
  {
    "path": "test-d/partial-on-undefined-deep.ts",
    "content": "import {expectAssignable, expectType} from 'tsd';\nimport type {PartialOnUndefinedDeep} from '../index.d.ts';\n\ntype TestingType = {\n\tfunction: (() => void) | undefined;\n\tobject: {objectKey: 1} | undefined;\n\tobjectDeep: {\n\t\tsubObject: string | undefined;\n\t};\n\tstring: string | undefined;\n\tunion: 'test1' | 'test2' | undefined;\n\tnumber: number | undefined;\n\tboolean: boolean | undefined;\n\tdate: Date | undefined;\n\tregexp: RegExp | undefined;\n\tsymbol: symbol | undefined;\n\tnull: null | undefined;\n\trecord: Record<string, any> | undefined;\n\tmap: Map<string, string> | undefined;\n\tset: Set<string> | undefined;\n\tarray1: any[] | undefined;\n\tarray2: Array<{propertyA: string; propertyB: number | undefined}> | undefined;\n\treadonly1: readonly any[] | undefined;\n\treadonly2: ReadonlyArray<{propertyA: string; propertyB: number | undefined}> | undefined;\n\treadonly readonlyProperty: string | undefined;\n\ttuple: ['test1', {propertyA: string; propertyB: number | undefined}] | undefined;\n};\ndeclare const indexType: {[k: string]: string | undefined; propertyA: string; propertyB: string | undefined};\ndeclare const indexTypeUnknown: {[k: string]: unknown; propertyA: string; propertyB: number | undefined};\n\n// Default behavior, without recursion into arrays/tuples\ndeclare const foo: PartialOnUndefinedDeep<TestingType>;\nexpectAssignable<{\n\tfunction?: TestingType['function'];\n\tobject?: TestingType['object'];\n\tobjectDeep: {\n\t\tsubObject?: TestingType['objectDeep']['subObject'];\n\t};\n\tstring?: TestingType['string'];\n\tunion?: TestingType['union'];\n\tnumber?: TestingType['number'];\n\tboolean?: TestingType['boolean'];\n\tdate?: TestingType['date'];\n\tregexp?: TestingType['regexp'];\n\tsymbol?: TestingType['symbol'];\n\tnull?: TestingType['null'];\n\trecord?: TestingType['record'];\n\tmap?: TestingType['map'];\n\tset?: TestingType['set'];\n\tarray1?: TestingType['array1'];\n\tarray2?: TestingType['array2'];\n\treadonly1?: TestingType['readonly1'];\n\treadonly2?: TestingType['readonly2'];\n\treadonly readonlyProperty?: TestingType['readonlyProperty'];\n\ttuple?: TestingType['tuple'];\n}>(foo);\n\ndeclare const indexTypeWithoutRecursion: PartialOnUndefinedDeep<typeof indexType>;\ndeclare const indexTypeUnknownWithoutRecursion: PartialOnUndefinedDeep<typeof indexTypeUnknown>;\nexpectType<{[k: string]: string | undefined; propertyA: string; propertyB?: string | undefined}>(indexTypeWithoutRecursion);\nexpectType<{[k: string]: unknown; propertyA: string; propertyB?: number | undefined}>(indexTypeUnknownWithoutRecursion);\n\n// With recursion into arrays/tuples activated\ndeclare const bar: PartialOnUndefinedDeep<TestingType, {recurseIntoArrays: true}>;\nexpectAssignable<{\n\tfunction?: TestingType['function'];\n\tobject?: TestingType['object'];\n\tobjectDeep: {\n\t\tsubObject?: TestingType['objectDeep']['subObject'];\n\t};\n\tstring?: TestingType['string'];\n\tunion?: TestingType['union'];\n\tnumber?: TestingType['number'];\n\tboolean?: TestingType['boolean'];\n\tdate?: TestingType['date'];\n\tregexp?: TestingType['regexp'];\n\tsymbol?: TestingType['symbol'];\n\tnull?: TestingType['null'];\n\trecord?: TestingType['record'];\n\tmap?: TestingType['map'];\n\tset?: TestingType['set'];\n\tarray1?: TestingType['array1'];\n\tarray2?: Array<{propertyA: string; propertyB?: number | undefined}> | undefined;\n\treadonly1?: TestingType['readonly1'];\n\treadonly2?: ReadonlyArray<{propertyA: string; propertyB?: number | undefined}> | undefined;\n\treadonly readonlyProperty?: TestingType['readonlyProperty'];\n\ttuple?: ['test1', {propertyA: string; propertyB?: number | undefined}] | undefined;\n}>(bar);\n\ndeclare const indexTypeWithRecursion: PartialOnUndefinedDeep<typeof indexType, {recurseIntoArrays: true}>;\ndeclare const indexTypeUnknownWithRecursion: PartialOnUndefinedDeep<typeof indexTypeUnknown, {recurseIntoArrays: true}>;\nexpectType<{[k: string]: string | undefined; propertyA: string; propertyB?: string | undefined}>(indexTypeWithRecursion);\nexpectType<{[k: string]: unknown; propertyA: string; propertyB?: number | undefined}>(indexTypeUnknownWithRecursion);\n"
  },
  {
    "path": "test-d/pascal-case.ts",
    "content": "import {expectType} from 'tsd';\nimport type {PascalCase} from '../index.d.ts';\n\nconst pascalFromCamel: PascalCase<'fooBar'> = 'FooBar';\nexpectType<'FooBar'>(pascalFromCamel);\n\nconst pascalFromKebab: PascalCase<'foo-bar'> = 'FooBar';\nexpectType<'FooBar'>(pascalFromKebab);\n\nconst pascalFromComplexKebab: PascalCase<'foo-bar-abc-123'> = 'FooBarAbc123';\nexpectType<'FooBarAbc123'>(pascalFromComplexKebab);\n\nexpectType<PascalCase<'fooBAR'>>('FooBar');\nexpectType<PascalCase<'fooBAR', {preserveConsecutiveUppercase: true}>>('FooBAR');\n\nexpectType<PascalCase<'fooBARBiz'>>('FooBarBiz');\nexpectType<PascalCase<'fooBARBiz', {preserveConsecutiveUppercase: true}>>('FooBARBiz');\n\nexpectType<PascalCase<'foo BAR-Biz_BUZZ', {preserveConsecutiveUppercase: true}>>('FooBARBizBUZZ');\nexpectType<PascalCase<'foo BAR-Biz_BUZZ', {preserveConsecutiveUppercase: false}>>('FooBarBizBuzz');\nexpectType<PascalCase<'foo\\tBAR-Biz_BUZZ'>>('FooBarBizBuzz');\n\nexpectType<PascalCase<string, {preserveConsecutiveUppercase: true}>>({} as Capitalize<string>);\nexpectType<PascalCase<string>>({} as Capitalize<string>);\n"
  },
  {
    "path": "test-d/pascal-cased-properties-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {PascalCasedPropertiesDeep} from '../index.d.ts';\n\ndeclare const foo: PascalCasedPropertiesDeep<{helloWorld: {fooBar: string}}>;\nexpectType<{HelloWorld: {FooBar: string}}>(foo);\n\ndeclare const fooBar: PascalCasedPropertiesDeep<() => {a: string}>;\nexpectType<() => {a: string}>(fooBar);\n\ndeclare const bar: PascalCasedPropertiesDeep<Set<{fooBar: string}>>;\nexpectType<Set<{FooBar: string}>>(bar);\n\n// Verify example\ntype User = {\n\tuserId: number;\n\tuserName: string;\n\tdate: Date;\n\tregExp: RegExp;\n};\n\ntype UserWithFriends = {\n\tuserInfo: User;\n\tuserFriends: User[];\n};\n\nconst result: PascalCasedPropertiesDeep<UserWithFriends> = {\n\tUserInfo: {\n\t\tUserId: 1,\n\t\tUserName: 'Tom',\n\t\tDate: new Date(),\n\t\tRegExp: /.*/,\n\t},\n\tUserFriends: [\n\t\t{\n\t\t\tUserId: 2,\n\t\t\tUserName: 'Jerry',\n\t\t\tDate: new Date(),\n\t\t\tRegExp: /.*/,\n\t\t},\n\t\t{\n\t\t\tUserId: 3,\n\t\t\tUserName: 'Spike',\n\t\t\tDate: new Date(),\n\t\t\tRegExp: /.*/,\n\t\t},\n\t],\n};\nexpectType<PascalCasedPropertiesDeep<UserWithFriends>>(result);\n\nexpectType<{'FooBar': unknown}>({} as PascalCasedPropertiesDeep<{foo_bar: unknown}>);\nexpectType<{'FooBar': {'BarBaz': unknown}; Biz: unknown}>({} as PascalCasedPropertiesDeep<{foo_bar: {bar_baz: unknown}; biz: unknown}>);\n\nexpectType<{'FooBar': any}>({} as PascalCasedPropertiesDeep<{foo_bar: any}>);\nexpectType<{'FooBar': {'BarBaz': any}; Biz: any}>({} as PascalCasedPropertiesDeep<{foo_bar: {bar_baz: any}; biz: any}>);\n\ntype bazBizDeep = {fooBAR: number; baz: {fooBAR: Array<{BARFoo: string}>}};\n\ndeclare const baz: PascalCasedPropertiesDeep<bazBizDeep, {preserveConsecutiveUppercase: true}>;\nexpectType<{FooBAR: number; Baz: {FooBAR: Array<{BARFoo: string}>}}>(baz);\n\ndeclare const biz: PascalCasedPropertiesDeep<bazBizDeep>;\nexpectType<{FooBar: number; Baz: {FooBar: Array<{BarFoo: string}>}}>(biz);\n"
  },
  {
    "path": "test-d/pascal-cased-properties.ts",
    "content": "import {expectType} from 'tsd';\nimport type {PascalCasedProperties} from '../index.d.ts';\n\ndeclare const foo: PascalCasedProperties<{helloWorld: {fooBar: string}}>;\nexpectType<{HelloWorld: {fooBar: string}}>(foo);\n\ndeclare const bar: PascalCasedProperties<Array<{helloWorld: string}>>;\nexpectType<Array<{helloWorld: string}>>(bar);\n\ndeclare const fooBar: PascalCasedProperties<() => {a: string}>;\nexpectType<() => {a: string}>(fooBar);\n\n// Verify example\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\nconst result: PascalCasedProperties<User> = {\n\tUserId: 1,\n\tUserName: 'Tom',\n};\nexpectType<PascalCasedProperties<User>>(result);\n\ndeclare const baz: PascalCasedProperties<{fooBAR: number; BARFoo: string}, {preserveConsecutiveUppercase: true}>;\nexpectType<{FooBAR: number; BARFoo: string}>(baz);\n\ndeclare const biz: PascalCasedProperties<{fooBAR: number; BARFoo: string}>;\nexpectType<{FooBar: number; BarFoo: string}>(biz);\n"
  },
  {
    "path": "test-d/paths.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {Paths, UnknownArray} from '../index.d.ts';\nimport type {MapsSetsOrArrays, NonRecursiveType} from '../source/internal/type.d.ts';\n\ndeclare const normal: Paths<{foo: string}>;\nexpectType<'foo'>(normal);\n\ntype DeepObject = {\n\ta: {\n\t\tb: {\n\t\t\tc: {\n\t\t\t\td: string;\n\t\t\t};\n\t\t};\n\t\tb2: number[];\n\t\tb3: boolean;\n\t};\n};\ndeclare const deepObject: Paths<DeepObject>;\ntype DeepPath = 'a' | 'a.b' | 'a.b2' | 'a.b3' | 'a.b.c' | 'a.b.c.d' | `a.b2.${number}`;\nexpectType<DeepPath>(deepObject);\n\n// Test for interface\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ninterface InterfaceType extends DeepObject {}\ndeclare const interfaceType: Paths<InterfaceType>;\nexpectType<DeepPath>(interfaceType);\n\ndeclare const emptyObject: Paths<{}>;\nexpectType<never>(emptyObject);\n\ndeclare const emptyArray: Paths<[]>;\nexpectType<never>(emptyArray);\n\ndeclare const symbol: Paths<{[Symbol.iterator]: string}>;\nexpectType<never>(symbol);\n\ndeclare const never: Paths<never>;\nexpectType<never>(never);\n\ndeclare const date: Paths<{foo: Date}>;\nexpectType<'foo'>(date);\n\ndeclare const mixed: Paths<{foo: boolean} | {bar: string}>;\nexpectType<'foo' | 'bar'>(mixed);\n\ndeclare const array: Paths<Array<{foo: string}>>;\nexpectType<number | `${number}` | `${number}.foo`>(array);\n\ndeclare const tuple: Paths<[{foo: string}]>;\nexpectType<'0' | '0.foo'>(tuple);\n\ndeclare const deeplist: Paths<{foo: Array<{bar: boolean[]}>}>;\nexpectType<'foo' | `foo.${number}` | `foo.${number}.bar` | `foo.${number}.bar.${number}`>(deeplist);\n\ndeclare const readonly: Paths<{foo: Readonly<{bar: string}>}>;\nexpectType<'foo' | 'foo.bar'>(readonly);\n\ndeclare const readonlyArray: Paths<{foo: readonly string[]}>;\nexpectType<'foo' | `foo.${number}`>(readonlyArray);\n\ndeclare const optional: Paths<{foo?: {bar?: number}}>;\nexpectType<'foo' | 'foo.bar'>(optional);\n\ndeclare const record: Paths<Record<'a', any>>;\nexpectType<'a'>(record);\n\ndeclare const record2: Paths<Record<1, unknown>>;\nexpectType<1 | '1'>(record2);\n\ndeclare const map: Paths<{foo?: {bar?: Map<string, number>}}>;\nexpectType<'foo' | 'foo.bar'>(map);\n\ndeclare const map2: Paths<Map<string, number>>;\nexpectType<never>(map2);\n\ndeclare const readonlyMap: Paths<{foo?: {bar?: ReadonlyMap<string, number>}}>;\nexpectType<'foo' | 'foo.bar'>(readonlyMap);\n\ndeclare const readonlyMap2: Paths<ReadonlyMap<string, number>>;\nexpectType<never>(readonlyMap2);\n\ndeclare const weakMap: Paths<{foo?: {bar?: WeakMap<{a: string}, number>}}>;\nexpectType<'foo' | 'foo.bar'>(weakMap);\n\ndeclare const weakMap2: Paths<WeakMap<{a: string}, number>>;\nexpectType<never>(weakMap2);\n\ndeclare const set: Paths<{foo?: {bar?: Set<string>}}>;\nexpectType<'foo' | 'foo.bar'>(set);\n\ndeclare const set2: Paths<Set<string>>;\nexpectType<never>(set2);\n\ndeclare const readonlySet: Paths<{foo?: {bar?: ReadonlySet<string>}}>;\nexpectType<'foo' | 'foo.bar'>(readonlySet);\n\ndeclare const readonlySet2: Paths<ReadonlySet<string>>;\nexpectType<never>(readonlySet2);\n\ndeclare const weakSet: Paths<{foo?: {bar?: WeakSet<{a: string}>}}>;\nexpectType<'foo' | 'foo.bar'>(weakSet);\n\ndeclare const weakSet2: Paths<WeakSet<{a: string}>>;\nexpectType<never>(weakSet2);\n\ndeclare const nonRecursives: Paths<{a: NonRecursiveType | Exclude<MapsSetsOrArrays, UnknownArray>}>;\nexpectType<'a'>(nonRecursives);\n\n// Test for unknown length array\ndeclare const trailingSpreadTuple: Paths<[{a: string}, ...Array<{b: number}>]>;\nexpectType<number | `${number}` | '0.a' | `${number}.b`>(trailingSpreadTuple);\n\ndeclare const trailingSpreadTuple1: Paths<[{a: string}, {b: number}, ...Array<{c: number}>]>;\nexpectType<number | `${number}` | '0.a' | '1.b' | `${number}.c`>(trailingSpreadTuple1);\n\ndeclare const optionalElementsWithTrailingSpreadTuple: Paths<{foo: [{a: string}, ({b: number})?, ...Array<{c: number}>]}>;\nexpectType<'foo' | `foo.${number}` | 'foo.0.a' | 'foo.1.b' | `foo.${number}.c`>(optionalElementsWithTrailingSpreadTuple);\n\ndeclare const optionalElementsWithTrailingSpreadTuple1: Paths<[({a: string})?, ({b: number})?, ...Array<{c: number}>]>;\nexpectType<number | `${number}` | '0.a' | '1.b' | `${number}.c`>(optionalElementsWithTrailingSpreadTuple1);\n\ndeclare const leadingSpreadTuple: Paths<[...Array<{a: string}>, {b: number}]>;\nexpectType<number | `${number}` | `${number}.b` | `${number}.a`>(leadingSpreadTuple);\n\ndeclare const leadingSpreadTuple1: Paths<[...Array<{a: string}>, {b: number}, {c: number}]>;\nexpectType<number | `${number}` | `${number}.b` | `${number}.c` | `${number}.a`>(leadingSpreadTuple1);\n\ndeclare const middleSpreadTuple: Paths<[{a: string}, ...Array<{b: number}>, {c: boolean}]>;\nexpectType<number | `${number}` | '0.a' | `${number}.b` | `${number}.c`>(middleSpreadTuple);\n\n// Circularly references\ntype MyEntity = {\n\tmyOtherEntity?: MyOtherEntity;\n};\ntype MyOtherEntity = {\n\tmyEntity?: MyEntity;\n};\ntype MyEntityPaths = Paths<MyEntity>;\nexpectAssignable<string>({} as MyEntityPaths);\n\n// By default, the recursion limit should be reasonably long\ntype RecursiveFoo = {foo: RecursiveFoo};\nexpectAssignable<Paths<RecursiveFoo, {maxRecursionDepth: 10}>>('foo.foo.foo.foo.foo.foo.foo.foo');\n\ndeclare const recursion0: Paths<RecursiveFoo, {maxRecursionDepth: 0}>;\nexpectType<'foo'>(recursion0);\n\ndeclare const recursion1: Paths<RecursiveFoo, {maxRecursionDepth: 1}>;\nexpectType<'foo' | 'foo.foo'>(recursion1);\n\n// Test a[0].b style\ntype Object1 = {\n\tarr: [{a: string}];\n};\nexpectType<Paths<Object1, {bracketNotation: true}>>({} as 'arr' | 'arr[0]' | 'arr[0].a');\n\ntype Object2 = {\n\tarr: Array<{a: string}>;\n\tarr1: string[];\n};\nexpectType<Paths<Object2, {bracketNotation: true}>>({} as 'arr' | 'arr1' | `arr[${number}]` | `arr[${number}].a` | `arr1[${number}]`);\n\ntype Object3 = {\n\t1: 'foo';\n\t'2': 'bar';\n};\nexpectType<Paths<Object3, {bracketNotation: true}>>({} as '[1]' | '[2]');\n\ntype Object4 = {\n\t1: {\n\t\ta: string;\n\t};\n};\nexpectType<Paths<Object4, {bracketNotation: true}>>({} as '[1]' | '[1].a');\n\ntype Object5 = {\n\t1: {\n\t\t2: string;\n\t};\n};\nexpectType<Paths<Object5, {bracketNotation: true}>>({} as '[1]' | '[1][2]');\n\ntype deepArray = {\n\tarr: Array<Array<Array<{a: string}>>>;\n};\nexpectType<Paths<deepArray, {bracketNotation: true}>>({} as 'arr' | `arr[${number}]` | `arr[${number}][${number}]` | `arr[${number}][${number}][${number}]` | `arr[${number}][${number}][${number}].a`);\n\ntype RecursionArray = RecursionArray[];\ntype RecursionArrayPaths = Paths<RecursionArray, {bracketNotation: true; maxRecursionDepth: 3}>;\nexpectAssignable<RecursionArrayPaths>({} as `[${number}][${number}][${number}][${number}]`);\nexpectNotAssignable<RecursionArrayPaths>({} as `[${number}][${number}][${number}][${number}][${number}]`);\n\n// -- leavesOnly option --\n\ndeclare const leaves: Paths<{a: {b: string; c?: Date; d: (x: string) => number; e: Map<string, string>; f?: {g?: Set<string>}}; h: boolean}, {leavesOnly: true}>;\nexpectType<'a.b' | 'a.c' | 'a.d' | 'a.e' | 'a.f.g' | 'h'>(leaves);\n\ndeclare const unionLeaves: Paths<{a: {b?: number}} | {a: string; b?: {c: string}}, {leavesOnly: true}>;\nexpectType<'a.b' | 'a' | 'b.c'>(unionLeaves);\n\ndeclare const unionLeaves1: Paths<{a: {} | {c: number}}, {leavesOnly: true}>;\nexpectType<'a' | 'a.c'>(unionLeaves1);\n\ndeclare const unionLeaves2: Paths<{a: {[x: string]: number} | {c: number}}, {leavesOnly: true}>;\nexpectType<`a.${string}`>(unionLeaves2); // Collapsed union\n\ndeclare const unionLeaves3: Paths<{a: string | {toLowerCase: number}}, {leavesOnly: true}>;\nexpectType<'a' | 'a.toLowerCase'>(unionLeaves3);\n\ndeclare const emptyObjectLeaves: Paths<{a: {}}, {leavesOnly: true}>;\nexpectType<'a'>(emptyObjectLeaves);\n\ndeclare const emptyArrayLeaves: Paths<{a: []}, {leavesOnly: true}>;\nexpectType<'a'>(emptyArrayLeaves);\n\ndeclare const readonlyEmptyArrayLeaves: Paths<{a: readonly []}, {leavesOnly: true}>;\nexpectType<'a'>(readonlyEmptyArrayLeaves);\n\ndeclare const arrayLeaves: Paths<string[], {leavesOnly: true}>;\nexpectType<number | `${number}`>(arrayLeaves);\n\ndeclare const tupleLeaves: Paths<[string, number?], {leavesOnly: true}>;\nexpectType<'0' | '1'>(tupleLeaves);\n\ndeclare const objectArrayLeaves: Paths<Array<{a: number}>, {leavesOnly: true}>;\nexpectType<`${number}.a`>(objectArrayLeaves);\n\ndeclare const objectTupleLeaves: Paths<readonly [{a?: number}?], {leavesOnly: true}>;\nexpectType<'0.a'>(objectTupleLeaves);\n\ndeclare const deepArrayLeaves: Paths<{a?: {b: readonly string[]}; c: boolean[]}, {leavesOnly: true}>;\nexpectType<`a.b.${number}` | `c.${number}`>(deepArrayLeaves);\n\ndeclare const deepTupleLeaves: Paths<{a: {b: [string, number]}}, {leavesOnly: true}>;\nexpectType<'a.b.0' | 'a.b.1'>(deepTupleLeaves);\n\ndeclare const deepObjectArrayLeaves: Paths<{a: {b: ReadonlyArray<{readonly c?: number; d: string}>}}, {leavesOnly: true}>;\nexpectType<`a.b.${number}.c` | `a.b.${number}.d`>(deepObjectArrayLeaves);\n\ndeclare const deepObjectTupleLeaves: Paths<{a: {readonly b: [{readonly c: string}, {d?: number}]}}, {leavesOnly: true}>;\nexpectType<'a.b.0.c' | 'a.b.1.d'>(deepObjectTupleLeaves);\n\ndeclare const nestedArrayLeaves: Paths<{a?: Array<Array<Array<{b: string}>>>}, {leavesOnly: true}>;\nexpectType<`a.${number}.${number}.${number}.b`>(nestedArrayLeaves);\n\ndeclare const nestedTupleLeaves: Paths<{a: [[[{b: string}]]?]}, {leavesOnly: true}>;\nexpectType<'a.0.0.0.b'>(nestedTupleLeaves);\n\ndeclare const trailingSpreadLeaves: Paths<[{a: string}, ...Array<{b: number}>], {leavesOnly: true}>;\nexpectType<'0.a' | `${number}.b`>(trailingSpreadLeaves);\n\ndeclare const trailingSpreadLeaves1: Paths<[{a: string}, {b: number}, ...Array<{c?: number}>], {leavesOnly: true}>;\nexpectType<'0.a' | '1.b' | `${number}.c`>(trailingSpreadLeaves1);\n\ndeclare const leadingSpreadLeaves: Paths<[...Array<{a?: string}>, {readonly b: number}], {leavesOnly: true}>;\nexpectType<`${number}.a` | `${number}.b`>(leadingSpreadLeaves);\n\ndeclare const leadingSpreadLeaves1: Paths<[...Array<{a?: string}>, {readonly b: number}, {c: number}], {leavesOnly: true}>;\nexpectType<`${number}.a` | `${number}.b` | `${number}.c`>(leadingSpreadLeaves1);\n\ndeclare const recursiveLeaves: Paths<RecursiveFoo, {leavesOnly: true; maxRecursionDepth: 10}>;\nexpectType<'foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo'>(recursiveLeaves);\n\ndeclare const recursiveWithMaxLeaves: Paths<RecursiveFoo, {maxRecursionDepth: 0; leavesOnly: true}>;\nexpectType<'foo'>(recursiveWithMaxLeaves);\n\ndeclare const recursiveWithMaxLeaves1: Paths<RecursiveFoo, {maxRecursionDepth: 1; leavesOnly: true}>;\nexpectType<'foo.foo'>(recursiveWithMaxLeaves1);\n\ndeclare const recursiveArrayLeaves: Paths<RecursionArray, {bracketNotation: true; maxRecursionDepth: 2; leavesOnly: true}>;\nexpectType<`[${number}][${number}][${number}]`>(recursiveArrayLeaves);\n\ndeclare const bracketArrayLeaves: Paths<{a: Array<{b: string; c?: string}>}, {bracketNotation: true; leavesOnly: true}>;\nexpectType<`a[${number}].b` | `a[${number}].c`>(bracketArrayLeaves);\n\ndeclare const bracketTupleLeaves: Paths<{a: [{b?: string}, {c: string}]}, {bracketNotation: true; leavesOnly: true}>;\nexpectType<'a[0].b' | 'a[1].c'>(bracketTupleLeaves);\n\ndeclare const bracketNumericLeaves: Paths<{a: {1: string; 2: number}}, {bracketNotation: true; leavesOnly: true}>;\nexpectType<'a[1]' | 'a[2]'>(bracketNumericLeaves);\n\ndeclare const bracketNestedArrayLeaves: Paths<{a: Array<Array<Array<{b: string}>>>}, {bracketNotation: true; leavesOnly: true}>;\nexpectType<`a[${number}][${number}][${number}].b`>(bracketNestedArrayLeaves);\n\ndeclare const mapLeaves: Paths<{a: {b: Map<string, number>; c: ReadonlyMap<string, number>}; d: WeakMap<{a: string}, number>}, {leavesOnly: true}>;\nexpectType<'a.b' | 'a.c' | 'd'>(mapLeaves);\n\ndeclare const setLeaves: Paths<{a: {b: Set<string>; c: ReadonlySet<string>}; d: WeakSet<{a: string}>}, {leavesOnly: true}>;\nexpectType<'a.b' | 'a.c' | 'd'>(setLeaves);\n\ndeclare const unknownLeaves: Paths<{a: {b: unknown}}, {leavesOnly: true}>;\nexpectType<'a.b'>(unknownLeaves);\n\ndeclare const anyLeaves: Paths<{a: {b: any}}, {leavesOnly: true}>;\nexpectType<'a.b'>(anyLeaves);\n\ndeclare const neverLeaves: Paths<{a: {b: never}}, {leavesOnly: true}>;\nexpectType<'a.b'>(neverLeaves);\n\n// -- depth option --\ndeclare const zeroDepth: Paths<DeepObject, {depth: 0}>;\nexpectType<'a'>(zeroDepth);\n\ndeclare const oneDepth: Paths<DeepObject, {depth: 1}>;\nexpectType<'a.b' | 'a.b2' | 'a.b3'>(oneDepth);\n\ndeclare const twoDepth: Paths<DeepObject, {depth: 2}>;\nexpectType<'a.b.c' | `a.b2.${number}`>(twoDepth);\n\ndeclare const threeDepth: Paths<DeepObject, {depth: 3}>;\nexpectType<'a.b.c.d'>(threeDepth);\n\ndeclare const unionDepth: Paths<{a: {readonly b?: string}} | {x: {y?: {z: number}}}, {depth: 1}>;\nexpectType<'a.b' | 'x.y'>(unionDepth);\n\ndeclare const unionDepth2: Paths<{a?: {b: string; readonly c: {d?: string}}} | {readonly x?: {y: string}}, {depth: 2}>;\nexpectType<'a.c.d'>(unionDepth2);\n\ndeclare const unionDepth3: Paths<DeepObject, {depth: 0 | 3}>;\nexpectType<'a' | 'a.b.c.d'>(unionDepth3);\n\ndeclare const unionDepth4: Paths<{a?: {b: string; readonly c: {d?: [string, number]}}} | {readonly x?: {y: string}}, {depth: 1 | 3}>;\nexpectType<'a.b' | 'a.c' | 'x.y' | 'a.c.d.0' | 'a.c.d.1'>(unionDepth4);\n\ndeclare const unionDepth5: Paths<{a: {b?: string}} | {x: {y?: {z: number}}}, {depth: 0 | 2}>;\nexpectType<'a' | 'x' | 'x.y.z'>(unionDepth5);\n\ndeclare const unreachableDepth: Paths<DeepObject, {depth: 4}>;\nexpectType<never>(unreachableDepth);\n\ndeclare const unreachableDepth2: Paths<{a: {}}, {depth: 1}>;\nexpectType<never>(unreachableDepth2);\n\ndeclare const unreachableDepth3: Paths<{a: readonly []}, {depth: 1}>;\nexpectType<never>(unreachableDepth3);\n\ndeclare const unreachableAndReachableDepth: Paths<{a: {b: string}}, {depth: 1 | 2}>;\nexpectType<'a.b'>(unreachableAndReachableDepth);\n\ndeclare const maxLessThanDepth: Paths<DeepObject, {maxRecursionDepth: 2; depth: 3}>;\nexpectType<never>(maxLessThanDepth);\n\ndeclare const maxLessThanDepth2: Paths<RecursiveFoo, {depth: 12}>; // Default `maxRecursionDepth` is 10\nexpectType<never>(maxLessThanDepth2);\n\ndeclare const maxSimilarToDepth: Paths<DeepObject, {maxRecursionDepth: 2; depth: 2}>;\nexpectType<'a.b.c' | `a.b2.${number}`>(maxSimilarToDepth);\n\ndeclare const maxSimilarToDepth2: Paths<RecursiveFoo, {maxRecursionDepth: 0; depth: 0}>;\nexpectType<'foo'>(maxSimilarToDepth2);\n\ndeclare const maxSimilarToDepth3: Paths<RecursiveFoo, {depth: 10; maxRecursionDepth: 10}>; // Default `maxRecursionDepth` is 10\nexpectType<'foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo'>(maxSimilarToDepth3);\n\ndeclare const maxMoreThanDepth: Paths<DeepObject, {maxRecursionDepth: 2; depth: 1}>;\nexpectType<'a.b' | 'a.b2' | 'a.b3'>(maxMoreThanDepth);\n\ndeclare const maxMoreThanDepth2: Paths<RecursiveFoo, {maxRecursionDepth: 6; depth: 3}>;\nexpectType<'foo.foo.foo.foo'>(maxMoreThanDepth2);\n\ndeclare const maxMoreAndLessThanDepth: Paths<RecursionArray, {maxRecursionDepth: 2; depth: 1 | 3}>;\nexpectType<`${number}.${number}`>(maxMoreAndLessThanDepth);\n\ndeclare const maxLessAndSimilarThanDepth: Paths<RecursionArray, {maxRecursionDepth: 1; depth: 0 | 1}>;\nexpectType<number | `${number}` | `${number}.${number}`>(maxLessAndSimilarThanDepth);\n\ndeclare const maxSimilarAndMoreThanDepth: Paths<RecursionArray, {maxRecursionDepth: 2; depth: 2 | 3}>;\nexpectType<`${number}.${number}.${number}`>(maxSimilarAndMoreThanDepth);\n\ndeclare const noLeavesAtDepth: Paths<DeepObject, {leavesOnly: true; depth: 0}>;\nexpectType<never>(noLeavesAtDepth);\n\ndeclare const onlyLeavesAtDepth: Paths<DeepObject, {leavesOnly: true; depth: 1}>;\nexpectType<'a.b3'>(onlyLeavesAtDepth);\n\ndeclare const onlyLeavesAtDepth2: Paths<DeepObject, {leavesOnly: true; depth: 2}>;\nexpectType<`a.b2.${number}`>(onlyLeavesAtDepth2);\n\ndeclare const deepArrayDepth: Paths<{a?: {b: readonly string[]}; c: boolean[]}, {depth: 0 | 2}>;\nexpectType<'a' | 'c' | `a.b.${number}`>(deepArrayDepth);\n\ndeclare const deepTupleDepth: Paths<{a: {b: [string, number]}}, {depth: 2}>;\nexpectType<'a.b.0' | 'a.b.1'>(deepTupleDepth);\n\ndeclare const deepObjectArrayDepth: Paths<{a: {b: ReadonlyArray<{readonly c?: number; d: string}>}}, {depth: 1 | 3}>;\nexpectType<'a.b' | `a.b.${number}.c` | `a.b.${number}.d`>(deepObjectArrayDepth);\n\ndeclare const deepObjectTupleDepth: Paths<{a: {readonly b: [{readonly c: string}, {d?: [number]}]}}, {leavesOnly: true; depth: 3}>;\nexpectType<'a.b.0.c'>(deepObjectTupleDepth);\n\ndeclare const nestedArrayDepth: Paths<{a?: Array<Array<Array<{b: string}>>>}, {depth: 1 | 2 | 3}>;\nexpectType<`a.${number}` | `a.${number}.${number}` | `a.${number}.${number}.${number}`>(nestedArrayDepth);\n\ndeclare const nestedTupleDepth: Paths<{a: [[[{b: string}]]?]}, {depth: 0 | 4}>;\nexpectType<'a' | 'a.0.0.0.b'>(nestedTupleDepth);\n\ndeclare const recursiveDepth: Paths<RecursiveFoo, {depth: 4}>;\nexpectType<'foo.foo.foo.foo.foo'>(recursiveDepth);\n\ndeclare const recursiveDepth2: Paths<RecursiveFoo, {depth: 1 | 3 | 8; maxRecursionDepth: 10}>;\nexpectType<'foo.foo' | 'foo.foo.foo.foo' | 'foo.foo.foo.foo.foo.foo.foo.foo.foo'>(recursiveDepth2);\n\n// For recursive types, leaves are at `maxRecursionDepth`\ndeclare const recursiveDepth3: Paths<RecursiveFoo, {leavesOnly: true; depth: 5; maxRecursionDepth: 10}>;\nexpectType<never>(recursiveDepth3);\n\ndeclare const recursiveDepth4: Paths<RecursiveFoo, {leavesOnly: true; depth: 5 | 10; maxRecursionDepth: 10}>; // No leaves at depth `5`\nexpectType<'foo.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo'>(recursiveDepth4);\n\ndeclare const recursiveDepth6: Paths<RecursiveFoo, {leavesOnly: true; maxRecursionDepth: 6; depth: 5}>; // Leaves are at depth `6`\nexpectType<never>(recursiveDepth6);\n\ndeclare const maxLeavesAndDepth: Paths<DeepObject, {leavesOnly: true; maxRecursionDepth: 2; depth: 2}>; // All depth `2` paths are leaves\nexpectType<'a.b.c' | `a.b2.${number}`>(maxLeavesAndDepth);\n\ndeclare const maxLeavesAndDepth2: Paths<DeepObject, {leavesOnly: true; maxRecursionDepth: 2; depth: 0 | 1 | 2}>;\nexpectType<'a.b3' | 'a.b.c' | `a.b2.${number}`>(maxLeavesAndDepth2);\n\ndeclare const recursiveBracketDepth: Paths<RecursionArray, {bracketNotation: true; depth: 3}>;\nexpectType<`[${number}][${number}][${number}][${number}]`>(recursiveBracketDepth);\n\ndeclare const recursiveBracketDepth2: Paths<RecursionArray, {bracketNotation: true; leavesOnly: true; depth: 3}>; // Leaves are at depth `10`\nexpectType<never>(recursiveBracketDepth2);\n\ndeclare const bracketArrayDepth: Paths<{a: Array<{b: string; c?: string}>}, {bracketNotation: true; depth: 1 | 2}>;\nexpectType<`a[${number}]` | `a[${number}].b` | `a[${number}].c`>(bracketArrayDepth);\n\ndeclare const bracketTupleDepth: Paths<{a: [{b?: string}, {c: string}]}, {bracketNotation: true; leavesOnly: true; depth: 0 | 2}>;\nexpectType<'a[0].b' | 'a[1].c'>(bracketTupleDepth);\n\ndeclare const bracketNumericDepth: Paths<{a: {1: string; 2: number}}, {bracketNotation: true; depth: 1}>;\nexpectType<'a[1]' | 'a[2]'>(bracketNumericDepth);\n\ndeclare const bracketNestedArrayDepth: Paths<{a: Array<Array<Array<{b: string}>>>}, {bracketNotation: true; depth: 2 | 4}>;\nexpectType<`a[${number}][${number}]` | `a[${number}][${number}][${number}].b`>(bracketNestedArrayDepth);\n\ndeclare const trailingSpreadDepth: Paths<[{a: string}, ...Array<{b: number}>], {depth: 1}>;\nexpectType<'0.a' | `${number}.b`>(trailingSpreadDepth);\n\ndeclare const leadingSpreadDepth: Paths<[...Array<{a?: string}>, {readonly b: number}], {depth: 0 | 1}>;\nexpectType<number | `${number}` | `${number}.b` | `${number}.a`>(leadingSpreadDepth);\n\ndeclare const negativeDepth: Paths<DeepObject, {depth: -1}>;\nexpectType<never>(negativeDepth);\n\ndeclare const positiveAndNegativeDepth: Paths<DeepObject, {depth: 1 | -1}>;\nexpectType<'a.b' | 'a.b2' | 'a.b3'>(positiveAndNegativeDepth);\n\ndeclare const zeroPositiveAndNegativeDepth: Paths<DeepObject, {depth: 0 | 2 | -4}>;\nexpectType<'a' | 'a.b.c' | `a.b2.${number}`>(zeroPositiveAndNegativeDepth);\n\ndeclare const neverDepth: Paths<DeepObject, {depth: never}>;\nexpectType<never>(neverDepth);\n\ndeclare const anyDepth: Paths<DeepObject, {depth: any}>;\nexpectType<'a' | 'a.b.c' | `a.b2.${number}` | 'a.b3' | 'a.b' | 'a.b2' | 'a.b.c.d'>(anyDepth);\n\n// Index signatures\ndeclare const indexSignature: Paths<{[x: string]: {a: string; b: number}}>;\nexpectType<string>(indexSignature); // Collapsed union\n\ndeclare const indexSignature1: Paths<{[x: Lowercase<string>]: {a: string; b: number}}>;\nexpectType<Lowercase<string> | `${Lowercase<string>}.a` | `${Lowercase<string>}.b`>(indexSignature1);\n\ndeclare const indexSignature2: Paths<{[x: number]: {0: string; 1: number}}>;\nexpectType<number | `${number}` | `${number}.0` | `${number}.1`>(indexSignature2);\n\ndeclare const indexSignature3: Paths<{[x: Uppercase<string>]: {a: string; b: number}}>;\nexpectType<Uppercase<string> | `${Uppercase<string>}.a` | `${Uppercase<string>}.b`>(indexSignature3);\n\ndeclare const indexSignature4: Paths<{a: {[x: symbol]: {b: number; c: number}}}>;\nexpectType<'a'>(indexSignature4);\n\ndeclare const indexSignatureWithStaticKeys: Paths<{[x: Uppercase<string>]: {a: string; b: number}; c: number}>;\nexpectType<'c' | Uppercase<string> | `${Uppercase<string>}.a` | `${Uppercase<string>}.b`>(indexSignatureWithStaticKeys);\n\ndeclare const indexSignatureWithStaticKeys1: Paths<{[x: Uppercase<string>]: {a: string; b?: number}; C: {a: 'a'}}>;\nexpectType<Uppercase<string> | `${Uppercase<string>}.a` | `${Uppercase<string>}.b`>(indexSignatureWithStaticKeys1); // Collapsed union\n\ndeclare const nonRootIndexSignature: Paths<{a: {[x: string]: {b: string; c: number}}}>;\nexpectType<'a' | `a.${string}` | `a.${string}.b` | `a.${string}.c`>(nonRootIndexSignature);\n\ndeclare const nonRootIndexSignature1: Paths<{a: {[x: Lowercase<string>]: {b: string; c: number}}}>;\nexpectType<'a' | `a.${Lowercase<string>}` | `a.${Lowercase<string>}.b` | `a.${Lowercase<string>}.c`>(nonRootIndexSignature1);\n\ndeclare const nestedIndexSignature: Paths<{[x: string]: {[x: Lowercase<string>]: {a: string; b: number}}}>;\nexpectType<string>(nestedIndexSignature);\n\ndeclare const nestedIndexSignature1: Paths<{[x: Uppercase<string>]: {[x: Lowercase<string>]: {a: string; b: number}}}>;\nexpectType<Uppercase<string> | `${Uppercase<string>}.${Lowercase<string>}` | `${Uppercase<string>}.${Lowercase<string>}.a` | `${Uppercase<string>}.${Lowercase<string>}.b`>(\n\tnestedIndexSignature1,\n);\n\ndeclare const indexSignatureUnion: Paths<{a: {[x: string]: number} | {b: number}}>;\nexpectType<'a' | `a.${string}`>(indexSignatureUnion); // Collapsed union\n\ndeclare const indexSignatureUnion1: Paths<{a: {[x: Uppercase<string>]: number} | {b: number}}>;\nexpectType<'a' | 'a.b' | `a.${Uppercase<string>}`>(indexSignatureUnion1);\n\ndeclare const indexSignatureLeaves: Paths<{[x: string]: {a: string; b: number}}, {leavesOnly: true}>;\nexpectType<`${string}.a` | `${string}.b`>(indexSignatureLeaves);\n\ndeclare const indexSignatureLeaves1: Paths<{a: {[x: string]: {b: string; c: number}}; d: string; e: {f: number}}, {leavesOnly: true}>;\nexpectType<`a.${string}.b` | `a.${string}.c` | 'd' | 'e.f'>(indexSignatureLeaves1);\n\ndeclare const indexSignatureLeaves2: Paths<{a: {[x: string]: [] | {b: number}}}, {leavesOnly: true}>;\nexpectType<`a.${string}` | `a.${string}.b`>(indexSignatureLeaves2);\n\ndeclare const indexSignatureDepth: Paths<{[x: string]: {a: string; b: number}}, {depth: 1}>;\nexpectType<`${string}.b` | `${string}.a`>(indexSignatureDepth);\n\ndeclare const indexSignatureDepth1: Paths<{[x: string]: {a: string; b: number}}, {depth: 0}>;\nexpectType<string>(indexSignatureDepth1);\n\ndeclare const indexSignatureDepth2: Paths<{[x: string]: {a: string; b: number}}, {depth: 0 | 1}>;\nexpectType<string>(indexSignatureDepth2); // Collapsed union\n\ndeclare const indexSignatureDepth3: Paths<{a: {[x: string]: {b: string; c: number}}; d: string; e: {f: number}}, {depth: 0 | 2}>;\nexpectType<'a' | `a.${string}.b` | `a.${string}.c` | 'd' | 'e'>(indexSignatureDepth3);\n\ndeclare const indexSignatureDepth4: Paths<{a: {[x: string]: [] | {b: number}}}, {depth: 2}>;\nexpectType<`a.${string}.b`>(indexSignatureDepth4);\n\ndeclare const indexSignatureDepthLeaves: Paths<{a: {[x: string]: {b: string; c: number}}; d: string; e: {f: number}}, {depth: 0 | 2; leavesOnly: true}>;\nexpectType<`a.${string}.b` | `a.${string}.c` | 'd'>(indexSignatureDepthLeaves);\n\n// Generic types\ntype PathsConstraint<T, _U extends Paths<T>> = never;\n\ntype Generic1<T> = {bar: {baz: T}};\ntype Test1<T> = PathsConstraint<Generic1<T>, 'bar.baz'>;\n\ntype Generic2<T, U> = {bar: {baz: {qux: T}; fizz: {buzz: U} | U | T}};\ntype Test2<T, U> = PathsConstraint<\n\tGeneric2<T, U>,\n\t'bar' | 'bar.baz' | 'bar.baz.qux' | 'bar.fizz' | 'bar.fizz.buzz'\n>;\n\ntype LeavesOnlyPathsConstraint<T, _U extends Paths<T, {leavesOnly: true}>> = never;\n\ntype Generic3<T> = {bar: {baz: T; qux: string}};\ntype Test3<T> = LeavesOnlyPathsConstraint<Generic3<T>, 'bar.qux'>;\n// @ts-expect-error\ntype Test4<T> = LeavesOnlyPathsConstraint<Generic3<T>, 'bar'>; // 'bar' is not a leaf\n// @ts-expect-error\ntype Test5<T> = LeavesOnlyPathsConstraint<Generic3<T>, 'bar.baz'>; // 'bar.baz' is not a leaf, because `T` is not known.\n\ntype DepthPathsConstraint<T, _U extends Paths<T, {depth: 1}>> = never;\n\ntype Generic4<T> = {bar: {baz: T}; qux: [T]};\ntype Test6<T> = DepthPathsConstraint<Generic4<T>, 'bar.baz' | 'qux.0'>;\n// @ts-expect-error\ntype Test7<T> = DepthPathsConstraint<Generic4<T>, 'bar'>; // 'bar' is not at depth `1`\n// @ts-expect-error\ntype Test8<T> = DepthPathsConstraint<Generic4<T>, 'qux'>; // 'qux' is not at depth `1`\n\ntype BracketNotationPathsConstraint<T, _U extends Paths<T, {bracketNotation: true}>> = never;\n\ntype Generic5<T> = {1: {2: T}; 3: [T]};\ntype Test9<T> = BracketNotationPathsConstraint<Generic5<T>, '[1]' | '[1][2]' | '[3]' | '[3][0]'>;\n\ntype MaxRecursionDepthPathsConstraint<T, _U extends Paths<T, {maxRecursionDepth: 2}>> = never;\n\ntype Generic6<T> = {foo: {bar: T}; baz: T; fizz: {buzz: {qux: {quxx: T}}}};\ntype Test10<T> = MaxRecursionDepthPathsConstraint<\n\tGeneric6<T>,\n\t'foo' | 'foo.bar' | 'baz' | 'fizz' | 'fizz.buzz' | 'fizz.buzz.qux'\n>;\n// @ts-expect-error\ntype Test11<T> = MaxRecursionDepthPathsConstraint<Generic6<T>, 'fizz.buzz.qux.quxx'>; // 'fizz.buzz.qux.quxx' is at depth `3`\n\ntype LeavesOnlyAndDepthPathsConstraint<T, _U extends Paths<T, {leavesOnly: true; depth: 1}>> = never;\n\ntype Generic7<T> = {foo: {bar: T; baz: string; fizz: {buzz: number}}; qux: string};\ntype Test12<T> = LeavesOnlyAndDepthPathsConstraint<Generic7<T>, 'foo.baz'>;\n// @ts-expect-error\ntype Test13<T> = LeavesOnlyAndDepthPathsConstraint<Generic7<T>, 'qux'>; // 'qux' is a leaf, but not at depth `1`.\n// @ts-expect-error\ntype Test14<T> = LeavesOnlyAndDepthPathsConstraint<Generic7<T>, 'foo.fizz'>; // 'foo.fizz' is at depth `1`, but not a leaf.\n// @ts-expect-error\ntype Test15<T> = LeavesOnlyAndDepthPathsConstraint<Generic7<T>, 'foo.bar'>; // 'foo.bar' is at depth `1`, but not a leaf because `T` is not known.\n"
  },
  {
    "path": "test-d/pick-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {PickDeep} from '../index.d.ts';\n\ndeclare class ClassA {\n\ta: string;\n}\n\ntype BaseType = {\n\tstring: string;\n\toptionalString?: string;\n\tarray: number[];\n\treadonlyArray: readonly number[];\n\ttuples: ['foo', 'bar'];\n\tobjectArray: Array<{a: 1; b: 2}>;\n\tleadingSpreadArray: [...Array<{a: 1}>, {b: 2}];\n\ttailingSpreadArray: [{a: 1}, {b: {c: 2; other: 2}}, ...Array<{d: 3}>];\n\tobjectTuple: [{a: 1}];\n\tnumber: number;\n\tboolean: boolean;\n\tdate: Date;\n\tClass: typeof ClassA;\n\tinstance: ClassA;\n\t0: number;\n};\n\ntype Testing = BaseType & {\n\tobject: BaseType;\n\toptionalObject?: Partial<BaseType>;\n\toptionalString?: string;\n\treadonly readonlyObject: {a: 1};\n\t1: BaseType;\n\t2?: BaseType;\n};\n\ndeclare const normal: PickDeep<Testing, 'string'>;\nexpectType<{string: string}>(normal);\n\ntype DeepType = {\n\tnested: {\n\t\tdeep: {\n\t\t\tdeeper: {\n\t\t\t\tvalue: string;\n\t\t\t\tvalue1: number;\n\t\t\t};\n\t\t};\n\t};\n\tfoo: string;\n};\ntype DepthType = {nested: {deep: {deeper: {value: string}}}};\n\ndeclare const deep: PickDeep<DeepType, 'nested.deep.deeper.value'>;\nexpectType<DepthType>(deep);\n\n// Test interface\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ninterface DeepInterface extends DeepType {\n\tbar: {\n\t\tnumber: number;\n\t\tstring: string;\n\t};\n}\ndeclare const deepInterface: PickDeep<DeepInterface, 'nested.deep.deeper.value'>;\nexpectType<DepthType>(deepInterface);\ndeclare const deepInterface2: PickDeep<DeepInterface, 'bar.number'>;\nexpectType<{bar: {number: number}}>(deepInterface2);\n\ntype GenericType<T> = {\n\tgenericKey: T;\n};\ndeclare const genericTest: PickDeep<GenericType<number>, 'genericKey'>;\nexpectType<{genericKey: number}>(genericTest);\n\ndeclare const union: PickDeep<Testing, 'object.number' | 'object.string'>;\nexpectType<{object: {number: number; string: string}}>(union);\n\ndeclare const optional: PickDeep<Testing, 'optionalObject.optionalString'>;\nexpectType<{optionalObject?: {optionalString?: string}}>(optional);\n\ndeclare const optionalUnion: PickDeep<Testing, 'optionalObject.string' | 'object.number'>;\nexpectType<{optionalObject?: {string?: string}; object: {number: number}}>(optionalUnion);\n\ndeclare const readonlyTest: PickDeep<Testing, 'readonlyObject.a'>;\nexpectType<{readonly readonlyObject: {a: 1}}>(readonlyTest);\n\ndeclare const array: PickDeep<Testing, 'object.array'>;\nexpectType<{object: {array: number[]}}>(array);\n\ndeclare const readonlyArray: PickDeep<Testing, 'object.readonlyArray'>;\nexpectType<{object: {readonlyArray: readonly number[]}}>(readonlyArray);\n\ndeclare const tuple: PickDeep<Testing, 'object.tuples'>;\nexpectType<{object: {tuples: ['foo', 'bar']}}>(tuple);\n\ndeclare const objectArray1: PickDeep<Testing, `object.objectArray.${number}`>;\nexpectType<{object: {objectArray: Array<{a: 1; b: 2}>}}>(objectArray1);\n\ndeclare const objectArray2: PickDeep<Testing, `object.objectArray.${number}.a`>;\nexpectType<{object: {objectArray: Array<{a: 1}>}}>(objectArray2);\n\ndeclare const leadingSpreadArray1: PickDeep<Testing, `object.leadingSpreadArray.${number}.a`>;\nexpectType<{object: {leadingSpreadArray: [...Array<{a: 1}>]}}>(leadingSpreadArray1);\n\ndeclare const leadingSpreadArray2: PickDeep<Testing, `object.leadingSpreadArray.${number}`>;\nexpectType<{object: {leadingSpreadArray: [...Array<{a: 1}>, {b: 2}]}}>(leadingSpreadArray2);\n\ndeclare const tailingSpreadArray1: PickDeep<Testing, 'object.tailingSpreadArray.1'>;\nexpectType<{object: {tailingSpreadArray: [unknown, {b: {c: 2; other: 2}}]}}>(tailingSpreadArray1);\n\ndeclare const tailingSpreadArray2: PickDeep<Testing, 'object.tailingSpreadArray.1.b.c'>;\nexpectType<{object: {tailingSpreadArray: [unknown, {b: {c: 2}}]}}>(tailingSpreadArray2);\n\ndeclare const date: PickDeep<Testing, 'object.date'>;\nexpectType<{object: {date: Date}}>(date);\n\ndeclare const instance: PickDeep<Testing, 'object.instance'>;\nexpectType<{object: {instance: ClassA}}>(instance);\n\ndeclare const classTest: PickDeep<Testing, 'object.Class'>;\nexpectType<{object: {Class: typeof ClassA}}>(classTest);\n\ndeclare const numberTest: PickDeep<Testing, '1'>;\nexpectType<{1: BaseType}>(numberTest);\n\ndeclare const numberTest2: PickDeep<Testing, '1.0'>;\nexpectType<{1: {0: number}}>(numberTest2);\n\ndeclare const numberTest3: PickDeep<Testing, '2.0'>;\nexpectType<{2?: {0: number}}>(numberTest3);\n"
  },
  {
    "path": "test-d/pick-index-signature.ts",
    "content": "import {expectType} from 'tsd';\nimport type {PickIndexSignature, Simplify} from '../index.d.ts';\n\ndeclare const symbolKey: unique symbol;\n\ntype Foo = {\n\t[x: string]: unknown;\n\t[x: number]: unknown;\n\t[x: symbol]: unknown;\n\t[x: `head-${string}`]: string;\n\t[x: `${string}-tail`]: string;\n\t[x: `head-${string}-tail`]: string;\n\t[x: `${bigint}`]: string;\n\t[x: `embedded-${number}`]: string;\n};\n\ntype Bar = {\n\t['kebab-case-key']: string;\n\t[symbolKey]: string;\n\tfoo: 'bar';\n\tqux?: 'baz';\n};\n\ntype FooBar = Simplify<Foo & Bar>;\n\ndeclare const indexSignature: PickIndexSignature<FooBar>;\n\nexpectType<Foo>(indexSignature);\n"
  },
  {
    "path": "test-d/promisable.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Promisable} from '../index.d.ts';\n\ndeclare const promisable: Promisable<string>;\nexpectType<PromiseLike<string> | string>(promisable);\n"
  },
  {
    "path": "test-d/readonly-deep.ts",
    "content": "import {expectType, expectAssignable} from 'tsd';\nimport type {Opaque, tag} from '../source/tagged.d.ts';\nimport type {ReadonlyDeep, _ReadonlyObjectDeep} from '../source/readonly-deep.d.ts';\nimport type {JsonValue} from '../source/json-value.d.ts';\n\ntype Overloaded = {\n\t(foo: number): string;\n\t(foo: string, bar: number): number;\n};\n\ntype Namespace = {\n\t(foo: number): string;\n\tbaz: boolean[];\n};\n\ntype NamespaceWithOverload = Overloaded & {\n\tbaz: boolean[];\n};\n\ntype OpaqueObjectData = {a: number[]} | {b: string};\ntype OpaqueObject = Opaque<OpaqueObjectData, {token: unknown}>;\n\ntype ReadonlyJsonValue =\n\t| {readonly [k: string]: ReadonlyJsonValue}\n\t| readonly ReadonlyJsonValue[]\n\t| number\n\t| string\n\t| boolean\n\t| null;\n\nclass ClassA {\n\tfoo = 1;\n}\n\nconst data = {\n\tobject: {\n\t\tfoo: 'bar',\n\t},\n\tconstructor: ClassA,\n\tfn: (_: string) => true,\n\tfnWithOverload: ((_: number) => 'foo') as Overloaded,\n\tnamespace: {} as unknown as Namespace,\n\tnamespaceWithOverload: {} as unknown as NamespaceWithOverload,\n\tstring: 'foo',\n\tnumber: 1,\n\tboolean: false,\n\tsymbol: Symbol('test'),\n\tdate: new Date(),\n\tregExp: /.*/,\n\tnull: null,\n\tundefined: undefined, // eslint-disable-line object-shorthand\n\tmap: new Map<string, string>(),\n\tset: new Set<string>(),\n\tarray: ['foo'],\n\temptyTuple: [] as [],\n\tsingleItemTuple: ['foo'] as ['foo'],\n\tmultiItemTuple: [{a: ''}, {b: 4}, {c: ''}] as [{a: string}, {b: number}, {c: string}],\n\ttrailingSpreadTuple: ['foo', 1] as [string, ...number[]],\n\tleadingSpreadTuple: ['foo', 1] as [...string[], number],\n\treadonlyMap: new Map<string, string>() as ReadonlyMap<string, string>,\n\treadonlySet: new Set<string>() as ReadonlySet<string>,\n\treadonlyArray: ['foo'] as readonly string[],\n\treadonlyTuple: ['foo'] as const,\n\tjson: [{x: true}] as JsonValue,\n\topaqueObj: {a: [3]} as OpaqueObject, // eslint-disable-line @typescript-eslint/consistent-type-assertions\n};\n\nconst readonlyData: ReadonlyDeep<typeof data> = data;\nreadonlyData.fn('foo');\n\nreadonlyData.fnWithOverload(1);\nreadonlyData.fnWithOverload('', 1);\n\nexpectType<typeof ClassA>(readonlyData.constructor);\nconst instance = new readonlyData.constructor();\ninstance.foo = 2; // Constructor is not made readonly\n\n// @ts-expect-error\nreadonlyData.string = 'bar';\nexpectType<{readonly foo: string}>(readonlyData.object);\nexpectType<string>(readonlyData.string);\nexpectType<number>(readonlyData.number);\nexpectType<boolean>(readonlyData.boolean);\nexpectType<symbol>(readonlyData.symbol);\nexpectType<null>(readonlyData.null);\nexpectType<undefined>(readonlyData.undefined);\nexpectType<Date>(readonlyData.date);\nexpectType<RegExp>(readonlyData.regExp);\nexpectType<Readonly<ReadonlyMap<string, string>>>(readonlyData.map);\nexpectType<Readonly<ReadonlySet<string>>>(readonlyData.set);\nexpectType<readonly string[]>(readonlyData.array);\nexpectType<readonly []>(readonlyData.emptyTuple);\nexpectType<readonly ['foo']>(readonlyData.singleItemTuple);\nexpectType<readonly [string, ...number[]]>(readonlyData.trailingSpreadTuple);\nexpectType<readonly [...string[], number]>(readonlyData.leadingSpreadTuple);\nexpectType<readonly [{readonly a: string}, {readonly b: number}, {readonly c: string}]>(readonlyData.multiItemTuple);\nexpectType<Readonly<ReadonlyMap<string, string>>>(readonlyData.readonlyMap);\nexpectType<Readonly<ReadonlySet<string>>>(readonlyData.readonlySet);\nexpectType<readonly string[]>(readonlyData.readonlyArray);\nexpectType<readonly ['foo']>(readonlyData.readonlyTuple);\nexpectAssignable<ReadonlyJsonValue>(readonlyData.json);\nexpectAssignable<Opaque<ReadonlyDeep<OpaqueObjectData>, ReadonlyDeep<OpaqueObject[typeof tag]>>>(readonlyData.opaqueObj);\n\nexpectType<((foo: number) => string) & _ReadonlyObjectDeep<Namespace>>(readonlyData.namespace);\nexpectType<string>(readonlyData.namespace(1));\nexpectType<readonly boolean[]>(readonlyData.namespace.baz);\n\n// These currently aren't readonly due to TypeScript limitations.\n// @see https://github.com/microsoft/TypeScript/issues/29732\nexpectType<NamespaceWithOverload>(readonlyData.namespaceWithOverload);\nexpectType<string>(readonlyData.namespaceWithOverload(1));\nexpectType<number>(readonlyData.namespaceWithOverload('foo', 1));\nexpectType<boolean[]>(readonlyData.namespaceWithOverload.baz);\n\n// Test void\ntype VoidType = {\n\tfoo: void;\n\tbar: string | void;\n};\ntype VoidTypeExpected = {\n\treadonly foo: void;\n\treadonly bar: string | void;\n};\ndeclare const voidType: ReadonlyDeep<VoidType>;\nexpectType<VoidTypeExpected>(voidType);\n\n// Standalone tests\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\nconst readonlyNamespace = {} as ReadonlyDeep<{\n\t(foo: number): string;\n\tbaz: boolean[];\n}>;\nexpectType<((foo: number) => string) & {\n\treadonly baz: readonly boolean[];\n}>(readonlyNamespace);\nexpectAssignable<{\n\t(foo: number): string;\n\treadonly baz: readonly boolean[];\n}>(readonlyNamespace);\n"
  },
  {
    "path": "test-d/readonly-keys-of.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ReadonlyKeysOf, UnknownRecord} from '../index.d.ts';\n\ntype TestType1 = {\n\ta: string;\n\treadonly b: boolean;\n};\n\ntype TestType2 = {\n\treadonly a: string;\n\treadonly b: boolean;\n};\n\ntype TestType3 = {\n\ta: string;\n\tb: boolean;\n};\n\ntype ReadonlyKeysOf1 = ReadonlyKeysOf<TestType1>;\ntype ReadonlyKeysOf2 = ReadonlyKeysOf<TestType2>;\ntype ReadonlyKeysOf3 = ReadonlyKeysOf<TestType3>;\n\ndeclare const test1: ReadonlyKeysOf1;\ndeclare const test2: ReadonlyKeysOf2;\ndeclare const test3: ReadonlyKeysOf3;\n\nexpectType<'b'>(test1);\nexpectType<'a' | 'b'>(test2);\nexpectType<never>(test3);\n\nexpectType<'a' | 'c'>({} as ReadonlyKeysOf<{readonly a?: string; b: number; readonly c: boolean}>);\nexpectType<'c'>({} as ReadonlyKeysOf<{a?: string; b: number; readonly c: boolean}>);\n\n// Unions\nexpectType<'b' | 'c'>({} as ReadonlyKeysOf<{a: string; readonly b: number} | {readonly c?: string; d?: number}>);\nexpectType<'a' | 'b'>({} as ReadonlyKeysOf<{a: string; b: number} | {readonly a: string; readonly b: number}>);\n\n// Arrays\nexpectType<never>({} as Extract<ReadonlyKeysOf<[string, number, boolean]>, number | `${number}`>);\nexpectType<number | '0' | '1' | '2'>({} as Extract<ReadonlyKeysOf<readonly [string, number, boolean]>, number | `${number}`>);\nexpectType<never>({} as Extract<ReadonlyKeysOf<string[]>, number | `${number}`>);\nexpectType<number>({} as Extract<ReadonlyKeysOf<readonly string[]>, number | `${number}`>);\n\n// `ReadonlyKeysOf<T>` should be assignable to `keyof T`\ntype Assignability1<T, _K extends keyof T> = unknown;\ntype Test1<T extends object> = Assignability1<T, ReadonlyKeysOf<T>>;\n\n// `keyof T` should NOT be assignable to `ReadonlyKeysOf<T>`\ntype Assignability2<T extends object, _K extends ReadonlyKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test2<T extends object> = Assignability2<T, keyof T>;\n\n// `ReadonlyKeysOf<T>` should be assignable to `PropertyKey`\ntype Assignability3<_T, _K extends PropertyKey> = unknown;\ntype Test3<T extends object> = Assignability3<T, ReadonlyKeysOf<T>>;\n\n// `PropertyKey` should NOT be assignable to `ReadonlyKeysOf<T>`\ntype Assignability4<T extends object, _K extends ReadonlyKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test4<T extends object> = Assignability4<T, PropertyKey>;\n\n// `ReadonlyKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability5<T extends Record<string, unknown>, _K extends keyof T> = unknown;\ntype Test5<T extends Record<string, unknown>> = Assignability5<T, ReadonlyKeysOf<T>>;\n\n// `ReadonlyKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `object`\ntype Assignability6<T extends object, _K extends keyof T> = unknown;\ntype Test6<T extends object> = Assignability6<T, ReadonlyKeysOf<T>>;\n\n// `ReadonlyKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `UnknownRecord`\ntype Assignability7<T extends UnknownRecord, _K extends keyof T> = unknown;\ntype Test7<T extends UnknownRecord> = Assignability7<T, ReadonlyKeysOf<T>>;\n\n// `keyof T` should NOT be assignable to `ReadonlyKeysOf<T>` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability8<T extends Record<string, unknown>, _K extends ReadonlyKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test8<T extends Record<string, unknown>> = Assignability8<T, keyof T>;\n\n// `keyof T` should NOT be assignable to `ReadonlyKeysOf<T>` even when `T` is constrained to `object`\ntype Assignability9<T extends object, _K extends ReadonlyKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test9<T extends object> = Assignability9<T, keyof T>;\n\n// `keyof T` should NOT be assignable to `ReadonlyKeysOf<T>` even when `T` is constrained to `UnknownRecord`\ntype Assignability10<T extends UnknownRecord, _K extends ReadonlyKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test10<T extends UnknownRecord> = Assignability10<T, keyof T>;\n\n// @ts-expect-error\ntype AllowsOnlyObjects = ReadonlyKeysOf<string>;\n"
  },
  {
    "path": "test-d/readonly-tuple.ts",
    "content": "import {expectAssignable, expectNotAssignable} from 'tsd';\nimport type {ReadonlyTuple} from '../index.d.ts';\n\ntype TupleOfThreeStrings = ReadonlyTuple<string, 3>;\n\nexpectAssignable<TupleOfThreeStrings>(['a', 'b', 'c']);\n\nexpectNotAssignable<TupleOfThreeStrings>(['a', 'b', 123]);\nexpectNotAssignable<TupleOfThreeStrings>(['a']);\nexpectNotAssignable<TupleOfThreeStrings>(['a', 'b']);\nexpectNotAssignable<TupleOfThreeStrings>(['a', 'b', 'c', 'd']);\n\ndeclare const test: TupleOfThreeStrings;\n\n// @ts-expect-error\nconst _a: unknown = test.push;\n// @ts-expect-error\ntest[2] = 'a';\n"
  },
  {
    "path": "test-d/remove-prefix.ts",
    "content": "import {expectType} from 'tsd';\nimport type {RemovePrefix} from '../source/remove-prefix.d.ts';\n\nexpectType<'change'>({} as RemovePrefix<'on-change', 'on-'>);\nexpectType<'Click'>({} as RemovePrefix<'handleClick', 'handle'>);\nexpectType<'vscode'>({} as RemovePrefix<'.vscode', '.'>);\nexpectType<'whitespace'>({} as RemovePrefix<' whitespace', ' '>);\n\n// Prefix not present\nexpectType<''>({} as RemovePrefix<'', 'foo'>);\nexpectType<'on-mouse-move'>({} as RemovePrefix<'on-mouse-move', 'click'>);\n\n// Empty prefix\nexpectType<'baz'>({} as RemovePrefix<'baz', ''>);\n\n// Prefix completely matches the input string\nexpectType<''>({} as RemovePrefix<'click', 'click'>);\n\n// Prefix partially matches the input string\nexpectType<'foobar'>({} as RemovePrefix<'foobar', 'foobaz'>);\nexpectType<'hello'>({} as RemovePrefix<'hello', 'helloworld'>);\n\n// Multiple occurrences of prefix (should only remove from start)\nexpectType<'bar-bar-foo'>({} as RemovePrefix<'bar-bar-bar-foo', 'bar-'>);\nexpectType<'foofoo'>({} as RemovePrefix<'foofoofoo', 'foo'>);\n\n// === Non-literals ===\n\n// Input: Non-literal, Prefix: Literal\nexpectType<string>({} as RemovePrefix<`hover:${string}`, 'hover:'>);\nexpectType<Capitalize<string>>({} as RemovePrefix<`on${Capitalize<string>}`, 'on'>);\nexpectType<`${number}`>({} as RemovePrefix<`id-${number}`, 'id-'>);\nexpectType<`${string}--`>({} as RemovePrefix<`--${string}--`, '--'>);\nexpectType<`focus:${string}`>({} as RemovePrefix<`hover:focus:${string}`, 'hover:'>);\nexpectType<`user_${string}`>({} as RemovePrefix<`user_${string}`, 'admin_'>);\nexpectType<string>({} as RemovePrefix<string, 'on'>);\nexpectType<`${string}/${number}`>({} as RemovePrefix<`${string}/${number}`, 'foo'>);\n\n// Input: Literal, Prefix: Non-literal\nexpectType<string>({} as RemovePrefix<'on-click', `${string}-`>);\nexpectType<string>({} as RemovePrefix<'hover:flex', string>);\nexpectType<'handle-click'>({} as RemovePrefix<'handle-click', Uppercase<string>>);\nexpectType<'on-change'>({} as RemovePrefix<'on-change', `${string}--`>);\n\n// Input: Non-literal, Prefix: Non-literal\nexpectType<string>({} as RemovePrefix<`hover:${string}`, `${string}:`>);\nexpectType<string>({} as RemovePrefix<`${string}/${number}`, `${string}/`>);\nexpectType<string>({} as RemovePrefix<string, string>);\nexpectType<`${string}/${number}`>({} as RemovePrefix<`${string}/${number}`, `${string}:`>);\nexpectType<`${number}:${number}`>({} as RemovePrefix<`${number}:${number}`, `-${string}`>);\n\n// Unions\nexpectType<'click' | 'hover' | 'change'>({} as RemovePrefix<'on-click' | 'on-hover' | 'on-change', 'on-'>);\nexpectType<'click' | 'hover' | 'handle-change'>({} as RemovePrefix<'on-click' | 'on-hover' | 'handle-change', 'on-'>);\nexpectType<Uppercase<string> | `${number}`>({} as RemovePrefix<`id-${Uppercase<string>}` | `id-${number}`, 'id-'>);\nexpectType<string>({} as RemovePrefix<`hover:${string}` | `focus:${string}`, `${string}:`>);\n\nexpectType<'-change' | 'change'>({} as RemovePrefix<'on-change', 'on' | 'on-'>);\nexpectType<'change' | 'on-change'>({} as RemovePrefix<'on-change', 'on-' | 'handle-'>);\nexpectType<'on-change'>({} as RemovePrefix<'on-change', 'off-' | 'handle-'>);\nexpectType<string>({} as RemovePrefix<'on-change', `${string}-` | 'on'>);\n\nexpectType<'on:change' | 'onChange'>({} as RemovePrefix<'on:change' | 'onChange', `${string}-`>);\nexpectType<'name' | 'get-name' | 'age' | 'set-age' | 'other'>(\n\t{} as RemovePrefix<'get-name' | 'set-age' | 'other', 'get-' | 'set-'>,\n);\nexpectType<string>({} as RemovePrefix<`id:${Uppercase<string>}` | `id/${number}`, `${string}:` | `${string}/`>);\n\n// Boundary types\nexpectType<any>({} as RemovePrefix<any, 'foo'>);\nexpectType<never>({} as RemovePrefix<never, 'foo'>);\nexpectType<string>({} as RemovePrefix<'on-change', any>);\nexpectType<'on-change'>({} as RemovePrefix<'on-change', never>);\n\n// === strict: false ===\n\n// No effect if `Prefix` is a literal\nexpectType<'change'>({} as RemovePrefix<'on-change', 'on-', {strict: false}>);\nexpectType<'change' | 'hover'>({} as RemovePrefix<'on-change' | 'on-hover', 'on-', {strict: false}>);\nexpectType<Capitalize<string>>({} as RemovePrefix<`handle${Capitalize<string>}`, 'handle', {strict: false}>);\n\nexpectType<'click'>({} as RemovePrefix<'on-click', `${string}-`, {strict: false}>);\nexpectType<'over:flex'>({} as RemovePrefix<'hover:flex', string, {strict: false}>);\nexpectType<`${number}`>({} as RemovePrefix<`${string}/${number}`, `${string}/`, {strict: false}>);\nexpectType<'change' | '-change'>({} as RemovePrefix<'on-change', `${string}-` | 'on', {strict: false}>);\nexpectType<'on:change' | 'change'>({} as RemovePrefix<'on:change' | 'on-change', `${string}-`, {strict: false}>);\nexpectType<Uppercase<string> | `id:${Uppercase<string>}` | `${number}` | `id/${number}`>(\n\t{} as RemovePrefix<`id:${Uppercase<string>}` | `id/${number}`, `${string}:` | `${string}/`, {strict: false}>,\n);\n\n// Generic assignability test\ntype Assignability<S extends string> = S;\n// Output of `RemovePrefix` should be assignable to `string`.\ntype Test1<S extends string, Prefix extends string> = Assignability<RemovePrefix<S, Prefix>>;\ntype Test2<S extends Uppercase<string>, Prefix extends '-' | '/' | '#'> = Assignability<RemovePrefix<S, Prefix>>;\n"
  },
  {
    "path": "test-d/replace.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Replace, StringRepeat} from '../index.d.ts';\n\ndeclare function replace<\n\tInput extends string,\n\tSearch extends string,\n\tReplacement extends string,\n>(\n\tinput: Input,\n\tsearch: Search,\n\treplacement: Replacement\n): Replace<Input, Search, Replacement>;\n\ndeclare function replaceAll<\n\tInput extends string,\n\tSearch extends string,\n\tReplacement extends string,\n>(\n\tinput: Input,\n\tsearch: Search,\n\treplacement: Replacement\n): Replace<Input, Search, Replacement, {all: true}>;\n\nexpectType<'hello 🦄'>(replace('hello ?', '?', '🦄'));\nexpectType<'hello ❓?'>(replace('hello ??', '?', '❓'));\nexpectType<'10-42-00'>(replaceAll('10:42:00', ':', '-'));\nexpectType<'userName'>(replaceAll('__userName__', '__', ''));\nexpectType<'MyCoolTitle'>(replaceAll('My Cool Title', ' ', ''));\nexpectType<'fobarfobar'>(replaceAll('foobarfoobar', 'ob', 'b'));\n\n// Unions\nexpectType<'bcabc' | 'cbcba'>({} as Replace<'abcabc' | 'cbacba', 'a', ''>);\nexpectType<'bcabc' | 'acabc'>({} as Replace<'abcabc', 'a' | 'b', ''>);\nexpectType<'bcabc' | 'Abcabc'>({} as Replace<'abcabc', 'a', '' | 'A'>);\n\nexpectType<'bcabc' | 'acabc' | 'cbcba' | 'cacba'>({} as Replace<'abcabc' | 'cbacba', 'a' | 'b', ''>);\nexpectType<'bcabc' | 'Abcabc' | 'cbcba' | 'cbAcba'>({} as Replace<'abcabc' | 'cbacba', 'a', '' | 'A'>);\nexpectType<'bcabc' | 'Abcabc' | 'acabc' | 'aAcabc'>({} as Replace<'abcabc', 'a' | 'b', '' | 'A'>);\n\nexpectType<'bcabc' | 'Abcabc' | 'acabc' | 'aAcabc' | 'cbcba' | 'cbAcba' | 'cacba' | 'cAacba'>(\n\t{} as Replace<'abcabc' | 'cbacba', 'a' | 'b', '' | 'A'>,\n);\n\nexpectType<'bcbc' | 'cbcb'>({} as Replace<'abcabc' | 'cbacba', 'a', '', {all: true}>);\nexpectType<'bcbc' | 'acac'>({} as Replace<'abcabc', 'a' | 'b', '', {all: true}>);\nexpectType<'bcbc' | 'AbcAbc'>({} as Replace<'abcabc', 'a', '' | 'A', {all: true}>);\n\nexpectType<'bcbc' | 'acac' | 'cbcb' | 'caca'>({} as Replace<'abcabc' | 'cbacba', 'a' | 'b', '', {all: true}>);\nexpectType<'bcbc' | 'AbcAbc' | 'cbcb' | 'cbAcbA'>({} as Replace<'abcabc' | 'cbacba', 'a', '' | 'A', {all: true}>);\nexpectType<'bcbc' | 'AbcAbc' | 'acac' | 'aAcaAc'>({} as Replace<'abcabc', 'a' | 'b', '' | 'A', {all: true}>);\n\nexpectType<'bcbc' | 'AbcAbc' | 'acac' | 'aAcaAc' | 'cbcb' | 'cbAcbA' | 'caca' | 'cAacAa'>(\n\t{} as Replace<'abcabc' | 'cbacba', 'a' | 'b', '' | 'A', {all: true}>,\n);\n\n// Recursion depth at which a non-tail recursive implementation starts to fail.\ntype FiftyZeroes = StringRepeat<'0', 50>;\ntype FiftyOnes = StringRepeat<'1', 50>;\nexpectType<FiftyOnes>({} as Replace<FiftyZeroes, '0', '1', {all: true}>);\n\n// Maximum allowed recursion depth for a tail recursive implementation.\ntype NineHundredNinetyNineZeroes = StringRepeat<'0', 999>;\ntype NineHundredNinetyNineOnes = StringRepeat<'1', 999>;\nexpectType<NineHundredNinetyNineOnes>({} as Replace<NineHundredNinetyNineZeroes, '0', '1', {all: true}>);\n"
  },
  {
    "path": "test-d/require-all-or-none.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {RequireAllOrNone, Simplify} from '../index.d.ts';\n\ntype SystemMessages = {\n\tdefault: string;\n\n\tmacos: string;\n\tlinux: string;\n\n\toptional?: string;\n};\n\ntype ValidMessages = RequireAllOrNone<SystemMessages, 'macos' | 'linux'>;\ndeclare const test: (_: ValidMessages) => void;\n\ntest({default: 'hello'});\ntest({macos: 'yo', linux: 'sup', optional: 'howdy', default: 'hello'});\n\n// @ts-expect-error\ntest({});\n// @ts-expect-error\ntest({macos: 'hey', default: 'hello'});\n// @ts-expect-error\ntest({linux: 'hey', default: 'hello'});\n\ndeclare const testWithoutKeys: (_: RequireAllOrNone<{a: number; b: number}>) => void;\n\ntestWithoutKeys({});\ntestWithoutKeys({a: 1, b: 2});\n\n// @ts-expect-error\ntestWithoutKeys({a: 1});\n// @ts-expect-error\ntestWithoutKeys({b: 2});\n\nfunction narrowingTest(foo: Simplify<RequireAllOrNone<{a: string; b: string}>>): string { // `Simplify` just makes it easier to visualize the narrowing\n\tif (typeof foo.a === 'string') {\n\t\texpectAssignable<string>(foo.a);\n\t\texpectAssignable<string>(foo.b);\n\n\t\treturn foo.a;\n\t}\n\n\texpectNotAssignable<string>(foo.a);\n\texpectNotAssignable<string>(foo.b);\n\n\treturn '';\n}\n\nfunction narrowingTest2(foo: Simplify<RequireAllOrNone<{a: string; b: string; c: string}>>): string { // `Simplify` just makes it easier to visualize the narrowing\n\tif (typeof foo.a === 'string') {\n\t\texpectAssignable<string>(foo.a);\n\t\texpectAssignable<string>(foo.b);\n\t\texpectAssignable<string>(foo.c);\n\n\t\treturn foo.a;\n\t}\n\n\texpectNotAssignable<string>(foo.a);\n\texpectNotAssignable<string>(foo.b);\n\texpectNotAssignable<string>(foo.c);\n\n\treturn '';\n}\n\nfunction narrowingTest3(foo: Simplify<RequireAllOrNone<{a: string; b: string; c: string}, 'a' | 'b'>>): string { // `Simplify` just makes it easier to visualize the narrowing\n\tif (typeof foo.a === 'string') {\n\t\texpectAssignable<string>(foo.c);\n\n\t\texpectAssignable<string>(foo.a);\n\t\texpectAssignable<string>(foo.b);\n\n\t\treturn foo.a;\n\t}\n\n\texpectAssignable<string>(foo.c);\n\n\texpectNotAssignable<string>(foo.a);\n\texpectNotAssignable<string>(foo.b);\n\n\treturn '';\n}\n\nexpectType<{a: number; b: string} | {a?: never; b?: never}>({} as Simplify<RequireAllOrNone<{a: number; b: string}>>); // `Simplify` is required for the assertion to pass\nexpectType<{a: number; b: string} | {a?: never; b?: never}>({} as Simplify<RequireAllOrNone<{a: number; b: string}, any>>); // `Simplify` is required for the assertion to pass\nexpectType<{a: number; b: string; c: boolean} | {a?: never; b?: never; c?: never}>(\n\t{} as Simplify<RequireAllOrNone<{a: number; b: string; c: boolean}>>, // `Simplify` is required for the assertion to pass\n);\nexpectType<{a: number; b: string; c: boolean} | {a?: never; b?: never; c?: never}>(\n\t{} as Simplify<RequireAllOrNone<{a: number; b: string; c: boolean}, any>>, // `Simplify` is required for the assertion to pass\n);\n\nexpectType<{}>({} as RequireAllOrNone<{}>);\nexpectType<{a: string; b: number}>({} as RequireAllOrNone<{a: string; b: number}, never>);\n\nexpectType<any>({} as RequireAllOrNone<any>);\nexpectType<any>({} as RequireAllOrNone<any, 'foo'>);\nexpectType<any>({} as RequireAllOrNone<any, any>);\nexpectType<any>({} as RequireAllOrNone<any, never>);\n\nexpectType<never>({} as RequireAllOrNone<never>);\nexpectType<never>({} as RequireAllOrNone<never, 'foo'>);\nexpectType<never>({} as RequireAllOrNone<never, any>);\nexpectType<never>({} as RequireAllOrNone<never, never>);\n"
  },
  {
    "path": "test-d/require-at-least-one.ts",
    "content": "import {expectAssignable, expectType} from 'tsd';\nimport type {RequireAtLeastOne, Simplify} from '../index.d.ts';\n\ntype SystemMessages = {\n\tdefault: string;\n\n\tmacos?: string;\n\tlinux?: string;\n\twindows?: string;\n\n\toptional?: string;\n};\n\ntype ValidMessages = RequireAtLeastOne<SystemMessages, 'macos' | 'linux' | 'windows'>;\ndeclare const test: (_: ValidMessages) => void;\n\ntest({macos: 'hey', default: 'hello'});\ntest({linux: 'sup', default: 'hello', optional: 'howdy'});\ntest({macos: 'hey', linux: 'sup', windows: 'hi', default: 'hello'});\n\n// @ts-expect-error\ntest({});\n// @ts-expect-error\ntest({macos: 'hey'});\n// @ts-expect-error\ntest({default: 'hello'});\n\ndeclare const testWithoutKeys: (_: RequireAtLeastOne<{a: number; b: number}>) => void;\n\ntestWithoutKeys({a: 1});\ntestWithoutKeys({b: 2});\ntestWithoutKeys({a: 1, b: 2});\n\n// @ts-expect-error\ntestWithoutKeys({});\n\ntype MessageBoard<M> = (messages: M) => string;\n\nexpectAssignable<MessageBoard<ValidMessages>>(\n\t({macos = '', linux = '🐧', windows = '⊞'}) =>\n\t\t`${linux} + ${windows} = ${macos}`,\n);\n\nexpectType<{a: number; b?: string} | {a?: number; b: string}>(\n\t{} as Simplify<RequireAtLeastOne<{a: number; b: string}>>, // `Simplify` is required for the assertion to pass\n);\nexpectType<{a: number; b?: string} | {a?: number; b: string}>(\n\t{} as Simplify<RequireAtLeastOne<{a: number; b: string}, any>>, // `Simplify` is required for the assertion to pass\n);\nexpectType<{a: number; b?: string; c?: boolean} | {a?: number; b: string; c?: boolean} | {a?: number; b?: string; c: boolean}>(\n\t{} as Simplify<RequireAtLeastOne<{a: number; b: string; c: boolean}>>, // `Simplify` is required for the assertion to pass\n);\nexpectType<{a: number; b?: string; c?: boolean} | {a?: number; b: string; c?: boolean} | {a?: number; b?: string; c: boolean}>(\n\t{} as Simplify<RequireAtLeastOne<{a: number; b: string; c: boolean}, any>>, // `Simplify` is required for the assertion to pass\n);\n\nexpectType<never>({} as RequireAtLeastOne<{}>);\nexpectType<never>({} as RequireAtLeastOne<{a: string; b: number}, never>);\n\nexpectType<any>({} as RequireAtLeastOne<any>);\nexpectType<any>({} as RequireAtLeastOne<any, 'foo'>);\nexpectType<any>({} as RequireAtLeastOne<any, any>);\nexpectType<any>({} as RequireAtLeastOne<any, never>);\n\nexpectType<never>({} as RequireAtLeastOne<never>);\nexpectType<never>({} as RequireAtLeastOne<never, 'foo'>);\nexpectType<never>({} as RequireAtLeastOne<never, any>);\nexpectType<never>({} as RequireAtLeastOne<never, never>);\n"
  },
  {
    "path": "test-d/require-exactly-one.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {RequireExactlyOne, Simplify} from '../index.d.ts';\n\ntype SystemMessages = {\n\tdefault: string;\n\n\tmacos: string;\n\tlinux: string;\n\n\toptional?: string;\n};\n\ntype ValidMessages = RequireExactlyOne<SystemMessages, 'macos' | 'linux'>;\ndeclare const test: (_: ValidMessages) => void;\n\ntest({macos: 'hey', default: 'hello'});\ntest({linux: 'sup', optional: 'howdy', default: 'hello'});\n\n// @ts-expect-error\ntest({});\n// @ts-expect-error\ntest({macos: 'hey', linux: 'sup', default: 'hello'});\n\ndeclare const testWithoutKeys: (_: RequireExactlyOne<{a: number; b: number}>) => void;\n\ntestWithoutKeys({a: 1});\ntestWithoutKeys({b: 2});\n\n// @ts-expect-error\ntestWithoutKeys({});\n// @ts-expect-error\ntestWithoutKeys({a: 1, b: 2});\n\nfunction narrowingTest(foo: Simplify<RequireExactlyOne<{a: string; b: string}>>): string { // `Simplify` just makes it easier to visualize the narrowing\n\tif (typeof foo.a === 'string') {\n\t\texpectAssignable<string>(foo.a);\n\t\texpectNotAssignable<string>(foo.b);\n\n\t\treturn foo.a;\n\t}\n\n\texpectAssignable<string>(foo.b);\n\texpectNotAssignable<string>(foo.a);\n\n\treturn foo.b;\n}\n\nfunction narrowingTest2(foo: Simplify<RequireExactlyOne<{a: string; b: string; c: string}>>): string { // `Simplify` just makes it easier to visualize the narrowing\n\tif (typeof foo.a === 'string') {\n\t\texpectAssignable<string>(foo.a);\n\t\texpectNotAssignable<string>(foo.b);\n\t\texpectNotAssignable<string>(foo.c);\n\n\t\treturn foo.a;\n\t}\n\n\tif (typeof foo.b === 'string') {\n\t\texpectAssignable<string>(foo.b);\n\t\texpectNotAssignable<string>(foo.a);\n\t\texpectNotAssignable<string>(foo.c);\n\n\t\treturn foo.b;\n\t}\n\n\texpectAssignable<string>(foo.c);\n\texpectNotAssignable<string>(foo.a);\n\texpectNotAssignable<string>(foo.b);\n\n\treturn foo.c;\n}\n\nfunction narrowingTest3(foo: Simplify<RequireExactlyOne<{a: string; b: string; c: string}, 'a' | 'b'>>): string { // `Simplify` just makes it easier to visualize the narrowing\n\tif (typeof foo.a === 'string') {\n\t\texpectAssignable<string>(foo.c);\n\n\t\texpectAssignable<string>(foo.a);\n\t\texpectNotAssignable<string>(foo.b);\n\n\t\treturn foo.a;\n\t}\n\n\texpectAssignable<string>(foo.c);\n\n\texpectAssignable<string>(foo.b);\n\texpectNotAssignable<string>(foo.a);\n\n\treturn foo.b;\n}\n\nexpectType<{a: number; b?: never} | {a?: never; b: string}>({} as Simplify<RequireExactlyOne<{a: number; b: string}>>); // `Simplify` is required for the assertion to pass\nexpectType<{a: number; b?: never} | {a?: never; b: string}>({} as Simplify<RequireExactlyOne<{a: number; b: string}, any>>); // `Simplify` is required for the assertion to pass\nexpectType<{a: number; b?: never; c?: never} | {a?: never; b: string; c?: never} | {a?: never; b?: never; c: boolean}>(\n\t{} as Simplify<RequireExactlyOne<{a: number; b: string; c: boolean}>>, // `Simplify` is required for the assertion to pass\n);\nexpectType<{a: number; b?: never; c?: never} | {a?: never; b: string; c?: never} | {a?: never; b?: never; c: boolean}>(\n\t{} as Simplify<RequireExactlyOne<{a: number; b: string; c: boolean}, any>>, // `Simplify` is required for the assertion to pass\n);\n\nexpectType<never>({} as RequireExactlyOne<{}>);\nexpectType<never>({} as RequireExactlyOne<{a: string; b: number}, never>);\n\nexpectType<any>({} as RequireExactlyOne<any>);\nexpectType<any>({} as RequireExactlyOne<any, 'foo'>);\nexpectType<any>({} as RequireExactlyOne<any, any>);\nexpectType<any>({} as RequireExactlyOne<any, never>);\n\nexpectType<never>({} as RequireExactlyOne<never>);\nexpectType<never>({} as RequireExactlyOne<never, 'foo'>);\nexpectType<never>({} as RequireExactlyOne<never, any>);\nexpectType<never>({} as RequireExactlyOne<never, never>);\n"
  },
  {
    "path": "test-d/require-one-or-none.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {RequireOneOrNone, Simplify} from '../index.d.ts';\n\ntype OneAtMost = RequireOneOrNone<Record<'foo' | 'bar' | 'baz', true>>;\n\nexpectAssignable<OneAtMost>({});\nexpectAssignable<OneAtMost>({foo: true});\nexpectAssignable<OneAtMost>({bar: true});\nexpectAssignable<OneAtMost>({baz: true});\n\nexpectNotAssignable<OneAtMost>({foo: true, bar: true});\nexpectNotAssignable<OneAtMost>({foo: true, baz: true});\nexpectNotAssignable<OneAtMost>({bar: true, baz: true});\nexpectNotAssignable<OneAtMost>({foo: true, bar: true, baz: true});\n\n// 'foo' always required\ntype OneOrTwo = RequireOneOrNone<Record<'foo' | 'bar' | 'baz', true>, 'bar' | 'baz'>;\n\nexpectAssignable<OneOrTwo>({foo: true});\nexpectAssignable<OneOrTwo>({foo: true, bar: true});\nexpectAssignable<OneOrTwo>({foo: true, baz: true});\n\nexpectNotAssignable<OneOrTwo>({});\nexpectNotAssignable<OneOrTwo>({bar: true});\nexpectNotAssignable<OneOrTwo>({baz: true});\nexpectNotAssignable<OneOrTwo>({foo: true, bar: true, baz: true});\n\nfunction narrowingTest(foo: Simplify<RequireOneOrNone<{a: string; b: string}>>): string { // `Simplify` just makes it easier to visualize the narrowing\n\tif (typeof foo.a === 'string') {\n\t\texpectAssignable<string>(foo.a);\n\t\texpectNotAssignable<string>(foo.b);\n\n\t\treturn foo.a;\n\t}\n\n\tif (typeof foo.b === 'string') {\n\t\texpectAssignable<string>(foo.b);\n\t\texpectNotAssignable<string>(foo.a);\n\n\t\treturn foo.b;\n\t}\n\n\texpectNotAssignable<string>(foo.a);\n\texpectNotAssignable<string>(foo.b);\n\n\treturn '';\n}\n\nfunction narrowingTest2(foo: Simplify<RequireOneOrNone<{a: string; b: string; c: string}>>): string { // `Simplify` just makes it easier to visualize the narrowing\n\tif (typeof foo.a === 'string') {\n\t\texpectAssignable<string>(foo.a);\n\t\texpectNotAssignable<string>(foo.b);\n\t\texpectNotAssignable<string>(foo.c);\n\n\t\treturn foo.a;\n\t}\n\n\tif (typeof foo.b === 'string') {\n\t\texpectAssignable<string>(foo.b);\n\t\texpectNotAssignable<string>(foo.a);\n\t\texpectNotAssignable<string>(foo.c);\n\n\t\treturn foo.b;\n\t}\n\n\tif (typeof foo.c === 'string') {\n\t\texpectAssignable<string>(foo.c);\n\t\texpectNotAssignable<string>(foo.a);\n\t\texpectNotAssignable<string>(foo.b);\n\n\t\treturn foo.c;\n\t}\n\n\texpectNotAssignable<string>(foo.a);\n\texpectNotAssignable<string>(foo.b);\n\texpectNotAssignable<string>(foo.c);\n\n\treturn '';\n}\n\nfunction narrowingTest3(foo: Simplify<RequireOneOrNone<{a: string; b: string; c: string}, 'a' | 'b'>>): string { // `Simplify` just makes it easier to visualize the narrowing\n\tif (typeof foo.a === 'string') {\n\t\texpectAssignable<string>(foo.c);\n\n\t\texpectAssignable<string>(foo.a);\n\t\texpectNotAssignable<string>(foo.b);\n\n\t\treturn foo.a;\n\t}\n\n\tif (typeof foo.b === 'string') {\n\t\texpectAssignable<string>(foo.c);\n\n\t\texpectAssignable<string>(foo.b);\n\t\texpectNotAssignable<string>(foo.a);\n\n\t\treturn foo.b;\n\t}\n\n\texpectAssignable<string>(foo.c);\n\n\texpectNotAssignable<string>(foo.a);\n\texpectNotAssignable<string>(foo.b);\n\n\treturn '';\n}\n\nexpectType<{a: number; b?: never} | {a?: never; b: string} | {a?: never; b?: never}>(\n\t{} as Simplify<RequireOneOrNone<{a: number; b: string}>>, // `Simplify` is required for the assertion to pass\n);\nexpectType<{a: number; b?: never} | {a?: never; b: string} | {a?: never; b?: never}>(\n\t{} as Simplify<RequireOneOrNone<{a: number; b: string}, any>>, // `Simplify` is required for the assertion to pass\n);\nexpectType<{a: number; b?: never; c?: never} | {a?: never; b: string; c?: never} | {a?: never; b?: never; c: boolean} | {a?: never; b?: never; c?: never}>(\n\t{} as Simplify<RequireOneOrNone<{a: number; b: string; c: boolean}>>, // `Simplify` is required for the assertion to pass\n);\nexpectType<{a: number; b?: never; c?: never} | {a?: never; b: string; c?: never} | {a?: never; b?: never; c: boolean} | {a?: never; b?: never; c?: never}>(\n\t{} as Simplify<RequireOneOrNone<{a: number; b: string; c: boolean}, any>>, // `Simplify` is required for the assertion to pass\n);\n\nexpectType<{}>({} as RequireOneOrNone<{}>);\nexpectType<{a: string; b: number}>({} as RequireOneOrNone<{a: string; b: number}, never>);\n\nexpectType<any>({} as RequireOneOrNone<any>);\nexpectType<any>({} as RequireOneOrNone<any, 'foo'>);\nexpectType<any>({} as RequireOneOrNone<any, any>);\nexpectType<any>({} as RequireOneOrNone<any, never>);\n\nexpectType<never>({} as RequireOneOrNone<never>);\nexpectType<never>({} as RequireOneOrNone<never, 'foo'>);\nexpectType<never>({} as RequireOneOrNone<never, any>);\nexpectType<never>({} as RequireOneOrNone<never, never>);\n"
  },
  {
    "path": "test-d/required-deep.ts",
    "content": "import {expectNotType, expectType} from 'tsd';\nimport type {RequiredDeep, Simplify} from '../index.d.ts';\nimport type {BuiltIns} from '../source/internal/type.d.ts';\n\nexpectType<RequiredDeep<{a?: number; b: string}>>({} as {a: number; b: string});\nexpectType<RequiredDeep<{a?: {b?: {c?: string}; d?: string}}>>({} as {a: {b: {c: string}; d: string}});\nexpectType<RequiredDeep<{readonly a?: number; readonly b: {c?: string}}>>({} as {readonly a: number; readonly b: {c: string}});\nexpectType<RequiredDeep<{a?: Array<{b?: number}>}>>({} as {a: Array<{b: number}>});\nexpectType<RequiredDeep<{a?: [{b?: string}, number]}>>({} as {a: [{b: string}, number]});\nexpectType<RequiredDeep<{a?: number | {readonly b?: string}}>>({} as {a: number | {readonly b: string}});\nexpectType<RequiredDeep<{a?: {b: number} | {c?: string}}>>({} as {a: {b: number} | {c: string}});\nexpectType<RequiredDeep<{a?: {readonly b?: BuiltIns}}>>({} as {a: {readonly b: BuiltIns}});\n\n// Unions\nexpectType<RequiredDeep<{a?: number} | {b?: string}>>({} as {a: number} | {b: string});\nexpectType<RequiredDeep<{v?: {a?: number}} | {w?: {b?: string}}>>({} as {v: {a: number}} | {w: {b: string}});\nexpectType<RequiredDeep<Map<{a: {b?: {c: {d?: number}}}}, {e?: string}> | Set<{a: {b?: {c: {d?: number}}}}>>>(\n\t{} as Map<{a: {b: {c: {d: number}}}}, {e: string}> | Set<{a: {b: {c: {d: number}}}}>,\n);\n\n// Index signatures\nexpectType<RequiredDeep<{[x: string]: {a?: string; b: {c?: number}}}>>({} as {[x: string]: {a: string; b: {c: number}}});\nexpectType<RequiredDeep<{[x: string]: {[x: number]: {c?: number}}}>>({} as {[x: string]: {[x: number]: {c: number}}});\n\n// Optional with `undefined`\n// This behaviour changes depending on `exactOptionalPropertyTypes` compiler option, refer https://github.com/sindresorhus/type-fest/issues/1217\nexpectType<RequiredDeep<{a?: number | undefined}>>({} as {a: number | undefined});\nexpectType<RequiredDeep<{a?: {b: number} | undefined}>>({} as {a: {b: number} | undefined});\nexpectType<RequiredDeep<{a?: undefined}>>({} as {a: undefined});\n\n// Tuples\nexpectType<RequiredDeep<[string, number, boolean]>>({} as [string, number, boolean]); // All required\nexpectType<RequiredDeep<readonly [string, number?, boolean?]>>({} as readonly [string, number, boolean]); // Required and optional\nexpectType<RequiredDeep<[string?, number?, boolean?]>>({} as [string, number, boolean]); // All optional\nexpectType<RequiredDeep<[string, number, ...boolean[]]>>({} as [string, number, ...boolean[]]); // Required and trailing rest\nexpectType<RequiredDeep<readonly [string, number?, ...boolean[]]>>({} as readonly [string, number, ...boolean[]]); // Required, optional and trailing rest\nexpectType<RequiredDeep<[string?, number?, ...boolean[]]>>({} as [string, number, ...boolean[]]); // Optional and trailing rest\nexpectType<RequiredDeep<[...string[], number, boolean]>>({} as [...string[], number, boolean]); // Leading rest\nexpectType<RequiredDeep<[number, ...string[], number, boolean]>>({} as [number, ...string[], number, boolean]); // Rest in middle\n\n// Nested tuples\nexpectType<RequiredDeep<[[string, number?], [boolean, Date]?, [RegExp?, number?]?]>>({} as [[string, number], [boolean, Date], [RegExp, number]]);\nexpectType<RequiredDeep<[[{a?: string}, {b: number; c?: string}?], ...Array<[boolean, boolean?]>]>>({} as [[{a: string}, {b: number; c: string}], ...Array<[boolean, boolean]>]);\n\n// Non-tuple arrays\nexpectType<RequiredDeep<string[]>>({} as string[]);\nexpectType<RequiredDeep<Array<string | undefined>>>({} as string[]);\nexpectType<RequiredDeep<ReadonlyArray<string | undefined>>>({} as readonly string[]);\n\n// Maps\nexpectType<RequiredDeep<Map<{a?: string; b?: number}, {a?: string; b?: number}>>>({} as Map<{a: string; b: number}, {a: string; b: number}>);\nexpectType<RequiredDeep<ReadonlyMap<{a?: string; b?: number}, {a?: string; b?: number}>>>({} as ReadonlyMap<{a: string; b: number}, {a: string; b: number}>);\nexpectType<RequiredDeep<WeakMap<{a?: string; b?: number}, {a?: string; b?: number}>>>({} as WeakMap<{a: string; b: number}, {a: string; b: number}>);\n\n// Sets\nexpectType<RequiredDeep<Set<{a?: string; b?: number}>>>({} as Set<{a: string; b: number}>);\nexpectType<RequiredDeep<ReadonlySet<{a?: string; b?: number}>>>({} as ReadonlySet<{a: string; b: number}>);\nexpectType<RequiredDeep<WeakSet<{a?: string; b?: number}>>>({} as WeakSet<{a: string; b: number}>);\n\n// Promises\nexpectType<RequiredDeep<Promise<{a?: string; b?: number}>>>({} as Promise<{a: string; b: number}>);\nexpectType<RequiredDeep<Promise<Promise<{a?: string; b?: [number, number?]}>>>>({} as Promise<Promise<{a: string; b: [number, number]}>>);\n\n// Functions\ntype FunctionWithProperties = {(a1: string, a2: number): boolean; p1?: string; readonly p2?: number};\ndeclare const functionWithProperties: RequiredDeep<FunctionWithProperties>;\nexpectType<boolean>(functionWithProperties('foo', 1));\nexpectType<{p1: string; readonly p2: number}>({} as Simplify<typeof functionWithProperties>); // `Simplify` removes the call signature from `typeof functionWithProperties`\n\ntype FunctionWithProperties2 = {(a1: boolean, ...a2: string[]): number; p1?: {p2?: string; p3: {readonly p4?: boolean}}};\ndeclare const functionWithProperties2: RequiredDeep<FunctionWithProperties2>;\nexpectType<number>(functionWithProperties2(true, 'foo', 'bar'));\nexpectType<{p1: {p2: string; p3: {readonly p4: boolean}}}>({} as Simplify<typeof functionWithProperties2>);\n\ntype FunctionWithProperties3 = {(): void; p1?: {p2?: string; p3: [{p4?: number}, string?]}};\ndeclare const functionWithProperties3: RequiredDeep<FunctionWithProperties3>;\nexpectType<void>(functionWithProperties3());\nexpectType<{p1: {p2: string; p3: [{p4: number}, string]}}>({} as Simplify<typeof functionWithProperties3>);\n\n// Properties within functions containing multiple call signatures are not made required due to TS limitations, refer https://github.com/microsoft/TypeScript/issues/29732\ntype FunctionWithProperties4 = {(a1: number): string; (a1: string, a2: number): number; p1?: string};\ndeclare const functionWithProperties4: RequiredDeep<FunctionWithProperties4>;\nexpectType<string>(functionWithProperties4(1));\nexpectType<number>(functionWithProperties4('foo', 1));\nexpectNotType<{p1: string}>({} as Simplify<typeof functionWithProperties4>);\n"
  },
  {
    "path": "test-d/required-keys-of.ts",
    "content": "import {expectType} from 'tsd';\nimport type {RequiredKeysOf, UnknownRecord} from '../index.d.ts';\n\ntype TestType1 = {\n\ta: string;\n\tb?: boolean;\n};\n\ntype TestType2 = {\n\ta?: string;\n\tb?: boolean;\n};\n\ntype TestType3 = {\n\ta: string;\n\tb: boolean;\n};\n\ntype RequiredKeysOf1 = RequiredKeysOf<TestType1>;\ntype RequiredKeysOf2 = RequiredKeysOf<TestType2>;\ntype RequiredKeysOf3 = RequiredKeysOf<TestType3>;\n\ndeclare const test1: RequiredKeysOf1;\ndeclare const test2: RequiredKeysOf2;\ndeclare const test3: RequiredKeysOf3;\n\nexpectType<'a'>(test1);\nexpectType<never>(test2);\nexpectType<'a' | 'b'>(test3);\n\nexpectType<'a' | 'c'>({} as RequiredKeysOf<{readonly a: string; readonly b?: number; c: boolean; d?: string}>);\n\n// Unions\nexpectType<'b' | 'c'>({} as RequiredKeysOf<{a?: string; b: number} | {readonly c: string; readonly d?: number}>);\nexpectType<'a' | 'b'>({} as RequiredKeysOf<{a?: string; b?: number} | {a: string; b: number}>);\n\n// Arrays\nexpectType<keyof []>({} as RequiredKeysOf<[]>);\nexpectType<keyof readonly [string, number, boolean]>({} as RequiredKeysOf<readonly [string, number, boolean]>);\nexpectType<Exclude<keyof [string, number?, boolean?], '1' | '2'>>({} as RequiredKeysOf<[string, number?, boolean?]>);\nexpectType<Exclude<keyof [string, number, boolean?], '2'>>({} as RequiredKeysOf<[string?] | readonly [string, number?] | [string, number, boolean?]>);\n\n// `RequiredKeysOf<T>` should be assignable to `keyof T`\ntype Assignability1<T, _K extends keyof T> = unknown;\ntype Test1<T extends object> = Assignability1<T, RequiredKeysOf<T>>;\n\n// `keyof T` should NOT be assignable to `RequiredKeysOf<T>`\ntype Assignability2<T extends object, _K extends RequiredKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test2<T extends object> = Assignability2<T, keyof T>;\n\n// `RequiredKeysOf<T>` should be assignable to `PropertyKey`\ntype Assignability3<_T, _K extends PropertyKey> = unknown;\ntype Test3<T extends object> = Assignability3<T, RequiredKeysOf<T>>;\n\n// `PropertyKey` should NOT be assignable to `RequiredKeysOf<T>`\ntype Assignability4<T extends object, _K extends RequiredKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test4<T extends object> = Assignability4<T, PropertyKey>;\n\n// `RequiredKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability5<T extends Record<string, unknown>, _K extends keyof T> = unknown;\ntype Test5<T extends Record<string, unknown>> = Assignability5<T, RequiredKeysOf<T>>;\n\n// `RequiredKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `object`\ntype Assignability6<T extends object, _K extends keyof T> = unknown;\ntype Test6<T extends object> = Assignability6<T, RequiredKeysOf<T>>;\n\n// `RequiredKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `UnknownRecord`\ntype Assignability7<T extends UnknownRecord, _K extends keyof T> = unknown;\ntype Test7<T extends UnknownRecord> = Assignability7<T, RequiredKeysOf<T>>;\n\n// `keyof T` should NOT be assignable to `RequiredKeysOf<T>` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability8<T extends Record<string, unknown>, _K extends RequiredKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test8<T extends Record<string, unknown>> = Assignability8<T, keyof T>;\n\n// `keyof T` should NOT be assignable to `RequiredKeysOf<T>` even when `T` is constrained to `object`\ntype Assignability9<T extends object, _K extends RequiredKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test9<T extends object> = Assignability9<T, keyof T>;\n\n// `keyof T` should NOT be assignable to `RequiredKeysOf<T>` even when `T` is constrained to `UnknownRecord`\ntype Assignability10<T extends UnknownRecord, _K extends RequiredKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test10<T extends UnknownRecord> = Assignability10<T, keyof T>;\n"
  },
  {
    "path": "test-d/schema.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {Schema} from '../index.d.ts';\n\nconst foo = {\n\tbaz: 'fred',\n\tbar: {\n\t\tfunction: (_: string): void => undefined,\n\t\tobject: {key: 'value'},\n\t\tstring: 'waldo',\n\t\tnumber: 1,\n\t\tboolean: false,\n\t\tsymbol: Symbol('test'),\n\t\tmap: new Map<string, string>(),\n\t\tset: new Set<string>(),\n\t\tarray: ['foo'],\n\t\ttuple: ['foo'] as ['foo'],\n\t\tobjectArray: [{key: 'value'}],\n\t\treadonlyMap: new Map<string, string>() as ReadonlyMap<string, string>,\n\t\treadonlySet: new Set<string>() as ReadonlySet<string>,\n\t\treadonlyArray: ['foo'] as readonly string[],\n\t\treadonlyTuple: ['foo'] as const,\n\t\tregExp: /.*/g,\n\t},\n};\n\ntype FooOption = 'A' | 'B';\ntype FooSchema = Schema<typeof foo, FooOption>;\n\nconst fooSchema: FooSchema = {\n\tbaz: 'A',\n\tbar: {\n\t\tfunction: 'A',\n\t\tobject: {key: 'A'},\n\t\tstring: 'A',\n\t\tnumber: 'A',\n\t\tboolean: 'A',\n\t\tsymbol: 'A',\n\t\tmap: 'A',\n\t\tset: 'A',\n\t\tarray: ['A', 'A', 'A'],\n\t\ttuple: ['A'],\n\t\tobjectArray: [{key: 'A'}, {key: 'A'}, {key: 'A'}],\n\t\treadonlyMap: 'A',\n\t\treadonlySet: 'A',\n\t\treadonlyArray: ['A', 'A', 'A'] as const,\n\t\treadonlyTuple: ['A'] as const,\n\t\tregExp: 'A',\n\t},\n};\n\nexpectNotAssignable<FooSchema>(foo);\nexpectNotAssignable<FooSchema>({key: 'value'});\nexpectNotAssignable<FooSchema>(new Date());\nexpectType<FooOption>(fooSchema.baz);\n\nconst barSchema = fooSchema.bar;\nexpectType<FooOption>(barSchema.function);\nexpectType<{key: FooOption}>(barSchema.object);\nexpectType<FooOption>(barSchema.string);\nexpectType<FooOption>(barSchema.number);\nexpectType<FooOption>(barSchema.boolean);\nexpectType<FooOption>(barSchema.symbol);\nexpectType<FooOption>(barSchema.map);\nexpectType<FooOption>(barSchema.set);\nexpectType<FooOption[]>(barSchema.array);\nexpectType<[FooOption]>(barSchema.tuple);\nexpectType<Array<{key: FooOption}>>(barSchema.objectArray);\nexpectType<FooOption>(barSchema.readonlyMap);\nexpectType<FooOption>(barSchema.readonlySet);\nexpectType<readonly FooOption[]>(barSchema.readonlyArray);\nexpectType<readonly [FooOption]>(barSchema.readonlyTuple);\nexpectType<FooOption>(barSchema.regExp);\n\ntype ComplexOption = {\n\ttype: 'readonly' | 'required' | 'optional';\n\tvalidation(value: unknown): boolean;\n};\ntype ComplexSchema = Schema<typeof foo, ComplexOption>;\n\nconst createComplexOption = (type: ComplexOption['type']): ComplexOption => ({\n\ttype,\n\tvalidation(value) {\n\t\treturn value !== undefined;\n\t},\n});\n\nconst complexFoo: ComplexSchema = {\n\tbaz: createComplexOption('optional'),\n\tbar: {\n\t\tfunction: createComplexOption('required'),\n\t\tobject: {key: createComplexOption('readonly')},\n\t\tstring: createComplexOption('readonly'),\n\t\tnumber: createComplexOption('readonly'),\n\t\tboolean: createComplexOption('readonly'),\n\t\tsymbol: createComplexOption('readonly'),\n\t\tmap: createComplexOption('readonly'),\n\t\tset: createComplexOption('readonly'),\n\t\tarray: [createComplexOption('readonly'), createComplexOption('readonly'), createComplexOption('readonly')],\n\t\ttuple: [createComplexOption('readonly')],\n\t\tobjectArray: [{key: createComplexOption('readonly')}, {key: createComplexOption('readonly')}, {key: createComplexOption('readonly')}],\n\t\treadonlyMap: createComplexOption('readonly'),\n\t\treadonlySet: createComplexOption('readonly'),\n\t\treadonlyArray: [createComplexOption('readonly'), createComplexOption('readonly'), createComplexOption('readonly')] as const,\n\t\treadonlyTuple: [createComplexOption('readonly')] as const,\n\t\tregExp: createComplexOption('readonly'),\n\t},\n};\n\nexpectNotAssignable<ComplexSchema>(foo);\nexpectType<ComplexOption>(complexFoo.baz);\n\nconst complexBarSchema = complexFoo.bar;\nexpectType<ComplexOption>(complexBarSchema.function);\nexpectType<{key: ComplexOption}>(complexBarSchema.object);\nexpectType<ComplexOption>(complexBarSchema.string);\nexpectType<ComplexOption>(complexBarSchema.number);\nexpectType<ComplexOption>(complexBarSchema.boolean);\nexpectType<ComplexOption>(complexBarSchema.symbol);\nexpectType<ComplexOption>(complexBarSchema.map);\nexpectType<ComplexOption>(complexBarSchema.set);\nexpectType<ComplexOption[]>(complexBarSchema.array);\nexpectType<[ComplexOption]>(complexBarSchema.tuple);\nexpectType<Array<{key: ComplexOption}>>(complexBarSchema.objectArray);\nexpectType<ComplexOption>(complexBarSchema.readonlyMap);\nexpectType<ComplexOption>(complexBarSchema.readonlySet);\nexpectType<readonly ComplexOption[]>(complexBarSchema.readonlyArray);\nexpectType<readonly [ComplexOption]>(complexBarSchema.readonlyTuple);\nexpectType<ComplexOption>(complexBarSchema.regExp);\n\n// With Options and `recurseIntoArrays` set to `false`\ntype FooSchemaWithOptionsNoRecurse = Schema<typeof foo, FooOption, {recurseIntoArrays: false}>;\n\nconst fooSchemaWithOptionsNoRecurse: FooSchemaWithOptionsNoRecurse = {\n\tbaz: 'A',\n\tbar: {\n\t\tfunction: 'A',\n\t\tobject: {key: 'A'},\n\t\tstring: 'A',\n\t\tnumber: 'A',\n\t\tboolean: 'A',\n\t\tsymbol: 'A',\n\t\tmap: 'A',\n\t\tset: 'A',\n\t\tarray: 'A',\n\t\ttuple: 'A',\n\t\tobjectArray: 'A',\n\t\treadonlyMap: 'A',\n\t\treadonlySet: 'A',\n\t\treadonlyArray: 'A',\n\t\treadonlyTuple: 'A',\n\t\tregExp: 'A',\n\t},\n};\n\nexpectNotAssignable<FooSchemaWithOptionsNoRecurse>(foo);\nexpectNotAssignable<FooSchemaWithOptionsNoRecurse>({key: 'value'});\nexpectNotAssignable<FooSchemaWithOptionsNoRecurse>(new Date());\nexpectType<FooOption>(fooSchemaWithOptionsNoRecurse.baz);\n\nconst barSchemaWithOptionsNoRecurse = fooSchemaWithOptionsNoRecurse.bar;\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.function);\nexpectType<{key: FooOption}>(barSchemaWithOptionsNoRecurse.object);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.string);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.number);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.boolean);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.symbol);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.map);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.set);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.array);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.tuple);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.objectArray);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.readonlyMap);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.readonlySet);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.readonlyArray);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.readonlyTuple);\nexpectType<FooOption>(barSchemaWithOptionsNoRecurse.regExp);\n\n// With Options and `recurseIntoArrays` set to `true`\ntype FooSchemaWithOptionsRecurse = Schema<typeof foo, FooOption, {recurseIntoArrays: true}>;\n\nconst fooSchemaWithOptionsRecurse: FooSchemaWithOptionsRecurse = {\n\tbaz: 'A',\n\tbar: {\n\t\tfunction: 'A',\n\t\tobject: {key: 'A'},\n\t\tstring: 'A',\n\t\tnumber: 'A',\n\t\tboolean: 'A',\n\t\tsymbol: 'A',\n\t\tmap: 'A',\n\t\tset: 'A',\n\t\tarray: ['A', 'A', 'A'],\n\t\ttuple: ['A'],\n\t\tobjectArray: [{key: 'A'}, {key: 'A'}, {key: 'A'}],\n\t\treadonlyMap: 'A',\n\t\treadonlySet: 'A',\n\t\treadonlyArray: ['A', 'A', 'A'] as const,\n\t\treadonlyTuple: ['A'] as const,\n\t\tregExp: 'A',\n\t},\n};\n\nexpectNotAssignable<FooSchemaWithOptionsRecurse>(foo);\nexpectNotAssignable<FooSchemaWithOptionsRecurse>({key: 'value'});\nexpectNotAssignable<FooSchemaWithOptionsRecurse>(new Date());\nexpectType<FooOption>(fooSchema.baz);\n\nconst barSchemaWithOptionsRecurse = fooSchemaWithOptionsRecurse.bar;\nexpectType<FooOption>(barSchemaWithOptionsRecurse.function);\nexpectType<{key: FooOption}>(barSchemaWithOptionsRecurse.object);\nexpectType<FooOption>(barSchemaWithOptionsRecurse.string);\nexpectType<FooOption>(barSchemaWithOptionsRecurse.number);\nexpectType<FooOption>(barSchemaWithOptionsRecurse.boolean);\nexpectType<FooOption>(barSchemaWithOptionsRecurse.symbol);\nexpectType<FooOption>(barSchemaWithOptionsRecurse.map);\nexpectType<FooOption>(barSchemaWithOptionsRecurse.set);\nexpectType<FooOption[]>(barSchemaWithOptionsRecurse.array);\nexpectType<[FooOption]>(barSchemaWithOptionsRecurse.tuple);\nexpectType<Array<{key: FooOption}>>(barSchemaWithOptionsRecurse.objectArray);\nexpectType<FooOption>(barSchemaWithOptionsRecurse.readonlyMap);\nexpectType<FooOption>(barSchemaWithOptionsRecurse.readonlySet);\nexpectType<readonly FooOption[]>(barSchemaWithOptionsRecurse.readonlyArray);\nexpectType<readonly [FooOption]>(barSchemaWithOptionsRecurse.readonlyTuple);\nexpectType<FooOption>(barSchemaWithOptionsRecurse.regExp);\n\n// Non recursives\nexpectType<number>({} as Schema<string, number>);\nexpectType<string>({} as Schema<boolean, string>);\nexpectType<'c'>({} as Schema<'a' | 'b', 'c'>);\nexpectType<string | null>({} as Schema<number, string | null>);\nexpectType<false>({} as Schema<null | undefined, false>);\n\nexpectType<{date: Date}>({} as Schema<Date, {date: Date}>);\nexpectType<string>({} as Schema<RegExp, string>);\nexpectType<Set<number>>({} as Schema<Map<string, string>, Set<number>>);\nexpectType<Record<string, number>>({} as Schema<ReadonlyMap<string, string>, Record<string, number>>);\nexpectType<Map<string, number>>({} as Schema<Set<string>, Map<string, number>>);\nexpectType<readonly number[]>({} as Schema<ReadonlySet<string>, readonly number[]>);\nexpectType<{fn: unknown}>({} as Schema<(a: number, b: number) => void, {fn: unknown}>);\nexpectType<(a: string, b: string) => void>({} as Schema<(a: number, b: number) => void, (a: string, b: string) => void>);\nexpectType<{a: string}>({} as Schema<Map<string, number> | Set<number> | Date, {a: string}>);\n\n// Objects\nexpectType<{a: bigint}>({} as Schema<{a: number}, bigint>);\nexpectType<{a: {b: bigint}; c: bigint}>({} as Schema<{a: {b: number}; c: string}, bigint>);\nexpectType<{a: {b: bigint[]}; c: {d: {e: bigint} | {f: {g: bigint} | bigint}; h: {i: {j: {k: bigint}}}}}>(\n\t{} as Schema<{a: {b: string[]}; c: {d: {e: string} | {f: {g: number} | boolean}; h: {i: {j: {k: string}}}}}, bigint>,\n);\n\n// Preserves readonly and optional modifiers\nexpectType<{readonly a: number}>({} as Schema<{readonly a: string}, number>);\nexpectType<{a?: number}>({} as Schema<{a?: string}, number>);\nexpectType<{a?: {readonly b?: number}}>({} as Schema<{a?: {readonly b?: string}}, number>);\nexpectType<{0?: {readonly 1?: number}}>({} as Schema<{0?: {readonly 1?: string}}, number>);\nexpectType<{readonly a: boolean; b?: boolean; readonly c?: {readonly d?: {e?: boolean} | {readonly f: boolean}; g: {h: {readonly i: boolean}}}}>(\n\t{} as Schema<{readonly a: string; b?: string; readonly c?: {readonly d?: {e?: number} | {readonly f: number}; g: {h: {readonly i: bigint}}}}, boolean>,\n);\n\n// Caveat: Optional properties with explicit `undefined` don't behave differently from optional properties without explicit `undefined`.\n// For example, `Schema<{a?: {b?: number} | undefined}, string>` gives `{a?: {b?: string}}` and not `{a?: {b?: string} | string}`\nexpectType<{a?: {b?: string}}>({} as Schema<{a?: {b?: number} | undefined}, string>);\nexpectType<{a: {b?: string} | string}>({} as Schema<{a: {b?: number} | undefined}, string>);\n\n// Index signatures\nexpectType<Record<string, number>>({} as Schema<Record<string, string>, number>);\nexpectType<Record<string, {a: boolean; b: boolean}>>({} as Schema<Record<string, {a: string; b: number}>, boolean>);\nexpectType<Set<number> | Record<string, Set<number>>>({} as Schema<Map<string, string> | Record<string, string>, Set<number>>);\nexpectType<{[K: string]: number; a: number; b: number}>({} as Schema<{[K: string]: string; a: string; b: string}, number>);\nexpectType<{[K: number]: string; 0: string; 1: string}>({} as Schema<{[K: number]: boolean; 0: boolean; 1: boolean}, string>);\n\n// Edge cases\nexpectType<{}>({} as Schema<{}, number>);\nexpectType<bigint>({} as Schema<never, bigint>);\nexpectType<{a: {b: {c: string}}}>({} as Schema<any, {a: {b: {c: string}}}>);\n\n// Unions\nexpectType<{a: string} | {b: {c: string}}>({} as Schema<{a: number} | {b: {c: number}}, string>);\nexpectType<{a: {b: null} | {c: {d: null}}}>({} as Schema<{a: {b: string} | {c: {d: number}}}, null>);\nexpectType<{a: {b: null} | null}>({} as Schema<{a: {b: string} | string}, null>);\nexpectType<{a: {a: string}} | Array<{a: string}> | {a: string}>(\n\t{} as Schema<{a: string} | string[] | Set<string>, {a: string}>,\n);\nexpectType<{readonly a?: string}>(\n\t{} as Schema<Map<string, string> | Set<string> | Date | RegExp | (() => number), {readonly a?: string}>,\n);\n\n// Arrays\nexpectType<[bigint, bigint]>({} as Schema<[string, number], bigint>);\nexpectType<[{a: bigint}, bigint]>({} as Schema<[{a: string}, number], bigint>);\nexpectType<[Set<string>, (Set<string>)?, Set<string>?]>({} as Schema<[string, number?, boolean?], Set<string>>);\nexpectType<[string, {a: string}?, string?]>({} as Schema<[string, {a: number}?, boolean?], string>);\nexpectType<[null | undefined, null | undefined, ...Array<null | undefined>]>({} as Schema<[string, number, ...string[]], null | undefined>);\nexpectType<[({a?: string})?, ({a?: string})?]>({} as Schema<[string?, string?], {a?: string}>);\nexpectType<[bigint, bigint?, ({a: {b: bigint}})?, ...bigint[]]>(\n\t{} as Schema<[string, number?, ({a: {b: string}})?, ...string[]], bigint>,\n);\nexpectType<[bigint?, bigint?, ...Array<{a?: {b: bigint}}>]>({} as Schema<[string?, number?, ...Array<{a?: {b: string}}>], bigint>);\nexpectType<[...bigint[], bigint, bigint]>({} as Schema<[...string[], string, number], bigint>);\nexpectType<[bigint, ...bigint[], bigint, bigint]>({} as Schema<[string, ...string[], string, number], bigint>);\nexpectType<[bigint, [bigint, bigint], ...Array<[bigint, bigint?]>]>(\n\t{} as Schema<[string, [string, string], ...Array<[string, boolean?]>], bigint>,\n);\nexpectType<[`${number}`, [`${number}`, Array<{a: `${number}`}>], ...Array<[`${number}`, ...(Array<{a: `${number}`}>)]>]>(\n\t{} as Schema<[number, [number, Array<{a: number}>], ...Array<[number, ...(Array<{a: number}>)]>], `${number}`>,\n);\nexpectType<[x: number[], y: number[]]>({} as Schema<[x: bigint, y: bigint], number[]>);\nexpectType<[x: [x1: string, x2: string], y: [y1: string, y2: string]]>({} as Schema<[x: [x1: number, x2: number], y: [y1: number, y2: number]], string>);\n// Caveat: Optional properties with explicit `undefined` don't behave differently from optional properties without explicit `undefined`.\n// For example, `Schema<[({a: number} | undefined)?], bigint>` gives `[{a: bigint}?]` and not `[({a: bigint} | bigint)?]`\nexpectType<[{a: bigint}?]>({} as Schema<[({a: number} | undefined)?], bigint>);\nexpectType<[({a: bigint} | bigint)]>({} as Schema<[({a: number} | undefined)], bigint>);\n\n// === recurseIntoArrays: false ===\nexpectType<string>({} as Schema<number[], string, {recurseIntoArrays: false}>);\nexpectType<number>({} as Schema<[string, string, string], number, {recurseIntoArrays: false}>);\nexpectType<{a: number; b: number} | number>({} as Schema<{a: string[]; b: string} | [string, string, string], number, {recurseIntoArrays: false}>);\nexpectType<{a: 'a'; b: 'a'}>({} as Schema<{a: number[]; b: [string, string]}, 'a', {recurseIntoArrays: false}>);\nexpectType<{a: {b: {c: {d: {e: string[]}}}}}>({} as Schema<{a: {b: {c: {d: string[]}}}}, {e: string[]}, {recurseIntoArrays: false}>);\n"
  },
  {
    "path": "test-d/screaming-snake-case.ts",
    "content": "import {expectType} from 'tsd';\nimport type {ScreamingSnakeCase} from '../index.d.ts';\n\nconst snakeFromCamel: ScreamingSnakeCase<'fooBar'> = 'FOO_BAR';\nexpectType<'FOO_BAR'>(snakeFromCamel);\n\nconst snakeFromPascal: ScreamingSnakeCase<'FooBar'> = 'FOO_BAR';\nexpectType<'FOO_BAR'>(snakeFromPascal);\n\nconst snakeFromKebab: ScreamingSnakeCase<'foo-bar'> = 'FOO_BAR';\nexpectType<'FOO_BAR'>(snakeFromKebab);\n\nconst snakeFromSpace: ScreamingSnakeCase<'foo bar'> = 'FOO_BAR';\nexpectType<'FOO_BAR'>(snakeFromSpace);\n\nconst snakeFromSnake: ScreamingSnakeCase<'foo_bar'> = 'FOO_BAR';\nexpectType<'FOO_BAR'>(snakeFromSnake);\n\nconst noSnakeFromMono: ScreamingSnakeCase<'foobar'> = 'FOOBAR';\nexpectType<'FOOBAR'>(noSnakeFromMono);\n\nconst snakeFromCamelPascal: ScreamingSnakeCase<'FooBar'> = 'FOO_BAR';\nexpectType<'FOO_BAR'>(snakeFromCamelPascal);\n\nconst snakeFromComplexKebab: ScreamingSnakeCase<'foo-bar-abc-123'>\n\t= 'FOO_BAR_ABC_123';\nexpectType<'FOO_BAR_ABC_123'>(snakeFromComplexKebab);\n\nconst snakeFromMixed: ScreamingSnakeCase<'foo-bar_abc xyzBarFoo'>\n\t= 'FOO_BAR_ABC_XYZ_BAR_FOO';\nexpectType<'FOO_BAR_ABC_XYZ_BAR_FOO'>(snakeFromMixed);\n\nconst snakeFromVendorPrefixedCssProperty: ScreamingSnakeCase<'-webkit-animation'>\n\t= 'WEBKIT_ANIMATION';\nexpectType<'WEBKIT_ANIMATION'>(snakeFromVendorPrefixedCssProperty);\n\nconst snakeFromDoublePrefixedKebab: ScreamingSnakeCase<'--very-prefixed'>\n\t= 'VERY_PREFIXED';\nexpectType<'VERY_PREFIXED'>(snakeFromDoublePrefixedKebab);\n\nconst snakeFromRepeatedSeparators: ScreamingSnakeCase<'foo____bar'> = 'FOO_BAR';\nexpectType<'FOO_BAR'>(snakeFromRepeatedSeparators);\n\nconst snakeFromUppercase: ScreamingSnakeCase<'FOO'> = 'FOO';\nexpectType<'FOO'>(snakeFromUppercase);\n\nconst snakeFromLowercase: ScreamingSnakeCase<'foo'> = 'FOO';\nexpectType<'FOO'>(snakeFromLowercase);\n\nconst snakeFromScreamingSnakeCase: ScreamingSnakeCase<'FOO_BAR'> = 'FOO_BAR';\nexpectType<'FOO_BAR'>(snakeFromScreamingSnakeCase);\n\nconst snakeFromScreamingKebabCase: ScreamingSnakeCase<'FOO-BAR'> = 'FOO_BAR';\nexpectType<'FOO_BAR'>(snakeFromScreamingKebabCase);\n\nconst snakeFromMixed2: ScreamingSnakeCase<'parseHTML'> = 'PARSE_HTML';\nexpectType<'PARSE_HTML'>(snakeFromMixed2);\n\nconst snakeFromMixed3: ScreamingSnakeCase<'parseHTMLItem'> = 'PARSE_HTML_ITEM';\nexpectType<'PARSE_HTML_ITEM'>(snakeFromMixed3);\n\nconst snakeFromNumberInTheMiddleSplitOnNumbers: ScreamingSnakeCase<'foo2bar', {splitOnNumbers: true}> = 'FOO_2_BAR';\nexpectType<'FOO_2_BAR'>(snakeFromNumberInTheMiddleSplitOnNumbers);\n\nconst snakeFromNumberInTheMiddleSplitOnNumbersEdgeCase: ScreamingSnakeCase<'foO2Bar', {splitOnNumbers: true}> = 'FO_O_2_BAR';\nexpectType<'FO_O_2_BAR'>(snakeFromNumberInTheMiddleSplitOnNumbersEdgeCase);\n\nconst snakeFromNumberInTheMiddleSplitOnNumbersEdgeCase2: ScreamingSnakeCase<'foO2bar', {splitOnNumbers: true}> = 'FO_O_2_BAR';\nexpectType<'FO_O_2_BAR'>(snakeFromNumberInTheMiddleSplitOnNumbersEdgeCase2);\n\nconst snakeFromNumberInTheMiddleNoSplitOnNumbers: ScreamingSnakeCase<'foo2bar'> = 'FOO2BAR';\nexpectType<'FOO2BAR'>(snakeFromNumberInTheMiddleNoSplitOnNumbers);\n\nconst snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase: ScreamingSnakeCase<'foo2Bar'> = 'FOO2_BAR';\nexpectType<'FOO2_BAR'>(snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase);\n\nconst snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase2: ScreamingSnakeCase<'foO2bar'> = 'FO_O2BAR';\nexpectType<'FO_O2BAR'>(snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase2);\n\nconst snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase3: ScreamingSnakeCase<'FOO22Bar'> = 'FOO22_BAR';\nexpectType<'FOO22_BAR'>(snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase3);\n\nconst nonStringFromNonString: ScreamingSnakeCase<[]> = [];\nexpectType<[]>(nonStringFromNonString);\n\ndeclare const withPunctuation: ScreamingSnakeCase<'onDialog:close'>;\nexpectType<'ON_DIALOG:CLOSE'>(withPunctuation);\n\ndeclare const withPunctuation2: ScreamingSnakeCase<'foo-bar>>baz'>;\nexpectType<'FOO_BAR>>BAZ'>(withPunctuation2);\n\ndeclare const withPunctuation3: ScreamingSnakeCase<'card::after'>;\nexpectType<'CARD::AFTER'>(withPunctuation3);\n\ndeclare const withPunctuation4: ScreamingSnakeCase<'div.card::after'>;\nexpectType<'DIV.CARD::AFTER'>(withPunctuation4);\n\ndeclare const withPunctuationAndNumber: ScreamingSnakeCase<'foo-bar::01'>;\nexpectType<'FOO_BAR::01'>(withPunctuationAndNumber);\n\ndeclare const withPunctuationAndNumber2: ScreamingSnakeCase<'foo-bar::01', {splitOnNumbers: true}>;\nexpectType<'FOO_BAR::_01'>(withPunctuationAndNumber2);\n"
  },
  {
    "path": "test-d/set-field-type.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {SetFieldType} from '../index.d.ts';\n\ndeclare const variation1: SetFieldType<{a: number}, 'a', string>;\nexpectType<{a: string}>(variation1);\n\ndeclare const variation2: SetFieldType<{a: number; b: boolean; c: Date}, 'a' | 'b', string>;\nexpectType<{a: string; b: string; c: Date}>(variation2);\n\ndeclare const variation3: SetFieldType<{a: string; b: boolean; c: Date}, 'b' | 'c', number>;\nexpectType<{a: string; b: number; c: number}>(variation3);\n\ndeclare const variation4: SetFieldType<{a: string; b: string; c: string}, 'b', number>;\nexpectNotAssignable<{a: string; b: string; c: string}>(variation4);\n\n// Works with union types\ndeclare const variation5: SetFieldType<{a: string; b: string} | {a: number; c: number}, 'a', boolean>;\nexpectType<{a: boolean; b: string} | {a: boolean; c: number}>(variation5);\n\ndeclare const variation6: SetFieldType<{a: string; b: string} | {a: number; c: number}, 'a', boolean, {preservePropertyModifiers: false}>;\nexpectType<{a: boolean; b: string} | {a: boolean; c: number}>(variation6);\n\n// Property modifiers are always preserved for properties that are not being updated\ndeclare const variation7: SetFieldType<{a?: string; readonly b: string; c: string}, 'c', number>;\nexpectType<{a?: string; readonly b: string; c: number}>(variation7);\n\ndeclare const variation8: SetFieldType<{a?: string; readonly b: string; c: string}, 'c', number, {preservePropertyModifiers: false}>;\nexpectType<{a?: string; readonly b: string; c: number}>(variation8);\n\n// Preserves property modifiers\ndeclare const variation9: SetFieldType<{a?: string; readonly b: string; readonly c?: string}, 'a' | 'c', number>;\nexpectType<{a?: number; readonly b: string; readonly c?: number}>(variation9);\n\n// Doesn't preserve property modifiers when `preservePropertyModifiers` is `false`\ndeclare const variation10: SetFieldType<{a?: string; readonly b: string; readonly c?: string}, 'a' | 'c', number, {preservePropertyModifiers: false}>;\nexpectType<{a: number; readonly b: string; c: number}>(variation10);\n\n// Falls back to default of `true`, if `preservePropertyModifiers` is set to `boolean`\ndeclare const variation11: SetFieldType<{a?: string; readonly b: string; readonly c?: string}, 'a' | 'c', number, {preservePropertyModifiers: boolean}>;\nexpectType<{a?: number; readonly b: string; readonly c?: number}>(variation11);\n"
  },
  {
    "path": "test-d/set-non-nullable-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SetNonNullableDeep} from '../source/set-non-nullable-deep.d.ts';\n\nexpectType<{a: number}>({} as SetNonNullableDeep<{a: number | null}, 'a'>);\nexpectType<{a: number}>({} as SetNonNullableDeep<{a: number | undefined}, 'a'>);\nexpectType<{a: number}>({} as SetNonNullableDeep<{a: number | null | undefined}, 'a'>);\nexpectType<{a?: number}>({} as SetNonNullableDeep<{a?: number | null}, 'a'>);\nexpectType<{a?: number}>({} as SetNonNullableDeep<{a?: number | undefined}, 'a'>);\nexpectType<{a?: number}>({} as SetNonNullableDeep<{a?: number | null | undefined}, 'a'>);\n\nexpectType<{a: number; b: {c: string}}>({} as SetNonNullableDeep<{a: number; b: {c: string | null}}, 'b.c'>);\nexpectType<{a: number; b: {c: string}}>({} as SetNonNullableDeep<{a: number; b: {c: string | undefined}}, 'b.c'>);\nexpectType<{a: number; b: {c: string}}>({} as SetNonNullableDeep<{a: number; b: {c: string | null | undefined}}, 'b.c'>);\nexpectType<{a: number; b: {c?: string}}>({} as SetNonNullableDeep<{a: number; b: {c?: string | null}}, 'b.c'>);\nexpectType<{a: number; b: {c?: string}}>({} as SetNonNullableDeep<{a: number; b: {c?: string | undefined}}, 'b.c'>);\nexpectType<{a: number; b: {c?: string}}>({} as SetNonNullableDeep<{a: number; b: {c?: string | null | undefined}}, 'b.c'>);\n\n// Becomes `never` when the value is only `null` or `undefined`\nexpectType<{a: never}>({} as SetNonNullableDeep<{a: null | undefined}, 'a'>);\nexpectType<{a?: never}>({} as SetNonNullableDeep<{a?: null | undefined}, 'a'>);\n\n// Ignores keys that are already non-nullable\nexpectType<{a: number}>({} as SetNonNullableDeep<{a: number}, 'a'>);\nexpectType<{readonly a?: number}>({} as SetNonNullableDeep<{readonly a?: number}, 'a'>);\nexpectType<{a?: number; b: {c: string}}>({} as SetNonNullableDeep<{a?: number; b: {c: string}}, 'b.c'>);\nexpectType<{a: number; readonly b?: {c?: string}}>({} as SetNonNullableDeep<{a: number; readonly b?: {c?: string}}, 'b.c'>);\n\n// Removes nullables only from the specified keys, nullables in other paths are preserved\nexpectType<{a: number; b: {c: string | null | undefined} | null | undefined}>(\n\t{} as SetNonNullableDeep<{a: number | null | undefined; b: {c: string | null | undefined} | null | undefined}, 'a'>,\n);\nexpectType<{a: number | null | undefined; b: {c: string | null | undefined}}>(\n\t{} as SetNonNullableDeep<{a: number | null | undefined; b: {c: string | null | undefined} | null | undefined}, 'b'>,\n);\nexpectType<{a: number | null | undefined; b: {c: string} | null | undefined}>(\n\t{} as SetNonNullableDeep<{a: number | null | undefined; b: {c: string | null | undefined} | null | undefined}, 'b.c'>,\n);\nexpectType<{a: {b: string}}>({} as SetNonNullableDeep<{a: {b: string | null} | null | undefined}, 'a' | 'a.b'>);\nexpectType<{a: {b: {c: string}} | null | undefined}>({} as SetNonNullableDeep<{a: {b: {c: string | undefined} | null} | null | undefined}, 'a.b' | 'a.b.c'>);\nexpectType<{a: {b: {c: string} | null}}>({} as SetNonNullableDeep<{a: {b: {c: string | undefined} | null} | null | undefined}, 'a' | 'a.b.c'>);\nexpectType<{a: {b?: {c: {d?: {e: number | string}; f: {g: boolean}} | undefined} | null; h: number | null}}>(\n\t{} as SetNonNullableDeep<\n\t\t{a: {b?: {c: {d?: {e: number | string} | null; f: {g: boolean | null}} | undefined} | null; h: number | null} | undefined},\n\t'a' | 'a.b.c.d' | 'a.b.c.f.g'\n\t>,\n);\n\n// Unions\nexpectType<{a: string} | {a?: number} | {a: boolean}>({} as SetNonNullableDeep<{a: string | null} | {a?: number | undefined} | {a: boolean | null | undefined}, 'a'>);\nexpectType<{a: string; b: number}>({} as SetNonNullableDeep<{a: string | null; b: number | undefined}, 'a' | 'b'>);\nexpectType<{a: string; b: {c: {d: {e: number}} | null} | undefined}>(\n\t{} as SetNonNullableDeep<{a: string | null; b: {c: {d: {e: number | undefined}} | null} | undefined}, 'a' | 'b.c.d.e'>,\n);\nexpectType<{a: {b: string | null}} | {a?: number; b: {c?: string}}>(\n\t{} as SetNonNullableDeep<{a: {b: string | null} | undefined} | {a?: number | undefined; b: {c?: string}}, 'a' | 'b.c'>,\n);\nexpectType<{a: string; b: {c?: {d: string} | undefined; f?: number}} | {a: {b: number}; c: never; d?: undefined}>(\n\t{} as SetNonNullableDeep<\n\t{a: string; b: {c?: {d: string | null} | undefined; f?: number} | null} | {a: {b: number | null}; c: null; d?: undefined},\n\t'b' | 'b.c.d' | 'a.b' | 'c'\n\t>,\n);\nexpectType<{a: 1; b: {c: 2}; d?: {e?: {f?: 2}; g?: 3}}>(\n\t{} as SetNonNullableDeep<{a: 1 | null; b: {c: 2 | null}; d?: {e?: {f?: 2 | null}; g?: 3}}, 'a' | 'b' | 'b.c' | 'd.e.f' | 'd.g'>,\n);\nexpectType<{a: {b: string} | {c: string} | {b: {c: string | null}}}>(\n\t{} as SetNonNullableDeep<{a: {b: string | null} | {c: string} | {b: {c: string | null} | undefined}}, 'a.b'>,\n);\n\n// Preserves non-nullable values when they are in a union with objects\nexpectType<{a?: {b: string} | number}>({} as SetNonNullableDeep<{a?: {b: string} | number | null | undefined}, 'a'>);\nexpectType<{a: {b: Array<{c?: number | null}> | number}}>({} as SetNonNullableDeep<{a: {b: Array<{c?: number | null}> | number | null}}, 'a.b'>);\nexpectType<{a: {b: string | number} | number}>({} as SetNonNullableDeep<{a: {b: string | number | null} | number | null | undefined}, 'a' | 'a.b'>);\nexpectType<{a: number; b: {c: number | null} | {d: string}}>({} as SetNonNullableDeep<{a: number; b: {c: number | null} | {d: string | undefined} | null}, 'b' | 'b.d'>);\n\n// Preserves `readonly` modifier\nexpectType<{a: string; b: {readonly c: number}}>({} as SetNonNullableDeep<{a: string; b: {readonly c: number | null}}, 'b.c'>);\nexpectType<{readonly a: string; readonly b: {c: number | null}}>({} as SetNonNullableDeep<{readonly a: string | null; readonly b: {c: number | null} | null}, 'a' | 'b'>);\nexpectType<{readonly a: string; readonly b: {readonly c: number}}>({} as SetNonNullableDeep<{readonly a: string | null; readonly b: {readonly c: number | null} | null}, 'a' | 'b' | 'b.c'>);\n\n// Number keys\nexpectType<{0: 1; 1: {2?: string}}>({} as SetNonNullableDeep<{0: 1; 1: {2?: string | null}}, '1.2'>);\nexpectType<{0: 1; 1?: {2: string | null}}>({} as SetNonNullableDeep<{0: 1 | null; 1?: {2: string | null} | undefined}, 0 | 1>);\n\n// Number keys containing dots\n// NOTE: Passing \"1.2\" instead of 1.2 will treat it as a path instead of a key\nexpectType<{1.2?: string; 1?: {2?: string | null} | null}>({} as SetNonNullableDeep<{1.2?: string | null; 1?: {2?: string | null} | null}, 1.2>);\nexpectType<{1.2?: string | null; 1?: {2?: string} | null}>({} as SetNonNullableDeep<{1.2?: string | null; 1?: {2?: string | null} | null}, '1.2'>);\nexpectType<{1.2?: string; 1?: {2?: string} | undefined}>({} as SetNonNullableDeep<{1.2?: string | undefined; 1?: {2?: string | undefined} | undefined}, 1.2 | '1.2'>);\n\n// Index signatures\nexpectType<{[x: string]: any; a: number; b: {c: number}}>({} as SetNonNullableDeep<{[x: string]: any; a: number | null; b: {c: number | null}}, 'a' | 'b.c'>);\n\n// Works with `KeyPaths` containing template literals\nexpectType<{a: number | null; b: {c: number} | {d: number} | null | undefined}>(\n\t{} as SetNonNullableDeep<{a: number | null; b: {c: number | null} | {d: number | undefined} | null | undefined}, `b.${'c' | 'd'}`>,\n);\nexpectType<{a: number; b: null | {readonly c: {1: number[]} | undefined} | {d: {1: number[]} | null}}>({} as SetNonNullableDeep<\n\t{a: number | undefined; b: null | {readonly c: {1: number[] | undefined} | undefined} | {d: {1: number[] | undefined} | null}}, 'a' | `b.${'c' | 'd'}.1`\n>);\n\n// Non recursive types\nexpectType<{a: {b: never} | Set<number | null>}>({} as SetNonNullableDeep<{a: {b: null} | Set<number | null>}, 'a.b'>);\nexpectType<{a: {b: {c: string} | Map<string, string>}}>({} as SetNonNullableDeep<{a: {b: {c: string} | Map<string, string> | null}}, 'a.b'>);\n\n// === Arrays ===\nexpectType<[string, number | null, boolean]>({} as SetNonNullableDeep<[string | null, number | null, boolean | undefined], '0' | '2'>);\nexpectType<{a?: [string, number, (boolean | null)?] | null}>({} as SetNonNullableDeep<{a?: [string | undefined, number | undefined, (boolean | null)?] | null}, 'a.0' | 'a.1'>);\nexpectType<{a?: [string | null, number?, boolean?] | null}>({} as SetNonNullableDeep<{a?: [string | null, (number | undefined)?, (boolean | null)?] | null}, 'a.1' | 'a.2'>);\nexpectType<{a: readonly [string, number, (boolean | null)?]}>({} as SetNonNullableDeep<{a: readonly [string, number | undefined, (boolean | null)?]}, 'a.1'>);\nexpectType<{readonly a: [string, number | null | undefined, boolean, ...Array<number | null>]}>(\n\t{} as SetNonNullableDeep<{readonly a: [string | null, number | null | undefined, boolean | undefined, ...Array<number | null>]}, 'a.0' | 'a.2'>,\n);\nexpectType<{readonly a?: [string, number, boolean, ...Array<string | null>]}>(\n\t{} as SetNonNullableDeep<{readonly a?: [string, number | null, boolean | undefined, ...Array<string | null>] | undefined}, 'a' | 'a.1' | 'a.2'>,\n);\n\n// Readonly arrays\nexpectType<{a?: {b?: readonly [(string | number)?]} | null}>({} as SetNonNullableDeep<{a?: {b?: readonly [(string | number | null)?]} | null}, 'a.b.0'>);\nexpectType<{a: readonly [string, number, boolean, ...Array<string | undefined>] | undefined}>(\n\t{} as SetNonNullableDeep<{a: readonly [string | null, number | undefined, boolean | null, ...Array<string | undefined>] | undefined}, 'a.0' | 'a.1' | 'a.2'>,\n);\n\n// Ignores `Keys` that are already non-nullable\nexpectType<{a: [string, (number | null)?, boolean?]}>({} as SetNonNullableDeep<{a: [string, (number | null)?, boolean?]}, 'a.0'>);\nexpectType<{a: [string, number?, boolean?]}>({} as SetNonNullableDeep<{a: [string, (number | null)?, boolean?]}, 'a.0' | 'a.1'>);\n\n// Ignores `Keys` that are not known\n// This case is only possible when the array contains a rest element,\n// because otherwise the constaint on `KeyPaths` would disallow out of bound keys.\nexpectType<{a?: readonly [string | null, (number | undefined)?, (boolean | null)?, ...Array<number | null | undefined>] | undefined}>(\n\t{} as SetNonNullableDeep<{a?: readonly [string | null, (number | undefined)?, (boolean | null)?, ...Array<number | null | undefined>] | undefined}, 'a.10'>,\n);\n\n// Unions of arrays\nexpectType<{a: [string] | [string, number?, (boolean | null)?, ...Array<number | null>] | readonly [string, number, (boolean | undefined)?]}>(\n\t{} as SetNonNullableDeep<\n\t\t{a: [string | undefined] | [string | null, number?, (boolean | null)?, ...Array<number | null>] | readonly [string | null | undefined, number | null, (boolean | undefined)?]},\n\t'a.0' | 'a.1'\n\t>,\n);\n\n// Labelled tuples\nexpectType<{a?: [b: string, c: number] | undefined}>({} as SetNonNullableDeep<{a?: [b: string | null, c: number | undefined] | undefined}, 'a.0' | 'a.1'>);\n\n// Non-tuple arrays\nexpectType<{a: string[]}>({} as SetNonNullableDeep<{a: Array<string | null>}, `a.${number}`>);\nexpectType<{readonly a: ReadonlyArray<string | number>}>({} as SetNonNullableDeep<{readonly a: ReadonlyArray<string | number | null> | undefined}, 'a' | `a.${number}`>);\n\n// Nested arrays\nexpectType<{a?: [([string?, (number | null)?] | null)?]}>({} as SetNonNullableDeep<{a?: [([(string | undefined)?, (number | null)?] | null)?] | undefined}, 'a' | 'a.0.0'>);\nexpectType<{a?: [[(string | undefined)?, number?]?] | undefined}>({} as SetNonNullableDeep<{a?: [([(string | undefined)?, (number | null)?] | null)?] | undefined}, 'a.0.1' | 'a.0'>);\nexpectType<{a?: [[string | null, number]?] | null}>({} as SetNonNullableDeep<{a?: [([string | null, number | undefined] | null)?] | null}, 'a.0' | 'a.0.1'>);\nexpectType<{a?: Array<[string | null, number?]> | null}>({} as SetNonNullableDeep<{a?: Array<[string | null, (number | undefined)?]> | null}, `a.${number}.1`>);\n\n// Removes `null` & `undefined` from keys inside arrays\nexpectType<{a?: Array<{b: number}> | undefined}>({} as SetNonNullableDeep<{a?: Array<{b: number | null}> | undefined}, `a.${number}.b`>);\nexpectType<{readonly a?: [{readonly b: number}]}>({} as SetNonNullableDeep<{readonly a?: [{readonly b: number | undefined}] | null}, 'a' | 'a.0' | 'a.0.b'>);\nexpectType<{readonly a: [{readonly b: number}, {c?: string | null}?]}>(\n\t{} as SetNonNullableDeep<{readonly a: [{readonly b: number | null | undefined}, ({c?: string | null} | undefined)?]}, 'a.0.b' | 'a.1'>,\n);\nexpectType<{a?: Array<{b: number; c?: string | null}> | null}>({} as SetNonNullableDeep<{a?: Array<{b: number | undefined; c?: string | null}> | null}, `a.${number}.b`>);\nexpectType<{a: [{b?: number | null; readonly c: string}]}>({} as SetNonNullableDeep<{a: [{b?: number | null; readonly c: string | undefined}]}, 'a.0.c'>);\n"
  },
  {
    "path": "test-d/set-non-nullable.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {SetNonNullable} from '../index.d.ts';\n\n// Update one possibly undefined key and one possibly null key to non-nullable.\ndeclare const variation1: SetNonNullable<{a: number; b: string | undefined; c: boolean | null}, 'b' | 'c'>;\nexpectType<{a: number; b: string; c: boolean}>(variation1);\n\n// Update a key that is possibly null or undefined.\ndeclare const variation2: SetNonNullable<{a: number; b: string | null | undefined}, 'b'>;\nexpectType<{a: number; b: string}>(variation2);\n\n// Update an optional key.\ndeclare const variation3: SetNonNullable<{a: number; b?: string | undefined}, 'b'>;\nexpectType<{a: number; b?: string}>(variation3);\n\n// Fail if type changes even if non-nullable is right.\ndeclare const variation4: SetNonNullable<{a: number; b: string | undefined}, 'b'>;\nexpectNotAssignable<{a: string; b: string}>(variation4);\n\n// Update all keys if `Keys` generic is not passed.\ndeclare const variation5: SetNonNullable<{a: number; b: string | undefined; c: boolean | null}>;\nexpectType<{a: number; b: string; c: boolean}>(variation5);\n\n// Does not throw type error in type predicate contexts.\ntype Variation6Config = {a: boolean | null; b: boolean | null};\nconst variant6Function = <TProperty extends keyof Variation6Config>(\n\tconfig: Variation6Config,\n\tproperty: TProperty,\n): config is SetNonNullable<Variation6Config, TProperty> => Boolean(config[property]);\nexpectNotAssignable<never>(variant6Function); // Just to prevent unused error.\n"
  },
  {
    "path": "test-d/set-optional.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {SetOptional, Simplify} from '../index.d.ts';\n\n// Update one required and one optional to optional.\ndeclare const variation1: SetOptional<{a: number; b?: string; c: boolean}, 'b' | 'c'>;\nexpectType<{a: number; b?: string; c?: boolean}>(variation1);\n\n// Update two required to optional.\ndeclare const variation2: SetOptional<{a: number; b: string; c: boolean}, 'a' | 'b'>;\nexpectType<{a?: number; b?: string; c: boolean}>(variation2);\n\n// Three optional remain optional.\ndeclare const variation3: SetOptional<{a?: number; b?: string; c?: boolean}, 'a' | 'b' | 'c'>;\nexpectType<{a?: number; b?: string; c?: boolean}>(variation3);\n\n// Fail if type changes even if optional is right.\ndeclare const variation4: SetOptional<{a: number; b?: string; c: boolean}, 'b' | 'c'>;\nexpectNotAssignable<{a: boolean; b?: string; c?: boolean}>(variation4);\n\n// Preserves readonly modifier.\ndeclare const variation5: SetOptional<{readonly a: number; readonly b?: string; c: boolean}, 'b' | 'c'>;\nexpectType<{readonly a: number; readonly b?: string; c?: boolean}>(variation5);\n\n// Works with unions.\ndeclare const variation6: SetOptional<{readonly a: number; b: number; c: boolean} | {a: string; readonly b: string; d: boolean}, 'a' | 'b'>;\nexpectType<{readonly a?: number; b?: number; c: boolean} | {a?: string; readonly b?: string; d: boolean}>(variation6);\n\n// Marks all keys as optional, if `Keys` is `any`.\ndeclare const variation7: SetOptional<{readonly a: number; b: string; c: boolean}, any>;\nexpectType<{readonly a?: number; b?: string; c?: boolean}>(variation7);\n\n// Does nothing, if `Keys` is `never`.\ndeclare const variation8: SetOptional<{a?: number; readonly b?: string; readonly c: boolean}, never>;\nexpectType<{a?: number; readonly b?: string; readonly c: boolean}>(variation8);\n\n// Works with index signatures\ndeclare const variation9: SetOptional<{[k: string]: unknown; a: number; b?: string}, 'a' | 'b'>;\nexpectType<{[k: string]: unknown; a?: number; b?: string}>(variation9);\n\n// Works with functions containing properties\ndeclare const variation10: SetOptional<{(a1: string, a2: number): boolean; p1: string; readonly p2?: number}, 'p1'>;\nexpectType<boolean>(variation10('foo', 1));\nexpectType<{p1?: string; readonly p2?: number}>({} as Simplify<typeof variation10>); // `Simplify` removes the call signature from `typeof variation10`\n\ndeclare const variation11: SetOptional<{(a1: boolean, ...a2: string[]): number; p1: string; readonly p2: number; p3: boolean}, 'p1' | 'p2'>;\nexpectType<number>(variation11(true, 'foo', 'bar', 'baz'));\nexpectType<{p1?: string; readonly p2?: number; p3: boolean}>({} as Simplify<typeof variation11>);\n\n// Functions without properties are returned as is\ndeclare const variation12: SetOptional<(a: string) => number, never>;\nexpectType<number>(variation12('foo'));\n"
  },
  {
    "path": "test-d/set-parameter-type.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SetParameterType} from '../index.d.ts';\n\nfunction function_(_a: number, _b: string, _c: Object, ..._arguments: boolean[]) {\n\treturn null;\n}\n\n// @ts-ignore Global requires @types/node\nfunction functionWithThis(this: Global, _a: number) {\n\treturn null;\n}\n\nconst arrowFunction = (_a: number) => null;\n\n// Normal case\ndeclare const test1: SetParameterType<typeof function_, {1: boolean}>;\nexpectType<(a: number, b: boolean, c: Object, ...arguments_: boolean[]) => null>(test1);\ntest1(1, true, {}, true);\n\n// Test multiple parameters\ndeclare const test2: SetParameterType<typeof function_, {0: string; 2: boolean}>;\nexpectType<(a: string, b: string, c: boolean, ...arguments_: boolean[]) => null>(test2);\ntest2('1', '2', true, true);\n\n// Test another define way\ndeclare const test3: SetParameterType<typeof function_, [a: 'a', b: 'b']>;\nexpectType<(a: 'a', b: 'b', c: Object, ...arguments_: boolean[]) => null>(test3);\ntest3('a', 'b', {}, true);\n\n// Test `...args` parameter\ndeclare const testargs: SetParameterType<typeof function_, {3: string}>;\nexpectType<(a: number, b: string, c: Object, ...arguments_: string[]) => null>(testargs);\ntestargs(1, '1', {}, '1');\n\ndeclare const testargs2: SetParameterType<typeof function_, [string, number, number, ...boolean[]]>;\nexpectType<(a: string, b: number, c: number, ...arguments_: boolean[]) => null>(testargs2);\ntestargs2('1', 1, 1, true);\n\n// Test arrow function\ndeclare const test5: SetParameterType<typeof arrowFunction, {0: string}>;\nexpectType<(a: string) => null>(test5);\n\n// TODO: Fix. The `this` is reported as `any`.\n// Test the function that has `this` parameter\n// declare const testThis: SetParameterType<typeof functionWithThis, {0: string}>;\n\n// expectType<(this: typeof globalThis, a: string) => null>(testThis);\n\n// // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n// testThis.call(globalThis, '1');\n"
  },
  {
    "path": "test-d/set-readonly.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {SetReadonly, Simplify} from '../index.d.ts';\n\n// Update one readonly and one non readonly to readonly.\ndeclare const variation1: SetReadonly<{a: number; readonly b: string; c: boolean}, 'b' | 'c'>;\nexpectType<{a: number; readonly b: string; readonly c: boolean}>(variation1);\n\n// Update two non readonly to readonly.\ndeclare const variation2: SetReadonly<{readonly a: number; readonly b: string; c: boolean}, 'a' | 'b'>;\nexpectType<{readonly a: number; readonly b: string; c: boolean}>(variation2);\n\n// Three readonly remain readonly.\ndeclare const variation3: SetReadonly<{readonly a: number; readonly b?: string; readonly c: boolean}, 'a' | 'b' | 'c'>;\nexpectType<{readonly a: number; readonly b?: string; readonly c: boolean}>(variation3);\n\n// Fail if type changes even if readonly is right.\ndeclare const variation4: SetReadonly<{a: number; readonly b: string; c: boolean}, 'b' | 'c'>;\nexpectNotAssignable<{a: boolean; readonly b: string; readonly c: boolean}>(variation4);\n\n// Preserves optional modifier.\ndeclare const variation5: SetReadonly<{a?: number; readonly b?: string; c?: boolean}, 'b' | 'c'>;\nexpectType<{a?: number; readonly b?: string; readonly c?: boolean}>(variation5);\n\n// Works with unions.\ndeclare const variation6: SetReadonly<{a?: number; b: number; c: boolean} | {a: string; b?: string; d: boolean}, 'a' | 'b'>;\nexpectType<{readonly a?: number; readonly b: number; c: boolean} | {readonly a: string; readonly b?: string; d: boolean}>(variation6);\n\n// Marks all keys as readonly, if `Keys` is `any`.\ndeclare const variation7: SetReadonly<{a?: number; b: string; c: boolean}, any>;\nexpectType<{readonly a?: number; readonly b: string; readonly c: boolean}>(variation7);\n\n// Does nothing, if `Keys` is `never`.\ndeclare const variation8: SetReadonly<{a: number; readonly b: string; readonly c: boolean}, never>;\nexpectType<{a: number; readonly b: string; readonly c: boolean}>(variation8);\n\n// Works with index signatures\ndeclare const variation9: SetReadonly<{[k: string]: unknown; a: number; readonly b: string}, 'a' | 'b'>;\nexpectType<{[k: string]: unknown; readonly a: number; readonly b: string}>(variation9);\n\n// Works with functions containing properties\ndeclare const variation10: SetReadonly<{(a1: string, a2: number): boolean; p1: string; readonly p2?: number}, 'p1'>;\nexpectType<boolean>(variation10('foo', 1));\nexpectType<{readonly p1: string; readonly p2?: number}>({} as Simplify<typeof variation10>); // Simplify removes the call signature from `typeof variation10`\n\ndeclare const variation11: SetReadonly<{(a1: boolean, ...a2: string[]): number; p1: string; p2?: number; p3: boolean}, 'p1' | 'p2'>;\nexpectType<number>(variation11(true, 'foo', 'bar', 'baz'));\nexpectType<{readonly p1: string; readonly p2?: number; p3: boolean}>({} as Simplify<typeof variation11>);\n\n// Functions without properties are returned as is\ndeclare const variation12: SetReadonly<(a: string) => number, never>;\nexpectType<number>(variation12('foo'));\n"
  },
  {
    "path": "test-d/set-required-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SetRequiredDeep} from '../index.d.ts';\n\n// Set nested key to required\ndeclare const variation1: SetRequiredDeep<{a?: number; b?: {c?: string}}, 'b.c'>;\nexpectType<{a?: number; b?: {c: string}}>(variation1);\n\n// Set key to required but not nested keys if not specified\ndeclare const variation2: SetRequiredDeep<{a?: number; b?: {c?: string}}, 'b'>;\nexpectType<{a?: number; b: {c?: string}}>(variation2);\n\n// Set root key to required\ndeclare const variation3: SetRequiredDeep<{a?: number; b?: {c?: string}}, 'a'>;\nexpectType<{a: number; b?: {c?: string}}>(variation3);\n\n// Keeps required key as required\ndeclare const variation4: SetRequiredDeep<{a: number; b?: {c?: string}}, 'a'>;\nexpectType<{a: number; b?: {c?: string}}>(variation4);\n\n// Set key to required in a union.\ndeclare const variation5: SetRequiredDeep<{a?: '1'; b?: {c?: boolean}} | {a?: '2'; b?: {c?: boolean}}, 'a'>;\nexpectType<{a: '1'; b?: {c?: boolean}} | {a: '2'; b?: {c?: boolean}}>(variation5);\n\n// Set key with array type to required\ndeclare const variation6: SetRequiredDeep<{a?: Array<{b?: number}>}, 'a'>;\nexpectType<{a: Array<{b?: number}>}>(variation6);\n\n// Can set both root and nested keys to required\ndeclare const variation7: SetRequiredDeep<{a?: number; b?: {c?: string}}, 'b' | 'b.c'>;\nexpectType<{a?: number; b: {c: string}}>(variation7);\n\n// Preserves required root keys\ndeclare const variation8: SetRequiredDeep<{a: 1; b: {c?: 1}}, 'b.c'>;\nexpectType<{a: 1; b: {c: 1}}>(variation8);\n\n// Preserves union in root keys\ndeclare const variation9: SetRequiredDeep<{a: 1; b: {c?: 1} | number}, 'b.c'>;\nexpectType<{a: 1; b: {c: 1} | number}>(variation9);\n\n// Preserves readonly\ndeclare const variation10: SetRequiredDeep<{a: 1; readonly b: {c?: 1}}, 'b.c'>;\nexpectType<{a: 1; readonly b: {c: 1}}>(variation10);\n\ndeclare const variation11: SetRequiredDeep<{readonly a?: 1; readonly b?: {readonly c?: 1}}, 'a' | 'b'>;\nexpectType<{readonly a: 1; readonly b: {readonly c?: 1}}>(variation11);\n\ndeclare const variation12: SetRequiredDeep<{readonly a?: 1; readonly b?: {readonly c?: 1}}, 'a' | 'b' | 'b.c'>;\nexpectType<{readonly a: 1; readonly b: {readonly c: 1}}>(variation12);\n\n// Works with number keys\ndeclare const variation13: SetRequiredDeep<{0: 1; 1: {2?: string}}, '1.2'>;\nexpectType<{0: 1; 1: {2: string}}>(variation13);\n\ndeclare const variation14: SetRequiredDeep<{0?: 1; 1?: {2?: string}}, 0 | 1>;\nexpectType<{0: 1; 1: {2?: string}}>(variation14);\n\n// Multiple keys\ndeclare const variation15: SetRequiredDeep<{a?: 1; b?: {c?: 2}; d?: {e?: {f?: 2}; g?: 3}}, 'a' | 'b' | 'b.c' | 'd.e.f' | 'd.g'>;\nexpectType<{a: 1; b: {c: 2}; d?: {e?: {f: 2}; g: 3}}>(variation15);\n\n// Index signatures\ndeclare const variation16: SetRequiredDeep<{[x: string]: any; a?: number; b?: {c?: number}}, 'a' | 'b.c'>;\nexpectType<{[x: string]: any; a: number; b?: {c: number}}>(variation16);\n\n// Preserves union in nested keys\ndeclare const variation17: SetRequiredDeep<{a: 1; b?: {c?: 1} | number}, 'b'>;\nexpectType<{a: 1; b: {c?: 1} | number}>(variation17);\n\ndeclare const variation18: SetRequiredDeep<{a?: number; b?: {c?: number} | {d?: string}}, 'b' | 'b.d'>;\nexpectType<{a?: number; b: {c?: number} | {d: string}}>(variation18);\n\n// Works with number keys containing dots\n// NOTE: Passing \"1.2\" instead of 1.2 will treat it as a path instead of a key\ndeclare const variation19: SetRequiredDeep<{1.2?: string; 1?: {2?: string}}, 1.2>;\nexpectType<{1.2: string; 1?: {2?: string}}>(variation19);\n\ndeclare const variation20: SetRequiredDeep<{1.2?: string; 1?: {2?: string}}, '1.2'>;\nexpectType<{1.2?: string; 1?: {2: string}}>(variation20);\n\ndeclare const variation21: SetRequiredDeep<{1.2?: string; 1?: {2?: string}}, 1.2 | '1.2'>;\nexpectType<{1.2: string; 1?: {2: string}}>(variation21);\n\n// Works with unions\ndeclare const variation22: SetRequiredDeep<{a?: {readonly b?: number}} | {readonly b?: {c?: number[]}}, 'a.b' | 'b' | 'b.c'>;\nexpectType<{a?: {readonly b: number}} | {readonly b: {c: number[]}}>(variation22);\n\n// Works with `KeyPaths` containing template literals\ndeclare const variation23: SetRequiredDeep<{a?: number; b?: {c?: number} | {d?: number}}, `b.${'c' | 'd'}`>;\nexpectType<{a?: number; b?: {c: number} | {d: number}}>(variation23);\n\ndeclare const variation24: SetRequiredDeep<\n\t{a?: number; b?: {readonly c?: {1?: number}} | {d?: {1?: number}}}, 'a' | `b.${'c' | 'd'}.1`\n>;\nexpectType<{a: number; b?: {readonly c?: {1: number}} | {d?: {1: number}}}>(variation24);\n\n// Calls `RequiredDeep` when `KeyPaths` is `any`\ndeclare const variation25: SetRequiredDeep<{a?: number; readonly b?: {c?: string}}, any>;\nexpectType<{a: number; readonly b: {c: string}}>(variation25);\n\n// Does nothing when `KeyPaths` is `never`\ndeclare const variation26: SetRequiredDeep<{a?: number; readonly b?: {c?: string}}, never>;\nexpectType<{a?: number; readonly b?: {c?: string}}>(variation26);\n\n// =================\n// Works with arrays\n// =================\n\n// All optional elements\nexpectType<{a?: [string, number, boolean?]}>({} as SetRequiredDeep<{a?: [string?, number?, boolean?]}, 'a.0' | 'a.1'>);\n\n// Mix of optional and required elements\nexpectType<{a: readonly [string, number, boolean]}>({} as SetRequiredDeep<{a: readonly [string, number?, boolean?]}, 'a.1' | 'a.2'>);\n\n// Mix of optional and rest elements\nexpectType<{readonly a: [string, number, boolean?, ...number[]]}>({} as SetRequiredDeep<{readonly a: [string?, number?, boolean?, ...number[]]}, 'a.0' | 'a.1'>);\n\n// Mix of optional, required, and rest elements\nexpectType<{readonly a?: [string, number, boolean, ...string[]]}>({} as SetRequiredDeep<{readonly a?: [string, number?, boolean?, ...string[]]}, 'a.1' | 'a.2'>);\n\n// Works with readonly arrays\nexpectType<{a?: {b?: readonly [(string | number)]}}>({} as SetRequiredDeep<{a?: {b?: readonly [(string | number)?]}}, 'a.b.0'>);\nexpectType<{a: readonly [string, number, boolean, ...string[]]}>(\n\t{} as SetRequiredDeep<{a?: readonly [string, number?, boolean?, ...string[]]}, 'a' | 'a.1' | 'a.2'>,\n);\n\n// Ignores `Keys` that are already required\nexpectType<{a: [string, number?, boolean?]}>({} as SetRequiredDeep<{a: [string, number?, boolean?]}, 'a.0'>);\n\n// Ignores `Keys` that are not known\n// This case is only possible when the array contains a rest element,\n// because otherwise the constaint on `KeyPaths` would disallow out of bound keys.\nexpectType<{a?: readonly [string?, number?, boolean?, ...number[]]}>(\n\t{} as SetRequiredDeep<{a?: readonly [string?, number?, boolean?, ...number[]]}, 'a.10'>,\n);\n\n// Marks all keys as required, if `Keys` is `number`.\n// This case is only possible when the array contains a rest element,\n// because otherwise the constaint on `KeyPaths` would be stricter.\nexpectType<{a?: readonly [string, number, boolean, ...number[]]}>(\n\t{} as SetRequiredDeep<{a?: readonly [string?, number?, boolean?, ...number[]]}, `a.${number}`>,\n);\n\n// Preserves `| undefined`, similar to how built-in `Required` works.\nexpectType<{a: [string | undefined, number | undefined, boolean]}>({} as SetRequiredDeep<{a: [string | undefined, (number | undefined)?, boolean?]}, 'a.0' | 'a.1' | 'a.2'>);\nexpectType<{a: readonly [string | undefined, (number | undefined)?, boolean?]}>(\n\t{} as SetRequiredDeep<{a: readonly [(string | undefined)?, (number | undefined)?, boolean?]}, 'a.0'>,\n);\n\n// Optional elements cannot appear after required ones, `Keys` leading to such situations are ignored.\nexpectType<{a: [string?, number?, boolean?]}>({} as SetRequiredDeep<{a: [string?, number?, boolean?]}, 'a.1' | 'a.2'>); // `a.1` and `a.2` can't be required when `a.0` is optional\nexpectType<{a: [string, number, boolean?, string?, string?]}>(\n\t{} as SetRequiredDeep<{a: [string?, number?, boolean?, string?, string?]}, 'a.0' | 'a.1' | 'a.3'>, // `a.3` can't be required when `a.2` is optional\n);\nexpectType<{a: readonly [string | undefined, number?, boolean?, ...string[]]}>(\n\t{} as SetRequiredDeep<{a?: readonly [string | undefined, number?, boolean?, ...string[]]}, 'a' | 'a.2'>, // `a.2` can't be required when `a.1` is optional\n);\n\n// Works with unions of arrays\nexpectType<{a: [string] | [string, number, boolean?, ...number[]] | readonly [string, number, boolean?]}>(\n\t{} as SetRequiredDeep<{a: [string?] | [string, number?, boolean?, ...number[]] | readonly [string, number?, boolean?]}, 'a.0' | 'a.1'>,\n);\n\n// Works with labelled tuples\nexpectType<{a?: [b: string, c: number]}>({} as SetRequiredDeep<{a?: [b?: string, c?: number]}, 'a.0' | 'a.1'>);\n\n// Non tuple arrays are left unchanged\nexpectType<{a: string[]}>({} as SetRequiredDeep<{a: string[]}, `a.${number}`>);\nexpectType<{readonly a: ReadonlyArray<string | number>}>({} as SetRequiredDeep<{readonly a?: ReadonlyArray<string | number>}, 'a' | `a.${number}`>);\n\n// Works with nested arrays\nexpectType<{a?: [[string, number?]?]}>({} as SetRequiredDeep<{a?: [[string?, number?]?]}, 'a.0.0'>);\nexpectType<{a?: [[string, number]]}>({} as SetRequiredDeep<{a?: [[string?, number?]?]}, 'a.0' | 'a.0.0' | 'a.0.1'>);\nexpectType<{a?: Array<[string, number?]>}>({} as SetRequiredDeep<{a?: Array<[string?, number?]>}, `a.${number}.0`>);\n\n// Set key inside array to required\nexpectType<{a?: Array<{b: number}>}>({} as SetRequiredDeep<{a?: Array<{b?: number}>}, `a.${number}.b`>);\nexpectType<{readonly a?: [{readonly b: number}]}>({} as SetRequiredDeep<{readonly a?: [{readonly b?: number}]}, 'a.0.b'>);\nexpectType<{readonly a: [{readonly b: number}, {c?: string}]}>(\n\t{} as SetRequiredDeep<{readonly a?: [{readonly b?: number}, {c?: string}?]}, 'a' | 'a.0.b' | 'a.1'>,\n);\n\n// Set only specified keys inside array to required\nexpectType<{a?: Array<{b: number; c?: string}>}>({} as SetRequiredDeep<{a?: Array<{b?: number; c?: string}>}, `a.${number}.b`>);\nexpectType<{a: [{b?: number; readonly c: string}]}>({} as SetRequiredDeep<{a: [{b?: number; readonly c?: string}]}, 'a.0.c'>);\n"
  },
  {
    "path": "test-d/set-required.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {SetRequired, Simplify} from '../index.d.ts';\n\n// Update one required and one optional to required.\ndeclare const variation1: SetRequired<{a?: number; b: string; c?: boolean}, 'b' | 'c'>;\nexpectType<{a?: number; b: string; c: boolean}>(variation1);\n\n// Update two optional to required.\ndeclare const variation2: SetRequired<{a?: number; b?: string; c?: boolean}, 'a' | 'b'>;\nexpectType<{a: number; b: string; c?: boolean}>(variation2);\n\n// Three required remain required.\ndeclare const variation3: SetRequired<{a: number; b: string; c: boolean}, 'a' | 'b' | 'c'>;\nexpectType<{a: number; b: string; c: boolean}>(variation3);\n\n// Fail if type changes even if optional is right.\ndeclare const variation4: SetRequired<{a?: number; b: string; c?: boolean}, 'b' | 'c'>;\nexpectNotAssignable<{a?: boolean; b: string; c: boolean}>(variation4);\n\n// Update one required and one optional to required in a union.\ndeclare const variation5: SetRequired<{a?: '1'; b: string; c?: boolean} | {a?: '2'; b: string; c?: boolean}, 'a' | 'b'>;\nexpectType<{a: '1'; b: string; c?: boolean} | {a: '2'; b: string; c?: boolean}>(variation5);\n\n// Preserves readonly modifier.\ndeclare const variation6: SetRequired<{readonly a?: number; readonly b: string; c?: boolean}, 'b' | 'c'>;\nexpectType<{readonly a?: number; readonly b: string; c: boolean}>(variation6);\n\n// Works with unions.\ndeclare const variation7: SetRequired<{readonly a?: number; b?: number; c?: boolean} | {a?: string; readonly b?: string; d?: boolean}, 'a' | 'b'>;\nexpectType<{readonly a: number; b: number; c?: boolean} | {a: string; readonly b: string; d?: boolean}>(variation7);\n\n// Marks all keys as required, if `Keys` is `any`.\ndeclare const variation8: SetRequired<{readonly a?: number; b?: string; c?: boolean}, any>;\nexpectType<{readonly a: number; b: string; c: boolean}>(variation8);\n\n// Does nothing, if `Keys` is `never`.\ndeclare const variation9: SetRequired<{a?: number; readonly b?: string; readonly c: boolean}, never>;\nexpectType<{a?: number; readonly b?: string; readonly c: boolean}>(variation9);\n\n// Works with index signatures\ndeclare const variation10: SetRequired<{[k: string]: unknown; a?: number; b: string}, 'a' | 'b'>;\nexpectType<{[k: string]: unknown; a: number; b: string}>(variation10);\n\n// Works with functions containing properties\ndeclare const variation11: SetRequired<{(a1: string, a2: number): boolean; p1?: string; readonly p2: number}, 'p1'>;\nexpectType<boolean>(variation11('foo', 1));\nexpectType<{p1: string; readonly p2: number}>({} as Simplify<typeof variation11>);\n\ndeclare const variation12: SetRequired<{(a1: boolean, ...a2: string[]): number; p1?: string; readonly p2?: number; p3?: boolean}, 'p1' | 'p2'>;\nexpectType<number>(variation12(true, 'foo', 'bar', 'baz'));\nexpectType<{p1: string; readonly p2: number; p3?: boolean}>({} as Simplify<typeof variation12>);\n\n// Functions without properties are returned as is\ndeclare const variation13: SetRequired<(a: string) => number, never>;\nexpectType<number>(variation13('foo'));\n\n// =================\n// Works with arrays\n// =================\n\n// Empty array\nexpectType<[]>({} as SetRequired<[], never>);\nexpectType<readonly []>({} as SetRequired<readonly [], never>);\n\n// All optional elements\nexpectType<[string, number?]>({} as SetRequired<[string?, number?], '0'>);\nexpectType<[string, number, boolean]>({} as SetRequired<[string?, number?, boolean?], '0' | '1' | '2'>);\nexpectType<[(string | number)]>({} as SetRequired<[(string | number)?], '0'>);\n\n// Works with number `Keys`, string `Keys`, and union of them.\nexpectType<[string, number, boolean?]>({} as SetRequired<[string, number?, boolean?], 1>);\nexpectType<[string, number, boolean, ...number[]]>({} as SetRequired<[string, number?, boolean?, ...number[]], '1' | '2'>);\nexpectType<readonly [string, number, boolean]>({} as SetRequired<readonly [string?, number?, boolean?], '0' | 1 | 2>);\n\n// Mix of optional and required elements\nexpectType<[string, number, boolean?]>({} as SetRequired<[string, number?, boolean?], '1'>);\nexpectType<readonly [string, number, boolean]>({} as SetRequired<readonly [string, number?, boolean?], '1' | '2'>);\n\n// Mix of optional and rest elements\nexpectType<[string, number?, boolean?, ...number[]]>({} as SetRequired<[string?, number?, boolean?, ...number[]], '0'>);\nexpectType<[string, number, boolean, ...number[]]>({} as SetRequired<[string?, number?, boolean?, ...number[]], '0' | '1' | 2>);\n\n// Mix of optional, required, and rest elements\nexpectType<readonly [string, number, boolean?, ...number[]]>({} as SetRequired<readonly [string, number?, boolean?, ...number[]], '1'>);\nexpectType<[string, number, boolean, ...string[]]>({} as SetRequired<[string, number?, boolean?, ...string[]], '1' | 2>);\n\n// Works with readonly arrays\nexpectType<readonly [(string | number)]>({} as SetRequired<readonly [(string | number)?], '0'>);\nexpectType<readonly [string, number, boolean?]>({} as SetRequired<readonly [string, number?, boolean?], '1'>);\nexpectType<readonly [string, number, boolean, ...number[]]>({} as SetRequired<readonly [string?, number?, boolean?, ...number[]], '0' | '1' | 2>);\nexpectType<readonly [string, number, boolean, ...string[]]>({} as SetRequired<readonly [string, number?, boolean?, ...string[]], '1' | 2>);\n\n// Ignores `Keys` that are already required\nexpectType<[string, number?, boolean?]>({} as SetRequired<[string, number?, boolean?], '0'>);\nexpectType<readonly [string, number, boolean]>({} as SetRequired<readonly [string, number, boolean], 1 | 2>);\nexpectType<readonly [string, number, boolean, ...number[]]>({} as SetRequired<readonly [string, number, boolean, ...number[]], 1 | 2>);\nexpectType<[string, number, boolean, ...number[]]>({} as SetRequired<[string, number?, boolean?, ...number[]], '0' | '1' | '2'>);\n\n// Ignores `Keys` that are out of bounds\nexpectType<[]>({} as SetRequired<[], 1>);\nexpectType<[string, number?, boolean?]>({} as SetRequired<[string, number?, boolean?], 10>);\nexpectType<[string, number, boolean]>({} as SetRequired<[string?, number?, boolean?], 0 | 1 | 2 | 3 | 4>);\nexpectType<readonly [string, number, boolean?, ...number[]]>({} as SetRequired<readonly [string, number?, boolean?, ...number[]], 10 | 1>);\n\n// Marks all keys as required, if `Keys` is `any`.\nexpectType<[string, number, boolean]>({} as SetRequired<[string?, number?, boolean?], any>);\nexpectType<[string, number, boolean, ...number[]]>({} as SetRequired<[string, number?, boolean?, ...number[]], any>);\nexpectType<readonly [string, number, boolean, ...number[]]>({} as SetRequired<readonly [string, number, boolean, ...number[]], any>);\nexpectType<readonly [string, number, boolean, ...number[]]>({} as SetRequired<readonly [string, number?, boolean?, ...number[]], any>);\n\n// Marks all keys as required, if `Keys` is `number`.\nexpectType<[string, number, boolean]>({} as SetRequired<[string?, number?, boolean?], number>);\nexpectType<[string, number, boolean, ...number[]]>({} as SetRequired<[string, number?, boolean?, ...number[]], number>);\nexpectType<readonly [string, number, boolean, ...number[]]>({} as SetRequired<readonly [string, number, boolean, ...number[]], number>);\nexpectType<readonly [string, number, boolean, ...number[]]>({} as SetRequired<readonly [string, number?, boolean?, ...number[]], number>);\n\n// Returns the array as-is, if `Keys` is `never`.\nexpectType<[string?, number?]>({} as SetRequired<[string?, number?], never>);\nexpectType<readonly [string?, number?, ...number[]]>({} as SetRequired<readonly [string?, number?, ...number[]], never>);\n\n// Arrays where non-rest elements appear after the rest element are left unchanged, because they can never have optional elements.\nexpectType<[...string[], string | undefined, number]>({} as SetRequired<[...string[], string | undefined, number], any>);\nexpectType<[boolean, ...string[], string, number]>({} as SetRequired<[boolean, ...string[], string, number], any>);\n\n// Preserves `| undefined`, similar to how built-in `Required` works.\nexpectType<[string | undefined, number | undefined, boolean]>({} as SetRequired<[string | undefined, (number | undefined)?, boolean?], 0 | 1 | 2>);\nexpectType<readonly [string | undefined, (number | undefined)?, boolean?]>({} as SetRequired<readonly [(string | undefined)?, (number | undefined)?, boolean?], 0>);\n\n// Optional elements cannot appear after required ones, `Keys` leading to such situations are ignored.\nexpectType<[string?, number?, boolean?]>({} as SetRequired<[string?, number?, boolean?], 1 | 2>); // `1` and `2` can't be required when `0` is optional\nexpectType<[string, number, boolean?, string?, string?]>(\n\t{} as SetRequired<[string?, number?, boolean?, string?, string?], 0 | 1 | 3>, // `3` can't be required when `2` is optional\n);\nexpectType<readonly [string | undefined, number?, boolean?, ...string[]]>(\n\t{} as SetRequired<readonly [string | undefined, number?, boolean?, ...string[]], 2>, // `2` can't be required when `1` is optional\n);\n\n// Works with unions of arrays\nexpectType<readonly [] | []>({} as SetRequired<readonly [] | [], never>);\nexpectType<[] | readonly [(string | number)]>({} as SetRequired<[] | readonly [(string | number)?], 0>);\nexpectType<[string] | [string, number, boolean?, ...number[]] | readonly [string, number, boolean?]>(\n\t{} as SetRequired<[string?] | [string, number?, boolean?, ...number[]] | readonly [string, number?, boolean?], 0 | 1>,\n);\nexpectType<readonly [number, string] | [string, boolean, ...number[]] | readonly [string, number | undefined, boolean?, string?]>(\n\t{} as SetRequired<readonly [number, string] | [string, boolean?, ...number[]] | readonly [string, (number | undefined)?, boolean?, string?], 1 | 3>,\n);\nexpectType<readonly [...number[], number] | [string, boolean, ...number[]] | readonly [string, number | undefined, boolean, string]>(\n\t{} as SetRequired<readonly [...number[], number] | [string, boolean?, ...number[]] | readonly [string, (number | undefined)?, boolean?, string?], any>,\n);\nexpectType<readonly string[] | [x: number, y: number] | [string, number, ...string[]]>(\n\t{} as SetRequired<readonly string[] | [x: number, y?: number] | [string?, number?, ...string[]], number>,\n);\n\n// Works with labelled tuples\nexpectType<[x: string, y: number]>({} as SetRequired<[x?: string, y?: number], '0' | '1'>);\nexpectType<readonly [x: number, y: number, z?: number]>({} as SetRequired<readonly [x?: number, y?: number, z?: number], 0 | 1>);\nexpectType<readonly [x: number, y: number, z?: number, ...rest: number[]]>({} as SetRequired<readonly [x?: number, y?: number, z?: number, ...rest: number[]], 0 | 1>);\n\n// Non tuple arrays are left unchanged\nexpectType<string[]>({} as SetRequired<string[], number>);\nexpectType<ReadonlyArray<string | number>>({} as SetRequired<ReadonlyArray<string | number>, number>);\nexpectType<number[]>({} as SetRequired<[...number[]], never>);\n"
  },
  {
    "path": "test-d/set-return-type.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SetReturnType} from '../index.d.ts';\n\ndeclare const anything: unknown;\n\n// Without `thisArg` and without parameters.\ndeclare const variation1: SetReturnType<() => void, number>;\nexpectType<() => number>(variation1);\nvariation1.call(anything);\n\n// Without `thisArg` and with parameters.\ndeclare const variation2: SetReturnType<(foo: string, bar: boolean) => number, void>;\nexpectType<(foo: string, bar: boolean) => void>(variation2);\nvariation2.call(anything, 'foo', true);\n\n// With `thisArg` and without parameters.\nfunction function1(this: Date): void {} // eslint-disable-line @typescript-eslint/no-empty-function\ndeclare const variation3: SetReturnType<typeof function1, string[]>;\nexpectType<(this: Date) => string[]>(variation3);\nvariation3.call(new Date());\n// @ts-expect-error\nvariation3.call('not-a-date');\n\n// With `thisArg` and with parameters.\ndeclare function function2(this: Date, foo: any, bar: Array<[number]>): any;\ndeclare const variation4: SetReturnType<typeof function2, never>;\nexpectType<(this: Date, foo: any, bar: Array<[number]>) => never>(variation4);\nvariation4.call(new Date(), anything, [[4], [7]]);\n// @ts-expect-error\nvariation4.call('not-a-date', anything, [[4], [7]]);\n\n// Sanity check to the fact that omitting `this: unknown` from the argument list has no effect other than in readability.\ndeclare function withExplicitThis(this: unknown, foo: string): number;\ndeclare function withImplicitThis(foo: string): number;\nexpectType<typeof withExplicitThis>(withImplicitThis);\nexpectType<typeof withImplicitThis>(withExplicitThis);\n"
  },
  {
    "path": "test-d/shared-union-fields-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SharedUnionFieldsDeep} from '../index.d.ts';\n\ntype TestingType = {\n\tfunction: (() => void);\n\trecord: Record<string, {\n\t\tpropertyA: string;\n\t}>;\n\tobject: {\n\t\tsubObject: {\n\t\t\tsubSubObject: {\n\t\t\t\tpropertyA: string;\n\t\t\t};\n\t\t};\n\t};\n\tstring: string;\n\tunion: 'test1' | 'test2';\n\tnumber: number;\n\tboolean: boolean;\n\tdate: Date;\n\tregexp: RegExp;\n\tsymbol: symbol;\n\tnull: null;\n\tundefined: undefined;\n\toptional?: boolean | undefined;\n\treadonly propertyWithKeyword: boolean;\n\tmap: Map<string, {propertyA: string; propertyB: string}>;\n\tset: Set<string>;\n\tobjectSet: Set<{propertyA: string; propertyB: string}>;\n\tarray: Array<{a: number; b: string}>;\n\treadonlyArray: ReadonlyArray<{a: number; b: string}>;\n};\n\ntype SharedUnionFieldsDeepRecurseIntoArrays<T> = SharedUnionFieldsDeep<T, {recurseIntoArrays: true}>;\n\ndeclare const normal: SharedUnionFieldsDeep<TestingType | {string: string; number: number; foo: any}>;\nexpectType<{string: string; number: number}>(normal);\n\ndeclare const normal2: SharedUnionFieldsDeep<TestingType | {string: string; foo: any}>;\nexpectType<{string: string}>(normal2);\n\ndeclare const unMatched: SharedUnionFieldsDeep<TestingType | {foo: any}>;\nexpectType<{}>(unMatched);\n\ndeclare const number: SharedUnionFieldsDeep<TestingType | {number: number; foo: any}>;\nexpectType<{number: number}>(number);\n\ndeclare const string: SharedUnionFieldsDeep<TestingType | {string: string; foo: any}>;\nexpectType<{string: string}>(string);\n\ndeclare const boolean: SharedUnionFieldsDeep<TestingType | {boolean: boolean; foo: any}>;\nexpectType<{boolean: boolean}>(boolean);\n\ndeclare const date: SharedUnionFieldsDeep<TestingType | {date: Date; foo: any}>;\nexpectType<{date: Date}>(date);\n\ndeclare const regexp: SharedUnionFieldsDeep<TestingType | {regexp: RegExp; foo: any}>;\nexpectType<{regexp: RegExp}>(regexp);\n\ndeclare const symbol: SharedUnionFieldsDeep<TestingType | {symbol: symbol; foo: any}>;\nexpectType<{symbol: symbol}>(symbol);\n\ndeclare const null_: SharedUnionFieldsDeep<TestingType | {null: null; foo: any}>;\nexpectType<{null: null}>(null_);\n\ndeclare const undefined_: SharedUnionFieldsDeep<TestingType | {undefined: undefined; foo: any}>;\nexpectType<{undefined: undefined}>(undefined_);\n\ndeclare const optional: SharedUnionFieldsDeep<TestingType | {optional: string; foo: any}>;\nexpectType<{optional?: boolean | string | undefined}>(optional);\n\ndeclare const propertyWithKeyword: SharedUnionFieldsDeep<TestingType | {readonly propertyWithKeyword: string; foo: any}>;\nexpectType<{readonly propertyWithKeyword: boolean | string}>(propertyWithKeyword);\n\ndeclare const map: SharedUnionFieldsDeep<TestingType | {map: Map<string, {propertyA: string}>; foo: any}>;\nexpectType<{map: TestingType['map'] | Map<string, {propertyA: string}>}>(map);\n\ndeclare const set: SharedUnionFieldsDeep<TestingType | {set: Set<number>; foo: any}>;\nexpectType<{set: TestingType['set'] | Set<number>}>(set);\n\ndeclare const union: SharedUnionFieldsDeep<TestingType | {string: string; number: number; foo: any} | {string: string; bar: any}>;\nexpectType<{string: string}>(union);\n\ndeclare const union2: SharedUnionFieldsDeep<TestingType | {union: {a: number}}>;\nexpectType<{union: 'test1' | 'test2' | {a: number}}>(union2);\n\n/** Test for array */\ndeclare const array: SharedUnionFieldsDeepRecurseIntoArrays<TestingType | {array: Array<{a: number; bar: string}>; foo: any}>;\nexpectType<{array: Array<{a: number}>}>(array);\n\ndeclare const arrayWithoutRecursive: SharedUnionFieldsDeep<TestingType | {array: Array<{a: number; bar: string}>; foo: any}>;\nexpectType<{array: TestingType['array'] | Array<{a: number; bar: string}>}>(arrayWithoutRecursive);\n\ndeclare const readonlyArray: SharedUnionFieldsDeepRecurseIntoArrays<TestingType | {readonlyArray: ReadonlyArray<{a: number; bar: string}>; foo: any}>;\nexpectType<{readonlyArray: ReadonlyArray<{a: number}>}>(readonlyArray);\n\n/** Test for tuple */\ndeclare const tuple: SharedUnionFieldsDeepRecurseIntoArrays<{tuple: [number]} | {tuple: [number, string]; foo: any}>;\nexpectType<{tuple: [number]}>(tuple);\n\ndeclare const tupleWithoutRecursive: SharedUnionFieldsDeep<{tuple: [number]} | {tuple: [number, string]; foo: any}>;\nexpectType<{tuple: [number] | [number, string]}>(tupleWithoutRecursive);\n\ndeclare const tupleOrArray: SharedUnionFieldsDeepRecurseIntoArrays<{tuple: boolean[]} | {tuple: [number, string]}>;\nexpectType<{tuple: [number | boolean, string | boolean]}>(tupleOrArray);\n\n/** Test for fixed length tuple */\ndeclare const fixedLengthTuple: SharedUnionFieldsDeepRecurseIntoArrays<{tuple: [number, string]} | {tuple: [number, string, boolean]}>;\nexpectType<{tuple: [number, string]}>(fixedLengthTuple);\n\ndeclare const fixedLengthTuple2: SharedUnionFieldsDeepRecurseIntoArrays<{tuple: [number, string]} | {tuple: []}>;\nexpectType<{tuple: []}>(fixedLengthTuple2);\n\ndeclare const fixedLengthTuple3: SharedUnionFieldsDeepRecurseIntoArrays<{tuple: [number, string, number]} | {tuple: [number, boolean, ...string[]]}>;\nexpectType<{tuple: [number, string | boolean, number | string]}>(fixedLengthTuple3);\n\ndeclare const threeLengthTuple: SharedUnionFieldsDeepRecurseIntoArrays<{tuple: [number, string]} | {tuple: [number, string, boolean]} | {tuple: number[]}>;\nexpectType<{tuple: [number, string | number]}>(threeLengthTuple);\n\n/** Test for non-fixed length tuple */\ndeclare const nonFixedLengthTuple: SharedUnionFieldsDeepRecurseIntoArrays<{tuple: [number, ...string[]]} | {tuple: boolean[]}>;\nexpectType<{tuple: [number | boolean, ...Array<string | boolean>]}>(nonFixedLengthTuple);\n\ndeclare const nonFixedLengthTuple2: SharedUnionFieldsDeepRecurseIntoArrays<{tuple: [number, ...string[]]} | {tuple: [number, string, ...boolean[]]}>;\nexpectType<{tuple: [number, string, ...Array<string | boolean>]}>(nonFixedLengthTuple2);\n\n// Test for same type\ntype TestingType2 = TestingType & {foo: any};\ndeclare const same: SharedUnionFieldsDeepRecurseIntoArrays<TestingType | TestingType2>;\nexpectType<TestingType>(same);\n\n// Test for propagation with non union root object\ndeclare const nonUnionRootType: SharedUnionFieldsDeep<{union: {number: number; boolean: boolean} | {number: number}}>;\nexpectType<{union: {number: number}}>(nonUnionRootType);\n\ndeclare const unionWithUndefined: SharedUnionFieldsDeep<{\n\ta?: {a: string; foo: number} | {a: string; bar: string} | undefined;\n\tb?: {a: string; foo: number} | {a: string; bar: string};\n\tc: {a: string; foo: number} | {a: string; bar: string} | undefined;\n}>;\nexpectType<{\n\ta?: {a: string} | undefined;\n\tb?: {a: string};\n\tc: {a: string} | undefined;\n}>(unionWithUndefined);\n"
  },
  {
    "path": "test-d/shared-union-fields.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SharedUnionFields} from '../index.d.ts';\nimport type {NonRecursiveType} from '../source/internal/index.d.ts';\n\ntype TestingType = {\n\tfunction: (() => void);\n\trecord: Record<string, {\n\t\tpropertyA: string;\n\t}>;\n\tobject: {\n\t\tsubObject: {\n\t\t\tsubSubObject: {\n\t\t\t\tpropertyA: string;\n\t\t\t};\n\t\t};\n\t};\n\tstring: string;\n\tunion: 'test1' | 'test2';\n\tnumber: number;\n\tboolean: boolean;\n\tdate: Date;\n\tregexp: RegExp;\n\tsymbol: symbol;\n\tnull: null;\n\tundefined: undefined;\n\toptional?: boolean | undefined;\n\treadonly propertyWithKeyword: boolean;\n\tmap: Map<string, {propertyA: string; propertyB: string}>;\n\tset: Set<string>;\n\tobjectSet: Set<{propertyA: string; propertyB: string}>;\n};\n\ndeclare const normal: SharedUnionFields<TestingType | {string: string; number: number; foo: any}>;\nexpectType<{string: string; number: number}>(normal);\n\ndeclare const normal2: SharedUnionFields<TestingType | {string: string; foo: any}>;\nexpectType<{string: string}>(normal2);\n\ndeclare const unMatched: SharedUnionFields<TestingType | {foo: any}>;\nexpectType<{}>(unMatched);\n\ndeclare const number: SharedUnionFields<TestingType | {number: number; foo: any}>;\nexpectType<{number: number}>(number);\n\ndeclare const string: SharedUnionFields<TestingType | {string: string; foo: any}>;\nexpectType<{string: string}>(string);\n\ndeclare const boolean: SharedUnionFields<TestingType | {boolean: boolean; foo: any}>;\nexpectType<{boolean: boolean}>(boolean);\n\ndeclare const date: SharedUnionFields<TestingType | {date: Date; foo: any}>;\nexpectType<{date: Date}>(date);\n\ndeclare const regexp: SharedUnionFields<TestingType | {regexp: RegExp; foo: any}>;\nexpectType<{regexp: RegExp}>(regexp);\n\ndeclare const symbol: SharedUnionFields<TestingType | {symbol: symbol; foo: any}>;\nexpectType<{symbol: symbol}>(symbol);\n\ndeclare const null_: SharedUnionFields<TestingType | {null: null; foo: any}>;\nexpectType<{null: null}>(null_);\n\ndeclare const undefined_: SharedUnionFields<TestingType | {undefined: undefined; foo: any}>;\nexpectType<{undefined: undefined}>(undefined_);\n\ndeclare const optional: SharedUnionFields<TestingType | {optional: string; foo: any}>;\nexpectType<{optional?: boolean | string | undefined}>(optional);\n\ndeclare const propertyWithKeyword: SharedUnionFields<TestingType | {readonly propertyWithKeyword: string; foo: any}>;\nexpectType<{readonly propertyWithKeyword: boolean | string}>(propertyWithKeyword);\n\ndeclare const map: SharedUnionFields<TestingType | {map: Map<string, {propertyA: string}>; foo: any}>;\nexpectType<{map: TestingType['map'] | Map<string, {propertyA: string}>}>(map);\n\ndeclare const set: SharedUnionFields<TestingType | {set: Set<number>; foo: any}>;\nexpectType<{set: TestingType['set'] | Set<number>}>(set);\n\ndeclare const moreUnion: SharedUnionFields<TestingType | {string: string; number: number; foo: any} | {string: string; bar: any}>;\nexpectType<{string: string}>(moreUnion);\n\ndeclare const union: SharedUnionFields<TestingType | {union: {a: number}}>;\nexpectType<{union: 'test1' | 'test2' | {a: number}}>(union);\n\ndeclare const unionWithOptional: SharedUnionFields<{a?: string; foo: number} | {a: string; bar: string}>;\nexpectType<{a?: string}>(unionWithOptional);\n\n// Non-recursive types\nexpectType<Set<string> | Map<string, string>>({} as SharedUnionFields<Set<string> | Map<string, string>>);\nexpectType<string[] | Set<string>>({} as SharedUnionFields<string[] | Set<string>>);\nexpectType<NonRecursiveType>({} as SharedUnionFields<NonRecursiveType>);\n\n// Mix of non-recursive and recursive types\nexpectType<{a: string | number} | undefined>({} as SharedUnionFields<{a: string} | {a: number; b: true} | undefined>);\nexpectType<RegExp | {test: string}>({} as SharedUnionFields<RegExp | {test: string}>);\nexpectType<RegExp | null | {test: string | number}>({} as SharedUnionFields<RegExp | null | {test: string} | {test: number; foo: any}>);\n\n// Boundary types\nexpectType<any>({} as SharedUnionFields<any>);\nexpectType<never>({} as SharedUnionFields<never>);\n"
  },
  {
    "path": "test-d/simplify-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SimplifyDeep} from '../index.d.ts';\n\ntype Properties1 = {\n\theight: number;\n\tposition: {\n\t\ttop: number;\n\t\tbottom: number;\n\t};\n};\n\ntype Properties2 = {\n\twidth: number;\n\tposition: {\n\t\tleft: number;\n\t\tright: number;\n\t};\n};\n\n// Flatten the type output to improve type hints shown in editors.\ndeclare const flattenProperties: {\n\theight: number;\n\twidth: number;\n\tposition: {\n\t\ttop: number;\n\t\tbottom: number;\n\t\tleft: number;\n\t\tright: number;\n\t};\n};\n\nexpectType<SimplifyDeep<Properties1 & Properties2>>(flattenProperties);\n\n// Array\ndeclare function testArraySimplification(arg: {foo: Array<{[x: string]: string}>}): void;\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ninterface BarBaz {\n\tbar: string;\n\tbaz: string;\n}\n\n// This would fail if `SimplifyDeep` did not simplify arrays,\n// because interfaces being open are not compatible with index signatures.\ntestArraySimplification({} as SimplifyDeep<{foo: BarBaz[]}>);\n"
  },
  {
    "path": "test-d/simplify.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {Simplify} from '../index.d.ts';\n\ntype PositionProperties = {\n\ttop: number;\n\tleft: number;\n};\n\ntype SizeProperties = {\n\twidth: number;\n\theight: number;\n};\n\n// Flatten the type output to improve type hints shown in editors.\nconst flattenProperties = {top: 120, left: 240, width: 480, height: 600};\nexpectType<Simplify<PositionProperties & SizeProperties>>(flattenProperties);\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ninterface SomeInterface {\n\tfoo: number;\n\tbar?: string;\n\tbaz: number | undefined;\n}\n\ntype SomeInterfaceAsTypeWrittenByHand = {\n\tfoo: number;\n\tbar?: string;\n\tbaz: number | undefined;\n};\n\nconst valueAsLiteral = {foo: 123, bar: 'hello', baz: 456};\nconst valueAsSimplifiedInterface: Simplify<SomeInterface> = valueAsLiteral;\nconst valueAsInterface: SomeInterface = valueAsLiteral;\n\ndeclare const a: Simplify<SomeInterface>;\nexpectType<SomeInterfaceAsTypeWrittenByHand>(a);\n\n// Interface is assignable to its Simplified type (created with Simplify, and by hand)\nexpectType<Simplify<SomeInterface>>(valueAsInterface);\nexpectType<SomeInterfaceAsTypeWrittenByHand>(valueAsInterface);\n\n// The following demonstrates one reason a type may be preferred over an interface is that it can be assigned to alternate types. In this example the interface cannot be because it is not sealed and elsewhere a non-string property could be added.\nexpectAssignable<Record<string, unknown>>(valueAsLiteral);\nexpectAssignable<Record<string, unknown>>(valueAsSimplifiedInterface);\nexpectNotAssignable<Record<string, unknown>>(valueAsInterface); // Index signature is missing in interface\n\n// The following tests should be fixed once we have determined the cause of the bug reported in https://github.com/sindresorhus/type-fest/issues/436\n\ntype SomeFunction = (type: string) => string;\ntype SimplifiedFunction = Simplify<SomeFunction>; // Return '{}' expected 'SomeFunction'\n\ndeclare const someFunction: SimplifiedFunction;\n\nexpectNotAssignable<SomeFunction>(someFunction);\n\n// // Should return the original type if it is not simplifiable, like a function.\n// type SomeFunction = (type: string) => string;\n// expectType<Simplify<SomeFunction>>((type: string) => type);\n\n// class SomeClass {\n// \tid: string;\n\n// \tprivate readonly code: number;\n\n// \tconstructor() {\n// \t\tthis.id = 'some-class';\n// \t\tthis.code = 42;\n// \t}\n\n// \tsomeMethod() {\n// \t\treturn this.code;\n// \t}\n// }\n\n// expectType<Simplify<SomeClass>>(new SomeClass());\n"
  },
  {
    "path": "test-d/single-key-object.ts",
    "content": "import {expectNever, expectAssignable} from 'tsd';\nimport type {SingleKeyObject} from '../index.d.ts';\n\nconst test = <T>(_: SingleKeyObject<T>): void => {}; // eslint-disable-line @typescript-eslint/no-empty-function\n\ntest({key: 'value'});\n\n// @ts-expect-error\ntest({});\n// @ts-expect-error\ntest({key: 'value', otherKey: 'other value'});\n\ndeclare const validObject: SingleKeyObject<{key: string}>;\nexpectAssignable<{key: string}>(validObject);\n\ndeclare const invalidObject: SingleKeyObject<{key1: string; key2: number}>;\nexpectNever(invalidObject);\n"
  },
  {
    "path": "test-d/snake-case.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SnakeCase} from '../index.d.ts';\n\nconst snakeFromCamel: SnakeCase<'fooBar'> = 'foo_bar';\nexpectType<'foo_bar'>(snakeFromCamel);\n\nconst snakeFromPascal: SnakeCase<'FooBar'> = 'foo_bar';\nexpectType<'foo_bar'>(snakeFromPascal);\n\nconst snakeFromKebab: SnakeCase<'foo-bar'> = 'foo_bar';\nexpectType<'foo_bar'>(snakeFromKebab);\n\nconst snakeFromSpace: SnakeCase<'foo bar'> = 'foo_bar';\nexpectType<'foo_bar'>(snakeFromSpace);\n\nconst snakeFromSnake: SnakeCase<'foo_bar'> = 'foo_bar';\nexpectType<'foo_bar'>(snakeFromSnake);\n\nconst noSnakeFromMono: SnakeCase<'foobar'> = 'foobar';\nexpectType<'foobar'>(noSnakeFromMono);\n\nconst snakeFromCamelPascal: SnakeCase<'FooBar'> = 'foo_bar';\nexpectType<'foo_bar'>(snakeFromCamelPascal);\n\nconst snakeFromComplexKebab: SnakeCase<'foo-bar-abc-123'> = 'foo_bar_abc_123';\nexpectType<'foo_bar_abc_123'>(snakeFromComplexKebab);\n\nconst snakeFromMixed: SnakeCase<'foo-bar_abc xyzBarFoo'>\n\t= 'foo_bar_abc_xyz_bar_foo';\nexpectType<'foo_bar_abc_xyz_bar_foo'>(snakeFromMixed);\n\nconst snakeFromVendorPrefixedCssProperty: SnakeCase<'-webkit-animation'>\n\t= 'webkit_animation';\nexpectType<'webkit_animation'>(snakeFromVendorPrefixedCssProperty);\n\nconst snakeFromDoublePrefixedKebab: SnakeCase<'--very-prefixed'>\n\t= 'very_prefixed';\nexpectType<'very_prefixed'>(snakeFromDoublePrefixedKebab);\n\nconst snakeFromRepeatedSeparators: SnakeCase<'foo____bar'> = 'foo_bar';\nexpectType<'foo_bar'>(snakeFromRepeatedSeparators);\n\nconst snakeFromUppercase: SnakeCase<'FOO'> = 'foo';\nexpectType<'foo'>(snakeFromUppercase);\n\nconst snakeFromLowercase: SnakeCase<'foo'> = 'foo';\nexpectType<'foo'>(snakeFromLowercase);\n\nconst snakeFromScreamingSnakeCase: SnakeCase<'FOO_BAR'> = 'foo_bar';\nexpectType<'foo_bar'>(snakeFromScreamingSnakeCase);\n\nconst snakeFromScreamingKebabCase: SnakeCase<'FOO-BAR'> = 'foo_bar';\nexpectType<'foo_bar'>(snakeFromScreamingKebabCase);\n\nconst snakeFromMixed2: SnakeCase<'parseHTML'> = 'parse_html';\nexpectType<'parse_html'>(snakeFromMixed2);\n\nconst snakeFromMixed3: SnakeCase<'parseHTMLItem'> = 'parse_html_item';\nexpectType<'parse_html_item'>(snakeFromMixed3);\n\nconst snakeFromNumberInTheMiddleSplitOnNumbers: SnakeCase<'foo2bar', {splitOnNumbers: true}>\n\t= 'foo_2_bar';\nexpectType<'foo_2_bar'>(snakeFromNumberInTheMiddleSplitOnNumbers);\n\nconst snakeFromNumberInTheMiddleSplitOnNumbersEdgeCase: SnakeCase<'foO2Bar', {splitOnNumbers: true}>\n\t= 'fo_o_2_bar';\nexpectType<'fo_o_2_bar'>(snakeFromNumberInTheMiddleSplitOnNumbersEdgeCase);\n\nconst snakeFromNumberInTheMiddleSplitOnNumbersEdgeCase2: SnakeCase<'foO2bar', {splitOnNumbers: true}>\n\t= 'fo_o_2_bar';\nexpectType<'fo_o_2_bar'>(snakeFromNumberInTheMiddleSplitOnNumbersEdgeCase2);\n\nconst snakeFromNumberInTheMiddleNoSplitOnNumbers: SnakeCase<'foo2bar'> = 'foo2bar';\nexpectType<'foo2bar'>(snakeFromNumberInTheMiddleNoSplitOnNumbers);\n\nconst snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase: SnakeCase<'foo2Bar'> = 'foo2_bar';\nexpectType<'foo2_bar'>(snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase);\n\nconst snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase2: SnakeCase<'foO2bar'> = 'fo_o2bar';\nexpectType<'fo_o2bar'>(snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase2);\n\nconst snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase3: SnakeCase<'FOO22Bar'> = 'foo22_bar';\nexpectType<'foo22_bar'>(snakeFromNumberInTheMiddleNoSplitOnNumbersEdgeCase3);\n\ndeclare const withPunctuation: SnakeCase<'onDialog:close'>;\nexpectType<'on_dialog:close'>(withPunctuation);\n\ndeclare const withPunctuation2: SnakeCase<'foo-bar>>baz'>;\nexpectType<'foo_bar>>baz'>(withPunctuation2);\n\ndeclare const withPunctuation3: SnakeCase<'card::after'>;\nexpectType<'card::after'>(withPunctuation3);\n\ndeclare const withPunctuation4: SnakeCase<'div.card::after'>;\nexpectType<'div.card::after'>(withPunctuation4);\n\ndeclare const withPunctuationAndNumber: SnakeCase<'foo-bar::01'>;\nexpectType<'foo_bar::01'>(withPunctuationAndNumber);\n\ndeclare const withPunctuationAndNumber2: SnakeCase<'foo-bar::01', {splitOnNumbers: true}>;\nexpectType<'foo_bar::_01'>(withPunctuationAndNumber2);\n"
  },
  {
    "path": "test-d/snake-cased-properties-deep.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SnakeCasedPropertiesDeep} from '../index.d.ts';\n\ntype FooBar = {helloWorld: {p2p: Array<{addressLine1: string}>}};\n\ndeclare const foo: SnakeCasedPropertiesDeep<FooBar>;\nexpectType<{hello_world: {p2p: Array<{address_line1: string}>}}>(foo);\n\ndeclare const bar: SnakeCasedPropertiesDeep<FooBar, {splitOnNumbers: true}>;\nexpectType<{hello_world: {p_2_p: Array<{address_line_1: string}>}}>(bar);\n\n// Verify example\ntype User = {\n\tuserId: number;\n\tuserName: string;\n\tdate: Date;\n\tregExp: RegExp;\n};\n\ntype UserWithFriends = {\n\tuserInfo: User;\n\tuserFriends: User[];\n};\n\nconst result: SnakeCasedPropertiesDeep<UserWithFriends> = {\n\tuser_info: {\n\t\tuser_id: 1,\n\t\tuser_name: 'Tom',\n\t\tdate: new Date(),\n\t\treg_exp: /.*/,\n\t},\n\tuser_friends: [\n\t\t{\n\t\t\tuser_id: 2,\n\t\t\tuser_name: 'Jerry',\n\t\t\tdate: new Date(),\n\t\t\treg_exp: /.*/,\n\t\t},\n\t\t{\n\t\t\tuser_id: 3,\n\t\t\tuser_name: 'Spike',\n\t\t\tdate: new Date(),\n\t\t\treg_exp: /.*/,\n\t\t},\n\t],\n};\nexpectType<SnakeCasedPropertiesDeep<UserWithFriends>>(result);\n\nexpectType<{foo_bar: unknown}>({} as SnakeCasedPropertiesDeep<{fooBar: unknown}>);\nexpectType<{foo_bar: {bar_baz: unknown}; biz: unknown}>({} as SnakeCasedPropertiesDeep<{fooBar: {barBaz: unknown}; biz: unknown}>);\n\nexpectType<{foo_bar: any}>({} as SnakeCasedPropertiesDeep<{fooBar: any}>);\nexpectType<{foo_bar: {bar_baz: any}; biz: any}>({} as SnakeCasedPropertiesDeep<{fooBar: {barBaz: any}; biz: any}>);\n"
  },
  {
    "path": "test-d/snake-cased-properties.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SnakeCasedProperties} from '../index.d.ts';\n\ntype Foobar = {helloWorld1: {fooBar: string}};\n\ndeclare const foo: SnakeCasedProperties<Foobar>;\nexpectType<{hello_world1: {fooBar: string}}>(foo);\n\ndeclare const bar: SnakeCasedProperties<Foobar, {splitOnNumbers: true}>;\nexpectType<{hello_world_1: {fooBar: string}}>(bar);\n\n// Verify example\ntype User = {\n\tuserId: number;\n\tuserName: string;\n};\nconst result: SnakeCasedProperties<User> = {\n\tuser_id: 1,\n\tuser_name: 'Tom',\n};\nexpectType<SnakeCasedProperties<User>>(result);\n"
  },
  {
    "path": "test-d/some-extend.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SomeExtend} from '../source/some-extend.d.ts';\nimport type {UnknownArray} from '../source/unknown-array.d.ts';\n\nexpectType<SomeExtend<[], number>>(false);\nexpectType<SomeExtend<[1, '2', '3'], number>>(true); // First element matches\nexpectType<SomeExtend<['1', '2', 3], number>>(true); // Last element matches\nexpectType<SomeExtend<['1', 2, '3'], number>>(true); // Mid element matches\nexpectType<SomeExtend<[number, '1', 2, `${number}`], string>>(true); // Multiple elements match\nexpectType<SomeExtend<[1, 2, 3], number>>(true); // All elements match\n// Trailing rest element\nexpectType<SomeExtend<['2', 1, ...string[]], number>>(true); // Non-rest element matches\nexpectType<SomeExtend<['2', '1', ...number[]], number>>(true); // Rest element matches\n// Leading rest element\nexpectType<SomeExtend<[...Array<1 | -1>, number, string], string>>(true); // Non-rest element matches\nexpectType<SomeExtend<[...Array<1 | -1>, string, string], number>>(true); // Rest element matches\n// Middle rest element\nexpectType<SomeExtend<[string, number, ...string[], string, string], number>>(true); // Non-rest element before rest element matches\nexpectType<SomeExtend<[string, string, ...string[], number, string], number>>(true); // Non-rest element after rest element matches\nexpectType<SomeExtend<[string, ...number[], string, string], number>>(true); // Rest element matches\n\nexpectType<SomeExtend<['1', '2', '3'], number>>(false);\nexpectType<SomeExtend<[1, 2, 3], string>>(false);\nexpectType<SomeExtend<[1, 2, 3, ...string[]], bigint>>(false);\nexpectType<SomeExtend<[...bigint[], true, false], number | string>>(false);\nexpectType<SomeExtend<[1, 2, ...number[], '1', 3], true>>(false);\nexpectType<SomeExtend<['1', '2', ...bigint[]], number>>(false);\n\n// Union targets\nexpectType<SomeExtend<['1', '2', 3], number | bigint>>(true);\nexpectType<SomeExtend<[1, false, 0, true, 1], boolean>>(true);\nexpectType<SomeExtend<[...bigint[], number, string], number | string>>(true);\n\n// Union type elements\nexpectType<SomeExtend<[number, string | number], string>>({} as boolean);\nexpectType<SomeExtend<[false, false, false, boolean], true>>({} as boolean);\nexpectType<SomeExtend<[true, true, boolean, true], false>>({} as boolean);\nexpectType<SomeExtend<[1, 2n, number | bigint, 3n], string>>(false);\nexpectType<SomeExtend<['1', '2', number | bigint, '3'], number | bigint>>(true);\nexpectType<SomeExtend<[true, false, true, ...Array<string | undefined>], string | number>>({} as boolean);\nexpectType<SomeExtend<['foo', ...Array<number | string>, 'bar'], bigint | undefined>>(false);\n\n// Readonly arrays\nexpectType<SomeExtend<readonly [], number>>(false);\nexpectType<SomeExtend<readonly ['1', 2, '3'], number>>(true);\nexpectType<SomeExtend<readonly ['1', '2', '3'], number>>(false);\nexpectType<SomeExtend<readonly ['^', ...number[], '$'], number>>(true);\n\n// Optional elements\n// If `exactOptionalPropertyTypes` were disabled, the target type would need an additional `| undefined` for a successful match.\n// For example, `SomeExtend<['1'?, 2?], number>` would return `boolean`. To make it return `true`, the target type must be `number | undefined`.\nexpectType<SomeExtend<['1'?, '2'?, 3?], number>>(true);\nexpectType<SomeExtend<['1'?, (2 | undefined)?], number>>({} as boolean);\nexpectType<SomeExtend<[1?, '2'?, 3?], string | undefined>>(true);\nexpectType<SomeExtend<[1, 2?, 3?, ...string[]], string>>(true);\nexpectType<SomeExtend<['1', '2'?, '3'?, ...Array<number | undefined>], number>>({} as boolean);\nexpectType<SomeExtend<[1?, 2?, 3?, ...boolean[]], string>>(false);\n\n// Labelled tuples\nexpectType<SomeExtend<[x: string, y: number], string>>(true);\nexpectType<SomeExtend<[x?: number, y?: number], string>>(false);\nexpectType<SomeExtend<[x?: string, y?: string, ...rest: number[]], number>>(true);\nexpectType<SomeExtend<[...rest: number[], z: string], string>>(true);\nexpectType<SomeExtend<[...rest: number[], z: string], bigint>>(false);\n\n// Non-tuple arrays\nexpectType<SomeExtend<string[], string>>(true);\nexpectType<SomeExtend<Array<string | number>, number>>({} as boolean);\nexpectType<SomeExtend<ReadonlyArray<string | undefined>, string>>({} as boolean);\nexpectType<SomeExtend<[...readonly boolean[]], string>>(false);\n\n// Unions\nexpectType<SomeExtend<['1', '2', 3] | ['4', 5, '6'], number>>(true); // Both `true`\nexpectType<SomeExtend<[1, 2, 3] | ['4', '5', '6'], bigint>>(false); // Both `false`\nexpectType<SomeExtend<['1', '2', '3'] | ['1', '2', 3], number>>({} as boolean); // One `true`, one `false`\nexpectType<SomeExtend<[true, false] | [false, boolean], true>>({} as boolean); // One `true`, one `boolean`\nexpectType<SomeExtend<[false, false] | [boolean, false], true>>({} as boolean); // One `false`, one `boolean`\n\nexpectType<SomeExtend<[string, string, ...number[]] | [number, string, ...number[]], number>>(true);\nexpectType<SomeExtend<readonly [(number | bigint)?, ...string[]] | [0, 'a', 'b'] | [...ReadonlyArray<string | number>, 1], true>>(false);\nexpectType<SomeExtend<number[] | [...ReadonlyArray<string | number>, number], string>>({} as boolean);\nexpectType<SomeExtend<readonly number[] | [...rest: string[], l1: string, l2: string] | [(number | string)?, string?, ...string[]], number>>(\n\t{} as boolean,\n);\n\n// Boundary cases\nexpectType<SomeExtend<[], any>>(false);\nexpectType<SomeExtend<[], never>>(false);\n// `never` target\nexpectType<SomeExtend<[number, string, boolean], never>>(false);\nexpectType<SomeExtend<[number, string, never], never>>(true);\nexpectType<SomeExtend<[number, string, any], never>>({} as boolean);\n// `any` target\nexpectType<SomeExtend<[number], any>>(true);\nexpectType<SomeExtend<[never], any>>(true);\nexpectType<SomeExtend<[any], any>>(true);\n// `never` and `any` elements\nexpectType<SomeExtend<[1, 2, never], string>>(false);\nexpectType<SomeExtend<[1, 2, any], string>>({} as boolean);\n// `never[]` and `any[]` elements\nexpectType<SomeExtend<[1, 2, ...any[]], string>>({} as boolean);\nexpectType<SomeExtend<[1, 2, ...any[], 3, 4], string>>({} as boolean);\nexpectType<SomeExtend<[...any[], 3, 4], string>>({} as boolean);\nexpectType<SomeExtend<any[], number>>({} as boolean);\nexpectType<SomeExtend<[1, 2, ...never[]], string>>(false);\nexpectType<SomeExtend<[1, 2, ...never[], 3, 4], string>>(false);\nexpectType<SomeExtend<[...never[], 1, 2], string>>(false);\nexpectType<SomeExtend<never[], number>>(false);\n\n// === strictNever: false ===\ntype NonStrictNeverSomeExtend<TArray extends UnknownArray, Type> = SomeExtend<TArray, Type, {strictNever: false}>;\n\n// `never` elements\nexpectType<NonStrictNeverSomeExtend<[1, 2, never], string>>(true);\n// `never[]` elements\nexpectType<NonStrictNeverSomeExtend<[1, 2, ...never[]], string>>(true);\nexpectType<NonStrictNeverSomeExtend<[1, 2, ...never[], 3, 4], string>>(true);\nexpectType<NonStrictNeverSomeExtend<[...never[], 1, 2], string>>(true);\nexpectType<NonStrictNeverSomeExtend<never[], number>>(true);\n\nexpectType<SomeExtend<any, never>>(false);\nexpectType<SomeExtend<never, any>>(false);\n"
  },
  {
    "path": "test-d/split-on-rest-element.ts",
    "content": "import {expectType} from 'tsd';\nimport type {SplitOnRestElement, TupleOf, UnknownArray} from '../index.d.ts';\n\n// Fixed tuples (No rest element)\nexpectType<SplitOnRestElement<[]>>({} as [[], [], []]);\nexpectType<SplitOnRestElement<[1]>>({} as [[1], [], []]);\nexpectType<SplitOnRestElement<[1, 2, 3]>>({} as [[1, 2, 3], [], []]);\nexpectType<SplitOnRestElement<readonly ['a', 'b', 'c']>>({} as readonly [['a', 'b', 'c'], [], []]);\n\n// Rest elements (true variadic)\nexpectType<SplitOnRestElement<[1, ...number[]]>>({} as [[1], number[], []]);\nexpectType<SplitOnRestElement<[...string[]]>>({} as [[], string[], []]);\nexpectType<SplitOnRestElement<[...never[]]>>({} as [[], never[], []]);\nexpectType<SplitOnRestElement<[1, ...number[], 2]>>({} as [[1], number[], [2]]);\nexpectType<SplitOnRestElement<['a', ...string[], 'b']>>({} as [['a'], string[], ['b']]);\nexpectType<SplitOnRestElement<[...boolean[], string]>>({} as [[], boolean[], [string]]);\nexpectType<SplitOnRestElement<[...string[], 'x', 'y']>>({} as [[], string[], ['x', 'y']]);\nexpectType<SplitOnRestElement<[...never[], 1]>>({} as [[], never[], [1]]);\nexpectType<SplitOnRestElement<[undefined, ...boolean[], null]>>({} as [[undefined], boolean[], [null]]);\nexpectType<SplitOnRestElement<[void, ...never[], 1]>>({} as [[void], never[], [1]]);\nexpectType<SplitOnRestElement<[null, ...any[], null]>>({} as [[null], any[], [null]]);\nexpectType<SplitOnRestElement<[...Array<{id: string}>, number]>>({} as [[], Array<{id: string}>, [number]]);\nexpectType<SplitOnRestElement<[1, ...Array<readonly [string, number]>, 2]>>({} as [[1], Array<readonly [string, number]>, [2]]);\n\n// Generic arrays\nexpectType<SplitOnRestElement<string[]>>({} as [[], string[], []]);\nexpectType<SplitOnRestElement<number[]>>({} as [[], number[], []]);\nexpectType<SplitOnRestElement<unknown[]>>({} as [[], unknown[], []]);\nexpectType<SplitOnRestElement<any[]>>({} as [[], any[], []]);\n\n// Unions\nexpectType<SplitOnRestElement<[...Array<string | number>, boolean]>>({} as [[], Array<string | number>, [boolean]]);\nexpectType<SplitOnRestElement<[1, 2] | [3, 4]>>({} as [[1, 2], [], []] | [[3, 4], [], []]);\nexpectType<SplitOnRestElement<[1, ...number[]] | ['foo', ...string[]]>>({} as [[1], number[], []] | [['foo'], string[], []]);\n\n// Preserve optional\nexpectType<SplitOnRestElement<[0, 1?, 2?, ...never[]]>>({} as [[0, 1?, 2?], never[], []]);\nexpectType<SplitOnRestElement<[number?, ...string[]]>>({} as [[number?], string[], []]);\nexpectType<SplitOnRestElement<[number, boolean?, ...string[]]>>({} as [[number, boolean?], string[], []]);\n\n// Remove optional\nexpectType<SplitOnRestElement<[0, 1?, 2?, ...never[]], {preserveOptionalModifier: false}>>({} as [[0, 1, 2], never[], []]);\nexpectType<SplitOnRestElement<[number?, ...string[]], {preserveOptionalModifier: false}>>({} as [[number], string[], []]);\nexpectType<SplitOnRestElement<[number, boolean?, ...string[]], {preserveOptionalModifier: false}>>({} as [[number, boolean], string[], []]);\n\n// Readonly\nexpectType<SplitOnRestElement<readonly []>>({} as readonly [[], [], []]);\nexpectType<SplitOnRestElement<readonly [number] | [string]>>({} as readonly [[number], [], []] | [[string], [], []]);\nexpectType<SplitOnRestElement<readonly [...number[], 2]>>({} as readonly [[], number[], [2]]);\nexpectType<SplitOnRestElement<readonly [1, ...string[], 2] | readonly ['foo'?, ...string[]]>>({} as readonly [[1], string[], [2]] | readonly [['foo'?], string[], []]);\nexpectType<SplitOnRestElement<readonly [1, 2, 3]>>({} as readonly [[1, 2, 3], [], []]);\n\n// Edge: `never` / `any`\nexpectType<SplitOnRestElement<any>>({} as any);\nexpectType<SplitOnRestElement<never>>({} as never);\n\n// Long tuples\ntype FiftyZeroes = TupleOf<50, '0'>;\nexpectType<SplitOnRestElement<[...FiftyZeroes, ...number[], ...FiftyZeroes]>>({} as [FiftyZeroes, number[], FiftyZeroes]);\n\ntype FourHundredNinetyNineZeroes = TupleOf<499, '0'>;\nexpectType<SplitOnRestElement<[...FourHundredNinetyNineZeroes, ...number[], ...FourHundredNinetyNineZeroes]>>({} as [FourHundredNinetyNineZeroes, number[], FourHundredNinetyNineZeroes]);\n\n// Generic instantiations\ntype Assignability<_T extends UnknownArray> = unknown;\ntype TestAssignability<T extends UnknownArray> = Assignability<SplitOnRestElement<T>>;\n"
  },
  {
    "path": "test-d/split.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Split, StringRepeat, TupleOf} from '../index.d.ts';\n\ndeclare function split<\n\tS extends string,\n\tDelimiter extends string,\n>(string: S, separator: Delimiter): Split<S, Delimiter>;\n\nconst items = 'foo,bar,baz,waldo';\n\n// General use.\nexpectType<['foo', 'bar', 'baz', 'waldo']>(split(items, ','));\n\n// Missing replacement character in original string.\nexpectType<['foo,bar,baz,waldo']>(split(items, ' '));\n\n// Empty string split (every character).\nexpectType<[\n\t'f', 'o', 'o', ',', 'b', 'a', 'r', ',',\n\t'b', 'a', 'z', ',', 'w', 'a', 'l', 'd', 'o',\n]>(split(items, ''));\n\n// Split single same character.\nexpectType<['', '']>(split(' ', ' '));\n\n// Split empty string by empty string.\nexpectType<[]>(split('', ''));\n\n// Split empty string by any string.\nexpectType<['']>(split('', ' '));\n\n// Unions\nexpectType<['a', 'b', 'c'] | ['x', 'y', 'z']>({} as Split<'a,b,c' | 'x,y,z', ','>);\nexpectType<['a', 'b', 'c'] | ['a,', ',c']>({} as Split<'a,b,c', ',' | 'b'>);\nexpectType<['a', 'b', 'c'] | ['a,b,c'] | ['x', 'y', 'z'] | ['x:y:z']>({} as Split<'a,b,c' | 'x:y:z', ',' | ':'>);\n\n// -- strictLiteralChecks: false --\n// NOTE: The behaviour covered in the test below is not acurate because the `a.b.${string}` type might hold a value like `a.b.c.d`,\n// which, when split by `.`, would result in `['a', 'b', 'c', 'd']`, which wouldn't conform to the output type of `['a', 'b', string]`.\nexpectType<['a', 'b', string]>({} as Split<`a.b.${string}`, '.', {strictLiteralChecks: false}>);\n\n// Ensure the last dynamic \"string\" is not dropped when split by `''`.\n// https://github.com/sindresorhus/type-fest/issues/1203\nexpectType<['a', 'b', string]>({} as Split<`ab${string}`, '', {strictLiteralChecks: false}>);\n\n// -- strictLiteralChecks: true --\nexpectType<string[]>({} as Split<string, ''>);\nexpectType<string[]>({} as Split<Uppercase<string>, '-'>);\nexpectType<string[]>({} as Split<`on${string}`, 'n'>);\nexpectType<string[]>({} as Split<'a,b,c', string>);\nexpectType<string[]>({} as Split<'a,b,c', Lowercase<string>>);\nexpectType<string[]>({} as Split<'a,b,c', `,${string}`, {strictLiteralChecks: true}>);\nexpectType<string[]>({} as Split<`on${string}`, Lowercase<string>, {strictLiteralChecks: true}>);\n\nexpectType<['a', 'b', 'c'] | string[]>({} as Split<'a,b,c' | `bye, ${string}`, ',', {strictLiteralChecks: true}>);\nexpectType<['a', 'b', 'c'] | string[]>({} as Split<'a,b,c', ',' | `b${string}`, {strictLiteralChecks: true}>);\nexpectType<['a', 'b', 'c'] | string[]>({} as Split<'a,b,c' | `bye, ${string}`, ',' | `b${string}`, {strictLiteralChecks: true}>);\n\n// Recursion depth at which a non-tail recursive implementation starts to fail.\ntype FiftyZeroes = StringRepeat<'0', 50>;\nexpectType<TupleOf<50, '0'>>({} as Split<FiftyZeroes, ''>);\n\n// Maximum allowed recursion depth for a tail recursive implementation.\ntype NineHundredNinetyNineZeroes = StringRepeat<'0', 999>;\nexpectType<TupleOf<999, '0'>>({} as Split<NineHundredNinetyNineZeroes, ''>);\n"
  },
  {
    "path": "test-d/spread.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Spread} from '../index.d.ts';\n\ntype Foo = {\n\ta: 'a1';\n\tb?: 'b1';\n\tc: 'c1';\n\td?: 'd1';\n\te: 'e1' | undefined;\n\tf: 'f1';\n\tg?: 'g1';\n};\n\ntype Bar = {\n\ta?: 'a2';\n\tb: 'b2';\n\tc: 'c2';\n\td?: 'd2';\n\te?: 'e2';\n\th: 'h2';\n\ti?: 'i2';\n};\n\ntype FooBar = Spread<Foo, Bar>;\n\nconst foo: Foo = {\n\ta: 'a1',\n\tb: 'b1',\n\tc: 'c1',\n\td: 'd1',\n\te: 'e1',\n\tf: 'f1',\n\tg: 'g1',\n};\n\nconst bar: Bar = {\n\tb: 'b2',\n\tc: 'c2',\n\th: 'h2',\n};\n\nconst foobar = {...foo, ...bar};\n\nexpectType<FooBar>(foobar);\n\nconst arrayFoo = [1, 2, 3];\nconst arrayBar = [4, 5, 6];\n\nconst arrayFooBar = [...arrayFoo, ...arrayBar]; //=> number[]\ntype ArrayFooBar = Spread<typeof arrayFoo, typeof arrayBar>;\n\nexpectType<ArrayFooBar>(arrayFooBar);\nexpectType<number[]>(arrayFooBar);\n\nconst stringArray = ['4', '5', '6'];\n\nconst mixedArrayFooBar = [...arrayFoo, ...stringArray]; //=> (string | number)[]\ntype MixedArrayFooBar = Spread<typeof arrayFoo, typeof stringArray>;\n\nexpectType<MixedArrayFooBar>(mixedArrayFooBar);\nexpectType<Array<string | number>>(mixedArrayFooBar);\n\nconst tupleFoo: [1, 2, 3] = [1, 2, 3];\nconst tupleBar: [4, 5, 6] = [4, 5, 6];\n\nconst tupleFooBar = [...tupleFoo, ...tupleBar]; //=> (1 | 2 | 3 | 4 | 5 | 6)[]\ntype TupleFooBar = Spread<typeof tupleFoo, typeof tupleBar>;\n\nexpectType<TupleFooBar>(tupleFooBar);\nexpectType<Array<1 | 2 | 3 | 4 | 5 | 6>>(tupleFooBar);\n\nconst arrayTupleFooBar = [...arrayFoo, ...tupleBar]; //=> number[]\ntype ArrayTupleFooBar = Spread<typeof arrayFoo, typeof tupleBar>;\n\nexpectType<ArrayTupleFooBar>(arrayTupleFooBar);\nexpectType<number[]>(arrayTupleFooBar);\n\nconst tupleArrayFooBar = [...tupleFoo, ...arrayBar]; //=> number[]\ntype TupleArrayFooBar = Spread<typeof tupleFoo, typeof arrayBar>;\n\nexpectType<TupleArrayFooBar>(tupleArrayFooBar);\nexpectType<number[]>(tupleArrayFooBar);\n"
  },
  {
    "path": "test-d/string-repeat.ts",
    "content": "import {expectType} from 'tsd';\nimport type {StringRepeat} from '../index.d.ts';\n\ndeclare const unknown: unknown;\n\nexpectType<StringRepeat<'', 0>>('');\nexpectType<StringRepeat<'', -1>>(unknown as never);\nexpectType<StringRepeat<string, 0>>('');\nexpectType<StringRepeat<string, -1>>(unknown as never);\nexpectType<StringRepeat<'', number>>('');\nexpectType<StringRepeat<string, number>>(unknown as string);\nexpectType<StringRepeat<'0', number>>(unknown as string);\nexpectType<StringRepeat<'0', -1>>(unknown as never);\nexpectType<StringRepeat<'0', 0>>('');\nexpectType<StringRepeat<'0', 1>>('0');\nexpectType<StringRepeat<'0', 5>>('00000');\nexpectType<StringRepeat<'012345-', 0>>('');\nexpectType<StringRepeat<'012345-', 1>>('012345-');\nexpectType<StringRepeat<'012345-', 5>>('012345-012345-012345-012345-012345-');\n\n// Non literal strings\nexpectType<StringRepeat<string, 2>>(unknown as string);\nexpectType<StringRepeat<`abc${string}`, 2>>(unknown as `abc${string}abc${string}`);\nexpectType<StringRepeat<Uppercase<string>, 2>>(unknown as `${Uppercase<string>}${Uppercase<string>}`);\n\n// Union cases\nexpectType<StringRepeat<'0' | '1', 5>>(unknown as '00000' | '11111');\nexpectType<StringRepeat<'0', 4 | 5>>(unknown as '0000' | '00000');\nexpectType<StringRepeat<'0' | '1', 4 | 5>>(unknown as '0000' | '00000' | '1111' | '11111');\n\n// Recursion depth at which a non-tail recursive implementation starts to fail.\nconst fiftyZeroes = '00000000000000000000000000000000000000000000000000';\nexpectType<StringRepeat<'0', 50>>(fiftyZeroes);\n\n// Maximum allowed recursion depth for a tail recursive implementation.\n// eslint-disable-next-line @stylistic/max-len\nconst nineHundredNinetyNineZeroes = '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\nexpectType<StringRepeat<'0', 999>>(nineHundredNinetyNineZeroes);\n"
  },
  {
    "path": "test-d/string-slice.ts",
    "content": "import {expectType} from 'tsd';\nimport type {StringSlice} from '../index.d.ts';\n\nexpectType<StringSlice<'abcde'>>('abcde');\nexpectType<StringSlice<'abcde'>>('abcde');\nexpectType<StringSlice<'abcde', 0, -1>>('abcd');\nexpectType<StringSlice<'abcde', 1, -1>>('bcd');\nexpectType<StringSlice<'abcde', 1, 2>>('b');\nexpectType<StringSlice<'abcde', 1, 3>>('bc');\nexpectType<StringSlice<'abcde', -100, -1>>('abcd');\nexpectType<StringSlice<'abcde', -100, -3>>('ab');\nexpectType<StringSlice<'abcde', 3, 100>>('de');\nexpectType<StringSlice<'abcde', 1, 1>>('');\nexpectType<StringSlice<'abcde', 100, 1>>('');\nexpectType<StringSlice<string>>(null! as string);\nexpectType<StringSlice<string, 1>>(null! as string);\nexpectType<StringSlice<string, 1, 2>>(null! as string);\n\n// Unions\n// String is union\nexpectType<StringSlice<'012' | 'abcd', 0>>({} as '012' | 'abcd'); // Positive start, no end\nexpectType<StringSlice<'012' | 'abcd', -2>>({} as '12' | 'cd'); // Negative start, no end\nexpectType<StringSlice<'012' | 'abcd', 0, 2>>({} as '01' | 'ab'); // Positive start, positive end\nexpectType<StringSlice<'012' | 'abcd', -2, -1>>({} as '1' | 'c'); // Negative start, negative end\nexpectType<StringSlice<'012' | 'abcd', -3, 2>>({} as '01' | 'b'); // Negative start, positive end\nexpectType<StringSlice<'012' | 'abcd', 1, -1>>({} as '1' | 'bc'); // Positive start, negative end\n\n// Start is union\nexpectType<StringSlice<'0123', 1 | -2>>({} as '123' | '23'); // Positive/Negative start, no end\nexpectType<StringSlice<'0123', 2 | -3, 3>>({} as '2' | '12'); // Positive/Negative start, positive end\nexpectType<StringSlice<'0123', 0 | -2, -1>>({} as '2' | '012'); // Positive/Negative start, negative end\n\n// End is union\nexpectType<StringSlice<'0123', 0, 1 | -2>>({} as '0' | '01'); // Positive start, positive/negative end\nexpectType<StringSlice<'0123', -2, 2 | -1>>({} as '' | '2'); // Negative start, positive/negative end\n\n// Array and start are unions\nexpectType<StringSlice<'012' | 'abcd', 1 | -1>>({} as '12' | '2' | 'bcd' | 'd'); // Positive/Negative start, no end\nexpectType<StringSlice<'012' | 'abcd', 1 | -2, 2>>({} as '1' | 'b' | ''); // Positive/Negative start, positive end\nexpectType<StringSlice<'012' | 'abcd', 0 | -2, -1>>({} as '01' | '1' | 'abc' | 'c'); // Positive/Negative start, negative end\n\n// Array and end are unions\nexpectType<StringSlice<'012' | 'abcd', 2, 3 | -1>>({} as '2' | '' | 'c'); // Positive start, positive/negative end\nexpectType<StringSlice<'012' | 'abcd', -3, 3 | -2>>({} as '012' | '0' | 'bc' | 'b'); // Negative start, positive/negative end\n\n// Start and end are unions\nexpectType<StringSlice<'0123', -5 | 0 | 1, -2 | 0 | 3>>( // Positive/Negative start, positive/negative end\n\t{} as '01' | '012' | '' | '1' | '12',\n);\n\n// Array, start and end are unions\nexpectType<StringSlice<'012' | 'abcd', 1 | -4, 4 | -1>>( // Positive/Negative start, positive/negative end\n\t{} as '1' | '12' | '01' | '012' | 'abcd' | 'abc' | 'bc' | 'bcd',\n);\n"
  },
  {
    "path": "test-d/stringified.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {Stringified} from '../index.d.ts';\n\ndeclare const stringified: Stringified<{a: number; b: string}>;\nexpectType<{a: string; b: string}>(stringified);\n\ntype Car = {\n\tmodel: string;\n\tspeed: number;\n};\nexpectNotAssignable<Stringified<Car>>({model: 'Foo', speed: 101});\nexpectAssignable<Stringified<Car>>({model: 'Foo', speed: '101'});\n"
  },
  {
    "path": "test-d/structured-cloneable.ts",
    "content": "import {expectAssignable, expectNotAssignable} from 'tsd';\nimport type {StructuredCloneable} from '../index.d.ts';\n\n/*\nSource: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n# Supported types\n## JavaScript types\n- Array\n- ArrayBuffer\n- Boolean\n- DataView\n- Date\n- Error types (but see Error types below).\n- Map\n- Number\n- Object: but only plain objects (e.g. from object literals).\n- Primitive types, except symbol.\n- RegExp: but note that lastIndex is not preserved.\n- Set\n- String\n- TypedArray\n\n## Error types\nFor Error types, the error name must be one of: Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError (or will be set to \"Error\").\n\n## Web/API types\n - Blob\n - File\n\n## DOM exclusive types (not included)\n - AudioData\n - CropTarget\n - CryptoKey\n - DOMException: browsers must serialize the properties name and message. Other attributes may also be serialized/cloned.\n - DOMMatrix\n - DOMMatrixReadOnly\n - DOMPoint\n - DOMPointReadOnly\n - DOMQuad\n - DOMRect\n - DOMRectReadOnly\n - FileList\n - FileSystemDirectoryHandle\n - FileSystemFileHandle\n - FileSystemHandle\n - GPUCompilationInfo\n - GPUCompilationMessage\n - ImageBitmap\n - ImageData\n - RTCCertificate\n - VideoFrame\n*/\n\n// Date, Boolean, Number, String\nexpectAssignable<StructuredCloneable>(new Date());\ndeclare const booleanWrapperObject: Boolean;\nexpectAssignable<StructuredCloneable>(booleanWrapperObject);\ndeclare const numberWrapperObject: Number;\nexpectAssignable<StructuredCloneable>(numberWrapperObject);\ndeclare const stringWrapperObject: String;\nexpectAssignable<StructuredCloneable>(stringWrapperObject);\n\n// Primitive types, except symbol.\nexpectAssignable<StructuredCloneable>(undefined);\nexpectAssignable<StructuredCloneable>(null);\nexpectAssignable<StructuredCloneable>(true);\nexpectAssignable<StructuredCloneable>(1);\nexpectAssignable<StructuredCloneable>(1n);\nexpectAssignable<StructuredCloneable>('');\ndeclare const symbolValue: symbol;\nexpectNotAssignable<StructuredCloneable>(symbolValue);\n\n// RegExp: but note that lastIndex is not preserved.\nexpectAssignable<StructuredCloneable>(/foo/);\n\n// ArrayBuffer, DataView\nexpectAssignable<StructuredCloneable>(new ArrayBuffer(10));\nexpectAssignable<StructuredCloneable>(new DataView(new ArrayBuffer(10)));\n\n// TypedArray\nexpectAssignable<StructuredCloneable>(new Int8Array(10));\nexpectAssignable<StructuredCloneable>(new Uint8Array(10));\nexpectAssignable<StructuredCloneable>(new Uint8ClampedArray(10));\nexpectAssignable<StructuredCloneable>(new Int16Array(10));\nexpectAssignable<StructuredCloneable>(new Uint16Array(10));\nexpectAssignable<StructuredCloneable>(new Int32Array(10));\nexpectAssignable<StructuredCloneable>(new Uint32Array(10));\nexpectAssignable<StructuredCloneable>(new Float32Array(10));\nexpectAssignable<StructuredCloneable>(new Float64Array(10));\nexpectAssignable<StructuredCloneable>(new BigInt64Array(10));\nexpectAssignable<StructuredCloneable>(new BigUint64Array(10));\n\n// Error types\ndeclare const error: Error;\nexpectAssignable<StructuredCloneable>(error);\ndeclare const evalError: EvalError;\nexpectAssignable<StructuredCloneable>(evalError);\ndeclare const rangeError: RangeError;\nexpectAssignable<StructuredCloneable>(rangeError);\ndeclare const referenceError: ReferenceError;\nexpectAssignable<StructuredCloneable>(referenceError);\ndeclare const syntaxError: SyntaxError;\nexpectAssignable<StructuredCloneable>(syntaxError);\ndeclare const typeError: TypeError;\nexpectAssignable<StructuredCloneable>(typeError);\ndeclare const uriError: URIError;\nexpectAssignable<StructuredCloneable>(uriError);\n\n// Object: but only plain objects (e.g. from object literals).\nexpectAssignable<StructuredCloneable>({});\nexpectAssignable<StructuredCloneable>({x: 10});\nexpectAssignable<StructuredCloneable>({x: {y: 10}});\nexpectAssignable<StructuredCloneable>({x: 10} as const);\nclass CustomType {}\nexpectNotAssignable<StructuredCloneable>(new CustomType());\nclass CustomTypeWithProperties {\n\tfoo = 'wow';\n\tbar = 1;\n}\nexpectNotAssignable<StructuredCloneable>(new CustomTypeWithProperties());\n\n// Array\nexpectAssignable<StructuredCloneable>([]);\nexpectAssignable<StructuredCloneable>([1, 2, 3]);\nexpectAssignable<StructuredCloneable>([1, 2, 3] as const);\nexpectAssignable<StructuredCloneable>([[1, 2], [3, 4]]);\nexpectAssignable<StructuredCloneable>([{x: 1}, {x: 2}]);\n\n// Map\nexpectAssignable<StructuredCloneable>(new Map<string, Date>());\nexpectAssignable<StructuredCloneable>(new Map<Date, string[]>());\nexpectAssignable<StructuredCloneable>(new Map<Date, Map<string, number>>());\n\n// Set\nexpectAssignable<StructuredCloneable>(new Set<number>());\nexpectAssignable<StructuredCloneable>(new Set<string[]>());\nexpectAssignable<StructuredCloneable>(new Set<Set<string>>());\n\n// Web/API types\n\n// @ts-ignore Requires dom or @types/node@>=20\ndeclare const blob: Blob;\nexpectAssignable<StructuredCloneable>(blob);\n\n// @ts-ignore Requires dom or @types/node@>=20\ndeclare const file: File;\nexpectAssignable<StructuredCloneable>(file);\n"
  },
  {
    "path": "test-d/subtract.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Subtract} from '../index.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../source/numeric.d.ts';\n\n// Positive result\nexpectType<12>({} as Subtract<10, -2>);\nexpectType<0>({} as Subtract<0, 0>);\nexpectType<0>({} as Subtract<2, 2>);\nexpectType<2>({} as Subtract<-1, -3>);\nexpectType<7>({} as Subtract<12, 5>);\nexpectType<69>({} as Subtract<69, 0>);\nexpectType<1000>({} as Subtract<999, -1>);\nexpectType<1998>({} as Subtract<999, -999>);\n\n// Negative result\nexpectType<-1>({} as Subtract<1, 2>);\nexpectType<-6>({} as Subtract<-10, -4>);\nexpectType<-14>({} as Subtract<-10, 4>);\nexpectType<-333>({} as Subtract<-111, 222>);\nexpectType<-420>({} as Subtract<0, 420>);\nexpectType<-1000>({} as Subtract<-999, 1>);\nexpectType<-1998>({} as Subtract<-999, 999>);\n\n// Infinity\nexpectType<PositiveInfinity>({} as Subtract<PositiveInfinity, 999>);\nexpectType<NegativeInfinity>({} as Subtract<-999, PositiveInfinity>);\nexpectType<NegativeInfinity>({} as Subtract<NegativeInfinity, 999>);\nexpectType<PositiveInfinity>({} as Subtract<999, NegativeInfinity>);\nexpectType<NegativeInfinity>({} as Subtract<NegativeInfinity, PositiveInfinity>);\n\n// Number\nexpectType<number>({} as Subtract<number, 2>);\nexpectType<number>({} as Subtract<2, number>);\nexpectType<number>({} as Subtract<number, number>);\nexpectType<number>({} as Subtract<NegativeInfinity, NegativeInfinity>);\nexpectType<number>({} as Subtract<PositiveInfinity, PositiveInfinity>);\nexpectType<number>({} as Subtract<number, PositiveInfinity>);\nexpectType<number>({} as Subtract<PositiveInfinity, number>);\n\n// Union\nexpectType<9 | 8>({} as Subtract<10, 1 | 2>);\nexpectType<9 | 4>({} as Subtract<10 | 5, 1>);\nexpectType<9 | 8 | 4 | 3>({} as Subtract<10 | 5, 1 | 2>);\nexpectType<11 | 8 | -4 | -7>({} as Subtract<10 | -5, -1 | 2>);\n"
  },
  {
    "path": "test-d/sum.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Sum} from '../index.d.ts';\nimport type {NegativeInfinity, PositiveInfinity} from '../source/numeric.d.ts';\n\n// Positive result\nexpectType<0>({} as Sum<-999, 999>);\nexpectType<0>({} as Sum<999, -999>);\nexpectType<0>({} as Sum<0, 0>);\nexpectType<0>({} as Sum<2, -2>);\nexpectType<0>({} as Sum<-2, 2>);\nexpectType<3>({} as Sum<1, 2>);\nexpectType<8>({} as Sum<10, -2>);\nexpectType<8>({} as Sum<-2, 10>);\nexpectType<57>({} as Sum<-20, 77>);\nexpectType<998>({} as Sum<-1, 999>);\nexpectType<1000>({} as Sum<999, 1>);\nexpectType<1998>({} as Sum<999, 999>);\n\n// Negative result\nexpectType<-3>({} as Sum<-1, -2>);\nexpectType<-8>({} as Sum<-10, 2>);\nexpectType<-8>({} as Sum<2, -10>);\nexpectType<-57>({} as Sum<20, -77>);\nexpectType<-998>({} as Sum<-999, 1>);\nexpectType<-998>({} as Sum<1, -999>);\nexpectType<-1998>({} as Sum<-999, -999>);\n\n// Infinity\nexpectType<PositiveInfinity>({} as Sum<PositiveInfinity, -999>);\nexpectType<PositiveInfinity>({} as Sum<-999, PositiveInfinity>);\nexpectType<PositiveInfinity>({} as Sum<PositiveInfinity, PositiveInfinity>);\nexpectType<NegativeInfinity>({} as Sum<NegativeInfinity, 999>);\nexpectType<NegativeInfinity>({} as Sum<999, NegativeInfinity>);\nexpectType<NegativeInfinity>({} as Sum<NegativeInfinity, NegativeInfinity>);\n\n// Number\nexpectType<number>({} as Sum<number, 1>);\nexpectType<number>({} as Sum<1, number>);\nexpectType<number>({} as Sum<number, number>);\nexpectType<number>({} as Sum<number, PositiveInfinity>);\nexpectType<number>({} as Sum<NegativeInfinity, number>);\nexpectType<number>({} as Sum<NegativeInfinity, PositiveInfinity>);\nexpectType<number>({} as Sum<PositiveInfinity, NegativeInfinity>);\n\n// Union\nexpectType<3 | 4>({} as Sum<1, 2 | 3>);\nexpectType<4 | 5>({} as Sum<1 | 2, 3>);\nexpectType<5 | 6 | 7 | 8>({} as Sum<1 | 2 | 3, 4 | 5>);\nexpectType<2 | 4 | 5 | 7 | 9 | -2 | -4 | -7>({} as Sum<1 | -2 | 3, 4 | -5 | 6>);\n"
  },
  {
    "path": "test-d/tagged-union.ts",
    "content": "import {expectAssignable, expectNotAssignable} from 'tsd';\nimport type {TaggedUnion} from '../index.d.ts';\n\ntype Union = TaggedUnion<'tag', {str: {a: string}; num: {b: number}}>;\n\nconst first = {\n\ttag: 'str' as const,\n\ta: 'some-string',\n};\n\nconst second = {\n\ttag: 'num' as const,\n\tb: 1,\n};\n\nexpectAssignable<Union>(first);\nexpectAssignable<Union>(second);\n\nconst fails = {\n\ttag: 'num' as const,\n\tb: 'should not be string',\n};\n\nconst failsToo = {\n\ttag: 'str' as const,\n\tb: 2,\n};\n\nexpectNotAssignable<Union>(fails);\nexpectNotAssignable<Union>(failsToo);\n"
  },
  {
    "path": "test-d/trim.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Trim} from '../index.d.ts';\n\ndeclare function trim<S extends string>(value: S): Trim<S>;\n\nexpectType<'foo'>(trim(' foo'));\nexpectType<'bar'>(trim('bar '));\nexpectType<'baz'>(trim(' baz '));\nexpectType<'waldo'>(trim('  waldo  '));\nexpectType<'fr ed'>(trim(' fr ed '));\nexpectType<'foo'>(trim(' foo\\n'));\nexpectType<'foo'>(trim(' foo\\n\\t '));\n"
  },
  {
    "path": "test-d/ts41.ts",
    "content": "// Ensure that TypeScript 4.1 types are available.\nimport {expectType} from 'tsd';\nimport type {CamelCase} from '../index.d.ts';\n\nconst camelFromPascal: CamelCase<'FooBar'> = 'fooBar';\nexpectType<CamelCase<'FooBar'>>(camelFromPascal);\n"
  },
  {
    "path": "test-d/tsconfig-json.ts",
    "content": "import {expectType, expectAssignable} from 'tsd';\nimport type {Jsonifiable, TsConfigJson} from '../index.d.ts';\n\nconst tsConfig: TsConfigJson = {};\n\nexpectType<boolean | undefined>(tsConfig.compileOnSave);\nexpectType<TsConfigJson.CompilerOptions | undefined>(tsConfig.compilerOptions);\nexpectType<string[] | undefined>(tsConfig.exclude);\nexpectType<string | string[] | undefined>(tsConfig.extends);\nexpectType<string[] | undefined>(tsConfig.files);\nexpectType<string[] | undefined>(tsConfig.include);\nexpectType<TsConfigJson.References[] | undefined>(tsConfig.references);\nexpectType<TsConfigJson.TypeAcquisition | undefined>(tsConfig.typeAcquisition);\nexpectAssignable<Jsonifiable>(tsConfig);\n\nexpectType<boolean | undefined>(tsConfig.compilerOptions?.noCheck);\n"
  },
  {
    "path": "test-d/tuple-of.ts",
    "content": "import {expectType} from 'tsd';\nimport type {TupleOf} from '../source/tuple-of.d.ts';\n\nexpectType<TupleOf<3, null>>({} as [null, null, null]);\nexpectType<TupleOf<5, 0>>({} as [0, 0, 0, 0, 0]);\nexpectType<TupleOf<2, 0 | 1>>({} as [0 | 1, 0 | 1]);\n\n// Zero length\nexpectType<TupleOf<0, string>>({} as []);\n\n// Default `Fill`\nexpectType<TupleOf<4>>({} as [unknown, unknown, unknown, unknown]);\n\n// Union length\nexpectType<TupleOf<2 | 3, 0>>({} as [0, 0] | [0, 0, 0]);\n\n// Large length\n// eslint-disable-next-line @stylistic/max-len\nexpectType<TupleOf<999, 1>>({} as [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);\n\n// Negative length\nexpectType<TupleOf<-3, string>>({} as []);\n\n// Boundary types\nexpectType<TupleOf<never, string>>({} as []);\nexpectType<TupleOf<never>>({} as []);\nexpectType<TupleOf<any, string>>({} as string[]);\nexpectType<TupleOf<any>>({} as unknown[]);\nexpectType<TupleOf<2, never>>({} as [never, never]);\nexpectType<TupleOf<3, any>>({} as [any, any, any]);\n\n// @ts-expect-error\ntype LengthShouldBeNumber = TupleOf<'ten'>;\n"
  },
  {
    "path": "test-d/tuple-to-object.ts",
    "content": "import {expectType} from 'tsd';\nimport type {TupleToObject} from '../source/tuple-to-object.d.ts';\n\n// Tuples\nexpectType<TupleToObject<[]>>({} as {});\nexpectType<TupleToObject<[number]>>({} as {0: number});\nexpectType<TupleToObject<[number, string]>>({} as {0: number; 1: string});\nexpectType<TupleToObject<[number | string, {foo: string}]>>({} as {0: number | string; 1: {foo: string}});\nexpectType<TupleToObject<[number, string?]>>({} as {0: number; 1?: string});\nexpectType<TupleToObject<[number?, string?, boolean?]>>({} as {0?: number; 1?: string; 2?: boolean});\n\n// Readonly tuples\nexpectType<TupleToObject<readonly []>>({} as {});\nexpectType<TupleToObject<readonly [number, string]>>({} as {readonly 0: number; readonly 1: string});\nexpectType<TupleToObject<readonly [number, string?, boolean?]>>({} as {readonly 0: number; readonly 1?: string; readonly 2?: boolean});\n\n// Non-tuples\nexpectType<TupleToObject<number[]>>({} as Record<number, number>);\nexpectType<TupleToObject<[...boolean[]]>>({} as Record<number, boolean>);\nexpectType<TupleToObject<[number, string, ...boolean[]]>>({} as {[x: number]: number | string | boolean; 0: number; 1: string});\nexpectType<TupleToObject<[number, string?, ...boolean[]]>>({} as {[x: number]: number | string | boolean | undefined; 0: number; 1?: string});\nexpectType<TupleToObject<[...number[], string, bigint]>>({} as Record<number, number | string | bigint>);\nexpectType<TupleToObject<never[]>>({} as Record<number, never>);\nexpectType<TupleToObject<any[]>>({} as Record<number, any>);\n\n// Readonly non-tuples\nexpectType<TupleToObject<readonly number[]>>({} as Readonly<Record<number, number>>);\nexpectType<TupleToObject<readonly [number, string?, ...boolean[]]>>({} as {readonly [x: number]: number | string | boolean | undefined; readonly 0: number; readonly 1?: string});\nexpectType<TupleToObject<readonly [...number[], string, bigint]>>({} as Readonly<Record<number, number | string | bigint>>);\n\n// Unions\nexpectType<TupleToObject<[number] | [number, string, boolean]>>(\n\t{} as {0: number} | {0: number; 1: string; 2: boolean},\n);\nexpectType<TupleToObject<[number?, string?] | [] | [number, string, ...number[]]>>(\n\t{} as {0?: number; 1?: string} | {} | {[x: number]: number | string; 0: number; 1: string},\n);\nexpectType<TupleToObject<Array<number | undefined> | string[]>>(\n\t{} as Record<number, number | undefined> | Record<number, string>,\n);\nexpectType<TupleToObject<[number, string] | readonly string[]>>(\n\t{} as {0: number; 1: string} | Readonly<Record<number, string>>,\n);\nexpectType<TupleToObject<readonly [string] | readonly [number?] | number[]>>(\n\t{} as {readonly 0: string} | {readonly 0?: number} | Record<number, number>,\n);\nexpectType<TupleToObject<[...number[], string] | [number?, string?, ...number[]]>>(\n\t{} as Record<number, string | number> | {[x: number]: string | number | undefined; 0?: number; 1?: string},\n);\n\n// Labeled tuples\nexpectType<TupleToObject<[x: string, y: number]>>({} as {0: string; 1: number});\nexpectType<TupleToObject<[first: string, ...rest: number[]]>>({} as {[x: number]: string | number; 0: string});\nexpectType<TupleToObject<[...rest: number[], last: string]>>({} as Record<number, string | number>);\nexpectType<TupleToObject<readonly [name: string, age?: number]>>({} as {readonly 0: string; readonly 1?: number});\n\n// Boundary types\nexpectType<TupleToObject<any>>({} as any);\nexpectType<TupleToObject<never>>({} as never);\n\n// @ts-expect-error only works with arrays\ntype T = TupleToObject<{}>;\n"
  },
  {
    "path": "test-d/tuple-to-union.ts",
    "content": "import {expectAssignable, expectNotType, expectType} from 'tsd';\nimport type {TupleToUnion} from '../index.d.ts';\n\nconst options = ['a', 'b', 'c'] as const;\ntype Options = TupleToUnion<typeof options>;\n\nconst a: Options = 'a';\nexpectAssignable<Options>(a);\nexpectType<'a'>(a);\nexpectNotType<'b'>(a);\nexpectNotType<'c'>(a);\n\nconst b: Options = 'b';\nexpectAssignable<Options>(b);\nexpectNotType<'a'>(b);\nexpectType<'b'>(b);\nexpectNotType<'c'>(b);\n\nconst c: Options = 'c';\nexpectAssignable<Options>(c);\nexpectNotType<'a'>(c);\nexpectNotType<'b'>(c);\nexpectType<'c'>(c);\n\ndeclare const notAnArray: TupleToUnion<[]>;\nexpectType<never>(notAnArray);\n\ndeclare const worksWithArrays: TupleToUnion<Array<string | number>>;\nexpectType<string | number>(worksWithArrays);\n\ndeclare const resolvesToNeverForNonArrays: TupleToUnion<string | number>;\nexpectType<never>(resolvesToNeverForNonArrays);\n\ndeclare const infiniteRestArguments: TupleToUnion<[string, ...number[]]>;\nexpectType<string | number>(infiniteRestArguments);\n"
  },
  {
    "path": "test-d/undefined-on-partial-deep.ts",
    "content": "// TODO: Test equality\nimport {expectAssignable} from 'tsd';\nimport type {UndefinedOnPartialDeep} from '../source/undefined-on-partial-deep.d.ts';\n\ntype TestType1 = UndefinedOnPartialDeep<{required: string; optional?: string; optional2?: number; optional3?: string}>;\nexpectAssignable<TestType1>({required: '', optional: undefined, optional2: 1});\n\ntype TestType2 = UndefinedOnPartialDeep<{optional?: string | undefined}>;\nexpectAssignable<TestType2>({optional: undefined});\n\ntype TestType3 = UndefinedOnPartialDeep<{requiredWithUndefind: string | undefined}>;\nexpectAssignable<TestType3>({requiredWithUndefind: undefined});\n\n// Test null and undefined\ntype NullType = UndefinedOnPartialDeep<{null?: null}>;\nexpectAssignable<NullType>({null: undefined});\ntype UndefinedType = UndefinedOnPartialDeep<{ud?: undefined}>;\nexpectAssignable<UndefinedType>({ud: undefined});\n\n// Test mixed types\ntype MixedType = UndefinedOnPartialDeep<{\n\trequired: string;\n\tunion?: 'test1' | 'test2';\n\tboolean?: boolean;\n\tstring?: string;\n\tsymbol?: symbol;\n\tdate?: Date;\n\tregExp?: RegExp;\n\tfunc?: (arguments0: string, arguments1: number) => boolean;\n}>;\nexpectAssignable<MixedType>({\n\trequired: '',\n\tunion: undefined,\n\tboolean: undefined,\n\tstring: undefined,\n\tsymbol: undefined,\n\tdate: undefined,\n\tregExp: undefined,\n\tfunc: undefined,\n});\n\n// Test object\ntype ObjectType = UndefinedOnPartialDeep<{obj?: {key: string}}>;\nexpectAssignable<ObjectType>({obj: undefined});\n\ntype ObjectDeepType = UndefinedOnPartialDeep<{obj?: {subObj?: {key?: string}}}>;\nexpectAssignable<ObjectDeepType>({obj: undefined});\nexpectAssignable<ObjectDeepType>({obj: {subObj: undefined}});\nexpectAssignable<ObjectDeepType>({obj: {subObj: {key: undefined}}});\n\n// Test map\ntype MapType = UndefinedOnPartialDeep<{map?: Map<string, {key?: string}>}>;\nexpectAssignable<MapType>({map: undefined});\nexpectAssignable<MapType>({map: new Map([['', {key: undefined}]])});\n\n// Test set\ntype SetType = UndefinedOnPartialDeep<{set?: Set<{key?: string}>}>;\nexpectAssignable<SetType>({set: undefined});\nexpectAssignable<SetType>({set: new Set([{key: undefined}])});\n\n// Test array and tuple\ntype TupleType = UndefinedOnPartialDeep<{tuple?: [string, number]}>;\nexpectAssignable<TupleType>({tuple: undefined});\ntype ArrayType = UndefinedOnPartialDeep<{array?: string[]}>;\nexpectAssignable<ArrayType>({array: undefined});\ntype ArrayDeepType = UndefinedOnPartialDeep<{array?: Array<{subArray?: string[]}>}>;\nexpectAssignable<ArrayDeepType>({array: undefined});\nexpectAssignable<ArrayDeepType>({array: [{subArray: undefined}]});\ntype ObjectListType = UndefinedOnPartialDeep<{array?: Array<{key?: string}>}>;\nexpectAssignable<ObjectListType>({array: undefined});\nexpectAssignable<ObjectListType>({array: [{key: undefined}]});\n\n// Test readonly array\ntype ReadonlyType = UndefinedOnPartialDeep<{readonly?: readonly string[]}>;\nexpectAssignable<ReadonlyType>({readonly: undefined});\n// eslint-disable-next-line @typescript-eslint/array-type\ntype ReadonlyArrayTest = UndefinedOnPartialDeep<{readonly?: ReadonlyArray<string>}>;\nexpectAssignable<ReadonlyArrayTest>({readonly: undefined});\n"
  },
  {
    "path": "test-d/union-member.ts",
    "content": "import {expectType} from 'tsd';\nimport type {UnionMember, IsNever, IsEqual} from '../index.d.ts';\n\nexpectType<false>({} as boolean extends UnionMember<boolean> ? true : false);\nexpectType<false>({} as (1 | 'foo' | 'bar') extends UnionMember<1 | 'foo' | 'bar'> ? true : false);\nexpectType<false>({} as ({foo: string} | {bar: number}) extends UnionMember<{foo: string} | {bar: number}> ? true : false);\n\nexpectType<number>({} as UnionMember<number>);\nexpectType<string>({} as UnionMember<string>);\nexpectType<bigint>({} as UnionMember<bigint>);\nexpectType<true>({} as UnionMember<true>);\nexpectType<false>({} as UnionMember<false>);\nexpectType<null>({} as any as UnionMember<null>);\nexpectType<undefined>({} as any as UnionMember<undefined>);\n\nexpectType<never>({} as UnionMember<never>);\nexpectType<unknown>({} as UnionMember<unknown>);\nexpectType<any>({} as UnionMember<any>);\n\n// `WrapMemberInTuple` ensures `UnionMember` selects exactly one member at a time.\ntype WrapMemberInTuple<T, L = UnionMember<T>> =\n\tIsNever<T> extends false\n\t\t? WrapMemberInTuple<Exclude<T, L>> | [L]\n\t\t: never;\nexpectType<[1] | [2] | [3]>({} as WrapMemberInTuple<1 | 2 | 3>);\nexpectType<['foo'] | ['bar'] | ['baz']>({} as WrapMemberInTuple<'foo' | 'bar' | 'baz'>);\nexpectType<[1] | ['foo'] | [true] | [100n] | [null] | [undefined]>(\n\t{} as WrapMemberInTuple<1 | 'foo' | true | 100n | null | undefined>,\n);\nexpectType<[{a: string}] | [{b: number}]>({} as WrapMemberInTuple<{a: string} | {b: number}>);\n\ntype UnionType = {a: 0} | {readonly a: 0};\ntype PickedUnionMember = UnionMember<UnionType>;\n// We can't use `UnionType extends PickedUnionMember ? true : false` for testing here,\n// because that would always be `true` as `UnionType` extends both of its members individually.\nexpectType<false>({} as IsEqual<UnionType, PickedUnionMember>);\n"
  },
  {
    "path": "test-d/union-to-intersection.ts",
    "content": "import {expectAssignable, expectType} from 'tsd';\nimport type {UnionToIntersection} from '../index.d.ts';\n\ndeclare const intersection1: UnionToIntersection<{a: string} | {b: number}>;\nexpectAssignable<{a: string; b: number}>(intersection1);\n\n// Creates a union of matching properties.\ndeclare const intersection2: UnionToIntersection<{a: string} | {b: number} | {a: () => void}>;\nexpectAssignable<{a: string | (() => void); b: number}>(intersection2);\n\ntype Assignability<T, U, _K extends T | U> = never;\ntype TestAssignability<T, U> = Assignability<T, U, UnionToIntersection<T | U>>;\n"
  },
  {
    "path": "test-d/union-to-tuple.ts",
    "content": "import {expectAssignable, expectType} from 'tsd';\nimport type {UnionToTuple} from '../index.d.ts';\n\ntype Options = UnionToTuple<'a' | 'b' | 'c'>;\n// Results unordered\nexpectAssignable<['a', 'b', 'c'] | ['a', 'c', 'b'] | ['b', 'a', 'c'] | ['b', 'c', 'a'] | ['c', 'a', 'b'] | ['c', 'b', 'a']>({} as Options);\nexpectType<Options[number]>({} as ('a' | 'b' | 'c'));\n\ntype Options1 = UnionToTuple<1 | 2 | 3>;\nexpectType<Options1[number]>({} as (1 | 2 | 3));\n\ntype Options2 = UnionToTuple<boolean | 1>;\nexpectType<Options2[number]>({} as (1 | false | true));\n\n// Test for https://github.com/sindresorhus/type-fest/issues/1352\n// This union is special because `{readonly a: 0}` extends `{a: 0}`, and `{a: 0}` also extends `{readonly a: 0}`,\n// meaning both types are assignable to each other.\n// See [this comment](https://github.com/sindresorhus/type-fest/pull/1349#issuecomment-3858719735) for more details.\ntype DifferentModifierUnion = {readonly a: 0} | {a: 0};\nexpectType<DifferentModifierUnion>({} as UnionToTuple<DifferentModifierUnion>[number]);\n\n// Edge cases.\nexpectType<[]>({} as UnionToTuple<never>);\nexpectType<[any]>({} as UnionToTuple<any>);\nexpectType<[unknown]>({} as UnionToTuple<unknown>);\n"
  },
  {
    "path": "test-d/unknown-array.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {UnknownArray} from '../index.d.ts';\n\ndeclare const foo: readonly [];\ndeclare const bar: {\n\treadonly array: unknown[];\n};\n\nexpectAssignable<UnknownArray>(foo);\nexpectAssignable<UnknownArray>(bar.array);\nexpectAssignable<UnknownArray>([]);\nexpectAssignable<UnknownArray>(['foo']);\n\nexpectNotAssignable<UnknownArray>(null);\nexpectNotAssignable<UnknownArray>(undefined);\nexpectNotAssignable<UnknownArray>({});\nexpectNotAssignable<UnknownArray>({0: 1});\nexpectNotAssignable<UnknownArray>(1);\nexpectNotAssignable<UnknownArray>(Date);\n\ntype IsArray<T> = T extends UnknownArray ? true : false;\n\ndeclare const string: IsArray<string>;\nexpectType<false>(string);\ndeclare const array: IsArray<[]>;\nexpectType<true>(array);\ndeclare const tuple: IsArray<['foo']>;\nexpectType<true>(tuple);\ndeclare const readonlyArray: IsArray<readonly number[]>;\nexpectType<true>(readonlyArray);\ndeclare const leadingSpread: IsArray<readonly [number, ...string[]]>;\nexpectType<true>(leadingSpread);\ndeclare const trailingSpread: IsArray<readonly [...string[], number]>;\nexpectType<true>(trailingSpread);\n"
  },
  {
    "path": "test-d/unknown-map.ts",
    "content": "import {expectAssignable, expectNotAssignable} from 'tsd';\nimport type {UnknownMap} from '../index.d.ts';\n\ndeclare const foo: ReadonlyMap<string, number>;\ndeclare const bar: {\n\treadonly map: ReadonlyMap<number, string>;\n};\n\nexpectAssignable<UnknownMap>(foo);\nexpectAssignable<UnknownMap>(bar.map);\nexpectAssignable<UnknownMap>(new Map());\nexpectAssignable<UnknownMap>(new Map([['foo', 1]]));\n\nexpectNotAssignable<UnknownMap>(null);\nexpectNotAssignable<UnknownMap>(undefined);\nexpectNotAssignable<UnknownMap>({});\nexpectNotAssignable<UnknownMap>([]);\nexpectNotAssignable<UnknownMap>({0: 1});\nexpectNotAssignable<UnknownMap>(1);\n"
  },
  {
    "path": "test-d/unknown-record.ts",
    "content": "import {expectAssignable, expectType} from 'tsd';\nimport type {UnknownRecord} from '../index.d.ts';\n\ndeclare let foo: UnknownRecord;\n\nexpectAssignable<UnknownRecord>(foo);\nexpectAssignable<UnknownRecord>(foo = {});\nexpectAssignable<UnknownRecord>(foo = {bar: 'baz'});\nexpectAssignable<UnknownRecord>(foo = {bar: {baz: 'hello'}});\n\n// @ts-expect-error\nfoo = [];\n// @ts-expect-error\nfoo = 42;\n// @ts-expect-error\nfoo = null;\n\nexpectType<unknown>(foo['bar']);\n"
  },
  {
    "path": "test-d/unknown-set.ts",
    "content": "import {expectAssignable, expectNotAssignable} from 'tsd';\nimport type {UnknownSet} from '../index.d.ts';\n\ndeclare const foo: ReadonlySet<string>;\ndeclare const bar: {\n\treadonly set: ReadonlySet<number>;\n};\n\nexpectAssignable<UnknownSet>(foo);\nexpectAssignable<UnknownSet>(bar.set);\nexpectAssignable<UnknownSet>(new Set());\nexpectAssignable<UnknownSet>(new Set('foo'));\n\nexpectNotAssignable<UnknownSet>(null);\nexpectNotAssignable<UnknownSet>(undefined);\nexpectNotAssignable<UnknownSet>({});\nexpectNotAssignable<UnknownSet>([]);\nexpectNotAssignable<UnknownSet>({0: 1});\nexpectNotAssignable<UnknownSet>(1);\nexpectNotAssignable<UnknownSet>(Date);\n"
  },
  {
    "path": "test-d/unwrap-partial.ts",
    "content": "import {expectType} from 'tsd';\nimport type {EmptyObject, UnwrapPartial} from '../index.d.ts';\n\ntype TestType = {\n\ta: string;\n\tb: number;\n};\n\nexpectType<TestType>({} as UnwrapPartial<Partial<TestType>>);\nexpectType<TestType>({} as UnwrapPartial<{a?: string; b?: number}>);\nexpectType<Partial<TestType>>({} as UnwrapPartial<Partial<Partial<TestType>>>);\n\n// `UnwrapPartial` preserves optional properties\ntype TestTypeWithOptionalProp = TestType & {\n\tc?: boolean;\n};\n\ntype AnotherTestType = {\n\tc: boolean;\n\td: 'literal';\n};\n\ntype TestTypeWithOptionalProps = TestType & Partial<AnotherTestType>;\n\nexpectType<TestTypeWithOptionalProp>({} as UnwrapPartial<Partial<TestTypeWithOptionalProp>>);\nexpectType<TestTypeWithOptionalProps>({} as UnwrapPartial<Partial<TestTypeWithOptionalProps>>);\n\n// `UnwrapPartial` preserves nested `Partial` properties\ntype TestTypeWithPartialProp = TestType & {\n\tc: Partial<TestType>;\n};\n\nexpectType<TestTypeWithPartialProp>({} as UnwrapPartial<Partial<TestTypeWithPartialProp>>);\n\n// `UnwrapPartial` preserves readonly properties\ntype TestTypeWithReadonlyProps = Readonly<TestType> & {\n\treadonly c: boolean;\n};\n\nexpectType<TestTypeWithReadonlyProps>({} as UnwrapPartial<Partial<TestTypeWithReadonlyProps>>);\n\n// `UnwrapPartial` works with methods\ntype TestTypeWithMethod = {\n\tc(): void;\n};\n\nexpectType<TestTypeWithMethod>({} as UnwrapPartial<Partial<TestTypeWithMethod>>);\n\n// `UnwrapPartial` works with union types\ntype PartialUnionType = Partial<TestType> | Partial<AnotherTestType>;\n\nexpectType<TestType | AnotherTestType>({} as UnwrapPartial<PartialUnionType>);\nexpectType<TestType | AnotherTestType>({} as UnwrapPartial<Partial<TestType> | AnotherTestType>);\n\n// `UnwrapPartial` works with index signatures\ntype ArrayLikeTestType = {\n\t[index: number]: string;\n};\n\ntype PlainObjectTestType = {\n\treadonly [key: string]: number | undefined;\n};\n\nexpectType<ArrayLikeTestType>({} as UnwrapPartial<Partial<ArrayLikeTestType>>);\nexpectType<PlainObjectTestType>({} as UnwrapPartial<PlainObjectTestType>);\nexpectType<Record<number, string>>({} as UnwrapPartial<Partial<Record<number, string>>>);\nexpectType<string[]>({} as UnwrapPartial<Partial<string[]>>);\nexpectType<Array<string | undefined>>({} as UnwrapPartial<Array<string | undefined>>);\n\n// `UnwrapPartial` works with tuples\ntype TestTuple = [string, number, boolean];\n\nexpectType<TestTuple>({} as UnwrapPartial<Partial<TestTuple>>);\nexpectType<TestTuple>({} as UnwrapPartial<[string?, number?, boolean?]>);\n\n// `UnwrapPartial` works with empty objects and unknown types\nexpectType<EmptyObject>({} as UnwrapPartial<Partial<EmptyObject>>);\nexpectType<unknown>({} as UnwrapPartial<Partial<unknown>>);\nexpectType<any>({} as UnwrapPartial<Partial<any>>);\nexpectType<never>({} as UnwrapPartial<never>);\nexpectType<Record<string, unknown>>({} as UnwrapPartial<Partial<Record<string, unknown>>>);\nexpectType<Record<string, any>>({} as UnwrapPartial<Partial<Record<string, any>>>);\n\n// `UnwrapPartial` has no effect on non-partial types\nexpectType<TestType>({} as UnwrapPartial<TestType>);\n"
  },
  {
    "path": "test-d/value-of.ts",
    "content": "import {expectAssignable, expectNotAssignable, expectType} from 'tsd';\nimport type {ValueOf} from '../index.d.ts';\n\nconst value: ValueOf<{a: 1; b: 2; c: 3}> = 3;\nconst valueRestricted: ValueOf<{a: 1; b: 2; c: 3}, 'a'> = 1;\n\nexpectAssignable<1 | 2 | 3>(value);\nexpectNotAssignable<4>(value);\n\nexpectType<1>(valueRestricted);\nexpectNotAssignable<2>(valueRestricted);\nexpectNotAssignable<4>(valueRestricted);\n"
  },
  {
    "path": "test-d/words.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Words} from '../source/words.d.ts';\n\nexpectType<Words<''>>([]);\nexpectType<Words<'a'>>(['a']);\nexpectType<Words<'B'>>(['B']);\nexpectType<Words<'aa'>>(['aa']);\nexpectType<Words<'aB'>>(['a', 'B']);\nexpectType<Words<'Ba'>>(['Ba']);\nexpectType<Words<'BB'>>(['BB']);\nexpectType<Words<'aaa'>>(['aaa']);\nexpectType<Words<'aaB'>>(['aa', 'B']);\nexpectType<Words<'aBa'>>(['a', 'Ba']);\nexpectType<Words<'aBB'>>(['a', 'BB']);\nexpectType<Words<'Baa'>>(['Baa']);\nexpectType<Words<'BaB'>>(['Ba', 'B']);\nexpectType<Words<'BBa'>>(['B', 'Ba']);\nexpectType<Words<'BBB'>>(['BBB']);\nexpectType<Words<'aaaa'>>(['aaaa']);\nexpectType<Words<'aaaB'>>(['aaa', 'B']);\nexpectType<Words<'aaBa'>>(['aa', 'Ba']);\nexpectType<Words<'aaBB'>>(['aa', 'BB']);\nexpectType<Words<'aBaa'>>(['a', 'Baa']);\nexpectType<Words<'aBaB'>>(['a', 'Ba', 'B']);\nexpectType<Words<'aBBa'>>(['a', 'B', 'Ba']);\nexpectType<Words<'aBBB'>>(['a', 'BBB']);\nexpectType<Words<'Baaa'>>(['Baaa']);\nexpectType<Words<'BaaB'>>(['Baa', 'B']);\nexpectType<Words<'BaBa'>>(['Ba', 'Ba']);\nexpectType<Words<'BaBB'>>(['Ba', 'BB']);\nexpectType<Words<'BBaa'>>(['B', 'Baa']);\nexpectType<Words<'BBaB'>>(['B', 'Ba', 'B']);\nexpectType<Words<'BBBa'>>(['BB', 'Ba']);\nexpectType<Words<'BBBB'>>(['BBBB']);\nexpectType<Words<'aaaaa'>>(['aaaaa']);\nexpectType<Words<'aaaaB'>>(['aaaa', 'B']);\nexpectType<Words<'aaaBa'>>(['aaa', 'Ba']);\nexpectType<Words<'aaaBB'>>(['aaa', 'BB']);\nexpectType<Words<'aaBaa'>>(['aa', 'Baa']);\nexpectType<Words<'aaBaB'>>(['aa', 'Ba', 'B']);\nexpectType<Words<'aaBBa'>>(['aa', 'B', 'Ba']);\nexpectType<Words<'aaBBB'>>(['aa', 'BBB']);\nexpectType<Words<'aBaaa'>>(['a', 'Baaa']);\nexpectType<Words<'aBaaB'>>(['a', 'Baa', 'B']);\nexpectType<Words<'aBaBa'>>(['a', 'Ba', 'Ba']);\nexpectType<Words<'aBaBB'>>(['a', 'Ba', 'BB']);\nexpectType<Words<'aBBaa'>>(['a', 'B', 'Baa']);\nexpectType<Words<'aBBaB'>>(['a', 'B', 'Ba', 'B']);\nexpectType<Words<'aBBBa'>>(['a', 'BB', 'Ba']);\nexpectType<Words<'aBBBB'>>(['a', 'BBBB']);\nexpectType<Words<'Baaaa'>>(['Baaaa']);\nexpectType<Words<'BaaaB'>>(['Baaa', 'B']);\nexpectType<Words<'BaaBa'>>(['Baa', 'Ba']);\nexpectType<Words<'BaaBB'>>(['Baa', 'BB']);\nexpectType<Words<'BaBaa'>>(['Ba', 'Baa']);\nexpectType<Words<'BaBaB'>>(['Ba', 'Ba', 'B']);\nexpectType<Words<'BaBBa'>>(['Ba', 'B', 'Ba']);\nexpectType<Words<'BaBBB'>>(['Ba', 'BBB']);\nexpectType<Words<'BBaaa'>>(['B', 'Baaa']);\nexpectType<Words<'BBaaB'>>(['B', 'Baa', 'B']);\nexpectType<Words<'BBaBa'>>(['B', 'Ba', 'Ba']);\nexpectType<Words<'BBaBB'>>(['B', 'Ba', 'BB']);\nexpectType<Words<'BBBaa'>>(['BB', 'Baa']);\nexpectType<Words<'BBBaB'>>(['BB', 'Ba', 'B']);\nexpectType<Words<'BBBBa'>>(['BBB', 'Ba']);\nexpectType<Words<'BBBBB'>>(['BBBBB']);\n\nexpectType<Words<'hello world'>>(['hello', 'world']);\nexpectType<Words<'Hello-world'>>(['Hello', 'world']);\nexpectType<Words<'hello_world'>>(['hello', 'world']);\nexpectType<Words<'hello  world'>>(['hello', 'world']);\nexpectType<Words<'Hello--world'>>(['Hello', 'world']);\nexpectType<Words<'hello__world'>>(['hello', 'world']);\nexpectType<Words<'   hello  world'>>(['hello', 'world']);\nexpectType<Words<'---Hello--world'>>(['Hello', 'world']);\nexpectType<Words<'___hello__world'>>(['hello', 'world']);\nexpectType<Words<'hello  world   '>>(['hello', 'world']);\nexpectType<Words<'hello\\tworld'>>(['hello', 'world']);\nexpectType<Words<'Hello--world--'>>(['Hello', 'world']);\nexpectType<Words<'hello__world___'>>(['hello', 'world']);\nexpectType<Words<'___ hello -__  _world'>>(['hello', 'world']);\nexpectType<Words<'__HelloWorld-HELLOWorld helloWORLD'>>(['Hello', 'World', 'HELLO', 'World', 'hello', 'WORLD']);\nexpectType<Words<'hello WORLD lowercase'>>(['hello', 'WORLD', 'lowercase']);\nexpectType<Words<'hello WORLD-lowercase'>>(['hello', 'WORLD', 'lowercase']);\nexpectType<Words<'hello WORLD Uppercase'>>(['hello', 'WORLD', 'Uppercase']);\n\nexpectType<Words<'item0'>>(['item', '0']);\nexpectType<Words<'item01'>>(['item', '01']);\nexpectType<Words<'item10'>>(['item', '10']);\nexpectType<Words<'item010'>>(['item', '010']);\nexpectType<Words<'0item0'>>(['0', 'item', '0']);\nexpectType<Words<'01item01'>>(['01', 'item', '01']);\nexpectType<Words<'10item10'>>(['10', 'item', '10']);\nexpectType<Words<'010item010'>>(['010', 'item', '010']);\nexpectType<Words<'item0_item_1 item -2'>>(['item', '0', 'item', '1', 'item', '2']);\n"
  },
  {
    "path": "test-d/writable-deep.ts",
    "content": "import {expectType, expectAssignable} from 'tsd';\nimport type {JsonValue, Opaque, ReadonlyDeep, WritableDeep} from '../index.d.ts';\nimport type {_WritableObjectDeep} from '../source/writable-deep.d.ts';\nimport type {tag} from '../source/tagged.d.ts';\n\ntype Overloaded = {\n\t(foo: number): string;\n\t(foo: string, bar: number): number;\n};\n\ntype Namespace = {\n\t(foo: number): string;\n\treadonly baz: readonly boolean[];\n};\n\ntype NamespaceWithOverload = Overloaded & {\n\treadonly baz: readonly boolean[];\n};\n\ntype OpaqueObjectData = {readonly a: number[]} | {readonly b: string};\ntype OpaqueObject = Opaque<OpaqueObjectData, {readonly token: unknown}>;\n\ntype ReadonlyJsonValue =\n\t| {readonly [k: string]: ReadonlyJsonValue}\n\t| readonly ReadonlyJsonValue[]\n\t| number\n\t| string\n\t| boolean\n\t| null;\n\nconst data = {\n\tobject: {\n\t\tfoo: 'bar',\n\t} as const,\n\tfn: (_: string) => true,\n\tfnWithOverload: ((_: number) => 'foo') as Overloaded,\n\tnamespace: {} as unknown as Namespace,\n\tnamespaceWithOverload: {} as unknown as NamespaceWithOverload,\n\tstring: 'foo',\n\tnumber: 1,\n\tboolean: false,\n\tsymbol: Symbol('test'),\n\tdate: new Date(),\n\tregExp: /.*/,\n\tnull: null,\n\tundefined: undefined, // eslint-disable-line object-shorthand\n\tmap: new Map<string, string>(),\n\tset: new Set<string>(),\n\tarray: ['foo'],\n\temptyTuple: [] as [],\n\ttuple: ['foo'] as ['foo'],\n\tmultiItemTuple: [{a: ''}, {b: 1}] as [{a: string}, {b: number}],\n\tspreadTuple: ['foo'] as [...string[]],\n\ttrailingSpreadTuple: ['foo', 1] as [string, ...number[]],\n\tleadingSpreadTuple: ['foo', 1] as [...string[], number],\n\treadonlyMap: new Map<string, string>() as ReadonlyMap<string, string>,\n\treadonlySet: new Set<string>() as ReadonlySet<string>,\n\treadonlyArray: ['foo'] as readonly string[],\n\treadonlyTuple: ['foo'] as const,\n\tjson: [{x: true}] as JsonValue,\n\topaqueObj: {a: [3]} as OpaqueObject, // eslint-disable-line @typescript-eslint/consistent-type-assertions\n};\n\nconst readonlyData: ReadonlyDeep<typeof data> = data;\n\nlet writableData: WritableDeep<typeof readonlyData>;\n// @ts-expect-error\nwritableData = readonlyData; // eslint-disable-line prefer-const\n\nwritableData.fn('foo');\n\nwritableData.fnWithOverload(1);\nwritableData.fnWithOverload('', 1);\n\nwritableData.string = 'bar';\n\nexpectType<{foo: 'bar'}>(writableData.object);\nexpectType<string>(writableData.string);\nexpectType<number>(writableData.number);\nexpectType<boolean>(writableData.boolean);\nexpectType<symbol>(writableData.symbol);\nexpectType<null>(writableData.null);\nexpectType<undefined>(writableData.undefined);\nexpectType<Date>(writableData.date);\nexpectType<RegExp>(writableData.regExp);\nexpectType<Map<string, string>>(writableData.map);\nexpectType<Set<string>>(writableData.set);\nexpectType<string[]>(writableData.array);\nexpectType<[]>(writableData.emptyTuple);\nexpectType<['foo']>(writableData.tuple);\nexpectType<[{a: string}, {b: number}]>(writableData.multiItemTuple);\nexpectType<[...string[]]>(writableData.spreadTuple);\nexpectType<[string, ...number[]]>(writableData.trailingSpreadTuple);\nexpectType<[...string[], number]>(writableData.leadingSpreadTuple);\nexpectType<Map<string, string>>(writableData.readonlyMap);\nexpectType<Set<string>>(writableData.readonlySet);\nexpectType<string[]>(writableData.readonlyArray);\nexpectType<['foo']>(writableData.readonlyTuple);\nexpectAssignable<ReadonlyJsonValue>(writableData.json);\nexpectAssignable<Opaque<WritableDeep<OpaqueObjectData>, WritableDeep<OpaqueObject[typeof tag]>>>(writableData.opaqueObj);\n\nexpectType<((foo: number) => string) & _WritableObjectDeep<Namespace>>(writableData.namespace);\nexpectType<string>(writableData.namespace(1));\nexpectType<boolean[]>(writableData.namespace.baz);\n\n// These currently aren't writable due to TypeScript limitations.\n// @see https://github.com/microsoft/TypeScript/issues/29732\nexpectType<NamespaceWithOverload>(writableData.namespaceWithOverload);\nexpectType<string>(writableData.namespaceWithOverload(1));\nexpectType<number>(writableData.namespaceWithOverload('foo', 1));\nexpectType<readonly boolean[]>(writableData.namespaceWithOverload.baz);\n\n// Test that WritableDeep is the inverse of ReadonlyDeep.\nconst fullyWritableData = {\n\tarray: ['a', 'b'],\n\tmap: new Map<string, number>(),\n\tset: new Set<string>(),\n\tobject: {\n\t\tdate: new Date(),\n\t\tboolean: true,\n\t},\n};\nexpectAssignable<WritableDeep<ReadonlyDeep<typeof fullyWritableData>>>(fullyWritableData);\n\n// Standalone tests\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\nconst writableNamespace = {} as WritableDeep<{\n\t(foo: number): string;\n\treadonly baz: readonly boolean[];\n}>;\nexpectType<((foo: number) => string) & {\n\tbaz: boolean[];\n}>(writableNamespace);\nexpectAssignable<{\n\t(foo: number): string;\n\tbaz: boolean[];\n}>(writableNamespace);\n"
  },
  {
    "path": "test-d/writable-keys-of.ts",
    "content": "import {expectType} from 'tsd';\nimport type {UnknownRecord, WritableKeysOf} from '../index.d.ts';\n\ntype TestType1 = {\n\treadonly a: string;\n\tb: boolean;\n};\n\ntype TestType2 = {\n\ta: string;\n\tb: boolean;\n};\n\ntype TestType3 = {\n\treadonly a: string;\n\treadonly b: boolean;\n};\n\ntype WritableKeysOf1 = WritableKeysOf<TestType1>;\ntype WritableKeysOf2 = WritableKeysOf<TestType2>;\ntype WritableKeysOf3 = WritableKeysOf<TestType3>;\n\ndeclare const test1: WritableKeysOf1;\ndeclare const test2: WritableKeysOf2;\ndeclare const test3: WritableKeysOf3;\n\nexpectType<'b'>(test1);\nexpectType<'a' | 'b'>(test2);\nexpectType<never>(test3);\n\nexpectType<'a' | 'c'>({} as WritableKeysOf<{a?: string; readonly b: number; c: boolean}>);\nexpectType<'c'>({} as WritableKeysOf<{readonly a?: string; readonly b: number; c: boolean}>);\n\n// Unions\nexpectType<'b' | 'c'>({} as WritableKeysOf<{readonly a: string; b: number} | {c?: string; readonly d?: number}>);\nexpectType<'a' | 'b'>({} as WritableKeysOf<{readonly a: string; readonly b: number} | {a: string; b: number}>);\n\n// Arrays\nexpectType<number | '0' | '1' | '2'>({} as Extract<WritableKeysOf<[string, number, boolean]>, number | `${number}`>);\nexpectType<never>({} as Extract<WritableKeysOf<readonly [string, number, boolean]>, number | `${number}`>);\nexpectType<number>({} as Extract<WritableKeysOf<string[]>, number | `${number}`>);\nexpectType<never>({} as Extract<WritableKeysOf<readonly string[]>, number | `${number}`>);\n\n// `WritableKeysOf<T>` should be assignable to `keyof T`\ntype Assignability1<T, _K extends keyof T> = unknown;\ntype Test1<T extends object> = Assignability1<T, WritableKeysOf<T>>;\n\n// `keyof T` should NOT be assignable to `WritableKeysOf<T>`\ntype Assignability2<T extends object, _K extends WritableKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test2<T extends object> = Assignability2<T, keyof T>;\n\n// `WritableKeysOf<T>` should be assignable to `PropertyKey`\ntype Assignability3<_T, _K extends PropertyKey> = unknown;\ntype Test3<T extends object> = Assignability3<T, WritableKeysOf<T>>;\n\n// `PropertyKey` should NOT be assignable to `WritableKeysOf<T>`\ntype Assignability4<T extends object, _K extends WritableKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test4<T extends object> = Assignability4<T, PropertyKey>;\n\n// `WritableKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability5<T extends Record<string, unknown>, _K extends keyof T> = unknown;\ntype Test5<T extends Record<string, unknown>> = Assignability5<T, WritableKeysOf<T>>;\n\n// `WritableKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `object`\ntype Assignability6<T extends object, _K extends keyof T> = unknown;\ntype Test6<T extends object> = Assignability6<T, WritableKeysOf<T>>;\n\n// `WritableKeysOf<T>` should be assignable to `keyof T` even when `T` is constrained to `UnknownRecord`\ntype Assignability7<T extends UnknownRecord, _K extends keyof T> = unknown;\ntype Test7<T extends UnknownRecord> = Assignability7<T, WritableKeysOf<T>>;\n\n// `keyof T` should NOT be assignable to `WritableKeysOf<T>` even when `T` is constrained to `Record<string, unknown>`\ntype Assignability8<T extends Record<string, unknown>, _K extends WritableKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test8<T extends Record<string, unknown>> = Assignability8<T, keyof T>;\n\n// `keyof T` should NOT be assignable to `WritableKeysOf<T>` even when `T` is constrained to `object`\ntype Assignability9<T extends object, _K extends WritableKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test9<T extends object> = Assignability9<T, keyof T>;\n\n// `keyof T` should NOT be assignable to `WritableKeysOf<T>` even when `T` is constrained to `UnknownRecord`\ntype Assignability10<T extends UnknownRecord, _K extends WritableKeysOf<T>> = unknown;\n// @ts-expect-error\ntype Test10<T extends UnknownRecord> = Assignability10<T, keyof T>;\n\n// @ts-expect-error\ntype AllowsOnlyObjects = WritableKeysOf<string>;\n"
  },
  {
    "path": "test-d/writable.ts",
    "content": "import {expectNotAssignable, expectType} from 'tsd';\nimport type {Writable} from '../index.d.ts';\n\ntype Foo = {\n\treadonly a: number;\n\treadonly b: string;\n};\n\nconst ab: Writable<Foo> = {a: 1, b: '2'};\nab.a = 2;\nconst ab2: Writable<Readonly<Foo>> = ab;\nab2.a = 2;\n\n// Update one writable and one readonly to writable, leaving one property unaffected.\ndeclare const variation1: Writable<{readonly a: number; b: string; readonly c: boolean}, 'b' | 'c'>;\nexpectType<{readonly a: number; b: string; c: boolean}>(variation1);\n\n// Update two readonly to writable, leaving one property unaffected.\ndeclare const variation2: Writable<{readonly a: number; readonly b: string; readonly c: boolean}, 'a' | 'b'>;\nexpectType<{a: number; b: string; readonly c: boolean}>(variation2);\n\n// Three writable remain writable.\ndeclare const variation3: Writable<{a: number; b: string; c: boolean}, 'a' | 'b' | 'c'>;\nexpectType<{a: number; b: string; c: boolean}>(variation3);\n\n// Check if type changes raise an error even if readonly and writable are applied correctly.\ndeclare const variation4: Writable<{readonly a: number; b: string; readonly c: boolean}, 'b' | 'c'>;\nexpectNotAssignable<{readonly a: boolean; b: string; c: boolean}>(variation4);\n\n// Test array\ndeclare const variation5: Writable<readonly string[]>;\nexpectType<string[]>(variation5);\n\n// Test tuple\ndeclare const variation8: Writable<readonly [string, number]>;\nexpectType<[string, number]>(variation8);\n\n// Test tuple with spread\ndeclare const variation6: Writable<readonly [...string[], number]>;\nexpectType<[...string[], number]>(variation6);\ndeclare const variation7: Writable<readonly [string, ...number[]]>;\nexpectType<[string, ...number[]]>(variation7);\n\n// Test readonly set\ndeclare const variation9: Writable<ReadonlySet<string>>;\nexpectType<Set<string>>(variation9);\n\n// Test readonly map\ndeclare const variation10: Writable<ReadonlyMap<string, number>>;\nexpectType<Map<string, number>>(variation10);\n"
  },
  {
    "path": "test-d/xor.ts",
    "content": "import {expectType} from 'tsd';\nimport type {Xor} from '../source/xor.d.ts';\n\ndeclare const boolean: boolean;\n\nexpectType<Xor<true, true>>(false);\nexpectType<Xor<true, false>>(true);\nexpectType<Xor<false, true>>(true);\nexpectType<Xor<false, false>>(false);\n\nexpectType<Xor<true, boolean>>(boolean);\nexpectType<Xor<boolean, true>>(boolean);\nexpectType<Xor<false, boolean>>(boolean);\nexpectType<Xor<boolean, false>>(boolean);\nexpectType<Xor<boolean, boolean>>(boolean);\n\n// Boundary cases\nexpectType<Xor<true, any>>(boolean);\nexpectType<Xor<any, true>>(boolean);\nexpectType<Xor<false, any>>(boolean);\nexpectType<Xor<any, false>>(boolean);\nexpectType<Xor<boolean, any>>(boolean);\nexpectType<Xor<any, boolean>>(boolean);\nexpectType<Xor<any, any>>(boolean);\n\nexpectType<Xor<true, never>>(true);\nexpectType<Xor<never, true>>(true);\nexpectType<Xor<false, never>>(false);\nexpectType<Xor<never, false>>(false);\nexpectType<Xor<boolean, never>>(boolean);\nexpectType<Xor<never, boolean>>(boolean);\nexpectType<Xor<never, never>>(false);\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n\t\"extends\": \"@sindresorhus/tsconfig\",\n\t\"compilerOptions\": {\n\t\t\"noEmit\": true,\n\t\t\"allowJs\": true,\n\t\t\"noUnusedLocals\": false, // Allow unused variables in test-d/*.ts files\n\t\t\"types\": [], // Ensures no @types/ are unintentionally included\n\t\t\"exactOptionalPropertyTypes\": true,\n\t\t\"skipLibCheck\": false, // Ensures .d.ts files are checked: https://github.com/sindresorhus/tsconfig/issues/15\n\t\t\"erasableSyntaxOnly\": false // We cannot do this as we need to be able to test enums.\n\t}\n}\n"
  },
  {
    "path": "xo.config.js",
    "content": "// @ts-check\nimport tseslint from 'typescript-eslint';\nimport {importPathRule} from './lint-rules/import-path.js';\nimport {sourceFilesExtensionRule} from './lint-rules/source-files-extension.js';\nimport {requireExportedTypesRule} from './lint-rules/require-exported-types.js';\nimport {requireExportRule} from './lint-rules/require-export.js';\nimport {validateJSDocCodeblocksRule} from './lint-rules/validate-jsdoc-codeblocks.js';\nimport {jsdocCodeblocksProcessor} from './lint-processors/jsdoc-codeblocks.js';\n\n/** @type {import('xo').FlatXoConfig} */\nconst xoConfig = [\n\t{\n\t\trules: {\n\t\t\t'@typescript-eslint/no-extraneous-class': 'off',\n\t\t\t'@typescript-eslint/ban-ts-comment': 'off',\n\t\t\t'@typescript-eslint/ban-types': 'off',\n\t\t\t'@typescript-eslint/naming-convention': 'off',\n\t\t\t'@typescript-eslint/no-redeclare': 'off',\n\t\t\t'@typescript-eslint/no-confusing-void-expression': 'off',\n\t\t\t'@typescript-eslint/no-unsafe-argument': 'off',\n\t\t\t'@typescript-eslint/no-restricted-types': 'off',\n\t\t\t'@typescript-eslint/no-empty-object-type': 'off',\n\t\t\t'@typescript-eslint/no-unsafe-function-type': 'off',\n\t\t\t'@typescript-eslint/no-deprecated': 'off',\n\t\t\t'@typescript-eslint/no-wrapper-object-types': 'off',\n\t\t\t'@typescript-eslint/consistent-indexed-object-style': 'off',\n\t\t\t'@typescript-eslint/unified-signatures': 'off', // Temp\n\t\t\t'@stylistic/quote-props': 'off',\n\t\t\t'@stylistic/function-paren-newline': 'off',\n\t\t\t'@stylistic/object-curly-newline': 'off',\n\t\t\t'n/file-extension-in-import': 'off',\n\t\t\t'object-curly-newline': [\n\t\t\t\t'error',\n\t\t\t\t{\n\t\t\t\t\tmultiline: true,\n\t\t\t\t\tconsistent: true,\n\t\t\t\t},\n\t\t\t],\n\t\t\t'import-x/consistent-type-specifier-style': [\n\t\t\t\t'error',\n\t\t\t\t'prefer-top-level',\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tfiles: 'source/**/*.d.ts',\n\t\trules: {\n\t\t\t'no-restricted-imports': [\n\t\t\t\t'error',\n\t\t\t\t{\n\t\t\t\t\tpaths: ['tsd', 'expect-type'],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tplugins: {\n\t\t\t'type-fest': {\n\t\t\t\trules: {\n\t\t\t\t\t'import-path': importPathRule,\n\t\t\t\t\t'source-files-extension': sourceFilesExtensionRule,\n\t\t\t\t\t'require-exported-types': requireExportedTypesRule,\n\t\t\t\t\t'require-export': requireExportRule,\n\t\t\t\t\t'validate-jsdoc-codeblocks': validateJSDocCodeblocksRule,\n\t\t\t\t},\n\t\t\t\tprocessors: {\n\t\t\t\t\t'jsdoc-codeblocks': jsdocCodeblocksProcessor,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tfiles: ['source/**/*.d.ts', 'test-d/**/*.ts', 'index.d.ts'],\n\t\trules: {\n\t\t\t'type-fest/import-path': 'error',\n\t\t},\n\t},\n\t{\n\t\tfiles: 'source/**/*',\n\t\trules: {\n\t\t\t'type-fest/source-files-extension': 'error',\n\t\t},\n\t},\n\t{\n\t\tfiles: 'source/**/*.d.ts',\n\t\tignores: ['source/internal/**/*.d.ts'],\n\t\trules: {\n\t\t\t'type-fest/require-exported-types': 'error',\n\t\t\t'type-fest/require-export': 'error',\n\t\t\t'type-fest/validate-jsdoc-codeblocks': 'error',\n\t\t},\n\t},\n\t// Register processor for all source `.d.ts` files\n\t{\n\t\tfiles: 'source/**/*.d.ts',\n\t\tprocessor: 'type-fest/jsdoc-codeblocks',\n\n\t},\n\t{\n\t\t// Virtual files created by the `jsdoc-codeblocks` processor\n\t\tfiles: 'source/**/*.d.ts/*.ts',\n\t\t...tseslint.configs.disableTypeChecked,\n\t},\n\t{\n\t\t// Virtual files created by the `jsdoc-codeblocks` processor\n\t\tfiles: 'source/**/*.d.ts/*.ts',\n\t\trules: {\n\t\t\t'type-fest/source-files-extension': 'off',\n\t\t\t'@stylistic/eol-last': 'off',\n\t\t\t'capitalized-comments': 'off',\n\t\t\t'unicorn/prefer-structured-clone': 'off',\n\t\t},\n\t},\n\t{\n\t\t// Virtual files created by the `jsdoc-codeblocks` processor\n\t\tfiles: ['source/is-float.d.ts/*.ts', 'source/is-integer.d.ts/*.ts', 'source/numeric.d.ts/*.ts'],\n\t\trules: {\n\t\t\t'unicorn/no-zero-fractions': 'off',\n\t\t},\n\t},\n\t{\n\t\t// Virtual files created by the `jsdoc-codeblocks` processor\n\t\tfiles: ['source/find-global-type.d.ts/*.ts', 'source/jsonify.d.ts/*.ts', 'source/simplify.d.ts/*.ts'],\n\t\trules: {\n\t\t\t'@typescript-eslint/consistent-type-definitions': 'off',\n\t\t},\n\t},\n\t{\n\t\tfiles: 'lint-rules/test-utils.js',\n\t\trules: {\n\t\t\t'no-irregular-whitespace': [\n\t\t\t\t'error',\n\t\t\t\t{\n\t\t\t\t\t'skipComments': true,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n];\n\nexport default xoConfig;\n"
  }
]