Skip to content

Commit

Permalink
update flow to 0.100
Browse files Browse the repository at this point in the history
  • Loading branch information
quantizor committed Nov 7, 2019
1 parent 3c9f3b1 commit 7b32b43
Show file tree
Hide file tree
Showing 92 changed files with 79 additions and 33 deletions.
3 changes: 0 additions & 3 deletions .flowconfig
Expand Up @@ -30,9 +30,6 @@
.*/integration-test/.*
.*/sandbox/.*

[libs]
packages/styled-components/flow-typed/

[options]
suppress_comment=.*\\$FlowFixMe
suppress_comment=.*\\$FlowInvalidInputTest
File renamed without changes.
Expand Up @@ -103,8 +103,8 @@ declare class express$Response extends http$ServerResponse mixins express$Reques

declare type express$NextFunction = (err?: ?Error | 'route') => mixed;
declare type express$Middleware =
((req: $Subtype<express$Request>, res: express$Response, next: express$NextFunction) => mixed) |
((error: Error, req: $Subtype<express$Request>, res: express$Response, next: express$NextFunction) => mixed);
((req: 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> {
(middleware: express$Middleware): T;
(...middleware: Array<express$Middleware>): T;
Expand Down Expand Up @@ -154,7 +154,7 @@ declare class express$Router extends express$Route {
param(
param: string,
callback: (
req: $Subtype<express$Request>,
req: express$Request,
res: express$Response,
next: express$NextFunction,
id: string
Expand Down
@@ -1,5 +1,5 @@
// flow-typed signature: 28023a2fc5b16f1b06322e5cfaa058ae
// flow-typed version: <<STUB>>/@babel/helper-module-imports_v^7.0.0/flow_v0.93.0
// flow-typed signature: 31eb46abbb940d1871cad5b72e2d5a1e
// flow-typed version: <<STUB>>/@babel/helper-module-imports_v^7.0.0/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
// flow-typed signature: 18bebea31f46f7fd38c7e73e7eee5c64
// flow-typed version: <<STUB>>/babel-plugin-styled-components_v>= 1/flow_v0.93.0
// flow-typed signature: 3631573e8a31615f5c06edf208a5d931
// flow-typed version: <<STUB>>/babel-plugin-styled-components_v>= 1/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
// flow-typed signature: c4d3b342af002be982eed9ef28b4c764
// flow-typed version: <<STUB>>/css-to-react-native_v^2.2.2/flow_v0.93.0
// flow-typed signature: e6263c15ef6789188b11afd5007f8d74
// flow-typed version: <<STUB>>/css-to-react-native_v^2.2.2/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -26,7 +26,7 @@ declare module 'prop-types' {
declare var shape: React$PropType$Shape;

declare function checkPropTypes<V>(
propTypes: $Subtype<{[_: $Keys<V>]: $npm$propTypes$ReactPropsCheckType}>,
propTypes: {[_: $Keys<V>]: $npm$propTypes$ReactPropsCheckType},
values: V,
location: string,
componentName: string,
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
// flow-typed signature: 1568ba57b8d3998628360b6bfbd8a4fd
// flow-typed version: <<STUB>>/react-frame-component_v^4.0.2/flow_v0.93.0
// flow-typed signature: 0533cf4c3dd8abb74d7bfc21895ecbf1
// flow-typed version: <<STUB>>/react-frame-component_v^4.0.2/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
Expand Down
@@ -1,5 +1,5 @@
// flow-typed signature: 320c42728e11557b0e081c05d7c7ca5a
// flow-typed version: <<STUB>>/react-is_v^16.8.0/flow_v0.93.0
// flow-typed signature: 3da1f41fe3c1eac4ec9566f7bebc64de
// flow-typed version: <<STUB>>/react-is_v>= 16.8.0/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
Expand Down
File renamed without changes.
@@ -1,5 +1,5 @@
// flow-typed signature: 4c6a09df60b4f4103206b2cb975f9a97
// flow-typed version: <<STUB>>/react-primitives_v^0.6.1/flow_v0.93.0
// flow-typed signature: 2f036fce35c841a66a3acc231ebe64c5
// flow-typed version: <<STUB>>/react-primitives_v^0.8.0/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
46 changes: 46 additions & 0 deletions flow-typed/npm/stylis-rtl_vx.x.x.js
@@ -0,0 +1,46 @@
// flow-typed signature: c2f55640f21684671437622668c77ece
// flow-typed version: <<STUB>>/stylis-rtl_v^1.0.1/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
*
* 'stylis-rtl'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'stylis-rtl' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'stylis-rtl/dist/stylis-rtl' {
declare module.exports: any;
}

declare module 'stylis-rtl/flow-typed/npm/flow-bin_v0.x.x' {
declare module.exports: any;
}

declare module 'stylis-rtl/flow-typed/npm/jest_v23.x.x' {
declare module.exports: any;
}

// Filename aliases
declare module 'stylis-rtl/dist/stylis-rtl.js' {
declare module.exports: $Exports<'stylis-rtl/dist/stylis-rtl'>;
}
declare module 'stylis-rtl/flow-typed/npm/flow-bin_v0.x.x.js' {
declare module.exports: $Exports<'stylis-rtl/flow-typed/npm/flow-bin_v0.x.x'>;
}
declare module 'stylis-rtl/flow-typed/npm/jest_v23.x.x.js' {
declare module.exports: $Exports<'stylis-rtl/flow-typed/npm/jest_v23.x.x'>;
}
@@ -1,5 +1,5 @@
// flow-typed signature: cd778a473db0eb2d14b70b56fa9dd858
// flow-typed version: <<STUB>>/stylis-rule-sheet_v^0.0.10/flow_v0.93.0
// flow-typed signature: 25a657cfecad14b46a99412c79f7d57d
// flow-typed version: <<STUB>>/stylis-rule-sheet_v^0.0.10/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
Expand Down
@@ -1,5 +1,5 @@
// flow-typed signature: 35d4eb9da83fea7e08b720bbb15abb46
// flow-typed version: <<STUB>>/stylis_v^3.5.0/flow_v0.93.0
// flow-typed signature: 8ad9fa0691948bf8ca06348d7e4dc447
// flow-typed version: <<STUB>>/stylis_v^3.5.0/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
Expand Down
@@ -1,5 +1,5 @@
// flow-typed signature: ccf9b2a0ffd1554319738597bb2401e4
// flow-typed version: <<STUB>>/supports-color_v^5.5.0/flow_v0.93.0
// flow-typed signature: a03f8da2c14979e1fd547f310e373abb
// flow-typed version: <<STUB>>/supports-color_v^5.5.0/flow_v0.100.0

/**
* This is an autogenerated libdef stub for:
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -50,7 +50,7 @@
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react-hooks": "^1.6.0",
"express": "^4.16.4",
"flow-bin": "^0.93.0",
"flow-bin": "^0.100.0",
"flow-watch": "^1.1.1",
"husky": "^1.1.3",
"jest": "^24.8.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/styled-components/package.json
Expand Up @@ -79,7 +79,7 @@
"react-is": ">= 16.8.0"
},
"devDependencies": {
"flow-bin": "^0.93.0",
"flow-bin": "^0.100.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-frame-component": "^4.0.2",
Expand Down
7 changes: 5 additions & 2 deletions packages/styled-components/src/models/ThemeProvider.js
Expand Up @@ -5,16 +5,18 @@ import isFunction from '../utils/isFunction';

export type Theme = { [key: string]: mixed };

type ThemeArgument = Theme | ((outerTheme?: Theme) => Theme);

type Props = {
children?: Element<any>,
theme: Theme | ((outerTheme: Theme) => void),
theme: ThemeArgument,
};

export const ThemeContext: Context<Theme | void> = React.createContext();

export const ThemeConsumer = ThemeContext.Consumer;

function useMergedTheme(theme: Theme | ((outerTheme?: Theme) => Theme), outerTheme?: Theme): Theme {
function useMergedTheme(theme: ThemeArgument, outerTheme?: Theme): Theme {
if (isFunction(theme)) {
const mergedTheme = theme(outerTheme);

Expand All @@ -40,6 +42,7 @@ function useMergedTheme(theme: Theme | ((outerTheme?: Theme) => Theme), outerThe
*/
export default function ThemeProvider(props: Props) {
const outerTheme = useContext(ThemeContext);

// NOTE: can't really memoize with props.theme as that'd cause incorrect memoization when it's a function
const themeContext = useMergedTheme(props.theme, outerTheme);

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -5170,10 +5170,10 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916"
integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg==

flow-bin@^0.93.0:
version "0.93.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.93.0.tgz#9192a08d88db2a8da0ff55e42420f44539791430"
integrity sha512-p8yq4ocOlpyJgOEBEj0v0GzCP25c9WP0ilFQ8hXSbrTR7RPKuR+Whr+OitlVyp8ocdX0j1MrIwQ8x28dacy1pg==
flow-bin@^0.100.0:
version "0.100.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.100.0.tgz#729902726658cfa0a81425d6401f9625cf9f5534"
integrity sha512-jcethhgrslBJukH7Z7883ohFFpzLrdsOEwHxvn5NwuTWbNaE71GAl55/PEBRJwYpDvYkRlqgcNkANTv0x5XjqA==

flow-remove-types@^1.1.0:
version "1.2.3"
Expand Down

0 comments on commit 7b32b43

Please sign in to comment.