Skip to content

TypeScript: Result.files and saveFiles() are typed as a single item #94

Description

@paulius-petkus

Result.files is declared as [ResultFile] and saveFiles() as Promise<[string]>. In TypeScript these are one-item tuples, not arrays, even though conversions can return several files.

Runtime works fine. The problem is compile-time only: TypeScript code like result.files[1], savedPaths[1] or result.files.length === 2 fails to build.

Fix: change both to plain arrays (ResultFile[] and Promise<string[]>).

This is a breaking change for TypeScript users, so release it as 2.0.0:

  • With noUncheckedIndexedAccess enabled, result.files[0].url will need a check (or use result.file).
  • Code that spells out the old [ResultFile] / [string] types needs updating.

JavaScript users are not affected.

Activity

  1. bighauscwb commented on Oct 8, 2026

    @bighauscwb

    Hm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions