oauth-1.0a icon indicating copy to clipboard operation
oauth-1.0a copied to clipboard

Index signature missing for OAuth.Header (typescript)

Open mskd12 opened this issue 5 years ago • 1 comments

Hi,

I am using the output of toHeader in the fetch API and I see the following error:

error TS2322: Type 'Header' is not assignable to type 'Record<string, string> | Headers | string[][] | undefined'.
      Type 'Header' is not assignable to type 'Record<string, string>'.
        Index signature is missing in type 'Header'.

    136             headers: this.client.toHeader(body)

Any thoughts on how to fix it?

mskd12 avatar Aug 06 '20 21:08 mskd12

This seems to be an odd behavior with Typescript, Data, Header & Authorization interfaces need to be declared as a type instead of an interface. For now you can use headers: this.client.toHeader(body) as Record<string, string> while it's solved at library level.

ejose19 avatar Jun 28 '21 22:06 ejose19