utility-types#DeepPartial TypeScript Examples

The following examples show how to use utility-types#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: config-utils.ts    From plasmic with MIT License 7 votes vote down vote up
/**
 * Given some partial configs for PlasmicConfig, fills in all required fields
 * with default values.
 */
export function fillDefaults(
  config: DeepPartial<PlasmicConfig>
): PlasmicConfig {
  return L.merge({}, DEFAULT_CONFIG, config);
}
Example #2
Source File: is-match.ts    From s-libs with MIT License 6 votes vote down vote up
/**
 * Performs a partial deep comparison between `object` and `source` to determine if `object` contains equivalent property values.
 *
 * *Note:* This method is equivalent to `matches` when source is partially applied.
 *
 * Partial comparisons will match empty array and empty object source values against any array or object value, respectively.
 *
 * Differences from lodash:
 * - does not match `0` to `-0`
 *
 * Contribution to minified bundle size, when it is the only function imported:
 * - Lodash: 11,471 bytes
 * - Micro-dash: 698 bytes
 */
export function isMatch<T>(object: T, source: DeepPartial<T>): boolean {
  return isEmpty(source) || isMatch0(object, source);
}