We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6789fe2 commit 1262dbdCopy full SHA for 1262dbd
src/build/__tests__/resolveThunk-test.js
@@ -1,9 +1,9 @@
1
-/* eslint-env jest */
+/* @flow */
2
3
import resolveThunk from '../resolveThunk';
4
5
describe('resolveThunk()', () => {
6
- it('should work', () => {
+ test('works', () => {
7
expect(resolveThunk(true)).toBe(true);
8
expect(resolveThunk(() => true)).toBe(true);
9
});
src/build/resolveThunk.js
@@ -1,3 +1,7 @@
-export default function resolveThunk(thunk) {
+
+export type Thunk<T> = (() => T) | T;
+export default function resolveThunk<T>(thunk: Thunk<T>): T {
return typeof thunk === 'function' ? thunk() : thunk;
}
0 commit comments