Type for options for POST request not exported
jdforsythe opened this issue · comments
Jeremy Forsythe commented
The type used for POST requests is IWithData<phin.IOptions>
but the IWithData
is not exported in types.d.ts
so there's no way to construct a typed options object without making a custom type.
Also, there's a note in the types about using the generics to make JSON/Form posting mutually exclusive, but wouldn't this work just as well?
export interface IOptions extends IOptionsBase {
parse?: 'none'
}
interface WithData {
data: object;
}
interface WithForm {
form: {
[index: string]: string;
}
}
export type IOptionsWithData = IOptions & WithData;
export type IOptionsWithForm = IOptions & WithForm;
// etc
Ethan commented
Thanks for pointing that out. A PR would be appreciated!
Jeremy Forsythe commented