remotestorage/remotestorage.js

apiKeys in setApiKeys has the wrong TS type

Silver-Golden opened this issue · 1 comments

setApiKeys (apiKeys: { type: string; key: string }): void | boolean {

Currently it is as above, which is the JSDoc format I believe.
However for typescript it could be better to repersent it as

interface ApiKeys {
  googledrive?: string;
  dropbox?: string;
}

setApiKeys (apiKeys: ApiKeys ): void | boolean { 
  // ...
}

In its current state the mismatch is causing me to use @ts-ignore

// current

// @ts-ignore
remoteStorage.setApiKeys({googledrive: 'key'});

// what TS expects based off the current types
remoteStorage.setApiKeys({type: 'googledrive', key: "key"});

Good catch! Your solution looks good to me. Want to open a PR with that?