mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* 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>
37 lines
1,011 B
TypeScript
37 lines
1,011 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, setWith } from '..';
|
|
|
|
const someObj: object = {};
|
|
const anyValue: any = 'any value';
|
|
|
|
expectType<object>(set(someObj, 'a.b.c', anyValue));
|
|
expectType<object>(
|
|
setWith(someObj, 'a.b.c', anyValue, (value, key, obj) => {
|
|
expectType<any>(value);
|
|
expectType<string>(key);
|
|
expectType<object>(obj);
|
|
})
|
|
);
|
|
|
|
expectType<object>(set(someObj, ['a.b.c'], anyValue));
|
|
expectType<object>(
|
|
setWith(someObj, ['a.b.c'], anyValue, (value, key, obj) => {
|
|
expectType<any>(value);
|
|
expectType<string>(key);
|
|
expectType<object>(obj);
|
|
})
|
|
);
|
|
|
|
expectType<object>(set(someObj, ['a.b.c', 2, Symbol('hep')], anyValue));
|
|
expectType<object>(
|
|
setWith(someObj, ['a.b.c', 2, Symbol('hep')], anyValue, (value, key, obj) => {
|
|
expectType<any>(value);
|
|
expectType<string>(key);
|
|
expectType<object>(obj);
|
|
})
|
|
);
|