Skip to content

Arrays typed as readonly aren't Passable #3060

@michaelfig

Description

@michaelfig

Describe the bug

ReadonlyArrays aren't Passable because they don't conform to CopyArrayInterface. CopyArrays are hardened, thus the mutating methods will always fail, and marking them as readonly only changes the typing to omit the mutating methods.

Steps to reproduce

  1. Create repro.ts with the following contents:
import type { Passable } from '@endo/pass-style';
export default ['ibc'] as Readonly<[string]> satisfies Passable;
  1. Load in IDE or compile with tsc, and see error:
Type 'readonly [string]' does not satisfy the expected type 'Passable'.
  Type 'readonly [string]' is not assignable to type 'CopyArrayInterface<PassableCap, Error>'.ts(1360)

Expected behavior

No error.

Platform environment

  • What OS are you using? macOS
  • What version of Node.js? v22.21.0
  • Is there anything special/unusual about your platform? not especially
  • What version of Endo are you using? @endo/import-bundle@1.5.2-303-g31f81e8ac`

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions