kibana/packages/elastic-safer-lodash-set/test/fp_assoc.ts
Mikhail Shustov e9e0ca3782
Introduce TS incremental builds & move src/test_utils to TS project (#76082)
* move test_helpers to the core

* create base tsconfig

* all tsconfigs use the base one

* use test_helpers exposed from the src/core

* move getFieldFormatsRegistry to data plugin

* add test_utils project

* compile types after checkout

* add a stub for platform tsconfig.json

* fix broken import

* fix broken path to the base config

* set tsBuildInfoFile for project without outDir

* do not commit tsbuildinfo file

* do not check output d.ts files

* fix type error

* use separate config to build types

* rollback changes to include paths

* mute import zone error

* rename files to avoid references to tsd

* do not use tsd for type tests

* include all ts files in project

* run buildRefs before type check to ensure the latest version

* store tsbuildinfo locally

* update paths to base config

* comment out core/tsconfig.json

* remove ui path

* fix wrong tsbuildinfo path
2020-09-03 14:20:04 +02:00

26 lines
1 KiB
TypeScript

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