-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap lodash functions to avoid exporting lodash type defs (#1723)
* Wrap lodash functions to avoid exporting lodash type defs * changelog
- Loading branch information
1 parent
b92fa19
commit a54ab16
Showing
4 changed files
with
50 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
import get from 'lodash/get'; | ||
import omit from 'lodash/omit'; | ||
import _get from 'lodash/get'; | ||
import _omit from 'lodash/omit'; | ||
|
||
export { get, omit }; | ||
// wrap the lodash functions to avoid having lodash's TS type definition from being | ||
// exported, which can conflict with the lodash namespace if other versions are used | ||
|
||
export const get = (object: {}, path: string[] | string, defaultValue?: any) => | ||
_get(object, path, defaultValue); | ||
|
||
export const omit = (object: {} | null | undefined, paths: string[]) => | ||
_omit(object, paths); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
import isFunction from 'lodash/isFunction'; | ||
import isArray from 'lodash/isArray'; | ||
import isString from 'lodash/isString'; | ||
import isBoolean from 'lodash/isBoolean'; | ||
import isNumber from 'lodash/isNumber'; | ||
import isNaN from 'lodash/isNaN'; | ||
import _isFunction from 'lodash/isFunction'; | ||
import _isArray from 'lodash/isArray'; | ||
import _isString from 'lodash/isString'; | ||
import _isBoolean from 'lodash/isBoolean'; | ||
import _isNumber from 'lodash/isNumber'; | ||
import _isNaN from 'lodash/isNaN'; | ||
|
||
export { isFunction, isArray, isString, isBoolean, isNumber, isNaN }; | ||
// wrap the lodash functions to avoid having lodash's TS type definition from being | ||
// exported, which can conflict with the lodash namespace if other versions are used | ||
|
||
// tslint:disable-next-line:ban-types | ||
export const isFunction = (value: any): value is Function => _isFunction(value); | ||
export const isArray = (value: any): value is any[] => _isArray(value); | ||
export const isString = (value: any): value is string => _isString(value); | ||
export const isBoolean = (value: any): value is boolean => _isBoolean(value); | ||
export const isNumber = (value: any): value is number => _isNumber(value); | ||
export const isNaN = (value: any) => _isNaN(value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters