Skip to content

[BUG] /// keep-sorted error with "as const satisfies ..." combination #45

@Soundvessel

Description

@Soundvessel

Describe the bug

Appears related to #25 but this is when satisfies is used with as const e,g. as const satisfies Record<string, Options>

The following produces the error on keep-sorted; [keep-sorted] error: Unable to find object/array/interface to sort

interface Option {
  id: number
  name: string
}

type Options = Record<string, Option>

/// keep-sorted
const options = {
  status: {
    on: {
      id: 1,
      name: 'On',
    },
    off: {
      id: 2,
      name: 'Off',
    },
  }
} as const satisfies Record<string, Options>

Reproduction

see above

System Info

System:
    OS: Linux 6.6 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
    CPU: (22) x64 Intel(R) Core(TM) Ultra 7 155H
    Memory: 5.66 GB / 15.35 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 24.12.0 - /home/matth/.local/share/mise/installs/node/24.12.0/bin/node
    Yarn: 4.9.4 - /usr/bin/yarn
    npm: 11.6.2 - /home/matth/.local/share/mise/installs/node/24.12.0/bin/npm

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions