Skip to content

Update to [email protected] #17842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
"fbjs-scripts": "^0.8.3",
"filesize": "^3.5.6",
"flow-bin": "^0.84.0",
"flow-bin": "0.89",
"glob": "^6.0.4",
"glob-stream": "^6.1.0",
"google-closure-compiler": "20190301.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-cache/src/LRU.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function createLRU<T>(limit: number) {
}
}

function add(value: T, onDelete: () => mixed): Entry<T> {
function add(value: Object, onDelete: () => mixed): Entry<Object> {
const entry = {
value,
onDelete,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/client/ReactDOMHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ export const warnsIfNotActing = true;
// This initialization code may run even on server environments
// if a component just imports ReactDOM (e.g. for findDOMNode).
// Some environments might not have setTimeout or clearTimeout.
export const scheduleTimeout =
export const scheduleTimeout: any =
typeof setTimeout === 'function' ? setTimeout : (undefined: any);
export const cancelTimeout =
export const cancelTimeout: any =
typeof clearTimeout === 'function' ? clearTimeout : (undefined: any);
export const noTimeout = -1;

Expand Down
2 changes: 2 additions & 0 deletions packages/react-interactions/events/src/dom/PressLegacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ const pressResponderImpl = {

// Determine whether to call preventDefault on subsequent native events.
if (
target !== null &&
context.isTargetWithinResponder(target) &&
context.isTargetWithinHostComponent(target, 'a')
) {
Expand Down Expand Up @@ -808,6 +809,7 @@ const pressResponderImpl = {
if (
!isKeyboardEvent &&
pressTarget !== null &&
target !== null &&
!targetIsDocument(pressTarget)
) {
if (
Expand Down
16 changes: 8 additions & 8 deletions packages/react-native-renderer/src/ReactFabricHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,34 +436,34 @@ export function DEPRECATED_unmountResponderInstance(
throw new Error('Not yet implemented.');
}

export function getFundamentalComponentInstance(fundamentalInstance) {
export function getFundamentalComponentInstance(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function mountFundamentalComponent(fundamentalInstance) {
export function mountFundamentalComponent(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function shouldUpdateFundamentalComponent(fundamentalInstance) {
export function shouldUpdateFundamentalComponent(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function updateFundamentalComponent(fundamentalInstance) {
export function updateFundamentalComponent(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function unmountFundamentalComponent(fundamentalInstance) {
export function unmountFundamentalComponent(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function cloneFundamentalInstance(fundamentalInstance) {
export function cloneFundamentalInstance(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function getInstanceFromNode(node) {
export function getInstanceFromNode(node: any) {
throw new Error('Not yet implemented.');
}

export function beforeRemoveInstance(instance) {
export function beforeRemoveInstance(instance: any) {
// noop
}
14 changes: 7 additions & 7 deletions packages/react-native-renderer/src/ReactNativeHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,30 +493,30 @@ export function DEPRECATED_unmountResponderInstance(
throw new Error('Not yet implemented.');
}

export function getFundamentalComponentInstance(fundamentalInstance) {
export function getFundamentalComponentInstance(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function mountFundamentalComponent(fundamentalInstance) {
export function mountFundamentalComponent(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function shouldUpdateFundamentalComponent(fundamentalInstance) {
export function shouldUpdateFundamentalComponent(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function updateFundamentalComponent(fundamentalInstance) {
export function updateFundamentalComponent(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function unmountFundamentalComponent(fundamentalInstance) {
export function unmountFundamentalComponent(fundamentalInstance: any) {
throw new Error('Not yet implemented.');
}

export function getInstanceFromNode(node) {
export function getInstanceFromNode(node: any) {
throw new Error('Not yet implemented.');
}

export function beforeRemoveInstance(instance) {
export function beforeRemoveInstance(instance: any) {
// noop
}
6 changes: 4 additions & 2 deletions packages/react-test-renderer/src/ReactTestHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ export function DEPRECATED_unmountResponderInstance(
// noop
}

export function getFundamentalComponentInstance(fundamentalInstance): Instance {
export function getFundamentalComponentInstance(
fundamentalInstance: ReactFundamentalComponentInstance<any, any>,
): Instance {
const {impl, props, state} = fundamentalInstance;
return impl.getInstance(null, props, state);
}
Expand Down Expand Up @@ -370,6 +372,6 @@ export function getInstanceFromNode(mockNode: Object) {
return null;
}

export function beforeRemoveInstance(instance) {
export function beforeRemoveInstance(instance: any) {
// noop
}
50 changes: 29 additions & 21 deletions packages/react/src/ReactHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import {REACT_RESPONDER_TYPE} from 'shared/ReactSymbols';

import ReactCurrentDispatcher from './ReactCurrentDispatcher';

type BasicStateAction<S> = (S => S) | S;
type Dispatch<A> = A => void;

function resolveDispatcher() {
const dispatcher = ReactCurrentDispatcher.current;
invariant(
Expand Down Expand Up @@ -72,7 +75,9 @@ export function useContext<T>(
return dispatcher.useContext(Context, unstable_observedBits);
}

export function useState<S>(initialState: (() => S) | S) {
export function useState<S>(
initialState: (() => S) | S,
): [S, Dispatch<BasicStateAction<S>>] {
const dispatcher = resolveDispatcher();
return dispatcher.useState(initialState);
}
Expand All @@ -81,7 +86,7 @@ export function useReducer<S, I, A>(
reducer: (S, A) => S,
initialArg: I,
init?: I => S,
) {
): [S, Dispatch<A>] {
const dispatcher = resolveDispatcher();
return dispatcher.useReducer(reducer, initialArg, init);
}
Expand All @@ -93,46 +98,49 @@ export function useRef<T>(initialValue: T): {|current: T|} {

export function useEffect(
create: () => (() => void) | void,
inputs: Array<mixed> | void | null,
) {
deps: Array<mixed> | void | null,
): void {
const dispatcher = resolveDispatcher();
return dispatcher.useEffect(create, inputs);
return dispatcher.useEffect(create, deps);
}

export function useLayoutEffect(
create: () => (() => void) | void,
inputs: Array<mixed> | void | null,
) {
deps: Array<mixed> | void | null,
): void {
const dispatcher = resolveDispatcher();
return dispatcher.useLayoutEffect(create, inputs);
return dispatcher.useLayoutEffect(create, deps);
}

export function useCallback(
callback: () => mixed,
inputs: Array<mixed> | void | null,
) {
export function useCallback<T>(
callback: T,
deps: Array<mixed> | void | null,
): T {
const dispatcher = resolveDispatcher();
return dispatcher.useCallback(callback, inputs);
return dispatcher.useCallback(callback, deps);
}

export function useMemo(
create: () => mixed,
inputs: Array<mixed> | void | null,
) {
export function useMemo<T>(
create: () => T,
deps: Array<mixed> | void | null,
): T {
const dispatcher = resolveDispatcher();
return dispatcher.useMemo(create, inputs);
return dispatcher.useMemo(create, deps);
}

export function useImperativeHandle<T>(
ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
create: () => T,
inputs: Array<mixed> | void | null,
deps: Array<mixed> | void | null,
): void {
const dispatcher = resolveDispatcher();
return dispatcher.useImperativeHandle(ref, create, inputs);
return dispatcher.useImperativeHandle(ref, create, deps);
}

export function useDebugValue(value: any, formatterFn: ?(value: any) => any) {
export function useDebugValue<T>(
value: T,
formatterFn: ?(value: T) => mixed,
): void {
if (__DEV__) {
const dispatcher = resolveDispatcher();
return dispatcher.useDebugValue(value, formatterFn);
Expand Down
2 changes: 1 addition & 1 deletion scripts/flow/config/flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[version]
^0.84.0
^0.89.0
4 changes: 4 additions & 0 deletions scripts/flow/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{
inject: ?((stuff: Object) => void)
};*/

declare module 'create-react-class' {
declare var exports: React$CreateClass;
}

declare var trustedTypes: {|
isHTML: (value: any) => boolean,
isScript: (value: any) => boolean,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5725,10 +5725,10 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==

flow-bin@^0.84.0:
version "0.84.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.84.0.tgz#4cb2364c750fb37a7840524fa62456b53f64cdcb"
integrity sha512-ocji8eEYp+YfICsm+F6cIHUcD7v5sb0/ADEXm6gyUKdjQzmSckMrPUdZtyfP973t3YGHKliUMxMvIBHyR5LbXQ==
flow-bin@0.89:
version "0.89.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.89.0.tgz#6bd29c2af7e0f429797f820662f33749105c32fa"
integrity sha512-DkO4PsXYrl53V6G5+t5HbRMC5ajYUQej2LEGPUZ+j9okTb41Sn5j9vfxsCpXMEAslYnQoysHhYu4GUZsQX/DrQ==

[email protected]:
version "0.13.0"
Expand Down