kibana/packages/kbn-safer-lodash-set/test/fp_set.ts
Spencer 9003353729
rename @elastic/* packages to @kbn/* (#138957)
* rename @elastic/* packages to @kbn/*

* update yarn.lock

* [CI] Auto-commit changed files from 'node scripts/generate packages_build_manifest'

* update lint task

* review feedback

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-08-18 08:54:42 -07:00

25 lines
1,001 B
TypeScript

/*
* Elasticsearch B.V licenses this file to you under the MIT License.
* See `packages/kbn-safer-lodash-set/LICENSE` for more information.
*/
import { expectType } from 'tsd';
import set from '../fp/set';
const someObj: object = {};
const anyValue: any = 'any value';
expectType<object>(set('a.b.c', anyValue, someObj));
expectType<object>(set('a.b.c')(anyValue, someObj));
expectType<object>(set('a.b.c')(anyValue)(someObj));
expectType<object>(set('a.b.c', anyValue)(someObj));
expectType<object>(set(['a.b.c'], anyValue, someObj));
expectType<object>(set(['a.b.c'])(anyValue, someObj));
expectType<object>(set(['a.b.c'])(anyValue)(someObj));
expectType<object>(set(['a.b.c'], anyValue)(someObj));
expectType<object>(set(['a.b.c', 2, Symbol('hep')], anyValue, someObj));
expectType<object>(set(['a.b.c', 2, Symbol('hep')])(anyValue, someObj));
expectType<object>(set(['a.b.c', 2, Symbol('hep')])(anyValue)(someObj));
expectType<object>(set(['a.b.c', 2, Symbol('hep')], anyValue)(someObj));