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.
Result.filesis declared as[ResultFile]andsaveFiles()asPromise<[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]orresult.files.length === 2fails to build.Fix: change both to plain arrays (
ResultFile[]andPromise<string[]>).This is a breaking change for TypeScript users, so release it as 2.0.0:
noUncheckedIndexedAccessenabled,result.files[0].urlwill need a check (or useresult.file).[ResultFile]/[string]types needs updating.