ts-essentials#DeepPartial TypeScript Examples
The following examples show how to use
ts-essentials#DeepPartial.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: records.ts From ts-di-starter with MIT License | 6 votes |
/**
* Get firestore configs
*
* @param {ServiceInterface} services
* @param {ConfigInterface} config
* @returns {{ firestoreConfig: FirestoreConfigInterface<Record>, cacheConfig: FirestoreCacheConfigInterface<Record> }}
*/
private static getFirestoreConfigs(
services: ServiceInterface,
config: ConfigInterface
): { firestoreConfig: FirestoreConfigInterface<Record>; cacheConfig: FirestoreCacheConfigInterface<Record> | undefined } {
return {
firestoreConfig: {
collection: Records.CONSTANTS.COLLECTION_NAME,
convertFromDb: (params): Record => new Record(params),
convertForDb: (instance: DeepPartial<Record>): any => instance,
},
cacheConfig: config.cacheTtlSec
? {
cacheTtlSec: config.cacheTtlSec,
parseFromCache: (stringified) => new Record(JSON.parse(stringified)),
stringifyForCache: (instance) => JSON.stringify(instance),
}
: undefined,
};
}