Reusable typescript typings
npm install @gilbarbara/types 
Reusable typescript typings.
``sh`
npm i @gilbarbara/types
For convenience, the type-fest package is re-exported.
`typescript
type NumberOrNull = number | null;
type StringOrNull = string | null;
type StringOrNumber = string | number;
type PlainObject
type GenericFunction
type VoidFunction = () => void;
`
`typescript
type AsyncStatus = 'IDLE' | 'PENDING' | 'SUCCESS' | 'ERROR';
interface AsyncFlow {
message: string;
status: AsyncStatus;
}
interface AsyncFlowWithCache extends AsyncFlow {
updatedAt: number;
}
interface AsyncFlowWithData
data: T;
}
interface AsyncFlowWithDataAndCache
updatedAt: number;
}
type HttpMethods =
| 'CONNECT'
| 'DELETE'
| 'GET'
| 'HEAD'
| 'OPTIONS'
| 'PATCH'
| 'POST'
| 'PUT';
interface IdName {
id: string;
name: string;
}
interface LabelValue {
label: string;
value: string;
}
`
`typescript`
/**
* Narrow down a Record to a plain object.
*/
type NarrowPlainObject
T,
Array
>;
`typescript`
/**
* An object without excluded types.
*/
type RemoveType
[Key in keyof TObject as TObject[Key] extends TExclude ? never : Key]: TObject[Key];
};
`typescript``
/**
* A strict plain object with a specific set of keys.
*/
type StrictObject
[Key in keyof TObject]: Key extends keyof TExpected ? TExpected[Key] : never;
};