diff --git a/CHANGELOG.md b/CHANGELOG.md index e06aac18db..d1384bf1c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Fixes +- Remove dependency on Lodash in TypeScript typings @layershifter ([#2323](https://github.com/microsoft/fluent-ui-react/pull/2323)) + ## [v0.44.0](https://github.com/microsoft/fluent-ui-react/tree/v0.44.0) (2020-02-05) [Compare changes](https://github.com/microsoft/fluent-ui-react/compare/v0.43.2..v0.44.0) diff --git a/build/gulp/tasks/test-projects/typings/tsconfig.json b/build/gulp/tasks/test-projects/typings/tsconfig.json index 44589f338f..91273a3039 100644 --- a/build/gulp/tasks/test-projects/typings/tsconfig.json +++ b/build/gulp/tasks/test-projects/typings/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "jsx": "react", "lib": ["dom", "dom.iterable", "esnext"], - "target": "es5" + "target": "es5", + "strict": true }, "include": ["src"] } diff --git a/packages/react/src/components/Carousel/Carousel.tsx b/packages/react/src/components/Carousel/Carousel.tsx index e1838f85dd..1dcd952b6b 100644 --- a/packages/react/src/components/Carousel/Carousel.tsx +++ b/packages/react/src/components/Carousel/Carousel.tsx @@ -19,6 +19,7 @@ import { import { WithAsProp, withSafeTypeForAs, + DebounceResultFn, ShorthandCollection, ShorthandValue, ComponentEventHandler, @@ -216,7 +217,7 @@ class Carousel extends AutoControlledComponent, Carous itemRefs = [] as React.RefObject[] paddleNextRef = React.createRef() paddlePreviousRef = React.createRef() - focusItemAtIndex = _.debounce((index: number) => { + focusItemAtIndex: DebounceResultFn<(index: number) => void> = _.debounce((index: number) => { this.itemRefs[index].current.focus() }, 400) diff --git a/packages/react/src/components/Dropdown/Dropdown.tsx b/packages/react/src/components/Dropdown/Dropdown.tsx index 7f04a31599..cb36a7e1c9 100644 --- a/packages/react/src/components/Dropdown/Dropdown.tsx +++ b/packages/react/src/components/Dropdown/Dropdown.tsx @@ -7,6 +7,7 @@ import cx from 'classnames' import * as keyboardKey from 'keyboard-key' import { + DebounceResultFn, ShorthandRenderFunction, ShorthandValue, ComponentEventHandler, @@ -1371,11 +1372,11 @@ class Dropdown extends AutoControlledComponent, Dropdo this.clearStartingString() } - clearA11ySelectionMessage = _.debounce(() => { + clearA11ySelectionMessage: DebounceResultFn<() => void> = _.debounce(() => { this.setState({ a11ySelectionStatus: '' }) }, Dropdown.a11yStatusCleanupTime) - clearStartingString = _.debounce(() => { + clearStartingString: DebounceResultFn<() => void> = _.debounce(() => { this.setState({ startingString: '' }) }, Dropdown.charKeyPressedCleanupTime) } diff --git a/packages/react/src/types.ts b/packages/react/src/types.ts index 576f58259d..80d54da824 100644 --- a/packages/react/src/types.ts +++ b/packages/react/src/types.ts @@ -3,6 +3,13 @@ import * as React from 'react' import { ShorthandFactory } from './utils/factories' +// Temporary workaround for @lodash dependency + +export type DebounceResultFn = T & { + cancel: () => void + flush: () => void +} + // ======================================================== // Utilities // ======================================================== diff --git a/packages/react/src/utils/applyAccessibilityKeyHandlers.ts b/packages/react/src/utils/applyAccessibilityKeyHandlers.ts index 86129ecff2..35e7458cc9 100644 --- a/packages/react/src/utils/applyAccessibilityKeyHandlers.ts +++ b/packages/react/src/utils/applyAccessibilityKeyHandlers.ts @@ -9,7 +9,10 @@ import { Props, ShorthandValue } from '../types' const applyAccessibilityKeyHandlers = ( keyHandlers: AccessibilityHandlerProps, value: Props | ShorthandValue, -) => { +): Partial void +>> => { const valIsPropsObject = _.isPlainObject(value) const valIsReactElement = React.isValidElement(value)