|
123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { Semigroup } from './Semigroup'
- /**
- * Return a semigroup which works like `Object.assign`.
- *
- * @example
- * import { getAssignSemigroup } from 'fp-ts/struct'
- *
- * interface Person {
- * readonly name: string
- * readonly age: number
- * }
- *
- * const S = getAssignSemigroup<Person>()
- * assert.deepStrictEqual(S.concat({ name: 'name', age: 23 }, { name: 'name', age: 24 }), { name: 'name', age: 24 })
- *
- * @category instances
- * @since 2.10.0
- */
- export declare const getAssignSemigroup: <A extends object = never>() => Semigroup<A>
- /**
- * Creates a new object by recursively evolving a shallow copy of `a`, according to the `transformation` functions.
- *
- * @example
- * import { pipe } from 'fp-ts/function'
- * import { evolve } from 'fp-ts/struct'
- *
- * assert.deepStrictEqual(
- * pipe(
- * { a: 'a', b: 1 },
- * evolve({
- * a: (a) => a.length,
- * b: (b) => b * 2
- * })
- * ),
- * { a: 1, b: 2 }
- * )
- *
- * @since 2.11.0
- */
- export declare const evolve: <A, F extends { [K in keyof A]: (a: A[K]) => unknown }>(
- transformations: F
- ) => (a: A) => { [K_1 in keyof F]: ReturnType<F[K_1]> }
|