Closed charles-allen closed 3 years ago
Thanks! This does seem like a good idea.
I think this is now handled by optional properties in IOptionsBase
If anyone is wondering how exactly to extend the phin type definitions to include the suggested additions in your project, you can do so as follows:
types/phin.d.ts
:
import phin, { IWithData, IWithForm } from 'phin';
declare module 'phin' {
export function defaults
2. Update `tsconfig.json` as follows:
```json
"compilerOptions": {
"typeRoots": [
"./types/"
],
}
defaults
like this:
import p from 'phin';
export const httpClient = p.defaults({ headers: { 'User-Agent': 'My App', }, });
There is a disclaimer in the types file:
I think perhaps
Partial<T>
is the piece of the puzzle you were missing? I tried to write a definition, but I'm not sure I understand the relation between JS source & TS types. Does this help? (might not be correct!)