remove deprecated utilities

Summary: Remove `$Subtype` and `$Supertype` utilities. Replacement was done on a best-effort basis. In many cases it sufficed to replace `$Supertype<T>` and `$Subtype<T>` with `T`, but when this was not possible `any | T` and `any & T` were used instead.

Reviewed By: jbrown215

Differential Revision: D13624765

fbshipit-source-id: 82ee9d43cfc318ed4bd2d84e0f4c5c1d8f488a9c
This commit is contained in:
Daniel Sainati
2019-01-15 13:07:54 -08:00
committed by Facebook Github Bot
parent a254cef98d
commit 9b985b1338
5 changed files with 8 additions and 7 deletions

View File

@@ -104,8 +104,8 @@ declare class express$Response extends http$ServerResponse mixins express$Reques
declare type express$NextFunction = (err?: ?Error | 'route') => mixed; declare type express$NextFunction = (err?: ?Error | 'route') => mixed;
declare type express$Middleware = declare type express$Middleware =
((req: $Subtype<express$Request>, res: express$Response, next: express$NextFunction) => mixed) | ((req: express$Request, res: express$Response, next: express$NextFunction) => mixed) |
((error: Error, req: $Subtype<express$Request>, res: express$Response, next: express$NextFunction) => mixed); ((error: Error, req: express$Request, res: express$Response, next: express$NextFunction) => mixed);
declare interface express$RouteMethodType<T> { declare interface express$RouteMethodType<T> {
(middleware: express$Middleware): T; (middleware: express$Middleware): T;
(...middleware: Array<express$Middleware>): T; (...middleware: Array<express$Middleware>): T;
@@ -155,7 +155,7 @@ declare class express$Router extends express$Route {
param( param(
param: string, param: string,
callback: ( callback: (
req: $Subtype<express$Request>, req: express$Request,
res: express$Response, res: express$Response,
next: express$NextFunction, next: express$NextFunction,
id: string id: string

View File

@@ -1066,7 +1066,7 @@ declare module "lodash" {
): Object; ): Object;
at(object?: ?Object, ...paths: Array<string>): Array<any>; at(object?: ?Object, ...paths: Array<string>): Array<any>;
at(object?: ?Object, paths: Array<string>): Array<any>; at(object?: ?Object, paths: Array<string>): Array<any>;
create<T>(prototype: T, properties: Object): $Supertype<T>; create<T>(prototype: T, properties: Object): T;
create(prototype: any, properties: void | null): {}; create(prototype: any, properties: void | null): {};
defaults(object?: ?Object, ...sources?: Array<?Object>): Object; defaults(object?: ?Object, ...sources?: Array<?Object>): Object;
defaultsDeep(object?: ?Object, ...sources?: Array<?Object>): Object; defaultsDeep(object?: ?Object, ...sources?: Array<?Object>): Object;
@@ -2725,7 +2725,7 @@ declare module "lodash/fp" {
props(paths: Array<string>, object: Object): Array<any>; props(paths: Array<string>, object: Object): Array<any>;
paths(paths: Array<string>): (object: Object) => Array<any>; paths(paths: Array<string>): (object: Object) => Array<any>;
paths(paths: Array<string>, object: Object): Array<any>; paths(paths: Array<string>, object: Object): Array<any>;
create<T>(prototype: T): $Supertype<T>; create<T>(prototype: T): T;
defaults(source: Object): (object: Object) => Object; defaults(source: Object): (object: Object) => Object;
defaults(source: Object, object: Object): Object; defaults(source: Object, object: Object): Object;
defaultsAll(objects: Array<Object>): Object; defaultsAll(objects: Array<Object>): Object;

View File

@@ -25,7 +25,7 @@ declare module 'prop-types' {
declare var shape: React$PropType$Shape; declare var shape: React$PropType$Shape;
declare function checkPropTypes<V>( declare function checkPropTypes<V>(
propTypes: $Subtype<{[_: $Keys<V>]: $npm$propTypes$ReactPropsCheckType}>, propTypes: {[_: $Keys<V>]: $npm$propTypes$ReactPropsCheckType},
values: V, values: V,
location: string, location: string,
componentName: string, componentName: string,

View File

@@ -12,7 +12,7 @@ declare module 'redux' {
*/ */
declare export type DispatchAPI<A> = (action: A) => A; declare export type DispatchAPI<A> = (action: A) => A;
declare export type Dispatch<A: { type: $Subtype<string> }> = DispatchAPI<A>; declare export type Dispatch<A: { type: string }> = DispatchAPI<A>;
declare export type MiddlewareAPI<S, A, D = Dispatch<A>> = { declare export type MiddlewareAPI<S, A, D = Dispatch<A>> = {
dispatch: D; dispatch: D;

View File

@@ -36,6 +36,7 @@ import type {
} from './plugins.js'; } from './plugins.js';
import type {Store as ReduxStore} from 'redux'; import type {Store as ReduxStore} from 'redux';
// $FlowFixMe introduced when removing $Subtype/$Supertype
export type Store = ReduxStore< export type Store = ReduxStore<
{| {|
application: ApplicationState, application: ApplicationState,