poetapp / node

The core of Po.et
https://docs.poetnetwork.net/
MIT License
192 stars 27 forks source link

refactor: Factories: API #925

Closed kennylavender closed 5 years ago

kennylavender commented 5 years ago

PR Process - PR Review Checklist

Release

Semantic release is enabled for this repository. Make sure you follow the right commit message convention. We're using semantic-release's default — Angular Commit Message Conventions.

Description of Changes

resolves #924

kennylavender commented 5 years ago

Having some issues with the file controller interface, will continue to work on it.

Type '(x?: ReadonlyArray<ReadStream>) => Promise<{}>' is not assignable to type '(fileStreams: ReadonlyArray<ReadStream>) => Promise<ReadonlyArray<{ hash: string; }>>'.
  Type 'Promise<{}>' is not assignable to type 'Promise<ReadonlyArray<{ hash: string; }>>'.
    Type '{}' is missing the following properties from type 'ReadonlyArray<{ hash: string; }>': length, concat, join, slice, and 17 more.ts(2322)
const addFiles: (fileStreams: ReadonlyArray<fs.ReadStream>) => Promise<ReadonlyArray<{
    hash: string;
}>>
kennylavender commented 5 years ago

Ok, think I've got the types figured out. TS was inferring some types incorrectly in handleFile, so I added manual typings. TS was also having issues with ramda's map, and it also had issues with Promise.all.bind(Promise) so I had to adjust those functions those things inside of addFiles