Skip to content

Type Result.files and saveFiles() as arrays - #95

Open
paulius-petkus wants to merge 1 commit into
masterfrom
bugfix/result-files-typing
Open

paulius-petkus wants to merge 1 commit into
masterfrom
bugfix/result-files-typing

Conversation

@paulius-petkus

Copy link
Copy Markdown
Collaborator

Task

#94

What is done

  • Result.files typed as ResultFile[] (was [ResultFile])
  • saveFiles() typed as Promise<string[]> (was Promise<[string]>)

[ResultFile] is a TypeScript tuple with a fixed size of 1, so TypeScript treated every result as having exactly one file. That is wrong for conversions that return several files. Runtime is unchanged; this only affects TypeScript compilation.

TypeScript code Before Now
files[1], saved[1], const [a, b] = files build error works
files.length === 2 build error works
files[0], loops, saveFiles(), result.file works works
files[0].url with noUncheckedIndexedAccess works needs a check, like any array
Code that spells out [ResultFile] / [string] works needs updating to arrays

The last two rows are breaking for some TypeScript users, so this should be released as 2.0.0. JavaScript users are not affected.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 07:54
@paulius-petkus paulius-petkus self-assigned this Oct 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants