From 4e581dbe5e7852c427e29111e862f505a8365f1d Mon Sep 17 00:00:00 2001 From: akameco Date: Wed, 6 Mar 2019 00:55:13 +0900 Subject: [PATCH 01/25] refactor(typescript): components --- .eslintrc | 3 +- app/components/A/{example.js => example.tsx} | 1 - app/components/A/{index.js => index.tsx} | 2 - .../A/tests/{index.test.js => index.test.tsx} | 22 +++---- .../AutoLockScroll/{index.js => index.tsx} | 12 ++-- app/components/Avater/{index.js => index.tsx} | 14 ++--- .../Box/{BoxFooter.js => BoxFooter.tsx} | 9 +-- .../Box/{boxStyles.js => boxStyles.tsx} | 2 - app/components/Box/{index.js => index.tsx} | 31 +++++----- ...xHeaderWrapper.js => BoxHeaderWrapper.tsx} | 2 - .../BoxHeader/{Caption.js => Caption.tsx} | 6 +- .../BoxHeader/{Title.js => Title.tsx} | 2 +- .../BoxHeader/{index.js => index.tsx} | 53 +++++++++-------- .../{index.example.js => index.example.tsx} | 2 - app/components/Chip/{index.js => index.tsx} | 14 ++--- .../ColumnBody/{index.js => index.tsx} | 9 +-- .../{HeaderPopover.js => HeaderPopover.tsx} | 8 +-- .../ColumnHeader/{index.js => index.tsx} | 22 +++---- .../ColumnHeader/{styles.js => styles.tsx} | 4 -- .../{index.js => index.tsx} | 24 ++++---- .../{messages.js => messages.tsx} | 1 - .../ColumnLoading/{index.js => index.tsx} | 7 ++- .../ColumnRoot/{index.js => index.tsx} | 7 +-- .../{DrawerWrapper.js => DrawerWrapper.tsx} | 2 - .../{StyledDrawer.js => StyledDrawer.tsx} | 2 - app/components/Drawer/{index.js => index.tsx} | 29 +++++----- app/components/Dropdown/{Item.js => Item.tsx} | 8 +-- .../Dropdown/{index.js => index.tsx} | 9 ++- .../Dropdown/{messages.js => messages.tsx} | 1 - .../Dropdown/{styles.js => styles.tsx} | 3 - .../Icons/{DeleteIcon.js => DeleteIcon.tsx} | 3 +- .../Icons/{IconBase.js => IconBase.tsx} | 57 ++++++++----------- .../IllustList/{index.js => index.tsx} | 22 +++---- .../IllustList/{styles.js => styles.tsx} | 1 - .../LoadMore/{index.js => index.tsx} | 21 +++---- .../{LoadingWrapper.js => LoadingWrapper.tsx} | 2 - app/components/Loading/{Rect.js => Rect.tsx} | 3 - .../Loading/{Spinner.js => Spinner.tsx} | 2 - .../{index.example.js => index.example.tsx} | 1 - .../Loading/{index.js => index.tsx} | 7 +-- .../tests/{Rect.test.js => Rect.test.tsx} | 2 - .../{ErrorNotify.js => ErrorNotify.tsx} | 1 - .../LoginModal/{Feild.js => Feild.tsx} | 2 - .../LoginModal/{Input.js => Input.tsx} | 2 - .../LoginModal/{Loading.js => Loading.tsx} | 1 - .../{LoginButton.js => LoginButton.tsx} | 5 +- .../LoginModal/{Submit.js => Submit.tsx} | 2 - .../LoginModal/{index.js => index.tsx} | 37 ++++++------ .../LoginModal/{messages.js => messages.tsx} | 1 - .../MainView/{index.js => index.tsx} | 2 - .../Overlay/{Overlay.js => Overlay.tsx} | 16 +++--- .../{StyledOverlay.js => StyledOverlay.tsx} | 3 - .../Overlay/{index.js => index.tsx} | 1 - .../Profile/{index.js => index.tsx} | 10 +--- .../{HeaderButton.js => HeaderButton.tsx} | 15 +++-- .../Sidebar/{index.js => index.tsx} | 32 +++++------ .../Sidebar/{styles.js => styles.tsx} | 2 - app/components/Tag/{index.js => index.tsx} | 8 +-- app/components/Tag/{styles.js => styles.tsx} | 1 - .../TextAutoLink/{index.js => index.tsx} | 5 +- .../TwitterButton/{index.js => index.tsx} | 1 - .../TwitterButton/{styles.js => styles.tsx} | 1 - .../{DrawerHeader.js => DrawerHeader.tsx} | 9 +-- .../{Navigation.js => Navigation.tsx} | 12 ++-- .../UserDrawer/{index.js => index.tsx} | 28 ++++----- .../UserDrawer/{messages.js => messages.tsx} | 1 - .../{ImageWrap.js => ImageWrap.tsx} | 2 - .../UserPopover/{Top.js => Top.tsx} | 2 - .../UserPopover/{TopRight.js => TopRight.tsx} | 2 - .../UserPopover/{Wrap.js => Wrap.tsx} | 2 - .../UserPopover/{index.js => index.tsx} | 17 +++--- .../common/{Button.js => Button.tsx} | 46 +++++++-------- .../{CloseButton.js => CloseButton.tsx} | 10 ++-- app/components/common/{Icon.js => Icon.tsx} | 53 ++++++++++------- package.json | 12 ++-- tsconfig.json | 6 ++ yarn.lock | 55 +++++++++++------- 77 files changed, 374 insertions(+), 463 deletions(-) rename app/components/A/{example.js => example.tsx} (96%) rename app/components/A/{index.js => index.tsx} (95%) rename app/components/A/tests/{index.test.js => index.test.tsx} (78%) rename app/components/AutoLockScroll/{index.js => index.tsx} (90%) rename app/components/Avater/{index.js => index.tsx} (78%) rename app/components/Box/{BoxFooter.js => BoxFooter.tsx} (86%) rename app/components/Box/{boxStyles.js => boxStyles.tsx} (95%) rename app/components/Box/{index.js => index.tsx} (69%) rename app/components/BoxHeader/{BoxHeaderWrapper.js => BoxHeaderWrapper.tsx} (95%) rename app/components/BoxHeader/{Caption.js => Caption.tsx} (91%) rename app/components/BoxHeader/{Title.js => Title.tsx} (97%) rename app/components/BoxHeader/{index.js => index.tsx} (85%) rename app/components/Chip/{index.example.js => index.example.tsx} (98%) rename app/components/Chip/{index.js => index.tsx} (92%) rename app/components/ColumnBody/{index.js => index.tsx} (87%) rename app/components/ColumnHeader/{HeaderPopover.js => HeaderPopover.tsx} (91%) rename app/components/ColumnHeader/{index.js => index.tsx} (83%) rename app/components/ColumnHeader/{styles.js => styles.tsx} (98%) rename app/components/ColumnHeaderBookmark/{index.js => index.tsx} (80%) rename app/components/ColumnHeaderBookmark/{messages.js => messages.tsx} (93%) rename app/components/ColumnLoading/{index.js => index.tsx} (80%) rename app/components/ColumnRoot/{index.js => index.tsx} (89%) rename app/components/Drawer/{DrawerWrapper.js => DrawerWrapper.tsx} (96%) rename app/components/Drawer/{StyledDrawer.js => StyledDrawer.tsx} (98%) rename app/components/Drawer/{index.js => index.tsx} (69%) rename app/components/Dropdown/{Item.js => Item.tsx} (83%) rename app/components/Dropdown/{index.js => index.tsx} (87%) rename app/components/Dropdown/{messages.js => messages.tsx} (93%) rename app/components/Dropdown/{styles.js => styles.tsx} (97%) rename app/components/Icons/{DeleteIcon.js => DeleteIcon.tsx} (85%) rename app/components/Icons/{IconBase.js => IconBase.tsx} (71%) rename app/components/IllustList/{index.js => index.tsx} (85%) rename app/components/IllustList/{styles.js => styles.tsx} (98%) rename app/components/LoadMore/{index.js => index.tsx} (76%) rename app/components/Loading/{LoadingWrapper.js => LoadingWrapper.tsx} (96%) rename app/components/Loading/{Rect.js => Rect.tsx} (97%) rename app/components/Loading/{Spinner.js => Spinner.tsx} (94%) rename app/components/Loading/{index.example.js => index.example.tsx} (95%) rename app/components/Loading/{index.js => index.tsx} (88%) rename app/components/Loading/tests/{Rect.test.js => Rect.test.tsx} (95%) rename app/components/LoginModal/{ErrorNotify.js => ErrorNotify.tsx} (98%) rename app/components/LoginModal/{Feild.js => Feild.tsx} (94%) rename app/components/LoginModal/{Input.js => Input.tsx} (96%) rename app/components/LoginModal/{Loading.js => Loading.tsx} (98%) rename app/components/LoginModal/{LoginButton.js => LoginButton.tsx} (86%) rename app/components/LoginModal/{Submit.js => Submit.tsx} (97%) rename app/components/LoginModal/{index.js => index.tsx} (78%) rename app/components/LoginModal/{messages.js => messages.tsx} (97%) rename app/components/MainView/{index.js => index.tsx} (96%) rename app/components/Overlay/{Overlay.js => Overlay.tsx} (67%) rename app/components/Overlay/{StyledOverlay.js => StyledOverlay.tsx} (98%) rename app/components/Overlay/{index.js => index.tsx} (86%) rename app/components/Profile/{index.js => index.tsx} (91%) rename app/components/Sidebar/{HeaderButton.js => HeaderButton.tsx} (74%) rename app/components/Sidebar/{index.js => index.tsx} (78%) rename app/components/Sidebar/{styles.js => styles.tsx} (97%) rename app/components/Tag/{index.js => index.tsx} (72%) rename app/components/Tag/{styles.js => styles.tsx} (94%) rename app/components/TextAutoLink/{index.js => index.tsx} (86%) rename app/components/TwitterButton/{index.js => index.tsx} (96%) rename app/components/TwitterButton/{styles.js => styles.tsx} (90%) rename app/components/UserDrawer/{DrawerHeader.js => DrawerHeader.tsx} (88%) rename app/components/UserDrawer/{Navigation.js => Navigation.tsx} (90%) rename app/components/UserDrawer/{index.js => index.tsx} (79%) rename app/components/UserDrawer/{messages.js => messages.tsx} (95%) rename app/components/UserPopover/{ImageWrap.js => ImageWrap.tsx} (93%) rename app/components/UserPopover/{Top.js => Top.tsx} (94%) rename app/components/UserPopover/{TopRight.js => TopRight.tsx} (93%) rename app/components/UserPopover/{Wrap.js => Wrap.tsx} (92%) rename app/components/UserPopover/{index.js => index.tsx} (81%) rename app/components/common/{Button.js => Button.tsx} (76%) rename app/components/common/{CloseButton.js => CloseButton.tsx} (85%) rename app/components/common/{Icon.js => Icon.tsx} (89%) create mode 100644 tsconfig.json diff --git a/.eslintrc b/.eslintrc index 5e3b188d..26f3d55f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,7 +1,6 @@ { "extends": [ - "precure/oss", - "precure/react" + "precure/auto" ], "env": { "node": true, diff --git a/app/components/A/example.js b/app/components/A/example.tsx similarity index 96% rename from app/components/A/example.js rename to app/components/A/example.tsx index 1268713f..dc6e2b02 100644 --- a/app/components/A/example.js +++ b/app/components/A/example.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import { storiesOf } from '@storybook/react' import A from '.' diff --git a/app/components/A/index.js b/app/components/A/index.tsx similarity index 95% rename from app/components/A/index.js rename to app/components/A/index.tsx index fffee13c..39e075cf 100644 --- a/app/components/A/index.js +++ b/app/components/A/index.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' import { key } from 'styles/styleTheme' @@ -10,5 +9,4 @@ const A = styled.a` text-decoration: underline; } ` - export default A diff --git a/app/components/A/tests/index.test.js b/app/components/A/tests/index.test.tsx similarity index 78% rename from app/components/A/tests/index.test.js rename to app/components/A/tests/index.test.tsx index cb04d129..a86b93be 100644 --- a/app/components/A/tests/index.test.js +++ b/app/components/A/tests/index.test.tsx @@ -1,9 +1,7 @@ -// @flow import * as React from 'react' -import { mount } from 'enzyme' -// eslint-disable-next-line import/no-unassigned-import -import 'jest-styled-components' +import { mount } from 'enzyme' // eslint-disable-next-line import/no-unassigned-import +import 'jest-styled-components' import A from '..' const href = 'https://akameco.github.io' @@ -20,26 +18,28 @@ test('have an href attribute', () => { const c = renderComponent() expect(c.prop('href')).toStrictEqual(href) }) - test('have children', () => { const c = renderComponent() expect(c.contains(children)).toStrictEqual(true) }) - test('have a className attribute', () => { const className = 'test' - const c = renderComponent({ className }) + const c = renderComponent({ + className, + }) expect(c.find('a').hasClass(className)).toStrictEqual(true) }) - test('adopt a target', () => { const target = '_blank' - const c = renderComponent({ target }) + const c = renderComponent({ + target, + }) expect(c.prop('target')).toStrictEqual(target) }) - test('adopt a type attribute', () => { const type = 'text/html' - const c = renderComponent({ type }) + const c = renderComponent({ + type, + }) expect(c.prop('type')).toStrictEqual(type) }) diff --git a/app/components/AutoLockScroll/index.js b/app/components/AutoLockScroll/index.tsx similarity index 90% rename from app/components/AutoLockScroll/index.js rename to app/components/AutoLockScroll/index.tsx index a3f4c895..91e89133 100644 --- a/app/components/AutoLockScroll/index.js +++ b/app/components/AutoLockScroll/index.tsx @@ -1,11 +1,9 @@ -// @flow import * as React from 'react' -type Props = { - lock: boolean, +interface Props { + lock: boolean } - -let lockingCounter: number = 1 +let lockingCounter = 1 let originalBodyOverflow = null function getElementBody() { @@ -43,7 +41,6 @@ class AutoLockScroll extends React.Component { } lockingCounter += 1 - this.locked = true if (lockingCounter === 1) { @@ -64,9 +61,8 @@ class AutoLockScroll extends React.Component { body.style.overflow = originalBodyOverflow || '' originalBodyOverflow = null } - } + } // eslint-disable-next-line class-methods-use-this - // eslint-disable-next-line class-methods-use-this render() { return null } diff --git a/app/components/Avater/index.js b/app/components/Avater/index.tsx similarity index 78% rename from app/components/Avater/index.js rename to app/components/Avater/index.tsx index 63570c68..e43eaa40 100644 --- a/app/components/Avater/index.js +++ b/app/components/Avater/index.tsx @@ -1,15 +1,13 @@ -// @flow import styled from 'styled-components' import * as React from 'react' -type Props = { - size: number, - src: string, - style?: Object, - className?: string, - color?: string, +interface Props { + size: number + src: string + style?: object + className?: string + color?: string } - const StyledAvater = styled.img` user-select: none; display: inline-flex; diff --git a/app/components/Box/BoxFooter.js b/app/components/Box/BoxFooter.tsx similarity index 86% rename from app/components/Box/BoxFooter.js rename to app/components/Box/BoxFooter.tsx index f42aabae..9fb8ab20 100644 --- a/app/components/Box/BoxFooter.js +++ b/app/components/Box/BoxFooter.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import { union } from 'lodash' import styled from 'styled-components' @@ -15,12 +14,10 @@ const FooterWrapper = styled.div` display: none; } ` - -type Props = { - onClickTag: (tag: string) => void, - tags: Array, +interface Props { + onClickTag: (tag: string) => undefined + tags: string[] } - export default function BoxFooter(props: Props) { const Tags = union(props.tags).map(item => ( diff --git a/app/components/Box/boxStyles.js b/app/components/Box/boxStyles.tsx similarity index 95% rename from app/components/Box/boxStyles.js rename to app/components/Box/boxStyles.tsx index 54ff1865..a15a51d8 100644 --- a/app/components/Box/boxStyles.js +++ b/app/components/Box/boxStyles.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' import { key } from 'styles/styleTheme' @@ -7,5 +6,4 @@ const Wrapper = styled.div` border-bottom: 1px solid #292f33; overflow-x: hidden; ` - export default Wrapper diff --git a/app/components/Box/index.js b/app/components/Box/index.tsx similarity index 69% rename from app/components/Box/index.js rename to app/components/Box/index.tsx index 878f166e..63aad885 100644 --- a/app/components/Box/index.js +++ b/app/components/Box/index.tsx @@ -1,22 +1,21 @@ -// @flow import * as React from 'react' -import type { User } from 'types/user' -import type { Illust } from 'types/illust' +import { User } from 'types/user' +import { Illust } from 'types/illust' import BoxHeader from 'components/BoxHeader' import LazyLoadImg from 'components/LazyLoadImg' import BoxFooter from './BoxFooter' import BoxWrapper from './boxStyles' -export type Props = { - id: number | string, - illust: Illust, - user: User, - isIllustOnly: boolean, - isShowCaption: boolean, - onClick: (type: 'illust' | 'manga') => void, - onClickUser: (userId: number) => void, - onClickTag: (tag: string) => void, - onContextMenu: (event: Event) => void, +export interface Props { + id: number | string + illust: Illust + user: User + isIllustOnly: boolean + isShowCaption: boolean + onClick: (type: 'illust' | 'manga') => undefined + onClickUser: (userId: number) => undefined + onClickTag: (tag: string) => undefined + onContextMenu: (event: Event) => undefined } function Box(props: Props) { @@ -30,14 +29,10 @@ function Box(props: Props) { isIllustOnly, isShowCaption, onContextMenu, - } = props - - // const { isIntersecting, isHidden } = this.state + } = props // const { isIntersecting, isHidden } = this.state const tags = illust.tags.map(x => x.name) - const isManga = illust.pageCount > 1 - return ( {!isIllustOnly && ( diff --git a/app/components/BoxHeader/BoxHeaderWrapper.js b/app/components/BoxHeader/BoxHeaderWrapper.tsx similarity index 95% rename from app/components/BoxHeader/BoxHeaderWrapper.js rename to app/components/BoxHeader/BoxHeaderWrapper.tsx index ae451454..20cbf308 100644 --- a/app/components/BoxHeader/BoxHeaderWrapper.js +++ b/app/components/BoxHeader/BoxHeaderWrapper.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' const Wrapper = styled.div` @@ -8,5 +7,4 @@ const Wrapper = styled.div` display: flex; justify-content: space-between; ` - export default Wrapper diff --git a/app/components/BoxHeader/Caption.js b/app/components/BoxHeader/Caption.tsx similarity index 91% rename from app/components/BoxHeader/Caption.js rename to app/components/BoxHeader/Caption.tsx index 51acff9f..9c5c5365 100644 --- a/app/components/BoxHeader/Caption.js +++ b/app/components/BoxHeader/Caption.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import TextAutoLink from 'components/TextAutoLink' @@ -15,9 +14,8 @@ const Wrapper = styled.div` color: #51769f; } ` - -type Props = { - caption: string, +interface Props { + caption: string } const Caption = ({ caption }: Props) => ( diff --git a/app/components/BoxHeader/Title.js b/app/components/BoxHeader/Title.tsx similarity index 97% rename from app/components/BoxHeader/Title.js rename to app/components/BoxHeader/Title.tsx index c6bab3bc..b5763578 100644 --- a/app/components/BoxHeader/Title.js +++ b/app/components/BoxHeader/Title.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' @@ -9,6 +8,7 @@ const TitleWrapper = styled.div` font-size: 1rem; margin: 0; ` + const Title = ({ title }: { title: string }) => ( {title} ) diff --git a/app/components/BoxHeader/index.js b/app/components/BoxHeader/index.tsx similarity index 85% rename from app/components/BoxHeader/index.js rename to app/components/BoxHeader/index.tsx index 9a7983ef..1a23f29a 100644 --- a/app/components/BoxHeader/index.js +++ b/app/components/BoxHeader/index.tsx @@ -1,9 +1,8 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import Popover from 'material-ui/Popover' -import type { User } from 'types/user' -import type { Illust } from 'types/illust' +import { User } from 'types/user' +import { Illust } from 'types/illust' import Avater from 'components/Avater' import BookmarkButton from 'containers/BookmarkButton' import UserPopover from 'containers/UserPopoverContainer' @@ -16,48 +15,42 @@ const AvaterWrapper = styled.div` margin: 5px; cursor: pointer; ` - const ProfileWrapper = styled.div` position: relative; width: calc(100% - 56px); ` - -type Props = { - user: User, - illust: Illust, - onClick: () => void, - isShowCaption: boolean, +interface Props { + user: User + illust: Illust + onClick: () => undefined + isShowCaption: boolean } - -type State = { - open: boolean, - focus: boolean, - anchorEl: ?EventTarget, +interface State { + open: boolean + focus: boolean + anchorEl: EventTarget | null | undefined } - export default class BoxHeader extends React.Component { - delayTimer: ?TimeoutID + delayTimer: TimeoutID | null | undefined state: State = { open: false, focus: false, anchorEl: null, } - handleMouseEnter = (event: Event) => { event.preventDefault() this.delaySetPopup(true, 0.2) - this.setState({ anchorEl: event.target }) + this.setState({ + anchorEl: event.target, + }) } - handlePopoverEnter = () => { this.setPopupVisible(true) } - handleMouseLeave = (event: MouseEvent) => { event.preventDefault() this.setPopupVisible(false) } - handleClick = () => { this.setPopupVisible(false) this.props.onClick() @@ -77,11 +70,12 @@ export default class BoxHeader extends React.Component { }) } - delaySetPopup(open: boolean, ms?: number): void { + delaySetPopup(open: boolean, ms?: number): undefined { if (!ms) { this.setPopupVisible(open) return } + const delay = ms * 1000 this.delayTimer = setTimeout(() => { this.setPopupVisible(open) @@ -105,11 +99,12 @@ export default class BoxHeader extends React.Component { const { illust, user } = this.props const nextIllust = nextProps.illust const nextUser = nextProps.user - const { isBookmarked } = illust + if (nextIllust.isBookmarked !== isBookmarked) { return true } + if (nextUser.isFollowed !== user.isFollowed) { return true } @@ -119,7 +114,6 @@ export default class BoxHeader extends React.Component { render() { const { illust, user, isShowCaption, onClick } = this.props - const { id, title, caption, isBookmarked } = illust if (!user) { @@ -127,7 +121,6 @@ export default class BoxHeader extends React.Component { } const { name, profileImageUrls } = user - return ( { <Profile name={name} onClick={onClick} /> - <div style={{ position: 'absolute', top: 5, right: 10 }}> + <div + style={{ + position: 'absolute', + top: 5, + right: 10, + }} + > <BookmarkButton id={id} isBookmarked={isBookmarked} /> </div> {isShowCaption && caption && <Caption caption={caption} />} diff --git a/app/components/Chip/index.example.js b/app/components/Chip/index.example.tsx similarity index 98% rename from app/components/Chip/index.example.js rename to app/components/Chip/index.example.tsx index 5675dcb2..b925c527 100644 --- a/app/components/Chip/index.example.js +++ b/app/components/Chip/index.example.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import { storiesOf } from '@storybook/react' @@ -11,7 +10,6 @@ const Wrapper = styled.div` align-items: center; padding-top: 10px; ` - storiesOf('Chip', module).add('basic', () => { return ( <Wrapper> diff --git a/app/components/Chip/index.js b/app/components/Chip/index.tsx similarity index 92% rename from app/components/Chip/index.js rename to app/components/Chip/index.tsx index 8f043442..47fae443 100644 --- a/app/components/Chip/index.js +++ b/app/components/Chip/index.tsx @@ -1,14 +1,12 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import DeleteIcon from '../Icons/DeleteIcon' -export type Props = { - children?: ?React.Node, - onClick?: Function, - onRequestDelete?: Function, +export interface Props { + children?: React.Node | null | undefined + onClick?: Function + onRequestDelete?: Function } - const StyledChip = styled.div` display: flex; box-sizing: border-box; @@ -24,7 +22,6 @@ const StyledChip = styled.div` vertical-align: baseline; border-radius: 16px; ` - const InnerChip = styled.span` color: rgba(0, 0, 0, 0.87); font-size: 14px; @@ -35,7 +32,6 @@ const InnerChip = styled.span` user-select: none; white-space: nowrap; ` - const icnonStyle = { cursor: 'pointer', margin: '4px 4px 0px -8px', @@ -44,6 +40,7 @@ const icnonStyle = { class Chip extends React.PureComponent<Props> { handleRequestDelete = (e: Event) => { e.stopPropagation() + if (this.props.onRequestDelete) { this.props.onRequestDelete(e) } @@ -51,7 +48,6 @@ class Chip extends React.PureComponent<Props> { render() { const { onClick, onRequestDelete, children } = this.props - return ( <StyledChip> <InnerChip onClick={onClick}>{children}</InnerChip> diff --git a/app/components/ColumnBody/index.js b/app/components/ColumnBody/index.tsx similarity index 87% rename from app/components/ColumnBody/index.js rename to app/components/ColumnBody/index.tsx index e42ca0fb..98e50912 100644 --- a/app/components/ColumnBody/index.js +++ b/app/components/ColumnBody/index.tsx @@ -1,20 +1,17 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import Loading from 'components/ColumnLoading' -type Props = { - isLoading: boolean, - children?: React.Node, +interface Props { + isLoading: boolean + children?: React.Node } - const Body = styled.div` overflow-y: auto; overflow-x: hidden; height: calc(100% - 50px); width: 280px; ` - export default function ColumnBody({ isLoading, children }: Props) { const handleMove = (e: Event) => { e.stopPropagation() diff --git a/app/components/ColumnHeader/HeaderPopover.js b/app/components/ColumnHeader/HeaderPopover.tsx similarity index 91% rename from app/components/ColumnHeader/HeaderPopover.js rename to app/components/ColumnHeader/HeaderPopover.tsx index c4854a51..579b88aa 100644 --- a/app/components/ColumnHeader/HeaderPopover.js +++ b/app/components/ColumnHeader/HeaderPopover.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' @@ -17,10 +16,9 @@ const StyledPopover = styled.div` width: 90%; } ` - -type Props = { - children?: React.Node, - open: boolean, +interface Props { + children?: React.Node + open: boolean } const Popover = ({ open, children }: Props) => { diff --git a/app/components/ColumnHeader/index.js b/app/components/ColumnHeader/index.tsx similarity index 83% rename from app/components/ColumnHeader/index.js rename to app/components/ColumnHeader/index.tsx index b6416f8d..3ae2ca1b 100644 --- a/app/components/ColumnHeader/index.js +++ b/app/components/ColumnHeader/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import IconButton from 'material-ui/IconButton' import NavigationMenu from 'material-ui/svg-icons/navigation/menu' @@ -6,24 +5,24 @@ import NavigationClose from 'material-ui/svg-icons/navigation/close' import HeaderPopover from './HeaderPopover' import { Header, Item, Title, Wrap } from './styles' -type Props = { - name: string, - onTopClick: (event: Event) => void, - onClose: () => void, - children?: React.Node, +interface Props { + name: string + onTopClick: (event: Event) => undefined + onClose: () => undefined + children?: React.Node } - -type State = { - open: boolean, +interface State { + open: boolean } class ColumnHeader extends React.PureComponent<Props, State> { state: State = { open: false, } - handleClick = () => { - this.setState({ open: !this.state.open }) + this.setState({ + open: !this.state.open, + }) } render() { @@ -50,4 +49,5 @@ class ColumnHeader extends React.PureComponent<Props, State> { ) } } + export default ColumnHeader diff --git a/app/components/ColumnHeader/styles.js b/app/components/ColumnHeader/styles.tsx similarity index 98% rename from app/components/ColumnHeader/styles.js rename to app/components/ColumnHeader/styles.tsx index c4f16eb4..18fd8b90 100644 --- a/app/components/ColumnHeader/styles.js +++ b/app/components/ColumnHeader/styles.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' export const Wrap = styled.div` @@ -8,7 +7,6 @@ export const Wrap = styled.div` padding: 0; flex-direction: column; ` - export const Header = styled.div` position: relative; display: flex; @@ -22,14 +20,12 @@ export const Header = styled.div` width: 100%; cursor: pointer; ` - export const Item = styled.div` display: flex; position: relative; justify-content: space-between; align-items: center; ` - export const Title = styled.div` color: #e1e8ed; font-size: 1rem; diff --git a/app/components/ColumnHeaderBookmark/index.js b/app/components/ColumnHeaderBookmark/index.tsx similarity index 80% rename from app/components/ColumnHeaderBookmark/index.js rename to app/components/ColumnHeaderBookmark/index.tsx index f6806108..5aff385f 100644 --- a/app/components/ColumnHeaderBookmark/index.js +++ b/app/components/ColumnHeaderBookmark/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import { debounce } from 'lodash' @@ -6,13 +5,12 @@ import Slider from 'material-ui/Slider' import { FormattedMessage } from 'react-intl' import messages from './messages' -export type Props = { - setMinBookmarks: (value: number) => void, - minBookmarks: number, +export interface Props { + setMinBookmarks: (value: number) => undefined + minBookmarks: number } - -type State = { - minBookmarks: number, +interface State { + minBookmarks: number } class ColumnHeaderSetting extends React.PureComponent<Props, State> { @@ -21,21 +19,24 @@ class ColumnHeaderSetting extends React.PureComponent<Props, State> { } componentWillMount() { - this.setState({ minBookmarks: this.props.minBookmarks }) + this.setState({ + minBookmarks: this.props.minBookmarks, + }) } handleSlider = (event: Event, value: number) => { - this.setState({ minBookmarks: value }) + this.setState({ + minBookmarks: value, + }) + this._sendBookmark() } - _sendBookmark = debounce(() => { this.props.setMinBookmarks(this.state.minBookmarks) }, 400) render() { const { minBookmarks } = this.state - return ( <Wrap> <FormattedMessage {...messages.bookmarkFilter} /> {minBookmarks} @@ -58,5 +59,4 @@ const Wrap = styled.div` flex-direction: column; color: #eee; ` - export default ColumnHeaderSetting diff --git a/app/components/ColumnHeaderBookmark/messages.js b/app/components/ColumnHeaderBookmark/messages.tsx similarity index 93% rename from app/components/ColumnHeaderBookmark/messages.js rename to app/components/ColumnHeaderBookmark/messages.tsx index 2e90be11..f56b539b 100644 --- a/app/components/ColumnHeaderBookmark/messages.js +++ b/app/components/ColumnHeaderBookmark/messages.tsx @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/components/ColumnLoading/index.js b/app/components/ColumnLoading/index.tsx similarity index 80% rename from app/components/ColumnLoading/index.js rename to app/components/ColumnLoading/index.tsx index 79e432e7..f81e8cf7 100644 --- a/app/components/ColumnLoading/index.js +++ b/app/components/ColumnLoading/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import Loading from 'components/Loading' @@ -12,7 +11,11 @@ const LoadingWrap = styled.div` const ColumnLoading = () => ( <LoadingWrap> - <Loading wrapStyle={{ background: '#121212' }} /> + <Loading + wrapStyle={{ + background: '#121212', + }} + /> </LoadingWrap> ) diff --git a/app/components/ColumnRoot/index.js b/app/components/ColumnRoot/index.tsx similarity index 89% rename from app/components/ColumnRoot/index.js rename to app/components/ColumnRoot/index.tsx index 169d90d1..69a3a972 100644 --- a/app/components/ColumnRoot/index.js +++ b/app/components/ColumnRoot/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import { key } from 'styles/styleTheme' @@ -13,11 +12,9 @@ const View = styled.div` background-color: ${key('base')}; border: 2px solid #444448; ` - -type Props = { - children?: React.Node, +interface Props { + children?: React.Node } - export default function ColumnRoot({ children }: Props) { return <View>{children}</View> } diff --git a/app/components/Drawer/DrawerWrapper.js b/app/components/Drawer/DrawerWrapper.tsx similarity index 96% rename from app/components/Drawer/DrawerWrapper.js rename to app/components/Drawer/DrawerWrapper.tsx index 0418cae6..fd81e310 100644 --- a/app/components/Drawer/DrawerWrapper.js +++ b/app/components/Drawer/DrawerWrapper.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' import { key } from 'styles/styleTheme' @@ -11,5 +10,4 @@ const DrawerWrapper = styled.div` overflow: hidden; background-color: ${key('base')}; ` - export default DrawerWrapper diff --git a/app/components/Drawer/StyledDrawer.js b/app/components/Drawer/StyledDrawer.tsx similarity index 98% rename from app/components/Drawer/StyledDrawer.js rename to app/components/Drawer/StyledDrawer.tsx index 6019c563..048dbb32 100644 --- a/app/components/Drawer/StyledDrawer.js +++ b/app/components/Drawer/StyledDrawer.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' const StyledDrawer = styled.div` @@ -17,5 +16,4 @@ const StyledDrawer = styled.div` box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15); background-color: inherit; ` - export default StyledDrawer diff --git a/app/components/Drawer/index.js b/app/components/Drawer/index.tsx similarity index 69% rename from app/components/Drawer/index.js rename to app/components/Drawer/index.tsx index 26accb78..43337e58 100644 --- a/app/components/Drawer/index.js +++ b/app/components/Drawer/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import EventListener from 'react-event-listener' import handleEscCreater from 'utils/handleEscCreater' @@ -6,25 +5,22 @@ import Overlay from 'components/Overlay' import StyledDrawer from './StyledDrawer' import DrawerWrapper from './DrawerWrapper' -export type Props = { - open: boolean, - children?: React.Element<any>, - onRequestClose?: () => void, - width?: number, +export interface Props { + open: boolean + children?: React.ReactNode + onRequestClose?: () => undefined + width?: number } - -type DefaultProps = { - width: number, +interface DefaultProps { + width: number } -class Drawer extends React.PureComponent<Props, void> { +class Drawer extends React.PureComponent<Props, undefined> { props: Props - static defaultProps: DefaultProps = { width: 500, onRequestClose: () => {}, } - handleKeyUp = this.props && this.props.onRequestClose && @@ -32,14 +28,19 @@ class Drawer extends React.PureComponent<Props, void> { render() { const { open, width, children, onRequestClose } = this.props - return ( <DrawerWrapper> {open && <EventListener target="window" onKeyUp={this.handleKeyUp} />} <StyledDrawer open={open} x={width}> {open && children} </StyledDrawer> - <Overlay show={open} style={{ zIndex: 800 }} onClick={onRequestClose} /> + <Overlay + show={open} + style={{ + zIndex: 800, + }} + onClick={onRequestClose} + /> </DrawerWrapper> ) } diff --git a/app/components/Dropdown/Item.js b/app/components/Dropdown/Item.tsx similarity index 83% rename from app/components/Dropdown/Item.js rename to app/components/Dropdown/Item.tsx index 815f9c4f..e8eb7f22 100644 --- a/app/components/Dropdown/Item.js +++ b/app/components/Dropdown/Item.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' @@ -17,10 +16,9 @@ const Wrap = styled.div` background-color: #3f9f94; } ` - -type Props = { - text: string | React.Element<any>, - onClick: () => void, +interface Props { + text: string | React.ReactNode + onClick: () => undefined } const Item = ({ text, onClick }: Props) => <Wrap onClick={onClick}>{text}</Wrap> diff --git a/app/components/Dropdown/index.js b/app/components/Dropdown/index.tsx similarity index 87% rename from app/components/Dropdown/index.js rename to app/components/Dropdown/index.tsx index 63b9a4d4..b0fd3a59 100644 --- a/app/components/Dropdown/index.js +++ b/app/components/Dropdown/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import { FormattedMessage } from 'react-intl' import EventListener from 'react-event-listener' @@ -7,10 +6,10 @@ import Item from './Item' import { H, Wrap } from './styles' import messages from './messages' -type Props = { - onOpenFilterModal: () => void, - onLogout: () => void, - onClose: Function, +interface Props { + onOpenFilterModal: () => undefined + onLogout: () => undefined + onClose: Function } const Dropdwon = ({ onOpenFilterModal, onLogout, onClose }: Props) => ( diff --git a/app/components/Dropdown/messages.js b/app/components/Dropdown/messages.tsx similarity index 93% rename from app/components/Dropdown/messages.js rename to app/components/Dropdown/messages.tsx index 4b19755d..67619fcc 100644 --- a/app/components/Dropdown/messages.js +++ b/app/components/Dropdown/messages.tsx @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/components/Dropdown/styles.js b/app/components/Dropdown/styles.tsx similarity index 97% rename from app/components/Dropdown/styles.js rename to app/components/Dropdown/styles.tsx index 8bf3bdd1..4b7a937e 100644 --- a/app/components/Dropdown/styles.js +++ b/app/components/Dropdown/styles.tsx @@ -1,4 +1,3 @@ -// @flow import styled, { keyframes } from 'styled-components' const fadeIn = keyframes` @@ -10,7 +9,6 @@ const fadeIn = keyframes` bottom: 10px; } ` - export const Wrap = styled.div` position: absolute; background-color: white; @@ -20,7 +18,6 @@ export const Wrap = styled.div` padding: 12px 0; animation: ${fadeIn} 200ms both; ` - export const H = styled.div` padding-top: 1px; border-bottom: 1px solid #ddd; diff --git a/app/components/Icons/DeleteIcon.js b/app/components/Icons/DeleteIcon.tsx similarity index 85% rename from app/components/Icons/DeleteIcon.js rename to app/components/Icons/DeleteIcon.tsx index 4d3cebcb..7db6d7ab 100644 --- a/app/components/Icons/DeleteIcon.js +++ b/app/components/Icons/DeleteIcon.tsx @@ -1,6 +1,5 @@ -// @flow import * as React from 'react' -import IconBase, { type Props } from './IconBase' +import IconBase, { Props } from './IconBase' export default function DeleteIcon(props: Props) { return ( diff --git a/app/components/Icons/IconBase.js b/app/components/Icons/IconBase.tsx similarity index 71% rename from app/components/Icons/IconBase.js rename to app/components/Icons/IconBase.tsx index 84408971..7de84384 100644 --- a/app/components/Icons/IconBase.js +++ b/app/components/Icons/IconBase.tsx @@ -1,48 +1,44 @@ -// @flow import * as React from 'react' -type DP = { - size: number, - viewBox: string, +interface DP { + size: number + viewBox: string } - -export type Props = { - style?: Object, - color?: string, - hoverColor?: string, - onMouseEnter?: Function, - onMouseLeave?: Function, - children?: ?React.Element<any>, - size?: number, - viewBox?: string, +export interface Props { + style?: object + color?: string + hoverColor?: string + onMouseEnter?: Function + onMouseLeave?: Function + children?: React.ReactNode | null | undefined + size?: number + viewBox?: string } - -type State = { - hoverd: boolean, +interface State { + hoverd: boolean } - export default class Icon extends React.PureComponent<Props, State> { - props: Props - state: State = { - hoverd: false, - } - static defaultProps: DP = { viewBox: '0 0 24 24', size: 24, } - - state: { hoverd: boolean } = { hoverd: false } - + state: State = { + hoverd: false, + } handleMouseEnter = (event: Event) => { - this.setState({ hoverd: true }) + this.setState({ + hoverd: true, + }) + if (this.props.onMouseEnter) { this.props.onMouseEnter(event) } } - handleMouseLeave = (event: Event) => { - this.setState({ hoverd: false }) + this.setState({ + hoverd: false, + }) + if (this.props.onMouseLeave) { this.props.onMouseLeave(event) } @@ -50,10 +46,8 @@ export default class Icon extends React.PureComponent<Props, State> { render() { const { style, color, hoverColor, viewBox, size, children } = this.props - const offColor = color ? color : 'currentColor' const onColor = hoverColor ? hoverColor : offColor - const mergedStyles = { fill: this.state.hoverd ? onColor : offColor, display: 'inline-block', @@ -62,7 +56,6 @@ export default class Icon extends React.PureComponent<Props, State> { userSelect: 'none', ...style, } - return ( <svg viewBox={viewBox} diff --git a/app/components/IllustList/index.js b/app/components/IllustList/index.tsx similarity index 85% rename from app/components/IllustList/index.js rename to app/components/IllustList/index.tsx index f138d696..d3166814 100644 --- a/app/components/IllustList/index.js +++ b/app/components/IllustList/index.tsx @@ -1,30 +1,26 @@ -// @flow import * as React from 'react' import Box from 'containers/BoxContainer' import IntersectionObserverWrapper from 'utils/intersectionObserverWrapper' -import type { Illust } from 'types/illust' +import { Illust } from 'types/illust' import LoadMore from 'components/LoadMore' import { ScrollableY } from './styles' -export type Props = { - id: string, - hasMore: boolean, - illusts: Array<Illust>, - node?: (HTMLElement | null) => void, - onNext: Function, +export interface Props { + id: string + hasMore: boolean + illusts: Illust[] + node?: (a: HTMLElement | null) => undefined + onNext: Function } - export default class IllustList extends React.PureComponent<Props> { node: HTMLElement | null intersectionObserverWrapper = new IntersectionObserverWrapper() - attachIntersectionObserver = () => { this.intersectionObserverWrapper.connect({ root: this.node, rootMargin: '300%', }) } - detachIntersectionObserver = () => { this.intersectionObserverWrapper.disconnect() } @@ -45,13 +41,13 @@ export default class IllustList extends React.PureComponent<Props> { render() { const { id, illusts, hasMore } = this.props + if (illusts.length === 0) { return null } const List = illusts.map(illust => <Box key={illust.id} id={illust.id} />) - - let loadMore: ?React.Element<any> = null + let loadMore: React.ReactNode | null | undefined = null if (hasMore) { loadMore = ( diff --git a/app/components/IllustList/styles.js b/app/components/IllustList/styles.tsx similarity index 98% rename from app/components/IllustList/styles.js rename to app/components/IllustList/styles.tsx index ed4ff518..6f95a762 100644 --- a/app/components/IllustList/styles.js +++ b/app/components/IllustList/styles.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' import { key } from 'styles/styleTheme' diff --git a/app/components/LoadMore/index.js b/app/components/LoadMore/index.tsx similarity index 76% rename from app/components/LoadMore/index.js rename to app/components/LoadMore/index.tsx index 872f5e19..fb865306 100644 --- a/app/components/LoadMore/index.js +++ b/app/components/LoadMore/index.tsx @@ -1,15 +1,13 @@ -// @flow import * as React from 'react' import Loading from 'components/Loading' import IntersectionObserverWrapper from 'utils/intersectionObserverWrapper' -export type Props = { - id: number | string, - innerRef: HTMLElement => void, - onRequestLoadMore: Function, - intersectionObserverWrapper: IntersectionObserverWrapper, +export interface Props { + id: number | string + innerRef: (a: HTMLElement) => undefined + onRequestLoadMore: Function + intersectionObserverWrapper: IntersectionObserverWrapper } - export default class LoadMore extends React.PureComponent<Props> { componentMounted: boolean = false node: HTMLElement @@ -38,8 +36,7 @@ export default class LoadMore extends React.PureComponent<Props> { this.props.onRequestLoadMore() } } - - _setNode = (node: ?HTMLElement) => { + _setNode = (node: HTMLElement | null | undefined) => { if (node) { this.node = node } @@ -57,7 +54,11 @@ export default class LoadMore extends React.PureComponent<Props> { backgroundColor: 'inherit', }} > - <Loading wrapStyle={{ background: 'inherit' }} /> + <Loading + wrapStyle={{ + background: 'inherit', + }} + /> </div> ) } diff --git a/app/components/Loading/LoadingWrapper.js b/app/components/Loading/LoadingWrapper.tsx similarity index 96% rename from app/components/Loading/LoadingWrapper.js rename to app/components/Loading/LoadingWrapper.tsx index c18455bd..e84a788f 100644 --- a/app/components/Loading/LoadingWrapper.js +++ b/app/components/Loading/LoadingWrapper.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' import { key } from 'styles/styleTheme' @@ -9,5 +8,4 @@ const LoadingWrapper = styled.div` width: 100%; height: 100%; ` - export default LoadingWrapper diff --git a/app/components/Loading/Rect.js b/app/components/Loading/Rect.tsx similarity index 97% rename from app/components/Loading/Rect.js rename to app/components/Loading/Rect.tsx index b7367633..4b2b76db 100644 --- a/app/components/Loading/Rect.js +++ b/app/components/Loading/Rect.tsx @@ -1,4 +1,3 @@ -// @flow import styled, { keyframes } from 'styled-components' import { key } from 'styles/styleTheme' @@ -13,7 +12,6 @@ const loading = keyframes` transform: scaleY(1); } ` - const Rect = styled.div` background-color: ${key('gray')}; height: 100%; @@ -23,5 +21,4 @@ const Rect = styled.div` animation: ${loading} 1.2s infinite ease-in-out; animation-delay: ${props => props.delay}s; ` - export default Rect diff --git a/app/components/Loading/Spinner.js b/app/components/Loading/Spinner.tsx similarity index 94% rename from app/components/Loading/Spinner.js rename to app/components/Loading/Spinner.tsx index 66781dcd..a0ad6fa9 100644 --- a/app/components/Loading/Spinner.js +++ b/app/components/Loading/Spinner.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' const Spinner = styled.div` @@ -8,5 +7,4 @@ const Spinner = styled.div` text-align: center; font-size: 10px; ` - export default Spinner diff --git a/app/components/Loading/index.example.js b/app/components/Loading/index.example.tsx similarity index 95% rename from app/components/Loading/index.example.js rename to app/components/Loading/index.example.tsx index 81225bff..d3e58e75 100644 --- a/app/components/Loading/index.example.js +++ b/app/components/Loading/index.example.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import { storiesOf } from '@storybook/react' import Loading from '.' diff --git a/app/components/Loading/index.js b/app/components/Loading/index.tsx similarity index 88% rename from app/components/Loading/index.js rename to app/components/Loading/index.tsx index a854246f..de6e6ad7 100644 --- a/app/components/Loading/index.js +++ b/app/components/Loading/index.tsx @@ -1,12 +1,11 @@ -// @flow import * as React from 'react' import LoadingWrapper from './LoadingWrapper' import Spinner from './Spinner' import Rect from './Rect' -type Props = { - wrapStyle?: Object, - style?: Object, +interface Props { + wrapStyle?: object + style?: object } function Loading({ style, wrapStyle }: Props) { diff --git a/app/components/Loading/tests/Rect.test.js b/app/components/Loading/tests/Rect.test.tsx similarity index 95% rename from app/components/Loading/tests/Rect.test.js rename to app/components/Loading/tests/Rect.test.tsx index e8c4e15c..8cf1fbc4 100644 --- a/app/components/Loading/tests/Rect.test.js +++ b/app/components/Loading/tests/Rect.test.tsx @@ -1,7 +1,5 @@ -// @flow import * as React from 'react' import { mount } from 'enzyme' - import Rect from '../Rect' test('render a prop', () => { diff --git a/app/components/LoginModal/ErrorNotify.js b/app/components/LoginModal/ErrorNotify.tsx similarity index 98% rename from app/components/LoginModal/ErrorNotify.js rename to app/components/LoginModal/ErrorNotify.tsx index 7c691f0e..f67f72a8 100644 --- a/app/components/LoginModal/ErrorNotify.js +++ b/app/components/LoginModal/ErrorNotify.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import { FormattedMessage } from 'react-intl' diff --git a/app/components/LoginModal/Feild.js b/app/components/LoginModal/Feild.tsx similarity index 94% rename from app/components/LoginModal/Feild.js rename to app/components/LoginModal/Feild.tsx index 7a8f57c9..38fa276d 100644 --- a/app/components/LoginModal/Feild.js +++ b/app/components/LoginModal/Feild.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' const Feild = styled.div` @@ -7,5 +6,4 @@ const Feild = styled.div` margin: 0 auto; text-align: center; ` - export default Feild diff --git a/app/components/LoginModal/Input.js b/app/components/LoginModal/Input.tsx similarity index 96% rename from app/components/LoginModal/Input.js rename to app/components/LoginModal/Input.tsx index d1366fd5..de52a8da 100644 --- a/app/components/LoginModal/Input.js +++ b/app/components/LoginModal/Input.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' const Input = styled.input` @@ -12,5 +11,4 @@ const Input = styled.input` text-align: center; box-sizing: border-box; ` - export default Input diff --git a/app/components/LoginModal/Loading.js b/app/components/LoginModal/Loading.tsx similarity index 98% rename from app/components/LoginModal/Loading.js rename to app/components/LoginModal/Loading.tsx index 47dbc884..673fb8f8 100644 --- a/app/components/LoginModal/Loading.js +++ b/app/components/LoginModal/Loading.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import { FormattedMessage } from 'react-intl' diff --git a/app/components/LoginModal/LoginButton.js b/app/components/LoginModal/LoginButton.tsx similarity index 86% rename from app/components/LoginModal/LoginButton.js rename to app/components/LoginModal/LoginButton.tsx index 96018dc9..2cf2f4ba 100644 --- a/app/components/LoginModal/LoginButton.js +++ b/app/components/LoginModal/LoginButton.tsx @@ -1,11 +1,10 @@ -// @flow import * as React from 'react' import { FormattedMessage } from 'react-intl' import Submit from './Submit' import messages from './messages' -type Props = { - onClick: () => void, +interface Props { + onClick: () => undefined } const LoginButton = ({ onClick }: Props) => ( diff --git a/app/components/LoginModal/Submit.js b/app/components/LoginModal/Submit.tsx similarity index 97% rename from app/components/LoginModal/Submit.js rename to app/components/LoginModal/Submit.tsx index f3f23241..db1a51cc 100644 --- a/app/components/LoginModal/Submit.js +++ b/app/components/LoginModal/Submit.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' const Submit = styled.button` @@ -21,5 +20,4 @@ const Submit = styled.button` background-color: #529ecc; border-color: #529ecc; ` - export default Submit diff --git a/app/components/LoginModal/index.js b/app/components/LoginModal/index.tsx similarity index 78% rename from app/components/LoginModal/index.js rename to app/components/LoginModal/index.tsx index efe203f9..d33abad5 100644 --- a/app/components/LoginModal/index.js +++ b/app/components/LoginModal/index.tsx @@ -1,7 +1,6 @@ -// @flow import React, { Component } from 'react' import styled from 'styled-components' -import { injectIntl, type IntlShape } from 'react-intl' +import { injectIntl, IntlShape } from 'react-intl' import LoginButton from './LoginButton' import Loading from './Loading' import ErrorNotify from './ErrorNotify' @@ -9,21 +8,21 @@ import Input from './Input' import Feild from './Feild' import messages from './messages' -type InjectProp = { - intl: IntlShape, +interface InjectProp { + intl: IntlShape } -export type Props = { - username: string, - password: string, - isLoginFailure: boolean, - isLoading: boolean, - onClick: (username: string, password: string) => void, +export interface Props { + username: string + password: string + isLoginFailure: boolean + isLoading: boolean + onClick: (username: string, password: string) => undefined } -type State = { - username: string, - password: string, +interface State { + username: string + password: string } const Wrap = styled.div` @@ -39,19 +38,20 @@ class LoginModal extends Component<Props & InjectProp, State> { username: this.props.username, password: this.props.password, } - handleChangeName = (event: Event) => { if (event.target instanceof HTMLInputElement) { - this.setState({ username: event.target.value }) + this.setState({ + username: event.target.value, + }) } } - handleChangePassword = (event: Event) => { if (event.target instanceof HTMLInputElement) { - this.setState({ password: event.target.value }) + this.setState({ + password: event.target.value, + }) } } - handleClick = () => { this.props.onClick(this.state.username, this.state.password) } @@ -64,7 +64,6 @@ class LoginModal extends Component<Props & InjectProp, State> { } const { username, password } = this.state - return ( <Wrap> {isLoginFailure && <ErrorNotify />} diff --git a/app/components/LoginModal/messages.js b/app/components/LoginModal/messages.tsx similarity index 97% rename from app/components/LoginModal/messages.js rename to app/components/LoginModal/messages.tsx index 883ac199..ac23dfd5 100644 --- a/app/components/LoginModal/messages.js +++ b/app/components/LoginModal/messages.tsx @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/components/MainView/index.js b/app/components/MainView/index.tsx similarity index 96% rename from app/components/MainView/index.js rename to app/components/MainView/index.tsx index ed063df6..a6d56d09 100644 --- a/app/components/MainView/index.js +++ b/app/components/MainView/index.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' import { key } from 'styles/styleTheme' @@ -10,5 +9,4 @@ const MainView = styled.div` overflow-y: hidden; background-color: ${key('base')}; ` - export default MainView diff --git a/app/components/Overlay/Overlay.js b/app/components/Overlay/Overlay.tsx similarity index 67% rename from app/components/Overlay/Overlay.js rename to app/components/Overlay/Overlay.tsx index 21fdb9e4..e7e910ba 100644 --- a/app/components/Overlay/Overlay.js +++ b/app/components/Overlay/Overlay.tsx @@ -1,21 +1,21 @@ -// @flow import * as React from 'react' import AutoLockScroll from 'components/AutoLockScroll' import StyledOverlay from './StyledOverlay' -type Props = { - show: boolean, - autoLockScrolling: boolean, - style: Object, +interface Props { + show: boolean + autoLockScrolling: boolean + style: object } -class Overlay extends React.Component<Props, void> { +class Overlay extends React.Component<Props, undefined> { props: Props - static defaultProps = { autoLockScrolling: true } + static defaultProps = { + autoLockScrolling: true, + } render() { const { autoLockScrolling, show, ...other } = this.props - return ( <StyledOverlay show={show} {...other}> {autoLockScrolling && <AutoLockScroll lock={show} />} diff --git a/app/components/Overlay/StyledOverlay.js b/app/components/Overlay/StyledOverlay.tsx similarity index 98% rename from app/components/Overlay/StyledOverlay.js rename to app/components/Overlay/StyledOverlay.tsx index a02fc332..95ac977d 100644 --- a/app/components/Overlay/StyledOverlay.js +++ b/app/components/Overlay/StyledOverlay.tsx @@ -1,9 +1,7 @@ -// @flow import styled from 'styled-components' const showTransition = 'left 400ms ease-out 0, opacity 400ms ease-out' const hideTransition = 'left 0ms ease-out, opacity 200ms ease-out' - const StyledOverlay = styled.div` position: fixed; height: 100%; @@ -17,5 +15,4 @@ const StyledOverlay = styled.div` opacity: ${props => (props.show ? 1 : 0)}; transition: ${props => (props.show ? showTransition : hideTransition)}; ` - export default StyledOverlay diff --git a/app/components/Overlay/index.js b/app/components/Overlay/index.tsx similarity index 86% rename from app/components/Overlay/index.js rename to app/components/Overlay/index.tsx index 223f4533..fe021e11 100644 --- a/app/components/Overlay/index.js +++ b/app/components/Overlay/index.tsx @@ -1,4 +1,3 @@ -// @flow import Overlay from './Overlay' export default Overlay diff --git a/app/components/Profile/index.js b/app/components/Profile/index.tsx similarity index 91% rename from app/components/Profile/index.js rename to app/components/Profile/index.tsx index d46544f4..ee49b306 100644 --- a/app/components/Profile/index.js +++ b/app/components/Profile/index.tsx @@ -1,13 +1,11 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import A from 'components/A' -type Props = { - name: string, - onClick: () => void, +interface Props { + name: string + onClick: () => undefined } - const Name = styled(A)` color: #74787c; line-height: 1; @@ -15,7 +13,6 @@ const Name = styled(A)` font-size: 0.9rem; margin-right: 5px; ` - const Line = styled.p` margin: 0; overflow-x: scroll; @@ -25,7 +22,6 @@ const Line = styled.p` display: none; } ` - const ProfileWrapper = styled.div` display: inline-flex; margin-top: 2px; diff --git a/app/components/Sidebar/HeaderButton.js b/app/components/Sidebar/HeaderButton.tsx similarity index 74% rename from app/components/Sidebar/HeaderButton.js rename to app/components/Sidebar/HeaderButton.tsx index 0aaf33cd..46f843ef 100644 --- a/app/components/Sidebar/HeaderButton.js +++ b/app/components/Sidebar/HeaderButton.tsx @@ -9,11 +9,10 @@ const A = styled.a` height: 45px; margin: 0 auto; ` - -type Props = { - iconType: 'add' | 'searchIllust' | 'setting', - onClick: () => void, - IconStyle: Object, +interface Props { + iconType: 'add' | 'searchIllust' | 'setting' + onClick: () => undefined + IconStyle: object } const HeaderButton = ({ iconType, onClick, IconStyle }: Props) => { @@ -21,7 +20,11 @@ const HeaderButton = ({ iconType, onClick, IconStyle }: Props) => { evnet.stopPropagation() onClick() } - const style = { color: '#a4a4a4', ...IconStyle } + + const style = { + color: '#a4a4a4', + ...IconStyle, + } return ( <A onClick={handleClick}> <Icon type={iconType} size={38} style={style} /> diff --git a/app/components/Sidebar/index.js b/app/components/Sidebar/index.tsx similarity index 78% rename from app/components/Sidebar/index.js rename to app/components/Sidebar/index.tsx index 066fe10d..093851cd 100644 --- a/app/components/Sidebar/index.js +++ b/app/components/Sidebar/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import EventListener from 'react-event-listener' @@ -8,29 +7,26 @@ import Dropdwon from '../Dropdown' import HeaderButton from './HeaderButton' import { SearchWrap, Wrap } from './styles' -export type Props = { - isDropdown: boolean, - isSearchField: boolean, - toggleSearchField: () => void, - onClickAdd: () => void, - onToggleDropdown: () => void, - onOpenFilterModal: () => void, - onCloseDropdown: Function, - onLogout: () => void, +export interface Props { + isDropdown: boolean + isSearchField: boolean + toggleSearchField: () => undefined + onClickAdd: () => undefined + onToggleDropdown: () => undefined + onOpenFilterModal: () => undefined + onCloseDropdown: Function + onLogout: () => undefined } - const Top = styled.div` width: 100%; text-align: center; ` - const Bottom = styled.div` width: 100%; position: absolute; left: 0; bottom: 20px; ` - export default function Sidebar(props: Props) { const { onClickAdd, @@ -42,9 +38,7 @@ export default function Sidebar(props: Props) { toggleSearchField, onCloseDropdown, } = props - const handleKeyUp = handleEscCreater(toggleSearchField) - return ( <Wrap> <Top> @@ -52,7 +46,13 @@ export default function Sidebar(props: Props) { <HeaderButton iconType="searchIllust" onClick={toggleSearchField} - IconStyle={isSearchField ? { color: '#dedede' } : {}} + IconStyle={ + isSearchField + ? { + color: '#dedede', + } + : {} + } /> </Top> diff --git a/app/components/Sidebar/styles.js b/app/components/Sidebar/styles.tsx similarity index 97% rename from app/components/Sidebar/styles.js rename to app/components/Sidebar/styles.tsx index 54eaba43..976584a0 100644 --- a/app/components/Sidebar/styles.js +++ b/app/components/Sidebar/styles.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' export const Wrap = styled.header` @@ -16,7 +15,6 @@ export const Wrap = styled.header` height: 100%; background-color: #292f33; ` - export const SearchWrap = styled.div` position: fixed; top: 35px; diff --git a/app/components/Tag/index.js b/app/components/Tag/index.tsx similarity index 72% rename from app/components/Tag/index.js rename to app/components/Tag/index.tsx index 47497116..ed53eab4 100644 --- a/app/components/Tag/index.js +++ b/app/components/Tag/index.tsx @@ -1,12 +1,10 @@ -// @flow import * as React from 'react' import { StyledTag } from './styles' -export type Props = { - onClick: string => void, - name: string, +export interface Props { + onClick: (a: string) => undefined + name: string } - export default function Tag({ name, onClick }: Props) { return <StyledTag onClick={() => onClick(name)}>#{name}</StyledTag> } diff --git a/app/components/Tag/styles.js b/app/components/Tag/styles.tsx similarity index 94% rename from app/components/Tag/styles.js rename to app/components/Tag/styles.tsx index 553d7c11..eed6fba4 100644 --- a/app/components/Tag/styles.js +++ b/app/components/Tag/styles.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' import A from 'components/A' diff --git a/app/components/TextAutoLink/index.js b/app/components/TextAutoLink/index.tsx similarity index 86% rename from app/components/TextAutoLink/index.js rename to app/components/TextAutoLink/index.tsx index 2f8dfb19..1d12ce89 100644 --- a/app/components/TextAutoLink/index.js +++ b/app/components/TextAutoLink/index.tsx @@ -1,9 +1,8 @@ -// @flow import * as React from 'react' import { link } from 'autolinker' -type Props = { - text: string, +interface Props { + text: string } const TextAutoLink = ({ text }: Props) => ( diff --git a/app/components/TwitterButton/index.js b/app/components/TwitterButton/index.tsx similarity index 96% rename from app/components/TwitterButton/index.js rename to app/components/TwitterButton/index.tsx index 52856129..6377eb60 100644 --- a/app/components/TwitterButton/index.js +++ b/app/components/TwitterButton/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import Button from 'components/common/Button' import { A } from './styles' diff --git a/app/components/TwitterButton/styles.js b/app/components/TwitterButton/styles.tsx similarity index 90% rename from app/components/TwitterButton/styles.js rename to app/components/TwitterButton/styles.tsx index 78a97e5a..c7383e7d 100644 --- a/app/components/TwitterButton/styles.js +++ b/app/components/TwitterButton/styles.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' export const A = styled.a` diff --git a/app/components/UserDrawer/DrawerHeader.js b/app/components/UserDrawer/DrawerHeader.tsx similarity index 88% rename from app/components/UserDrawer/DrawerHeader.js rename to app/components/UserDrawer/DrawerHeader.tsx index 2c67d9ef..84ac15a3 100644 --- a/app/components/UserDrawer/DrawerHeader.js +++ b/app/components/UserDrawer/DrawerHeader.tsx @@ -1,12 +1,11 @@ -// @flow import * as React from 'react' import styled from 'styled-components' -import type { User, Profile } from 'types/user' +import { User, Profile } from 'types/user' import Avater from 'components/Avater' import TextAutoLink from 'components/TextAutoLink' import Navigation from './Navigation' -const Header = ({ user, profile }: { user: User, profile: Profile }) => ( +const Header = ({ user, profile }: { user: User; profile: Profile }) => ( <Wrap> <Navigation user={user} profile={profile} /> <ImageWrap> @@ -23,7 +22,6 @@ const Wrap = styled.div` background-color: #eee; padding-bottom: 30px; ` - const ImageWrap = styled.div` position: relative; width: 100%; @@ -31,11 +29,9 @@ const ImageWrap = styled.div` margin: 20px auto; text-align: center; ` - const Info = styled.div` text-align: center; ` - const Caption = styled.div` background-color: #fff; border-radius: 2px; @@ -44,5 +40,4 @@ const Caption = styled.div` line-height: 21px; font-size: 14px; ` - export default Header diff --git a/app/components/UserDrawer/Navigation.js b/app/components/UserDrawer/Navigation.tsx similarity index 90% rename from app/components/UserDrawer/Navigation.js rename to app/components/UserDrawer/Navigation.tsx index 21748b5b..226b88fa 100644 --- a/app/components/UserDrawer/Navigation.js +++ b/app/components/UserDrawer/Navigation.tsx @@ -1,7 +1,6 @@ -// @flow import * as React from 'react' import styled from 'styled-components' -import type { User, Profile } from 'types/user' +import { User, Profile } from 'types/user' import FollowButton from 'containers/FollowButton' import AddNewColumnButton from 'containers/AddNewColumnButton' import TwitterButton from 'components/TwitterButton' @@ -10,10 +9,9 @@ import Button from 'components/common/Button' export const A = styled.a` margin: 0 5px; ` - -type Props = { - user: User, - profile: Profile, +interface Props { + user: User + profile: Profile } const getPixivUserLink = id => `https://www.pixiv.net/member.php?id=${id}` @@ -42,12 +40,10 @@ const NavigationWrap = styled.div` top: 0; z-index: 10; ` - const Wrap = styled.div` display: flex; text-align: left; justify-content: flex-end; padding: 10px; ` - export default Navigation diff --git a/app/components/UserDrawer/index.js b/app/components/UserDrawer/index.tsx similarity index 79% rename from app/components/UserDrawer/index.js rename to app/components/UserDrawer/index.tsx index 4a678c23..44eac156 100644 --- a/app/components/UserDrawer/index.js +++ b/app/components/UserDrawer/index.tsx @@ -1,23 +1,21 @@ -// @flow import * as React from 'react' import { Tabs, Tab } from 'material-ui/Tabs' import { FormattedMessage } from 'react-intl' -import type { User, Profile } from 'types/user' -import type { Illust } from 'types/illust' +import { User, Profile } from 'types/user' +import { Illust } from 'types/illust' import { key } from 'styles/styleTheme' import IllustList from '../IllustList' import Header from './DrawerHeader' import messages from './messages' -export type Props = { - user: User, - profile: Profile, - illusts: Array<Illust>, - mangas: Array<Illust>, - onNextIllust: Function, - onNextManga: Function, +export interface Props { + user: User + profile: Profile + illusts: Illust[] + mangas: Illust[] + onNextIllust: () => void + onNextManga: () => void } - const tabProps = { tabItemContainerStyle: { backgroundColor: key('base')(), @@ -45,7 +43,9 @@ const UserDrawer = ({ label={ <FormattedMessage {...messages.tabIllust} - values={{ count: totalIllusts }} + values={{ + count: totalIllusts, + }} /> } > @@ -62,7 +62,9 @@ const UserDrawer = ({ label={ <FormattedMessage {...messages.tabManga} - values={{ count: totalManga }} + values={{ + count: totalManga, + }} /> } > diff --git a/app/components/UserDrawer/messages.js b/app/components/UserDrawer/messages.tsx similarity index 95% rename from app/components/UserDrawer/messages.js rename to app/components/UserDrawer/messages.tsx index d8046ac5..68c6c051 100644 --- a/app/components/UserDrawer/messages.js +++ b/app/components/UserDrawer/messages.tsx @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/components/UserPopover/ImageWrap.js b/app/components/UserPopover/ImageWrap.tsx similarity index 93% rename from app/components/UserPopover/ImageWrap.js rename to app/components/UserPopover/ImageWrap.tsx index ac9763c6..d5f1de0b 100644 --- a/app/components/UserPopover/ImageWrap.js +++ b/app/components/UserPopover/ImageWrap.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' const ImageWrap = styled.div` @@ -6,5 +5,4 @@ const ImageWrap = styled.div` margin: 0; display: flex; ` - export default ImageWrap diff --git a/app/components/UserPopover/Top.js b/app/components/UserPopover/Top.tsx similarity index 94% rename from app/components/UserPopover/Top.js rename to app/components/UserPopover/Top.tsx index d9d103d2..27106e5c 100644 --- a/app/components/UserPopover/Top.js +++ b/app/components/UserPopover/Top.tsx @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' const Top = styled.div` @@ -7,5 +6,4 @@ const Top = styled.div` justify-content: space-between; align-items: center; ` - export default Top diff --git a/app/components/UserPopover/TopRight.js b/app/components/UserPopover/TopRight.tsx similarity index 93% rename from app/components/UserPopover/TopRight.js rename to app/components/UserPopover/TopRight.tsx index f620c93a..efc3a927 100644 --- a/app/components/UserPopover/TopRight.js +++ b/app/components/UserPopover/TopRight.tsx @@ -1,9 +1,7 @@ -// @flow import styled from 'styled-components' const TopRight = styled.div` display: flex; align-items: flex-end; ` - export default TopRight diff --git a/app/components/UserPopover/Wrap.js b/app/components/UserPopover/Wrap.tsx similarity index 92% rename from app/components/UserPopover/Wrap.js rename to app/components/UserPopover/Wrap.tsx index 6514eaec..8e6c8ddf 100644 --- a/app/components/UserPopover/Wrap.js +++ b/app/components/UserPopover/Wrap.tsx @@ -1,9 +1,7 @@ -// @flow import styled from 'styled-components' const Wrap = styled.div` min-width: 300px; min-height: 200px; ` - export default Wrap diff --git a/app/components/UserPopover/index.js b/app/components/UserPopover/index.tsx similarity index 81% rename from app/components/UserPopover/index.js rename to app/components/UserPopover/index.tsx index f436d855..a48d01f1 100644 --- a/app/components/UserPopover/index.js +++ b/app/components/UserPopover/index.tsx @@ -1,7 +1,6 @@ -// @flow import * as React from 'react' -import type { User } from 'types/user' -import type { Illust } from 'types/illust' +import { User } from 'types/user' +import { Illust } from 'types/illust' import FollowButton from 'containers/FollowButton' import Avater from 'components/Avater' import Profile from 'components/Profile' @@ -10,10 +9,10 @@ import ImageWrap from './ImageWrap' import Top from './Top' import TopRight from './TopRight' -export type Props = { - onClick: () => void, - illusts: Array<Illust>, - user: User, +export interface Props { + onClick: () => undefined + illusts: Illust[] + user: User } const UserPopover = ({ user, onClick, illusts }: Props) => { @@ -29,7 +28,9 @@ const UserPopover = ({ user, onClick, illusts }: Props) => { <Profile name={user.name} onClick={onClick} - style={{ color: '#222' }} + style={{ + color: '#222', + }} /> </TopRight> <FollowButton user={user} /> diff --git a/app/components/common/Button.js b/app/components/common/Button.tsx similarity index 76% rename from app/components/common/Button.js rename to app/components/common/Button.tsx index 38b61709..42aa41d2 100644 --- a/app/components/common/Button.js +++ b/app/components/common/Button.tsx @@ -1,45 +1,43 @@ -// @flow import * as React from 'react' -type Props = { - children?: React.Element<*>, - label?: string | React.Element<*>, - style?: Object, - color?: string, - hoverdColor?: string, - reverse?: boolean, - onClick?: Function, - onMouseEnter: (event: Event) => void, - onMouseLeave: (event: Event) => void, +interface Props { + children?: React.ReactNode + label?: string | React.ReactNode + style?: object + color?: string + hoverdColor?: string + reverse?: boolean + onClick?: Function + onMouseEnter: (event: Event) => undefined + onMouseLeave: (event: Event) => undefined } - -type State = { - hoverd: boolean, +interface State { + hoverd: boolean } - export default class Button extends React.Component<Props, State> { static defaultProps = { onMouseEnter: () => {}, onMouseLeave: () => {}, } - - state = { hoverd: false } - + state = { + hoverd: false, + } handleMouseEnter = (event: Event) => { - this.setState({ hoverd: true }) + this.setState({ + hoverd: true, + }) this.props.onMouseEnter(event) } - handleMouseLeave = (event: Event) => { - this.setState({ hoverd: false }) + this.setState({ + hoverd: false, + }) this.props.onMouseLeave(event) } render() { const { label, color, hoverdColor, children, reverse, onClick } = this.props - const { hoverd } = this.state - let buttonColor = color || '#fff' let buttonHoverdColor = hoverdColor || '#7898cf' const borderColor = buttonHoverdColor @@ -62,9 +60,7 @@ export default class Button extends React.Component<Props, State> { fontSize: 13, }, } - const mergedStyle = { ...styles.root, ...this.props.style } - return ( <button style={mergedStyle} diff --git a/app/components/common/CloseButton.js b/app/components/common/CloseButton.tsx similarity index 85% rename from app/components/common/CloseButton.js rename to app/components/common/CloseButton.tsx index 79fec728..94dc9292 100644 --- a/app/components/common/CloseButton.js +++ b/app/components/common/CloseButton.tsx @@ -1,14 +1,12 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import ClearIcon from 'material-ui/svg-icons/content/clear' -type Props = { - style?: Object, - iconStyle?: Object, - onClick: () => void, +interface Props { + style?: object + iconStyle?: object + onClick: () => undefined } - const A = styled.a` position: absolute; text-align: center; diff --git a/app/components/common/Icon.js b/app/components/common/Icon.tsx similarity index 89% rename from app/components/common/Icon.js rename to app/components/common/Icon.tsx index 744a514f..950d7fdc 100644 --- a/app/components/common/Icon.js +++ b/app/components/common/Icon.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' type IconType = @@ -9,17 +8,16 @@ type IconType = | 'close' | 'visible-off' | 'favorite' - -type Props = { - type: IconType, - viewBox?: string, - size?: number, - className?: string, - color?: string, - hoverColor?: string, - style?: Object, - onMouseEnter: (event: Event) => void, - onMouseLeave: (event: Event) => void, +interface Props { + type: IconType + viewBox?: string + size?: number + className?: string + color?: string + hoverColor?: string + style?: object + onMouseEnter: (event: Event) => undefined + onMouseLeave: (event: Event) => undefined } const SelectIcon = ({ type }: { type: IconType }) => { @@ -28,28 +26,35 @@ const SelectIcon = ({ type }: { type: IconType }) => { return ( <path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65c-.03-.24-.24-.42-.49-.42h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zm-7.43 2.52c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z" /> ) + case 'manga': return ( <path d="M10 18h5v-6h-5v6zm-6 0h5v-13h-5v13zm12 0h5v-6h-5v6zm-6-13v6h11v-6h-11z" /> ) + case 'searchIllust': return ( <path d="M15.5 14h-.79l-.28-.27c.98-1.14 1.57-2.62 1.57-4.23 0-3.59-2.91-6.5-6.5-6.5s-6.5 2.91-6.5 6.5 2.91 6.5 6.5 6.5c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99 1.49-1.49-4.99-5zm-6 0c-2.49 0-4.5-2.01-4.5-4.5s2.01-4.5 4.5-4.5 4.5 2.01 4.5 4.5-2.01 4.5-4.5 4.5z" /> ) + case 'add': return <path d="M19 13h-6v6h-2v-6h-6v-2h6v-6h2v6h6v2z" /> + case 'close': return ( <path d="M19 6.41l-1.41-1.41-5.59 5.59-5.59-5.59-1.41 1.41 5.59 5.59-5.59 5.59 1.41 1.41 5.59-5.59 5.59 5.59 1.41-1.41-5.59-5.59z" /> ) + case 'visible-off': return ( <path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16c.57-.23 1.18-.36 1.83-.36zm-10-2.73l2.28 2.28.46.46c-1.66 1.29-2.96 3.01-3.74 4.99 1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42 2.93 2.92 1.27-1.27-17.73-17.73-1.27 1.27zm5.53 5.53l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z" /> ) + case 'favorite': return ( <path d="M12 21.35l-1.45-1.32c-5.15-4.67-8.55-7.75-8.55-11.53 0-3.08 2.42-5.5 5.5-5.5 1.74 0 3.41.81 4.5 2.09 1.09-1.28 2.76-2.09 4.5-2.09 3.08 0 5.5 2.42 5.5 5.5 0 3.78-3.4 6.86-8.55 11.54l-1.45 1.31z" /> ) + default: throw new Error('icon not match') } @@ -57,7 +62,9 @@ const SelectIcon = ({ type }: { type: IconType }) => { export default class Icon extends React.PureComponent< Props, - { hoverd: boolean } + { + hoverd: boolean + } > { static defaultProps = { onMouseEnter: () => {}, @@ -65,16 +72,21 @@ export default class Icon extends React.PureComponent< viewBox: '0 0 24 24', size: 24, } - - state: { hoverd: boolean } = { hoverd: false } - + state: { + hoverd: boolean + } = { + hoverd: false, + } handleMouseEnter = (event: Event) => { - this.setState({ hoverd: true }) + this.setState({ + hoverd: true, + }) this.props.onMouseEnter(event) } - handleMouseLeave = (event: Event) => { - this.setState({ hoverd: false }) + this.setState({ + hoverd: false, + }) this.props.onMouseLeave(event) } @@ -88,10 +100,8 @@ export default class Icon extends React.PureComponent< size, className, } = this.props - const offColor = color ? color : 'currentColor' const onColor = hoverColor ? hoverColor : offColor - const mergedStyles = { fill: this.state.hoverd ? onColor : offColor, display: 'inline-block', @@ -100,7 +110,6 @@ export default class Icon extends React.PureComponent< userSelect: 'none', ...style, } - return ( <svg viewBox={viewBox} diff --git a/package.json b/package.json index 1c7744f9..29445b97 100644 --- a/package.json +++ b/package.json @@ -21,17 +21,16 @@ "test:ci": "cross-env NODE_ENV=test npm run flow && npm run jest --ci", "test:watch": "cross-env NODE_ENV=test jest --watch", "jest": "cross-env NODE_ENV=test jest", - "fmt": "prettier --write '**/*.{js,json,md}'", + "fmt": "prettier --write '**/*.{js,json,md,ts,tsx}'", "build": "npm run build:main && npm run build:renderer", "s2s": "babel-node ./config/scripts/s2s.js", - "flow": "flow", "i18n": "babel-node ./config/scripts/extract-intl.js", "build:dll": "node config/scripts/webpack build-dll", "build:main": "node config/scripts/webpack build-main", "build:renderer": "node config/scripts/webpack build-renderer", "lint": "npm run lint:js && npm run lint:css", "lint:css": "stylelint \"app/**/*.js\"", - "lint:js": "eslint .", + "lint:js": "eslint \"app/**/*.(tsx,ts)\"", "hot-updates-server": "node config/scripts/webpack hot-server", "start-hot-renderer": "node config/scripts/hot-renderer", "postinstall": "npm run build:dll && electron-builder install-app-deps", @@ -85,6 +84,7 @@ "uuid": "^3.1.0" }, "devDependencies": { + "@akameco/tsconfig": "^0.1.1", "@babel/cli": "7.5.5", "@babel/core": "7.5.5", "@babel/node": "7.5.5", @@ -113,6 +113,7 @@ "cp-file": "7.0.0", "cross-env": "5.2.0", "cross-spawn": "6.0.5", + "del": "^4.0.0", "devtron": "1.4.0", "electron": "5.0.8", "electron-builder": "21.2.0", @@ -126,8 +127,8 @@ "extract-react-intl-messages": "1.0.2", "extract-zip": "1.6.7", "file-loader": "3.0.1", - "flow-bin": "0.76.0", "flow-runtime": "0.17.0", + "flow-to-typescript": "^1.0.0", "husky": "2.7.0", "jest": "24.8.0", "jest-styled-components": "6.3.3", @@ -143,6 +144,7 @@ "stylelint": "10.1.0", "stylelint-config-standard": "18.3.0", "stylelint-processor-styled-components": "1.8.0", + "typescript": "^3.3.3333", "url-loader": "1.1.2", "webpack": "4.39.1", "webpack-bundle-analyzer": "3.4.1", @@ -158,7 +160,7 @@ }, "husky": { "hooks": { - "pre-commit": "npm run flow && lint-staged" + "pre-commit": "lint-staged" } } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..7724ba32 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@akameco/tsconfig", + "compilerOptions": { + "rootDirs": ["types", "styles", "components", "containers"] + } +} diff --git a/yarn.lock b/yarn.lock index 97f33868..6b642193 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,6 +7,11 @@ resolved "https://registry.yarnpkg.com/7zip-bin/-/7zip-bin-5.0.3.tgz#bc5b5532ecafd923a61f2fb097e3b108c0106a3f" integrity sha512-GLyWIFBbGvpKPGo55JyRZAo4lVbnBiD52cKlw/0Vt+wnmKvWJkpZvsjVoaIolyBXDeAQKSicRtqFNPem9w0WYA== +"@akameco/tsconfig@^0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@akameco/tsconfig/-/tsconfig-0.1.1.tgz#c59077afeea345a2bda4a1b7c7511946d0d27182" + integrity sha512-lktKg5RhNqaFauPJDgtQT1iL8Qp/plLoxyXDCzK/CN9joFoTSs4HzW8nd7cZHF+2NWPB+X3uPQRzMs9TVkE+4A== + "@babel/cli@7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.5.5.tgz#bdb6d9169e93e241a08f5f7b0265195bf38ef5ec" @@ -3427,6 +3432,18 @@ del@^3.0.0: pify "^3.0.0" rimraf "^2.2.8" +del@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/del/-/del-4.0.0.tgz#4fa27e92c366cb45b9bdaa56a9b8703dced17437" + integrity sha512-/BnSJ+SuZyLu7xMn48kZY0nMXDi+5KNmR4g8n21Wivsl8+B9njV6/5kcTNE9juSprp0zRWBU28JuHUq0FqK1Nw== + dependencies: + globby "^6.1.0" + is-path-cwd "^2.0.0" + is-path-in-cwd "^2.0.0" + p-map "^2.0.0" + pify "^4.0.1" + rimraf "^2.6.2" + del@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" @@ -4782,16 +4799,16 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== -flow-bin@0.76.0: - version "0.76.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.76.0.tgz#eb00036991c3abc106743fcbc7ee321f02aa4faa" - integrity sha512-ywyEEEDYuItrkpx9HqRhuY78rXYbaWiNZSWgaI0KUGGeOldaTEbCZXosspxTEKqmQTCBW1/02Z2K0kC9C6hqzQ== - flow-runtime@0.17.0: version "0.17.0" resolved "https://registry.yarnpkg.com/flow-runtime/-/flow-runtime-0.17.0.tgz#ff57dd22bd7b0682c7beff20c3590f6a4a8286e3" integrity sha512-x621HugMPrtU68ddiRX0TkNRif9PS6ml3oeP6oo0k+Kv2issqCmifC4ZX59XnLUh9dfmBcj4GoZJXu4oe8L28Q== +flow-to-typescript@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/flow-to-typescript/-/flow-to-typescript-1.0.0.tgz#c12f973a557314f253a8e6a30315ea02acc33d56" + integrity sha512-R7sM1Y/W/F3A9RaGeZTm1pouDZQYB8MDPgIqigNdNYbMJzF3yMrMfE09yRqByFyVuv7qxkPI0eZMhBvb6ATDpw== + flush-write-stream@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" @@ -5973,9 +5990,9 @@ is-path-cwd@^1.0.0: integrity sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0= is-path-cwd@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" - integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.0.0.tgz#d4777a8e227a00096a31f030db3770f84b116c02" + integrity sha512-m5dHHzpOXEiv18JEORttBO64UgTEypx99vCxQLjbBvGhOJxnTNglYoFXxwo6AbsQb79sqqycQEHv2hWkHZAijA== is-path-in-cwd@^1.0.0: version "1.0.1" @@ -5985,11 +6002,11 @@ is-path-in-cwd@^1.0.0: is-path-inside "^1.0.0" is-path-in-cwd@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz#bfe2dca26c69f397265a4009963602935a053acb" - integrity sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ== + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-2.0.0.tgz#68e452a6eec260500cec21e029c0a44cc0dcd2ea" + integrity sha512-6Vz5Gc9s/sDA3JBVu0FzWufm8xaBsqy1zn8Q6gmvGP6nSDMw78aS4poBNeatWjaRpTpxxLn1WOndAiOlk+qY8A== dependencies: - is-path-inside "^2.1.0" + is-path-inside "^1.0.0" is-path-inside@^1.0.0: version "1.0.1" @@ -5998,13 +6015,6 @@ is-path-inside@^1.0.0: dependencies: path-is-inside "^1.0.1" -is-path-inside@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-2.1.0.tgz#7c9810587d659a40d27bcdb4d5616eab059494b2" - integrity sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg== - dependencies: - path-is-inside "^1.0.2" - is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" @@ -9590,7 +9600,7 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" -rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: +rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -10884,6 +10894,11 @@ typescript-tuple@^2.1.0: dependencies: typescript-compare "^0.0.2" +typescript@^3.3.3333: + version "3.3.3333" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6" + integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw== + ua-parser-js@^0.7.18: version "0.7.20" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.20.tgz#7527178b82f6a62a0f243d1f94fd30e3e3c21098" From 84350ed72b34db685d2e0c1398950be038f2c4d6 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Thu, 7 Mar 2019 01:18:14 +0900 Subject: [PATCH 02/25] refactor(types,services): refactor to typescript --- app/services/{api.test.js => api.test.ts} | 7 +- app/services/{api.js => api.ts} | 99 ++++++++++++----------- app/types/account.js | 16 ---- app/types/account.ts | 14 ++++ app/types/illust.js | 49 ----------- app/types/illust.ts | 48 +++++++++++ app/types/index.js | 12 --- app/types/index.ts | 8 ++ app/types/response.js | 7 -- app/types/response.ts | 6 ++ app/types/state.js | 50 ------------ app/types/state.ts | 49 +++++++++++ app/types/user.js | 31 ------- app/types/user.ts | 30 +++++++ 14 files changed, 209 insertions(+), 217 deletions(-) rename app/services/{api.test.js => api.test.ts} (91%) rename app/services/{api.js => api.ts} (55%) delete mode 100644 app/types/account.js create mode 100644 app/types/account.ts delete mode 100644 app/types/illust.js create mode 100644 app/types/illust.ts delete mode 100644 app/types/index.js create mode 100644 app/types/index.ts delete mode 100644 app/types/response.js create mode 100644 app/types/response.ts delete mode 100644 app/types/state.js create mode 100644 app/types/state.ts delete mode 100644 app/types/user.js create mode 100644 app/types/user.ts diff --git a/app/services/api.test.js b/app/services/api.test.ts similarity index 91% rename from app/services/api.test.js rename to app/services/api.test.ts index 6f611ab3..d829cc8a 100644 --- a/app/services/api.test.js +++ b/app/services/api.test.ts @@ -1,11 +1,10 @@ /** * @jest-environment node */ -// @flow import { fetchAuth, getRequest, postRequest } from './api' -const USERNAME: ?string = process.env.USERNAME -const PASSWORD: ?string = process.env.PASSWORD +const USERNAME: string | null | undefined = process.env.USERNAME +const PASSWORD: string | null | undefined = process.env.PASSWORD describe('API', () => { if (!(USERNAME && PASSWORD)) { @@ -45,7 +44,6 @@ describe('API', () => { it.skip('get success', async () => { const { accessToken } = await fetchAuth(info) - const { result } = await getRequest( '/v1/user/detail', { userId: 471355 }, @@ -56,7 +54,6 @@ describe('API', () => { it.skip('post success', async () => { const { accessToken } = await fetchAuth(info) - const postData = await postRequest( '/v2/illust/bookmark/add', { illustId: 63576594, restrict: 'public' }, diff --git a/app/services/api.js b/app/services/api.ts similarity index 55% rename from app/services/api.js rename to app/services/api.ts index b9493298..31cc06d7 100644 --- a/app/services/api.js +++ b/app/services/api.ts @@ -1,11 +1,9 @@ -// @flow -/* eslint-disable camelcase */ +/* eslint-disable @typescript-eslint/camelcase */ import { stringify } from 'querystring' -// $FlowFixMe import { schema, normalize } from 'normalizr' import camelcaseKeys from 'camelcase-keys' import decamelizeKeys from 'decamelize-keys' -import axios from 'axios' +import axios, { AxiosInstance } from 'axios' const userSchema = new schema.Entity('users', { idAttribute: 'id' }) @@ -19,37 +17,33 @@ const mySchema = { illusts: [illustSchema], } -export type Response = { +export interface Response { result: { - illusts: Array<number>, - nextUrl: string, - }, - entities: Object, + illusts: number[] + nextUrl: string + } + entities: object } -function normalizeData(response: Object): Response { +function normalizeData(response: object): Response { return normalize(response, mySchema) } -type UserInfo = { - username: string, - password: string, - refreshToken?: string, +interface UserInfo { + username: string + password: string + refreshToken?: string } - const AUTH_URL = 'https://oauth.secure.pixiv.net/auth/token' - -type AuthResponse = { - accessToken: string, - user: Object, +interface AuthResponse { + accessToken: string + user: object } - const defaultReqConfig = { client_id: 'MOBrBDS8blbauoSck0ZfDbtuzpyT', client_secret: 'lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj', get_secure_url: 1, } - export async function fetchAuth({ username, password, @@ -58,33 +52,31 @@ export async function fetchAuth({ const data = refreshToken ? { ...defaultReqConfig, + // eslint-disable-next-line @typescript-eslint/camelcase grant_type: 'refresh_token', + // eslint-disable-next-line @typescript-eslint/camelcase refresh_token: refreshToken, } - : { - ...defaultReqConfig, - grant_type: 'password', - username, - password, - } - + : { ...defaultReqConfig, grant_type: 'password', username, password } + // eslint-disable-next-line @typescript-eslint/promise-function-async + const transform = (rowData: string): unknown => { + try { + return JSON.parse(rowData) + } catch (error) { + return rowData + } + } const { data: { response }, } = await axios.post(AUTH_URL, stringify(data), { - transformResponse: [ - rowData => { - try { - return JSON.parse(rowData) - } catch (error) { - return rowData - } - }, - ], + transformResponse: [transform], + }) + return camelcaseKeys(response, { + deep: true, }) - return camelcaseKeys(response, { deep: true }) } -function fetchFactory(opts?: Object) { +function fetchFactory(opts?: object): AxiosInstance { return axios.create({ baseURL: 'https://app-api.pixiv.net', headers: { @@ -97,26 +89,37 @@ function fetchFactory(opts?: Object) { }) } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function getRequest( endpoint: string, - params?: Object, - token?: ?string + params?: object, + token?: string | null | undefined ) { const request = fetchFactory( - token ? { Authorization: `Bearer ${token}` } : {} + token + ? { + Authorization: `Bearer ${token}`, + } + : {} ) const { data: result } = await request.get( endpoint, - params ? { params: decamelizeKeys(params) } : null + params + ? { + params: decamelizeKeys(params), + } + : undefined ) - - const camelcasedJSON = camelcaseKeys(result, { deep: true }) + const camelcasedJSON = camelcaseKeys(result, { + deep: true, + }) return normalizeData(camelcasedJSON) } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export async function postRequest( endpoint: string, - data: Object, + data: object, token: string ) { const request = fetchFactory({ @@ -127,5 +130,7 @@ export async function postRequest( endpoint, stringify(decamelizeKeys(data)) ) - return camelcaseKeys(result, { deep: true }) + return camelcaseKeys(result, { + deep: true, + }) } diff --git a/app/types/account.js b/app/types/account.js deleted file mode 100644 index edb92e98..00000000 --- a/app/types/account.js +++ /dev/null @@ -1,16 +0,0 @@ -// @flow - -export type Account = {| - +account: string, - +id: string, - +isMailAuthorized: boolean, - +isPremium: boolean, - +mailAddress: string, - +name: string, - +profileImageUrls: {| - +px16x16: string, - +px50x50: string, - +px170x170: string, - |}, - +xRestrict: number, -|} diff --git a/app/types/account.ts b/app/types/account.ts new file mode 100644 index 00000000..5b34e878 --- /dev/null +++ b/app/types/account.ts @@ -0,0 +1,14 @@ +export interface Account { + account: string + id: string + isMailAuthorized: boolean + isPremium: boolean + mailAddress: string + name: string + profileImageUrls: { + px16x16: string + px50x50: string + px170x170: string + } + xRestrict: number +} diff --git a/app/types/illust.js b/app/types/illust.js deleted file mode 100644 index 55409d88..00000000 --- a/app/types/illust.js +++ /dev/null @@ -1,49 +0,0 @@ -// @flow -export type ImageUrls = {| - squareMedium: string, - medium: string, - large: string, -|} - -export type MetaPages = Array<{| - imageUrls: {| - squareMedium: string, - medium: string, - large: string, - original: string, - |}, -|}> - -export type Tag = {| - name: string, -|} - -export type Illust = {| - id: number, - title: string, - type: 'illust', - imageUrls: $Shape<ImageUrls>, - caption: string, - restrict: number, - user: number, - tags: Array<Tag>, - tools: Array<string>, - createDate: string, - pageCount: number, - width: number, - height: number, - metaSinglePage: { - originalImageUrl?: string, - }, - metaPages?: MetaPages, - totalView: number, - totalBookmarks: number, - isBookmarked: boolean, - visible: boolean, - isMuted: boolean, - totalComments: number, -|} - -type Key = number | string - -export type Illusts = { [key: Key]: Illust } diff --git a/app/types/illust.ts b/app/types/illust.ts new file mode 100644 index 00000000..0b4849ae --- /dev/null +++ b/app/types/illust.ts @@ -0,0 +1,48 @@ +export interface ImageUrls { + squareMedium: string + medium: string + large: string +} + +export type MetaPages = { + imageUrls: { + squareMedium: string + medium: string + large: string + original: string + } +}[] + +export interface Tag { + name: string +} + +export interface Illust { + id: number + title: string + type: 'illust' + imageUrls: Partial<ImageUrls> + caption: string + restrict: number + user: number + tags: Tag[] + tools: string[] + createDate: string + pageCount: number + width: number + height: number + metaSinglePage: { + originalImageUrl?: string + } + metaPages?: MetaPages + totalView: number + totalBookmarks: number + isBookmarked: boolean + visible: boolean + isMuted: boolean + totalComments: number +} + +export interface Illusts { + [key: string]: Illust +} diff --git a/app/types/index.js b/app/types/index.js deleted file mode 100644 index cc4d0df9..00000000 --- a/app/types/index.js +++ /dev/null @@ -1,12 +0,0 @@ -// @flow -import type { Store as ReduxStore, Dispatch as ReduxDispatch } from 'redux' -import type { Action as NextAction } from '../action' -import type { State as BaseState } from './state' - -export type State = BaseState - -export type Action = NextAction - -export type Store = ReduxStore<State, Action> - -export type Dispatch = ReduxDispatch<Action> diff --git a/app/types/index.ts b/app/types/index.ts new file mode 100644 index 00000000..eafd5dd7 --- /dev/null +++ b/app/types/index.ts @@ -0,0 +1,8 @@ +import { Store as ReduxStore, Dispatch as ReduxDispatch } from 'redux' +import { Action as NextAction } from '../action' +import { State as BaseState } from './state' + +export type State = BaseState +export type Action = NextAction +export type Store = ReduxStore<State, Action> +export type Dispatch = ReduxDispatch<Action> diff --git a/app/types/response.js b/app/types/response.js deleted file mode 100644 index 7c0aa418..00000000 --- a/app/types/response.js +++ /dev/null @@ -1,7 +0,0 @@ -// @flow -export type Response = { - response: { - entities: Object, - result: Array<number>, - }, -} diff --git a/app/types/response.ts b/app/types/response.ts new file mode 100644 index 00000000..733747ed --- /dev/null +++ b/app/types/response.ts @@ -0,0 +1,6 @@ +export interface Response { + response: { + entities: object + result: number[] + } +} diff --git a/app/types/state.js b/app/types/state.js deleted file mode 100644 index 7de13934..00000000 --- a/app/types/state.js +++ /dev/null @@ -1,50 +0,0 @@ -// @flow -import type { State as ColumnBookmarkState } from '../containers/ColumnBookmark/reducer' -import type { State as ColumnFollowState } from '../containers/ColumnFollow/reducer' -import type { State as ColumnHistoryState } from '../containers/ColumnHistory/reducer' -import type { State as ColumnManagerState } from '../containers/ColumnManager/reducer' -import type { State as ColumnRankingState } from '../containers/ColumnRanking/reducer' -import type { State as ColumnRankingR18State } from '../containers/ColumnRankingR18/reducer' -import type { State as ColumnRecommendedState } from '../containers/ColumnRecommended/reducer' -import type { State as ColumnSearchState } from '../containers/ColumnSearch/reducer' -import type { State as ColumnUserIllustState } from '../containers/ColumnUserIllust/reducer' -import type { State as DrawerManagerState } from '../containers/DrawerManager/reducer' -import type { State as HeaderContainerState } from '../containers/HeaderContainer/reducer' -import type { State as IllustByIdState } from '../containers/IllustById/reducer' -import type { State as IllustPreviewState } from '../containers/IllustPreview/reducer' -import type { State as LanguageState } from '../containers/Language/reducer' -import type { State as LoginModalState } from '../containers/LoginModal/reducer' -import type { State as MangaPreviewState } from '../containers/MangaPreview/reducer' -import type { State as ModalManegerState } from '../containers/ModalManeger/reducer' -import type { State as SearchFieldState } from '../containers/SearchField/reducer' -import type { State as SettingModalState } from '../containers/SettingModal/reducer' -import type { State as TableState } from '../containers/Table/reducer' -import type { State as UserByIdState } from '../containers/UserById/reducer' -import type { State as UserDrawerContainerState } from '../containers/UserDrawerContainer/reducer' -import type { State as UserPopoverContainerState } from '../containers/UserPopoverContainer/reducer' - -export type State = { - ColumnBookmark: ColumnBookmarkState, - ColumnFollow: ColumnFollowState, - ColumnHistory: ColumnHistoryState, - ColumnManager: ColumnManagerState, - ColumnRankingR18: ColumnRankingR18State, - ColumnRanking: ColumnRankingState, - ColumnRecommended: ColumnRecommendedState, - ColumnSearch: ColumnSearchState, - ColumnUserIllust: ColumnUserIllustState, - DrawerManager: DrawerManagerState, - HeaderContainer: HeaderContainerState, - IllustById: IllustByIdState, - IllustPreview: IllustPreviewState, - Language: LanguageState, - LoginModal: LoginModalState, - MangaPreview: MangaPreviewState, - ModalManeger: ModalManegerState, - SearchField: SearchFieldState, - SettingModal: SettingModalState, - Table: TableState, - UserById: UserByIdState, - UserDrawerContainer: UserDrawerContainerState, - UserPopoverContainer: UserPopoverContainerState, -} diff --git a/app/types/state.ts b/app/types/state.ts new file mode 100644 index 00000000..68473e3e --- /dev/null +++ b/app/types/state.ts @@ -0,0 +1,49 @@ +import { State as ColumnBookmarkState } from '../containers/ColumnBookmark/reducer' +import { State as ColumnFollowState } from '../containers/ColumnFollow/reducer' +import { State as ColumnHistoryState } from '../containers/ColumnHistory/reducer' +import { State as ColumnManagerState } from '../containers/ColumnManager/reducer' +import { State as ColumnRankingState } from '../containers/ColumnRanking/reducer' +import { State as ColumnRankingR18State } from '../containers/ColumnRankingR18/reducer' +import { State as ColumnRecommendedState } from '../containers/ColumnRecommended/reducer' +import { State as ColumnSearchState } from '../containers/ColumnSearch/reducer' +import { State as ColumnUserIllustState } from '../containers/ColumnUserIllust/reducer' +import { State as DrawerManagerState } from '../containers/DrawerManager/reducer' +import { State as HeaderContainerState } from '../containers/HeaderContainer/reducer' +import { State as IllustByIdState } from '../containers/IllustById/reducer' +import { State as IllustPreviewState } from '../containers/IllustPreview/reducer' +import { State as LanguageState } from '../containers/Language/reducer' +import { State as LoginModalState } from '../containers/LoginModal/reducer' +import { State as MangaPreviewState } from '../containers/MangaPreview/reducer' +import { State as ModalManegerState } from '../containers/ModalManeger/reducer' +import { State as SearchFieldState } from '../containers/SearchField/reducer' +import { State as SettingModalState } from '../containers/SettingModal/reducer' +import { State as TableState } from '../containers/Table/reducer' +import { State as UserByIdState } from '../containers/UserById/reducer' +import { State as UserDrawerContainerState } from '../containers/UserDrawerContainer/reducer' +import { State as UserPopoverContainerState } from '../containers/UserPopoverContainer/reducer' + +export interface State { + ColumnBookmark: ColumnBookmarkState + ColumnFollow: ColumnFollowState + ColumnHistory: ColumnHistoryState + ColumnManager: ColumnManagerState + ColumnRankingR18: ColumnRankingR18State + ColumnRanking: ColumnRankingState + ColumnRecommended: ColumnRecommendedState + ColumnSearch: ColumnSearchState + ColumnUserIllust: ColumnUserIllustState + DrawerManager: DrawerManagerState + HeaderContainer: HeaderContainerState + IllustById: IllustByIdState + IllustPreview: IllustPreviewState + Language: LanguageState + LoginModal: LoginModalState + MangaPreview: MangaPreviewState + ModalManeger: ModalManegerState + SearchField: SearchFieldState + SettingModal: SettingModalState + Table: TableState + UserById: UserByIdState + UserDrawerContainer: UserDrawerContainerState + UserPopoverContainer: UserPopoverContainerState +} diff --git a/app/types/user.js b/app/types/user.js deleted file mode 100644 index 1d2961d0..00000000 --- a/app/types/user.js +++ /dev/null @@ -1,31 +0,0 @@ -// @flow -export type User = {| - id: number, - name: string, - account: string, - profileImageUrls: {| - medium: string, - |}, - isFollowed: boolean, - comment?: string, -|} - -export type Profile = { - backgroundImageUrl: string, - birth: string, - gender: string, - isPremium: boolean, - region: string, - totalFollowUsers: number, - totalFollower: number, - totalIllustBookmarksPublic: number, - totalIllusts: number, - totalManga: number, - totalMypixivUsers: number, - totalNovels: number, - twitterAccounts: string, - twitterUrl: ?string, - webpage: string, -} - -export type Users = { [key: number]: User } diff --git a/app/types/user.ts b/app/types/user.ts new file mode 100644 index 00000000..c00e1164 --- /dev/null +++ b/app/types/user.ts @@ -0,0 +1,30 @@ +export interface User { + id: number + name: string + account: string + profileImageUrls: { + medium: string + } + isFollowed: boolean + comment?: string +} +export interface Profile { + backgroundImageUrl: string + birth: string + gender: string + isPremium: boolean + region: string + totalFollowUsers: number + totalFollower: number + totalIllustBookmarksPublic: number + totalIllusts: number + totalManga: number + totalMypixivUsers: number + totalNovels: number + twitterAccounts: string + twitterUrl: string | null | undefined + webpage: string +} +export interface Users { + [key: number]: User +} From b18420b748481d5e402cc3cc1fcec0df3c3f5594 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Thu, 7 Mar 2019 01:41:07 +0900 Subject: [PATCH 03/25] chore(eslint): disable @typescript-eslint/no-explicit-any --- .eslintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 26f3d55f..0abbf5bc 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,11 +14,11 @@ ] }, "rules": { + "@typescript-eslint/no-explicit-any": 0, "no-constant-condition": 0, "import/no-extraneous-dependencies": 0, "import/exports-last": 0, "import/no-unresolved": 0, - "flowtype/no-weak-types": 0, "no-duplicate-imports": 0, "no-invalid-this": 0, "no-warning-comments": 0, From 92235a7dee405e10f32e17b3fa6dcd6bbb3e120d Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Thu, 7 Mar 2019 01:51:59 +0900 Subject: [PATCH 04/25] refactor(utils): typescript --- app/utils/handleEscCreater.js | 10 ------ app/utils/handleEscCreater.ts | 13 +++++++ ...pper.js => intersectionObserverWrapper.ts} | 23 ++++-------- ...{scrollToTopBind.js => scrollToTopBind.ts} | 36 ++++++++++++------- app/utils/update.js | 10 ------ app/utils/update.ts | 13 +++++++ 6 files changed, 56 insertions(+), 49 deletions(-) delete mode 100644 app/utils/handleEscCreater.js create mode 100644 app/utils/handleEscCreater.ts rename app/utils/{intersectionObserverWrapper.js => intersectionObserverWrapper.ts} (61%) rename app/utils/{scrollToTopBind.js => scrollToTopBind.ts} (59%) delete mode 100644 app/utils/update.js create mode 100644 app/utils/update.ts diff --git a/app/utils/handleEscCreater.js b/app/utils/handleEscCreater.js deleted file mode 100644 index 522ccda6..00000000 --- a/app/utils/handleEscCreater.js +++ /dev/null @@ -1,10 +0,0 @@ -// @flow -import keycode from 'keycode' - -const handleEscCreater = (fn: Function) => (event: Event) => { - if (keycode(event) === 'esc') { - fn(event) - } -} - -export default handleEscCreater diff --git a/app/utils/handleEscCreater.ts b/app/utils/handleEscCreater.ts new file mode 100644 index 00000000..b98a3311 --- /dev/null +++ b/app/utils/handleEscCreater.ts @@ -0,0 +1,13 @@ +import keycode from 'keycode' + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +type Fn = (event: any) => any + +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type +const handleEscCreater = (fn: Fn) => (event: Event) => { + if (keycode(event) === 'esc') { + fn(event) + } +} + +export default handleEscCreater diff --git a/app/utils/intersectionObserverWrapper.js b/app/utils/intersectionObserverWrapper.ts similarity index 61% rename from app/utils/intersectionObserverWrapper.js rename to app/utils/intersectionObserverWrapper.ts index 7ed5b99c..ba4a4397 100644 --- a/app/utils/intersectionObserverWrapper.js +++ b/app/utils/intersectionObserverWrapper.ts @@ -1,22 +1,13 @@ -// @flow -declare class IntersectionObserver { - constructor: Function; - observe: Function; - disconnect: Function; -} - -type ID = number | string - export default class IntersectionObserverWrapper { - callbacks: { [key: ID]: Function } = {} - observerBacklog: Array<*> = [] - observer: IntersectionObserver + callbacks: { [key: string]: any } = {} + observerBacklog: any[] = [] + observer: IntersectionObserver | null = null - connect(options: Object) { - const onIntersection = entries => { + connect(options: IntersectionObserverInit) { + const onIntersection: IntersectionObserverCallback = entries => { entries.forEach(entry => { const id = entry.target.getAttribute('data-id') - if (this.callbacks[id]) { + if (id && this.callbacks[id]) { this.callbacks[id](entry) } }) @@ -29,7 +20,7 @@ export default class IntersectionObserverWrapper { this.observerBacklog = [] } - observe(id: ID, node: HTMLElement, callback: Function) { + observe(id: string, node: HTMLElement, callback: any) { if (this.observer) { this.callbacks[id] = callback this.observer.observe(node) diff --git a/app/utils/scrollToTopBind.js b/app/utils/scrollToTopBind.ts similarity index 59% rename from app/utils/scrollToTopBind.js rename to app/utils/scrollToTopBind.ts index ed6c6af5..1eed18fd 100644 --- a/app/utils/scrollToTopBind.js +++ b/app/utils/scrollToTopBind.ts @@ -1,21 +1,25 @@ -// @flow -const easeOutExpo = x => (x === 1 ? 1 : 1 - 2 ** -10 * x) +const easeOutExpo = (x: number): number => (x === 1 ? 1 : 1 - 2 ** -10 * x) -const position = (start, end, elapsed, duration) => { +const position = ( + start: number, + end: number, + elapsed: number, + duration: number +): number => { if (elapsed > duration) { return end } + return start + (end - start) * easeOutExpo(elapsed / duration) } -const scrollTop = (node: HTMLElement, callback?: Function) => { +const scrollTop = (node: HTMLElement, callback?: () => unknown): void => { const clock = Date.now() const duration = 700 - let opacity = 1 const start = node.scrollTop - const step = () => { + const step = (): void => { const elapsed = Date.now() - clock node.scrollTop = position(start, 0, elapsed, duration) @@ -25,19 +29,23 @@ const scrollTop = (node: HTMLElement, callback?: Function) => { } else if (opacity > 0) { opacity -= 0.06 } + node.style.opacity = `${opacity}` requestAnimationFrame(step) } else { node.style.opacity = '1.0' + if (callback) { callback() } } } + step() } -const scrollToTopFactory = (node: HTMLElement, fn?: Function) => ( +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type +const scrollToTopFactory = (node: HTMLElement, fn?: (e: Event) => void) => ( e: Event ): void => { e.preventDefault() @@ -54,13 +62,15 @@ const scrollToTopFactory = (node: HTMLElement, fn?: Function) => ( return } - scrollTop(node, () => { - if (fn) { - fn(e) + scrollTop( + node, + (): void => { + if (fn) { + fn(e) + } } - }) + ) } -export type HandleHeaderClick = Event => void - +export type HandleHeaderClick = (a: Event) => undefined export default scrollToTopFactory diff --git a/app/utils/update.js b/app/utils/update.js deleted file mode 100644 index a22c603c..00000000 --- a/app/utils/update.js +++ /dev/null @@ -1,10 +0,0 @@ -// @flow -function update<T, S: { [*]: T }, A: { +id: * }>( - state: S, - action: A, - subject: $Shape<T> -): S { - return { ...state, [action.id]: { ...state[action.id], ...subject } } -} - -export default update diff --git a/app/utils/update.ts b/app/utils/update.ts new file mode 100644 index 00000000..d87772a6 --- /dev/null +++ b/app/utils/update.ts @@ -0,0 +1,13 @@ +function update< + T, + State extends { + [a: string]: T + }, + Action extends { + id: any + } +>(state: State, action: Action, subject: Partial<T>): State { + return { ...state, [action.id]: { ...state[action.id], ...subject } } +} + +export default update From 5fb32d5aa506142497754ff16e6abe82c3dca30c Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Thu, 7 Mar 2019 01:52:26 +0900 Subject: [PATCH 05/25] chore(eslint): disable @typescript-eslint/explicit-function-return-type --- .eslintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc b/.eslintrc index 0abbf5bc..9d9121d1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -15,6 +15,7 @@ }, "rules": { "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/explicit-function-return-type": 0, "no-constant-condition": 0, "import/no-extraneous-dependencies": 0, "import/exports-last": 0, From e62d18e0666de42208cb3a5811d0ed95e1fc360f Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Thu, 7 Mar 2019 01:53:16 +0900 Subject: [PATCH 06/25] chore(deps): add types --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 29445b97..1b354a40 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,9 @@ "@babel/preset-flow": "7.0.0", "@babel/preset-react": "7.0.0", "@babel/register": "7.5.5", + "@types/camelcase-keys": "^4.0.0", + "@types/jest": "^24.0.9", + "@types/react": "^16.8.6", "all-contributors-cli": "6.8.1", "babel-eslint": "10.0.2", "babel-jest": "24.8.0", From 79eb7691c9fe3e43f14739b26b335d0372308128 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Thu, 7 Mar 2019 02:00:15 +0900 Subject: [PATCH 07/25] refactor(components): ts LazyLoadImg --- .../LazyLoadImg/{index.js => index.tsx} | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) rename app/components/LazyLoadImg/{index.js => index.tsx} (83%) diff --git a/app/components/LazyLoadImg/index.js b/app/components/LazyLoadImg/index.tsx similarity index 83% rename from app/components/LazyLoadImg/index.js rename to app/components/LazyLoadImg/index.tsx index 11ca502a..0805d50e 100644 --- a/app/components/LazyLoadImg/index.js +++ b/app/components/LazyLoadImg/index.tsx @@ -3,12 +3,6 @@ import * as React from 'react' import styled from 'styled-components' import Icon from 'components/common/Icon' -declare class IntersectionObserver { - constructor: Function; - observe: Function; - unobserve: Function; -} - const StyledImg = styled.div` position: relative; width: 100%; @@ -40,15 +34,15 @@ const StyledImg = styled.div` } ` -type Props = { - src: string, - isManga?: boolean, - onClick: Function, +interface Props { + src: string + isManga?: boolean + onClick: () => any } -type State = { - isVisible: boolean, - isLoaded: boolean, +interface State { + isVisible: boolean + isLoaded: boolean } export default class LazyLoadImg extends React.PureComponent<Props, State> { @@ -56,15 +50,17 @@ export default class LazyLoadImg extends React.PureComponent<Props, State> { isVisible: false, isLoaded: false, } - node: HTMLElement - io: IntersectionObserver + node: HTMLElement | null = null + io: IntersectionObserver | null = null componentDidMount() { this.init() } componentWillUnmount() { - this.io.unobserve(this.node) + if (this.io && this.node) { + this.io.unobserve(this.node) + } } init() { @@ -73,7 +69,7 @@ export default class LazyLoadImg extends React.PureComponent<Props, State> { } this.io = new IntersectionObserver( - (entries: Array<{ intersectionRatio: number }>) => { + (entries: { intersectionRatio: number }[]) => { // eslint-disable-line no-undef const intersectionRatio = entries[0].intersectionRatio if (intersectionRatio <= 0) { From 3892cd0270899b16e89e125d904a557042d92627 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Thu, 7 Mar 2019 02:00:54 +0900 Subject: [PATCH 08/25] chore(deps): add @types/styled-components --- package.json | 1 + yarn.lock | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/package.json b/package.json index 1b354a40..d2dfb852 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "@types/camelcase-keys": "^4.0.0", "@types/jest": "^24.0.9", "@types/react": "^16.8.6", + "@types/styled-components": "^4.1.12", "all-contributors-cli": "6.8.1", "babel-eslint": "10.0.2", "babel-jest": "24.8.0", diff --git a/yarn.lock b/yarn.lock index 6b642193..08f15e76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1095,6 +1095,11 @@ dependencies: "@babel/types" "^7.3.0" +"@types/camelcase-keys@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/camelcase-keys/-/camelcase-keys-4.0.0.tgz#528da23e7bd41068ee25e3ba52a96a4d0d263ed5" + integrity sha1-Uo2iPnvUEGjuJeO6UqlqTQ0mPtU= + "@types/debug@^4.1.4": version "4.1.5" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" @@ -1139,6 +1144,18 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" +"@types/jest-diff@*": + version "20.0.1" + resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" + integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA== + +"@types/jest@^24.0.9": + version "24.0.9" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.9.tgz#74ce9cf337f25e189aa18f76ab3d65e8669b55f2" + integrity sha512-k3OOeevcBYLR5pdsOv5g3OP94h3mrJmLPHFEPWgbbVy2tGv0TZ/TlygiC848ogXhK8NL0I5up7YYtwpCp8xCJA== + dependencies: + "@types/jest-diff" "*" + "@types/json-schema@^7.0.3": version "7.0.3" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636" @@ -1164,11 +1181,41 @@ resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== +"@types/prop-types@*": + version "15.7.1" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6" + integrity sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg== + +"@types/react-native@*": + version "0.57.38" + resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.57.38.tgz#2ff6ed1a7cc207afbfd87bf496513d96931d1446" + integrity sha512-bmY2ad/vQgP0HMT7Q7EQzirDBt5ibp+kBHclTnY7/i5MrdqE1oY+3b9NkDg3ohXlumr7p5stAG6I55nhfeUV6Q== + dependencies: + "@types/prop-types" "*" + "@types/react" "*" + +"@types/react@*", "@types/react@^16.8.6": + version "16.8.6" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.6.tgz#fa1de3fe56cc9b6afeddc73d093d7f30fd5e31cc" + integrity sha512-bN9qDjEMltmHrl0PZRI4IF2AbB7V5UlRfG+OOduckVnRQ4VzXVSzy/1eLAh778IEqhTnW0mmgL9yShfinNverA== + dependencies: + "@types/prop-types" "*" + csstype "^2.2.0" + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== +"@types/styled-components@^4.1.12": + version "4.1.12" + resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-4.1.12.tgz#62c19bd1aa37b1a904d36c179a0fec66c24ac99c" + integrity sha512-Du0bltHm5sWkDnXzYi6cMNhnSKWHQW6//at359DtRJNfjeG1SdtqQPX6jiVtrUkBJ1JsjxqT18DssYBLJ/fg/A== + dependencies: + "@types/react" "*" + "@types/react-native" "*" + csstype "^2.2.0" + "@types/unist@*", "@types/unist@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e" @@ -3262,6 +3309,11 @@ cssstyle@^1.0.0: dependencies: cssom "0.3.x" +csstype@^2.2.0: + version "2.6.6" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.6.tgz#c34f8226a94bbb10c32cc0d714afdf942291fc41" + integrity sha512-RpFbQGUE74iyPgvr46U9t1xoQBM8T4BL8SxrN66Le2xYAPSaDJJKeztV3awugusb3g3G9iL8StmkBBXhcbbXhg== + currently-unhandled@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" From 017f38b616ceee1385c6b18ea981bf5e7d011422 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Thu, 7 Mar 2019 02:38:24 +0900 Subject: [PATCH 09/25] refactor(reducer,action): typescript --- .eslintrc | 1 + app/action.js | 58 -------------- app/action.ts | 54 +++++++++++++ app/containers/AddColumnModal/Card.js | 6 +- app/containers/AddColumnModal/LinkButton.js | 6 +- app/containers/AddNewColumnButton/Button.js | 4 +- app/containers/Api/actionTypes.js | 9 --- app/containers/Api/actionTypes.ts | 7 ++ app/containers/Api/{actions.js => actions.ts} | 5 +- .../Api/{constants.js => constants.ts} | 3 +- .../BookmarkButton/BookmarkButton.js | 8 +- app/containers/BookmarkButton/actionTypes.js | 29 ------- app/containers/BookmarkButton/actionTypes.ts | 23 ++++++ .../BookmarkButton/{actions.js => actions.ts} | 10 +-- .../{constants.js => constants.ts} | 3 +- app/containers/BoxContainer/actionTypes.js | 7 -- app/containers/BoxContainer/actionTypes.ts | 5 ++ .../BoxContainer/{actions.js => actions.ts} | 3 +- .../{constants.js => constants.ts} | 3 +- app/containers/Column/reducer.js | 35 -------- app/containers/Column/reducer.ts | 45 +++++++++++ .../{actionTypes.js => actionTypes.ts} | 45 ++++++----- .../ColumnBookmark/{actions.js => actions.ts} | 18 +---- .../{constants.js => constants.ts} | 3 +- .../ColumnBookmark/{reducer.js => reducer.ts} | 15 ++-- .../{actionTypes.js => actionTypes.ts} | 45 ++++++----- .../ColumnFollow/{actions.js => actions.ts} | 22 ++---- .../{constants.js => constants.ts} | 3 +- .../ColumnFollow/{reducer.js => reducer.ts} | 17 ++-- .../{actionTypes.js => actionTypes.ts} | 14 ++-- .../ColumnHistory/{actions.js => actions.ts} | 4 +- .../{constants.js => constants.ts} | 3 +- app/containers/ColumnHistory/reducer.js | 26 ------ app/containers/ColumnHistory/reducer.ts | 22 ++++++ app/containers/ColumnManager/actionTypes.js | 10 --- app/containers/ColumnManager/actionTypes.ts | 8 ++ .../ColumnManager/{actions.js => actions.ts} | 5 +- .../{constants.js => constants.ts} | 3 +- .../ColumnManager/{reducer.js => reducer.ts} | 24 +++--- .../{actionTypes.js => actionTypes.ts} | 33 ++++---- .../ColumnRanking/{actions.js => actions.ts} | 15 +--- .../{constants.js => constants.ts} | 3 +- .../ColumnRanking/{reducer.js => reducer.ts} | 20 ++--- .../{actionTypes.js => actionTypes.ts} | 34 ++++---- .../{actions.js => actions.ts} | 20 +---- .../{constants.js => constants.ts} | 3 +- .../{reducer.js => reducer.ts} | 19 +++-- .../{actionTypes.js => actionTypes.ts} | 33 ++++---- .../{actions.js => actions.ts} | 13 +-- .../{constants.js => constants.ts} | 3 +- .../{reducer.js => reducer.ts} | 23 +++--- .../ColumnSearch/FilterUsersIn/index.js | 6 +- .../{actionTypes.js => actionTypes.ts} | 79 +++++++++---------- .../ColumnSearch/{actions.js => actions.ts} | 34 +++----- .../{constants.js => constants.ts} | 3 +- .../ColumnSearch/{reducer.js => reducer.ts} | 36 +++++---- .../{actionTypes.js => actionTypes.ts} | 32 ++++---- .../{actions.js => actions.ts} | 17 +--- .../{constants.js => constants.ts} | 3 +- .../{reducer.js => reducer.ts} | 13 ++- .../{actionTypes.js => actionTypes.ts} | 11 ++- .../DrawerManager/{actions.js => actions.ts} | 4 +- .../{constants.js => constants.ts} | 3 +- .../DrawerManager/{reducer.js => reducer.ts} | 18 ++--- .../{actionTypes.js => actionTypes.ts} | 29 +++---- .../FollowButton/{actions.js => actions.ts} | 8 +- .../{constants.js => constants.ts} | 3 +- .../{actionTypes.js => actionTypes.ts} | 9 +-- .../{actions.js => actions.ts} | 6 +- .../{constants.js => constants.ts} | 3 +- .../{reducer.js => reducer.ts} | 15 ++-- .../IllustById/{reducer.js => reducer.ts} | 12 +-- app/containers/IllustPreview/IllustPreview.js | 18 ++--- app/containers/IllustPreview/LazyImg.js | 30 +++---- .../{actionTypes.js => actionTypes.ts} | 16 ++-- .../IllustPreview/{actions.js => actions.ts} | 6 +- .../{constants.js => constants.ts} | 3 +- .../IllustPreview/{reducer.js => reducer.ts} | 22 +++--- app/containers/Language/actionTypes.js | 7 -- app/containers/Language/actionTypes.ts | 5 ++ .../Language/{actions.js => actions.ts} | 3 +- .../Language/{constants.js => constants.ts} | 3 +- .../Language/{reducer.js => reducer.ts} | 14 ++-- .../{actionTypes.js => actionTypes.ts} | 41 +++++----- .../LoginModal/{actions.js => actions.ts} | 14 +--- .../LoginModal/{constants.js => constants.ts} | 3 +- .../LoginModal/{reducer.js => reducer.ts} | 29 ++++--- .../{actionTypes.js => actionTypes.ts} | 11 ++- .../MangaPreview/{actions.js => actions.ts} | 4 +- .../{constants.js => constants.ts} | 3 +- .../MangaPreview/{reducer.js => reducer.ts} | 16 ++-- app/containers/ModalManeger/ModalWrapper.js | 10 +-- app/containers/ModalManeger/actionTypes.js | 9 --- app/containers/ModalManeger/actionTypes.ts | 12 +++ .../ModalManeger/{actions.js => actions.ts} | 6 +- .../{constants.js => constants.ts} | 3 +- .../ModalManeger/{reducer.js => reducer.ts} | 14 ++-- app/containers/Notify/actionTypes.js | 13 --- app/containers/Notify/actionTypes.ts | 11 +++ .../Notify/{actions.js => actions.ts} | 4 +- .../Notify/{constants.js => constants.ts} | 6 +- app/containers/PreviewFactory/Preview.js | 6 +- app/containers/SearchField/Popover.js | 14 ++-- app/containers/SearchField/PopoverAuto.js | 8 +- app/containers/SearchField/UsersOver.js | 6 +- app/containers/SearchField/actionTypes.js | 18 ----- app/containers/SearchField/actionTypes.ts | 16 ++++ .../SearchField/{actions.js => actions.ts} | 7 +- .../{constants.js => constants.ts} | 3 +- .../SearchField/{reducer.js => reducer.ts} | 15 ++-- app/containers/SettingModal/Card.js | 4 +- app/containers/SettingModal/SettingModal.js | 26 +++--- .../{actionTypes.js => actionTypes.ts} | 20 ++--- .../SettingModal/{actions.js => actions.ts} | 7 +- .../{constants.js => constants.ts} | 3 +- .../SettingModal/{reducer.js => reducer.ts} | 18 ++--- .../Table/{actionTypes.js => actionTypes.ts} | 14 ++-- .../Table/{actions.js => actions.ts} | 7 +- .../Table/{constants.js => constants.ts} | 3 +- .../Table/{reducer.js => reducer.ts} | 21 ++--- .../UserById/{reducer.js => reducer.ts} | 12 +-- .../{actionTypes.js => actionTypes.ts} | 71 ++++++++--------- .../{actions.js => actions.ts} | 27 ++----- .../{constants.js => constants.ts} | 3 +- .../{reducer.js => reducer.ts} | 29 +++---- .../{actionTypes.js => actionTypes.ts} | 25 +++--- .../{actions.js => actions.ts} | 8 +- .../{constants.js => constants.ts} | 3 +- .../{reducer.js => reducer.ts} | 19 +++-- package.json | 2 + yarn.lock | 10 +++ 131 files changed, 860 insertions(+), 1075 deletions(-) delete mode 100644 app/action.js create mode 100644 app/action.ts delete mode 100644 app/containers/Api/actionTypes.js create mode 100644 app/containers/Api/actionTypes.ts rename app/containers/Api/{actions.js => actions.ts} (64%) rename app/containers/Api/{constants.js => constants.ts} (55%) delete mode 100644 app/containers/BookmarkButton/actionTypes.js create mode 100644 app/containers/BookmarkButton/actionTypes.ts rename app/containers/BookmarkButton/{actions.js => actions.ts} (91%) rename app/containers/BookmarkButton/{constants.js => constants.ts} (97%) delete mode 100644 app/containers/BoxContainer/actionTypes.js create mode 100644 app/containers/BoxContainer/actionTypes.ts rename app/containers/BoxContainer/{actions.js => actions.ts} (72%) rename app/containers/BoxContainer/{constants.js => constants.ts} (53%) delete mode 100644 app/containers/Column/reducer.js create mode 100644 app/containers/Column/reducer.ts rename app/containers/ColumnBookmark/{actionTypes.js => actionTypes.ts} (62%) rename app/containers/ColumnBookmark/{actions.js => actions.ts} (82%) rename app/containers/ColumnBookmark/{constants.js => constants.ts} (97%) rename app/containers/ColumnBookmark/{reducer.js => reducer.ts} (76%) rename app/containers/ColumnFollow/{actionTypes.js => actionTypes.ts} (68%) rename app/containers/ColumnFollow/{actions.js => actions.ts} (81%) rename app/containers/ColumnFollow/{constants.js => constants.ts} (98%) rename app/containers/ColumnFollow/{reducer.js => reducer.ts} (74%) rename app/containers/ColumnHistory/{actionTypes.js => actionTypes.ts} (57%) rename app/containers/ColumnHistory/{actions.js => actions.ts} (82%) rename app/containers/ColumnHistory/{constants.js => constants.ts} (65%) delete mode 100644 app/containers/ColumnHistory/reducer.js create mode 100644 app/containers/ColumnHistory/reducer.ts delete mode 100644 app/containers/ColumnManager/actionTypes.js create mode 100644 app/containers/ColumnManager/actionTypes.ts rename app/containers/ColumnManager/{actions.js => actions.ts} (60%) rename app/containers/ColumnManager/{constants.js => constants.ts} (52%) rename app/containers/ColumnManager/{reducer.js => reducer.ts} (58%) rename app/containers/ColumnRanking/{actionTypes.js => actionTypes.ts} (70%) rename app/containers/ColumnRanking/{actions.js => actions.ts} (85%) rename app/containers/ColumnRanking/{constants.js => constants.ts} (97%) rename app/containers/ColumnRanking/{reducer.js => reducer.ts} (76%) rename app/containers/ColumnRankingR18/{actionTypes.js => actionTypes.ts} (75%) rename app/containers/ColumnRankingR18/{actions.js => actions.ts} (84%) rename app/containers/ColumnRankingR18/{constants.js => constants.ts} (98%) rename app/containers/ColumnRankingR18/{reducer.js => reducer.ts} (72%) rename app/containers/ColumnRecommended/{actionTypes.js => actionTypes.ts} (65%) rename app/containers/ColumnRecommended/{actions.js => actions.ts} (82%) rename app/containers/ColumnRecommended/{constants.js => constants.ts} (96%) rename app/containers/ColumnRecommended/{reducer.js => reducer.ts} (54%) rename app/containers/ColumnSearch/{actionTypes.js => actionTypes.ts} (65%) rename app/containers/ColumnSearch/{actions.js => actions.ts} (85%) rename app/containers/ColumnSearch/{constants.js => constants.ts} (98%) rename app/containers/ColumnSearch/{reducer.js => reducer.ts} (56%) rename app/containers/ColumnUserIllust/{actionTypes.js => actionTypes.ts} (69%) rename app/containers/ColumnUserIllust/{actions.js => actions.ts} (80%) rename app/containers/ColumnUserIllust/{constants.js => constants.ts} (97%) rename app/containers/ColumnUserIllust/{reducer.js => reducer.ts} (61%) rename app/containers/DrawerManager/{actionTypes.js => actionTypes.ts} (55%) rename app/containers/DrawerManager/{actions.js => actions.ts} (81%) rename app/containers/DrawerManager/{constants.js => constants.ts} (62%) rename app/containers/DrawerManager/{reducer.js => reducer.ts} (61%) rename app/containers/FollowButton/{actionTypes.js => actionTypes.ts} (54%) rename app/containers/FollowButton/{actions.js => actions.ts} (94%) rename app/containers/FollowButton/{constants.js => constants.ts} (96%) rename app/containers/HeaderContainer/{actionTypes.js => actionTypes.ts} (84%) rename app/containers/HeaderContainer/{actions.js => actions.ts} (89%) rename app/containers/HeaderContainer/{constants.js => constants.ts} (95%) rename app/containers/HeaderContainer/{reducer.js => reducer.ts} (83%) rename app/containers/IllustById/{reducer.js => reducer.ts} (51%) rename app/containers/IllustPreview/{actionTypes.js => actionTypes.ts} (73%) rename app/containers/IllustPreview/{actions.js => actions.ts} (90%) rename app/containers/IllustPreview/{constants.js => constants.ts} (95%) rename app/containers/IllustPreview/{reducer.js => reducer.ts} (70%) delete mode 100644 app/containers/Language/actionTypes.js create mode 100644 app/containers/Language/actionTypes.ts rename app/containers/Language/{actions.js => actions.ts} (74%) rename app/containers/Language/{constants.js => constants.ts} (53%) rename app/containers/Language/{reducer.js => reducer.ts} (66%) rename app/containers/LoginModal/{actionTypes.js => actionTypes.ts} (71%) rename app/containers/LoginModal/{actions.js => actions.ts} (91%) rename app/containers/LoginModal/{constants.js => constants.ts} (98%) rename app/containers/LoginModal/{reducer.js => reducer.ts} (78%) rename app/containers/MangaPreview/{actionTypes.js => actionTypes.ts} (54%) rename app/containers/MangaPreview/{actions.js => actions.ts} (83%) rename app/containers/MangaPreview/{constants.js => constants.ts} (91%) rename app/containers/MangaPreview/{reducer.js => reducer.ts} (63%) delete mode 100644 app/containers/ModalManeger/actionTypes.js create mode 100644 app/containers/ModalManeger/actionTypes.ts rename app/containers/ModalManeger/{actions.js => actions.ts} (71%) rename app/containers/ModalManeger/{constants.js => constants.ts} (61%) rename app/containers/ModalManeger/{reducer.js => reducer.ts} (82%) delete mode 100644 app/containers/Notify/actionTypes.js create mode 100644 app/containers/Notify/actionTypes.ts rename app/containers/Notify/{actions.js => actions.ts} (84%) rename app/containers/Notify/{constants.js => constants.ts} (62%) delete mode 100644 app/containers/SearchField/actionTypes.js create mode 100644 app/containers/SearchField/actionTypes.ts rename app/containers/SearchField/{actions.js => actions.ts} (74%) rename app/containers/SearchField/{constants.js => constants.ts} (93%) rename app/containers/SearchField/{reducer.js => reducer.ts} (67%) rename app/containers/SettingModal/{actionTypes.js => actionTypes.ts} (61%) rename app/containers/SettingModal/{actions.js => actions.ts} (91%) rename app/containers/SettingModal/{constants.js => constants.ts} (96%) rename app/containers/SettingModal/{reducer.js => reducer.ts} (81%) rename app/containers/Table/{actionTypes.js => actionTypes.ts} (55%) rename app/containers/Table/{actions.js => actions.ts} (73%) rename app/containers/Table/{constants.js => constants.ts} (92%) rename app/containers/Table/{reducer.js => reducer.ts} (65%) rename app/containers/UserById/{reducer.js => reducer.ts} (51%) rename app/containers/UserDrawerContainer/{actionTypes.js => actionTypes.ts} (57%) rename app/containers/UserDrawerContainer/{actions.js => actions.ts} (82%) rename app/containers/UserDrawerContainer/{constants.js => constants.ts} (99%) rename app/containers/UserDrawerContainer/{reducer.js => reducer.ts} (70%) rename app/containers/UserPopoverContainer/{actionTypes.js => actionTypes.ts} (61%) rename app/containers/UserPopoverContainer/{actions.js => actions.ts} (76%) rename app/containers/UserPopoverContainer/{constants.js => constants.ts} (95%) rename app/containers/UserPopoverContainer/{reducer.js => reducer.ts} (61%) diff --git a/.eslintrc b/.eslintrc index 9d9121d1..5210c081 100644 --- a/.eslintrc +++ b/.eslintrc @@ -16,6 +16,7 @@ "rules": { "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/explicit-function-return-type": 0, + "import/named": 0, "no-constant-condition": 0, "import/no-extraneous-dependencies": 0, "import/exports-last": 0, diff --git a/app/action.js b/app/action.js deleted file mode 100644 index 773f2ec9..00000000 --- a/app/action.js +++ /dev/null @@ -1,58 +0,0 @@ -// @flow -import type { Action as BookmarkButtonAction } from './containers/BookmarkButton/actionTypes' -import type { Action as BoxContainerAction } from './containers/BoxContainer/actionTypes' -import type { Action as ColumnBookmarkAction } from './containers/ColumnBookmark/actionTypes' -import type { Action as ColumnFollowAction } from './containers/ColumnFollow/actionTypes' -import type { Action as ColumnHistoryAction } from './containers/ColumnHistory/actionTypes' -import type { Action as ColumnManagerAction } from './containers/ColumnManager/actionTypes' -import type { Action as ColumnRankingAction } from './containers/ColumnRanking/actionTypes' -import type { Action as ColumnRankingR18Action } from './containers/ColumnRankingR18/actionTypes' -import type { Action as ColumnSearchAction } from './containers/ColumnSearch/actionTypes' -import type { Action as ColumnUserIllustAction } from './containers/ColumnUserIllust/actionTypes' -import type { Action as DrawerManagerAction } from './containers/DrawerManager/actionTypes' -import type { Action as FollowButtonAction } from './containers/FollowButton/actionTypes' -import type { Action as HeaderContainerAction } from './containers/HeaderContainer/actionTypes' -import type { Action as IllustPreviewAction } from './containers/IllustPreview/actionTypes' -import type { Action as LanguageAction } from './containers/Language/actionTypes' -import type { Action as LoginModalAction } from './containers/LoginModal/actionTypes' -import type { Action as MangaPreviewAction } from './containers/MangaPreview/actionTypes' -import type { Action as ModalManegerAction } from './containers/ModalManeger/actionTypes' -import type { Action as SearchFieldAction } from './containers/SearchField/actionTypes' -import type { Action as SettingModalAction } from './containers/SettingModal/actionTypes' -import type { Action as TableAction } from './containers/Table/actionTypes' -import type { Action as UserDrawerContainerAction } from './containers/UserDrawerContainer/actionTypes' -import type { Action as UserPopoverContainerAction } from './containers/UserPopoverContainer/actionTypes' - -import type { Action as NotifyAction } from './containers/Notify/actionTypes' - -import type { Action as ApiAction } from './containers/Api/actionTypes' - -import type { Action as ColumnRecommendedAction } from './containers/ColumnRecommended/actionTypes' - -export type Action = - | BookmarkButtonAction - | BoxContainerAction - | ColumnBookmarkAction - | ColumnFollowAction - | ColumnHistoryAction - | ColumnManagerAction - | ColumnRankingAction - | ColumnRankingR18Action - | ColumnSearchAction - | ColumnUserIllustAction - | DrawerManagerAction - | FollowButtonAction - | HeaderContainerAction - | IllustPreviewAction - | LanguageAction - | LoginModalAction - | MangaPreviewAction - | ModalManegerAction - | SearchFieldAction - | SettingModalAction - | TableAction - | UserDrawerContainerAction - | UserPopoverContainerAction - | NotifyAction - | ApiAction - | ColumnRecommendedAction diff --git a/app/action.ts b/app/action.ts new file mode 100644 index 00000000..52c8abe0 --- /dev/null +++ b/app/action.ts @@ -0,0 +1,54 @@ +import { Action as BookmarkButtonAction } from './containers/BookmarkButton/actionTypes' +import { Action as BoxContainerAction } from './containers/BoxContainer/actionTypes' +import { Action as ColumnBookmarkAction } from './containers/ColumnBookmark/actionTypes' +import { Action as ColumnFollowAction } from './containers/ColumnFollow/actionTypes' +import { Action as ColumnHistoryAction } from './containers/ColumnHistory/actionTypes' +import { Action as ColumnManagerAction } from './containers/ColumnManager/actionTypes' +import { Action as ColumnRankingAction } from './containers/ColumnRanking/actionTypes' +import { Action as ColumnRankingR18Action } from './containers/ColumnRankingR18/actionTypes' +import { Action as ColumnSearchAction } from './containers/ColumnSearch/actionTypes' +import { Action as ColumnUserIllustAction } from './containers/ColumnUserIllust/actionTypes' +import { Action as DrawerManagerAction } from './containers/DrawerManager/actionTypes' +import { Action as FollowButtonAction } from './containers/FollowButton/actionTypes' +import { Action as HeaderContainerAction } from './containers/HeaderContainer/actionTypes' +import { Action as IllustPreviewAction } from './containers/IllustPreview/actionTypes' +import { Action as LanguageAction } from './containers/Language/actionTypes' +import { Action as LoginModalAction } from './containers/LoginModal/actionTypes' +import { Action as MangaPreviewAction } from './containers/MangaPreview/actionTypes' +import { Action as ModalManegerAction } from './containers/ModalManeger/actionTypes' +import { Action as SearchFieldAction } from './containers/SearchField/actionTypes' +import { Action as SettingModalAction } from './containers/SettingModal/actionTypes' +import { Action as TableAction } from './containers/Table/actionTypes' +import { Action as UserDrawerContainerAction } from './containers/UserDrawerContainer/actionTypes' +import { Action as UserPopoverContainerAction } from './containers/UserPopoverContainer/actionTypes' +import { Action as NotifyAction } from './containers/Notify/actionTypes' +import { Action as ApiAction } from './containers/Api/actionTypes' +import { Action as ColumnRecommendedAction } from './containers/ColumnRecommended/actionTypes' + +export type Action = + | BookmarkButtonAction + | BoxContainerAction + | ColumnBookmarkAction + | ColumnFollowAction + | ColumnHistoryAction + | ColumnManagerAction + | ColumnRankingAction + | ColumnRankingR18Action + | ColumnSearchAction + | ColumnUserIllustAction + | DrawerManagerAction + | FollowButtonAction + | HeaderContainerAction + | IllustPreviewAction + | LanguageAction + | LoginModalAction + | MangaPreviewAction + | ModalManegerAction + | SearchFieldAction + | SettingModalAction + | TableAction + | UserDrawerContainerAction + | UserPopoverContainerAction + | NotifyAction + | ApiAction + | ColumnRecommendedAction diff --git a/app/containers/AddColumnModal/Card.js b/app/containers/AddColumnModal/Card.js index 4ff2411d..6ac682f1 100644 --- a/app/containers/AddColumnModal/Card.js +++ b/app/containers/AddColumnModal/Card.js @@ -37,9 +37,9 @@ const List = ({ children }: { children?: React.Node }) => ( <ListWrap>{children}</ListWrap> ) -type Props = { - title: string | React.Element<any>, - children?: React.Node, +interface Props { + title: string | React.Element<any>; + children?: React.Node; } const Card = ({ title, children }: Props) => ( diff --git a/app/containers/AddColumnModal/LinkButton.js b/app/containers/AddColumnModal/LinkButton.js index e60e5e95..107e32b0 100644 --- a/app/containers/AddColumnModal/LinkButton.js +++ b/app/containers/AddColumnModal/LinkButton.js @@ -23,9 +23,9 @@ const InnerButton = styled.div` padding: 10px 16px 10px 17px; ` -type Props = { - text: string | React.Element<any>, - onClick: () => void, +interface Props { + text: string | React.Element<any>; + onClick: () => void; } const LinkButton = ({ text, onClick }: Props) => ( diff --git a/app/containers/AddNewColumnButton/Button.js b/app/containers/AddNewColumnButton/Button.js index 959eeb9e..b869de10 100644 --- a/app/containers/AddNewColumnButton/Button.js +++ b/app/containers/AddNewColumnButton/Button.js @@ -4,8 +4,8 @@ import { FormattedMessage } from 'react-intl' import Button from 'components/common/Button' import messages from './messages' -export type Props = { - onClick: () => void, +export interface Props { + onClick: () => void; } const AddColumnButton = ({ onClick }: Props) => ( diff --git a/app/containers/Api/actionTypes.js b/app/containers/Api/actionTypes.js deleted file mode 100644 index 119a5050..00000000 --- a/app/containers/Api/actionTypes.js +++ /dev/null @@ -1,9 +0,0 @@ -// @flow -import type { Response } from 'services/api' - -export type API_REQUEST_SUCCESS_TYPE = 'Api/API_REQUEST_SUCCESS' - -export type Action = { - +type: API_REQUEST_SUCCESS_TYPE, - +response: Response, -} diff --git a/app/containers/Api/actionTypes.ts b/app/containers/Api/actionTypes.ts new file mode 100644 index 00000000..19b23dba --- /dev/null +++ b/app/containers/Api/actionTypes.ts @@ -0,0 +1,7 @@ +import { Response } from 'services/api' + +export type API_REQUEST_SUCCESS_TYPE = 'Api/API_REQUEST_SUCCESS' +export interface Action { + type: API_REQUEST_SUCCESS_TYPE + response: Response +} diff --git a/app/containers/Api/actions.js b/app/containers/Api/actions.ts similarity index 64% rename from app/containers/Api/actions.js rename to app/containers/Api/actions.ts index 5f191a59..2f59576d 100644 --- a/app/containers/Api/actions.js +++ b/app/containers/Api/actions.ts @@ -1,6 +1,5 @@ -// @flow -import type { Response } from 'services/api' -import type { Action } from './actionTypes' +import { Response } from 'services/api' +import { Action } from './actionTypes' import { API_REQUEST_SUCCESS } from './constants' export function apiRequestSuccess(response: Response): Action { diff --git a/app/containers/Api/constants.js b/app/containers/Api/constants.ts similarity index 55% rename from app/containers/Api/constants.js rename to app/containers/Api/constants.ts index 10a7c1b5..39acce54 100644 --- a/app/containers/Api/constants.js +++ b/app/containers/Api/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { API_REQUEST_SUCCESS_TYPE } from './actionTypes' +import { API_REQUEST_SUCCESS_TYPE } from './actionTypes' export const API_REQUEST_SUCCESS: API_REQUEST_SUCCESS_TYPE = 'Api/API_REQUEST_SUCCESS' diff --git a/app/containers/BookmarkButton/BookmarkButton.js b/app/containers/BookmarkButton/BookmarkButton.js index 15cf8866..72876639 100644 --- a/app/containers/BookmarkButton/BookmarkButton.js +++ b/app/containers/BookmarkButton/BookmarkButton.js @@ -18,10 +18,10 @@ const styles = { const hoverColor = '#b94343' -export type Props = { - addBookmark: () => void, - deleteBookmark: () => void, - isBookmarked: boolean, +export interface Props { + addBookmark: () => void; + deleteBookmark: () => void; + isBookmarked: boolean; } const BookmarkButton = ({ diff --git a/app/containers/BookmarkButton/actionTypes.js b/app/containers/BookmarkButton/actionTypes.js deleted file mode 100644 index 3a724309..00000000 --- a/app/containers/BookmarkButton/actionTypes.js +++ /dev/null @@ -1,29 +0,0 @@ -// @flow -import type { Restrict } from './types' - -export type ADD_BOOKMARK_REQUEST_TYPE = 'BookmarkButton/ADD_BOOKMARK_REQUEST' -export type ADD_BOOKMARK_SUCCESS_TYPE = 'BookmarkButton/ADD_BOOKMARK_SUCCESS' -export type ADD_BOOKMARK_FAILER_TYPE = 'BookmarkButton/ADD_BOOKMARK_FAILER' - -export type DELETE_BOOKMARK_REQUEST_TYPE = - 'BookmarkButton/ELETE_BOOKMARK_REQUEST' -export type DELETE_BOOKMARK_SUCCESS_TYPE = - 'BookmarkButton/DELETE_BOOKMARK_SUCCESS' -export type DELETE_BOOKMARK_FAILER_TYPE = - 'BookmarkButton/DELETE_BOOKMARK_FAILER' - -export type Action = - | {| - +type: ADD_BOOKMARK_REQUEST_TYPE | ADD_BOOKMARK_SUCCESS_TYPE, - +id: number, - +restrict: Restrict, - |} - | {| - +type: DELETE_BOOKMARK_REQUEST_TYPE | DELETE_BOOKMARK_SUCCESS_TYPE, - +id: number, - |} - | {| - +type: ADD_BOOKMARK_FAILER_TYPE | DELETE_BOOKMARK_FAILER_TYPE, - +id: number, - +error: string, - |} diff --git a/app/containers/BookmarkButton/actionTypes.ts b/app/containers/BookmarkButton/actionTypes.ts new file mode 100644 index 00000000..cf400bac --- /dev/null +++ b/app/containers/BookmarkButton/actionTypes.ts @@ -0,0 +1,23 @@ +import { Restrict } from './types' + +export type ADD_BOOKMARK_REQUEST_TYPE = 'BookmarkButton/ADD_BOOKMARK_REQUEST' +export type ADD_BOOKMARK_SUCCESS_TYPE = 'BookmarkButton/ADD_BOOKMARK_SUCCESS' +export type ADD_BOOKMARK_FAILER_TYPE = 'BookmarkButton/ADD_BOOKMARK_FAILER' +export type DELETE_BOOKMARK_REQUEST_TYPE = 'BookmarkButton/ELETE_BOOKMARK_REQUEST' +export type DELETE_BOOKMARK_SUCCESS_TYPE = 'BookmarkButton/DELETE_BOOKMARK_SUCCESS' +export type DELETE_BOOKMARK_FAILER_TYPE = 'BookmarkButton/DELETE_BOOKMARK_FAILER' +export type Action = + | { + type: ADD_BOOKMARK_REQUEST_TYPE | ADD_BOOKMARK_SUCCESS_TYPE + id: number + restrict: Restrict + } + | { + type: DELETE_BOOKMARK_REQUEST_TYPE | DELETE_BOOKMARK_SUCCESS_TYPE + id: number + } + | { + type: ADD_BOOKMARK_FAILER_TYPE | DELETE_BOOKMARK_FAILER_TYPE + id: number + error: string + } diff --git a/app/containers/BookmarkButton/actions.js b/app/containers/BookmarkButton/actions.ts similarity index 91% rename from app/containers/BookmarkButton/actions.js rename to app/containers/BookmarkButton/actions.ts index 8a0c3aa9..2925c818 100644 --- a/app/containers/BookmarkButton/actions.js +++ b/app/containers/BookmarkButton/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_BOOKMARK_REQUEST, ADD_BOOKMARK_SUCCESS, @@ -8,7 +7,7 @@ import { ADD_BOOKMARK_FAILER, DELETE_BOOKMARK_FAILER, } from './constants' -import type { Restrict } from './types' +import { Restrict } from './types' export function addBookmarkRequest(id: number, restrict: Restrict): Action { return { @@ -17,7 +16,6 @@ export function addBookmarkRequest(id: number, restrict: Restrict): Action { restrict, } } - export function addBookmarkSuccess(id: number, restrict: Restrict): Action { return { type: ADD_BOOKMARK_SUCCESS, @@ -25,21 +23,18 @@ export function addBookmarkSuccess(id: number, restrict: Restrict): Action { restrict, } } - export function deleteBookmarkRequest(id: number): Action { return { type: DELETE_BOOKMARK_REQUEST, id, } } - export function deleteBookmarkSuccess(id: number): Action { return { type: DELETE_BOOKMARK_SUCCESS, id, } } - export function addBookmarkFailer(id: number, error: string): Action { return { type: ADD_BOOKMARK_FAILER, @@ -47,7 +42,6 @@ export function addBookmarkFailer(id: number, error: string): Action { error, } } - export function deleteBookmarkFailer(id: number, error: string): Action { return { type: DELETE_BOOKMARK_FAILER, diff --git a/app/containers/BookmarkButton/constants.js b/app/containers/BookmarkButton/constants.ts similarity index 97% rename from app/containers/BookmarkButton/constants.js rename to app/containers/BookmarkButton/constants.ts index a17b0361..65f8aad3 100644 --- a/app/containers/BookmarkButton/constants.js +++ b/app/containers/BookmarkButton/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { ADD_BOOKMARK_REQUEST_TYPE, ADD_BOOKMARK_SUCCESS_TYPE, ADD_BOOKMARK_FAILER_TYPE, diff --git a/app/containers/BoxContainer/actionTypes.js b/app/containers/BoxContainer/actionTypes.js deleted file mode 100644 index a3c24c06..00000000 --- a/app/containers/BoxContainer/actionTypes.js +++ /dev/null @@ -1,7 +0,0 @@ -// @flow -export type OPEN_PIXIV_TYPE = 'BoxContainer/OPEN_PIXIV' - -export type Action = {| - +type: OPEN_PIXIV_TYPE, - id: number, -|} diff --git a/app/containers/BoxContainer/actionTypes.ts b/app/containers/BoxContainer/actionTypes.ts new file mode 100644 index 00000000..6281581a --- /dev/null +++ b/app/containers/BoxContainer/actionTypes.ts @@ -0,0 +1,5 @@ +export type OPEN_PIXIV_TYPE = 'BoxContainer/OPEN_PIXIV' +export interface Action { + type: OPEN_PIXIV_TYPE + id: number +} diff --git a/app/containers/BoxContainer/actions.js b/app/containers/BoxContainer/actions.ts similarity index 72% rename from app/containers/BoxContainer/actions.js rename to app/containers/BoxContainer/actions.ts index 58144ca6..a2c23774 100644 --- a/app/containers/BoxContainer/actions.js +++ b/app/containers/BoxContainer/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { OPEN_PIXIV } from './constants' export function openPixiv(id: number): Action { diff --git a/app/containers/BoxContainer/constants.js b/app/containers/BoxContainer/constants.ts similarity index 53% rename from app/containers/BoxContainer/constants.js rename to app/containers/BoxContainer/constants.ts index ea9a8e23..3797d5b1 100644 --- a/app/containers/BoxContainer/constants.js +++ b/app/containers/BoxContainer/constants.ts @@ -1,4 +1,3 @@ -// @flow -import type { OPEN_PIXIV_TYPE } from './actionTypes' +import { OPEN_PIXIV_TYPE } from './actionTypes' export const OPEN_PIXIV: OPEN_PIXIV_TYPE = 'BoxContainer/OPEN_PIXIV' diff --git a/app/containers/Column/reducer.js b/app/containers/Column/reducer.js deleted file mode 100644 index 01e3f7eb..00000000 --- a/app/containers/Column/reducer.js +++ /dev/null @@ -1,35 +0,0 @@ -// @flow -import update from 'utils/update' - -export type BaseColumn = { - ids: Array<number>, - nextUrl: ?string, -} - -type ActionTypes = { - ADD_COLUMN_SUCCESS: $Subtype<string>, - SET_NEXT_URL: $Subtype<string>, - FETCH_SUCCESS: $Subtype<string>, - FETCH_NEXT_SUCCESS?: $Subtype<string>, - FETCH_NEW_SUCCESS?: $Subtype<string>, -} - -export function baseReducer< - T: BaseColumn, - S: { [*]: T }, - AS: ActionTypes, - A: { +type: $Subtype<string> } ->(name: string, types: AS, state: S, action: A): S { - switch (action.type) { - case types.SET_NEXT_URL: - return update(state, action, { nextUrl: action.nextUrl }) - case types.ADD_COLUMN_SUCCESS: - return update(state, action, { ids: [], nextUrl: null }) - case types.FETCH_SUCCESS: - case types.FETCH_NEXT_SUCCESS: - case types.FETCH_NEW_SUCCESS: - return update(state, action, { ids: action.ids }) - default: - return state - } -} diff --git a/app/containers/Column/reducer.ts b/app/containers/Column/reducer.ts new file mode 100644 index 00000000..91cf10b4 --- /dev/null +++ b/app/containers/Column/reducer.ts @@ -0,0 +1,45 @@ +import update from 'utils/update' +import { AnyAction } from 'redux' + +export interface BaseColumn { + ids: number[] + nextUrl: string | null | undefined +} +interface ActionTypes { + ADD_COLUMN_SUCCESS: Partial<string> + SET_NEXT_URL: Partial<string> + FETCH_SUCCESS: Partial<string> + FETCH_NEXT_SUCCESS?: Partial<string> + FETCH_NEW_SUCCESS?: Partial<string> +} +export function baseReducer< + T extends BaseColumn, + State extends { + [a: string]: T + }, + AS extends ActionTypes, + Action extends AnyAction +>(_name: string, types: AS, state: State, action: Action): State { + switch (action.type) { + case types.SET_NEXT_URL: + return update(state, action, { + nextUrl: action.nextUrl, + }) + + case types.ADD_COLUMN_SUCCESS: + return update(state, action, { + ids: [], + nextUrl: null, + }) + + case types.FETCH_SUCCESS: + case types.FETCH_NEXT_SUCCESS: + case types.FETCH_NEW_SUCCESS: + return update(state, action, { + ids: action.ids, + }) + + default: + return state + } +} diff --git a/app/containers/ColumnBookmark/actionTypes.js b/app/containers/ColumnBookmark/actionTypes.ts similarity index 62% rename from app/containers/ColumnBookmark/actionTypes.js rename to app/containers/ColumnBookmark/actionTypes.ts index 126c856a..a93b774d 100644 --- a/app/containers/ColumnBookmark/actionTypes.js +++ b/app/containers/ColumnBookmark/actionTypes.ts @@ -1,36 +1,43 @@ -// @flow -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export type ADD_COLUMN_TYPE = 'ColumnBookmark/ADD_COLUMN' export type ADD_COLUMN_SUCCESS_TYPE = 'ColumnBookmark/ADD_COLUMN_SUCCESS' export type SET_NEXT_URL_TYPE = 'ColumnBookmark/SET_NEXT_URL' - export type FETCH_TYPE = 'ColumnBookmark/FETCH' export type FETCH_SUCCESS_TYPE = 'ColumnBookmark/FETCH_SUCCESS' export type FETCH_FAILRE_TYPE = 'ColumnBookmark/FETCH_FAILRE' - export type REMOVE_ITEM_TYPE = 'ColumnBookmark/REMOVE_ITEM' - export type FETCH_NEXT_TYPE = 'ColumnBookmark/FETCH_NEXT' export type FETCH_NEXT_SUCCESS_TYPE = 'ColumnBookmark/FETCH_NEXT_SUCCESS' export type FETCH_NEXT_FAILRE_TYPE = 'ColumnBookmark/FETCH_NEXT_FAILRE' - export type Action = - | {| - +type: + | { + type: | ADD_COLUMN_TYPE | ADD_COLUMN_SUCCESS_TYPE | FETCH_TYPE | FETCH_FAILRE_TYPE | FETCH_NEXT_TYPE - | FETCH_NEXT_FAILRE_TYPE, - +id: ColumnId, - |} - | {| +type: SET_NEXT_URL_TYPE, +id: ColumnId, +nextUrl: string |} - | {| +type: REMOVE_ITEM_TYPE, +id: 'public', +item: number |} - | {| - +type: FETCH_SUCCESS_TYPE | FETCH_NEXT_SUCCESS_TYPE, - +id: ColumnId, - +ids: Array<number>, - |} - | {| +type: FETCH_FAILRE_TYPE, +id: ColumnId, +error: string |} + | FETCH_NEXT_FAILRE_TYPE + id: ColumnId + } + | { + type: SET_NEXT_URL_TYPE + id: ColumnId + nextUrl: string + } + | { + type: REMOVE_ITEM_TYPE + id: 'public' + item: number + } + | { + type: FETCH_SUCCESS_TYPE | FETCH_NEXT_SUCCESS_TYPE + id: ColumnId + ids: number[] + } + | { + type: FETCH_FAILRE_TYPE + id: ColumnId + error: string + } diff --git a/app/containers/ColumnBookmark/actions.js b/app/containers/ColumnBookmark/actions.ts similarity index 82% rename from app/containers/ColumnBookmark/actions.js rename to app/containers/ColumnBookmark/actions.ts index 80659f15..beeb2b4a 100644 --- a/app/containers/ColumnBookmark/actions.js +++ b/app/containers/ColumnBookmark/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_COLUMN, ADD_COLUMN_SUCCESS, @@ -12,7 +11,7 @@ import { FETCH_SUCCESS, FETCH_NEXT_SUCCESS, } from './constants' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export function addColumn(id: ColumnId): Action { return { @@ -20,21 +19,18 @@ export function addColumn(id: ColumnId): Action { id, } } - export function addColumnSuccess(id: ColumnId): Action { return { type: ADD_COLUMN_SUCCESS, id, } } - export function fetch(id: ColumnId): Action { return { type: FETCH, id, } } - export function fetchFailre(id: ColumnId, error: string): Action { return { type: FETCH_FAILRE, @@ -42,21 +38,18 @@ export function fetchFailre(id: ColumnId, error: string): Action { error, } } - export function fetchNext(id: ColumnId): Action { return { type: FETCH_NEXT, id, } } - export function fetchNextFailre(id: ColumnId): Action { return { type: FETCH_NEXT_FAILRE, id, } } - export function setNextUrl(id: ColumnId, nextUrl: string): Action { return { type: SET_NEXT_URL, @@ -64,7 +57,6 @@ export function setNextUrl(id: ColumnId, nextUrl: string): Action { nextUrl, } } - export function removeItem(id: 'public', item: number): Action { return { type: REMOVE_ITEM, @@ -72,16 +64,14 @@ export function removeItem(id: 'public', item: number): Action { item, } } - -export function fetchSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_SUCCESS, id, ids, } } - -export function fetchNextSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchNextSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_NEXT_SUCCESS, id, diff --git a/app/containers/ColumnBookmark/constants.js b/app/containers/ColumnBookmark/constants.ts similarity index 97% rename from app/containers/ColumnBookmark/constants.js rename to app/containers/ColumnBookmark/constants.ts index 4924500f..b12ad661 100644 --- a/app/containers/ColumnBookmark/constants.js +++ b/app/containers/ColumnBookmark/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { ADD_COLUMN_TYPE, ADD_COLUMN_SUCCESS_TYPE, SET_NEXT_URL_TYPE, diff --git a/app/containers/ColumnBookmark/reducer.js b/app/containers/ColumnBookmark/reducer.ts similarity index 76% rename from app/containers/ColumnBookmark/reducer.js rename to app/containers/ColumnBookmark/reducer.ts index 9d12ac14..93f174ea 100644 --- a/app/containers/ColumnBookmark/reducer.js +++ b/app/containers/ColumnBookmark/reducer.ts @@ -1,19 +1,15 @@ -// @flow import update from 'utils/update' -import { baseReducer, type BaseColumn } from '../Column/reducer' -import type { Action } from './actionTypes' +import { baseReducer, BaseColumn } from '../Column/reducer' +import { Action } from './actionTypes' import * as Actions from './constants' export type Restrict = 'public' | 'private' - export type ColumnId = Restrict - export type ColumnBookmark = BaseColumn - -export type State = $Shape<{ [ColumnId]: ColumnBookmark }> - +export type State = Partial<{ + [a: string]: ColumnBookmark +}> const initialState: State = {} - export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.REMOVE_ITEM: { @@ -22,6 +18,7 @@ export default function(state: State = initialState, action: Action): State { ids: state.public.ids.filter(id => id !== item), }) } + default: return baseReducer('ColumnBookmark', Actions, state, action) } diff --git a/app/containers/ColumnFollow/actionTypes.js b/app/containers/ColumnFollow/actionTypes.ts similarity index 68% rename from app/containers/ColumnFollow/actionTypes.js rename to app/containers/ColumnFollow/actionTypes.ts index 4a4820e1..cb38c073 100644 --- a/app/containers/ColumnFollow/actionTypes.js +++ b/app/containers/ColumnFollow/actionTypes.ts @@ -1,45 +1,44 @@ -// @flow -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export type ADD_COLUMN_TYPE = 'ColumnFollow/ADD_COLUMN' export type ADD_COLUMN_SUCCESS_TYPE = 'ColumnFollow/ADD_COLUMN_SUCCESS' export type SET_NEXT_URL_TYPE = 'ColumnFollow/SET_NEXT_URL' - export type FETCH_TYPE = 'ColumnFollow/FETCH' export type FETCH_SUCCESS_TYPE = 'ColumnFollow/FETCH_SUCCESS' export type FETCH_FAILRE_TYPE = 'ColumnFollow/FETCH_FAILRE' - export type FETCH_NEXT_TYPE = 'ColumnFollow/FETCH_NEXT' export type FETCH_NEXT_SUCCESS_TYPE = 'ColumnFollow/FETCH_NEXT_SUCCESS' export type FETCH_NEXT_FAILRE_TYPE = 'ColumnFollow/FETCH_NEXT_FAILRE' - export type FETCH_NEW_TYPE = 'ColumnFollow/FETCH_USER_NEW_ILLUST' export type FETCH_NEW_SUCCESS_TYPE = 'ColumnFollow/FETCH_NEW_SUCCESS' export type FETCH_NEW_FAILRE_TYPE = 'ColumnFollow/FETCH_NEW_FAILRE' - export type Action = - | {| - +type: + | { + type: | ADD_COLUMN_TYPE | ADD_COLUMN_SUCCESS_TYPE | FETCH_TYPE | FETCH_FAILRE_TYPE | FETCH_NEW_TYPE | FETCH_NEXT_TYPE - | FETCH_NEXT_FAILRE_TYPE, - +id: ColumnId, - |} - | {| +type: SET_NEXT_URL_TYPE, +id: ColumnId, +nextUrl: string |} - | {| - +type: + | FETCH_NEXT_FAILRE_TYPE + id: ColumnId + } + | { + type: SET_NEXT_URL_TYPE + id: ColumnId + nextUrl: string + } + | { + type: | FETCH_SUCCESS_TYPE | FETCH_NEXT_SUCCESS_TYPE - | FETCH_NEW_SUCCESS_TYPE, - +id: ColumnId, - +ids: Array<number>, - |} - | {| - +type: FETCH_FAILRE_TYPE | FETCH_NEXT_FAILRE_TYPE | FETCH_NEW_FAILRE_TYPE, - +id: ColumnId, - +error: string, - |} + | FETCH_NEW_SUCCESS_TYPE + id: ColumnId + ids: number[] + } + | { + type: FETCH_FAILRE_TYPE | FETCH_NEXT_FAILRE_TYPE | FETCH_NEW_FAILRE_TYPE + id: ColumnId + error: string + } diff --git a/app/containers/ColumnFollow/actions.js b/app/containers/ColumnFollow/actions.ts similarity index 81% rename from app/containers/ColumnFollow/actions.js rename to app/containers/ColumnFollow/actions.ts index 559ed546..05aee065 100644 --- a/app/containers/ColumnFollow/actions.js +++ b/app/containers/ColumnFollow/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_COLUMN, ADD_COLUMN_SUCCESS, @@ -14,7 +13,7 @@ import { FETCH_NEW_SUCCESS, FETCH_NEW_FAILRE, } from './constants' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export function addColumn(id: ColumnId): Action { return { @@ -22,21 +21,18 @@ export function addColumn(id: ColumnId): Action { id, } } - export function addColumnSuccess(id: ColumnId): Action { return { type: ADD_COLUMN_SUCCESS, id, } } - export function fetch(id: ColumnId): Action { return { type: FETCH, id, } } - export function fetchFailre(id: ColumnId, error: string): Action { return { type: FETCH_FAILRE, @@ -44,21 +40,18 @@ export function fetchFailre(id: ColumnId, error: string): Action { error, } } - export function fetchNew(id: ColumnId): Action { return { type: FETCH_NEW, id, } } - export function fetchNext(id: ColumnId): Action { return { type: FETCH_NEXT, id, } } - export function fetchNextFailre(id: ColumnId, error: string): Action { return { type: FETCH_NEXT_FAILRE, @@ -66,7 +59,6 @@ export function fetchNextFailre(id: ColumnId, error: string): Action { error, } } - export function setNextUrl(id: ColumnId, nextUrl: string): Action { return { type: SET_NEXT_URL, @@ -74,31 +66,27 @@ export function setNextUrl(id: ColumnId, nextUrl: string): Action { nextUrl, } } - -export function fetchSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_SUCCESS, id, ids, } } - -export function fetchNextSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchNextSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_NEXT_SUCCESS, id, ids, } } - -export function fetchNewSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchNewSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_NEW_SUCCESS, id, ids, } } - export function fetchNewFailre(id: ColumnId, error: string): Action { return { type: FETCH_NEW_FAILRE, diff --git a/app/containers/ColumnFollow/constants.js b/app/containers/ColumnFollow/constants.ts similarity index 98% rename from app/containers/ColumnFollow/constants.js rename to app/containers/ColumnFollow/constants.ts index 5abdd3ca..39cfcbbc 100644 --- a/app/containers/ColumnFollow/constants.js +++ b/app/containers/ColumnFollow/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { ADD_COLUMN_TYPE, ADD_COLUMN_SUCCESS_TYPE, SET_NEXT_URL_TYPE, diff --git a/app/containers/ColumnFollow/reducer.js b/app/containers/ColumnFollow/reducer.ts similarity index 74% rename from app/containers/ColumnFollow/reducer.js rename to app/containers/ColumnFollow/reducer.ts index 344719c9..8d354195 100644 --- a/app/containers/ColumnFollow/reducer.js +++ b/app/containers/ColumnFollow/reducer.ts @@ -1,22 +1,18 @@ -// @flow import ms from 'ms' import update from 'utils/update' -import { baseReducer, type BaseColumn } from '../Column/reducer' -import type { Action } from './actionTypes' +import { baseReducer, BaseColumn } from '../Column/reducer' +import { Action } from './actionTypes' import * as Actions from './constants' export type Restrict = 'public' | 'private' - export type ColumnId = Restrict - export type ColumnFollow = { - interval: number, + interval: number } & BaseColumn - -export type State = $Shape<{ [ColumnId]: ColumnFollow }> - +export type State = Partial<{ + [a: ColumnId]: ColumnFollow +}> const initialState: State = {} - export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.ADD_COLUMN_SUCCESS: @@ -25,6 +21,7 @@ export default function(state: State = initialState, action: Action): State { nextUrl: null, interval: ms('3m'), }) + default: return baseReducer('ColumnFollow', Actions, state, action) } diff --git a/app/containers/ColumnHistory/actionTypes.js b/app/containers/ColumnHistory/actionTypes.ts similarity index 57% rename from app/containers/ColumnHistory/actionTypes.js rename to app/containers/ColumnHistory/actionTypes.ts index 73c715df..a3dbee7f 100644 --- a/app/containers/ColumnHistory/actionTypes.js +++ b/app/containers/ColumnHistory/actionTypes.ts @@ -1,10 +1,10 @@ -// @flow export type ADD_HISTORY_TYPE = 'ColumnHistory/ADD_HISTORY' export type ADD_COLUMN_HISTORY_TYPE = 'ColumnHistory/ADD_COLUMN_HISTORY' - export type Action = - | {| - +type: ADD_HISTORY_TYPE, - +id: number, - |} - | {| +type: ADD_COLUMN_HISTORY_TYPE |} + | { + type: ADD_HISTORY_TYPE + id: number + } + | { + type: ADD_COLUMN_HISTORY_TYPE + } diff --git a/app/containers/ColumnHistory/actions.js b/app/containers/ColumnHistory/actions.ts similarity index 82% rename from app/containers/ColumnHistory/actions.js rename to app/containers/ColumnHistory/actions.ts index 3185de3a..1b8281dc 100644 --- a/app/containers/ColumnHistory/actions.js +++ b/app/containers/ColumnHistory/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_HISTORY, ADD_COLUMN_HISTORY } from './constants' export function addHistory(id: number): Action { @@ -8,7 +7,6 @@ export function addHistory(id: number): Action { id, } } - export function addColumnHistory(): Action { return { type: ADD_COLUMN_HISTORY, diff --git a/app/containers/ColumnHistory/constants.js b/app/containers/ColumnHistory/constants.ts similarity index 65% rename from app/containers/ColumnHistory/constants.js rename to app/containers/ColumnHistory/constants.ts index fc160059..0c8164a7 100644 --- a/app/containers/ColumnHistory/constants.js +++ b/app/containers/ColumnHistory/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { ADD_HISTORY_TYPE, ADD_COLUMN_HISTORY_TYPE } from './actionTypes' +import { ADD_HISTORY_TYPE, ADD_COLUMN_HISTORY_TYPE } from './actionTypes' export const ADD_HISTORY: ADD_HISTORY_TYPE = 'ColumnHistory/ADD_HISTORY' export const ADD_COLUMN_HISTORY: ADD_COLUMN_HISTORY_TYPE = diff --git a/app/containers/ColumnHistory/reducer.js b/app/containers/ColumnHistory/reducer.js deleted file mode 100644 index 59b141e8..00000000 --- a/app/containers/ColumnHistory/reducer.js +++ /dev/null @@ -1,26 +0,0 @@ -// @flow -import { union } from 'lodash' -import type { Action } from './actionTypes' -import * as Actions from './constants' - -export type ColumnId = 'RANKING' - -export type State = { - illustIds: Array<number>, -} - -const initialState: State = { - illustIds: [], -} - -export default function( - state: State = initialState, - action: Action -): $Shape<State> { - switch (action.type) { - case Actions.ADD_HISTORY: - return { illustIds: union([action.id, ...state.illustIds]) } - default: - return state - } -} diff --git a/app/containers/ColumnHistory/reducer.ts b/app/containers/ColumnHistory/reducer.ts new file mode 100644 index 00000000..6aa636b3 --- /dev/null +++ b/app/containers/ColumnHistory/reducer.ts @@ -0,0 +1,22 @@ +import { union } from 'lodash' +import { Action } from './actionTypes' +import * as Actions from './constants' + +export type ColumnId = 'RANKING' +export interface State { + illustIds: number[] +} +const initialState: State = { + illustIds: [], +} +export default function(state: State = initialState, action: Action): State { + switch (action.type) { + case Actions.ADD_HISTORY: + return { + illustIds: union([action.id, ...state.illustIds]), + } + + default: + return state + } +} diff --git a/app/containers/ColumnManager/actionTypes.js b/app/containers/ColumnManager/actionTypes.js deleted file mode 100644 index 87ca00d4..00000000 --- a/app/containers/ColumnManager/actionTypes.js +++ /dev/null @@ -1,10 +0,0 @@ -// @flow -import type { ColumnManagerId, ColumnManager } from './reducer' - -export type ADD_TABLE_TYPE = 'ColumnManager/ADD_TABLE' - -export type Action = { - +type: ADD_TABLE_TYPE, - +id: ColumnManagerId, - +maneger: ColumnManager, -} diff --git a/app/containers/ColumnManager/actionTypes.ts b/app/containers/ColumnManager/actionTypes.ts new file mode 100644 index 00000000..475b7ef4 --- /dev/null +++ b/app/containers/ColumnManager/actionTypes.ts @@ -0,0 +1,8 @@ +import { ColumnManagerId, ColumnManager } from './reducer' + +export type ADD_TABLE_TYPE = 'ColumnManager/ADD_TABLE' +export interface Action { + type: ADD_TABLE_TYPE + id: ColumnManagerId + maneger: ColumnManager +} diff --git a/app/containers/ColumnManager/actions.js b/app/containers/ColumnManager/actions.ts similarity index 60% rename from app/containers/ColumnManager/actions.js rename to app/containers/ColumnManager/actions.ts index ffffca54..13bdf122 100644 --- a/app/containers/ColumnManager/actions.js +++ b/app/containers/ColumnManager/actions.ts @@ -1,7 +1,6 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_TABLE } from './constants' -import type { ColumnManagerId, ColumnManager } from './reducer' +import { ColumnManagerId, ColumnManager } from './reducer' export function addTable(id: ColumnManagerId, maneger: ColumnManager): Action { return { diff --git a/app/containers/ColumnManager/constants.js b/app/containers/ColumnManager/constants.ts similarity index 52% rename from app/containers/ColumnManager/constants.js rename to app/containers/ColumnManager/constants.ts index 4d54fca7..6dd9e29a 100644 --- a/app/containers/ColumnManager/constants.js +++ b/app/containers/ColumnManager/constants.ts @@ -1,4 +1,3 @@ -// @flow -import type { ADD_TABLE_TYPE } from './actionTypes' +import { ADD_TABLE_TYPE } from './actionTypes' export const ADD_TABLE: ADD_TABLE_TYPE = 'ColumnManager/ADD_TABLE' diff --git a/app/containers/ColumnManager/reducer.js b/app/containers/ColumnManager/reducer.ts similarity index 58% rename from app/containers/ColumnManager/reducer.js rename to app/containers/ColumnManager/reducer.ts index 39a58450..780365e8 100644 --- a/app/containers/ColumnManager/reducer.js +++ b/app/containers/ColumnManager/reducer.ts @@ -1,6 +1,5 @@ -// @flow import update from 'utils/update' -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' export type ColumnManagerId = string @@ -14,24 +13,21 @@ export type ColumnType = | 'SEARCH' | 'HISTORY' | 'RECOMMENDED' - -export type ColumnManager = { - columnId: ColumnId, - type: ColumnType, +export interface ColumnManager { + columnId: ColumnId + type: ColumnType } - -export type Column = { - title: string, +export interface Column { + title: string } - -export type State = { - [id: ColumnManagerId]: ColumnManager, +export interface State { + [id: string]: ColumnManager } - -export default function(state: State = {}, action: Action): $Shape<State> { +export default function(state: State = {}, action: Action): State { switch (action.type) { case Actions.ADD_TABLE: return update(state, action, action.maneger) + default: return state } diff --git a/app/containers/ColumnRanking/actionTypes.js b/app/containers/ColumnRanking/actionTypes.ts similarity index 70% rename from app/containers/ColumnRanking/actionTypes.js rename to app/containers/ColumnRanking/actionTypes.ts index 4caa2151..457ca4f5 100644 --- a/app/containers/ColumnRanking/actionTypes.js +++ b/app/containers/ColumnRanking/actionTypes.ts @@ -1,34 +1,33 @@ -// @flow -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export type ADD_COLUMN_TYPE = 'ColumnRanking/ADD_COLUMN' export type ADD_COLUMN_SUCCESS_TYPE = 'ColumnRanking/ADD_COLUMN_SUCCESS' export type SET_NEXT_URL_TYPE = 'ColumnRanking/SET_NEXT_URL' - export type CLERE_TYPE = 'ColumnRanking/CLERE' - export type FETCH_TYPE = 'ColumnRanking/FETCH' export type FETCH_SUCCESS_TYPE = 'ColumnRanking/FETCH_SUCCESS' export type FETCH_FAILRE_TYPE = 'ColumnRanking/FETCH_FAILRE' - export type START_WATCH_TYPE = 'ColumnRanking/START_WATCH' export type WATCH_NEW_TYPE = 'ColumnRanking/WATCH_NEW' - export type Action = - | {| - +type: + | { + type: | ADD_COLUMN_TYPE | ADD_COLUMN_SUCCESS_TYPE | CLERE_TYPE | FETCH_TYPE | FETCH_FAILRE_TYPE | WATCH_NEW_TYPE - | START_WATCH_TYPE, - +id: ColumnId, - |} - | {| +type: SET_NEXT_URL_TYPE, +id: ColumnId, +nextUrl: string |} - | {| - +type: FETCH_SUCCESS_TYPE, - +id: ColumnId, - +ids: Array<number>, - |} + | START_WATCH_TYPE + id: ColumnId + } + | { + type: SET_NEXT_URL_TYPE + id: ColumnId + nextUrl: string + } + | { + type: FETCH_SUCCESS_TYPE + id: ColumnId + ids: number[] + } diff --git a/app/containers/ColumnRanking/actions.js b/app/containers/ColumnRanking/actions.ts similarity index 85% rename from app/containers/ColumnRanking/actions.js rename to app/containers/ColumnRanking/actions.ts index 4f3b3e47..23b369cd 100644 --- a/app/containers/ColumnRanking/actions.js +++ b/app/containers/ColumnRanking/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_COLUMN, ADD_COLUMN_SUCCESS, @@ -11,7 +10,7 @@ import { SET_NEXT_URL, FETCH_SUCCESS, } from './constants' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export function addColumn(id: ColumnId): Action { return { @@ -19,49 +18,42 @@ export function addColumn(id: ColumnId): Action { id, } } - export function addColumnSuccess(id: ColumnId): Action { return { type: ADD_COLUMN_SUCCESS, id, } } - export function clere(id: ColumnId): Action { return { type: CLERE, id, } } - export function fetch(id: ColumnId): Action { return { type: FETCH, id, } } - export function fetchFailre(id: ColumnId): Action { return { type: FETCH_FAILRE, id, } } - export function watchNew(id: ColumnId): Action { return { type: WATCH_NEW, id, } } - export function startWatch(id: ColumnId): Action { return { type: START_WATCH, id, } } - export function setNextUrl(id: ColumnId, nextUrl: string): Action { return { type: SET_NEXT_URL, @@ -69,8 +61,7 @@ export function setNextUrl(id: ColumnId, nextUrl: string): Action { nextUrl, } } - -export function fetchSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_SUCCESS, id, diff --git a/app/containers/ColumnRanking/constants.js b/app/containers/ColumnRanking/constants.ts similarity index 97% rename from app/containers/ColumnRanking/constants.js rename to app/containers/ColumnRanking/constants.ts index bfa81489..7d7bf344 100644 --- a/app/containers/ColumnRanking/constants.js +++ b/app/containers/ColumnRanking/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { ADD_COLUMN_TYPE, ADD_COLUMN_SUCCESS_TYPE, SET_NEXT_URL_TYPE, diff --git a/app/containers/ColumnRanking/reducer.js b/app/containers/ColumnRanking/reducer.ts similarity index 76% rename from app/containers/ColumnRanking/reducer.js rename to app/containers/ColumnRanking/reducer.ts index 794bee11..50904c1c 100644 --- a/app/containers/ColumnRanking/reducer.js +++ b/app/containers/ColumnRanking/reducer.ts @@ -1,8 +1,7 @@ -// @flow import ms from 'ms' import update from 'utils/update' -import { baseReducer, type BaseColumn } from '../Column/reducer' -import type { Action } from './actionTypes' +import { baseReducer, BaseColumn } from '../Column/reducer' +import { Action } from './actionTypes' import * as Actions from './constants' export type Mode = @@ -13,15 +12,14 @@ export type Mode = | 'day_female' | 'week_original' | 'week_rookie' - export type ColumnId = Mode - -export type ColumnRanking = { interval: number } & BaseColumn - -export type State = $Shape<{ [Mode]: ColumnRanking }> - +export type ColumnRanking = { + interval: number +} & BaseColumn +export type State = $Shape<{ + [a: Mode]: ColumnRanking +}> export const initialState: State = {} - export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.ADD_COLUMN_SUCCESS: @@ -30,12 +28,14 @@ export default function(state: State = initialState, action: Action): State { nextUrl: null, interval: ms('3h'), }) + case Actions.CLERE: return update(state, action, { ids: [], nextUrl: null, interval: ms('3h'), }) + default: return baseReducer('ColumnRanking', Actions, state, action) } diff --git a/app/containers/ColumnRankingR18/actionTypes.js b/app/containers/ColumnRankingR18/actionTypes.ts similarity index 75% rename from app/containers/ColumnRankingR18/actionTypes.js rename to app/containers/ColumnRankingR18/actionTypes.ts index f3747203..89512424 100644 --- a/app/containers/ColumnRankingR18/actionTypes.js +++ b/app/containers/ColumnRankingR18/actionTypes.ts @@ -1,26 +1,20 @@ -// @flow -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export type ADD_COLUMN_TYPE = 'ColumnRankingR18/ADD_COLUMN' export type ADD_COLUMN_SUCCESS_TYPE = 'ColumnRankingR18/ADD_COLUMN_SUCCESS' export type SET_NEXT_URL_TYPE = 'ColumnRankingR18/SET_NEXT_URL' - export type CLERE_TYPE = 'ColumnRankingR18/CLERE' - export type FETCH_TYPE = 'ColumnRankingR18/FETCH' export type FETCH_SUCCESS_TYPE = 'ColumnRankingR18/FETCH_SUCCESS' export type FETCH_FAILRE_TYPE = 'ColumnRankingR18/FETCH_FAILRE' - export type FETCH_NEXT_TYPE = 'ColumnRankingR18/FETCH_NEXT' export type FETCH_NEXT_SUCCESS_TYPE = 'ColumnRankingR18/FETCH_NEXT_SUCCESS' export type FETCH_NEXT_FAILRE_TYPE = 'ColumnRankingR18/FETCH_NEXT_FAILRE' - export type START_WATCH_TYPE = 'ColumnRankingR18/START_WATCH' export type WATCH_NEW_TYPE = 'ColumnRankingR18/WATCH_NEW' - export type Action = - | {| - +type: + | { + type: | ADD_COLUMN_TYPE | ADD_COLUMN_SUCCESS_TYPE | CLERE_TYPE @@ -29,12 +23,16 @@ export type Action = | FETCH_TYPE | FETCH_FAILRE_TYPE | WATCH_NEW_TYPE - | START_WATCH_TYPE, - +id: ColumnId, - |} - | {| +type: SET_NEXT_URL_TYPE, +id: ColumnId, +nextUrl: string |} - | {| - +type: FETCH_SUCCESS_TYPE | FETCH_NEXT_SUCCESS_TYPE, - +id: ColumnId, - +ids: Array<number>, - |} + | START_WATCH_TYPE + id: ColumnId + } + | { + type: SET_NEXT_URL_TYPE + id: ColumnId + nextUrl: string + } + | { + type: FETCH_SUCCESS_TYPE | FETCH_NEXT_SUCCESS_TYPE + id: ColumnId + ids: number[] + } diff --git a/app/containers/ColumnRankingR18/actions.js b/app/containers/ColumnRankingR18/actions.ts similarity index 84% rename from app/containers/ColumnRankingR18/actions.js rename to app/containers/ColumnRankingR18/actions.ts index a5e32c40..cff3216b 100644 --- a/app/containers/ColumnRankingR18/actions.js +++ b/app/containers/ColumnRankingR18/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_COLUMN, ADD_COLUMN_SUCCESS, @@ -14,7 +13,7 @@ import { FETCH_SUCCESS, FETCH_NEXT_SUCCESS, } from './constants' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export function addColumn(id: ColumnId): Action { return { @@ -22,63 +21,54 @@ export function addColumn(id: ColumnId): Action { id, } } - export function addColumnSuccess(id: ColumnId): Action { return { type: ADD_COLUMN_SUCCESS, id, } } - export function clere(id: ColumnId): Action { return { type: CLERE, id, } } - export function fetchNext(id: ColumnId): Action { return { type: FETCH_NEXT, id, } } - export function fetchNextFailre(id: ColumnId): Action { return { type: FETCH_NEXT_FAILRE, id, } } - export function fetch(id: ColumnId): Action { return { type: FETCH, id, } } - export function fetchFailre(id: ColumnId): Action { return { type: FETCH_FAILRE, id, } } - export function watchNew(id: ColumnId): Action { return { type: WATCH_NEW, id, } } - export function startWatch(id: ColumnId): Action { return { type: START_WATCH, id, } } - export function setNextUrl(id: ColumnId, nextUrl: string): Action { return { type: SET_NEXT_URL, @@ -86,16 +76,14 @@ export function setNextUrl(id: ColumnId, nextUrl: string): Action { nextUrl, } } - -export function fetchSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_SUCCESS, id, ids, } } - -export function fetchNextSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchNextSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_NEXT_SUCCESS, id, diff --git a/app/containers/ColumnRankingR18/constants.js b/app/containers/ColumnRankingR18/constants.ts similarity index 98% rename from app/containers/ColumnRankingR18/constants.js rename to app/containers/ColumnRankingR18/constants.ts index 786abab7..ac1ef93e 100644 --- a/app/containers/ColumnRankingR18/constants.js +++ b/app/containers/ColumnRankingR18/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { ADD_COLUMN_TYPE, ADD_COLUMN_SUCCESS_TYPE, SET_NEXT_URL_TYPE, diff --git a/app/containers/ColumnRankingR18/reducer.js b/app/containers/ColumnRankingR18/reducer.ts similarity index 72% rename from app/containers/ColumnRankingR18/reducer.js rename to app/containers/ColumnRankingR18/reducer.ts index d237c646..6538d25c 100644 --- a/app/containers/ColumnRankingR18/reducer.js +++ b/app/containers/ColumnRankingR18/reducer.ts @@ -1,8 +1,7 @@ -// @flow import ms from 'ms' import update from 'utils/update' -import { baseReducer, type BaseColumn } from '../Column/reducer' -import type { Action } from './actionTypes' +import { baseReducer, BaseColumn } from '../Column/reducer' +import { Action } from './actionTypes' import * as Actions from './constants' export type R18Mode = @@ -11,15 +10,14 @@ export type R18Mode = | 'day_male_r18' | 'day_female_r18' | 'week_r18g' - export type ColumnId = R18Mode - -export type ColumnRankingR18 = { interval: number } & BaseColumn - -export type State = { [R18Mode]: $Shape<ColumnRankingR18> } - +export type ColumnRankingR18 = { + interval: number +} & BaseColumn +export interface State { + [a: string]: Partial<ColumnRankingR18> +} export const initialState: State = {} - export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.ADD_COLUMN_SUCCESS: @@ -29,6 +27,7 @@ export default function(state: State = initialState, action: Action): State { nextUrl: null, interval: ms('3h'), }) + default: return baseReducer('ColumnRankingR18', Actions, state, action) } diff --git a/app/containers/ColumnRecommended/actionTypes.js b/app/containers/ColumnRecommended/actionTypes.ts similarity index 65% rename from app/containers/ColumnRecommended/actionTypes.js rename to app/containers/ColumnRecommended/actionTypes.ts index 8118f1b9..45cf4c74 100644 --- a/app/containers/ColumnRecommended/actionTypes.js +++ b/app/containers/ColumnRecommended/actionTypes.ts @@ -1,30 +1,29 @@ -// @flow -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export type ADD_COLUMN_TYPE = 'ColumnRecommended/ADD_COLUMN' export type ADD_COLUMN_SUCCESS_TYPE = 'ColumnRecommended/ADD_COLUMN_SUCCESS' - export type SET_NEXT_URL_TYPE = 'ColumnRecommended/SET_NEXT_URL' - export type CLERE_TYPE = 'ColumnRecommended/CLERE' - export type FETCH_TYPE = 'ColumnRecommended/FETCH' export type FETCH_SUCCESS_TYPE = 'ColumnRecommended/FETCH_SUCCESS' export type FETCH_FAILRE_TYPE = 'ColumnRecommended/FETCH_FAILRE' - export type Action = - | {| - +type: + | { + type: | ADD_COLUMN_TYPE | ADD_COLUMN_SUCCESS_TYPE | CLERE_TYPE | FETCH_TYPE - | FETCH_FAILRE_TYPE, - +id: ColumnId, - |} - | {| +type: SET_NEXT_URL_TYPE, +id: ColumnId, +nextUrl: string |} - | {| - +type: FETCH_SUCCESS_TYPE, - +id: ColumnId, - +ids: Array<number>, - |} + | FETCH_FAILRE_TYPE + id: ColumnId + } + | { + type: SET_NEXT_URL_TYPE + id: ColumnId + nextUrl: string + } + | { + type: FETCH_SUCCESS_TYPE + id: ColumnId + ids: number[] + } diff --git a/app/containers/ColumnRecommended/actions.js b/app/containers/ColumnRecommended/actions.ts similarity index 82% rename from app/containers/ColumnRecommended/actions.js rename to app/containers/ColumnRecommended/actions.ts index 19262d6c..96db99ee 100644 --- a/app/containers/ColumnRecommended/actions.js +++ b/app/containers/ColumnRecommended/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_COLUMN, ADD_COLUMN_SUCCESS, @@ -9,7 +8,7 @@ import { SET_NEXT_URL, FETCH_SUCCESS, } from './constants' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export function addColumn(id: ColumnId): Action { return { @@ -17,35 +16,30 @@ export function addColumn(id: ColumnId): Action { id, } } - export function addColumnSuccess(id: ColumnId): Action { return { type: ADD_COLUMN_SUCCESS, id, } } - export function clere(id: ColumnId): Action { return { type: CLERE, id, } } - export function fetch(id: ColumnId): Action { return { type: FETCH, id, } } - export function fetchFailre(id: ColumnId): Action { return { type: FETCH_FAILRE, id, } } - export function setNextUrl(id: ColumnId, nextUrl: string): Action { return { type: SET_NEXT_URL, @@ -53,8 +47,7 @@ export function setNextUrl(id: ColumnId, nextUrl: string): Action { nextUrl, } } - -export function fetchSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_SUCCESS, id, diff --git a/app/containers/ColumnRecommended/constants.js b/app/containers/ColumnRecommended/constants.ts similarity index 96% rename from app/containers/ColumnRecommended/constants.js rename to app/containers/ColumnRecommended/constants.ts index 8b279d62..1e49561c 100644 --- a/app/containers/ColumnRecommended/constants.js +++ b/app/containers/ColumnRecommended/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { ADD_COLUMN_TYPE, ADD_COLUMN_SUCCESS_TYPE, SET_NEXT_URL_TYPE, diff --git a/app/containers/ColumnRecommended/reducer.js b/app/containers/ColumnRecommended/reducer.ts similarity index 54% rename from app/containers/ColumnRecommended/reducer.js rename to app/containers/ColumnRecommended/reducer.ts index d4621685..a3b4d9d5 100644 --- a/app/containers/ColumnRecommended/reducer.js +++ b/app/containers/ColumnRecommended/reducer.ts @@ -1,21 +1,24 @@ -// @flow import update from 'utils/update' -import { baseReducer, type BaseColumn } from '../Column/reducer' -import type { Action } from './actionTypes' +import { baseReducer, BaseColumn } from '../Column/reducer' +import { Action } from './actionTypes' import * as Actions from './constants' export type ColumnId = 'recommended' - export type ColumnRecommended = BaseColumn - -export type State = { recommended: $Shape<ColumnRecommended> } - -const initialState: State = { recommended: {} } - +export interface State { + recommended: $Shape<ColumnRecommended> +} +const initialState: State = { + recommended: {}, +} export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.CLERE: - return update(state, action, { ids: [], nextUrl: null }) + return update(state, action, { + ids: [], + nextUrl: null, + }) + default: return baseReducer('ColumnRecommended', Actions, state, action) } diff --git a/app/containers/ColumnSearch/FilterUsersIn/index.js b/app/containers/ColumnSearch/FilterUsersIn/index.js index 1bd48c91..5d89e843 100644 --- a/app/containers/ColumnSearch/FilterUsersIn/index.js +++ b/app/containers/ColumnSearch/FilterUsersIn/index.js @@ -13,9 +13,9 @@ const styles = { color: '#eee', } -type Props = { - defaultValue: string, - onChange: Function, +interface Props { + defaultValue: string; + onChange: Function; } class FilterUsersIn extends React.Component<Props> { diff --git a/app/containers/ColumnSearch/actionTypes.js b/app/containers/ColumnSearch/actionTypes.ts similarity index 65% rename from app/containers/ColumnSearch/actionTypes.js rename to app/containers/ColumnSearch/actionTypes.ts index c748e607..a09095ae 100644 --- a/app/containers/ColumnSearch/actionTypes.js +++ b/app/containers/ColumnSearch/actionTypes.ts @@ -1,36 +1,27 @@ -// @flow -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export type ADD_COLUMN_TYPE = 'ColumnSearch/ADD_COLUMN' export type ADD_COLUMN_SUCCESS_TYPE = 'ColumnSearch/ADD_COLUMN_SUCCESS' export type SET_NEXT_URL_TYPE = 'ColumnSearch/SET_NEXT_URL' - export type FETCH_TYPE = 'ColumnSearch/FETCH' export type FETCH_SUCCESS_TYPE = 'ColumnSearch/FETCH_SUCCESS' export type FETCH_FAILRE_TYPE = 'ColumnSearch/FETCH_FAILRE' - export type FETCH_NEXT_TYPE = 'ColumnSearch/FETCH_NEXT' export type FETCH_NEXT_SUCCESS_TYPE = 'ColumnSearch/FETCH_NEXT_SUCCESS' export type FETCH_NEXT_FAILRE_TYPE = 'ColumnSearch/FETCH_NEXT_FAILRE' - export type FETCH_NEW_TYPE = 'ColumnSearch/FETCH_USER_NEW_ILLUST' export type FETCH_NEW_SUCCESS_TYPE = 'ColumnSearch/FETCH_NEW_SUCCESS' export type FETCH_NEW_FAILRE_TYPE = 'ColumnSearch/FETCH_NEW_FAILRE' - export type SET_MIN_BOOKBOOK_TYPE = 'ColumnSearch/SET_MIN_BOOKBOOK' export type SET_INTERVAL_TYPE = 'ColumnSearch/SET_INTERVAL' - export type USERS_IN_TYPE = 'ColumnSearch/USERS_IN' export type SET_USERS_IN_TYPE = 'ColumnSearch/SET_USERS_IN' - export type RESET_IDS_TYPE = 'ColumnSearch/RESET_IDS' - export type START_WATCH_TYPE = 'ColumnSearch/START_WATCH' export type WATCH_NEW_TYPE = 'ColumnSearch/WATCH_NEW' - export type Action = - | {| - +type: + | { + type: | ADD_COLUMN_TYPE | ADD_COLUMN_SUCCESS_TYPE | FETCH_TYPE @@ -38,35 +29,39 @@ export type Action = | WATCH_NEW_TYPE | FETCH_NEW_TYPE | RESET_IDS_TYPE - | FETCH_NEXT_TYPE, - +id: ColumnId, - |} - | {| +type: SET_NEXT_URL_TYPE, +id: ColumnId, +nextUrl: ?string |} - | {| - +type: + | FETCH_NEXT_TYPE + id: ColumnId + } + | { + type: SET_NEXT_URL_TYPE + id: ColumnId + nextUrl: string | null | undefined + } + | { + type: | FETCH_SUCCESS_TYPE | FETCH_NEXT_SUCCESS_TYPE - | FETCH_NEW_SUCCESS_TYPE, - +id: ColumnId, - +ids: Array<number>, - |} - | {| - +type: SET_MIN_BOOKBOOK_TYPE, - +id: ColumnId, - +minBookmarks: number, - |} - | {| - +type: SET_USERS_IN_TYPE | USERS_IN_TYPE, - +id: ColumnId, - +usersIn: number, - |} - | {| - +type: SET_INTERVAL_TYPE, - +id: ColumnId, - +interval: number, - |} - | {| - +type: FETCH_FAILRE_TYPE | FETCH_NEXT_FAILRE_TYPE | FETCH_NEW_FAILRE_TYPE, - +id: ColumnId, - +error: string, - |} + | FETCH_NEW_SUCCESS_TYPE + id: ColumnId + ids: number[] + } + | { + type: SET_MIN_BOOKBOOK_TYPE + id: ColumnId + minBookmarks: number + } + | { + type: SET_USERS_IN_TYPE | USERS_IN_TYPE + id: ColumnId + usersIn: number + } + | { + type: SET_INTERVAL_TYPE + id: ColumnId + interval: number + } + | { + type: FETCH_FAILRE_TYPE | FETCH_NEXT_FAILRE_TYPE | FETCH_NEW_FAILRE_TYPE + id: ColumnId + error: string + } diff --git a/app/containers/ColumnSearch/actions.js b/app/containers/ColumnSearch/actions.ts similarity index 85% rename from app/containers/ColumnSearch/actions.js rename to app/containers/ColumnSearch/actions.ts index 70cdda3c..f5529c15 100644 --- a/app/containers/ColumnSearch/actions.js +++ b/app/containers/ColumnSearch/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_COLUMN, ADD_COLUMN_SUCCESS, @@ -21,7 +20,7 @@ import { FETCH_NEXT_FAILRE, FETCH_NEW_FAILRE, } from './constants' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export function addColumn(id: ColumnId): Action { return { @@ -29,88 +28,79 @@ export function addColumn(id: ColumnId): Action { id, } } - export function addColumnSuccess(id: ColumnId): Action { return { type: ADD_COLUMN_SUCCESS, id, } } - export function fetch(id: ColumnId): Action { return { type: FETCH, id, } } - export function startWatch(id: ColumnId): Action { return { type: START_WATCH, id, } } - export function watchNew(id: ColumnId): Action { return { type: WATCH_NEW, id, } } - export function fetchNew(id: ColumnId): Action { return { type: FETCH_NEW, id, } } - export function resetIds(id: ColumnId): Action { return { type: RESET_IDS, id, } } - export function fetchNext(id: ColumnId): Action { return { type: FETCH_NEXT, id, } } - -export function setNextUrl(id: ColumnId, nextUrl: ?string): Action { +export function setNextUrl( + id: ColumnId, + nextUrl: string | null | undefined +): Action { return { type: SET_NEXT_URL, id, nextUrl, } } - -export function fetchSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_SUCCESS, id, ids, } } - -export function fetchNextSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchNextSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_NEXT_SUCCESS, id, ids, } } - -export function fetchNewSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchNewSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_NEW_SUCCESS, id, ids, } } - export function setMinBookbook(id: ColumnId, minBookmarks: number): Action { return { type: SET_MIN_BOOKBOOK, @@ -118,7 +108,6 @@ export function setMinBookbook(id: ColumnId, minBookmarks: number): Action { minBookmarks, } } - export function setUsersIn(id: ColumnId, usersIn: number): Action { return { type: SET_USERS_IN, @@ -126,7 +115,6 @@ export function setUsersIn(id: ColumnId, usersIn: number): Action { usersIn, } } - export function usersIn(id: ColumnId, usersIn: number): Action { return { type: USERS_IN, @@ -134,7 +122,6 @@ export function usersIn(id: ColumnId, usersIn: number): Action { usersIn, } } - export function setInterval(id: ColumnId, interval: number): Action { return { type: SET_INTERVAL, @@ -142,7 +129,6 @@ export function setInterval(id: ColumnId, interval: number): Action { interval, } } - export function fetchFailre(id: ColumnId, error: string): Action { return { type: FETCH_FAILRE, @@ -150,7 +136,6 @@ export function fetchFailre(id: ColumnId, error: string): Action { error, } } - export function fetchNextFailre(id: ColumnId, error: string): Action { return { type: FETCH_NEXT_FAILRE, @@ -158,7 +143,6 @@ export function fetchNextFailre(id: ColumnId, error: string): Action { error, } } - export function fetchNewFailre(id: ColumnId, error: string): Action { return { type: FETCH_NEW_FAILRE, diff --git a/app/containers/ColumnSearch/constants.js b/app/containers/ColumnSearch/constants.ts similarity index 98% rename from app/containers/ColumnSearch/constants.js rename to app/containers/ColumnSearch/constants.ts index 24cd3416..f668dc93 100644 --- a/app/containers/ColumnSearch/constants.js +++ b/app/containers/ColumnSearch/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { ADD_COLUMN_TYPE, ADD_COLUMN_SUCCESS_TYPE, SET_NEXT_URL_TYPE, diff --git a/app/containers/ColumnSearch/reducer.js b/app/containers/ColumnSearch/reducer.ts similarity index 56% rename from app/containers/ColumnSearch/reducer.js rename to app/containers/ColumnSearch/reducer.ts index d5184878..7a9b373d 100644 --- a/app/containers/ColumnSearch/reducer.js +++ b/app/containers/ColumnSearch/reducer.ts @@ -1,22 +1,18 @@ -// @flow import ms from 'ms' import update from 'utils/update' -import { baseReducer, type BaseColumn } from '../Column/reducer' -import type { Action } from './actionTypes' +import { baseReducer, BaseColumn } from '../Column/reducer' +import { Action } from './actionTypes' import * as Actions from './constants' -export type ColumnId = string - export type ColumnSearch = { - minBookmarks: number, - usersIn: number, - interval: number, + minBookmarks: number + usersIn: number + interval: number } & BaseColumn - -export type State = $Shape<{ [ColumnId]: ColumnSearch }> - +export type State = Partial<{ + [a: string]: ColumnSearch +}> export const initialState: State = {} - export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.ADD_COLUMN_SUCCESS: @@ -29,16 +25,24 @@ export default function(state: State = initialState, action: Action): State { }) case Actions.RESET_IDS: - return update(state, action, { ids: [] }) + return update(state, action, { + ids: [], + }) case Actions.SET_INTERVAL: - return update(state, action, { interval: action.interval }) + return update(state, action, { + interval: action.interval, + }) case Actions.SET_USERS_IN: - return update(state, action, { usersIn: action.usersIn }) + return update(state, action, { + usersIn: action.usersIn, + }) case Actions.SET_MIN_BOOKBOOK: - return update(state, action, { minBookmarks: action.minBookmarks }) + return update(state, action, { + minBookmarks: action.minBookmarks, + }) default: return baseReducer('ColumnSearch', Actions, state, action) diff --git a/app/containers/ColumnUserIllust/actionTypes.js b/app/containers/ColumnUserIllust/actionTypes.ts similarity index 69% rename from app/containers/ColumnUserIllust/actionTypes.js rename to app/containers/ColumnUserIllust/actionTypes.ts index 8f65fd55..a11b8f13 100644 --- a/app/containers/ColumnUserIllust/actionTypes.js +++ b/app/containers/ColumnUserIllust/actionTypes.ts @@ -1,32 +1,32 @@ -// @flow -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export type ADD_COLUMN_TYPE = 'ColumnUserIllust/ADD_COLUMN' export type ADD_COLUMN_SUCCESS_TYPE = 'ColumnUserIllust/ADD_COLUMN_SUCCESS' export type SET_NEXT_URL_TYPE = 'ColumnUserIllust/SET_NEXT_URL' - export type FETCH_TYPE = 'ColumnUserIllust/FETCH' export type FETCH_SUCCESS_TYPE = 'ColumnUserIllust/FETCH_SUCCESS' export type FETCH_FAILRE_TYPE = 'ColumnUserIllust/FETCH_FAILRE' - export type FETCH_NEXT_TYPE = 'ColumnUserIllust/FETCH_NEXT' export type FETCH_NEXT_SUCCESS_TYPE = 'ColumnUserIllust/FETCH_NEXT_SUCCESS' export type FETCH_NEXT_FAILRE_TYPE = 'ColumnUserIllust/FETCH_NEXT_FAILRE' - export type Action = - | {| - +type: + | { + type: | ADD_COLUMN_TYPE | ADD_COLUMN_SUCCESS_TYPE | FETCH_TYPE | FETCH_FAILRE_TYPE | FETCH_NEXT_TYPE - | FETCH_NEXT_FAILRE_TYPE, - +id: ColumnId, - |} - | {| +type: SET_NEXT_URL_TYPE, +id: ColumnId, +nextUrl: string |} - | {| - +type: FETCH_SUCCESS_TYPE | FETCH_NEXT_SUCCESS_TYPE, - +id: ColumnId, - +ids: Array<number>, - |} + | FETCH_NEXT_FAILRE_TYPE + id: ColumnId + } + | { + type: SET_NEXT_URL_TYPE + id: ColumnId + nextUrl: string + } + | { + type: FETCH_SUCCESS_TYPE | FETCH_NEXT_SUCCESS_TYPE + id: ColumnId + ids: number[] + } diff --git a/app/containers/ColumnUserIllust/actions.js b/app/containers/ColumnUserIllust/actions.ts similarity index 80% rename from app/containers/ColumnUserIllust/actions.js rename to app/containers/ColumnUserIllust/actions.ts index ea76fe85..e3def62c 100644 --- a/app/containers/ColumnUserIllust/actions.js +++ b/app/containers/ColumnUserIllust/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_COLUMN, ADD_COLUMN_SUCCESS, @@ -11,7 +10,7 @@ import { FETCH_SUCCESS, FETCH_NEXT_SUCCESS, } from './constants' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' export function addColumn(id: ColumnId): Action { return { @@ -19,42 +18,36 @@ export function addColumn(id: ColumnId): Action { id, } } - export function addColumnSuccess(id: ColumnId): Action { return { type: ADD_COLUMN_SUCCESS, id, } } - export function fetch(id: ColumnId): Action { return { type: FETCH, id, } } - export function fetchFailre(id: ColumnId): Action { return { type: FETCH_FAILRE, id, } } - export function fetchNext(id: ColumnId): Action { return { type: FETCH_NEXT, id, } } - export function fetchNextFailre(id: ColumnId): Action { return { type: FETCH_NEXT_FAILRE, id, } } - export function setNextUrl(id: ColumnId, nextUrl: string): Action { return { type: SET_NEXT_URL, @@ -62,16 +55,14 @@ export function setNextUrl(id: ColumnId, nextUrl: string): Action { nextUrl, } } - -export function fetchSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_SUCCESS, id, ids, } } - -export function fetchNextSuccess(id: ColumnId, ids: Array<number>): Action { +export function fetchNextSuccess(id: ColumnId, ids: number[]): Action { return { type: FETCH_NEXT_SUCCESS, id, diff --git a/app/containers/ColumnUserIllust/constants.js b/app/containers/ColumnUserIllust/constants.ts similarity index 97% rename from app/containers/ColumnUserIllust/constants.js rename to app/containers/ColumnUserIllust/constants.ts index 28212131..a67046a9 100644 --- a/app/containers/ColumnUserIllust/constants.js +++ b/app/containers/ColumnUserIllust/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { ADD_COLUMN_TYPE, ADD_COLUMN_SUCCESS_TYPE, SET_NEXT_URL_TYPE, diff --git a/app/containers/ColumnUserIllust/reducer.js b/app/containers/ColumnUserIllust/reducer.ts similarity index 61% rename from app/containers/ColumnUserIllust/reducer.js rename to app/containers/ColumnUserIllust/reducer.ts index 4285b344..a6f1514b 100644 --- a/app/containers/ColumnUserIllust/reducer.js +++ b/app/containers/ColumnUserIllust/reducer.ts @@ -1,16 +1,13 @@ -// @flow -import { baseReducer, type BaseColumn } from '../Column/reducer' -import type { Action } from './actionTypes' +import { baseReducer, BaseColumn } from '../Column/reducer' +import { Action } from './actionTypes' import * as Actions from './constants' export type ColumnId = number - export type ColumnUserIllust = BaseColumn - -export type State = $Shape<{ [ColumnId]: ColumnUserIllust }> - +export type State = Partial<{ + [a: string]: ColumnUserIllust +}> const initialState: State = {} - export default function(state: State = initialState, action: Action): State { return baseReducer('ColumnUserIllust', Actions, state, action) } diff --git a/app/containers/DrawerManager/actionTypes.js b/app/containers/DrawerManager/actionTypes.ts similarity index 55% rename from app/containers/DrawerManager/actionTypes.js rename to app/containers/DrawerManager/actionTypes.ts index 62969b36..87b5a8e7 100644 --- a/app/containers/DrawerManager/actionTypes.js +++ b/app/containers/DrawerManager/actionTypes.ts @@ -1,7 +1,10 @@ -// @flow export type OPEN_DRAWER_TYPE = 'DrawerManager/OPEN' export type CLOSE_DRAWER_TYPE = 'DrawerManager/CLOSE' - export type Action = - | {| +type: CLOSE_DRAWER_TYPE |} - | {| +type: OPEN_DRAWER_TYPE, id: number |} + | { + type: CLOSE_DRAWER_TYPE + } + | { + type: OPEN_DRAWER_TYPE + id: number + } diff --git a/app/containers/DrawerManager/actions.js b/app/containers/DrawerManager/actions.ts similarity index 81% rename from app/containers/DrawerManager/actions.js rename to app/containers/DrawerManager/actions.ts index 45c944b3..010ebd84 100644 --- a/app/containers/DrawerManager/actions.js +++ b/app/containers/DrawerManager/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { CLOSE_DRAWER, OPEN_DRAWER } from './constants' export function closeDrawer(): Action { @@ -7,7 +6,6 @@ export function closeDrawer(): Action { type: CLOSE_DRAWER, } } - export function openDrawer(id: number): Action { return { type: OPEN_DRAWER, diff --git a/app/containers/DrawerManager/constants.js b/app/containers/DrawerManager/constants.ts similarity index 62% rename from app/containers/DrawerManager/constants.js rename to app/containers/DrawerManager/constants.ts index af335f6e..fe0585b3 100644 --- a/app/containers/DrawerManager/constants.js +++ b/app/containers/DrawerManager/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { OPEN_DRAWER_TYPE, CLOSE_DRAWER_TYPE } from './actionTypes' +import { OPEN_DRAWER_TYPE, CLOSE_DRAWER_TYPE } from './actionTypes' export const OPEN_DRAWER: OPEN_DRAWER_TYPE = 'DrawerManager/OPEN' export const CLOSE_DRAWER: CLOSE_DRAWER_TYPE = 'DrawerManager/CLOSE' diff --git a/app/containers/DrawerManager/reducer.js b/app/containers/DrawerManager/reducer.ts similarity index 61% rename from app/containers/DrawerManager/reducer.js rename to app/containers/DrawerManager/reducer.ts index e7284688..c2cf6959 100644 --- a/app/containers/DrawerManager/reducer.js +++ b/app/containers/DrawerManager/reducer.ts @@ -1,26 +1,22 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' -export type State = { - open: boolean, - userId: ?number, +export interface State { + open: boolean + userId: number | null | undefined } - const initialState: State = { open: false, userId: null, } - -export default function( - state: State = initialState, - action: Action -): $Shape<State> { +export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.OPEN_DRAWER: return { ...state, open: true, userId: action.id } + case Actions.CLOSE_DRAWER: return { ...state, open: false } + default: return state } diff --git a/app/containers/FollowButton/actionTypes.js b/app/containers/FollowButton/actionTypes.ts similarity index 54% rename from app/containers/FollowButton/actionTypes.js rename to app/containers/FollowButton/actionTypes.ts index 8c86c282..254d8602 100644 --- a/app/containers/FollowButton/actionTypes.js +++ b/app/containers/FollowButton/actionTypes.ts @@ -1,23 +1,20 @@ -// @flow export type FOLLOW_REQUEST_TYPE = 'FollowButton/FOLLOW_REQUEST' export type FOLLOW_SUCCESS_TYPE = 'FollowButton/FOLLOW_SUCCESS' export type FOLLOW_FAILER_TYPE = 'FollowButton/FOLLOW_FAILER' - export type UN_FOLLOW_REQUEST_TYPE = 'FollowButton/UN_FOLLOW_REQUEST' export type UN_FOLLOW_SUCCESS_TYPE = 'FollowButton/UN_FOLLOW_SUCCESS' export type UN_FOLLOW_FAILER_TYPE = 'FollowButton/UN_FOLLOW_FAILER' - export type Action = - | {| - +type: FOLLOW_REQUEST_TYPE | UN_FOLLOW_REQUEST_TYPE, - +id: number, - +restrict: 'public' | 'private', - |} - | {| - +type: FOLLOW_SUCCESS_TYPE | UN_FOLLOW_SUCCESS_TYPE, - +restrict: 'public' | 'private', - |} - | {| - +type: FOLLOW_FAILER_TYPE | UN_FOLLOW_FAILER_TYPE, - +error: string, - |} + | { + type: FOLLOW_REQUEST_TYPE | UN_FOLLOW_REQUEST_TYPE + id: number + restrict: 'public' | 'private' + } + | { + type: FOLLOW_SUCCESS_TYPE | UN_FOLLOW_SUCCESS_TYPE + restrict: 'public' | 'private' + } + | { + type: FOLLOW_FAILER_TYPE | UN_FOLLOW_FAILER_TYPE + error: string + } diff --git a/app/containers/FollowButton/actions.js b/app/containers/FollowButton/actions.ts similarity index 94% rename from app/containers/FollowButton/actions.js rename to app/containers/FollowButton/actions.ts index 84b0f6c4..9428c453 100644 --- a/app/containers/FollowButton/actions.js +++ b/app/containers/FollowButton/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { FOLLOW_REQUEST, UN_FOLLOW_REQUEST, @@ -19,7 +18,6 @@ export function followRequest( restrict, } } - export function unFollowRequest( id: number, restrict: 'public' | 'private' @@ -30,28 +28,24 @@ export function unFollowRequest( restrict, } } - export function followSuccess(restrict: 'public' | 'private'): Action { return { type: FOLLOW_SUCCESS, restrict, } } - export function unFollowSuccess(restrict: 'public' | 'private'): Action { return { type: UN_FOLLOW_SUCCESS, restrict, } } - export function followFailer(error: string): Action { return { type: FOLLOW_FAILER, error, } } - export function unFollowFailer(error: string): Action { return { type: UN_FOLLOW_FAILER, diff --git a/app/containers/FollowButton/constants.js b/app/containers/FollowButton/constants.ts similarity index 96% rename from app/containers/FollowButton/constants.js rename to app/containers/FollowButton/constants.ts index 50ecc214..a3ebb931 100644 --- a/app/containers/FollowButton/constants.js +++ b/app/containers/FollowButton/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { FOLLOW_REQUEST_TYPE, FOLLOW_SUCCESS_TYPE, FOLLOW_FAILER_TYPE, diff --git a/app/containers/HeaderContainer/actionTypes.js b/app/containers/HeaderContainer/actionTypes.ts similarity index 84% rename from app/containers/HeaderContainer/actionTypes.js rename to app/containers/HeaderContainer/actionTypes.ts index f4c68316..3af83eb5 100644 --- a/app/containers/HeaderContainer/actionTypes.js +++ b/app/containers/HeaderContainer/actionTypes.ts @@ -1,14 +1,11 @@ -// @flow export type TOGGLE_SEARCH_FIELD_TYPE = 'HeaderContainer/toggleSearchField' export type CLOSE_SEARCH_FIELD_TYPE = 'HeaderContainer/closeSearchField' - export type TOGGLE_DROPDOWN_TYPE = 'HeaderContainer/toggleDropdown' export type CLOSE_DROPDOWN_TYPE = 'HeaderContainer/closeDropdown' - -export type Action = { - +type: +export interface Action { + type: | TOGGLE_SEARCH_FIELD_TYPE | CLOSE_SEARCH_FIELD_TYPE | TOGGLE_DROPDOWN_TYPE - | CLOSE_DROPDOWN_TYPE, + | CLOSE_DROPDOWN_TYPE } diff --git a/app/containers/HeaderContainer/actions.js b/app/containers/HeaderContainer/actions.ts similarity index 89% rename from app/containers/HeaderContainer/actions.js rename to app/containers/HeaderContainer/actions.ts index 8703403d..e8476660 100644 --- a/app/containers/HeaderContainer/actions.js +++ b/app/containers/HeaderContainer/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { TOGGLE_SEARCH_FIELD, CLOSE_SEARCH_FIELD, @@ -12,19 +11,16 @@ export function toggleSearchField(): Action { type: TOGGLE_SEARCH_FIELD, } } - export function closeSearchField(): Action { return { type: CLOSE_SEARCH_FIELD, } } - export function toggleDropdown(): Action { return { type: TOGGLE_DROPDOWN, } } - export function closeDropdown(): Action { return { type: CLOSE_DROPDOWN, diff --git a/app/containers/HeaderContainer/constants.js b/app/containers/HeaderContainer/constants.ts similarity index 95% rename from app/containers/HeaderContainer/constants.js rename to app/containers/HeaderContainer/constants.ts index 6505ce44..33bd4ee1 100644 --- a/app/containers/HeaderContainer/constants.js +++ b/app/containers/HeaderContainer/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { TOGGLE_SEARCH_FIELD_TYPE, CLOSE_SEARCH_FIELD_TYPE, TOGGLE_DROPDOWN_TYPE, diff --git a/app/containers/HeaderContainer/reducer.js b/app/containers/HeaderContainer/reducer.ts similarity index 83% rename from app/containers/HeaderContainer/reducer.js rename to app/containers/HeaderContainer/reducer.ts index 20d18055..fb8599f6 100644 --- a/app/containers/HeaderContainer/reducer.js +++ b/app/containers/HeaderContainer/reducer.ts @@ -1,27 +1,28 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' -export type State = { - isOpenDropdown: boolean, - isOpenSearchField: boolean, +export interface State { + isOpenDropdown: boolean + isOpenSearchField: boolean } - const initialState: State = { isOpenDropdown: false, isOpenSearchField: false, } - export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.TOGGLE_SEARCH_FIELD: return { ...state, isOpenSearchField: !state.isOpenSearchField } + case Actions.CLOSE_SEARCH_FIELD: return { ...state, isOpenSearchField: false } + case Actions.TOGGLE_DROPDOWN: return { ...state, isOpenDropdown: !state.isOpenDropdown } + case Actions.CLOSE_DROPDOWN: return { ...state, isOpenDropdown: false } + default: return state } diff --git a/app/containers/IllustById/reducer.js b/app/containers/IllustById/reducer.ts similarity index 51% rename from app/containers/IllustById/reducer.js rename to app/containers/IllustById/reducer.ts index 7fe46bb2..07ef4463 100644 --- a/app/containers/IllustById/reducer.js +++ b/app/containers/IllustById/reducer.ts @@ -1,16 +1,12 @@ -// @flow -import type { Action } from 'types' -import type { Illusts } from 'types/illust' +import { Action } from 'types' +import { Illusts } from 'types/illust' export type State = Illusts export default function IllustById(state: State = {}, action: Action): State { - // $FlowFixMe if (action.response && action.response.entities.illusts) { - return { - ...state, - ...action.response.entities.illusts, - } + return { ...state, ...action.response.entities.illusts } } + return state } diff --git a/app/containers/IllustPreview/IllustPreview.js b/app/containers/IllustPreview/IllustPreview.js index c09580ff..09d0d865 100644 --- a/app/containers/IllustPreview/IllustPreview.js +++ b/app/containers/IllustPreview/IllustPreview.js @@ -3,15 +3,15 @@ import * as React from 'react' import styled from 'styled-components' import LazyImg from './LazyImg' -type Props = { - from: string, - original: string, - width: number, - height: number, - isLoaded: boolean, - onLoad: () => void, - onUnLoad: () => void, - onClose: () => void, +interface Props { + from: string; + original: string; + width: number; + height: number; + isLoaded: boolean; + onLoad: () => void; + onUnLoad: () => void; + onClose: () => void; } export default class IllustPreview extends React.PureComponent<Props> { diff --git a/app/containers/IllustPreview/LazyImg.js b/app/containers/IllustPreview/LazyImg.js index 53d58fa2..bf6fcd18 100644 --- a/app/containers/IllustPreview/LazyImg.js +++ b/app/containers/IllustPreview/LazyImg.js @@ -4,9 +4,9 @@ import styled, { keyframes } from 'styled-components' import CloseButton from 'components/common/CloseButton' import { LazyImgWrapper as Wrapper } from './styles' -type Size = { - width: number | 'auto', - height: number | 'auto', +interface Size { + width: number | 'auto'; + height: number | 'auto'; } function calcSize(width: number, height: number): Size { @@ -41,20 +41,20 @@ function calcMarginTop(node: HTMLElement | null): number { return 10 } -type Props = { - from: string, - original: string, - width: number, - height: number, - isLoaded: boolean, - onLoad: () => void, - onClose: () => void, +interface Props { + from: string; + original: string; + width: number; + height: number; + isLoaded: boolean; + onLoad: () => void; + onClose: () => void; } -type State = { - isClicked: boolean, - fromMarginTop: number, - toMarginTop: number, +interface State { + isClicked: boolean; + fromMarginTop: number; + toMarginTop: number; } export default class LazyImg extends React.PureComponent<Props, State> { diff --git a/app/containers/IllustPreview/actionTypes.js b/app/containers/IllustPreview/actionTypes.ts similarity index 73% rename from app/containers/IllustPreview/actionTypes.js rename to app/containers/IllustPreview/actionTypes.ts index f002ccea..5f537cd8 100644 --- a/app/containers/IllustPreview/actionTypes.js +++ b/app/containers/IllustPreview/actionTypes.ts @@ -1,15 +1,15 @@ -// @flow export type OPEN_ILLUST_VIEWER_TYPE = 'IllustPreview/open' export type COLOSE_ILLUST_VIEWER_TYPE = 'IllustPreview/close' - export type START_IMG_LOADING_TYPE = 'IllustPreview/START_IMG_LOADING' export type FINISH_IMG_LOADING_TYPE = 'IllustPreview/FINISH_IMG_LOADING' - export type Action = - | {| - +type: + | { + type: | COLOSE_ILLUST_VIEWER_TYPE | START_IMG_LOADING_TYPE - | FINISH_IMG_LOADING_TYPE, - |} - | {| +type: OPEN_ILLUST_VIEWER_TYPE, id: number |} + | FINISH_IMG_LOADING_TYPE + } + | { + type: OPEN_ILLUST_VIEWER_TYPE + id: number + } diff --git a/app/containers/IllustPreview/actions.js b/app/containers/IllustPreview/actions.ts similarity index 90% rename from app/containers/IllustPreview/actions.js rename to app/containers/IllustPreview/actions.ts index e488f10a..d68acf7e 100644 --- a/app/containers/IllustPreview/actions.js +++ b/app/containers/IllustPreview/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { COLOSE_ILLUST_VIEWER, START_IMG_LOADING, @@ -12,19 +11,16 @@ export function coloseIllustViewer(): Action { type: COLOSE_ILLUST_VIEWER, } } - export function startImgLoading(): Action { return { type: START_IMG_LOADING, } } - export function finishImgLoading(): Action { return { type: FINISH_IMG_LOADING, } } - export function openIllustViewer(id: number): Action { return { type: OPEN_ILLUST_VIEWER, diff --git a/app/containers/IllustPreview/constants.js b/app/containers/IllustPreview/constants.ts similarity index 95% rename from app/containers/IllustPreview/constants.js rename to app/containers/IllustPreview/constants.ts index 5f4bddcc..663dd366 100644 --- a/app/containers/IllustPreview/constants.js +++ b/app/containers/IllustPreview/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { OPEN_ILLUST_VIEWER_TYPE, COLOSE_ILLUST_VIEWER_TYPE, START_IMG_LOADING_TYPE, diff --git a/app/containers/IllustPreview/reducer.js b/app/containers/IllustPreview/reducer.ts similarity index 70% rename from app/containers/IllustPreview/reducer.js rename to app/containers/IllustPreview/reducer.ts index a3cb42c5..d5108333 100644 --- a/app/containers/IllustPreview/reducer.js +++ b/app/containers/IllustPreview/reducer.ts @@ -1,32 +1,30 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' -export type State = { - open: boolean, - id: ?number, - isImgLoading: boolean, +export interface State { + open: boolean + id: number | null | undefined + isImgLoading: boolean } - const initialState: State = { open: false, id: null, isImgLoading: false, } - -export default function( - state: State = initialState, - action: Action -): $Shape<State> { +export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.OPEN_ILLUST_VIEWER: return { ...state, open: true, id: action.id } + case Actions.COLOSE_ILLUST_VIEWER: return { ...state, open: false, id: null } + case Actions.START_IMG_LOADING: return { ...state, isImgLoading: true } + case Actions.FINISH_IMG_LOADING: return { ...state, isImgLoading: false } + default: return state } diff --git a/app/containers/Language/actionTypes.js b/app/containers/Language/actionTypes.js deleted file mode 100644 index eb45d79d..00000000 --- a/app/containers/Language/actionTypes.js +++ /dev/null @@ -1,7 +0,0 @@ -// @flow -export type CHANGE_LOCALE_TYPE = 'Language/CHANGE_LOCALE' - -export type Action = { - +type: CHANGE_LOCALE_TYPE, - locale: string, -} diff --git a/app/containers/Language/actionTypes.ts b/app/containers/Language/actionTypes.ts new file mode 100644 index 00000000..debf2630 --- /dev/null +++ b/app/containers/Language/actionTypes.ts @@ -0,0 +1,5 @@ +export type CHANGE_LOCALE_TYPE = 'Language/CHANGE_LOCALE' +export interface Action { + type: CHANGE_LOCALE_TYPE + locale: string +} diff --git a/app/containers/Language/actions.js b/app/containers/Language/actions.ts similarity index 74% rename from app/containers/Language/actions.js rename to app/containers/Language/actions.ts index 3462034a..b0cf50a9 100644 --- a/app/containers/Language/actions.js +++ b/app/containers/Language/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { CHANGE_LOCALE } from './constants' export function changeLocale(locale: string): Action { diff --git a/app/containers/Language/constants.js b/app/containers/Language/constants.ts similarity index 53% rename from app/containers/Language/constants.js rename to app/containers/Language/constants.ts index 9be48358..2a02c0d8 100644 --- a/app/containers/Language/constants.js +++ b/app/containers/Language/constants.ts @@ -1,4 +1,3 @@ -// @flow -import type { CHANGE_LOCALE_TYPE } from './actionTypes' +import { CHANGE_LOCALE_TYPE } from './actionTypes' export const CHANGE_LOCALE: CHANGE_LOCALE_TYPE = 'Language/CHANGE_LOCALE' diff --git a/app/containers/Language/reducer.js b/app/containers/Language/reducer.ts similarity index 66% rename from app/containers/Language/reducer.js rename to app/containers/Language/reducer.ts index ae58727b..b106549d 100644 --- a/app/containers/Language/reducer.js +++ b/app/containers/Language/reducer.ts @@ -1,16 +1,18 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' -export type State = { locale: ?string } - +export interface State { + locale: string | null | undefined +} export const DEFAULT_LOCALE = 'ja' -const initialState: State = { locale: null } - +const initialState: State = { + locale: null, +} export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.CHANGE_LOCALE: return { ...state, locale: action.locale } + default: return state } diff --git a/app/containers/LoginModal/actionTypes.js b/app/containers/LoginModal/actionTypes.ts similarity index 71% rename from app/containers/LoginModal/actionTypes.js rename to app/containers/LoginModal/actionTypes.ts index cf78311a..f99dc37e 100644 --- a/app/containers/LoginModal/actionTypes.js +++ b/app/containers/LoginModal/actionTypes.ts @@ -1,43 +1,38 @@ -// @flow -import type { Account } from 'types/account' +import { Account } from 'types/account' export type LOGIN_REQUEST_TYPE = 'LoginModal/LOGIN_REQUEST' export type LOGIN_SUCCESS_TYPE = 'LoginModal/LOGIN_SUCCESS' export type LOGIN_FAILURE_TYPE = 'LoginModal/LOGIN_FAILURE' - export type START_LOADING_TYPE = 'LoginModal/START_LOADING' export type END_LOADING_TYPE = 'LoginModal/END_LOADING' - export type AUTO_LOGIN_REQUEST_TYPE = 'LoginModal/AUTO_LOGIN_REQUEST' export type AUTO_LOGIN_SUCCESS_TYPE = 'LoginModal/AUTO_LOGIN_SUCCESS' export type AUTO_LOGIN_FAILURE_TYPE = 'LoginModal/AUTO_LOGIN_FAILURE' - export type LOGOUT_TYPE = 'LoginModal/LOGOUT' - export type SET_AUTH_TYPE = 'LoginModal/SET_AUTH' export type CLEAR_ERROR_TYPE = 'LoginModal/CLEAR_ERROR' - export type SET_ACCOUNT_TYPE = 'LoginModal/SET_ACCOUNT' - export type SET_REFRESH_TOKEN_TYPE = 'LoginModal/SET_REFRESH_TOKEN' - export type Action = - | {| - +type: SET_AUTH_TYPE | LOGIN_REQUEST_TYPE, - username: string, - password: string, - |} - | {| +type: SET_REFRESH_TOKEN_TYPE, refreshToken: string |} - | {| - +type: SET_ACCOUNT_TYPE, - +account: Account, - |} - | {| - +type: + | { + type: SET_AUTH_TYPE | LOGIN_REQUEST_TYPE + username: string + password: string + } + | { + type: SET_REFRESH_TOKEN_TYPE + refreshToken: string + } + | { + type: SET_ACCOUNT_TYPE + account: Account + } + | { + type: | CLEAR_ERROR_TYPE | LOGIN_FAILURE_TYPE | LOGOUT_TYPE | START_LOADING_TYPE | END_LOADING_TYPE - | AUTO_LOGIN_REQUEST_TYPE, - |} + | AUTO_LOGIN_REQUEST_TYPE + } diff --git a/app/containers/LoginModal/actions.js b/app/containers/LoginModal/actions.ts similarity index 91% rename from app/containers/LoginModal/actions.js rename to app/containers/LoginModal/actions.ts index 7421036b..80e56e8d 100644 --- a/app/containers/LoginModal/actions.js +++ b/app/containers/LoginModal/actions.ts @@ -1,6 +1,5 @@ -// @flow -import type { Account } from 'types/account' -import type { Action } from './actionTypes' +import { Account } from 'types/account' +import { Action } from './actionTypes' import { SET_AUTH, LOGIN_REQUEST, @@ -21,7 +20,6 @@ export function setAuth(username: string, password: string): Action { password, } } - export function loginRequest(username: string, password: string): Action { return { type: LOGIN_REQUEST, @@ -29,51 +27,43 @@ export function loginRequest(username: string, password: string): Action { password, } } - export function setRefreshToken(refreshToken: string): Action { return { type: SET_REFRESH_TOKEN, refreshToken, } } - export function setAccount(account: Account): Action { return { type: SET_ACCOUNT, account, } } - export function clearError(): Action { return { type: CLEAR_ERROR, } } - export function loginFailure(): Action { return { type: LOGIN_FAILURE, } } - export function logout(): Action { return { type: LOGOUT, } } - export function startLoading(): Action { return { type: START_LOADING, } } - export function endLoading(): Action { return { type: END_LOADING, } } - export function autoLoginRequest(): Action { return { type: AUTO_LOGIN_REQUEST, diff --git a/app/containers/LoginModal/constants.js b/app/containers/LoginModal/constants.ts similarity index 98% rename from app/containers/LoginModal/constants.js rename to app/containers/LoginModal/constants.ts index ac441ccc..2cc0a7ef 100644 --- a/app/containers/LoginModal/constants.js +++ b/app/containers/LoginModal/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { LOGIN_REQUEST_TYPE, LOGIN_SUCCESS_TYPE, LOGIN_FAILURE_TYPE, diff --git a/app/containers/LoginModal/reducer.js b/app/containers/LoginModal/reducer.ts similarity index 78% rename from app/containers/LoginModal/reducer.js rename to app/containers/LoginModal/reducer.ts index b6a47181..793868bc 100644 --- a/app/containers/LoginModal/reducer.js +++ b/app/containers/LoginModal/reducer.ts @@ -1,17 +1,15 @@ -// @flow -import type { Account } from 'types/account' -import type { Action } from './actionTypes' +import { Account } from 'types/account' +import { Action } from './actionTypes' import * as Actions from './constants' -export type State = { - username: string, - password: string, - refreshToken: ?string, - isLoading: boolean, - isLoginFailure: boolean, - account: ?Account, +export interface State { + username: string + password: string + refreshToken: string | null | undefined + isLoading: boolean + isLoginFailure: boolean + account: Account | null | undefined } - export const initialState: State = { username: '', password: '', @@ -20,25 +18,32 @@ export const initialState: State = { isLoginFailure: false, account: null, } - export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.SET_AUTH: return { ...state, username: action.username, password: action.password } + case Actions.LOGIN_REQUEST: return { ...state, isLoading: true } + case Actions.START_LOADING: return { ...state, isLoading: true } + case Actions.END_LOADING: return { ...state, isLoading: false } + case Actions.LOGIN_FAILURE: return { ...state, isLoginFailure: true } + case Actions.CLEAR_ERROR: return { ...state, isLoginFailure: false } + case Actions.SET_ACCOUNT: return { ...state, account: action.account } + case Actions.SET_REFRESH_TOKEN: return { ...state, refreshToken: action.refreshToken } + default: return state } diff --git a/app/containers/MangaPreview/actionTypes.js b/app/containers/MangaPreview/actionTypes.ts similarity index 54% rename from app/containers/MangaPreview/actionTypes.js rename to app/containers/MangaPreview/actionTypes.ts index 90e271cf..67c0c1b7 100644 --- a/app/containers/MangaPreview/actionTypes.js +++ b/app/containers/MangaPreview/actionTypes.ts @@ -1,7 +1,10 @@ -// @flow export type OPEN_MANGA_PREVIEW_TYPE = 'MangaPreview/open' export type CLOSE_MANGA_PREVIEW_TYPE = 'MangaPreview/close' - export type Action = - | {| +type: CLOSE_MANGA_PREVIEW_TYPE |} - | {| +type: OPEN_MANGA_PREVIEW_TYPE, id: number |} + | { + type: CLOSE_MANGA_PREVIEW_TYPE + } + | { + type: OPEN_MANGA_PREVIEW_TYPE + id: number + } diff --git a/app/containers/MangaPreview/actions.js b/app/containers/MangaPreview/actions.ts similarity index 83% rename from app/containers/MangaPreview/actions.js rename to app/containers/MangaPreview/actions.ts index cf89ca3f..4ab6b1c9 100644 --- a/app/containers/MangaPreview/actions.js +++ b/app/containers/MangaPreview/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { CLOSE_MANGA_PREVIEW, OPEN_MANGA_PREVIEW } from './constants' export function closeMangaPreview(): Action { @@ -7,7 +6,6 @@ export function closeMangaPreview(): Action { type: CLOSE_MANGA_PREVIEW, } } - export function openMangaPreview(id: number): Action { return { type: OPEN_MANGA_PREVIEW, diff --git a/app/containers/MangaPreview/constants.js b/app/containers/MangaPreview/constants.ts similarity index 91% rename from app/containers/MangaPreview/constants.js rename to app/containers/MangaPreview/constants.ts index 11143a07..95bfb915 100644 --- a/app/containers/MangaPreview/constants.js +++ b/app/containers/MangaPreview/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { OPEN_MANGA_PREVIEW_TYPE, CLOSE_MANGA_PREVIEW_TYPE, } from './actionTypes' diff --git a/app/containers/MangaPreview/reducer.js b/app/containers/MangaPreview/reducer.ts similarity index 63% rename from app/containers/MangaPreview/reducer.js rename to app/containers/MangaPreview/reducer.ts index ded1da49..fc21cd23 100644 --- a/app/containers/MangaPreview/reducer.js +++ b/app/containers/MangaPreview/reducer.ts @@ -1,10 +1,9 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' -export type State = { - id: ?number, - open: boolean, +export interface State { + id: number | null | undefined + open: boolean } const initialState: State = { @@ -12,15 +11,14 @@ const initialState: State = { open: false, } -export default function( - state: State = initialState, - action: Action -): $Shape<State> { +export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.OPEN_MANGA_PREVIEW: return { ...state, open: true, id: action.id } + case Actions.CLOSE_MANGA_PREVIEW: return { ...state, open: false, id: null } + default: return state } diff --git a/app/containers/ModalManeger/ModalWrapper.js b/app/containers/ModalManeger/ModalWrapper.js index 4c99a9a1..38f3e180 100644 --- a/app/containers/ModalManeger/ModalWrapper.js +++ b/app/containers/ModalManeger/ModalWrapper.js @@ -6,11 +6,11 @@ import Overlay from 'components/Overlay' import CloseButton from 'components/common/CloseButton' import { Content, Wrap } from './sytles' -type Props = { - open: boolean, - onRequestClose?: Function, - children?: React.Node, - onClose: Function, +interface Props { + open: boolean; + onRequestClose?: Function; + children?: React.Node; + onClose: Function; } export default class ModalWrapper extends React.Component<Props> { diff --git a/app/containers/ModalManeger/actionTypes.js b/app/containers/ModalManeger/actionTypes.js deleted file mode 100644 index 4759683a..00000000 --- a/app/containers/ModalManeger/actionTypes.js +++ /dev/null @@ -1,9 +0,0 @@ -// @flow -import type { ModalType } from './reducer' - -export type OPEN_MODAL_TYPE = 'ModalManager/open' -export type CLOSE_MODAL_TYPE = 'ModalManager/close' - -export type Action = - | {| +type: OPEN_MODAL_TYPE, +modal: ModalType |} - | {| +type: CLOSE_MODAL_TYPE |} diff --git a/app/containers/ModalManeger/actionTypes.ts b/app/containers/ModalManeger/actionTypes.ts new file mode 100644 index 00000000..578f7dcf --- /dev/null +++ b/app/containers/ModalManeger/actionTypes.ts @@ -0,0 +1,12 @@ +import { ModalType } from './reducer' + +export type OPEN_MODAL_TYPE = 'ModalManager/open' +export type CLOSE_MODAL_TYPE = 'ModalManager/close' +export type Action = + | { + type: OPEN_MODAL_TYPE + modal: ModalType + } + | { + type: CLOSE_MODAL_TYPE + } diff --git a/app/containers/ModalManeger/actions.js b/app/containers/ModalManeger/actions.ts similarity index 71% rename from app/containers/ModalManeger/actions.js rename to app/containers/ModalManeger/actions.ts index 504d53cc..4c7c3d37 100644 --- a/app/containers/ModalManeger/actions.js +++ b/app/containers/ModalManeger/actions.ts @@ -1,7 +1,6 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { OPEN_MODAL, CLOSE_MODAL } from './constants' -import type { ModalType } from './reducer' +import { ModalType } from './reducer' export function openModal(modal: ModalType): Action { return { @@ -9,7 +8,6 @@ export function openModal(modal: ModalType): Action { modal, } } - export function closeModal(): Action { return { type: CLOSE_MODAL, diff --git a/app/containers/ModalManeger/constants.js b/app/containers/ModalManeger/constants.ts similarity index 61% rename from app/containers/ModalManeger/constants.js rename to app/containers/ModalManeger/constants.ts index c5c44b8e..2388de1c 100644 --- a/app/containers/ModalManeger/constants.js +++ b/app/containers/ModalManeger/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { OPEN_MODAL_TYPE, CLOSE_MODAL_TYPE } from './actionTypes' +import { OPEN_MODAL_TYPE, CLOSE_MODAL_TYPE } from './actionTypes' export const OPEN_MODAL: OPEN_MODAL_TYPE = 'ModalManager/open' export const CLOSE_MODAL: CLOSE_MODAL_TYPE = 'ModalManager/close' diff --git a/app/containers/ModalManeger/reducer.js b/app/containers/ModalManeger/reducer.ts similarity index 82% rename from app/containers/ModalManeger/reducer.js rename to app/containers/ModalManeger/reducer.ts index 60ebf834..c9e38cd9 100644 --- a/app/containers/ModalManeger/reducer.js +++ b/app/containers/ModalManeger/reducer.ts @@ -1,16 +1,12 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' export type ModalType = 'AddColumn' | 'Setting' | 'Login' - const defaultModal = 'Login' - -export type State = { - open: boolean, - type: ModalType, +export interface State { + open: boolean + type: ModalType } - const initialState: State = { open: true, type: defaultModal, @@ -20,8 +16,10 @@ function modalManeger(state: State = initialState, action: Action): State { switch (action.type) { case Actions.OPEN_MODAL: return { ...state, open: true, type: action.modal } + case Actions.CLOSE_MODAL: return { ...state, open: false } + default: return state } diff --git a/app/containers/Notify/actionTypes.js b/app/containers/Notify/actionTypes.js deleted file mode 100644 index 526a7728..00000000 --- a/app/containers/Notify/actionTypes.js +++ /dev/null @@ -1,13 +0,0 @@ -// @flow -export type ADD_NOTIFY_TYPE = 'Notify/add' -export type ADD_NOTIFY_WITH_ILLUST_TYPE = 'Notify/ADD_NOTIFY_WITH_ILLUST' - -export type Action = - | {| - +type: ADD_NOTIFY_TYPE, - |} - | {| - +type: ADD_NOTIFY_WITH_ILLUST_TYPE, - +title: string, - +id: number, - |} diff --git a/app/containers/Notify/actionTypes.ts b/app/containers/Notify/actionTypes.ts new file mode 100644 index 00000000..ce0e43d9 --- /dev/null +++ b/app/containers/Notify/actionTypes.ts @@ -0,0 +1,11 @@ +export type ADD_NOTIFY_TYPE = 'Notify/add' +export type ADD_NOTIFY_WITH_ILLUST_TYPE = 'Notify/ADD_NOTIFY_WITH_ILLUST' +export type Action = + | { + type: ADD_NOTIFY_TYPE + } + | { + type: ADD_NOTIFY_WITH_ILLUST_TYPE + title: string + id: number + } diff --git a/app/containers/Notify/actions.js b/app/containers/Notify/actions.ts similarity index 84% rename from app/containers/Notify/actions.js rename to app/containers/Notify/actions.ts index 4a504dda..81b9e64b 100644 --- a/app/containers/Notify/actions.js +++ b/app/containers/Notify/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_NOTIFY, ADD_NOTIFY_WITH_ILLUST } from './constants' export function addNotify(): Action { @@ -7,7 +6,6 @@ export function addNotify(): Action { type: ADD_NOTIFY, } } - export function addNotifyWithIllust(title: string, id: number): Action { return { type: ADD_NOTIFY_WITH_ILLUST, diff --git a/app/containers/Notify/constants.js b/app/containers/Notify/constants.ts similarity index 62% rename from app/containers/Notify/constants.js rename to app/containers/Notify/constants.ts index 0b176c2e..4e417418 100644 --- a/app/containers/Notify/constants.js +++ b/app/containers/Notify/constants.ts @@ -1,8 +1,4 @@ -// @flow -import type { - ADD_NOTIFY_TYPE, - ADD_NOTIFY_WITH_ILLUST_TYPE, -} from './actionTypes' +import { ADD_NOTIFY_TYPE, ADD_NOTIFY_WITH_ILLUST_TYPE } from './actionTypes' export const ADD_NOTIFY: ADD_NOTIFY_TYPE = 'Notify/add' export const ADD_NOTIFY_WITH_ILLUST: ADD_NOTIFY_WITH_ILLUST_TYPE = diff --git a/app/containers/PreviewFactory/Preview.js b/app/containers/PreviewFactory/Preview.js index f76654dc..38e9e751 100644 --- a/app/containers/PreviewFactory/Preview.js +++ b/app/containers/PreviewFactory/Preview.js @@ -3,9 +3,9 @@ import * as React from 'react' import IllustPreview from '../IllustPreview' import MangaPreview from '../MangaPreview' -export type Props = { - isOpenImage: boolean, - isOpenManga: boolean, +export interface Props { + isOpenImage: boolean; + isOpenManga: boolean; } const Preview = ({ isOpenImage, isOpenManga }: Props) => { diff --git a/app/containers/SearchField/Popover.js b/app/containers/SearchField/Popover.js index e61681f7..23ac869a 100644 --- a/app/containers/SearchField/Popover.js +++ b/app/containers/SearchField/Popover.js @@ -2,10 +2,10 @@ import * as React from 'react' import styled from 'styled-components' -type ItemProps = { - start: string, - end: string, - onClick: () => void, +interface ItemProps { + start: string; + end: string; + onClick: () => void; } export const Item = ({ start, end, onClick }: ItemProps) => ( @@ -26,9 +26,9 @@ const ItemWrap = styled.div` } ` -type Props = { - title: string | React.Element<any>, - children?: React.Node, +interface Props { + title: string | React.Element<any>; + children?: React.Node; } const Wrap = styled.div` diff --git a/app/containers/SearchField/PopoverAuto.js b/app/containers/SearchField/PopoverAuto.js index 526e6b91..9a1ba6e7 100644 --- a/app/containers/SearchField/PopoverAuto.js +++ b/app/containers/SearchField/PopoverAuto.js @@ -4,10 +4,10 @@ import { FormattedMessage } from 'react-intl' import Popover, { Item } from './Popover' import messages from './messages' -type Props = { - value: string, - keywords: Array<string>, - onClick: (word: string) => void, +interface Props { + value: string; + keywords: string[]; + onClick: (word: string) => void; } const PopoverAuto = ({ value, keywords, onClick }: Props) => { diff --git a/app/containers/SearchField/UsersOver.js b/app/containers/SearchField/UsersOver.js index e639eb74..058b1c02 100644 --- a/app/containers/SearchField/UsersOver.js +++ b/app/containers/SearchField/UsersOver.js @@ -2,9 +2,9 @@ import * as React from 'react' import Popover, { Item } from './Popover' -type Props = { - value: string, - onClick: (word: string) => void, +interface Props { + value: string; + onClick: (word: string) => void; } const UsersOver = ({ value, onClick }: Props) => { diff --git a/app/containers/SearchField/actionTypes.js b/app/containers/SearchField/actionTypes.js deleted file mode 100644 index fecd1a25..00000000 --- a/app/containers/SearchField/actionTypes.js +++ /dev/null @@ -1,18 +0,0 @@ -// @flow -export type FETCH_REQUEST_TYPE = 'SearchField/FETCH_REQUEST' -export type FETCH_SUCCESS_TYPE = 'SearchField/FETCH_SUCCESS' -export type FETCH_FAILRE_TYPE = 'SearchField/FETCH_FAILRE' - -export type Action = - | {| - +type: FETCH_REQUEST_TYPE, - +word: string, - |} - | {| - +type: FETCH_SUCCESS_TYPE, - +keywords: Array<string>, - |} - | {| - +type: FETCH_FAILRE_TYPE, - +error: string, - |} diff --git a/app/containers/SearchField/actionTypes.ts b/app/containers/SearchField/actionTypes.ts new file mode 100644 index 00000000..6d6a05d9 --- /dev/null +++ b/app/containers/SearchField/actionTypes.ts @@ -0,0 +1,16 @@ +export type FETCH_REQUEST_TYPE = 'SearchField/FETCH_REQUEST' +export type FETCH_SUCCESS_TYPE = 'SearchField/FETCH_SUCCESS' +export type FETCH_FAILRE_TYPE = 'SearchField/FETCH_FAILRE' +export type Action = + | { + type: FETCH_REQUEST_TYPE + word: string + } + | { + type: FETCH_SUCCESS_TYPE + keywords: string[] + } + | { + type: FETCH_FAILRE_TYPE + error: string + } diff --git a/app/containers/SearchField/actions.js b/app/containers/SearchField/actions.ts similarity index 74% rename from app/containers/SearchField/actions.js rename to app/containers/SearchField/actions.ts index 13ad91c7..e19bc9f6 100644 --- a/app/containers/SearchField/actions.js +++ b/app/containers/SearchField/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { FETCH_REQUEST, FETCH_SUCCESS, FETCH_FAILRE } from './constants' export function fetchRequest(word: string): Action { @@ -8,14 +7,12 @@ export function fetchRequest(word: string): Action { word, } } - -export function fetchSuccess(keywords: Array<string>): Action { +export function fetchSuccess(keywords: string[]): Action { return { type: FETCH_SUCCESS, keywords, } } - export function fetchFailre(error: string): Action { return { type: FETCH_FAILRE, diff --git a/app/containers/SearchField/constants.js b/app/containers/SearchField/constants.ts similarity index 93% rename from app/containers/SearchField/constants.js rename to app/containers/SearchField/constants.ts index 7a3956aa..c2d3ba71 100644 --- a/app/containers/SearchField/constants.js +++ b/app/containers/SearchField/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { FETCH_REQUEST_TYPE, FETCH_SUCCESS_TYPE, FETCH_FAILRE_TYPE, diff --git a/app/containers/SearchField/reducer.js b/app/containers/SearchField/reducer.ts similarity index 67% rename from app/containers/SearchField/reducer.js rename to app/containers/SearchField/reducer.ts index 244144fb..e6defd93 100644 --- a/app/containers/SearchField/reducer.js +++ b/app/containers/SearchField/reducer.ts @@ -1,24 +1,23 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' type Word = string - -export type State = { - keywords: Array<Word>, +export interface State { + keywords: Word[] } - const initialState: State = { keywords: [], } - export default function( state: State = initialState, action: Action ): $Shape<State> { switch (action.type) { case Actions.FETCH_SUCCESS: - return { keywords: action.keywords } + return { + keywords: action.keywords, + } + default: return state } diff --git a/app/containers/SettingModal/Card.js b/app/containers/SettingModal/Card.js index 6e26b70c..fede86ef 100644 --- a/app/containers/SettingModal/Card.js +++ b/app/containers/SettingModal/Card.js @@ -2,8 +2,8 @@ import * as React from 'react' import styled from 'styled-components' -type Props = { - children?: React.Node, +interface Props { + children?: React.Node; } const Card = ({ children }: Props) => <Wrap>{children}</Wrap> diff --git a/app/containers/SettingModal/SettingModal.js b/app/containers/SettingModal/SettingModal.js index f693fa79..c1cbffb2 100644 --- a/app/containers/SettingModal/SettingModal.js +++ b/app/containers/SettingModal/SettingModal.js @@ -13,21 +13,21 @@ import LimitSetting from './LimitSetting' import messages from './messages' import { ChipWrap, Field, Icon, Input, TagFilter, Wrap } from './styles' -export type Props = { - onDelete: (tag: string) => void, - onSubmit: (tag: string) => void, - onCheckShowText: (isShow: boolean) => void, - onCheckIllustOnly: (isShow: boolean) => void, - onSelectLanguage: (locale: string) => void, - onRemoveCache: Function, - tags: Array<string>, - isShowCaption: boolean, - isIllustOnly: boolean, - locale: string, +export interface Props { + onDelete: (tag: string) => void; + onSubmit: (tag: string) => void; + onCheckShowText: (isShow: boolean) => void; + onCheckIllustOnly: (isShow: boolean) => void; + onSelectLanguage: (locale: string) => void; + onRemoveCache: Function; + tags: string[]; + isShowCaption: boolean; + isIllustOnly: boolean; + locale: string; } -type State = { - value: string, +interface State { + value: string; } export default class SettingFilterModal extends Component<Props, State> { diff --git a/app/containers/SettingModal/actionTypes.js b/app/containers/SettingModal/actionTypes.ts similarity index 61% rename from app/containers/SettingModal/actionTypes.js rename to app/containers/SettingModal/actionTypes.ts index 2f7fd510..6feb23ca 100644 --- a/app/containers/SettingModal/actionTypes.js +++ b/app/containers/SettingModal/actionTypes.ts @@ -1,15 +1,17 @@ -// @flow export type SET_SHOW_ONLY_ILLUST_TYPE = 'SettingModal/SET_SHOW_ONLY_ILLUST' export type SET_SHOW_CAPTION_TYPE = 'SettingModal/SET_SHOW_CAPTION' export type ADD_TAG_FILTER_TYPE = 'SettingModal/ADD_TAG_FILTER' export type REMOVE_TAG_FILTER_TYPE = 'SettingModal/REMOVE_TAG_FILTER' - export type REMOVE_CACHE_TYPE = 'SettingModal/REMOVE_CACHE' - export type Action = - | {| - +type: SET_SHOW_ONLY_ILLUST_TYPE | SET_SHOW_CAPTION_TYPE, - +show: boolean, - |} - | { +type: ADD_TAG_FILTER_TYPE | REMOVE_TAG_FILTER_TYPE, +tag: string } - | {| +type: REMOVE_CACHE_TYPE |} + | { + type: SET_SHOW_ONLY_ILLUST_TYPE | SET_SHOW_CAPTION_TYPE + show: boolean + } + | { + type: ADD_TAG_FILTER_TYPE | REMOVE_TAG_FILTER_TYPE + tag: string + } + | { + type: REMOVE_CACHE_TYPE + } diff --git a/app/containers/SettingModal/actions.js b/app/containers/SettingModal/actions.ts similarity index 91% rename from app/containers/SettingModal/actions.js rename to app/containers/SettingModal/actions.ts index a2cc40e1..8db65ba1 100644 --- a/app/containers/SettingModal/actions.js +++ b/app/containers/SettingModal/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { SET_SHOW_ONLY_ILLUST, SET_SHOW_CAPTION, @@ -14,28 +13,24 @@ export function setShowOnlyIllust(show: boolean): Action { show, } } - export function setShowCaption(show: boolean): Action { return { type: SET_SHOW_CAPTION, show, } } - export function addTagFilter(tag: string): Action { return { type: ADD_TAG_FILTER, tag, } } - export function removeTagFilter(tag: string): Action { return { type: REMOVE_TAG_FILTER, tag, } } - export function removeCache(): Action { return { type: REMOVE_CACHE, diff --git a/app/containers/SettingModal/constants.js b/app/containers/SettingModal/constants.ts similarity index 96% rename from app/containers/SettingModal/constants.js rename to app/containers/SettingModal/constants.ts index 30b2e851..c1ce7437 100644 --- a/app/containers/SettingModal/constants.js +++ b/app/containers/SettingModal/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { SET_SHOW_ONLY_ILLUST_TYPE, SET_SHOW_CAPTION_TYPE, ADD_TAG_FILTER_TYPE, diff --git a/app/containers/SettingModal/reducer.js b/app/containers/SettingModal/reducer.ts similarity index 81% rename from app/containers/SettingModal/reducer.js rename to app/containers/SettingModal/reducer.ts index 7773024f..c462092d 100644 --- a/app/containers/SettingModal/reducer.js +++ b/app/containers/SettingModal/reducer.ts @@ -1,33 +1,33 @@ -// @flow import { union } from 'lodash' -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' -export type State = { - isShowCaption: boolean, - isShowOnlyIllust: boolean, - // TODO: Set? - tags: Array<string>, +export interface State { + isShowCaption: boolean + isShowOnlyIllust: boolean + tags: string[] } - const initialState: State = { isShowCaption: false, isShowOnlyIllust: false, tags: [], } - export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.SET_SHOW_CAPTION: return { ...state, isShowCaption: action.show } + case Actions.SET_SHOW_ONLY_ILLUST: return { ...state, isShowOnlyIllust: action.show } + case Actions.ADD_TAG_FILTER: return { ...state, tags: union([...state.tags, action.tag]) } + case Actions.REMOVE_TAG_FILTER: { const { tag } = action return { ...state, tags: state.tags.filter(v => tag !== v) } } + default: return state } diff --git a/app/containers/Table/actionTypes.js b/app/containers/Table/actionTypes.ts similarity index 55% rename from app/containers/Table/actionTypes.js rename to app/containers/Table/actionTypes.ts index 4483ecaf..58343cf1 100644 --- a/app/containers/Table/actionTypes.js +++ b/app/containers/Table/actionTypes.ts @@ -1,14 +1,12 @@ -// @flow export type ADD_TABLE_TYPE = 'Table/ADD_TABLE' export type REMOVE_TABLE_TYPE = 'Table/REMOVE_TABLE' export type SET_TABLE_TYPE = 'Table/SET_TABLE_TYPE' - export type Action = - | {| - +type: ADD_TABLE_TYPE | REMOVE_TABLE_TYPE, - +id: string, - |} | { - +type: SET_TABLE_TYPE, - +ids: Array<string>, + type: ADD_TABLE_TYPE | REMOVE_TABLE_TYPE + id: string + } + | { + type: SET_TABLE_TYPE + ids: string[] } diff --git a/app/containers/Table/actions.js b/app/containers/Table/actions.ts similarity index 73% rename from app/containers/Table/actions.js rename to app/containers/Table/actions.ts index 4e40db0d..cfc03e59 100644 --- a/app/containers/Table/actions.js +++ b/app/containers/Table/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { ADD_TABLE, REMOVE_TABLE, SET_TABLE } from './constants' export function addTable(id: string): Action { @@ -8,15 +7,13 @@ export function addTable(id: string): Action { id, } } - export function removeTable(id: string): Action { return { type: REMOVE_TABLE, id, } } - -export function setTable(ids: Array<string>): Action { +export function setTable(ids: string[]): Action { return { type: SET_TABLE, ids, diff --git a/app/containers/Table/constants.js b/app/containers/Table/constants.ts similarity index 92% rename from app/containers/Table/constants.js rename to app/containers/Table/constants.ts index 4559b06e..a7d9a7e4 100644 --- a/app/containers/Table/constants.js +++ b/app/containers/Table/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { ADD_TABLE_TYPE, REMOVE_TABLE_TYPE, SET_TABLE_TYPE, diff --git a/app/containers/Table/reducer.js b/app/containers/Table/reducer.ts similarity index 65% rename from app/containers/Table/reducer.js rename to app/containers/Table/reducer.ts index ffb6cb9f..c2c5bd75 100644 --- a/app/containers/Table/reducer.js +++ b/app/containers/Table/reducer.ts @@ -1,25 +1,18 @@ -// @flow import { union } from 'lodash' -import type { ColumnManagerId } from '../ColumnManager/reducer' -import type { Action } from './actionTypes' +import { ColumnManagerId } from '../ColumnManager/reducer' +import { Action } from './actionTypes' import * as Actions from './constants' -export type TableIds = Array<ColumnManagerId> - -export type State = { - ids: TableIds, - nextIds: TableIds, +export type TableIds = ColumnManagerId[] +export interface State { + ids: TableIds + nextIds: TableIds } - const initialState: State = { ids: [], nextIds: [], } - -export default function( - state: State = initialState, - action: Action -): $Shape<State> { +export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.ADD_TABLE: return { diff --git a/app/containers/UserById/reducer.js b/app/containers/UserById/reducer.ts similarity index 51% rename from app/containers/UserById/reducer.js rename to app/containers/UserById/reducer.ts index ff7bce1b..71930c1f 100644 --- a/app/containers/UserById/reducer.js +++ b/app/containers/UserById/reducer.ts @@ -1,16 +1,12 @@ -// @flow -import type { Action } from 'types' -import type { Users } from 'types/user' +import { Action } from 'types' +import { Users } from 'types/user' export type State = Users export default function UserById(state: State = {}, action: Action): State { - // $FlowFixMe if (action.response && action.response.entities.users) { - return { - ...state, - ...action.response.entities.users, - } + return { ...state, ...action.response.entities.users } } + return state } diff --git a/app/containers/UserDrawerContainer/actionTypes.js b/app/containers/UserDrawerContainer/actionTypes.ts similarity index 57% rename from app/containers/UserDrawerContainer/actionTypes.js rename to app/containers/UserDrawerContainer/actionTypes.ts index 880a88d8..36aefdb3 100644 --- a/app/containers/UserDrawerContainer/actionTypes.js +++ b/app/containers/UserDrawerContainer/actionTypes.ts @@ -1,60 +1,55 @@ -// @flow -import type { User, Profile } from 'types/user' +import { User, Profile } from 'types/user' export type FETCH_ILLUST_TYPE = 'UserDrawer/FETCH_ILLUST' export type FETCH_ILLUST_SUCCESS_TYPE = 'UserDrawer/FETCH_ILLUST_SUCCESS' export type FETCH_ILLUST_FAILURE_TYPE = 'UserDrawer/FETCH_ILLUST_FAILURE' - export type FETCH_MANGA_TYPE = 'UserDrawer/FETCH_MANGA' export type FETCH_MANGA_SUCCESS_TYPE = 'UserDrawer/FETCH_MANGA_SUCCESS' export type FETCH_MANGA_FAILURE_TYPE = 'UserDrawer/FETCH_MANGA_FAILURE' - export type ADD_DRAWER_USER_TYPE = 'UserDrawer/ADD_DRAWER_USER' export type ADD_DRAWER_PROFILE_TYPE = 'UserDrawer/ADD_DRAWER_PROFILE' - export type ADD_DRAWER_ILLUST_IDS_TYPE = 'UserDrawer/ADD_DRAWER_ILLUST_IDS' export type ADD_DRAWER_MANGA_IDS_TYPE = 'UserDrawer/ADD_DRAWER_MANGA_IDS' - export type SET_NEXT_ILLUST_URL_TYPE = 'UserDrawer/SET_NEXT_ILLUST_URL' export type SET_NEXT_MANGA_URL_TYPE = 'UserDrawer/SET_NEXT_MANGA_URL' - export type FETCH_USER_DETAIL_TYPE = 'UserDrawer/FETCH_USER_DETAIL' -export type FETCH_USER_DETAIL_SUCCESS_TYPE = - 'UserDrawer/FETCH_USER_DETAIL_SUCCESS' -export type FETCH_USER_DETAIL_FAILURE_TYPE = - 'UserDrawer/FETCH_USER_DETAIL_FAILURE' - +export type FETCH_USER_DETAIL_SUCCESS_TYPE = 'UserDrawer/FETCH_USER_DETAIL_SUCCESS' +export type FETCH_USER_DETAIL_FAILURE_TYPE = 'UserDrawer/FETCH_USER_DETAIL_FAILURE' export type NEXT_ILLUST_PAGE_TYPE = 'UserDrawer/NEXT_PAGE_ILLUST' -export type NEXT_ILLUST_PAGE_SUCCESS_TYPE = - 'UserDrawer/NEXT_ILLUST_PAGE_SUCCESS' -export type NEXT_ILLUST_PAGE_FAILURE_TYPE = - 'UserDrawer/NEXT_ILLUST_PAGE_FAILURE' - +export type NEXT_ILLUST_PAGE_SUCCESS_TYPE = 'UserDrawer/NEXT_ILLUST_PAGE_SUCCESS' +export type NEXT_ILLUST_PAGE_FAILURE_TYPE = 'UserDrawer/NEXT_ILLUST_PAGE_FAILURE' export type NEXT_MANGA_PAGE_TYPE = 'UserDrawer/NEXT_PAGE_MANGA_' export type NEXT_MANGA_PAGE_SUCCESS_TYPE = 'UserDrawer/NEXT_MANGA_PAGE_SUCCESS' export type NEXT_MANGA_PAGE_FAILURE_TYPE = 'UserDrawer/NEXT_MANGA_PAGE_FAILURE' - export type Action = - | {| - +type: FETCH_ILLUST_TYPE | FETCH_MANGA_TYPE | FETCH_USER_DETAIL_TYPE, - +id: number, - |} - | {| - +type: SET_NEXT_ILLUST_URL_TYPE | SET_NEXT_MANGA_URL_TYPE, - +url: string, - |} - | {| +type: ADD_DRAWER_USER_TYPE, +user: User |} - | {| +type: ADD_DRAWER_PROFILE_TYPE, +profile: Profile |} - | {| +type: NEXT_ILLUST_PAGE_TYPE | NEXT_MANGA_PAGE_TYPE |} - | {| - +type: + | { + type: FETCH_ILLUST_TYPE | FETCH_MANGA_TYPE | FETCH_USER_DETAIL_TYPE + id: number + } + | { + type: SET_NEXT_ILLUST_URL_TYPE | SET_NEXT_MANGA_URL_TYPE + url: string + } + | { + type: ADD_DRAWER_USER_TYPE + user: User + } + | { + type: ADD_DRAWER_PROFILE_TYPE + profile: Profile + } + | { + type: NEXT_ILLUST_PAGE_TYPE | NEXT_MANGA_PAGE_TYPE + } + | { + type: | FETCH_ILLUST_SUCCESS_TYPE | FETCH_MANGA_SUCCESS_TYPE | ADD_DRAWER_ILLUST_IDS_TYPE - | ADD_DRAWER_MANGA_IDS_TYPE, - +ids: Array<number>, - |} - | {| - +type: FETCH_ILLUST_FAILURE_TYPE | FETCH_MANGA_FAILURE_TYPE, - +error: string, - |} + | ADD_DRAWER_MANGA_IDS_TYPE + ids: number[] + } + | { + type: FETCH_ILLUST_FAILURE_TYPE | FETCH_MANGA_FAILURE_TYPE + error: string + } diff --git a/app/containers/UserDrawerContainer/actions.js b/app/containers/UserDrawerContainer/actions.ts similarity index 82% rename from app/containers/UserDrawerContainer/actions.js rename to app/containers/UserDrawerContainer/actions.ts index 639555dd..90717f53 100644 --- a/app/containers/UserDrawerContainer/actions.js +++ b/app/containers/UserDrawerContainer/actions.ts @@ -1,6 +1,5 @@ -// @flow -import type { User, Profile } from 'types/user' -import type { Action } from './actionTypes' +import { User, Profile } from 'types/user' +import { Action } from './actionTypes' import { FETCH_ILLUST, FETCH_MANGA, @@ -25,96 +24,82 @@ export function fetchIllust(id: number): Action { id, } } - export function fetchManga(id: number): Action { return { type: FETCH_MANGA, id, } } - export function fetchUserDetail(id: number): Action { return { type: FETCH_USER_DETAIL, id, } } - export function setNextIllustUrl(url: string): Action { return { type: SET_NEXT_ILLUST_URL, url, } } - export function setNextMangaUrl(url: string): Action { return { type: SET_NEXT_MANGA_URL, url, } } - export function addDrawerUser(user: User): Action { return { type: ADD_DRAWER_USER, user, } } - export function addDrawerProfile(profile: Profile): Action { return { type: ADD_DRAWER_PROFILE, profile, } } - export function nextIllustPage(): Action { return { type: NEXT_ILLUST_PAGE, } } - export function nextMangaPage(): Action { return { type: NEXT_MANGA_PAGE, } } - -export function fetchIllustSuccess(ids: Array<number>): Action { +export function fetchIllustSuccess(ids: number[]): Action { return { type: FETCH_ILLUST_SUCCESS, ids, } } - -export function fetchMangaSuccess(ids: Array<number>): Action { +export function fetchMangaSuccess(ids: number[]): Action { return { type: FETCH_MANGA_SUCCESS, ids, } } - -export function addDrawerIllustIds(ids: Array<number>): Action { +export function addDrawerIllustIds(ids: number[]): Action { return { type: ADD_DRAWER_ILLUST_IDS, ids, } } - -export function addDrawerMangaIds(ids: Array<number>): Action { +export function addDrawerMangaIds(ids: number[]): Action { return { type: ADD_DRAWER_MANGA_IDS, ids, } } - export function fetchIllustFailure(error: string): Action { return { type: FETCH_ILLUST_FAILURE, error, } } - export function fetchMangaFailure(error: string): Action { return { type: FETCH_MANGA_FAILURE, diff --git a/app/containers/UserDrawerContainer/constants.js b/app/containers/UserDrawerContainer/constants.ts similarity index 99% rename from app/containers/UserDrawerContainer/constants.js rename to app/containers/UserDrawerContainer/constants.ts index 3c56e6f4..1c0388a0 100644 --- a/app/containers/UserDrawerContainer/constants.js +++ b/app/containers/UserDrawerContainer/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { FETCH_ILLUST_TYPE, FETCH_ILLUST_SUCCESS_TYPE, FETCH_ILLUST_FAILURE_TYPE, diff --git a/app/containers/UserDrawerContainer/reducer.js b/app/containers/UserDrawerContainer/reducer.ts similarity index 70% rename from app/containers/UserDrawerContainer/reducer.js rename to app/containers/UserDrawerContainer/reducer.ts index 7381b6d5..424892d7 100644 --- a/app/containers/UserDrawerContainer/reducer.js +++ b/app/containers/UserDrawerContainer/reducer.ts @@ -1,21 +1,18 @@ -// @flow -import type { User, Profile } from 'types/user' -import type { Action } from '../../action' +import { User, Profile } from 'types/user' +import { Action } from '../../action' import * as ManegerActions from '../DrawerManager/constants' import * as Actions from './constants' export type DrawerType = 'illust' | 'manga' - -export type State = { - user: ?User, - profile: ?Profile, - illustList: Array<number>, - mangaList: Array<number>, - nextIllustUrl: ?string, - nextMangaUrl: ?string, - isLoading: boolean, +export interface State { + user: User | null | undefined + profile: Profile | null | undefined + illustList: number[] + mangaList: number[] + nextIllustUrl: string | null | undefined + nextMangaUrl: string | null | undefined + isLoading: boolean } - export const initialState: State = { user: null, profile: null, @@ -25,11 +22,7 @@ export const initialState: State = { nextMangaUrl: null, isLoading: false, } - -export default function( - state: State = initialState, - action: Action -): $Shape<State> { +export default function(state: State = initialState, action: Action): State { switch (action.type) { case ManegerActions.CLOSE_DRAWER: return initialState diff --git a/app/containers/UserPopoverContainer/actionTypes.js b/app/containers/UserPopoverContainer/actionTypes.ts similarity index 61% rename from app/containers/UserPopoverContainer/actionTypes.js rename to app/containers/UserPopoverContainer/actionTypes.ts index d41f36e6..adf97e2b 100644 --- a/app/containers/UserPopoverContainer/actionTypes.js +++ b/app/containers/UserPopoverContainer/actionTypes.ts @@ -1,16 +1,21 @@ -// @flow export type OPEN_TYPE = 'UserPopoverContainer/OPEN' export type CLEAR_TYPE = 'UserPopoverContainer/CLEAR' - export type POPOVER_TYPE = 'UserPopoverContainer/ADD_POPOVER' export type POPOVER_SUCCESS_TYPE = 'UserPopoverContainer/ADD_POPOVER_SUCCESS' export type POPOVER_FAILRE_TYPE = 'UserPopoverContainer/ADD_POPOVER_FAILRE' - export type Action = - | {| +type: OPEN_TYPE, id: number |} - | {| - +type: POPOVER_SUCCESS_TYPE, - illusts: Array<number>, - |} - | {| +type: CLEAR_TYPE |} - | {| +type: POPOVER_FAILRE_TYPE, +error: string |} + | { + type: OPEN_TYPE + id: number + } + | { + type: POPOVER_SUCCESS_TYPE + illusts: number[] + } + | { + type: CLEAR_TYPE + } + | { + type: POPOVER_FAILRE_TYPE + error: string + } diff --git a/app/containers/UserPopoverContainer/actions.js b/app/containers/UserPopoverContainer/actions.ts similarity index 76% rename from app/containers/UserPopoverContainer/actions.js rename to app/containers/UserPopoverContainer/actions.ts index 50ebe9fe..f9ef908a 100644 --- a/app/containers/UserPopoverContainer/actions.js +++ b/app/containers/UserPopoverContainer/actions.ts @@ -1,5 +1,4 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import { OPEN, POPOVER_SUCCESS, CLEAR, POPOVER_FAILRE } from './constants' export function open(id: number): Action { @@ -8,20 +7,17 @@ export function open(id: number): Action { id, } } - -export function popoverSuccess(illusts: Array<number>): Action { +export function popoverSuccess(illusts: number[]): Action { return { type: POPOVER_SUCCESS, illusts, } } - export function clear(): Action { return { type: CLEAR, } } - export function popoverFailre(error: string): Action { return { type: POPOVER_FAILRE, diff --git a/app/containers/UserPopoverContainer/constants.js b/app/containers/UserPopoverContainer/constants.ts similarity index 95% rename from app/containers/UserPopoverContainer/constants.js rename to app/containers/UserPopoverContainer/constants.ts index 709303d9..f47bcf4c 100644 --- a/app/containers/UserPopoverContainer/constants.js +++ b/app/containers/UserPopoverContainer/constants.ts @@ -1,5 +1,4 @@ -// @flow -import type { +import { OPEN_TYPE, CLEAR_TYPE, POPOVER_TYPE, diff --git a/app/containers/UserPopoverContainer/reducer.js b/app/containers/UserPopoverContainer/reducer.ts similarity index 61% rename from app/containers/UserPopoverContainer/reducer.js rename to app/containers/UserPopoverContainer/reducer.ts index 6d9f4fb5..390a9f70 100644 --- a/app/containers/UserPopoverContainer/reducer.js +++ b/app/containers/UserPopoverContainer/reducer.ts @@ -1,21 +1,24 @@ -// @flow -import type { Action } from './actionTypes' +import { Action } from './actionTypes' import * as Actions from './constants' -export type State = { - illusts: Array<number>, +export interface State { + illusts: number[] } - const initialState: State = { illusts: [], } - export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.POPOVER_SUCCESS: - return { illusts: action.illusts } + return { + illusts: action.illusts, + } + case Actions.CLEAR: - return { illusts: [] } + return { + illusts: [], + } + default: return state } diff --git a/package.json b/package.json index d2dfb852..89e4715b 100644 --- a/package.json +++ b/package.json @@ -98,6 +98,8 @@ "@babel/register": "7.5.5", "@types/camelcase-keys": "^4.0.0", "@types/jest": "^24.0.9", + "@types/lodash": "^4.14.122", + "@types/ms": "^0.7.30", "@types/react": "^16.8.6", "@types/styled-components": "^4.1.12", "all-contributors-cli": "6.8.1", diff --git a/yarn.lock b/yarn.lock index 08f15e76..a59f52d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1161,11 +1161,21 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636" integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A== +"@types/lodash@^4.14.122": + version "4.14.122" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.122.tgz#3e31394c38cf1e5949fb54c1192cbc406f152c6c" + integrity sha512-9IdED8wU93ty8gP06ninox+42SBSJHp2IAamsSYMUY76mshRTeUsid/gtbl8ovnOwy8im41ib4cxTiIYMXGKew== + "@types/minimatch@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== +"@types/ms@^0.7.30": + version "0.7.30" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.30.tgz#f6c38b7ecbbf698b0bbd138315a0f0f18954f85f" + integrity sha512-OftRLCgAzJP7vmKn9by/GVjnf4hloz/pXNOwPo0vKGAfXI7GqWXJi9N2kRar4cP5s1dGwuwcagWqO6iHBTq1Mg== + "@types/node@*": version "12.7.2" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44" From 30d921b3afce3f0726a465a12124762301d0edd1 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Thu, 7 Mar 2019 03:27:28 +0900 Subject: [PATCH 10/25] refactor(messages,selectors): typescript --- .eslintrc | 1 + .../{messages.js => messages.ts} | 1 - .../{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 1 - .../BoxContainer/{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 4 +--- .../{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 9 ++++----- .../ColumnFollow/{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 9 ++++----- .../{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 3 +-- .../{selectors.js => selectors.ts} | 8 +++----- .../{messages.js => messages.ts} | 3 +-- .../{selectors.js => selectors.ts} | 10 ++++------ .../{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 10 ++++------ .../{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 3 +-- .../{selectors.js => selectors.ts} | 18 +++++------------- .../{selectors.js => selectors.ts} | 11 ++++------- .../{selectors.js => selectors.ts} | 3 +-- .../FollowButton/{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 3 +-- .../IllustById/{selectors.js => selectors.ts} | 19 +++++++------------ .../{selectors.js => selectors.ts} | 6 +----- .../Language/{selectors.js => selectors.ts} | 3 +-- .../LoginModal/{selectors.js => selectors.ts} | 10 +--------- .../{selectors.js => selectors.ts} | 5 +---- .../SearchField/{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 3 +-- .../SettingModal/{messages.js => messages.ts} | 1 - .../{selectors.js => selectors.ts} | 3 +-- .../Table/{selectors.js => selectors.ts} | 3 +-- .../UserById/{selectors.js => selectors.ts} | 10 +++------- .../{selectors.js => selectors.ts} | 9 +-------- .../{selectors.js => selectors.ts} | 4 +--- app/types/intl.ts | 11 +++++++++++ package.json | 1 + tsconfig.json | 7 ++++++- yarn.lock | 5 +++++ 41 files changed, 77 insertions(+), 129 deletions(-) rename app/containers/AddColumnModal/{messages.js => messages.ts} (97%) rename app/containers/AddNewColumnButton/{messages.js => messages.ts} (92%) rename app/containers/BookmarkButton/{selectors.js => selectors.ts} (95%) rename app/containers/BoxContainer/{messages.js => messages.ts} (97%) rename app/containers/BoxContainer/{selectors.js => selectors.ts} (92%) rename app/containers/ColumnBookmark/{messages.js => messages.ts} (95%) rename app/containers/ColumnBookmark/{selectors.js => selectors.ts} (84%) rename app/containers/ColumnFollow/{messages.js => messages.ts} (94%) rename app/containers/ColumnFollow/{selectors.js => selectors.ts} (84%) rename app/containers/ColumnHistory/{messages.js => messages.ts} (92%) rename app/containers/ColumnHistory/{selectors.js => selectors.ts} (91%) rename app/containers/ColumnManager/{selectors.js => selectors.ts} (80%) rename app/containers/ColumnRanking/{messages.js => messages.ts} (87%) rename app/containers/ColumnRanking/{selectors.js => selectors.ts} (85%) rename app/containers/ColumnRankingR18/{messages.js => messages.ts} (96%) rename app/containers/ColumnRankingR18/{selectors.js => selectors.ts} (86%) rename app/containers/ColumnRecommended/{messages.js => messages.ts} (94%) rename app/containers/ColumnRecommended/{selectors.js => selectors.ts} (93%) rename app/containers/ColumnSearch/{selectors.js => selectors.ts} (93%) rename app/containers/ColumnUserIllust/{selectors.js => selectors.ts} (87%) rename app/containers/DrawerManager/{selectors.js => selectors.ts} (79%) rename app/containers/FollowButton/{messages.js => messages.ts} (95%) rename app/containers/HeaderContainer/{selectors.js => selectors.ts} (88%) rename app/containers/IllustById/{selectors.js => selectors.ts} (91%) rename app/containers/IllustPreview/{selectors.js => selectors.ts} (91%) rename app/containers/Language/{selectors.js => selectors.ts} (84%) rename app/containers/LoginModal/{selectors.js => selectors.ts} (94%) rename app/containers/MangaPreview/{selectors.js => selectors.ts} (90%) rename app/containers/SearchField/{messages.js => messages.ts} (94%) rename app/containers/SearchField/{selectors.js => selectors.ts} (79%) rename app/containers/SettingModal/{messages.js => messages.ts} (98%) rename app/containers/SettingModal/{selectors.js => selectors.ts} (91%) rename app/containers/Table/{selectors.js => selectors.ts} (78%) rename app/containers/UserById/{selectors.js => selectors.ts} (77%) rename app/containers/UserDrawerContainer/{selectors.js => selectors.ts} (94%) rename app/containers/UserPopoverContainer/{selectors.js => selectors.ts} (90%) create mode 100644 app/types/intl.ts diff --git a/.eslintrc b/.eslintrc index 5210c081..9882e5a0 100644 --- a/.eslintrc +++ b/.eslintrc @@ -16,6 +16,7 @@ "rules": { "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/explicit-function-return-type": 0, + "@typescript-eslint/promise-function-async": 0, "import/named": 0, "no-constant-condition": 0, "import/no-extraneous-dependencies": 0, diff --git a/app/containers/AddColumnModal/messages.js b/app/containers/AddColumnModal/messages.ts similarity index 97% rename from app/containers/AddColumnModal/messages.js rename to app/containers/AddColumnModal/messages.ts index 5df5ea9d..27fb17ff 100644 --- a/app/containers/AddColumnModal/messages.js +++ b/app/containers/AddColumnModal/messages.ts @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/containers/AddNewColumnButton/messages.js b/app/containers/AddNewColumnButton/messages.ts similarity index 92% rename from app/containers/AddNewColumnButton/messages.js rename to app/containers/AddNewColumnButton/messages.ts index e21b0b3f..3840bfd6 100644 --- a/app/containers/AddNewColumnButton/messages.js +++ b/app/containers/AddNewColumnButton/messages.ts @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/containers/BookmarkButton/selectors.js b/app/containers/BookmarkButton/selectors.ts similarity index 95% rename from app/containers/BookmarkButton/selectors.js rename to app/containers/BookmarkButton/selectors.ts index f39294ed..84571436 100644 --- a/app/containers/BookmarkButton/selectors.js +++ b/app/containers/BookmarkButton/selectors.ts @@ -1,4 +1,3 @@ -// @flow import { createSelector } from 'reselect' import { makeSelectIllust } from '../IllustById/selectors' diff --git a/app/containers/BoxContainer/messages.js b/app/containers/BoxContainer/messages.ts similarity index 97% rename from app/containers/BoxContainer/messages.js rename to app/containers/BoxContainer/messages.ts index de73d98a..138531dc 100644 --- a/app/containers/BoxContainer/messages.js +++ b/app/containers/BoxContainer/messages.ts @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/containers/BoxContainer/selectors.js b/app/containers/BoxContainer/selectors.ts similarity index 92% rename from app/containers/BoxContainer/selectors.js rename to app/containers/BoxContainer/selectors.ts index 68aaf737..4b2c6daf 100644 --- a/app/containers/BoxContainer/selectors.js +++ b/app/containers/BoxContainer/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { makeSelectIllust } from '../IllustById/selectors' import { getUserById } from '../UserById/selectors' @@ -24,7 +23,6 @@ export const makeSelectIsIllustOnly = () => getSettingModal, s => s.isShowCaption ) - export const makeSelectIsShowOnlyIllust = () => createSelector( getSettingModal, diff --git a/app/containers/ColumnBookmark/messages.js b/app/containers/ColumnBookmark/messages.ts similarity index 95% rename from app/containers/ColumnBookmark/messages.js rename to app/containers/ColumnBookmark/messages.ts index bd46a89f..4f57b7ad 100644 --- a/app/containers/ColumnBookmark/messages.js +++ b/app/containers/ColumnBookmark/messages.ts @@ -1,4 +1,3 @@ -// @flow /* eslint-disable camelcase */ import { defineMessages } from 'react-intl' diff --git a/app/containers/ColumnBookmark/selectors.js b/app/containers/ColumnBookmark/selectors.ts similarity index 84% rename from app/containers/ColumnBookmark/selectors.js rename to app/containers/ColumnBookmark/selectors.ts index 17f19615..8c3382b9 100644 --- a/app/containers/ColumnBookmark/selectors.js +++ b/app/containers/ColumnBookmark/selectors.ts @@ -1,11 +1,10 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' -type Props = { - id: ColumnId, +interface Props { + id: ColumnId } const getColumns = (state: State) => state.ColumnBookmark diff --git a/app/containers/ColumnFollow/messages.js b/app/containers/ColumnFollow/messages.ts similarity index 94% rename from app/containers/ColumnFollow/messages.js rename to app/containers/ColumnFollow/messages.ts index c3e5c71d..6e94633c 100644 --- a/app/containers/ColumnFollow/messages.js +++ b/app/containers/ColumnFollow/messages.ts @@ -1,4 +1,3 @@ -// @flow /* eslint-disable camelcase */ import { defineMessages } from 'react-intl' diff --git a/app/containers/ColumnFollow/selectors.js b/app/containers/ColumnFollow/selectors.ts similarity index 84% rename from app/containers/ColumnFollow/selectors.js rename to app/containers/ColumnFollow/selectors.ts index 10c182b8..29da772d 100644 --- a/app/containers/ColumnFollow/selectors.js +++ b/app/containers/ColumnFollow/selectors.ts @@ -1,11 +1,10 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' -type Props = { - id: ColumnId, +interface Props { + id: ColumnId } const getColumns = (state: State) => state.ColumnFollow diff --git a/app/containers/ColumnHistory/messages.js b/app/containers/ColumnHistory/messages.ts similarity index 92% rename from app/containers/ColumnHistory/messages.js rename to app/containers/ColumnHistory/messages.ts index 96631ae1..8d75db5a 100644 --- a/app/containers/ColumnHistory/messages.js +++ b/app/containers/ColumnHistory/messages.ts @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/containers/ColumnHistory/selectors.js b/app/containers/ColumnHistory/selectors.ts similarity index 91% rename from app/containers/ColumnHistory/selectors.js rename to app/containers/ColumnHistory/selectors.ts index 9415884f..70f20139 100644 --- a/app/containers/ColumnHistory/selectors.js +++ b/app/containers/ColumnHistory/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' const getColumn = (state: State) => state.ColumnHistory diff --git a/app/containers/ColumnManager/selectors.js b/app/containers/ColumnManager/selectors.ts similarity index 80% rename from app/containers/ColumnManager/selectors.js rename to app/containers/ColumnManager/selectors.ts index b309648b..1c96ee89 100644 --- a/app/containers/ColumnManager/selectors.js +++ b/app/containers/ColumnManager/selectors.ts @@ -1,9 +1,8 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' -type Props = { - id: string, +interface Props { + id: string } const getColumnManeger = (state: State, { id }: Props) => @@ -14,7 +13,6 @@ export const makeSelectColumnId = () => getColumnManeger, s => s.columnId ) - export const makeSelectType = () => createSelector( getColumnManeger, diff --git a/app/containers/ColumnRanking/messages.js b/app/containers/ColumnRanking/messages.ts similarity index 87% rename from app/containers/ColumnRanking/messages.js rename to app/containers/ColumnRanking/messages.ts index b21aa932..c58c6281 100644 --- a/app/containers/ColumnRanking/messages.js +++ b/app/containers/ColumnRanking/messages.ts @@ -1,5 +1,4 @@ -// @flow -/* eslint-disable camelcase */ +/* eslint-disable @typescript-eslint/camelcase */ import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/containers/ColumnRanking/selectors.js b/app/containers/ColumnRanking/selectors.ts similarity index 85% rename from app/containers/ColumnRanking/selectors.js rename to app/containers/ColumnRanking/selectors.ts index d3aa1357..686e3bc2 100644 --- a/app/containers/ColumnRanking/selectors.js +++ b/app/containers/ColumnRanking/selectors.ts @@ -1,11 +1,10 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' -import type { Mode } from './reducer' +import { Mode } from './reducer' -type Props = { - id: Mode, +interface Props { + id: Mode } const getColumns = (state: State) => state.ColumnRanking @@ -24,7 +23,6 @@ export const makeSelectColumn = () => s => s ) -// $FlowFixMe export const getInterval = createSelector( getColumn, s => s.interval diff --git a/app/containers/ColumnRankingR18/messages.js b/app/containers/ColumnRankingR18/messages.ts similarity index 96% rename from app/containers/ColumnRankingR18/messages.js rename to app/containers/ColumnRankingR18/messages.ts index b9498bc3..4f3e4567 100644 --- a/app/containers/ColumnRankingR18/messages.js +++ b/app/containers/ColumnRankingR18/messages.ts @@ -1,4 +1,3 @@ -// @flow /* eslint-disable camelcase */ import { defineMessages } from 'react-intl' diff --git a/app/containers/ColumnRankingR18/selectors.js b/app/containers/ColumnRankingR18/selectors.ts similarity index 86% rename from app/containers/ColumnRankingR18/selectors.js rename to app/containers/ColumnRankingR18/selectors.ts index d77d6535..0c126e02 100644 --- a/app/containers/ColumnRankingR18/selectors.js +++ b/app/containers/ColumnRankingR18/selectors.ts @@ -1,11 +1,10 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' -import type { R18Mode } from './reducer' +import { R18Mode } from './reducer' -type Props = { - id: R18Mode, +interface Props { + id: R18Mode } const getR18Columns = (state: State) => state.ColumnRankingR18 @@ -23,7 +22,6 @@ export const makeSelectColumn = () => getColumn, s => s ) - export const getInterval = createSelector( getColumn, s => s.interval diff --git a/app/containers/ColumnRecommended/messages.js b/app/containers/ColumnRecommended/messages.ts similarity index 94% rename from app/containers/ColumnRecommended/messages.js rename to app/containers/ColumnRecommended/messages.ts index 7da5321c..b806571c 100644 --- a/app/containers/ColumnRecommended/messages.js +++ b/app/containers/ColumnRecommended/messages.ts @@ -1,4 +1,3 @@ -// @flow /* eslint-disable camelcase */ import { defineMessages } from 'react-intl' diff --git a/app/containers/ColumnRecommended/selectors.js b/app/containers/ColumnRecommended/selectors.ts similarity index 93% rename from app/containers/ColumnRecommended/selectors.js rename to app/containers/ColumnRecommended/selectors.ts index f52ffe57..ab7d22dc 100644 --- a/app/containers/ColumnRecommended/selectors.js +++ b/app/containers/ColumnRecommended/selectors.ts @@ -1,7 +1,6 @@ -// @flow import { isEmpty } from 'lodash' import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' const getC = (state: State) => state.ColumnRecommended diff --git a/app/containers/ColumnSearch/selectors.js b/app/containers/ColumnSearch/selectors.ts similarity index 93% rename from app/containers/ColumnSearch/selectors.js rename to app/containers/ColumnSearch/selectors.ts index dbf455ff..0f49ab7b 100644 --- a/app/containers/ColumnSearch/selectors.js +++ b/app/containers/ColumnSearch/selectors.ts @@ -1,11 +1,10 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { makeIllustsFilterByTags } from '../IllustById/selectors' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' -type Props = { - id: ColumnId, +interface Props { + id: ColumnId } const getColumns = (state: State) => state.ColumnSearch @@ -23,30 +22,25 @@ export const makeSelectColumn = () => getColumn, s => s ) - export const getInterval = createSelector( makeSelectColumn(), s => s.interval ) - export const makeSelectMinBookmark = () => createSelector( makeSelectColumn(), s => s.minBookmarks || 0 ) - export const makeSelectNextUrl = () => createSelector( makeSelectColumn(), s => s.nextUrl ) - export const makeSelectUsesIn = () => createSelector( makeSelectColumn(), s => s.usersIn ) - export const makeSelectHasMore = () => createSelector( makeSelectColumn(), @@ -58,6 +52,7 @@ export const makeSelectHasMore = () => } else if (!s.nextUrl && s.ids.length === 0) { return true } + return true } ) @@ -76,20 +71,17 @@ export const makeSelectIllusts = () => return s.map(v => obj[v]).filter(v => v) } ) - export const makeLimitedSelectIllusts = () => createSelector( makeSelectIllusts(), makeSelectMinBookmark(), (s, limit) => s.filter(s => s.totalBookmarks > limit) ) - export const makeLimitedSelectIllustsId = () => createSelector( makeLimitedSelectIllusts(), s => s.map(v => v.id) ) - export const makeIllustLength = () => createSelector( makeLimitedSelectIllusts(), diff --git a/app/containers/ColumnUserIllust/selectors.js b/app/containers/ColumnUserIllust/selectors.ts similarity index 87% rename from app/containers/ColumnUserIllust/selectors.js rename to app/containers/ColumnUserIllust/selectors.ts index bd3183f3..8fb3208d 100644 --- a/app/containers/ColumnUserIllust/selectors.js +++ b/app/containers/ColumnUserIllust/selectors.ts @@ -1,13 +1,11 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' import { getSelectUser } from '../UserById/selectors' +import { ColumnId } from './reducer' -import type { ColumnId } from './reducer' - -type Props = { - id: ColumnId, +interface Props { + id: ColumnId } const getColumns = (state: State) => state.ColumnUserIllust @@ -37,7 +35,6 @@ export const makeSelectUser = () => getSelectUser, s => s ) - export const makeSelectIllusts = () => createSelector( makeSelectIllustIds(), diff --git a/app/containers/DrawerManager/selectors.js b/app/containers/DrawerManager/selectors.ts similarity index 79% rename from app/containers/DrawerManager/selectors.js rename to app/containers/DrawerManager/selectors.ts index 5cefd755..42b4116c 100644 --- a/app/containers/DrawerManager/selectors.js +++ b/app/containers/DrawerManager/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' const selectRoot = (state: State) => state.DrawerManager diff --git a/app/containers/FollowButton/messages.js b/app/containers/FollowButton/messages.ts similarity index 95% rename from app/containers/FollowButton/messages.js rename to app/containers/FollowButton/messages.ts index e0f47758..0682fa85 100644 --- a/app/containers/FollowButton/messages.js +++ b/app/containers/FollowButton/messages.ts @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/containers/HeaderContainer/selectors.js b/app/containers/HeaderContainer/selectors.ts similarity index 88% rename from app/containers/HeaderContainer/selectors.js rename to app/containers/HeaderContainer/selectors.ts index 7ac9a602..7fc292a6 100644 --- a/app/containers/HeaderContainer/selectors.js +++ b/app/containers/HeaderContainer/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' const selectHeader = (state: State) => state.HeaderContainer diff --git a/app/containers/IllustById/selectors.js b/app/containers/IllustById/selectors.ts similarity index 91% rename from app/containers/IllustById/selectors.js rename to app/containers/IllustById/selectors.ts index 7325ffca..fa7a1227 100644 --- a/app/containers/IllustById/selectors.js +++ b/app/containers/IllustById/selectors.ts @@ -1,35 +1,28 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' -type Props = { - id: number, +interface Props { + id: number } - export const getIllustById = (state: State) => state.IllustById - export const getSelectIllust = (state: State, { id }: Props) => state.IllustById[id] - export const makeSelectIllust = () => createSelector( getSelectIllust, s => s ) - export const makeSelectIllustTags = () => createSelector( getSelectIllust, s => s.tags ) - export const makeSelectIllustTagNames = () => createSelector( makeSelectIllustTags(), s => s.map(t => t.name) - ) + ) // タグでフィルター -// タグでフィルター const getTags = (state: State) => state.SettingModal.tags export const makeIllustFilterByTags = () => @@ -41,10 +34,10 @@ export const makeIllustFilterByTags = () => if (names.every(name => tags.every(tag => name.includes(tag)))) { return illust } + return null } ) - export const makeIllustsFilterByTags = () => createSelector( getIllustById, @@ -53,9 +46,11 @@ export const makeIllustsFilterByTags = () => const result = Object.keys(obj).reduce((acc, key) => { const illust = obj[key] const names = illust.tags.map(t => t.name) + if (names.every(name => tags.every(tag => !name.includes(tag)))) { acc[key] = illust } + return acc }, {}) return result diff --git a/app/containers/IllustPreview/selectors.js b/app/containers/IllustPreview/selectors.ts similarity index 91% rename from app/containers/IllustPreview/selectors.js rename to app/containers/IllustPreview/selectors.ts index 8c280244..c3136ae8 100644 --- a/app/containers/IllustPreview/selectors.js +++ b/app/containers/IllustPreview/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' const selectIllustPreview = (state: State) => state.IllustPreview @@ -10,18 +9,15 @@ export const makeSelectIsImage = () => selectIllustPreview, s => s.open ) - export const makeSelectIsImgLoding = () => createSelector( selectIllustPreview, s => s.isImgLoading ) - const getSelectId = createSelector( selectIllustPreview, s => s.id ) - export const makeSelectIllust = () => createSelector( getIllustById, diff --git a/app/containers/Language/selectors.js b/app/containers/Language/selectors.ts similarity index 84% rename from app/containers/Language/selectors.js rename to app/containers/Language/selectors.ts index 556fdf58..96813679 100644 --- a/app/containers/Language/selectors.js +++ b/app/containers/Language/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types' +import { State } from 'types' const selectLanguage = (state: State) => state.Language diff --git a/app/containers/LoginModal/selectors.js b/app/containers/LoginModal/selectors.ts similarity index 94% rename from app/containers/LoginModal/selectors.js rename to app/containers/LoginModal/selectors.ts index 386d110d..bd2bb4d7 100644 --- a/app/containers/LoginModal/selectors.js +++ b/app/containers/LoginModal/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector, createStructuredSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' const selectAuth = (state: State) => state.LoginModal @@ -9,43 +8,36 @@ export const makeSelectUsername = () => selectAuth, s => s.username ) - export const makeSelectPassword = () => createSelector( selectAuth, s => s.password ) - export const makeSelectRefreshToken = () => createSelector( selectAuth, s => s.refreshToken ) - export const makeSelectInfo = () => createStructuredSelector({ username: makeSelectUsername(), password: makeSelectPassword(), refreshToken: makeSelectRefreshToken(), }) - export const makeSelectIsLoading = () => createSelector( selectAuth, s => s.isLoading ) - export const makeSelectIsLoginFailure = () => createSelector( selectAuth, s => s.isLoginFailure ) - const getAccount = createSelector( selectAuth, s => s.account ) - export const getMyId = createSelector( getAccount, s => (s ? s.id : null) diff --git a/app/containers/MangaPreview/selectors.js b/app/containers/MangaPreview/selectors.ts similarity index 90% rename from app/containers/MangaPreview/selectors.js rename to app/containers/MangaPreview/selectors.ts index a9e12978..a7b5e75a 100644 --- a/app/containers/MangaPreview/selectors.js +++ b/app/containers/MangaPreview/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' const selectPreviewSelect = (state: State) => state.MangaPreview @@ -9,14 +8,12 @@ const getSelectId = createSelector( selectPreviewSelect, s => s.id ) - export const makeSelectIllust = () => createSelector( getIllustById, getSelectId, (illusts, id) => id && illusts[id] ) - export const makeSelectOpen = () => createSelector( selectPreviewSelect, diff --git a/app/containers/SearchField/messages.js b/app/containers/SearchField/messages.ts similarity index 94% rename from app/containers/SearchField/messages.js rename to app/containers/SearchField/messages.ts index 4e4d1de9..64c81b4b 100644 --- a/app/containers/SearchField/messages.js +++ b/app/containers/SearchField/messages.ts @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/containers/SearchField/selectors.js b/app/containers/SearchField/selectors.ts similarity index 79% rename from app/containers/SearchField/selectors.js rename to app/containers/SearchField/selectors.ts index 0a885640..4fa74e57 100644 --- a/app/containers/SearchField/selectors.js +++ b/app/containers/SearchField/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' const selectRoot = (state: State) => state.SearchField diff --git a/app/containers/SettingModal/messages.js b/app/containers/SettingModal/messages.ts similarity index 98% rename from app/containers/SettingModal/messages.js rename to app/containers/SettingModal/messages.ts index fb29134d..0a4845bd 100644 --- a/app/containers/SettingModal/messages.js +++ b/app/containers/SettingModal/messages.ts @@ -1,4 +1,3 @@ -// @flow import { defineMessages } from 'react-intl' export default defineMessages({ diff --git a/app/containers/SettingModal/selectors.js b/app/containers/SettingModal/selectors.ts similarity index 91% rename from app/containers/SettingModal/selectors.js rename to app/containers/SettingModal/selectors.ts index c39ed375..0a6123fe 100644 --- a/app/containers/SettingModal/selectors.js +++ b/app/containers/SettingModal/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' const selectSettingModal = (state: State) => state.SettingModal diff --git a/app/containers/Table/selectors.js b/app/containers/Table/selectors.ts similarity index 78% rename from app/containers/Table/selectors.js rename to app/containers/Table/selectors.ts index 88e6a169..8fba2389 100644 --- a/app/containers/Table/selectors.js +++ b/app/containers/Table/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' const selectRoot = (state: State) => state.Table diff --git a/app/containers/UserById/selectors.js b/app/containers/UserById/selectors.ts similarity index 77% rename from app/containers/UserById/selectors.js rename to app/containers/UserById/selectors.ts index 527ed4ea..e058d68a 100644 --- a/app/containers/UserById/selectors.js +++ b/app/containers/UserById/selectors.ts @@ -1,15 +1,11 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' -type Props = { - id: number, +interface Props { + id: number } - export const getUserById = (state: State) => state.UserById - export const getSelectUser = (state: State, { id }: Props) => state.UserById[id] - export const makeSelectUserById = () => createSelector( getSelectUser, diff --git a/app/containers/UserDrawerContainer/selectors.js b/app/containers/UserDrawerContainer/selectors.ts similarity index 94% rename from app/containers/UserDrawerContainer/selectors.js rename to app/containers/UserDrawerContainer/selectors.ts index 5935531a..f1691ed6 100644 --- a/app/containers/UserDrawerContainer/selectors.js +++ b/app/containers/UserDrawerContainer/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' import { getIllustById } from '../IllustById/selectors' const selectRoot = (state: State) => state.UserDrawerContainer @@ -10,19 +9,16 @@ export const makeSelectProfile = () => selectRoot, s => s.profile ) - export const makeSelectIllustList = () => createSelector( selectRoot, s => s.illustList ) - export const makeSelectMangaList = () => createSelector( selectRoot, s => s.mangaList ) - export const getNextIllustUrl = createSelector( selectRoot, s => s.nextIllustUrl @@ -31,20 +27,17 @@ export const getNextMangaUrl = createSelector( selectRoot, s => s.nextMangaUrl ) - export const makeSelectUser = () => createSelector( selectRoot, s => s.user ) - export const makeGetIllusts = () => createSelector( makeSelectIllustList(), getIllustById, (s, arr) => s.map(v => arr[v]) ) - export const makeGetMangas = () => createSelector( makeSelectMangaList(), diff --git a/app/containers/UserPopoverContainer/selectors.js b/app/containers/UserPopoverContainer/selectors.ts similarity index 90% rename from app/containers/UserPopoverContainer/selectors.js rename to app/containers/UserPopoverContainer/selectors.ts index 664866c2..c52d67bd 100644 --- a/app/containers/UserPopoverContainer/selectors.js +++ b/app/containers/UserPopoverContainer/selectors.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types' +import { State } from 'types' import { getIllustById } from '../IllustById/selectors' const selectPopover = (state: State) => state.UserPopoverContainer @@ -10,7 +9,6 @@ export const makeSelectIllusts = () => selectPopover, s => s.illusts ) - export const makeLimitedIllust = () => createSelector( getIllustById, diff --git a/app/types/intl.ts b/app/types/intl.ts new file mode 100644 index 00000000..5ef9a452 --- /dev/null +++ b/app/types/intl.ts @@ -0,0 +1,11 @@ +import { FormattedMessage } from 'react-intl' + +declare module 'react-intl' { + interface ExtractableMessage { + [key: string]: string + } + + export function defineMessages<T extends ExtractableMessage>( + messages: T + ): { [Key in keyof T]: FormattedMessage.MessageDescriptor } +} diff --git a/package.json b/package.json index 89e4715b..adb68466 100644 --- a/package.json +++ b/package.json @@ -101,6 +101,7 @@ "@types/lodash": "^4.14.122", "@types/ms": "^0.7.30", "@types/react": "^16.8.6", + "@types/react-intl": "^2.3.17", "@types/styled-components": "^4.1.12", "all-contributors-cli": "6.8.1", "babel-eslint": "10.0.2", diff --git a/tsconfig.json b/tsconfig.json index 7724ba32..3f8b7ffa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,11 @@ { "extends": "@akameco/tsconfig", "compilerOptions": { + "lib": ["dom", "esnext"], "rootDirs": ["types", "styles", "components", "containers"] - } + }, + "include": [ + "node_modules/babel-plugin-react-intl-auto/**/*.d.ts", + "types/intl" + ] } diff --git a/yarn.lock b/yarn.lock index a59f52d6..78a09554 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1196,6 +1196,11 @@ resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6" integrity sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg== +"@types/react-intl@^2.3.17": + version "2.3.17" + resolved "https://registry.yarnpkg.com/@types/react-intl/-/react-intl-2.3.17.tgz#e1fc6e46e8af58bdef9531259d509380a8a99e8e" + integrity sha512-FGd6J1GQ7zvl1GZ3BBev83B7nfak8dqoR2PZ+l5MoisKMpd4xOLhZJC1ugpmk3Rz5F85t6HbOg9mYqXW97BsNA== + "@types/react-native@*": version "0.57.38" resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.57.38.tgz#2ff6ed1a7cc207afbfd87bf496513d96931d1446" From 27f72eb4ca4634836e0bcd6d3c4211977577d67c Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Sun, 10 Mar 2019 04:05:28 +0900 Subject: [PATCH 11/25] refactor(typescript): sagas --- .../AddColumnModal/{styles.js => styles.ts} | 3 - app/containers/Api/{sagas.js => sagas.ts} | 16 ++-- .../BookmarkButton/{saga.js => saga.ts} | 28 +++---- .../BoxContainer/{saga.js => saga.ts} | 6 +- app/containers/Column/{sagas.js => sagas.ts} | 44 +++++----- .../ColumnBookmark/{saga.js => saga.ts} | 49 +++++++----- .../ColumnFollow/{saga.js => saga.ts} | 63 ++++++++++----- .../ColumnHistory/{saga.js => saga.ts} | 23 +++--- app/containers/ColumnRanking/saga.js | 62 -------------- .../saga.js => ColumnRanking/saga.ts} | 53 +++++++----- app/containers/ColumnRankingR18/saga.ts | 80 +++++++++++++++++++ .../ColumnRecommended/{saga.js => saga.ts} | 20 ++--- app/containers/ColumnSearch/reducer.ts | 2 + .../ColumnSearch/{saga.js => saga.ts} | 68 ++++++++-------- .../ColumnUserIllust/{saga.js => saga.ts} | 33 ++++---- .../FollowButton/{saga.js => saga.ts} | 24 +++--- .../IllustPreview/{styles.js => styles.ts} | 1 - .../LoginModal/{saga.js => saga.ts} | 19 +++-- .../MangaPreview/{styles.js => styles.ts} | 1 - app/containers/Notify/{saga.js => saga.ts} | 41 +++++----- .../SearchField/{saga.js => saga.ts} | 11 +-- .../SearchField/{styles.js => styles.ts} | 4 - .../SettingModal/{saga.js => saga.ts} | 7 +- .../SettingModal/{styles.js => styles.ts} | 6 -- app/containers/Table/{saga.js => saga.ts} | 6 +- .../UserDrawerContainer/{saga.js => saga.ts} | 37 +++------ .../UserPopoverContainer/{saga.js => saga.ts} | 9 +-- 27 files changed, 371 insertions(+), 345 deletions(-) rename app/containers/AddColumnModal/{styles.js => styles.ts} (97%) rename app/containers/Api/{sagas.js => sagas.ts} (63%) rename app/containers/BookmarkButton/{saga.js => saga.ts} (68%) rename app/containers/BoxContainer/{saga.js => saga.ts} (65%) rename app/containers/Column/{sagas.js => sagas.ts} (69%) rename app/containers/ColumnBookmark/{saga.js => saga.ts} (58%) rename app/containers/ColumnFollow/{saga.js => saga.ts} (68%) rename app/containers/ColumnHistory/{saga.js => saga.ts} (61%) delete mode 100644 app/containers/ColumnRanking/saga.js rename app/containers/{ColumnRankingR18/saga.js => ColumnRanking/saga.ts} (56%) create mode 100644 app/containers/ColumnRankingR18/saga.ts rename app/containers/ColumnRecommended/{saga.js => saga.ts} (69%) rename app/containers/ColumnSearch/{saga.js => saga.ts} (72%) rename app/containers/ColumnUserIllust/{saga.js => saga.ts} (55%) rename app/containers/FollowButton/{saga.js => saga.ts} (67%) rename app/containers/IllustPreview/{styles.js => styles.ts} (96%) rename app/containers/LoginModal/{saga.js => saga.ts} (73%) rename app/containers/MangaPreview/{styles.js => styles.ts} (98%) rename app/containers/Notify/{saga.js => saga.ts} (65%) rename app/containers/SearchField/{saga.js => saga.ts} (76%) rename app/containers/SearchField/{styles.js => styles.ts} (98%) rename app/containers/SettingModal/{saga.js => saga.ts} (60%) rename app/containers/SettingModal/{styles.js => styles.ts} (98%) rename app/containers/Table/{saga.js => saga.ts} (63%) rename app/containers/UserDrawerContainer/{saga.js => saga.ts} (82%) rename app/containers/UserPopoverContainer/{saga.js => saga.ts} (85%) diff --git a/app/containers/AddColumnModal/styles.js b/app/containers/AddColumnModal/styles.ts similarity index 97% rename from app/containers/AddColumnModal/styles.js rename to app/containers/AddColumnModal/styles.ts index 3f9d699b..711ffbbd 100644 --- a/app/containers/AddColumnModal/styles.js +++ b/app/containers/AddColumnModal/styles.ts @@ -1,11 +1,9 @@ -// @flow import styled from 'styled-components' export const Wrap = styled.div` height: calc(100% - 1rem); padding: 1rem; ` - export const Content = styled.div` display: flex; flex-direction: row; @@ -13,7 +11,6 @@ export const Content = styled.div` padding-bottom: 10px; overflow-y: auto; ` - export const Header = styled.div` font-weight: 500; margin-left: 10px; diff --git a/app/containers/Api/sagas.js b/app/containers/Api/sagas.ts similarity index 63% rename from app/containers/Api/sagas.js rename to app/containers/Api/sagas.ts index f702d1f0..18764203 100644 --- a/app/containers/Api/sagas.js +++ b/app/containers/Api/sagas.ts @@ -1,27 +1,23 @@ -// @flow import { call, put } from 'redux-saga/effects' import { getToken } from 'containers/LoginModal/saga' import * as api from 'services/api' -import type { Response } from 'services/api' import * as actions from './actions' -export function* post(endpoint: string, data: Object): Generator<*, void, *> { +export function* post(endpoint: string, data: object) { const token = yield call(getToken) yield call(api.postRequest, endpoint, data, token) } -export function* get( - endpoint: string, - isToken?: boolean -): Generator<*, Response, *> { +export function* get(endpoint: string, isToken?: boolean) { let token = null + if (isToken) { token = yield call(getToken) } - // $FlowFixMe + const response = yield call(api.getRequest, endpoint, {}, token) - // $FlowFixMe + yield put(actions.apiRequestSuccess(response)) - // $FlowFixMe + return response } diff --git a/app/containers/BookmarkButton/saga.js b/app/containers/BookmarkButton/saga.ts similarity index 68% rename from app/containers/BookmarkButton/saga.js rename to app/containers/BookmarkButton/saga.ts index dbf20eaa..b7b00427 100644 --- a/app/containers/BookmarkButton/saga.js +++ b/app/containers/BookmarkButton/saga.ts @@ -1,31 +1,31 @@ -// @flow -import type { Saga } from 'redux-saga' import { call, put, takeEvery } from 'redux-saga/effects' import * as api from 'containers/Api/sagas' import { get } from '../Api/sagas' import * as columnActions from '../ColumnBookmark/actions' import * as Actions from './constants' import * as actions from './actions' -import type { Restrict } from './types' +import { Restrict } from './types' -type Props = { - id: number, - restrict: Restrict, +interface Props { + id: number + restrict: Restrict } - -export function* bookmark({ id, restrict }: Props): Saga<void> { +export function* bookmark({ id, restrict }: Props) { try { - yield call(api.post, '/v2/illust/bookmark/add', { illustId: id, restrict }) - + yield call(api.post, '/v2/illust/bookmark/add', { + illustId: id, + restrict, + }) yield put(actions.addBookmarkSuccess(id, restrict)) } catch (error) { yield put(actions.addBookmarkFailer(id, error)) } } - -export function* deleteTask({ id }: Props): Saga<void> { +export function* deleteTask({ id }: Props) { try { - yield call(api.post, '/v1/illust/bookmark/delete', { illustId: id }) + yield call(api.post, '/v1/illust/bookmark/delete', { + illustId: id, + }) yield put(actions.deleteBookmarkSuccess(id)) yield put(columnActions.removeItem('public', id)) } catch (error) { @@ -39,7 +39,7 @@ function* success({ id }: Props) { } catch (error) {} } -function* root(): Saga<void> { +function* root() { yield takeEvery(Actions.ADD_BOOKMARK_REQUEST, bookmark) yield takeEvery(Actions.DELETE_BOOKMARK_REQUEST, deleteTask) yield takeEvery( diff --git a/app/containers/BoxContainer/saga.js b/app/containers/BoxContainer/saga.ts similarity index 65% rename from app/containers/BoxContainer/saga.js rename to app/containers/BoxContainer/saga.ts index 879ca62b..8b3b4d3e 100644 --- a/app/containers/BoxContainer/saga.js +++ b/app/containers/BoxContainer/saga.ts @@ -1,16 +1,14 @@ -// @flow import { shell } from 'electron' -import type { Saga } from 'redux-saga' import { call, takeEvery } from 'redux-saga/effects' import * as Actions from './constants' -function* openPixiv({ id }: { id: number }): Saga<void> { +function* openPixiv({ id }: { id: number }) { yield call( shell.openExternal, `http://www.pixiv.net/member_illust.php?mode=medium&illust_id=${id}` ) } -export default function* root(): Saga<void> { +export default function* root() { yield takeEvery(Actions.OPEN_PIXIV, openPixiv) } diff --git a/app/containers/Column/sagas.js b/app/containers/Column/sagas.ts similarity index 69% rename from app/containers/Column/sagas.js rename to app/containers/Column/sagas.ts index e05eb936..9c787c34 100644 --- a/app/containers/Column/sagas.js +++ b/app/containers/Column/sagas.ts @@ -1,54 +1,50 @@ -// @flow import { union } from 'lodash' import { put, call } from 'redux-saga/effects' -import type { Response } from 'services/api' +import { Response } from 'services/api' import * as api from '../Api/sagas' -type Actions = { - fetchSuccess: (id: *, ids: Array<number>) => *, - fetchFailre: (id: *, error: string) => *, - setNextUrl: (id: *, nextUrl: string) => *, +interface Actions { + fetchSuccess: (id: any, ids: number[]) => any + fetchFailre: (id: any, error: string) => any + setNextUrl: (id: any, nextUrl: string) => any } export function* fetchColumn( - endpoint: ?string, - id: *, + endpoint: string | null | undefined, + id: any, actions: Actions, - ids: Array<number> -): Generator<*, void, *> { + ids: number[] +) { try { if (!endpoint || endpoint === '') { return } - const { result }: Response = yield call(api.get, endpoint, true) + const { result }: Response = yield call(api.get, endpoint, true) const nextIds = union(ids, result.illusts) - yield put(actions.fetchSuccess(id, nextIds)) yield put(actions.setNextUrl(id, result.nextUrl)) } catch (error) { yield put(actions.fetchFailre(id, error)) } } - -type NewActions = { - fetchSuccess: (id: *, ids: Array<number>) => *, - fetchFailre: (id: *, error: string) => *, +interface NewActions { + fetchSuccess: (id: any, ids: number[]) => any + fetchFailre: (id: any, error: string) => any } type Order = 'overwrite' | boolean - -type Config = {| - id: *, - endpoint: ?string, - ids: Array<number>, - order: Order, -|} +interface Config { + id: any + endpoint: string | null | undefined + ids: number[] + order: Order +} export function* fetchNew( { endpoint, id, ids, order }: Config, actions: NewActions -): Generator<*, void, *> { +) { try { if (!endpoint || endpoint === '') { return diff --git a/app/containers/ColumnBookmark/saga.js b/app/containers/ColumnBookmark/saga.ts similarity index 58% rename from app/containers/ColumnBookmark/saga.js rename to app/containers/ColumnBookmark/saga.ts index 824de65c..d0b5905b 100644 --- a/app/containers/ColumnBookmark/saga.js +++ b/app/containers/ColumnBookmark/saga.ts @@ -1,5 +1,3 @@ -// @flow -import type { Saga } from 'redux-saga' import { put, select, call, takeEvery } from 'redux-saga/effects' import { addTable } from 'containers/ColumnManager/actions' import { getMyId } from 'containers/LoginModal/selectors' @@ -7,43 +5,56 @@ import { ADD_BOOKMARK_SUCCESS } from '../BookmarkButton/constants' import * as column from '../Column/sagas' import * as Actions from './constants' import * as actions from './actions' -import type { Action } from './actionTypes' -import type { ColumnId } from './reducer' +import { Action } from './actionTypes' +import { ColumnId } from './reducer' import { makeSelectColumn, makeSelectIds } from './selectors' -export function* addColumn({ id }: { id: 'public' }): Saga<void> { - const ids: Array<?ColumnId> = yield select(makeSelectIds()) +export function* addColumn({ id }: { id: 'public' }) { + const ids: (ColumnId | null | undefined)[] = yield select(makeSelectIds()) + if (ids.every(v => v !== id)) { yield put(actions.addColumnSuccess(id)) } - yield put(addTable(`bookmark-${id}`, { columnId: id, type: 'BOOKMARK' })) + yield put( + addTable(`bookmark-${id}`, { + columnId: id, + type: 'BOOKMARK', + }) + ) } const getEndpoint = (userId, restrict) => `/v1/user/bookmarks/illust?user_id=${userId}&restrict=${restrict}` -export function* fetchBookmark({ id }: { id: 'public' }): Saga<void> { - const { ids, nextUrl } = yield select(makeSelectColumn(), { id }) +export function* fetchBookmark({ id }: { id: 'public' }) { + const { ids, nextUrl } = yield select(makeSelectColumn(), { + id, + }) const endpoint = nextUrl ? nextUrl : getEndpoint(yield select(getMyId), id) yield call(column.fetchColumn, endpoint, id, { ...actions }, ids) } - -export function* fetchNew({ - restrict: id, -}: { - restrict: $PropertyType<Action, 'id'>, -}): Saga<void> { +export function* fetchNew({ restrict: id }: { restrict: Action['id'] }) { try { - const { ids } = yield select(makeSelectColumn(), { id }) + const { ids } = yield select(makeSelectColumn(), { + id, + }) const endpoint = getEndpoint(yield select(getMyId), id) - yield call(column.fetchNew, { endpoint, id, ids, order: true }, actions) + yield call( + column.fetchNew, + { + endpoint, + id, + ids, + order: true, + }, + actions + ) } catch (error) { yield put(actions.fetchFailre(id, error)) } } - -export default function* root(): Saga<void> { +export default function* root() { yield takeEvery(Actions.ADD_COLUMN, addColumn) yield takeEvery([Actions.FETCH, Actions.FETCH_NEXT], fetchBookmark) yield takeEvery(ADD_BOOKMARK_SUCCESS, fetchNew) diff --git a/app/containers/ColumnFollow/saga.js b/app/containers/ColumnFollow/saga.ts similarity index 68% rename from app/containers/ColumnFollow/saga.js rename to app/containers/ColumnFollow/saga.ts index a5ea79e9..930a1149 100644 --- a/app/containers/ColumnFollow/saga.js +++ b/app/containers/ColumnFollow/saga.ts @@ -1,5 +1,3 @@ -// @flow -import type { Saga } from 'redux-saga' import { difference } from 'lodash' import { put, select, call, takeEvery, delay } from 'redux-saga/effects' import { addTable } from 'containers/ColumnManager/actions' @@ -9,26 +7,37 @@ import { FOLLOW_SUCCESS } from '../FollowButton/constants' import * as fetchColumn from '../Column/sagas' import * as Actions from './constants' import * as actions from './actions' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' import * as selectors from './selectors' -type Action = { id: ColumnId } +interface Action { + id: ColumnId +} +export function* addFollowColumn({ id }: Action) { + const ids: (ColumnId | null | undefined)[] = yield select( + selectors.makeSelectIds() + ) -export function* addFollowColumn({ id }: Action): Saga<void> { - const ids: Array<?ColumnId> = yield select(selectors.makeSelectIds()) if (ids.every(v => v !== id)) { yield put(actions.addColumnSuccess(id)) } - yield put(addTable(`follow-${id}`, { columnId: id, type: 'FOLLOW' })) + yield put( + addTable(`follow-${id}`, { + columnId: id, + type: 'FOLLOW', + }) + ) } const getEndpoint = (userId, restrict) => `/v2/illust/follow?user_id=${userId}&restrict=${restrict}` -function* fetchFollow({ id }: Action): Saga<void> { +function* fetchFollow({ id }: Action) { try { - const { ids, nextUrl } = yield select(selectors.makeSelectColumn(), { id }) + const { ids, nextUrl } = yield select(selectors.makeSelectColumn(), { + id, + }) const endpoint = nextUrl ? nextUrl : getEndpoint(yield select(getMyId), id) yield call(fetchColumn.fetchColumn, endpoint, id, actions, ids) } catch (error) { @@ -36,18 +45,29 @@ function* fetchFollow({ id }: Action): Saga<void> { } } -function* fetchNew({ id }: Action): Saga<void> { - const { ids } = yield select(selectors.makeSelectColumn(), { id }) +function* fetchNew({ id }: Action) { + const { ids } = yield select(selectors.makeSelectColumn(), { + id, + }) const endpoint = getEndpoint(yield select(getMyId), id) - yield call(fetchColumn.fetchNew, { endpoint, id, ids, order: true }, actions) + yield call( + fetchColumn.fetchNew, + { + endpoint, + id, + ids, + order: true, + }, + actions + ) } // TODO キャンセル function* fetchNewWatch(action: Action) { try { while (true) { - const { interval } = yield select(selectors.makeSelectColumn(), action) - // 増加したイラストをチェック + const { interval } = yield select(selectors.makeSelectColumn(), action) // 増加したイラストをチェック + const { ids } = yield select(selectors.makeSelectColumn(), action) yield call(fetchNew, action) const { ids: nextIds } = yield select( @@ -57,6 +77,7 @@ function* fetchNewWatch(action: Action) { if (ids.length > 0) { const diffIllusts = difference(nextIds, ids) + for (const id of diffIllusts) { yield put(addNotifyWithIllust('新着イラスト', id)) } @@ -69,17 +90,21 @@ function* fetchNewWatch(action: Action) { } } -function* handleFollowSuccess({ restrict }): Saga<*> { - const ids: Array<?ColumnId> = yield select(selectors.makeSelectIds()) +function* handleFollowSuccess({ restrict }) { + const ids: (ColumnId | null | undefined)[] = yield select( + selectors.makeSelectIds() + ) + if (ids.some(v => v === restrict)) { - yield call(fetchFollow, { id: restrict }) + yield call(fetchFollow, { + id: restrict, + }) } } -export default function* root(): Saga<void> { +export default function* root() { yield takeEvery(Actions.ADD_COLUMN, addFollowColumn) yield takeEvery([Actions.FETCH, Actions.FETCH_NEXT], fetchFollow) - yield takeEvery(Actions.ADD_COLUMN_SUCCESS, fetchNewWatch) yield takeEvery(FOLLOW_SUCCESS, handleFollowSuccess) } diff --git a/app/containers/ColumnHistory/saga.js b/app/containers/ColumnHistory/saga.ts similarity index 61% rename from app/containers/ColumnHistory/saga.js rename to app/containers/ColumnHistory/saga.ts index f54a85e0..f481ac98 100644 --- a/app/containers/ColumnHistory/saga.js +++ b/app/containers/ColumnHistory/saga.ts @@ -1,5 +1,3 @@ -// @flow -import type { Saga } from 'redux-saga' import { addTable } from 'containers/ColumnManager/actions' import { put, takeEvery } from 'redux-saga/effects' import { OPEN_ILLUST_VIEWER } from '../IllustPreview/constants' @@ -7,18 +5,21 @@ import { OPEN_MANGA_PREVIEW } from '../MangaPreview/constants' import * as Actions from './constants' import * as actions from './actions' -export function* addHistoryColumn(): Saga<void> { - yield put(addTable('HISTORY', { columnId: 'history', type: 'HISTORY' })) +export function* addHistoryColumn() { + yield put( + addTable('HISTORY', { + columnId: 'history', + type: 'HISTORY', + }) + ) } - -type Action = { id: number } - -export function* addHistory({ id }: Action): Saga<void> { +interface Action { + id: number +} +export function* addHistory({ id }: Action) { yield put(actions.addHistory(id)) } - -export default function* root(): Saga<void> { +export default function* root() { yield takeEvery(Actions.ADD_COLUMN_HISTORY, addHistoryColumn) - yield takeEvery([OPEN_ILLUST_VIEWER, OPEN_MANGA_PREVIEW], addHistory) } diff --git a/app/containers/ColumnRanking/saga.js b/app/containers/ColumnRanking/saga.js deleted file mode 100644 index e5d1f860..00000000 --- a/app/containers/ColumnRanking/saga.js +++ /dev/null @@ -1,62 +0,0 @@ -// @flow -import { type Saga } from 'redux-saga' -import { - put, - select, - call, - takeEvery, - fork, - take, - delay, -} from 'redux-saga/effects' -import { addTable } from 'containers/ColumnManager/actions' -import * as api from '../Column/sagas' -import * as Actions from './constants' -import * as actions from './actions' -import type { Mode } from './reducer' -import * as selectors from './selectors' - -type Action = { id: Mode } - -export function* addColumn({ id }: Action): Saga<void> { - const modes: Array<?Mode> = yield select(selectors.makeSelectModes()) - if (modes.every(v => v !== id)) { - yield put(actions.addColumnSuccess(id)) - } - - yield put(addTable(`ranking-${id}`, { columnId: id, type: 'RANKING' })) -} - -const getEndpoint = id => `/v1/illust/ranking?mode=${id}` - -export function* fetch(action: Action): Saga<void> { - const { ids, nextUrl } = yield select(selectors.makeSelectColumn(), action) - const endpoint = nextUrl ? nextUrl : getEndpoint(action.id) - yield call(api.fetchColumn, endpoint, action.id, actions, ids) -} - -export function* fetchNew({ id }: Action): Saga<void> { - const { ids } = yield select(selectors.makeSelectColumn(), { id }) - yield call( - api.fetchNew, - { endpoint: getEndpoint(id), id, ids, order: 'overwrite' }, - actions - ) -} - -// $FlowFixMe -export function* watchNewIllust(): Saga<*> { - while (true) { - const { id } = yield take(Actions.START_WATCH) - const interval = yield select(selectors.getInterval, { id }) - yield delay(interval) - yield call(fetchNew, { id }) - yield put(actions.watchNew(id)) - } -} - -export default function* root(): Saga<void> { - yield takeEvery(Actions.ADD_COLUMN, addColumn) - yield takeEvery(Actions.FETCH, fetch) - yield fork(watchNewIllust) -} diff --git a/app/containers/ColumnRankingR18/saga.js b/app/containers/ColumnRanking/saga.ts similarity index 56% rename from app/containers/ColumnRankingR18/saga.js rename to app/containers/ColumnRanking/saga.ts index c4e91355..a28d1b9c 100644 --- a/app/containers/ColumnRankingR18/saga.js +++ b/app/containers/ColumnRanking/saga.ts @@ -1,63 +1,76 @@ -// @flow -import { type Saga } from 'redux-saga' import { - delay, put, select, call, takeEvery, fork, take, + delay, } from 'redux-saga/effects' import { addTable } from 'containers/ColumnManager/actions' import * as api from '../Column/sagas' import * as Actions from './constants' import * as actions from './actions' -import type { R18Mode } from './reducer' +import { Mode } from './reducer' import * as selectors from './selectors' -type Action = { id: R18Mode } +interface Action { + id: Mode +} +export function* addColumn({ id }: Action) { + const modes: (Mode | null | undefined)[] = yield select( + selectors.makeSelectModes() + ) -export function* addColumn({ id }: Action): Saga<void> { - const modes: Array<?R18Mode> = yield select(selectors.makeSelectModes()) if (modes.every(v => v !== id)) { yield put(actions.addColumnSuccess(id)) } yield put( - addTable(`ranking-r18-${id}`, { columnId: id, type: 'RANKING_R18' }) + addTable(`ranking-${id}`, { + columnId: id, + type: 'RANKING', + }) ) } const getEndpoint = id => `/v1/illust/ranking?mode=${id}` -export function* fetch(action: Action): Saga<void> { +export function* fetch(action: Action) { const { ids, nextUrl } = yield select(selectors.makeSelectColumn(), action) const endpoint = nextUrl ? nextUrl : getEndpoint(action.id) yield call(api.fetchColumn, endpoint, action.id, actions, ids) } - -export function* fetchNew({ id }: Action): Saga<void> { - const { ids } = yield select(selectors.makeSelectColumn(), { id }) +export function* fetchNew({ id }: Action) { + const { ids } = yield select(selectors.makeSelectColumn(), { + id, + }) yield call( api.fetchNew, - { endpoint: getEndpoint(id), id, ids, order: 'overwrite' }, + { + endpoint: getEndpoint(id), + id, + ids, + order: 'overwrite', + }, actions ) -} +} // $FlowFixMe -// $FlowFixMe -export function* watchNewIllust(): Saga<*> { +export function* watchNewIllust() { while (true) { const { id } = yield take(Actions.START_WATCH) - const interval = yield select(selectors.getInterval, { id }) + const interval = yield select(selectors.getInterval, { + id, + }) yield delay(interval) - yield call(fetchNew, { id }) + yield call(fetchNew, { + id, + }) yield put(actions.watchNew(id)) } } - -export default function* root(): Saga<void> { +export default function* root() { yield takeEvery(Actions.ADD_COLUMN, addColumn) yield takeEvery(Actions.FETCH, fetch) yield fork(watchNewIllust) diff --git a/app/containers/ColumnRankingR18/saga.ts b/app/containers/ColumnRankingR18/saga.ts new file mode 100644 index 00000000..d9ead275 --- /dev/null +++ b/app/containers/ColumnRankingR18/saga.ts @@ -0,0 +1,80 @@ +import { + delay, + put, + select, + call, + takeEvery, + fork, + take, +} from 'redux-saga/effects' +import { addTable } from '../ColumnManager/actions' +import * as api from '../Column/sagas' +import * as Actions from './constants' +import * as actions from './actions' +import { R18Mode } from './reducer' +import * as selectors from './selectors' + +interface Action { + id: R18Mode +} + +export function* addColumn({ id }: Action) { + const modes: (R18Mode | null | undefined)[] = yield select( + selectors.makeSelectModes() + ) + + if (modes.every(v => v !== id)) { + yield put(actions.addColumnSuccess(id)) + } + + yield put( + addTable(`ranking-r18-${id}`, { + columnId: id, + type: 'RANKING_R18', + }) + ) +} + +const getEndpoint = (id: string) => `/v1/illust/ranking?mode=${id}` + +export function* fetch(action: Action) { + const { ids, nextUrl } = yield select(selectors.makeSelectColumn(), action) + const endpoint = nextUrl ? nextUrl : getEndpoint(action.id) + yield call(api.fetchColumn, endpoint, action.id, actions, ids) +} + +export function* fetchNew({ id }: Action) { + const { ids } = yield select(selectors.makeSelectColumn(), { + id, + }) + yield call( + api.fetchNew, + { + endpoint: getEndpoint(id), + id, + ids, + order: 'overwrite', + }, + actions + ) +} + +export function* watchNewIllust() { + while (true) { + const { id } = yield take(Actions.START_WATCH) + const interval = yield select(selectors.getInterval, { + id, + }) + yield delay(interval) + yield call(fetchNew, { + id, + }) + yield put(actions.watchNew(id)) + } +} + +export default function* root() { + yield takeEvery(Actions.ADD_COLUMN, addColumn) + yield takeEvery(Actions.FETCH, fetch) + yield fork(watchNewIllust) +} diff --git a/app/containers/ColumnRecommended/saga.js b/app/containers/ColumnRecommended/saga.ts similarity index 69% rename from app/containers/ColumnRecommended/saga.js rename to app/containers/ColumnRecommended/saga.ts index 851087ad..1750f787 100644 --- a/app/containers/ColumnRecommended/saga.js +++ b/app/containers/ColumnRecommended/saga.ts @@ -1,26 +1,26 @@ -// @flow -import type { Saga } from 'redux-saga' import { put, select, call, takeEvery } from 'redux-saga/effects' import { addTable } from 'containers/ColumnManager/actions' import * as fetchColumn from '../Column/sagas' import * as Actions from './constants' import * as actions from './actions' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' import { makeSelectColumn, makeSelectModes } from './selectors' -type Action = { - +id: ColumnId, +interface Action { + id: ColumnId } - -export function* addColumn({ id }: Action): Saga<void> { - const modes: Array<?ColumnId> = yield select(makeSelectModes()) +export function* addColumn({ id }: Action) { + const modes: (ColumnId | null | undefined)[] = yield select(makeSelectModes()) if (modes.every(v => v !== id)) { yield put(actions.addColumnSuccess(id)) } yield put( - addTable(`recommended`, { type: 'RECOMMENDED', columnId: 'recommended' }) + addTable(`recommended`, { + type: 'RECOMMENDED', + columnId: 'recommended', + }) ) } @@ -33,7 +33,7 @@ function* fetch(action: Action) { yield call(fetchColumn.fetchColumn, endpoint, action.id, actions, ids) } -export default function* root(): Saga<void> { +export default function* root() { yield takeEvery(Actions.ADD_COLUMN, addColumn) yield takeEvery(Actions.FETCH, fetch) } diff --git a/app/containers/ColumnSearch/reducer.ts b/app/containers/ColumnSearch/reducer.ts index 7a9b373d..eb47bfe0 100644 --- a/app/containers/ColumnSearch/reducer.ts +++ b/app/containers/ColumnSearch/reducer.ts @@ -9,10 +9,12 @@ export type ColumnSearch = { usersIn: number interval: number } & BaseColumn + export type State = Partial<{ [a: string]: ColumnSearch }> export const initialState: State = {} + export default function(state: State = initialState, action: Action): State { switch (action.type) { case Actions.ADD_COLUMN_SUCCESS: diff --git a/app/containers/ColumnSearch/saga.js b/app/containers/ColumnSearch/saga.ts similarity index 72% rename from app/containers/ColumnSearch/saga.js rename to app/containers/ColumnSearch/saga.ts index ea6a794e..5556c4ea 100644 --- a/app/containers/ColumnSearch/saga.js +++ b/app/containers/ColumnSearch/saga.ts @@ -1,5 +1,3 @@ -// @flow -import { type Saga } from 'redux-saga' import { delay, put, @@ -10,38 +8,47 @@ import { take, } from 'redux-saga/effects' import { union, difference } from 'lodash' -import { addTable } from 'containers/ColumnManager/actions' -import { addNotifyWithIllust } from 'containers/Notify/actions' +import { addTable } from '../ColumnManager/actions' +import { addNotifyWithIllust } from '../Notify/actions' import * as api from '../Api/sagas' import * as fetchSaga from '../Column/sagas' import * as Actions from './constants' import * as actions from './actions' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' import * as selectors from './selectors' -import type { Action } from './actionTypes' +import { Action } from './actionTypes' -export function* addColumn({ id }: Action): Saga<void> { - const ids: Array<?ColumnId> = yield select(selectors.makeSelectIds()) +export function* addColumn({ id }: Action) { + const ids: (ColumnId | null | undefined)[] = yield select( + selectors.makeSelectIds() + ) const word = id.replace(/\d+users入り$/, '') if (ids.every(v => v !== word)) { yield put(actions.addColumnSuccess(word)) } - yield put(addTable(`search-${word}`, { columnId: word, type: 'SEARCH' })) + yield put( + addTable(`search-${word}`, { + columnId: word, + type: 'SEARCH', + }) + ) } const getEndpoint = word => `/v1/search/illust?word=${word}&search_target=partial_match_for_tags&sort=date_desc` -function* fetchSearch(action: Action): Saga<void> { +function* fetchSearch(action: Action) { const { id } = action const word = id.replace(/\d+users入り$/, '') const { ids, nextUrl, usersIn } = yield select( selectors.makeSelectColumn(), action ) - const hasMore = yield select(selectors.makeSelectHasMore(), { id: word }) + const hasMore = yield select(selectors.makeSelectHasMore(), { + id: word, + }) // nullのチェックではない if (hasMore === false) { @@ -49,27 +56,23 @@ function* fetchSearch(action: Action): Saga<void> { } const fomattedWord = usersIn === 0 ? word : `${word}${usersIn}users入り` - const endpoint = nextUrl ? nextUrl : getEndpoint(fomattedWord) yield call(fetchSaga.fetchColumn, endpoint, word, actions, ids) } -function* fetchUntilLimit(action: Action): Saga<void> { +function* fetchUntilLimit(action: Action) { try { const initLen: number = yield select(selectors.makeIllustLength(), action) while (true) { yield call(fetchSearch, action) - const len = yield select(selectors.makeIllustLength(), action) - const nextUrl = yield select(selectors.makeSelectNextUrl(), action) if (!nextUrl) { return - } + } // 新しく取得したイラスト数が10より少ない場合、データを再fetchする - // 新しく取得したイラスト数が10より少ない場合、データを再fetchする if (len - initLen > 10) { return } @@ -81,26 +84,24 @@ function* fetchUntilLimit(action: Action): Saga<void> { } } -function* fetchNew({ id }: Action): Saga<void> { +function* fetchNew({ id }: Action) { try { - const { ids, usersIn } = yield select(selectors.makeSelectColumn(), { id }) + const { ids, usersIn } = yield select(selectors.makeSelectColumn(), { + id, + }) const beforeIds = yield select(selectors.makeLimitedSelectIllustsId(), { id, }) - const fomattedWord = usersIn === 0 ? id : `${id}${usersIn}users入り` const endpoint = getEndpoint(fomattedWord) - const { result } = yield call(api.get, endpoint, true) - const nextIds = union(result.illusts, ids) yield put(actions.fetchNewSuccess(id, nextIds)) - const afterIds = yield select(selectors.makeLimitedSelectIllustsId(), { id, }) - const diffIllusts = difference(afterIds, beforeIds) + if (diffIllusts.length > 0) { for (const illustId of diffIllusts) { yield put(addNotifyWithIllust(`検索新着 ${id} イラスト`, illustId)) @@ -109,9 +110,8 @@ function* fetchNew({ id }: Action): Saga<void> { } catch (error) { yield put(actions.fetchNewFailre(id, error)) } -} +} // TODO キャンセル -// TODO キャンセル function* fetchNewWatch(action: Action) { try { while (true) { @@ -124,29 +124,25 @@ function* fetchNewWatch(action: Action) { } } -export function* usersIn(): Saga<void> { +export function* usersIn() { while (true) { - const { id, usersIn: value } = yield take(Actions.USERS_IN) - // 検索ワードにusers入りがあれば消す。 - const word = id.replace(/\d+users入り$/, '') + const { id, usersIn: value } = yield take(Actions.USERS_IN) // 検索ワードにusers入りがあれば消す。 + + const word = id.replace(/\d+users入り$/, '') // urlの変更およびリクエストを行う - // urlの変更およびリクエストを行う yield put(actions.setUsersIn(word, value)) yield put(actions.resetIds(word)) yield put(actions.setNextUrl(word, null)) yield put(actions.fetch(word)) } } - -export default function* root(): Saga<void> { +export default function* root() { yield takeEvery(Actions.ADD_COLUMN, addColumn) - yield takeEvery( [Actions.FETCH, Actions.FETCH_NEXT, Actions.SET_MIN_BOOKBOOK], fetchUntilLimit - ) + ) // $FlowFixMe - // $FlowFixMe yield takeEvery(Actions.START_WATCH, fetchNewWatch) yield fork(usersIn) } diff --git a/app/containers/ColumnUserIllust/saga.js b/app/containers/ColumnUserIllust/saga.ts similarity index 55% rename from app/containers/ColumnUserIllust/saga.js rename to app/containers/ColumnUserIllust/saga.ts index d534fef1..268186e3 100644 --- a/app/containers/ColumnUserIllust/saga.js +++ b/app/containers/ColumnUserIllust/saga.ts @@ -1,39 +1,44 @@ -// @flow -import type { Saga } from 'redux-saga' import { put, select, call, takeEvery } from 'redux-saga/effects' import { addTable } from 'containers/ColumnManager/actions' import * as fetchColumn from '../Column/sagas' import * as Actions from './constants' import * as actions from './actions' -import type { ColumnId } from './reducer' +import { ColumnId } from './reducer' import { makeSelectColumn, makeSelectIds } from './selectors' -type Action = { id: ColumnId } +interface Action { + id: ColumnId +} +export function* addColumn({ id }: Action) { + const ids: (ColumnId | null | undefined)[] = yield select(makeSelectIds()) -export function* addColumn({ id }: Action): Saga<void> { - const ids: Array<?ColumnId> = yield select(makeSelectIds()) if (ids.every(v => v !== id)) { yield put(actions.addColumnSuccess(id)) } yield put( - addTable(`user-illust-${id}`, { columnId: String(id), type: 'USER_ILLUST' }) + addTable(`user-illust-${id}`, { + columnId: String(id), + type: 'USER_ILLUST', + }) ) } const endpoint = id => `/v1/user/illusts?type=illust&user_id=${id}` -export function* fetchUserIllust({ id }: Action): Saga<void> { - const { ids } = yield select(makeSelectColumn(), { id }) +export function* fetchUserIllust({ id }: Action) { + const { ids } = yield select(makeSelectColumn(), { + id, + }) yield call(fetchColumn.fetchColumn, endpoint(id), id, actions, ids) } - -export function* fetchNextUserIllust({ id }: Action): Saga<void> { - const { ids, nextUrl } = yield select(makeSelectColumn(), { id }) +export function* fetchNextUserIllust({ id }: Action) { + const { ids, nextUrl } = yield select(makeSelectColumn(), { + id, + }) yield call(fetchColumn.fetchColumn, nextUrl, id, actions, ids) } - -export default function* root(): Saga<void> { +export default function* root() { yield takeEvery(Actions.ADD_COLUMN, addColumn) yield takeEvery(Actions.FETCH, fetchUserIllust) yield takeEvery(Actions.FETCH_NEXT, fetchNextUserIllust) diff --git a/app/containers/FollowButton/saga.js b/app/containers/FollowButton/saga.ts similarity index 67% rename from app/containers/FollowButton/saga.js rename to app/containers/FollowButton/saga.ts index f13f69fe..480ce537 100644 --- a/app/containers/FollowButton/saga.js +++ b/app/containers/FollowButton/saga.ts @@ -1,27 +1,29 @@ -// @flow -import type { Saga } from 'redux-saga' import { call, takeEvery, put } from 'redux-saga/effects' import * as api from '../Api/sagas' import * as actions from './actions' import * as Actions from './constants' -type Props = { - id: number, +interface Props { + id: number } - -export function* follow({ id }: Props): Saga<void> { +export function* follow({ id }: Props) { try { - const data = { userId: id, restrict: 'public' } + const data = { + userId: id, + restrict: 'public', + } yield call(api.post, '/v1/user/follow/add', data) yield put(actions.followSuccess('public')) } catch (error) { yield put(actions.followFailer(error)) } } - -export function* unfollow({ id }: Props): Saga<void> { +export function* unfollow({ id }: Props) { try { - const data = { userId: id, restrict: 'public' } + const data = { + userId: id, + restrict: 'public', + } yield call(api.post, '/v1/user/follow/delete', data) yield put(actions.unFollowSuccess('public')) } catch (error) { @@ -29,7 +31,7 @@ export function* unfollow({ id }: Props): Saga<void> { } } -function* root(): Saga<void> { +function* root() { yield takeEvery(Actions.FOLLOW_REQUEST, follow) yield takeEvery(Actions.UN_FOLLOW_REQUEST, unfollow) } diff --git a/app/containers/IllustPreview/styles.js b/app/containers/IllustPreview/styles.ts similarity index 96% rename from app/containers/IllustPreview/styles.js rename to app/containers/IllustPreview/styles.ts index dccc8035..63bcc259 100644 --- a/app/containers/IllustPreview/styles.js +++ b/app/containers/IllustPreview/styles.ts @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' export const LazyImgWrapper = styled.div` diff --git a/app/containers/LoginModal/saga.js b/app/containers/LoginModal/saga.ts similarity index 73% rename from app/containers/LoginModal/saga.js rename to app/containers/LoginModal/saga.ts index d01d3fb4..2db50b93 100644 --- a/app/containers/LoginModal/saga.js +++ b/app/containers/LoginModal/saga.ts @@ -1,6 +1,4 @@ -// @flow // eslint-disable-next-line import/order -import type { Saga } from 'redux-saga' import { select, put, call, takeEvery } from 'redux-saga/effects' import { fetchAuth } from 'services/api' import { openModal, closeModal } from '../ModalManeger/actions' @@ -15,16 +13,17 @@ import { import * as Actions from './constants' import { makeSelectInfo } from './selectors' -export function* getToken(): Saga<*> { - const info = yield select(makeSelectInfo()) - // TODO: username & passwordがなければLogin Pageを開く +export function* getToken() { + const info = yield select(makeSelectInfo()) // TODO: username & passwordがなければLogin Pageを開く + const { accessToken } = yield call(fetchAuth, info) return accessToken } -function* authorize({ username, password }): Saga<void> { +function* authorize({ username, password }) { // エラーを非表示 yield put(clearError()) + try { const { user: account, refreshToken } = yield call(fetchAuth, { username, @@ -41,13 +40,13 @@ function* authorize({ username, password }): Saga<void> { } } -function* logout(): Saga<void> { - yield put(endLoading()) - // ログインモーダルを表示 +function* logout() { + yield put(endLoading()) // ログインモーダルを表示 + yield put(openModal('Login')) } -function* root(): Saga<void> { +function* root() { yield takeEvery(Actions.LOGIN_REQUEST, authorize) yield takeEvery(Actions.LOGOUT, logout) } diff --git a/app/containers/MangaPreview/styles.js b/app/containers/MangaPreview/styles.ts similarity index 98% rename from app/containers/MangaPreview/styles.js rename to app/containers/MangaPreview/styles.ts index 2422ab91..85c0d20c 100644 --- a/app/containers/MangaPreview/styles.js +++ b/app/containers/MangaPreview/styles.ts @@ -1,4 +1,3 @@ -// @flow import styled from 'styled-components' export const Item = styled.div` diff --git a/app/containers/Notify/saga.js b/app/containers/Notify/saga.ts similarity index 65% rename from app/containers/Notify/saga.js rename to app/containers/Notify/saga.ts index a188adbf..9d60b842 100644 --- a/app/containers/Notify/saga.js +++ b/app/containers/Notify/saga.ts @@ -1,19 +1,16 @@ -// @noflow -import type { Saga } from 'redux-saga' import { select, takeEvery } from 'redux-saga/effects' -import type { Illust } from 'types/illust' -import type { User } from 'types/user' +import { shell } from 'electron' +import { Illust } from 'types/illust' +import { User } from 'types/user' import { getSelectIllust } from '../IllustById/selectors' import { getSelectUser } from '../UserById/selectors' import * as Actions from './constants' -const { shell } = require('electron') - -type Notify = { - title: string, - icon: string, - body: string, - url?: string, +interface Notify { + title: string + icon: string + body: string + url?: string } export function notify({ title, url, body, icon }: Notify) { @@ -21,7 +18,6 @@ export function notify({ title, url, body, icon }: Notify) { icon, body, }) - notify.addEventListener('click', () => { if (url) { shell.openExternal(url) @@ -29,26 +25,31 @@ export function notify({ title, url, body, icon }: Notify) { }) } -type NotifyWithIllust = { - title: string, - id: number, +interface NotifyWithIllust { + title: string + id: number } const baseUrl = 'https://www.pixiv.net/member_illust.php?mode=medium&illust_id=' -export function* notifyWithIllust({ title, id }: NotifyWithIllust): Saga<void> { - const illust: Illust = yield select(getSelectIllust, { id }) +export function* notifyWithIllust({ title, id }: NotifyWithIllust) { + const illust: Illust = yield select(getSelectIllust, { + id, + }) + if (!illust) { return } - const user: User = yield select(getSelectUser, { id: illust.user }) + const user: User = yield select(getSelectUser, { + id: illust.user, + }) + if (!user) { return } const icon = illust.imageUrls.squareMedium - notify({ title, icon, @@ -57,7 +58,7 @@ export function* notifyWithIllust({ title, id }: NotifyWithIllust): Saga<void> { }) } -function* root(): Saga<void> { +function* root() { yield takeEvery(Actions.ADD_NOTIFY_WITH_ILLUST, notifyWithIllust) } diff --git a/app/containers/SearchField/saga.js b/app/containers/SearchField/saga.ts similarity index 76% rename from app/containers/SearchField/saga.js rename to app/containers/SearchField/saga.ts index 436a0da7..586ed50d 100644 --- a/app/containers/SearchField/saga.js +++ b/app/containers/SearchField/saga.ts @@ -1,5 +1,3 @@ -// @flow -import type { Saga } from 'redux-saga' import { call, takeLatest, put } from 'redux-saga/effects' import * as api from '../Api/sagas' import * as actions from './actions' @@ -7,11 +5,10 @@ import * as Actions from './constants' const endpoint = word => `/v1/search/autocomplete?word=${word}` -type Aciton = { - word: string, +interface Aciton { + word: string } - -export function* autocomplete({ word }: Aciton): Saga<void> { +export function* autocomplete({ word }: Aciton) { try { const { result } = yield call(api.get, endpoint(word), true) const { searchAutoCompleteKeywords } = result @@ -21,7 +18,7 @@ export function* autocomplete({ word }: Aciton): Saga<void> { } } -function* root(): Saga<void> { +function* root() { yield takeLatest(Actions.FETCH_REQUEST, autocomplete) } diff --git a/app/containers/SearchField/styles.js b/app/containers/SearchField/styles.ts similarity index 98% rename from app/containers/SearchField/styles.js rename to app/containers/SearchField/styles.ts index 934a395b..8fb7fa41 100644 --- a/app/containers/SearchField/styles.js +++ b/app/containers/SearchField/styles.ts @@ -1,17 +1,14 @@ -// @flow import styled from 'styled-components' export const Wrap = styled.div` position: relative; height: auto; ` - export const Field = styled.div` position: relative; max-width: 400px; margin-bottom: 5px; ` - export const Input = styled.input` font-size: 1.1rem; height: 40px; @@ -22,7 +19,6 @@ export const Input = styled.input` padding-left: 1rem; box-sizing: border-box; ` - export const Popup = styled.div` height: calc(100% - 50px); padding: 1px; diff --git a/app/containers/SettingModal/saga.js b/app/containers/SettingModal/saga.ts similarity index 60% rename from app/containers/SettingModal/saga.js rename to app/containers/SettingModal/saga.ts index 55f60b3b..6edad21b 100644 --- a/app/containers/SettingModal/saga.js +++ b/app/containers/SettingModal/saga.ts @@ -1,17 +1,14 @@ -// @flow -import type { Saga } from 'redux-saga' import { takeLatest } from 'redux-saga/effects' import { clean } from '../../store' import * as Actions from './constants' -// eslint-disable-next-line require-yield -function* removeCache(): Saga<void> { +function removeCache() { try { clean() } catch (error) {} } -function* root(): Saga<void> { +function* root() { yield takeLatest(Actions.REMOVE_CACHE, removeCache) } diff --git a/app/containers/SettingModal/styles.js b/app/containers/SettingModal/styles.ts similarity index 98% rename from app/containers/SettingModal/styles.js rename to app/containers/SettingModal/styles.ts index 55008087..fdd0e4bc 100644 --- a/app/containers/SettingModal/styles.js +++ b/app/containers/SettingModal/styles.ts @@ -1,11 +1,9 @@ -// @flow import styled from 'styled-components' export const ChipWrap = styled.div` display: flex; flex-wrap: wrap; ` - export const Input = styled.input` font-size: 1.1rem; height: 30px; @@ -19,13 +17,11 @@ export const Input = styled.input` border: 1px solid rgba(82, 158, 204, 0.7); } ` - export const Field = styled.div` position: relative; width: 100%; margin-bottom: 2rem; ` - export const Wrap = styled.div` max-width: 100%; margin-top: 2rem; @@ -36,12 +32,10 @@ export const Wrap = styled.div` flex-direction: column; align-items: center; ` - export const TagFilter = styled.div` padding-left: 10px; padding-right: 10px; ` - export const Icon = styled.div` position: absolute; top: 1rem; diff --git a/app/containers/Table/saga.js b/app/containers/Table/saga.ts similarity index 63% rename from app/containers/Table/saga.js rename to app/containers/Table/saga.ts index 043d5149..324f65d5 100644 --- a/app/containers/Table/saga.js +++ b/app/containers/Table/saga.ts @@ -1,14 +1,12 @@ -// @flow -import type { Saga } from 'redux-saga' import { put, takeEvery } from 'redux-saga/effects' import * as Actions from 'containers/ColumnManager/constants' -import type { Action } from 'containers/ColumnManager/actionTypes' +import { Action } from 'containers/ColumnManager/actionTypes' import * as actions from './actions' function* addTable({ id }: Action) { yield put(actions.addTable(id)) } -export default function* root(): Saga<void> { +export default function* root() { yield takeEvery(Actions.ADD_TABLE, addTable) } diff --git a/app/containers/UserDrawerContainer/saga.js b/app/containers/UserDrawerContainer/saga.ts similarity index 82% rename from app/containers/UserDrawerContainer/saga.js rename to app/containers/UserDrawerContainer/saga.ts index 562016c4..a349e068 100644 --- a/app/containers/UserDrawerContainer/saga.js +++ b/app/containers/UserDrawerContainer/saga.ts @@ -1,8 +1,6 @@ -// @flow -import type { Saga } from 'redux-saga' import { union } from 'lodash' import { put, select, call, takeEvery, takeLatest } from 'redux-saga/effects' -import { type User } from 'types/user' +import { User } from 'types/user' import * as api from '../Api/sagas' import { OPEN_DRAWER } from '../DrawerManager/constants' import { makeSelectUserById } from '../UserById/selectors' @@ -15,32 +13,30 @@ import { getNextIllustUrl, } from './selectors' -type P = { id: number } +interface P { + id: number +} -function* open({ id }): Saga<void> { +function* open({ id }) { try { - const user: User = yield select(makeSelectUserById(), { id }) - // todo 非同期 + const user: User = yield select(makeSelectUserById(), { + id, + }) // todo 非同期 + yield put(actions.fetchUserDetail(user.id)) yield put(actions.fetchIllust(user.id)) - yield put(actions.fetchManga(user.id)) - // todo 失敗の通知 + yield put(actions.fetchManga(user.id)) // todo 失敗の通知 } catch (error) {} } -function* fetchIllust(props: P): Saga<void> { +function* fetchIllust(props: P) { try { const { id } = props const oldIds = yield select(makeSelectIllustList()) - const url = yield select(getNextIllustUrl) - const endpoint = url ? url : `/v1/user/illusts?type=illust&user_id=${id}` - const { result } = yield call(api.get, endpoint, true) - yield put(actions.setNextIllustUrl(result.nextUrl)) - const nextIds = union(oldIds, result.illusts) yield put(actions.fetchIllustSuccess(nextIds)) } catch (error) { @@ -51,10 +47,8 @@ function* fetchIllust(props: P): Saga<void> { function* fetchManga({ id }: P) { try { const oldIds = yield select(makeSelectMangaList()) - const url = yield select(getNextMangaUrl) const endpoint = url ? url : `/v1/user/illusts?type=manga&user_id=${id}` - const { result } = yield call(api.get, endpoint, true) if (result.nextUrl) { @@ -68,12 +62,10 @@ function* fetchManga({ id }: P) { } } -function* fetchUserDetail({ id }: P): Saga<void> { +function* fetchUserDetail({ id }: P) { try { const endpoint = `/v1/user/detail?user_id=${id}` - const { result } = yield call(api.get, endpoint, true) - yield put(actions.addDrawerUser(result.user)) yield put(actions.addDrawerProfile(result.profile)) } catch (error) { @@ -81,14 +73,11 @@ function* fetchUserDetail({ id }: P): Saga<void> { } } -export default function* rootSaga(): Saga<void> { +export default function* rootSaga() { yield takeEvery(OPEN_DRAWER, open) - yield takeLatest(Actions.FETCH_ILLUST, fetchIllust) yield takeEvery(Actions.NEXT_ILLUST_PAGE, fetchIllust) - yield takeLatest(Actions.FETCH_MANGA, fetchManga) yield takeEvery(Actions.NEXT_MANGA_PAGE, fetchManga) - yield takeEvery(Actions.FETCH_USER_DETAIL, fetchUserDetail) } diff --git a/app/containers/UserPopoverContainer/saga.js b/app/containers/UserPopoverContainer/saga.ts similarity index 85% rename from app/containers/UserPopoverContainer/saga.js rename to app/containers/UserPopoverContainer/saga.ts index 64d25a6d..c7f6a1b5 100644 --- a/app/containers/UserPopoverContainer/saga.js +++ b/app/containers/UserPopoverContainer/saga.ts @@ -1,28 +1,25 @@ -// @flow // eslint-disable-next-line import/order -import type { Saga } from 'redux-saga' + import { put, call, takeEvery } from 'redux-saga/effects' import * as api from '../Api/sagas' import * as actions from './actions' import * as Actions from './constants' -function* popover({ id }): Saga<*> { +function* popover({ id }) { yield put(actions.clear()) try { const endpoint = `/v1/user/illusts?type=illust&user_id=${id}` const { result } = yield call(api.get, endpoint, true) - const illusts = result.illusts const limited = illusts.length > 3 ? illusts.slice(0, 3) : illusts - yield put(actions.popoverSuccess(limited)) } catch (error) { yield put(actions.popoverFailre(error)) } } -function* root(): Saga<void> { +function* root() { yield takeEvery(Actions.OPEN, popover) } From 1923a4748bd52959f72b384c0a528c7009cf1f03 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Sun, 10 Mar 2019 04:07:12 +0900 Subject: [PATCH 12/25] refactor(types): use reference --- app/types/{intl.ts => intl.d.ts} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename app/types/{intl.ts => intl.d.ts} (73%) diff --git a/app/types/intl.ts b/app/types/intl.d.ts similarity index 73% rename from app/types/intl.ts rename to app/types/intl.d.ts index 5ef9a452..56a000b1 100644 --- a/app/types/intl.ts +++ b/app/types/intl.d.ts @@ -1,6 +1,6 @@ -import { FormattedMessage } from 'react-intl' +/// <reference types="react-intl"/> -declare module 'react-intl' { +declare namespace ReactIntl { interface ExtractableMessage { [key: string]: string } From e45c50ea503f6f8e182f079b4be45f8fa1df5951 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Sun, 10 Mar 2019 04:17:07 +0900 Subject: [PATCH 13/25] refactor(typescript): app --- app/{index.js => index.tsx} | 8 ++--- app/{main.dev.js => main.dev.ts} | 60 ++++++++++++++------------------ app/{menu.js => menu.ts} | 14 ++++---- app/{reducer.js => reducer.ts} | 1 - app/{sagas.js => sagas.ts} | 4 +-- app/{store.js => store.ts} | 28 ++++++--------- 6 files changed, 49 insertions(+), 66 deletions(-) rename app/{index.js => index.tsx} (81%) rename app/{main.dev.js => main.dev.ts} (92%) rename app/{menu.js => menu.ts} (94%) rename app/{reducer.js => reducer.ts} (99%) rename app/{sagas.js => sagas.ts} (96%) rename app/{store.js => store.ts} (84%) diff --git a/app/index.js b/app/index.tsx similarity index 81% rename from app/index.js rename to app/index.tsx index 3d7a4ef8..6974dc28 100644 --- a/app/index.js +++ b/app/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import { render } from 'react-dom' import { AppContainer } from 'react-hot-loader' @@ -6,7 +5,6 @@ import configureStore from './store' import Root from './containers/Root' const { store, persistor } = configureStore() - const rootEl = document.querySelector('#root') if (rootEl) { @@ -20,11 +18,11 @@ if (rootEl) { if (rootEl && module.hot) { module.hot.accept('./containers/Root', () => { - // $FlowFixMe - const NextRoot = require('./containers/Root') // eslint-disable-line global-require + // eslint-disable-next-line global-require + const NextRoot = require('./containers/Root') + render( <AppContainer> - {/* // $FlowFixMe */} <NextRoot store={store} persistor={persistor} /> </AppContainer>, rootEl diff --git a/app/main.dev.js b/app/main.dev.ts similarity index 92% rename from app/main.dev.js rename to app/main.dev.ts index 645b3f34..aa0543e8 100644 --- a/app/main.dev.js +++ b/app/main.dev.ts @@ -1,18 +1,15 @@ -// @flow /* eslint global-require: 0, flowtype-errors/show-errors: 0, camelcase: 1 */ import electron from 'electron' import referer from 'electron-referer' import ms from 'ms' - import { autoUpdater } from 'electron-updater' import log from 'electron-log' - import ua from 'universal-analytics' import uuid from 'uuid' import appMenu from './menu' autoUpdater.logger = log -autoUpdater.logger.transports.file.level = 'info' +// autoUpdater.logger.transports.file.level = 'info' const Config = require('electron-config') @@ -20,15 +17,19 @@ const { app, BrowserWindow, ipcMain, shell } = electron let mainWindow // 常にbeta版なのでいついかなる時でもデバック可能なのだ...!もちろん配布後であっても...! -require('electron-debug')({ enabled: true, showDevTools: false }) +require('electron-debug')({ + enabled: true, + showDevTools: false, +}) if ( process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true' ) { const path = require('path') + const p = path.join(__dirname, '..', 'app', 'node_modules') - // $FlowFixMe + require('module').globalPaths.push(p) } @@ -36,8 +37,8 @@ require('electron-context-menu')() const installExtensions = () => { const loadDevtool = require('electron-load-devtool') - const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'] + const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'] return Promise.all( // chromeにreact&redux devtoolを開発者が入れておく必要がある // 個別のアプリごとにインストールするライブラリもあるが、確実に有利な点一つがある。 @@ -72,9 +73,7 @@ function createMainWindow() { nodeIntegration: true, }, }) - win.loadURL(`file://${__dirname}/app.html`) - win.on('closed', () => { mainWindow = null }) @@ -83,7 +82,6 @@ function createMainWindow() { config.set('bounds', win.getBounds()) }) }) - config.set('uuid', config.get('uuid', uuid.v4())) const user = ua('UA-102337955-1', config.get('uuid')) setInterval( @@ -93,36 +91,49 @@ function createMainWindow() { })(), ms('5m') ) - const { webContents } = win - webContents.on('did-finish-load', () => { referer('http://www.pixiv.net', win) }) - webContents.on('new-window', (event: Event, url: string) => { if (/intent\/twitter/.test(url)) { return } + event.preventDefault() shell.openExternal(url) }) - return win } +function openTweet(url: string) { + const tweetWin = new BrowserWindow({ + width: 600, + height: 400, + }) + const page = tweetWin.webContents + page.on('will-navigate', (event, url) => { + if (/twitter\.com\/intent\/tweet\/complete/.test(url)) { + tweetWin.close() + } + + event.preventDefault() + }) + tweetWin.loadURL(url, { + httpReferrer: 'https://twitter.com', + }) +} + app.on('window-all-closed', () => { // はっきり言って閉じるボタンが非表示を意味するmacアプリがおかしい // if (process.platform !== 'darwin') { } app.quit() }) - app.on('activate', () => { if (!mainWindow) { mainWindow = createMainWindow() } }) - app.on('ready', async () => { if ( process.env.NODE_ENV === 'development' || @@ -138,7 +149,6 @@ app.on('ready', async () => { mainWindow = createMainWindow() mainWindow.show() mainWindow.focus() - electron.Menu.setApplicationMenu(appMenu) if (process.env.NODE_ENV === 'production') { @@ -149,19 +159,3 @@ app.on('ready', async () => { openTweet(url) }) }) - -function openTweet(url: string) { - const tweetWin = new BrowserWindow({ width: 600, height: 400 }) - - const page = tweetWin.webContents - - page.on('will-navigate', (event, url) => { - if (/twitter\.com\/intent\/tweet\/complete/.test(url)) { - tweetWin.close() - } - - event.preventDefault() - }) - - tweetWin.loadURL(url, { httpReferrer: 'https://twitter.com' }) -} diff --git a/app/menu.js b/app/menu.ts similarity index 94% rename from app/menu.js rename to app/menu.ts index ec08d1bc..66c2a080 100644 --- a/app/menu.js +++ b/app/menu.ts @@ -1,20 +1,20 @@ -// @noflow import os from 'os' import electron from 'electron' const { app, shell } = electron - const appName = app.getName() -const helpSubmenu = [ +const helpSubmenu: electron.MenuItemConstructorOptions[] = [ { label: `${appName} Website`, + click() { shell.openExternal('https://github.com/akameco/PixivDeck') }, }, { label: 'Report an Issue...', + click() { const body = ` <!-- Please succinctly describe your issue and steps to reproduce it. --> @@ -40,6 +40,7 @@ if (process.platform !== 'darwin') { }, { role: 'about', + click() { electron.dialog.showMessageBox({ title: `About ${appName}`, @@ -52,7 +53,7 @@ if (process.platform !== 'darwin') { ) } -const darwinTpl = [ +const darwinTpl: electron.MenuItemConstructorOptions[] = [ { label: appName, submenu: [ @@ -127,6 +128,7 @@ const darwinTpl = [ { label: 'Reload', accelerator: 'CmdOrCtrl+R', + click(item, focusedWindow) { if (focusedWindow) { focusedWindow.reload() @@ -164,7 +166,7 @@ const darwinTpl = [ }, ] -const otherTpl = [ +const otherTpl: electron.MenuItemConstructorOptions[] = [ { label: 'File', submenu: [ @@ -216,8 +218,6 @@ const otherTpl = [ submenu: helpSubmenu, }, ] - const tpl = process.platform === 'darwin' ? darwinTpl : otherTpl const appMenu = electron.Menu.buildFromTemplate(tpl) - export default appMenu diff --git a/app/reducer.js b/app/reducer.ts similarity index 99% rename from app/reducer.js rename to app/reducer.ts index a8595518..564f55f9 100644 --- a/app/reducer.js +++ b/app/reducer.ts @@ -1,4 +1,3 @@ -// @flow import { combineReducers } from 'redux' import ColumnBookmark from 'containers/ColumnBookmark/reducer' import ColumnFollow from 'containers/ColumnFollow/reducer' diff --git a/app/sagas.js b/app/sagas.ts similarity index 96% rename from app/sagas.js rename to app/sagas.ts index f44d60e1..c5f470d5 100644 --- a/app/sagas.js +++ b/app/sagas.ts @@ -1,5 +1,3 @@ -// @flow -// $FlowFixMe import { fork, all } from 'redux-saga/effects' import BookmarkButton from 'containers/BookmarkButton/saga' import BoxContainer from 'containers/BoxContainer/saga' @@ -21,7 +19,7 @@ import UserPopoverContainer from 'containers/UserPopoverContainer/saga' import Notify from 'containers/Notify/saga' // import Api from 'containers/Api/saga' -function* root(): Generator<*, void, void> { +function* root() { yield all([ // fork(Api), fork(BookmarkButton), diff --git a/app/store.js b/app/store.ts similarity index 84% rename from app/store.js rename to app/store.ts index 6dfb302e..00f5623d 100644 --- a/app/store.js +++ b/app/store.ts @@ -1,16 +1,13 @@ -// @flow import { createStore, applyMiddleware, compose } from 'redux' import createSagaMiddleware from 'redux-saga' import { persistStore, persistReducer } from 'redux-persist' import localForage from 'localforage' -import type { Store } from 'types' +import { Store } from 'types' import reducer from './reducer' import mySaga from './sagas' - -import { version } from './package.json' // eslint-disable-line import/extensions +import { version } from './package.json' let persistor - const persistConfig = { key: `root`, version: version.split('.')[0], @@ -25,39 +22,36 @@ const persistConfig = { 'Table', ], } - const persistedReducer = persistReducer(persistConfig, reducer) - export default function configureStore( - initialState: Object = {} -): { store: Store, persistor: any } { + initialState: object = {} +): { + store: Store + persistor: any +} { const middleware = [] - const sagaMiddleware = createSagaMiddleware() middleware.push(sagaMiddleware) - const enhancer = compose( applyMiddleware(...middleware), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() ) - const store = createStore(persistedReducer, initialState, enhancer) - sagaMiddleware.run(mySaga) - persistor = persistStore(store) if (module.hot) { // Enable Webpack hot module replacement for reducers module.hot.accept('./reducer', () => { const nextRootReducer = require('./reducer') // eslint-disable-line global-require - - // $FlowFixMe store.replaceReducer(nextRootReducer) }) } - return { store, persistor } + return { + store, + persistor, + } } export function clean() { From b3592fc4ec1cf0b6259247616dcdc2aba4f95c03 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Sun, 10 Mar 2019 04:18:37 +0900 Subject: [PATCH 14/25] refactor(typescript): styles --- app/styles/{global-styles.js => global-styles.ts} | 2 -- app/styles/{styleTheme.js => styleTheme.ts} | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) rename app/styles/{global-styles.js => global-styles.ts} (93%) rename app/styles/{styleTheme.js => styleTheme.ts} (76%) diff --git a/app/styles/global-styles.js b/app/styles/global-styles.ts similarity index 93% rename from app/styles/global-styles.js rename to app/styles/global-styles.ts index 3afa912a..c1954d4f 100644 --- a/app/styles/global-styles.js +++ b/app/styles/global-styles.ts @@ -1,7 +1,5 @@ -// @flow import { createGlobalStyle } from 'styled-components' -/* eslint no-unused-expressions: 0 */ export const GlobalStyle = createGlobalStyle` * { -webkit-font-smoothing: antialiased; diff --git a/app/styles/styleTheme.js b/app/styles/styleTheme.ts similarity index 76% rename from app/styles/styleTheme.js rename to app/styles/styleTheme.ts index f240bae5..b3ce037d 100644 --- a/app/styles/styleTheme.js +++ b/app/styles/styleTheme.ts @@ -1,4 +1,3 @@ -// @flow const theme = { base: '#222426', black: '#222426', @@ -9,8 +8,7 @@ const theme = { accent: '', } -export function key(path: $Keys<typeof theme>) { +export function key(path: keyof typeof theme) { return () => theme[path] } - export default theme From 82e083f5eec68d0a5ca4ada712c461bd62f8292b Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Sun, 10 Mar 2019 04:22:27 +0900 Subject: [PATCH 15/25] refactor(typescript): i18n --- .../BoxContainer/{createMenu.js => createMenu.ts} | 14 ++++++-------- app/i18n/{i18n.test.js => i18n.test.ts} | 3 +-- app/i18n/{index.js => index.ts} | 1 - 3 files changed, 7 insertions(+), 11 deletions(-) rename app/containers/BoxContainer/{createMenu.js => createMenu.ts} (88%) rename app/i18n/{i18n.test.js => i18n.test.ts} (84%) rename app/i18n/{index.js => index.ts} (99%) diff --git a/app/containers/BoxContainer/createMenu.js b/app/containers/BoxContainer/createMenu.ts similarity index 88% rename from app/containers/BoxContainer/createMenu.js rename to app/containers/BoxContainer/createMenu.ts index 0caa5836..ed84b724 100644 --- a/app/containers/BoxContainer/createMenu.js +++ b/app/containers/BoxContainer/createMenu.ts @@ -1,15 +1,13 @@ -// @flow import { remote } from 'electron' import { download } from 'electron-dl' -import type { IntlShape } from 'react-intl' -import type { Dispatch } from 'types/' -import type { Illust } from 'types/illust' +import { IntlShape } from 'react-intl' +import { Dispatch } from 'types/' +import { Illust } from 'types/illust' import { openDrawer } from 'containers/DrawerManager/actions' import { addBookmarkRequest as addBookmark } from 'containers/BookmarkButton/actions' import { openPixiv } from './actions' import messages from './messages' -// $FlowFixMe const { Menu, MenuItem } = remote export default function createMenu({ @@ -17,9 +15,9 @@ export default function createMenu({ illust, intl, }: { - dispatch: Dispatch, - illust: Illust, - intl: IntlShape, + dispatch: Dispatch + illust: Illust + intl: IntlShape }) { const menu = new Menu() diff --git a/app/i18n/i18n.test.js b/app/i18n/i18n.test.ts similarity index 84% rename from app/i18n/i18n.test.js rename to app/i18n/i18n.test.ts index 4db37905..727f7433 100644 --- a/app/i18n/i18n.test.js +++ b/app/i18n/i18n.test.ts @@ -1,8 +1,7 @@ -// @flow import en from './en.yml' import ja from './ja.yml' -const getBlank = (obj: Object) => Object.keys(obj).filter(v => obj[v] === '') +const getBlank = (obj: object) => Object.keys(obj).filter(v => obj[v] === '') test('snapshot [en]', () => { expect(en).toMatchSnapshot() diff --git a/app/i18n/index.js b/app/i18n/index.ts similarity index 99% rename from app/i18n/index.js rename to app/i18n/index.ts index be7afc58..21920695 100644 --- a/app/i18n/index.js +++ b/app/i18n/index.ts @@ -1,4 +1,3 @@ -// @flow import { addLocaleData } from 'react-intl' import jaLocaleData from 'react-intl/locale-data/ja' import enLocaleData from 'react-intl/locale-data/en' From 36b219a4a97ff755fb982d43c28c012326b3de3b Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Sun, 10 Mar 2019 04:24:57 +0900 Subject: [PATCH 16/25] refactor(typescript): selector --- app/containers/ModalManeger/{selector.js => selector.ts} | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename app/containers/ModalManeger/{selector.js => selector.ts} (88%) diff --git a/app/containers/ModalManeger/selector.js b/app/containers/ModalManeger/selector.ts similarity index 88% rename from app/containers/ModalManeger/selector.js rename to app/containers/ModalManeger/selector.ts index f98190de..78e2eeff 100644 --- a/app/containers/ModalManeger/selector.js +++ b/app/containers/ModalManeger/selector.ts @@ -1,6 +1,5 @@ -// @flow import { createSelector } from 'reselect' -import type { State } from 'types/state' +import { State } from 'types/state' const selectModalManeger = (state: State) => state.ModalManeger From 35b50b8af544eeb548ea85473e7b0eb97fcd3575 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Sun, 10 Mar 2019 04:33:16 +0900 Subject: [PATCH 17/25] refactor(typescript): tests --- .../tests/{sagas.test.js => sagas.test.tsx} | 33 +++++++++----- .../tests/{sagas.test.js => sagas.test.tsx} | 15 ++++--- .../tests/{sagas.test.js => sagas.test.tsx} | 1 - .../tests/{sagas.test.js => sagas.test.tsx} | 44 ++++++++++++------- .../tests/{sagas.test.js => sagas.test.tsx} | 2 - .../tests/{sagas.test.js => sagas.test.tsx} | 8 ++-- .../tests/{sagas.test.js => sagas.test.tsx} | 17 ++++--- .../tests/{sagas.test.js => sagas.test.tsx} | 1 - .../tests/{sagas.test.js => sagas.test.tsx} | 1 - .../tests/{sagas.test.js => sagas.test.tsx} | 11 ++--- .../tests/{sagas.test.js => sagas.test.tsx} | 3 -- .../tests/{sagas.test.js => sagas.test.tsx} | 27 +++++------- .../tests/{saga.test.js => saga.test.tsx} | 9 ++-- .../tests/{sagas.test.js => sagas.test.tsx} | 2 - .../tests/{sagas.test.js => sagas.test.tsx} | 15 +++++-- 15 files changed, 104 insertions(+), 85 deletions(-) rename app/containers/Api/tests/{sagas.test.js => sagas.test.tsx} (67%) rename app/containers/BookmarkButton/tests/{sagas.test.js => sagas.test.tsx} (87%) rename app/containers/BoxContainer/tests/{sagas.test.js => sagas.test.tsx} (94%) rename app/containers/ColumnBookmark/tests/{sagas.test.js => sagas.test.tsx} (68%) rename app/containers/ColumnFollow/tests/{sagas.test.js => sagas.test.tsx} (96%) rename app/containers/ColumnHistory/tests/{sagas.test.js => sagas.test.tsx} (93%) rename app/containers/ColumnRanking/tests/{sagas.test.js => sagas.test.tsx} (71%) rename app/containers/ColumnRankingR18/tests/{sagas.test.js => sagas.test.tsx} (97%) rename app/containers/ColumnRecommended/tests/{sagas.test.js => sagas.test.tsx} (97%) rename app/containers/ColumnSearch/tests/{sagas.test.js => sagas.test.tsx} (91%) rename app/containers/ColumnUserIllust/tests/{sagas.test.js => sagas.test.tsx} (97%) rename app/containers/FollowButton/tests/{sagas.test.js => sagas.test.tsx} (86%) rename app/containers/LoginModal/tests/{saga.test.js => saga.test.tsx} (81%) rename app/containers/Notify/tests/{sagas.test.js => sagas.test.tsx} (96%) rename app/containers/SearchField/tests/{sagas.test.js => sagas.test.tsx} (80%) diff --git a/app/containers/Api/tests/sagas.test.js b/app/containers/Api/tests/sagas.test.tsx similarity index 67% rename from app/containers/Api/tests/sagas.test.js rename to app/containers/Api/tests/sagas.test.tsx index fff238ea..287c7f1f 100644 --- a/app/containers/Api/tests/sagas.test.js +++ b/app/containers/Api/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { call, put } from 'redux-saga/effects' import * as api from 'services/api' import { getToken } from 'containers/LoginModal/saga' @@ -6,32 +5,44 @@ import * as sagas from '../sagas' import * as actions from '../actions' test('post', () => { - const gen = sagas.post('endpoint', { dummy: 1 }) - + const gen = sagas.post('endpoint', { + dummy: 1, + }) let next = gen.next() expect(next.value).toStrictEqual(call(getToken)) - const token = 'fake token' next = gen.next(token) expect(next.value).toStrictEqual( - call(api.postRequest, 'endpoint', { dummy: 1 }, token) + call( + api.postRequest, + 'endpoint', + { + dummy: 1, + }, + token + ) ) }) test('get', () => { const gen = sagas.get('endpoint', true) - let next = gen.next() expect(next.value).toStrictEqual(call(getToken)) - const token = 'fake token' next = gen.next(token) - expect(next.value).toStrictEqual(call(api.getRequest, 'endpoint', {}, token)) + expect(next.value).toStrictEqual(call(api.getRequest, 'endpoint', {}, token)) // $FlowFixMe - // $FlowFixMe - next = gen.next({ entities: {}, result: {} }) + next = gen.next({ + entities: {}, + result: {}, + }) expect(next.value).toStrictEqual( // $FlowFixMe - put(actions.apiRequestSuccess({ entities: {}, result: {} })) + put( + actions.apiRequestSuccess({ + entities: {}, + result: {}, + }) + ) ) }) diff --git a/app/containers/BookmarkButton/tests/sagas.test.js b/app/containers/BookmarkButton/tests/sagas.test.tsx similarity index 87% rename from app/containers/BookmarkButton/tests/sagas.test.js rename to app/containers/BookmarkButton/tests/sagas.test.tsx index 5395581f..c5d5ea5e 100644 --- a/app/containers/BookmarkButton/tests/sagas.test.js +++ b/app/containers/BookmarkButton/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeEvery, put } from 'redux-saga/effects' import * as sagas from '../saga' import * as constants from '../constants' @@ -13,23 +12,25 @@ test('root', () => { }) test('bookmark', () => { - const action = { id: 1, restrict: 'public' } + const action = { + id: 1, + restrict: 'public', + } const gen = sagas.bookmark(action) - let next = gen.next() expect(next.value).toMatchSnapshot() - next = gen.next() expect(next.value).toStrictEqual(put(actions.addBookmarkSuccess(1, 'public'))) }) test('bookmark failed', () => { - const action = { id: 1, restrict: 'public' } + const action = { + id: 1, + restrict: 'public', + } const gen = sagas.bookmark(action) - let next = gen.next() expect(next.value).toMatchSnapshot() - next = gen.throw('error') expect(next.value).toStrictEqual(put(actions.addBookmarkFailer(1, 'error'))) }) diff --git a/app/containers/BoxContainer/tests/sagas.test.js b/app/containers/BoxContainer/tests/sagas.test.tsx similarity index 94% rename from app/containers/BoxContainer/tests/sagas.test.js rename to app/containers/BoxContainer/tests/sagas.test.tsx index d50a9dcf..54146737 100644 --- a/app/containers/BoxContainer/tests/sagas.test.js +++ b/app/containers/BoxContainer/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import * as sagas from '../saga' test('root', () => { diff --git a/app/containers/ColumnBookmark/tests/sagas.test.js b/app/containers/ColumnBookmark/tests/sagas.test.tsx similarity index 68% rename from app/containers/ColumnBookmark/tests/sagas.test.js rename to app/containers/ColumnBookmark/tests/sagas.test.tsx index ecbff995..6859d932 100644 --- a/app/containers/ColumnBookmark/tests/sagas.test.js +++ b/app/containers/ColumnBookmark/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeEvery } from 'redux-saga/effects' import { ADD_BOOKMARK_SUCCESS } from 'containers/BookmarkButton/constants' import * as sagas from '../saga' @@ -10,12 +9,10 @@ test('root', () => { expect(next.value).toStrictEqual( takeEvery(constants.ADD_COLUMN, sagas.addColumn) ) - next = gen.next() expect(next.value).toStrictEqual( takeEvery([constants.FETCH, constants.FETCH_NEXT], sagas.fetchBookmark) ) - next = gen.next() expect(next.value).toStrictEqual( takeEvery(ADD_BOOKMARK_SUCCESS, sagas.fetchNew) @@ -23,33 +20,48 @@ test('root', () => { }) test('fetch next', () => { - const gen = sagas.fetchBookmark({ id: 'public', type: constants.FETCH }) + const gen = sagas.fetchBookmark({ + id: 'public', + type: constants.FETCH, + }) const next = gen.next() expect(next.value).toMatchSnapshot() - expect(gen.next({ nextUrl: 'fake' }).value).toMatchSnapshot() + expect( + gen.next({ + nextUrl: 'fake', + }).value + ).toMatchSnapshot() }) test('fetch first', () => { - const gen = sagas.fetchBookmark({ id: 'public', type: constants.FETCH }) + const gen = sagas.fetchBookmark({ + id: 'public', + type: constants.FETCH, + }) let next = gen.next() - expect(next.value).toMatchSnapshot() - - next = gen.next({ id: '1' }) + next = gen.next({ + id: '1', + }) expect(next.value).toMatchSnapshot() - - next = gen.next({ ids: [1, 2, 3] }) + next = gen.next({ + ids: [1, 2, 3], + }) expect(next.value).toMatchSnapshot() }) test('new', () => { - const gen = sagas.fetchNew({ restrict: 'public' }) - let next = gen.next({ id: 'public' }) + const gen = sagas.fetchNew({ + restrict: 'public', + }) + let next = gen.next({ + id: 'public', + }) expect(next.value).toMatchSnapshot() - - next = gen.next({ ids: [1, 2, 3] }) + next = gen.next({ + ids: [1, 2, 3], + }) expect(next.value).toMatchSnapshot() - next = gen.next('myid') expect(next.value).toMatchSnapshot() }) diff --git a/app/containers/ColumnFollow/tests/sagas.test.js b/app/containers/ColumnFollow/tests/sagas.test.tsx similarity index 96% rename from app/containers/ColumnFollow/tests/sagas.test.js rename to app/containers/ColumnFollow/tests/sagas.test.tsx index ddcde38c..9bff716e 100644 --- a/app/containers/ColumnFollow/tests/sagas.test.js +++ b/app/containers/ColumnFollow/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeEvery } from 'redux-saga/effects' import * as sagas from '../saga' import * as constants from '../constants' @@ -6,7 +5,6 @@ import * as constants from '../constants' test('root', () => { const gen = sagas.default() const next = gen.next() - expect(next.value).toStrictEqual( takeEvery(constants.ADD_COLUMN, sagas.addFollowColumn) ) diff --git a/app/containers/ColumnHistory/tests/sagas.test.js b/app/containers/ColumnHistory/tests/sagas.test.tsx similarity index 93% rename from app/containers/ColumnHistory/tests/sagas.test.js rename to app/containers/ColumnHistory/tests/sagas.test.tsx index f29721cf..6072e8aa 100644 --- a/app/containers/ColumnHistory/tests/sagas.test.js +++ b/app/containers/ColumnHistory/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeEvery, put } from 'redux-saga/effects' import { OPEN_ILLUST_VIEWER } from 'containers/IllustPreview/constants' import { OPEN_MANGA_PREVIEW } from 'containers/MangaPreview/constants' @@ -8,12 +7,10 @@ import * as actions from '../actions' test('root Saga', () => { const gen = sagas.default() - let next = gen.next() expect(next.value).toStrictEqual( takeEvery(Actions.ADD_COLUMN_HISTORY, sagas.addHistoryColumn) ) - next = gen.next() expect(next.value).toStrictEqual( takeEvery([OPEN_ILLUST_VIEWER, OPEN_MANGA_PREVIEW], sagas.addHistory) @@ -21,8 +18,9 @@ test('root Saga', () => { }) test('add history', () => { - const gen = sagas.addHistory({ id: 1 }) - + const gen = sagas.addHistory({ + id: 1, + }) const next = gen.next() expect(next.value).toStrictEqual(put(actions.addHistory(1))) }) diff --git a/app/containers/ColumnRanking/tests/sagas.test.js b/app/containers/ColumnRanking/tests/sagas.test.tsx similarity index 71% rename from app/containers/ColumnRanking/tests/sagas.test.js rename to app/containers/ColumnRanking/tests/sagas.test.tsx index 35a28270..50028a06 100644 --- a/app/containers/ColumnRanking/tests/sagas.test.js +++ b/app/containers/ColumnRanking/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeEvery, take, call } from 'redux-saga/effects' import * as sagas from '../saga' import * as constants from '../constants' @@ -17,8 +16,16 @@ test('root', () => { test('watchNewIllust', () => { const gen = sagas.watchNewIllust() expect(gen.next().value).toStrictEqual(take(constants.START_WATCH)) - expect(gen.next({ id: 1 }).value).toMatchSnapshot() - expect(gen.next().value).toMatchSnapshot() - // $FlowFixMe - expect(gen.next().value).toStrictEqual(call(sagas.fetchNew, { id: 1 })) + expect( + gen.next({ + id: 1, + }).value + ).toMatchSnapshot() + expect(gen.next().value).toMatchSnapshot() // $FlowFixMe + + expect(gen.next().value).toStrictEqual( + call(sagas.fetchNew, { + id: 1, + }) + ) }) diff --git a/app/containers/ColumnRankingR18/tests/sagas.test.js b/app/containers/ColumnRankingR18/tests/sagas.test.tsx similarity index 97% rename from app/containers/ColumnRankingR18/tests/sagas.test.js rename to app/containers/ColumnRankingR18/tests/sagas.test.tsx index 97c8f6cb..31e06342 100644 --- a/app/containers/ColumnRankingR18/tests/sagas.test.js +++ b/app/containers/ColumnRankingR18/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeEvery } from 'redux-saga/effects' import * as sagas from '../saga' import * as constants from '../constants' diff --git a/app/containers/ColumnRecommended/tests/sagas.test.js b/app/containers/ColumnRecommended/tests/sagas.test.tsx similarity index 97% rename from app/containers/ColumnRecommended/tests/sagas.test.js rename to app/containers/ColumnRecommended/tests/sagas.test.tsx index 97c8f6cb..31e06342 100644 --- a/app/containers/ColumnRecommended/tests/sagas.test.js +++ b/app/containers/ColumnRecommended/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeEvery } from 'redux-saga/effects' import * as sagas from '../saga' import * as constants from '../constants' diff --git a/app/containers/ColumnSearch/tests/sagas.test.js b/app/containers/ColumnSearch/tests/sagas.test.tsx similarity index 91% rename from app/containers/ColumnSearch/tests/sagas.test.js rename to app/containers/ColumnSearch/tests/sagas.test.tsx index 60a53ff5..f06f2b6a 100644 --- a/app/containers/ColumnSearch/tests/sagas.test.js +++ b/app/containers/ColumnSearch/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import * as effects from 'redux-saga/effects' import * as sagas from '../saga' import * as actions from '../actions' @@ -15,19 +14,17 @@ test('root', () => { test('usersIn', () => { const gen = sagas.usersIn() const id = 'fate' - let next = gen.next() expect(next.value).toStrictEqual(effects.take(constants.USERS_IN)) - - next = gen.next({ id: 'fate1000users入り', usersIn: 100 }) + next = gen.next({ + id: 'fate1000users入り', + usersIn: 100, + }) expect(next.value).toStrictEqual(effects.put(actions.setUsersIn(id, 100))) - next = gen.next() expect(next.value).toStrictEqual(effects.put(actions.resetIds(id))) - next = gen.next() expect(next.value).toStrictEqual(effects.put(actions.setNextUrl(id, null))) - next = gen.next() expect(next.value).toStrictEqual(effects.put(actions.fetch(id))) }) diff --git a/app/containers/ColumnUserIllust/tests/sagas.test.js b/app/containers/ColumnUserIllust/tests/sagas.test.tsx similarity index 97% rename from app/containers/ColumnUserIllust/tests/sagas.test.js rename to app/containers/ColumnUserIllust/tests/sagas.test.tsx index 7bf44af0..eaf2bfe2 100644 --- a/app/containers/ColumnUserIllust/tests/sagas.test.js +++ b/app/containers/ColumnUserIllust/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeEvery } from 'redux-saga/effects' import * as sagas from '../saga' import * as constants from '../constants' @@ -9,12 +8,10 @@ test('root', () => { expect(next.value).toStrictEqual( takeEvery(constants.ADD_COLUMN, sagas.addColumn) ) - next = gen.next() expect(next.value).toStrictEqual( takeEvery(constants.FETCH, sagas.fetchUserIllust) ) - next = gen.next() expect(next.value).toStrictEqual( takeEvery(constants.FETCH_NEXT, sagas.fetchNextUserIllust) diff --git a/app/containers/FollowButton/tests/sagas.test.js b/app/containers/FollowButton/tests/sagas.test.tsx similarity index 86% rename from app/containers/FollowButton/tests/sagas.test.js rename to app/containers/FollowButton/tests/sagas.test.tsx index 5cbd7ecf..ddea9265 100644 --- a/app/containers/FollowButton/tests/sagas.test.js +++ b/app/containers/FollowButton/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeEvery, put } from 'redux-saga/effects' import * as sagas from '../saga' import * as constants from '../constants' @@ -6,12 +5,10 @@ import * as actions from '../actions' test('root', () => { const gen = sagas.default() - let next = gen.next() expect(next.value).toStrictEqual( takeEvery(constants.FOLLOW_REQUEST, sagas.follow) ) - next = gen.next() expect(next.value).toStrictEqual( takeEvery(constants.UN_FOLLOW_REQUEST, sagas.unfollow) @@ -19,41 +16,41 @@ test('root', () => { }) test('follow success', () => { - const gen = sagas.follow({ id: 1 }) - + const gen = sagas.follow({ + id: 1, + }) let next = gen.next() expect(next.value).toMatchSnapshot() - next = gen.next() expect(next.value).toStrictEqual(put(actions.followSuccess('public'))) }) test('follow failer', () => { - const gen = sagas.follow({ id: 1 }) - + const gen = sagas.follow({ + id: 1, + }) let next = gen.next() expect(next.value).toMatchSnapshot() - next = gen.throw('err') expect(next.value).toStrictEqual(put(actions.followFailer('err'))) }) test('unfollow success', () => { - const gen = sagas.unfollow({ id: 1 }) - + const gen = sagas.unfollow({ + id: 1, + }) let next = gen.next() expect(next.value).toMatchSnapshot() - next = gen.next() expect(next.value).toStrictEqual(put(actions.unFollowSuccess('public'))) }) test('unfollow failer', () => { - const gen = sagas.unfollow({ id: 1 }) - + const gen = sagas.unfollow({ + id: 1, + }) let next = gen.next() expect(next.value).toMatchSnapshot() - next = gen.throw('err') expect(next.value).toStrictEqual(put(actions.unFollowFailer('err'))) }) diff --git a/app/containers/LoginModal/tests/saga.test.js b/app/containers/LoginModal/tests/saga.test.tsx similarity index 81% rename from app/containers/LoginModal/tests/saga.test.js rename to app/containers/LoginModal/tests/saga.test.tsx index d0c45468..775c6b60 100644 --- a/app/containers/LoginModal/tests/saga.test.js +++ b/app/containers/LoginModal/tests/saga.test.tsx @@ -1,17 +1,16 @@ -// @flow import { call } from 'redux-saga/effects' import { fetchAuth } from 'services/api' import * as sagas from '../saga' test('getToken', () => { const gen = sagas.getToken() - let next = gen.next() expect(next.value).toMatchSnapshot() - - const fakeUserInfo = { username: 'fake-username', password: 'fake-pass' } + const fakeUserInfo = { + username: 'fake-username', + password: 'fake-pass', + } next = gen.next(fakeUserInfo) expect(next.value).toStrictEqual(call(fetchAuth, fakeUserInfo)) - expect(gen.return('fake-token')).toMatchSnapshot() }) diff --git a/app/containers/Notify/tests/sagas.test.js b/app/containers/Notify/tests/sagas.test.tsx similarity index 96% rename from app/containers/Notify/tests/sagas.test.js rename to app/containers/Notify/tests/sagas.test.tsx index 14a5c828..8a098a06 100644 --- a/app/containers/Notify/tests/sagas.test.js +++ b/app/containers/Notify/tests/sagas.test.tsx @@ -1,11 +1,9 @@ -// @flow import { takeEvery } from 'redux-saga/effects' import * as sagas from '../saga' import * as constants from '../constants' test('root', () => { const gen = sagas.default() - const next = gen.next() expect(next.value).toStrictEqual( takeEvery(constants.ADD_NOTIFY_WITH_ILLUST, sagas.notifyWithIllust) diff --git a/app/containers/SearchField/tests/sagas.test.js b/app/containers/SearchField/tests/sagas.test.tsx similarity index 80% rename from app/containers/SearchField/tests/sagas.test.js rename to app/containers/SearchField/tests/sagas.test.tsx index 4cded150..39a60db5 100644 --- a/app/containers/SearchField/tests/sagas.test.js +++ b/app/containers/SearchField/tests/sagas.test.tsx @@ -1,4 +1,3 @@ -// @flow import { takeLatest, call, put } from 'redux-saga/effects' import * as api from 'containers/Api/sagas' import * as sagas from '../saga' @@ -14,17 +13,25 @@ test('root', () => { }) test('autocomplete', () => { - const gen = sagas.autocomplete({ word: 'fate' }) + const gen = sagas.autocomplete({ + word: 'fate', + }) let next = gen.next() expect(next.value).toStrictEqual( call(api.get, '/v1/search/autocomplete?word=fate', true) ) - next = gen.next({ result: { searchAutoCompleteKeywords: ['fate', 'fgo'] } }) + next = gen.next({ + result: { + searchAutoCompleteKeywords: ['fate', 'fgo'], + }, + }) expect(next.value).toStrictEqual(put(actions.fetchSuccess(['fate', 'fgo']))) }) test('autocomplete failre', () => { - const gen = sagas.autocomplete({ word: 'fate' }) + const gen = sagas.autocomplete({ + word: 'fate', + }) let next = gen.next() expect(next.value).toStrictEqual( call(api.get, '/v1/search/autocomplete?word=fate', true) From 7e52992e750aff16d96c215c19ad57ab7b6dad60 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Sun, 10 Mar 2019 05:07:12 +0900 Subject: [PATCH 18/25] refactor(typescript): tests --- .../{actions.test.js => actions.test.ts} | 1 - .../{reducer.test.js => reducer.test.ts} | 10 +++++-- .../{reducer.test.js => reducer.test.ts} | 9 ++++--- .../{reducer.test.js => reducer.test.ts} | 13 ++++++--- .../{reducer.test.js => reducer.test.ts} | 3 +-- .../{reducer.test.js => reducer.test.ts} | 9 ++++--- .../{reducer.test.js => reducer.test.ts} | 9 ++++--- .../ColumnRecommended/tests/reducer.test.js | 7 ----- .../ColumnRecommended/tests/reducer.test.ts | 13 +++++++++ .../{reducer.test.js => reducer.test.ts} | 16 ++++++++--- .../{reducer.test.js => reducer.test.ts} | 14 +++++++--- .../{reducer.test.js => reducer.test.ts} | 15 ++++++----- .../{reducer.test.js => reducer.test.ts} | 9 ++++--- .../tests/__snapshots__/actions.test.js.snap | 15 ----------- app/containers/Notify/tests/actions.test.js | 10 ------- .../{reducer.test.js => reducer.test.ts} | 9 ++++--- .../{reducer.test.js => reducer.test.ts} | 27 ++++++++++++++----- .../{reducer.test.js => reducer.test.ts} | 13 ++++++--- 18 files changed, 121 insertions(+), 81 deletions(-) rename app/containers/BookmarkButton/tests/{actions.test.js => actions.test.ts} (97%) rename app/containers/Column/{reducer.test.js => reducer.test.ts} (92%) rename app/containers/ColumnBookmark/tests/{reducer.test.js => reducer.test.ts} (86%) rename app/containers/ColumnFollow/tests/{reducer.test.js => reducer.test.ts} (90%) rename app/containers/ColumnHistory/tests/{reducer.test.js => reducer.test.ts} (95%) rename app/containers/ColumnRanking/tests/{reducer.test.js => reducer.test.ts} (68%) rename app/containers/ColumnRankingR18/tests/{reducer.test.js => reducer.test.ts} (80%) delete mode 100644 app/containers/ColumnRecommended/tests/reducer.test.js create mode 100644 app/containers/ColumnRecommended/tests/reducer.test.ts rename app/containers/ColumnSearch/tests/{reducer.test.js => reducer.test.ts} (66%) rename app/containers/DrawerManager/tests/{reducer.test.js => reducer.test.ts} (68%) rename app/containers/Language/tests/{reducer.test.js => reducer.test.ts} (69%) rename app/containers/LoginModal/tests/{reducer.test.js => reducer.test.ts} (90%) delete mode 100644 app/containers/Notify/tests/__snapshots__/actions.test.js.snap delete mode 100644 app/containers/Notify/tests/actions.test.js rename app/containers/Table/tests/{reducer.test.js => reducer.test.ts} (84%) rename app/containers/UserDrawerContainer/tests/{reducer.test.js => reducer.test.ts} (61%) rename app/containers/UserPopoverContainer/tests/{reducer.test.js => reducer.test.ts} (68%) diff --git a/app/containers/BookmarkButton/tests/actions.test.js b/app/containers/BookmarkButton/tests/actions.test.ts similarity index 97% rename from app/containers/BookmarkButton/tests/actions.test.js rename to app/containers/BookmarkButton/tests/actions.test.ts index b9f6cd23..6ef5def2 100644 --- a/app/containers/BookmarkButton/tests/actions.test.js +++ b/app/containers/BookmarkButton/tests/actions.test.ts @@ -1,4 +1,3 @@ -// @flow import * as actions from '../actions' test('addBookmarkRequest', () => { diff --git a/app/containers/Column/reducer.test.js b/app/containers/Column/reducer.test.ts similarity index 92% rename from app/containers/Column/reducer.test.js rename to app/containers/Column/reducer.test.ts index b1c2cdda..bd950ea7 100644 --- a/app/containers/Column/reducer.test.js +++ b/app/containers/Column/reducer.test.ts @@ -1,4 +1,3 @@ -// @flow import { baseReducer as reducer } from './reducer' const baseActions = { @@ -18,7 +17,14 @@ const state = { test('default action', () => { expect( - reducer('base', baseActions, {}, { type: 'default action' }) + reducer( + 'base', + baseActions, + {}, + { + type: 'default action', + } + ) ).toMatchSnapshot() }) diff --git a/app/containers/ColumnBookmark/tests/reducer.test.js b/app/containers/ColumnBookmark/tests/reducer.test.ts similarity index 86% rename from app/containers/ColumnBookmark/tests/reducer.test.js rename to app/containers/ColumnBookmark/tests/reducer.test.ts index 77f21ea5..1821d9bb 100644 --- a/app/containers/ColumnBookmark/tests/reducer.test.js +++ b/app/containers/ColumnBookmark/tests/reducer.test.ts @@ -1,12 +1,15 @@ -// @flow import reducer from '../reducer' import * as actions from '../actions' const initialState = {} test('snapshot initialState', () => { - // $FlowFixMe - expect(reducer(initialState, { type: 'default action' })).toMatchSnapshot() + expect( + reducer(initialState, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() }) test('ADD_BOOKMARK_COLUMN_SUCCESS', () => { diff --git a/app/containers/ColumnFollow/tests/reducer.test.js b/app/containers/ColumnFollow/tests/reducer.test.ts similarity index 90% rename from app/containers/ColumnFollow/tests/reducer.test.js rename to app/containers/ColumnFollow/tests/reducer.test.ts index 0ca9e149..eec46427 100644 --- a/app/containers/ColumnFollow/tests/reducer.test.js +++ b/app/containers/ColumnFollow/tests/reducer.test.ts @@ -1,10 +1,16 @@ -// @flow import reducer from '../reducer' import * as actions from '../actions' test('default action', () => { - // $FlowFixMe - expect(reducer({}, { type: 'default action' })).toMatchSnapshot() + expect( + reducer( + {}, + { + // @ts-ignore + type: 'default action', + } + ) + ).toMatchSnapshot() }) test('ADD_FOLLOW_COLUMN_SUCCESS', () => { @@ -38,7 +44,6 @@ test('FETCH_NEXT_SUCCESS, FETCH_NEW_SUCCESS', () => { expect( reducer(first, actions.fetchNextSuccess('private', [4, 5])) ).toMatchSnapshot() - expect( reducer(first, actions.fetchNewSuccess('private', [8])) ).toMatchSnapshot() diff --git a/app/containers/ColumnHistory/tests/reducer.test.js b/app/containers/ColumnHistory/tests/reducer.test.ts similarity index 95% rename from app/containers/ColumnHistory/tests/reducer.test.js rename to app/containers/ColumnHistory/tests/reducer.test.ts index f3314331..ff23d54c 100644 --- a/app/containers/ColumnHistory/tests/reducer.test.js +++ b/app/containers/ColumnHistory/tests/reducer.test.ts @@ -1,4 +1,3 @@ -// @flow import reducer from '../reducer' import * as actions from '../actions' @@ -7,7 +6,7 @@ const ds = { } test('default action', () => { - // $FlowFixMe + // @ts-ignore expect(reducer(ds, 'default action')).toMatchSnapshot() }) diff --git a/app/containers/ColumnRanking/tests/reducer.test.js b/app/containers/ColumnRanking/tests/reducer.test.ts similarity index 68% rename from app/containers/ColumnRanking/tests/reducer.test.js rename to app/containers/ColumnRanking/tests/reducer.test.ts index 25121e9a..3863f488 100644 --- a/app/containers/ColumnRanking/tests/reducer.test.js +++ b/app/containers/ColumnRanking/tests/reducer.test.ts @@ -1,10 +1,13 @@ -// @flow import reducer, { initialState } from '../reducer' import * as actions from '../actions' test('default action', () => { - // $FlowFixMe - expect(reducer(initialState, { type: 'default action' })).toMatchSnapshot() + expect( + reducer(initialState, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() }) test('ADD_COLUMN_SUCCESS', () => { diff --git a/app/containers/ColumnRankingR18/tests/reducer.test.js b/app/containers/ColumnRankingR18/tests/reducer.test.ts similarity index 80% rename from app/containers/ColumnRankingR18/tests/reducer.test.js rename to app/containers/ColumnRankingR18/tests/reducer.test.ts index cadbce48..88417676 100644 --- a/app/containers/ColumnRankingR18/tests/reducer.test.js +++ b/app/containers/ColumnRankingR18/tests/reducer.test.ts @@ -1,10 +1,13 @@ -// @flow import reducer from '../reducer' import * as actions from '../actions' test('default action', () => { - // $FlowFixMe - expect(reducer(undefined, { type: 'default action' })).toMatchSnapshot() + expect( + reducer(undefined, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() }) test('ADD_COLUMN_SUCCESS', () => { diff --git a/app/containers/ColumnRecommended/tests/reducer.test.js b/app/containers/ColumnRecommended/tests/reducer.test.js deleted file mode 100644 index 061d9285..00000000 --- a/app/containers/ColumnRecommended/tests/reducer.test.js +++ /dev/null @@ -1,7 +0,0 @@ -// @flow -import reducer from '../reducer' - -test('default action', () => { - // $FlowFixMe - expect(reducer({}, { type: 'default action' })).toMatchSnapshot() -}) diff --git a/app/containers/ColumnRecommended/tests/reducer.test.ts b/app/containers/ColumnRecommended/tests/reducer.test.ts new file mode 100644 index 00000000..ac4a78f6 --- /dev/null +++ b/app/containers/ColumnRecommended/tests/reducer.test.ts @@ -0,0 +1,13 @@ +import reducer from '../reducer' + +test('default action', () => { + expect( + reducer( + {}, + { + // @ts-ignore + type: 'default action', + } + ) + ).toMatchSnapshot() +}) diff --git a/app/containers/ColumnSearch/tests/reducer.test.js b/app/containers/ColumnSearch/tests/reducer.test.ts similarity index 66% rename from app/containers/ColumnSearch/tests/reducer.test.js rename to app/containers/ColumnSearch/tests/reducer.test.ts index 96016235..d9edb14c 100644 --- a/app/containers/ColumnSearch/tests/reducer.test.js +++ b/app/containers/ColumnSearch/tests/reducer.test.ts @@ -1,4 +1,3 @@ -// @flow import reducer, { initialState } from '../reducer' import * as actions from '../actions' @@ -11,8 +10,12 @@ const defaultState = { } test('default action', () => { - // $FlowFixMe - expect(reducer(initialState, { type: 'default action' })).toMatchSnapshot() + expect( + reducer(initialState, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() }) test('setUsersIn', () => { @@ -23,6 +26,11 @@ test('setUsersIn', () => { test('reset ids', () => { expect( - reducer({ fate: defaultState }, actions.resetIds('fate')) + reducer( + { + fate: defaultState, + }, + actions.resetIds('fate') + ) ).toMatchSnapshot() }) diff --git a/app/containers/DrawerManager/tests/reducer.test.js b/app/containers/DrawerManager/tests/reducer.test.ts similarity index 68% rename from app/containers/DrawerManager/tests/reducer.test.js rename to app/containers/DrawerManager/tests/reducer.test.ts index fbb97f39..68c8a92e 100644 --- a/app/containers/DrawerManager/tests/reducer.test.js +++ b/app/containers/DrawerManager/tests/reducer.test.ts @@ -1,4 +1,3 @@ -// @flow import reducer from '../reducer' import * as actions from '../actions' @@ -8,8 +7,12 @@ const df = { } test('default action', () => { - // $FlowFixMe - expect(reducer(df, { type: 'default action' })).toMatchSnapshot() + expect( + reducer(df, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() }) test('OPEN_DRAWER', () => { @@ -17,6 +20,9 @@ test('OPEN_DRAWER', () => { }) test('CLOSE_DRAWER', () => { - const s = { open: true, userId: 1 } + const s = { + open: true, + userId: 1, + } expect(reducer(s, actions.closeDrawer())).toMatchSnapshot() }) diff --git a/app/containers/Language/tests/reducer.test.js b/app/containers/Language/tests/reducer.test.ts similarity index 69% rename from app/containers/Language/tests/reducer.test.js rename to app/containers/Language/tests/reducer.test.ts index 52977028..5d16fdf8 100644 --- a/app/containers/Language/tests/reducer.test.js +++ b/app/containers/Language/tests/reducer.test.ts @@ -1,16 +1,19 @@ -// @flow import reducer from '../reducer' import * as actions from '../actions' -test('default action', () => { - // $FlowFixMe - expect(reducer({}, { type: 'default action' })).toMatchSnapshot() -}) - const ds = { locale: 'ja', } +test('default action', () => { + expect( + reducer(ds, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() +}) + test(`changeLocale`, () => { expect(reducer(ds, actions.changeLocale('en'))).toMatchSnapshot() }) diff --git a/app/containers/LoginModal/tests/reducer.test.js b/app/containers/LoginModal/tests/reducer.test.ts similarity index 90% rename from app/containers/LoginModal/tests/reducer.test.js rename to app/containers/LoginModal/tests/reducer.test.ts index 254e00d5..3e1596ef 100644 --- a/app/containers/LoginModal/tests/reducer.test.js +++ b/app/containers/LoginModal/tests/reducer.test.ts @@ -1,10 +1,13 @@ -// @flow import reducer, { initialState } from '../reducer' import * as actions from '../actions' test('default action', () => { - // $FlowFixMe - expect(reducer(undefined, { type: 'default action' })).toMatchSnapshot() + expect( + reducer(undefined, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() }) test('SET_AUTH', () => { diff --git a/app/containers/Notify/tests/__snapshots__/actions.test.js.snap b/app/containers/Notify/tests/__snapshots__/actions.test.js.snap deleted file mode 100644 index 22468e60..00000000 --- a/app/containers/Notify/tests/__snapshots__/actions.test.js.snap +++ /dev/null @@ -1,15 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`addNotify 1`] = ` -Object { - "type": "Notify/add", -} -`; - -exports[`addNotifyWithIllust 1`] = ` -Object { - "id": 1, - "title": "new illust", - "type": "Notify/ADD_NOTIFY_WITH_ILLUST", -} -`; diff --git a/app/containers/Notify/tests/actions.test.js b/app/containers/Notify/tests/actions.test.js deleted file mode 100644 index ec3ad3ca..00000000 --- a/app/containers/Notify/tests/actions.test.js +++ /dev/null @@ -1,10 +0,0 @@ -// @flow -import * as actions from '../actions' - -test('addNotify', () => { - expect(actions.addNotify()).toMatchSnapshot() -}) - -test('addNotifyWithIllust', () => { - expect(actions.addNotifyWithIllust('new illust', 1)).toMatchSnapshot() -}) diff --git a/app/containers/Table/tests/reducer.test.js b/app/containers/Table/tests/reducer.test.ts similarity index 84% rename from app/containers/Table/tests/reducer.test.js rename to app/containers/Table/tests/reducer.test.ts index 6946ff85..75697598 100644 --- a/app/containers/Table/tests/reducer.test.js +++ b/app/containers/Table/tests/reducer.test.ts @@ -1,4 +1,3 @@ -// @flow import reducer from '../reducer' import * as actions from '../actions' @@ -8,8 +7,12 @@ const df = { } test('default action', () => { - // $FlowFixMe - expect(reducer(undefined, { type: 'default action' })).toMatchSnapshot() + expect( + reducer(undefined, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() }) test('ADD_TABLE', () => { diff --git a/app/containers/UserDrawerContainer/tests/reducer.test.js b/app/containers/UserDrawerContainer/tests/reducer.test.ts similarity index 61% rename from app/containers/UserDrawerContainer/tests/reducer.test.js rename to app/containers/UserDrawerContainer/tests/reducer.test.ts index 97fd0d9d..5fb9ce42 100644 --- a/app/containers/UserDrawerContainer/tests/reducer.test.js +++ b/app/containers/UserDrawerContainer/tests/reducer.test.ts @@ -1,11 +1,14 @@ -// @flow import * as manegerActions from 'containers/DrawerManager/actions' import reducer, { initialState as ds } from '../reducer' import * as actions from '../actions' test('default action', () => { - // $FlowFixMe - expect(reducer(ds, { type: 'default action' })).toMatchSnapshot() + expect( + reducer(ds, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() }) test('CLOSE_DRAWER', () => { @@ -13,14 +16,24 @@ test('CLOSE_DRAWER', () => { }) test('ADD_DRAWER_USER', () => { - // $FlowFixMe - expect(reducer(ds, actions.addDrawerUser({ id: 123 }))).toMatchSnapshot() + expect( + reducer( + ds, + actions.addDrawerUser({ + id: 123, + }) + ) + ).toMatchSnapshot() }) test('ADD_DRAWER_PROFILE', () => { expect( - // $FlowFixMe - reducer(ds, actions.addDrawerProfile({ mock: 'mock' })) + reducer( + ds, + actions.addDrawerProfile({ + mock: 'mock', + }) + ) ).toMatchSnapshot() }) diff --git a/app/containers/UserPopoverContainer/tests/reducer.test.js b/app/containers/UserPopoverContainer/tests/reducer.test.ts similarity index 68% rename from app/containers/UserPopoverContainer/tests/reducer.test.js rename to app/containers/UserPopoverContainer/tests/reducer.test.ts index b73fb367..f850bb74 100644 --- a/app/containers/UserPopoverContainer/tests/reducer.test.js +++ b/app/containers/UserPopoverContainer/tests/reducer.test.ts @@ -1,4 +1,3 @@ -// @flow import reducer from '../reducer' import * as actions from '../actions' @@ -7,8 +6,12 @@ const df = { } test('default action', () => { - // $FlowFixMe - expect(reducer(df, { type: 'default action' })).toMatchSnapshot() + expect( + reducer(df, { + // @ts-ignore + type: 'default action', + }) + ).toMatchSnapshot() }) test('POPOVER_SUCCESS', () => { @@ -16,6 +19,8 @@ test('POPOVER_SUCCESS', () => { }) test('CLEAR', () => { - const s = { illusts: [1, 2, 3] } + const s = { + illusts: [1, 2, 3], + } expect(reducer(s, actions.clear())).toMatchSnapshot() }) From a2f7fd8e72330084ea585b46bf0f7dd98278a4b6 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Sun, 10 Mar 2019 14:34:16 +0900 Subject: [PATCH 19/25] chore(flow): remove flow-typed --- flow-typed/index.js | 23 - flow-typed/npm/autolinker_vx.x.x.js | 39 - flow-typed/npm/jest_v23.x.x.js | 1155 ------ flow-typed/npm/localforage_vx.x.x.js | 326 -- flow-typed/npm/lodash_v4.x.x.js | 4231 -------------------- flow-typed/npm/normalizr_v2.x.x.js | 26 - flow-typed/npm/react-redux_v5.x.x.js | 132 - flow-typed/npm/redux-saga_v1.x.x.js | 2125 ---------- flow-typed/npm/redux_v3.x.x.js | 107 - flow-typed/npm/reselect_v3.x.x.js | 890 ---- flow-typed/npm/styled-components_v4.x.x.js | 410 -- flow-typed/redux-persist.js.flow | 11 - flow-typed/strorybook_v3.x.x.js | 22 - 13 files changed, 9497 deletions(-) delete mode 100644 flow-typed/index.js delete mode 100644 flow-typed/npm/autolinker_vx.x.x.js delete mode 100644 flow-typed/npm/jest_v23.x.x.js delete mode 100644 flow-typed/npm/localforage_vx.x.x.js delete mode 100644 flow-typed/npm/lodash_v4.x.x.js delete mode 100644 flow-typed/npm/normalizr_v2.x.x.js delete mode 100644 flow-typed/npm/react-redux_v5.x.x.js delete mode 100644 flow-typed/npm/redux-saga_v1.x.x.js delete mode 100644 flow-typed/npm/redux_v3.x.x.js delete mode 100644 flow-typed/npm/reselect_v3.x.x.js delete mode 100644 flow-typed/npm/styled-components_v4.x.x.js delete mode 100644 flow-typed/redux-persist.js.flow delete mode 100644 flow-typed/strorybook_v3.x.x.js diff --git a/flow-typed/index.js b/flow-typed/index.js deleted file mode 100644 index 7177cfd5..00000000 --- a/flow-typed/index.js +++ /dev/null @@ -1,23 +0,0 @@ -declare class IntersectionObserver { - constructor(any, options?: any): void; - observe(any): any; -} - -declare module 'electron-devtools-installer' { - declare module.exports: any => any; -} - -declare module 'react-event-listener' { - declare module.exports: any => any; -} - -declare var module: { - hot: { - accept: (s: string, f: () => void) => void, - }, -} - -declare class Notification { - constructor(title: string, opts? : {icon?: string, body?: string, url?: string}): void; - onclick: Function; -} diff --git a/flow-typed/npm/autolinker_vx.x.x.js b/flow-typed/npm/autolinker_vx.x.x.js deleted file mode 100644 index aa25cdb4..00000000 --- a/flow-typed/npm/autolinker_vx.x.x.js +++ /dev/null @@ -1,39 +0,0 @@ -// flow-typed signature: 3b8dc10f8e49e9c7c486040493ec641c -// flow-typed version: <<STUB>>/autolinker_v1.4.3/flow_v0.47.0 - -/** - * This is an autogenerated libdef stub for: - * - * 'autolinker' - * - * 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 'autolinker' { - 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 'autolinker/dist/Autolinker' { - declare module.exports: any; -} - -declare module 'autolinker/dist/Autolinker.min' { - declare module.exports: any; -} - -// Filename aliases -declare module 'autolinker/dist/Autolinker.js' { - declare module.exports: $Exports<'autolinker/dist/Autolinker'>; -} -declare module 'autolinker/dist/Autolinker.min.js' { - declare module.exports: $Exports<'autolinker/dist/Autolinker.min'>; -} diff --git a/flow-typed/npm/jest_v23.x.x.js b/flow-typed/npm/jest_v23.x.x.js deleted file mode 100644 index 95835f5f..00000000 --- a/flow-typed/npm/jest_v23.x.x.js +++ /dev/null @@ -1,1155 +0,0 @@ -// flow-typed signature: 78c200acffbcc16bba9478f5396c3a00 -// flow-typed version: b2980740dd/jest_v23.x.x/flow_>=v0.39.x - -type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = { - (...args: TArguments): TReturn, - /** - * An object for introspecting mock calls - */ - mock: { - /** - * An array that represents all calls that have been made into this mock - * function. Each call is represented by an array of arguments that were - * passed during the call. - */ - calls: Array<TArguments>, - /** - * An array that contains all the object instances that have been - * instantiated from this mock function. - */ - instances: Array<TReturn>, - /** - * An array that contains all the object results that have been - * returned by this mock function call - */ - results: Array<{ isThrow: boolean, value: TReturn }> - }, - /** - * Resets all information stored in the mockFn.mock.calls and - * mockFn.mock.instances arrays. Often this is useful when you want to clean - * up a mock's usage data between two assertions. - */ - mockClear(): void, - /** - * Resets all information stored in the mock. This is useful when you want to - * completely restore a mock back to its initial state. - */ - mockReset(): void, - /** - * Removes the mock and restores the initial implementation. This is useful - * when you want to mock functions in certain test cases and restore the - * original implementation in others. Beware that mockFn.mockRestore only - * works when mock was created with jest.spyOn. Thus you have to take care of - * restoration yourself when manually assigning jest.fn(). - */ - mockRestore(): void, - /** - * Accepts a function that should be used as the implementation of the mock. - * The mock itself will still record all calls that go into and instances - * that come from itself -- the only difference is that the implementation - * will also be executed when the mock is called. - */ - mockImplementation( - fn: (...args: TArguments) => TReturn - ): JestMockFn<TArguments, TReturn>, - /** - * Accepts a function that will be used as an implementation of the mock for - * one call to the mocked function. Can be chained so that multiple function - * calls produce different results. - */ - mockImplementationOnce( - fn: (...args: TArguments) => TReturn - ): JestMockFn<TArguments, TReturn>, - /** - * Accepts a string to use in test result output in place of "jest.fn()" to - * indicate which mock function is being referenced. - */ - mockName(name: string): JestMockFn<TArguments, TReturn>, - /** - * Just a simple sugar function for returning `this` - */ - mockReturnThis(): void, - /** - * Accepts a value that will be returned whenever the mock function is called. - */ - mockReturnValue(value: TReturn): JestMockFn<TArguments, TReturn>, - /** - * Sugar for only returning a value once inside your mock - */ - mockReturnValueOnce(value: TReturn): JestMockFn<TArguments, TReturn>, - /** - * Sugar for jest.fn().mockImplementation(() => Promise.resolve(value)) - */ - mockResolvedValue(value: TReturn): JestMockFn<TArguments, Promise<TReturn>>, - /** - * Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value)) - */ - mockResolvedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<TReturn>>, - /** - * Sugar for jest.fn().mockImplementation(() => Promise.reject(value)) - */ - mockRejectedValue(value: TReturn): JestMockFn<TArguments, Promise<any>>, - /** - * Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value)) - */ - mockRejectedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<any>> -}; - -type JestAsymmetricEqualityType = { - /** - * A custom Jasmine equality tester - */ - asymmetricMatch(value: mixed): boolean -}; - -type JestCallsType = { - allArgs(): mixed, - all(): mixed, - any(): boolean, - count(): number, - first(): mixed, - mostRecent(): mixed, - reset(): void -}; - -type JestClockType = { - install(): void, - mockDate(date: Date): void, - tick(milliseconds?: number): void, - uninstall(): void -}; - -type JestMatcherResult = { - message?: string | (() => string), - pass: boolean -}; - -type JestMatcher = (actual: any, expected: any) => - | JestMatcherResult - | Promise<JestMatcherResult>; - -type JestPromiseType = { - /** - * Use rejects to unwrap the reason of a rejected promise so any other - * matcher can be chained. If the promise is fulfilled the assertion fails. - */ - rejects: JestExpectType, - /** - * Use resolves to unwrap the value of a fulfilled promise so any other - * matcher can be chained. If the promise is rejected the assertion fails. - */ - resolves: JestExpectType -}; - -/** - * Jest allows functions and classes to be used as test names in test() and - * describe() - */ -type JestTestName = string | Function; - -/** - * Plugin: jest-styled-components - */ - -type JestStyledComponentsMatcherValue = - | string - | JestAsymmetricEqualityType - | RegExp - | typeof undefined; - -type JestStyledComponentsMatcherOptions = { - media?: string; - modifier?: string; - supports?: string; -} - -type JestStyledComponentsMatchersType = { - toHaveStyleRule( - property: string, - value: JestStyledComponentsMatcherValue, - options?: JestStyledComponentsMatcherOptions - ): void, -}; - -/** - * Plugin: jest-enzyme - */ -type EnzymeMatchersType = { - // 5.x - toBeEmpty(): void, - toBePresent(): void, - // 6.x - toBeChecked(): void, - toBeDisabled(): void, - toBeEmptyRender(): void, - toContainMatchingElement(selector: string): void; - toContainMatchingElements(n: number, selector: string): void; - toContainExactlyOneMatchingElement(selector: string): void; - toContainReact(element: React$Element<any>): void, - toExist(): void, - toHaveClassName(className: string): void, - toHaveHTML(html: string): void, - toHaveProp: ((propKey: string, propValue?: any) => void) & ((props: Object) => void), - toHaveRef(refName: string): void, - toHaveState: ((stateKey: string, stateValue?: any) => void) & ((state: Object) => void), - toHaveStyle: ((styleKey: string, styleValue?: any) => void) & ((style: Object) => void), - toHaveTagName(tagName: string): void, - toHaveText(text: string): void, - toHaveValue(value: any): void, - toIncludeText(text: string): void, - toMatchElement( - element: React$Element<any>, - options?: {| ignoreProps?: boolean, verbose?: boolean |}, - ): void, - toMatchSelector(selector: string): void, - // 7.x - toHaveDisplayName(name: string): void, -}; - -// DOM testing library extensions https://github.com/kentcdodds/dom-testing-library#custom-jest-matchers -type DomTestingLibraryType = { - toBeDisabled(): void, - toBeEmpty(): void, - toBeInTheDocument(): void, - toBeVisible(): void, - toContainElement(element: HTMLElement | null): void, - toContainHTML(htmlText: string): void, - toHaveAttribute(name: string, expectedValue?: string): void, - toHaveClass(...classNames: string[]): void, - toHaveFocus(): void, - toHaveFormValues(expectedValues: { [name: string]: any }): void, - toHaveStyle(css: string): void, - toHaveTextContent(content: string | RegExp, options?: { normalizeWhitespace: boolean }): void, - toBeInTheDOM(): void, -}; - -// Jest JQuery Matchers: https://github.com/unindented/custom-jquery-matchers -type JestJQueryMatchersType = { - toExist(): void, - toHaveLength(len: number): void, - toHaveId(id: string): void, - toHaveClass(className: string): void, - toHaveTag(tag: string): void, - toHaveAttr(key: string, val?: any): void, - toHaveProp(key: string, val?: any): void, - toHaveText(text: string | RegExp): void, - toHaveData(key: string, val?: any): void, - toHaveValue(val: any): void, - toHaveCss(css: {[key: string]: any}): void, - toBeChecked(): void, - toBeDisabled(): void, - toBeEmpty(): void, - toBeHidden(): void, - toBeSelected(): void, - toBeVisible(): void, - toBeFocused(): void, - toBeInDom(): void, - toBeMatchedBy(sel: string): void, - toHaveDescendant(sel: string): void, - toHaveDescendantWithText(sel: string, text: string | RegExp): void -}; - - -// Jest Extended Matchers: https://github.com/jest-community/jest-extended -type JestExtendedMatchersType = { - /** - * Note: Currently unimplemented - * Passing assertion - * - * @param {String} message - */ - // pass(message: string): void; - - /** - * Note: Currently unimplemented - * Failing assertion - * - * @param {String} message - */ - // fail(message: string): void; - - /** - * Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty. - */ - toBeEmpty(): void; - - /** - * Use .toBeOneOf when checking if a value is a member of a given Array. - * @param {Array.<*>} members - */ - toBeOneOf(members: any[]): void; - - /** - * Use `.toBeNil` when checking a value is `null` or `undefined`. - */ - toBeNil(): void; - - /** - * Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`. - * @param {Function} predicate - */ - toSatisfy(predicate: (n: any) => boolean): void; - - /** - * Use `.toBeArray` when checking if a value is an `Array`. - */ - toBeArray(): void; - - /** - * Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x. - * @param {Number} x - */ - toBeArrayOfSize(x: number): void; - - /** - * Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set. - * @param {Array.<*>} members - */ - toIncludeAllMembers(members: any[]): void; - - /** - * Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set. - * @param {Array.<*>} members - */ - toIncludeAnyMembers(members: any[]): void; - - /** - * Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array. - * @param {Function} predicate - */ - toSatisfyAll(predicate: (n: any) => boolean): void; - - /** - * Use `.toBeBoolean` when checking if a value is a `Boolean`. - */ - toBeBoolean(): void; - - /** - * Use `.toBeTrue` when checking a value is equal (===) to `true`. - */ - toBeTrue(): void; - - /** - * Use `.toBeFalse` when checking a value is equal (===) to `false`. - */ - toBeFalse(): void; - - /** - * Use .toBeDate when checking if a value is a Date. - */ - toBeDate(): void; - - /** - * Use `.toBeFunction` when checking if a value is a `Function`. - */ - toBeFunction(): void; - - /** - * Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`. - * - * Note: Required Jest version >22 - * Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same - * - * @param {Mock} mock - */ - toHaveBeenCalledBefore(mock: JestMockFn<any, any>): void; - - /** - * Use `.toBeNumber` when checking if a value is a `Number`. - */ - toBeNumber(): void; - - /** - * Use `.toBeNaN` when checking a value is `NaN`. - */ - toBeNaN(): void; - - /** - * Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`. - */ - toBeFinite(): void; - - /** - * Use `.toBePositive` when checking if a value is a positive `Number`. - */ - toBePositive(): void; - - /** - * Use `.toBeNegative` when checking if a value is a negative `Number`. - */ - toBeNegative(): void; - - /** - * Use `.toBeEven` when checking if a value is an even `Number`. - */ - toBeEven(): void; - - /** - * Use `.toBeOdd` when checking if a value is an odd `Number`. - */ - toBeOdd(): void; - - /** - * Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive). - * - * @param {Number} start - * @param {Number} end - */ - toBeWithin(start: number, end: number): void; - - /** - * Use `.toBeObject` when checking if a value is an `Object`. - */ - toBeObject(): void; - - /** - * Use `.toContainKey` when checking if an object contains the provided key. - * - * @param {String} key - */ - toContainKey(key: string): void; - - /** - * Use `.toContainKeys` when checking if an object has all of the provided keys. - * - * @param {Array.<String>} keys - */ - toContainKeys(keys: string[]): void; - - /** - * Use `.toContainAllKeys` when checking if an object only contains all of the provided keys. - * - * @param {Array.<String>} keys - */ - toContainAllKeys(keys: string[]): void; - - /** - * Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys. - * - * @param {Array.<String>} keys - */ - toContainAnyKeys(keys: string[]): void; - - /** - * Use `.toContainValue` when checking if an object contains the provided value. - * - * @param {*} value - */ - toContainValue(value: any): void; - - /** - * Use `.toContainValues` when checking if an object contains all of the provided values. - * - * @param {Array.<*>} values - */ - toContainValues(values: any[]): void; - - /** - * Use `.toContainAllValues` when checking if an object only contains all of the provided values. - * - * @param {Array.<*>} values - */ - toContainAllValues(values: any[]): void; - - /** - * Use `.toContainAnyValues` when checking if an object contains at least one of the provided values. - * - * @param {Array.<*>} values - */ - toContainAnyValues(values: any[]): void; - - /** - * Use `.toContainEntry` when checking if an object contains the provided entry. - * - * @param {Array.<String, String>} entry - */ - toContainEntry(entry: [string, string]): void; - - /** - * Use `.toContainEntries` when checking if an object contains all of the provided entries. - * - * @param {Array.<Array.<String, String>>} entries - */ - toContainEntries(entries: [string, string][]): void; - - /** - * Use `.toContainAllEntries` when checking if an object only contains all of the provided entries. - * - * @param {Array.<Array.<String, String>>} entries - */ - toContainAllEntries(entries: [string, string][]): void; - - /** - * Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries. - * - * @param {Array.<Array.<String, String>>} entries - */ - toContainAnyEntries(entries: [string, string][]): void; - - /** - * Use `.toBeExtensible` when checking if an object is extensible. - */ - toBeExtensible(): void; - - /** - * Use `.toBeFrozen` when checking if an object is frozen. - */ - toBeFrozen(): void; - - /** - * Use `.toBeSealed` when checking if an object is sealed. - */ - toBeSealed(): void; - - /** - * Use `.toBeString` when checking if a value is a `String`. - */ - toBeString(): void; - - /** - * Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings. - * - * @param {String} string - */ - toEqualCaseInsensitive(string: string): void; - - /** - * Use `.toStartWith` when checking if a `String` starts with a given `String` prefix. - * - * @param {String} prefix - */ - toStartWith(prefix: string): void; - - /** - * Use `.toEndWith` when checking if a `String` ends with a given `String` suffix. - * - * @param {String} suffix - */ - toEndWith(suffix: string): void; - - /** - * Use `.toInclude` when checking if a `String` includes the given `String` substring. - * - * @param {String} substring - */ - toInclude(substring: string): void; - - /** - * Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times. - * - * @param {String} substring - * @param {Number} times - */ - toIncludeRepeated(substring: string, times: number): void; - - /** - * Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings. - * - * @param {Array.<String>} substring - */ - toIncludeMultiple(substring: string[]): void; -}; - -interface JestExpectType { - not: - & JestExpectType - & EnzymeMatchersType - & DomTestingLibraryType - & JestJQueryMatchersType - & JestStyledComponentsMatchersType - & JestExtendedMatchersType, - /** - * If you have a mock function, you can use .lastCalledWith to test what - * arguments it was last called with. - */ - lastCalledWith(...args: Array<any>): void, - /** - * toBe just checks that a value is what you expect. It uses === to check - * strict equality. - */ - toBe(value: any): void, - /** - * Use .toBeCalledWith to ensure that a mock function was called with - * specific arguments. - */ - toBeCalledWith(...args: Array<any>): void, - /** - * Using exact equality with floating point numbers is a bad idea. Rounding - * means that intuitive things fail. - */ - toBeCloseTo(num: number, delta: any): void, - /** - * Use .toBeDefined to check that a variable is not undefined. - */ - toBeDefined(): void, - /** - * Use .toBeFalsy when you don't care what a value is, you just want to - * ensure a value is false in a boolean context. - */ - toBeFalsy(): void, - /** - * To compare floating point numbers, you can use toBeGreaterThan. - */ - toBeGreaterThan(number: number): void, - /** - * To compare floating point numbers, you can use toBeGreaterThanOrEqual. - */ - toBeGreaterThanOrEqual(number: number): void, - /** - * To compare floating point numbers, you can use toBeLessThan. - */ - toBeLessThan(number: number): void, - /** - * To compare floating point numbers, you can use toBeLessThanOrEqual. - */ - toBeLessThanOrEqual(number: number): void, - /** - * Use .toBeInstanceOf(Class) to check that an object is an instance of a - * class. - */ - toBeInstanceOf(cls: Class<*>): void, - /** - * .toBeNull() is the same as .toBe(null) but the error messages are a bit - * nicer. - */ - toBeNull(): void, - /** - * Use .toBeTruthy when you don't care what a value is, you just want to - * ensure a value is true in a boolean context. - */ - toBeTruthy(): void, - /** - * Use .toBeUndefined to check that a variable is undefined. - */ - toBeUndefined(): void, - /** - * Use .toContain when you want to check that an item is in a list. For - * testing the items in the list, this uses ===, a strict equality check. - */ - toContain(item: any): void, - /** - * Use .toContainEqual when you want to check that an item is in a list. For - * testing the items in the list, this matcher recursively checks the - * equality of all fields, rather than checking for object identity. - */ - toContainEqual(item: any): void, - /** - * Use .toEqual when you want to check that two objects have the same value. - * This matcher recursively checks the equality of all fields, rather than - * checking for object identity. - */ - toEqual(value: any): void, - /** - * Use .toHaveBeenCalled to ensure that a mock function got called. - */ - toHaveBeenCalled(): void, - toBeCalled(): void; - /** - * Use .toHaveBeenCalledTimes to ensure that a mock function got called exact - * number of times. - */ - toHaveBeenCalledTimes(number: number): void, - toBeCalledTimes(number: number): void; - /** - * - */ - toHaveBeenNthCalledWith(nthCall: number, ...args: Array<any>): void; - nthCalledWith(nthCall: number, ...args: Array<any>): void; - /** - * - */ - toHaveReturned(): void; - toReturn(): void; - /** - * - */ - toHaveReturnedTimes(number: number): void; - toReturnTimes(number: number): void; - /** - * - */ - toHaveReturnedWith(value: any): void; - toReturnWith(value: any): void; - /** - * - */ - toHaveLastReturnedWith(value: any): void; - lastReturnedWith(value: any): void; - /** - * - */ - toHaveNthReturnedWith(nthCall: number, value: any): void; - nthReturnedWith(nthCall: number, value: any): void; - /** - * Use .toHaveBeenCalledWith to ensure that a mock function was called with - * specific arguments. - */ - toHaveBeenCalledWith(...args: Array<any>): void, - toBeCalledWith(...args: Array<any>): void, - /** - * Use .toHaveBeenLastCalledWith to ensure that a mock function was last called - * with specific arguments. - */ - toHaveBeenLastCalledWith(...args: Array<any>): void, - lastCalledWith(...args: Array<any>): void, - /** - * Check that an object has a .length property and it is set to a certain - * numeric value. - */ - toHaveLength(number: number): void, - /** - * - */ - toHaveProperty(propPath: string, value?: any): void, - /** - * Use .toMatch to check that a string matches a regular expression or string. - */ - toMatch(regexpOrString: RegExp | string): void, - /** - * Use .toMatchObject to check that a javascript object matches a subset of the properties of an object. - */ - toMatchObject(object: Object | Array<Object>): void, - /** - * Use .toStrictEqual to check that a javascript object matches a subset of the properties of an object. - */ - toStrictEqual(value: any): void, - /** - * This ensures that an Object matches the most recent snapshot. - */ - toMatchSnapshot(propertyMatchers?: any, name?: string): void, - /** - * This ensures that an Object matches the most recent snapshot. - */ - toMatchSnapshot(name: string): void, - - toMatchInlineSnapshot(snapshot?: string): void, - toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void, - /** - * Use .toThrow to test that a function throws when it is called. - * If you want to test that a specific error gets thrown, you can provide an - * argument to toThrow. The argument can be a string for the error message, - * a class for the error, or a regex that should match the error. - * - * Alias: .toThrowError - */ - toThrow(message?: string | Error | Class<Error> | RegExp): void, - toThrowError(message?: string | Error | Class<Error> | RegExp): void, - /** - * Use .toThrowErrorMatchingSnapshot to test that a function throws a error - * matching the most recent snapshot when it is called. - */ - toThrowErrorMatchingSnapshot(): void, - toThrowErrorMatchingInlineSnapshot(snapshot?: string): void, -} - -type JestObjectType = { - /** - * Disables automatic mocking in the module loader. - * - * After this method is called, all `require()`s will return the real - * versions of each module (rather than a mocked version). - */ - disableAutomock(): JestObjectType, - /** - * An un-hoisted version of disableAutomock - */ - autoMockOff(): JestObjectType, - /** - * Enables automatic mocking in the module loader. - */ - enableAutomock(): JestObjectType, - /** - * An un-hoisted version of enableAutomock - */ - autoMockOn(): JestObjectType, - /** - * Clears the mock.calls and mock.instances properties of all mocks. - * Equivalent to calling .mockClear() on every mocked function. - */ - clearAllMocks(): JestObjectType, - /** - * Resets the state of all mocks. Equivalent to calling .mockReset() on every - * mocked function. - */ - resetAllMocks(): JestObjectType, - /** - * Restores all mocks back to their original value. - */ - restoreAllMocks(): JestObjectType, - /** - * Removes any pending timers from the timer system. - */ - clearAllTimers(): void, - /** - * The same as `mock` but not moved to the top of the expectation by - * babel-jest. - */ - doMock(moduleName: string, moduleFactory?: any): JestObjectType, - /** - * The same as `unmock` but not moved to the top of the expectation by - * babel-jest. - */ - dontMock(moduleName: string): JestObjectType, - /** - * Returns a new, unused mock function. Optionally takes a mock - * implementation. - */ - fn<TArguments: $ReadOnlyArray<*>, TReturn>( - implementation?: (...args: TArguments) => TReturn - ): JestMockFn<TArguments, TReturn>, - /** - * Determines if the given function is a mocked function. - */ - isMockFunction(fn: Function): boolean, - /** - * Given the name of a module, use the automatic mocking system to generate a - * mocked version of the module for you. - */ - genMockFromModule(moduleName: string): any, - /** - * Mocks a module with an auto-mocked version when it is being required. - * - * The second argument can be used to specify an explicit module factory that - * is being run instead of using Jest's automocking feature. - * - * The third argument can be used to create virtual mocks -- mocks of modules - * that don't exist anywhere in the system. - */ - mock( - moduleName: string, - moduleFactory?: any, - options?: Object - ): JestObjectType, - /** - * Returns the actual module instead of a mock, bypassing all checks on - * whether the module should receive a mock implementation or not. - */ - requireActual(moduleName: string): any, - /** - * Returns a mock module instead of the actual module, bypassing all checks - * on whether the module should be required normally or not. - */ - requireMock(moduleName: string): any, - /** - * Resets the module registry - the cache of all required modules. This is - * useful to isolate modules where local state might conflict between tests. - */ - resetModules(): JestObjectType, - /** - * Exhausts the micro-task queue (usually interfaced in node via - * process.nextTick). - */ - runAllTicks(): void, - /** - * Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(), - * setInterval(), and setImmediate()). - */ - runAllTimers(): void, - /** - * Exhausts all tasks queued by setImmediate(). - */ - runAllImmediates(): void, - /** - * Executes only the macro task queue (i.e. all tasks queued by setTimeout() - * or setInterval() and setImmediate()). - */ - advanceTimersByTime(msToRun: number): void, - /** - * Executes only the macro task queue (i.e. all tasks queued by setTimeout() - * or setInterval() and setImmediate()). - * - * Renamed to `advanceTimersByTime`. - */ - runTimersToTime(msToRun: number): void, - /** - * Executes only the macro-tasks that are currently pending (i.e., only the - * tasks that have been queued by setTimeout() or setInterval() up to this - * point) - */ - runOnlyPendingTimers(): void, - /** - * Explicitly supplies the mock object that the module system should return - * for the specified module. Note: It is recommended to use jest.mock() - * instead. - */ - setMock(moduleName: string, moduleExports: any): JestObjectType, - /** - * Indicates that the module system should never return a mocked version of - * the specified module from require() (e.g. that it should always return the - * real module). - */ - unmock(moduleName: string): JestObjectType, - /** - * Instructs Jest to use fake versions of the standard timer functions - * (setTimeout, setInterval, clearTimeout, clearInterval, nextTick, - * setImmediate and clearImmediate). - */ - useFakeTimers(): JestObjectType, - /** - * Instructs Jest to use the real versions of the standard timer functions. - */ - useRealTimers(): JestObjectType, - /** - * Creates a mock function similar to jest.fn but also tracks calls to - * object[methodName]. - */ - spyOn(object: Object, methodName: string, accessType?: "get" | "set"): JestMockFn<any, any>, - /** - * Set the default timeout interval for tests and before/after hooks in milliseconds. - * Note: The default timeout interval is 5 seconds if this method is not called. - */ - setTimeout(timeout: number): JestObjectType -}; - -type JestSpyType = { - calls: JestCallsType -}; - -/** Runs this function after every test inside this context */ -declare function afterEach( - fn: (done: () => void) => ?Promise<mixed>, - timeout?: number -): void; -/** Runs this function before every test inside this context */ -declare function beforeEach( - fn: (done: () => void) => ?Promise<mixed>, - timeout?: number -): void; -/** Runs this function after all tests have finished inside this context */ -declare function afterAll( - fn: (done: () => void) => ?Promise<mixed>, - timeout?: number -): void; -/** Runs this function before any tests have started inside this context */ -declare function beforeAll( - fn: (done: () => void) => ?Promise<mixed>, - timeout?: number -): void; - -/** A context for grouping tests together */ -declare var describe: { - /** - * Creates a block that groups together several related tests in one "test suite" - */ - (name: JestTestName, fn: () => void): void, - - /** - * Only run this describe block - */ - only(name: JestTestName, fn: () => void): void, - - /** - * Skip running this describe block - */ - skip(name: JestTestName, fn: () => void): void, - - /** - * each runs this test against array of argument arrays per each run - * - * @param {table} table of Test - */ - each( - ...table: Array<Array<mixed> | mixed> | [Array<string>, string] - ): ( - name: JestTestName, - fn?: (...args: Array<any>) => ?Promise<mixed>, - timeout?: number - ) => void, -}; - -/** An individual test unit */ -declare var it: { - /** - * An individual test unit - * - * @param {JestTestName} Name of Test - * @param {Function} Test - * @param {number} Timeout for the test, in milliseconds. - */ - ( - name: JestTestName, - fn?: (done: () => void) => ?Promise<mixed>, - timeout?: number - ): void, - - /** - * Only run this test - * - * @param {JestTestName} Name of Test - * @param {Function} Test - * @param {number} Timeout for the test, in milliseconds. - */ - only( - name: JestTestName, - fn?: (done: () => void) => ?Promise<mixed>, - timeout?: number - ): { - each( - ...table: Array<Array<mixed> | mixed> | [Array<string>, string] - ): ( - name: JestTestName, - fn?: (...args: Array<any>) => ?Promise<mixed>, - timeout?: number - ) => void, - }, - - /** - * Skip running this test - * - * @param {JestTestName} Name of Test - * @param {Function} Test - * @param {number} Timeout for the test, in milliseconds. - */ - skip( - name: JestTestName, - fn?: (done: () => void) => ?Promise<mixed>, - timeout?: number - ): void, - - /** - * Run the test concurrently - * - * @param {JestTestName} Name of Test - * @param {Function} Test - * @param {number} Timeout for the test, in milliseconds. - */ - concurrent( - name: JestTestName, - fn?: (done: () => void) => ?Promise<mixed>, - timeout?: number - ): void, - - /** - * each runs this test against array of argument arrays per each run - * - * @param {table} table of Test - */ - each( - ...table: Array<Array<mixed> | mixed> | [Array<string>, string] - ): ( - name: JestTestName, - fn?: (...args: Array<any>) => ?Promise<mixed>, - timeout?: number - ) => void, -}; - -declare function fit( - name: JestTestName, - fn: (done: () => void) => ?Promise<mixed>, - timeout?: number -): void; -/** An individual test unit */ -declare var test: typeof it; -/** A disabled group of tests */ -declare var xdescribe: typeof describe; -/** A focused group of tests */ -declare var fdescribe: typeof describe; -/** A disabled individual test */ -declare var xit: typeof it; -/** A disabled individual test */ -declare var xtest: typeof it; - -type JestPrettyFormatColors = { - comment: { close: string, open: string }, - content: { close: string, open: string }, - prop: { close: string, open: string }, - tag: { close: string, open: string }, - value: { close: string, open: string }, -}; - -type JestPrettyFormatIndent = string => string; -type JestPrettyFormatRefs = Array<any>; -type JestPrettyFormatPrint = any => string; -type JestPrettyFormatStringOrNull = string | null; - -type JestPrettyFormatOptions = {| - callToJSON: boolean, - edgeSpacing: string, - escapeRegex: boolean, - highlight: boolean, - indent: number, - maxDepth: number, - min: boolean, - plugins: JestPrettyFormatPlugins, - printFunctionName: boolean, - spacing: string, - theme: {| - comment: string, - content: string, - prop: string, - tag: string, - value: string, - |}, -|}; - -type JestPrettyFormatPlugin = { - print: ( - val: any, - serialize: JestPrettyFormatPrint, - indent: JestPrettyFormatIndent, - opts: JestPrettyFormatOptions, - colors: JestPrettyFormatColors, - ) => string, - test: any => boolean, -}; - -type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>; - -/** The expect function is used every time you want to test a value */ -declare var expect: { - /** The object that you want to make assertions against */ - (value: any): - & JestExpectType - & JestPromiseType - & EnzymeMatchersType - & DomTestingLibraryType - & JestJQueryMatchersType - & JestStyledComponentsMatchersType - & JestExtendedMatchersType, - - /** Add additional Jasmine matchers to Jest's roster */ - extend(matchers: { [name: string]: JestMatcher }): void, - /** Add a module that formats application-specific data structures. */ - addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void, - assertions(expectedAssertions: number): void, - hasAssertions(): void, - any(value: mixed): JestAsymmetricEqualityType, - anything(): any, - arrayContaining(value: Array<mixed>): Array<mixed>, - objectContaining(value: Object): Object, - /** Matches any received string that contains the exact expected string. */ - stringContaining(value: string): string, - stringMatching(value: string | RegExp): string, - not: { - arrayContaining: (value: $ReadOnlyArray<mixed>) => Array<mixed>, - objectContaining: (value: {}) => Object, - stringContaining: (value: string) => string, - stringMatching: (value: string | RegExp) => string, - }, -}; - -// TODO handle return type -// http://jasmine.github.io/2.4/introduction.html#section-Spies -declare function spyOn(value: mixed, method: string): Object; - -/** Holds all functions related to manipulating test runner */ -declare var jest: JestObjectType; - -/** - * The global Jasmine object, this is generally not exposed as the public API, - * using features inside here could break in later versions of Jest. - */ -declare var jasmine: { - DEFAULT_TIMEOUT_INTERVAL: number, - any(value: mixed): JestAsymmetricEqualityType, - anything(): any, - arrayContaining(value: Array<mixed>): Array<mixed>, - clock(): JestClockType, - createSpy(name: string): JestSpyType, - createSpyObj( - baseName: string, - methodNames: Array<string> - ): { [methodName: string]: JestSpyType }, - objectContaining(value: Object): Object, - stringMatching(value: string): string -}; diff --git a/flow-typed/npm/localforage_vx.x.x.js b/flow-typed/npm/localforage_vx.x.x.js deleted file mode 100644 index 701d7be7..00000000 --- a/flow-typed/npm/localforage_vx.x.x.js +++ /dev/null @@ -1,326 +0,0 @@ -// flow-typed signature: 0126e88adc2d4caaacf08afe9d3a8752 -// flow-typed version: <<STUB>>/localforage_v1.5/flow_v0.48.0 - -/** - * This is an autogenerated libdef stub for: - * - * 'localforage' - * - * 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 'localforage' { - 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 'localforage/dist/localforage' { - declare module.exports: any; -} - -declare module 'localforage/dist/localforage.min' { - declare module.exports: any; -} - -declare module 'localforage/dist/localforage.nopromises' { - declare module.exports: any; -} - -declare module 'localforage/dist/localforage.nopromises.min' { - declare module.exports: any; -} - -declare module 'localforage/docs/localforage.min' { - declare module.exports: any; -} - -declare module 'localforage/docs/scripts/flatdoc' { - declare module.exports: any; -} - -declare module 'localforage/docs/scripts/jquery.min' { - declare module.exports: any; -} - -declare module 'localforage/docs/scripts/legacy' { - declare module.exports: any; -} - -declare module 'localforage/docs/theme/script' { - declare module.exports: any; -} - -declare module 'localforage/examples/main' { - declare module.exports: any; -} - -declare module 'localforage/examples/require' { - declare module.exports: any; -} - -declare module 'localforage/Gruntfile' { - declare module.exports: any; -} - -declare module 'localforage/src/drivers/indexeddb' { - declare module.exports: any; -} - -declare module 'localforage/src/drivers/localstorage' { - declare module.exports: any; -} - -declare module 'localforage/src/drivers/websql' { - declare module.exports: any; -} - -declare module 'localforage/src/localforage' { - declare module.exports: any; -} - -declare module 'localforage/src/utils/createBlob' { - declare module.exports: any; -} - -declare module 'localforage/src/utils/executeCallback' { - declare module.exports: any; -} - -declare module 'localforage/src/utils/executeTwoCallbacks' { - declare module.exports: any; -} - -declare module 'localforage/src/utils/idb' { - declare module.exports: any; -} - -declare module 'localforage/src/utils/isIndexedDBValid' { - declare module.exports: any; -} - -declare module 'localforage/src/utils/isLocalStorageValid' { - declare module.exports: any; -} - -declare module 'localforage/src/utils/isWebSQLValid' { - declare module.exports: any; -} - -declare module 'localforage/src/utils/promise' { - declare module.exports: any; -} - -declare module 'localforage/src/utils/serializer' { - declare module.exports: any; -} - -declare module 'localforage/test/dummyStorageDriver' { - declare module.exports: any; -} - -declare module 'localforage/test/runner.browserify' { - declare module.exports: any; -} - -declare module 'localforage/test/runner' { - declare module.exports: any; -} - -declare module 'localforage/test/runner.webpack' { - declare module.exports: any; -} - -declare module 'localforage/test/saucelabs-browsers' { - declare module.exports: any; -} - -declare module 'localforage/test/serviceworker-client' { - declare module.exports: any; -} - -declare module 'localforage/test/test.api' { - declare module.exports: any; -} - -declare module 'localforage/test/test.callwhenready' { - declare module.exports: any; -} - -declare module 'localforage/test/test.config' { - declare module.exports: any; -} - -declare module 'localforage/test/test.customdriver' { - declare module.exports: any; -} - -declare module 'localforage/test/test.datatypes' { - declare module.exports: any; -} - -declare module 'localforage/test/test.drivers' { - declare module.exports: any; -} - -declare module 'localforage/test/test.faultydriver' { - declare module.exports: any; -} - -declare module 'localforage/test/test.iframes' { - declare module.exports: any; -} - -declare module 'localforage/test/test.nodriver' { - declare module.exports: any; -} - -declare module 'localforage/test/test.serviceworkers' { - declare module.exports: any; -} - -declare module 'localforage/test/test.webworkers' { - declare module.exports: any; -} - -declare module 'localforage/test/webworker-client' { - declare module.exports: any; -} - -// Filename aliases -declare module 'localforage/dist/localforage.js' { - declare module.exports: $Exports<'localforage/dist/localforage'>; -} -declare module 'localforage/dist/localforage.min.js' { - declare module.exports: $Exports<'localforage/dist/localforage.min'>; -} -declare module 'localforage/dist/localforage.nopromises.js' { - declare module.exports: $Exports<'localforage/dist/localforage.nopromises'>; -} -declare module 'localforage/dist/localforage.nopromises.min.js' { - declare module.exports: $Exports<'localforage/dist/localforage.nopromises.min'>; -} -declare module 'localforage/docs/localforage.min.js' { - declare module.exports: $Exports<'localforage/docs/localforage.min'>; -} -declare module 'localforage/docs/scripts/flatdoc.js' { - declare module.exports: $Exports<'localforage/docs/scripts/flatdoc'>; -} -declare module 'localforage/docs/scripts/jquery.min.js' { - declare module.exports: $Exports<'localforage/docs/scripts/jquery.min'>; -} -declare module 'localforage/docs/scripts/legacy.js' { - declare module.exports: $Exports<'localforage/docs/scripts/legacy'>; -} -declare module 'localforage/docs/theme/script.js' { - declare module.exports: $Exports<'localforage/docs/theme/script'>; -} -declare module 'localforage/examples/main.js' { - declare module.exports: $Exports<'localforage/examples/main'>; -} -declare module 'localforage/examples/require.js' { - declare module.exports: $Exports<'localforage/examples/require'>; -} -declare module 'localforage/Gruntfile.js' { - declare module.exports: $Exports<'localforage/Gruntfile'>; -} -declare module 'localforage/src/drivers/indexeddb.js' { - declare module.exports: $Exports<'localforage/src/drivers/indexeddb'>; -} -declare module 'localforage/src/drivers/localstorage.js' { - declare module.exports: $Exports<'localforage/src/drivers/localstorage'>; -} -declare module 'localforage/src/drivers/websql.js' { - declare module.exports: $Exports<'localforage/src/drivers/websql'>; -} -declare module 'localforage/src/localforage.js' { - declare module.exports: $Exports<'localforage/src/localforage'>; -} -declare module 'localforage/src/utils/createBlob.js' { - declare module.exports: $Exports<'localforage/src/utils/createBlob'>; -} -declare module 'localforage/src/utils/executeCallback.js' { - declare module.exports: $Exports<'localforage/src/utils/executeCallback'>; -} -declare module 'localforage/src/utils/executeTwoCallbacks.js' { - declare module.exports: $Exports<'localforage/src/utils/executeTwoCallbacks'>; -} -declare module 'localforage/src/utils/idb.js' { - declare module.exports: $Exports<'localforage/src/utils/idb'>; -} -declare module 'localforage/src/utils/isIndexedDBValid.js' { - declare module.exports: $Exports<'localforage/src/utils/isIndexedDBValid'>; -} -declare module 'localforage/src/utils/isLocalStorageValid.js' { - declare module.exports: $Exports<'localforage/src/utils/isLocalStorageValid'>; -} -declare module 'localforage/src/utils/isWebSQLValid.js' { - declare module.exports: $Exports<'localforage/src/utils/isWebSQLValid'>; -} -declare module 'localforage/src/utils/promise.js' { - declare module.exports: $Exports<'localforage/src/utils/promise'>; -} -declare module 'localforage/src/utils/serializer.js' { - declare module.exports: $Exports<'localforage/src/utils/serializer'>; -} -declare module 'localforage/test/dummyStorageDriver.js' { - declare module.exports: $Exports<'localforage/test/dummyStorageDriver'>; -} -declare module 'localforage/test/runner.browserify.js' { - declare module.exports: $Exports<'localforage/test/runner.browserify'>; -} -declare module 'localforage/test/runner.js' { - declare module.exports: $Exports<'localforage/test/runner'>; -} -declare module 'localforage/test/runner.webpack.js' { - declare module.exports: $Exports<'localforage/test/runner.webpack'>; -} -declare module 'localforage/test/saucelabs-browsers.js' { - declare module.exports: $Exports<'localforage/test/saucelabs-browsers'>; -} -declare module 'localforage/test/serviceworker-client.js' { - declare module.exports: $Exports<'localforage/test/serviceworker-client'>; -} -declare module 'localforage/test/test.api.js' { - declare module.exports: $Exports<'localforage/test/test.api'>; -} -declare module 'localforage/test/test.callwhenready.js' { - declare module.exports: $Exports<'localforage/test/test.callwhenready'>; -} -declare module 'localforage/test/test.config.js' { - declare module.exports: $Exports<'localforage/test/test.config'>; -} -declare module 'localforage/test/test.customdriver.js' { - declare module.exports: $Exports<'localforage/test/test.customdriver'>; -} -declare module 'localforage/test/test.datatypes.js' { - declare module.exports: $Exports<'localforage/test/test.datatypes'>; -} -declare module 'localforage/test/test.drivers.js' { - declare module.exports: $Exports<'localforage/test/test.drivers'>; -} -declare module 'localforage/test/test.faultydriver.js' { - declare module.exports: $Exports<'localforage/test/test.faultydriver'>; -} -declare module 'localforage/test/test.iframes.js' { - declare module.exports: $Exports<'localforage/test/test.iframes'>; -} -declare module 'localforage/test/test.nodriver.js' { - declare module.exports: $Exports<'localforage/test/test.nodriver'>; -} -declare module 'localforage/test/test.serviceworkers.js' { - declare module.exports: $Exports<'localforage/test/test.serviceworkers'>; -} -declare module 'localforage/test/test.webworkers.js' { - declare module.exports: $Exports<'localforage/test/test.webworkers'>; -} -declare module 'localforage/test/webworker-client.js' { - declare module.exports: $Exports<'localforage/test/webworker-client'>; -} diff --git a/flow-typed/npm/lodash_v4.x.x.js b/flow-typed/npm/lodash_v4.x.x.js deleted file mode 100644 index 09867662..00000000 --- a/flow-typed/npm/lodash_v4.x.x.js +++ /dev/null @@ -1,4231 +0,0 @@ -// flow-typed signature: da0eb44f640070ecdc5e5096791195f3 -// flow-typed version: 729ca94104/lodash_v4.x.x/flow_>=v0.55.x - -declare module "lodash" { - declare type __CurriedFunction1<A, R, AA: A> = (...r: [AA]) => R; - declare type CurriedFunction1<A, R> = __CurriedFunction1<A, R, *>; - - declare type __CurriedFunction2<A, B, R, AA: A, BB: B> = (( - ...r: [AA] - ) => CurriedFunction1<BB, R>) & - ((...r: [AA, BB]) => R); - declare type CurriedFunction2<A, B, R> = __CurriedFunction2<A, B, R, *, *>; - - declare type __CurriedFunction3<A, B, C, R, AA: A, BB: B, CC: C> = (( - ...r: [AA] - ) => CurriedFunction2<BB, CC, R>) & - ((...r: [AA, BB]) => CurriedFunction1<CC, R>) & - ((...r: [AA, BB, CC]) => R); - declare type CurriedFunction3<A, B, C, R> = __CurriedFunction3< - A, - B, - C, - R, - *, - *, - * - >; - - declare type __CurriedFunction4< - A, - B, - C, - D, - R, - AA: A, - BB: B, - CC: C, - DD: D - > = ((...r: [AA]) => CurriedFunction3<BB, CC, DD, R>) & - ((...r: [AA, BB]) => CurriedFunction2<CC, DD, R>) & - ((...r: [AA, BB, CC]) => CurriedFunction1<DD, R>) & - ((...r: [AA, BB, CC, DD]) => R); - declare type CurriedFunction4<A, B, C, D, R> = __CurriedFunction4< - A, - B, - C, - D, - R, - *, - *, - *, - * - >; - - declare type __CurriedFunction5< - A, - B, - C, - D, - E, - R, - AA: A, - BB: B, - CC: C, - DD: D, - EE: E - > = ((...r: [AA]) => CurriedFunction4<BB, CC, DD, EE, R>) & - ((...r: [AA, BB]) => CurriedFunction3<CC, DD, EE, R>) & - ((...r: [AA, BB, CC]) => CurriedFunction2<DD, EE, R>) & - ((...r: [AA, BB, CC, DD]) => CurriedFunction1<EE, R>) & - ((...r: [AA, BB, CC, DD, EE]) => R); - declare type CurriedFunction5<A, B, C, D, E, R> = __CurriedFunction5< - A, - B, - C, - D, - E, - R, - *, - *, - *, - *, - * - >; - - declare type __CurriedFunction6< - A, - B, - C, - D, - E, - F, - R, - AA: A, - BB: B, - CC: C, - DD: D, - EE: E, - FF: F - > = ((...r: [AA]) => CurriedFunction5<BB, CC, DD, EE, FF, R>) & - ((...r: [AA, BB]) => CurriedFunction4<CC, DD, EE, FF, R>) & - ((...r: [AA, BB, CC]) => CurriedFunction3<DD, EE, FF, R>) & - ((...r: [AA, BB, CC, DD]) => CurriedFunction2<EE, FF, R>) & - ((...r: [AA, BB, CC, DD, EE]) => CurriedFunction1<FF, R>) & - ((...r: [AA, BB, CC, DD, EE, FF]) => R); - declare type CurriedFunction6<A, B, C, D, E, F, R> = __CurriedFunction6< - A, - B, - C, - D, - E, - F, - R, - *, - *, - *, - *, - *, - * - >; - - declare type Curry = (<A, R>((...r: [A]) => R) => CurriedFunction1<A, R>) & - (<A, B, R>((...r: [A, B]) => R) => CurriedFunction2<A, B, R>) & - (<A, B, C, R>((...r: [A, B, C]) => R) => CurriedFunction3<A, B, C, R>) & - (<A, B, C, D, R>( - (...r: [A, B, C, D]) => R - ) => CurriedFunction4<A, B, C, D, R>) & - (<A, B, C, D, E, R>( - (...r: [A, B, C, D, E]) => R - ) => CurriedFunction5<A, B, C, D, E, R>) & - (<A, B, C, D, E, F, R>( - (...r: [A, B, C, D, E, F]) => R - ) => CurriedFunction6<A, B, C, D, E, F, R>); - - declare type UnaryFn<A, R> = (a: A) => R; - - declare type TemplateSettings = { - escape?: RegExp, - evaluate?: RegExp, - imports?: Object, - interpolate?: RegExp, - variable?: string - }; - - declare type TruncateOptions = { - length?: number, - omission?: string, - separator?: RegExp | string - }; - - declare type DebounceOptions = { - leading?: boolean, - maxWait?: number, - trailing?: boolean - }; - - declare type ThrottleOptions = { - leading?: boolean, - trailing?: boolean - }; - - declare type NestedArray<T> = Array<Array<T>>; - - declare type matchesIterateeShorthand = Object; - declare type matchesPropertyIterateeShorthand = [string, any]; - declare type propertyIterateeShorthand = string; - - declare type OPredicate<A, O> = - | ((value: A, key: string, object: O) => any) - | matchesIterateeShorthand - | matchesPropertyIterateeShorthand - | propertyIterateeShorthand; - - declare type OIterateeWithResult<V, O, R> = - | Object - | string - | ((value: V, key: string, object: O) => R); - declare type OIteratee<O> = OIterateeWithResult<any, O, any>; - declare type OFlatMapIteratee<T, U> = OIterateeWithResult<any, T, Array<U>>; - - declare type Predicate<T> = - | ((value: T, index: number, array: Array<T>) => any) - | matchesIterateeShorthand - | matchesPropertyIterateeShorthand - | propertyIterateeShorthand; - - declare type _ValueOnlyIteratee<T> = (value: T) => mixed; - declare type ValueOnlyIteratee<T> = _ValueOnlyIteratee<T> | string; - declare type _Iteratee<T> = ( - item: T, - index: number, - array: ?Array<T> - ) => mixed; - declare type Iteratee<T> = _Iteratee<T> | Object | string; - declare type FlatMapIteratee<T, U> = - | ((item: T, index: number, array: ?Array<T>) => Array<U>) - | Object - | string; - declare type Comparator<T> = (item: T, item2: T) => boolean; - - declare type MapIterator<T, U> = - | ((item: T, index: number, array: Array<T>) => U) - | propertyIterateeShorthand; - - declare type ReadOnlyMapIterator<T, U> = - | ((item: T, index: number, array: $ReadOnlyArray<T>) => U) - | propertyIterateeShorthand; - - declare type OMapIterator<T, O, U> = - | ((item: T, key: string, object: O) => U) - | propertyIterateeShorthand; - - declare class Lodash { - // Array - chunk<T>(array: ?Array<T>, size?: number): Array<Array<T>>; - compact<T, N: ?T>(array: Array<N>): Array<T>; - concat<T>(base: Array<T>, ...elements: Array<any>): Array<T | any>; - difference<T>(array: ?Array<T>, values?: Array<T>): Array<T>; - differenceBy<T>( - array: ?Array<T>, - values: Array<T>, - iteratee: ValueOnlyIteratee<T> - ): T[]; - differenceWith<T>(array: T[], values: T[], comparator?: Comparator<T>): T[]; - drop<T>(array: ?Array<T>, n?: number): Array<T>; - dropRight<T>(array: ?Array<T>, n?: number): Array<T>; - dropRightWhile<T>(array: ?Array<T>, predicate?: Predicate<T>): Array<T>; - dropWhile<T>(array: ?Array<T>, predicate?: Predicate<T>): Array<T>; - fill<T, U>( - array: ?Array<T>, - value: U, - start?: number, - end?: number - ): Array<T | U>; - findIndex<T>( - array: ?$ReadOnlyArray<T>, - predicate?: Predicate<T>, - fromIndex?: number - ): number; - findLastIndex<T>( - array: ?$ReadOnlyArray<T>, - predicate?: Predicate<T>, - fromIndex?: number - ): number; - // alias of _.head - first<T>(array: ?Array<T>): T; - flatten<T, X>(array: Array<Array<T> | X>): Array<T | X>; - flattenDeep<T>(array: any[]): Array<T>; - flattenDepth(array: any[], depth?: number): any[]; - fromPairs<A, B>(pairs: Array<[A, B]>): { [key: A]: B }; - head<T>(array: ?Array<T>): T; - indexOf<T>(array: ?Array<T>, value: T, fromIndex?: number): number; - initial<T>(array: ?Array<T>): Array<T>; - intersection<T>(...arrays: Array<Array<T>>): Array<T>; - //Workaround until (...parameter: T, parameter2: U) works - intersectionBy<T>(a1: Array<T>, iteratee?: ValueOnlyIteratee<T>): Array<T>; - intersectionBy<T>( - a1: Array<T>, - a2: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - intersectionBy<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - intersectionBy<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - a4: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - //Workaround until (...parameter: T, parameter2: U) works - intersectionWith<T>(a1: Array<T>, comparator: Comparator<T>): Array<T>; - intersectionWith<T>( - a1: Array<T>, - a2: Array<T>, - comparator: Comparator<T> - ): Array<T>; - intersectionWith<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - comparator: Comparator<T> - ): Array<T>; - intersectionWith<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - a4: Array<T>, - comparator: Comparator<T> - ): Array<T>; - join<T>(array: ?Array<T>, separator?: string): string; - last<T>(array: ?Array<T>): T; - lastIndexOf<T>(array: ?Array<T>, value: T, fromIndex?: number): number; - nth<T>(array: T[], n?: number): T; - pull<T>(array: ?Array<T>, ...values?: Array<T>): Array<T>; - pullAll<T>(array: ?Array<T>, values: Array<T>): Array<T>; - pullAllBy<T>( - array: ?Array<T>, - values: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - pullAllWith<T>(array?: T[], values: T[], comparator?: Function): T[]; - pullAt<T>(array: ?Array<T>, ...indexed?: Array<number>): Array<T>; - pullAt<T>(array: ?Array<T>, indexed?: Array<number>): Array<T>; - remove<T>(array: ?Array<T>, predicate?: Predicate<T>): Array<T>; - reverse<T>(array: ?Array<T>): Array<T>; - slice<T>(array: ?Array<T>, start?: number, end?: number): Array<T>; - sortedIndex<T>(array: ?Array<T>, value: T): number; - sortedIndexBy<T>( - array: ?Array<T>, - value: T, - iteratee?: ValueOnlyIteratee<T> - ): number; - sortedIndexOf<T>(array: ?Array<T>, value: T): number; - sortedLastIndex<T>(array: ?Array<T>, value: T): number; - sortedLastIndexBy<T>( - array: ?Array<T>, - value: T, - iteratee?: ValueOnlyIteratee<T> - ): number; - sortedLastIndexOf<T>(array: ?Array<T>, value: T): number; - sortedUniq<T>(array: ?Array<T>): Array<T>; - sortedUniqBy<T>(array: ?Array<T>, iteratee?: (value: T) => mixed): Array<T>; - tail<T>(array: ?Array<T>): Array<T>; - take<T>(array: ?Array<T>, n?: number): Array<T>; - takeRight<T>(array: ?Array<T>, n?: number): Array<T>; - takeRightWhile<T>(array: ?Array<T>, predicate?: Predicate<T>): Array<T>; - takeWhile<T>(array: ?Array<T>, predicate?: Predicate<T>): Array<T>; - union<T>(...arrays?: Array<Array<T>>): Array<T>; - //Workaround until (...parameter: T, parameter2: U) works - unionBy<T>(a1: Array<T>, iteratee?: ValueOnlyIteratee<T>): Array<T>; - unionBy<T>( - a1: Array<T>, - a2: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - unionBy<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - unionBy<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - a4: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - //Workaround until (...parameter: T, parameter2: U) works - unionWith<T>(a1: Array<T>, comparator?: Comparator<T>): Array<T>; - unionWith<T>( - a1: Array<T>, - a2: Array<T>, - comparator?: Comparator<T> - ): Array<T>; - unionWith<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - comparator?: Comparator<T> - ): Array<T>; - unionWith<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - a4: Array<T>, - comparator?: Comparator<T> - ): Array<T>; - uniq<T>(array: ?Array<T>): Array<T>; - uniqBy<T>(array: ?Array<T>, iteratee?: ValueOnlyIteratee<T>): Array<T>; - uniqWith<T>(array: ?Array<T>, comparator?: Comparator<T>): Array<T>; - unzip<T>(array: ?Array<T>): Array<T>; - unzipWith<T>(array: ?Array<T>, iteratee?: Iteratee<T>): Array<T>; - without<T>(array: ?Array<T>, ...values?: Array<T>): Array<T>; - xor<T>(...array: Array<Array<T>>): Array<T>; - //Workaround until (...parameter: T, parameter2: U) works - xorBy<T>(a1: Array<T>, iteratee?: ValueOnlyIteratee<T>): Array<T>; - xorBy<T>( - a1: Array<T>, - a2: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - xorBy<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - xorBy<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - a4: Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): Array<T>; - //Workaround until (...parameter: T, parameter2: U) works - xorWith<T>(a1: Array<T>, comparator?: Comparator<T>): Array<T>; - xorWith<T>( - a1: Array<T>, - a2: Array<T>, - comparator?: Comparator<T> - ): Array<T>; - xorWith<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - comparator?: Comparator<T> - ): Array<T>; - xorWith<T>( - a1: Array<T>, - a2: Array<T>, - a3: Array<T>, - a4: Array<T>, - comparator?: Comparator<T> - ): Array<T>; - zip<A, B>(a1: A[], a2: B[]): Array<[A, B]>; - zip<A, B, C>(a1: A[], a2: B[], a3: C[]): Array<[A, B, C]>; - zip<A, B, C, D>(a1: A[], a2: B[], a3: C[], a4: D[]): Array<[A, B, C, D]>; - zip<A, B, C, D, E>( - a1: A[], - a2: B[], - a3: C[], - a4: D[], - a5: E[] - ): Array<[A, B, C, D, E]>; - - zipObject<K, V>(props?: Array<K>, values?: Array<V>): { [key: K]: V }; - zipObjectDeep(props?: any[], values?: any): Object; - - zipWith<A>(a1: Array<A>): Array<[A]>; - zipWith<T, A>(a1: Array<A>, iteratee: (A) => T): Array<T>; - - zipWith<A, B>(a1: Array<A>, a2: Array<B>): Array<[A, B]>; - zipWith<T, A, B>( - a1: Array<A>, - a2: Array<B>, - iteratee: (A, B) => T - ): Array<T>; - - zipWith<A, B, C>( - a1: Array<A>, - a2: Array<B>, - a3: Array<C> - ): Array<[A, B, C]>; - zipWith<T, A, B, C>( - a1: Array<A>, - a2: Array<B>, - a3: Array<C>, - iteratee: (A, B, C) => T - ): Array<T>; - - zipWith<A, B, C, D>( - a1: Array<A>, - a2: Array<B>, - a3: Array<C>, - a4: Array<D> - ): Array<[A, B, C, D]>; - zipWith<T, A, B, C, D>( - a1: Array<A>, - a2: Array<B>, - a3: Array<C>, - a4: Array<D>, - iteratee: (A, B, C, D) => T - ): Array<T>; - - // Collection - countBy<T>(array: ?Array<T>, iteratee?: ValueOnlyIteratee<T>): Object; - countBy<T: Object>(object: T, iteratee?: ValueOnlyIteratee<T>): Object; - // alias of _.forEach - each<T>(array: ?Array<T>, iteratee?: Iteratee<T>): Array<T>; - each<T: Object>(object: T, iteratee?: OIteratee<T>): T; - // alias of _.forEachRight - eachRight<T>(array: ?Array<T>, iteratee?: Iteratee<T>): Array<T>; - eachRight<T: Object>(object: T, iteratee?: OIteratee<T>): T; - every<T>(array: ?Array<T>, iteratee?: Iteratee<T>): boolean; - every<T: Object>(object: T, iteratee?: OIteratee<T>): boolean; - filter<T>(array: ?Array<T>, predicate?: Predicate<T>): Array<T>; - filter<A, T: { [id: string]: A }>( - object: T, - predicate?: OPredicate<A, T> - ): Array<A>; - find<T>( - array: ?$ReadOnlyArray<T>, - predicate?: Predicate<T>, - fromIndex?: number - ): T | void; - find<V, A, T: { [id: string]: A }>( - object: T, - predicate?: OPredicate<A, T>, - fromIndex?: number - ): V; - findLast<T>( - array: ?$ReadOnlyArray<T>, - predicate?: Predicate<T>, - fromIndex?: number - ): T | void; - findLast<V, A, T: { [id: string]: A }>( - object: T, - predicate?: OPredicate<A, T> - ): V; - flatMap<T, U>(array: ?Array<T>, iteratee?: FlatMapIteratee<T, U>): Array<U>; - flatMap<T: Object, U>( - object: T, - iteratee?: OFlatMapIteratee<T, U> - ): Array<U>; - flatMapDeep<T, U>( - array: ?Array<T>, - iteratee?: FlatMapIteratee<T, U> - ): Array<U>; - flatMapDeep<T: Object, U>( - object: T, - iteratee?: OFlatMapIteratee<T, U> - ): Array<U>; - flatMapDepth<T, U>( - array: ?Array<T>, - iteratee?: FlatMapIteratee<T, U>, - depth?: number - ): Array<U>; - flatMapDepth<T: Object, U>( - object: T, - iteratee?: OFlatMapIteratee<T, U>, - depth?: number - ): Array<U>; - forEach<T>(array: ?Array<T>, iteratee?: Iteratee<T>): Array<T>; - forEach<T: Object>(object: T, iteratee?: OIteratee<T>): T; - forEachRight<T>(array: ?Array<T>, iteratee?: Iteratee<T>): Array<T>; - forEachRight<T: Object>(object: T, iteratee?: OIteratee<T>): T; - groupBy<V, T>( - array: ?Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): { [key: V]: Array<T> }; - groupBy<V, A, T: { [id: string]: A }>( - object: T, - iteratee?: ValueOnlyIteratee<A> - ): { [key: V]: Array<A> }; - includes<T>(array: ?Array<T>, value: T, fromIndex?: number): boolean; - includes<T: Object>(object: T, value: any, fromIndex?: number): boolean; - includes(str: string, value: string, fromIndex?: number): boolean; - invokeMap<T>( - array: ?Array<T>, - path: ((value: T) => Array<string> | string) | Array<string> | string, - ...args?: Array<any> - ): Array<any>; - invokeMap<T: Object>( - object: T, - path: ((value: any) => Array<string> | string) | Array<string> | string, - ...args?: Array<any> - ): Array<any>; - keyBy<T, V>( - array: ?Array<T>, - iteratee?: ValueOnlyIteratee<T> - ): { [key: V]: ?T }; - keyBy<V, A, I, T: { [id: I]: A }>( - object: T, - iteratee?: ValueOnlyIteratee<A> - ): { [key: V]: ?A }; - map<T, U>(array: ?Array<T>, iteratee?: MapIterator<T, U>): Array<U>; - map<T, U>( - array: ?$ReadOnlyArray<T>, - iteratee?: ReadOnlyMapIterator<T, U> - ): Array<U>, - map<V, T: Object, U>( - object: ?T, - iteratee?: OMapIterator<V, T, U> - ): Array<U>; - map( - str: ?string, - iteratee?: (char: string, index: number, str: string) => any - ): string; - orderBy<T>( - array: ?Array<T>, - iteratees?: Array<Iteratee<T>> | string, - orders?: Array<"asc" | "desc"> | string - ): Array<T>; - orderBy<V, T: Object>( - object: T, - iteratees?: Array<OIteratee<*>> | string, - orders?: Array<"asc" | "desc"> | string - ): Array<V>; - partition<T>( - array: ?Array<T>, - predicate?: Predicate<T> - ): [Array<T>, Array<T>]; - partition<V, A, T: { [id: string]: A }>( - object: T, - predicate?: OPredicate<A, T> - ): [Array<V>, Array<V>]; - reduce<T, U>( - array: ?Array<T>, - iteratee?: ( - accumulator: U, - value: T, - index: number, - array: ?Array<T> - ) => U, - accumulator?: U - ): U; - reduce<T: Object, U>( - object: T, - iteratee?: (accumulator: U, value: any, key: string, object: T) => U, - accumulator?: U - ): U; - reduceRight<T, U>( - array: ?Array<T>, - iteratee?: ( - accumulator: U, - value: T, - index: number, - array: ?Array<T> - ) => U, - accumulator?: U - ): U; - reduceRight<T: Object, U>( - object: T, - iteratee?: (accumulator: U, value: any, key: string, object: T) => U, - accumulator?: U - ): U; - reject<T>(array: ?Array<T>, predicate?: Predicate<T>): Array<T>; - reject<V: Object, A, T: { [id: string]: A }>( - object: T, - predicate?: OPredicate<A, T> - ): Array<V>; - sample<T>(array: ?Array<T>): T; - sample<V, T: Object>(object: T): V; - sampleSize<T>(array: ?Array<T>, n?: number): Array<T>; - sampleSize<V, T: Object>(object: T, n?: number): Array<V>; - shuffle<T>(array: ?Array<T>): Array<T>; - shuffle<V, T: Object>(object: T): Array<V>; - size(collection: Array<any> | Object): number; - some<T>(array: ?Array<T>, predicate?: Predicate<T>): boolean; - some<A, T: { [id: string]: A }>( - object?: ?T, - predicate?: OPredicate<A, T> - ): boolean; - sortBy<T>(array: ?Array<T>, ...iteratees?: Array<Iteratee<T>>): Array<T>; - sortBy<T>(array: ?Array<T>, iteratees?: Array<Iteratee<T>>): Array<T>; - sortBy<V, T: Object>( - object: T, - ...iteratees?: Array<OIteratee<T>> - ): Array<V>; - sortBy<V, T: Object>(object: T, iteratees?: Array<OIteratee<T>>): Array<V>; - - // Date - now(): number; - - // Function - after(n: number, fn: Function): Function; - ary(func: Function, n?: number): Function; - before(n: number, fn: Function): Function; - bind(func: Function, thisArg: any, ...partials: Array<any>): Function; - bindKey(obj: Object, key: string, ...partials: Array<any>): Function; - curry: Curry; - curry(func: Function, arity?: number): Function; - curryRight(func: Function, arity?: number): Function; - debounce<F: Function>(func: F, wait?: number, options?: DebounceOptions): F; - defer(func: Function, ...args?: Array<any>): number; - delay(func: Function, wait: number, ...args?: Array<any>): number; - flip(func: Function): Function; - memoize<F: Function>(func: F, resolver?: Function): F; - negate(predicate: Function): Function; - once(func: Function): Function; - overArgs(func: Function, ...transforms: Array<Function>): Function; - overArgs(func: Function, transforms: Array<Function>): Function; - partial(func: Function, ...partials: any[]): Function; - partialRight(func: Function, ...partials: Array<any>): Function; - partialRight(func: Function, partials: Array<any>): Function; - rearg(func: Function, ...indexes: Array<number>): Function; - rearg(func: Function, indexes: Array<number>): Function; - rest(func: Function, start?: number): Function; - spread(func: Function): Function; - throttle( - func: Function, - wait?: number, - options?: ThrottleOptions - ): Function; - unary(func: Function): Function; - wrap(value: any, wrapper: Function): Function; - - // Lang - castArray(value: *): any[]; - clone<T>(value: T): T; - cloneDeep<T>(value: T): T; - cloneDeepWith<T, U>( - value: T, - customizer?: ?(value: T, key: number | string, object: T, stack: any) => U - ): U; - cloneWith<T, U>( - value: T, - customizer?: ?(value: T, key: number | string, object: T, stack: any) => U - ): U; - conformsTo<T: { [key: string]: mixed }>( - source: T, - predicates: T & { [key: string]: (x: any) => boolean } - ): boolean; - eq(value: any, other: any): boolean; - gt(value: any, other: any): boolean; - gte(value: any, other: any): boolean; - isArguments(value: any): boolean; - isArray(value: any): boolean; - isArrayBuffer(value: any): boolean; - isArrayLike(value: any): boolean; - isArrayLikeObject(value: any): boolean; - isBoolean(value: any): boolean; - isBuffer(value: any): boolean; - isDate(value: any): boolean; - isElement(value: any): boolean; - isEmpty(value: any): boolean; - isEqual(value: any, other: any): boolean; - isEqualWith<T, U>( - value: T, - other: U, - customizer?: ( - objValue: any, - otherValue: any, - key: number | string, - object: T, - other: U, - stack: any - ) => boolean | void - ): boolean; - isError(value: any): boolean; - isFinite(value: any): boolean; - isFunction(value: Function): true; - isFunction(value: number | string | void | null | Object): false; - isInteger(value: any): boolean; - isLength(value: any): boolean; - isMap(value: any): boolean; - isMatch(object?: ?Object, source: Object): boolean; - isMatchWith<T: Object, U: Object>( - object: T, - source: U, - customizer?: ( - objValue: any, - srcValue: any, - key: number | string, - object: T, - source: U - ) => boolean | void - ): boolean; - isNaN(value: any): boolean; - isNative(value: any): boolean; - isNil(value: any): boolean; - isNull(value: any): boolean; - isNumber(value: any): boolean; - isObject(value: any): boolean; - isObjectLike(value: any): boolean; - isPlainObject(value: any): boolean; - isRegExp(value: any): boolean; - isSafeInteger(value: any): boolean; - isSet(value: any): boolean; - isString(value: string): true; - isString( - value: number | boolean | Function | void | null | Object | Array<any> - ): false; - isSymbol(value: any): boolean; - isTypedArray(value: any): boolean; - isUndefined(value: any): boolean; - isWeakMap(value: any): boolean; - isWeakSet(value: any): boolean; - lt(value: any, other: any): boolean; - lte(value: any, other: any): boolean; - toArray(value: any): Array<any>; - toFinite(value: any): number; - toInteger(value: any): number; - toLength(value: any): number; - toNumber(value: any): number; - toPlainObject(value: any): Object; - toSafeInteger(value: any): number; - toString(value: any): string; - - // Math - add(augend: number, addend: number): number; - ceil(number: number, precision?: number): number; - divide(dividend: number, divisor: number): number; - floor(number: number, precision?: number): number; - max<T>(array: ?Array<T>): T; - maxBy<T>(array: ?Array<T>, iteratee?: Iteratee<T>): T; - mean(array: Array<*>): number; - meanBy<T>(array: Array<T>, iteratee?: Iteratee<T>): number; - min<T>(array: ?Array<T>): T; - minBy<T>(array: ?Array<T>, iteratee?: Iteratee<T>): T; - multiply(multiplier: number, multiplicand: number): number; - round(number: number, precision?: number): number; - subtract(minuend: number, subtrahend: number): number; - sum(array: Array<*>): number; - sumBy<T>(array: Array<T>, iteratee?: Iteratee<T>): number; - - // number - clamp(number: number, lower?: number, upper: number): number; - inRange(number: number, start?: number, end: number): boolean; - random(lower?: number, upper?: number, floating?: boolean): number; - - // Object - assign(object?: ?Object, ...sources?: Array<Object>): Object; - assignIn<A, B>(a: A, b: B): A & B; - assignIn<A, B, C>(a: A, b: B, c: C): A & B & C; - assignIn<A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D; - assignIn<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E; - assignInWith<T: Object, A: Object>( - object: T, - s1: A, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void - ): Object; - assignInWith<T: Object, A: Object, B: Object>( - object: T, - s1: A, - s2: B, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B - ) => any | void - ): Object; - assignInWith<T: Object, A: Object, B: Object, C: Object>( - object: T, - s1: A, - s2: B, - s3: C, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B | C - ) => any | void - ): Object; - assignInWith<T: Object, A: Object, B: Object, C: Object, D: Object>( - object: T, - s1: A, - s2: B, - s3: C, - s4: D, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B | C | D - ) => any | void - ): Object; - assignWith<T: Object, A: Object>( - object: T, - s1: A, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void - ): Object; - assignWith<T: Object, A: Object, B: Object>( - object: T, - s1: A, - s2: B, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B - ) => any | void - ): Object; - assignWith<T: Object, A: Object, B: Object, C: Object>( - object: T, - s1: A, - s2: B, - s3: C, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B | C - ) => any | void - ): Object; - assignWith<T: Object, A: Object, B: Object, C: Object, D: Object>( - object: T, - s1: A, - s2: B, - s3: C, - s4: D, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B | C | D - ) => any | void - ): Object; - at(object?: ?Object, ...paths: Array<string>): Array<any>; - at(object?: ?Object, paths: Array<string>): Array<any>; - create<T>(prototype: T, properties?: Object): $Supertype<T>; - defaults(object?: ?Object, ...sources?: Array<Object>): Object; - defaultsDeep(object?: ?Object, ...sources?: Array<Object>): Object; - // alias for _.toPairs - entries(object?: ?Object): Array<[string, any]>; - // alias for _.toPairsIn - entriesIn(object?: ?Object): Array<[string, any]>; - // alias for _.assignIn - extend<A, B>(a: A, b: B): A & B; - extend<A, B, C>(a: A, b: B, c: C): A & B & C; - extend<A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D; - extend<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E; - // alias for _.assignInWith - extendWith<T: Object, A: Object>( - object: T, - s1: A, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void - ): Object; - extendWith<T: Object, A: Object, B: Object>( - object: T, - s1: A, - s2: B, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B - ) => any | void - ): Object; - extendWith<T: Object, A: Object, B: Object, C: Object>( - object: T, - s1: A, - s2: B, - s3: C, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B | C - ) => any | void - ): Object; - extendWith<T: Object, A: Object, B: Object, C: Object, D: Object>( - object: T, - s1: A, - s2: B, - s3: C, - s4: D, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B | C | D - ) => any | void - ): Object; - findKey<A, T: { [id: string]: A }>( - object?: ?T, - predicate?: OPredicate<A, T> - ): string | void; - findLastKey<A, T: { [id: string]: A }>( - object?: ?T, - predicate?: OPredicate<A, T> - ): string | void; - forIn(object?: ?Object, iteratee?: OIteratee<*>): Object; - forInRight(object?: ?Object, iteratee?: OIteratee<*>): Object; - forOwn(object?: ?Object, iteratee?: OIteratee<*>): Object; - forOwnRight(object?: ?Object, iteratee?: OIteratee<*>): Object; - functions(object?: ?Object): Array<string>; - functionsIn(object?: ?Object): Array<string>; - get( - object?: ?Object | ?Array<any>, - path?: ?Array<string> | string, - defaultValue?: any - ): any; - has(object?: ?Object, path?: ?Array<string> | string): boolean; - hasIn(object?: ?Object, path?: ?Array<string> | string): boolean; - invert(object?: ?Object, multiVal?: boolean): Object; - invertBy(object: ?Object, iteratee?: Function): Object; - invoke( - object?: ?Object, - path?: ?Array<string> | string, - ...args?: Array<any> - ): any; - keys<K>(object?: ?{ [key: K]: any }): Array<K>; - keys(object?: ?Object): Array<string>; - keysIn(object?: ?Object): Array<string>; - mapKeys(object?: ?Object, iteratee?: OIteratee<*>): Object; - mapValues(object?: ?Object, iteratee?: OIteratee<*>): Object; - merge(object?: ?Object, ...sources?: Array<?Object>): Object; - mergeWith<T: Object, A: Object>( - object: T, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void - ): Object; - mergeWith<T: Object, A: Object, B: Object>( - object: T, - s1: A, - s2: B, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B - ) => any | void - ): Object; - mergeWith<T: Object, A: Object, B: Object, C: Object>( - object: T, - s1: A, - s2: B, - s3: C, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B | C - ) => any | void - ): Object; - mergeWith<T: Object, A: Object, B: Object, C: Object, D: Object>( - object: T, - s1: A, - s2: B, - s3: C, - s4: D, - customizer?: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B | C | D - ) => any | void - ): Object; - omit(object?: ?Object, ...props: Array<string>): Object; - omit(object?: ?Object, props: Array<string>): Object; - omitBy<A, T: { [id: string]: A }>( - object?: ?T, - predicate?: OPredicate<A, T> - ): Object; - pick(object?: ?Object, ...props: Array<string>): Object; - pick(object?: ?Object, props: Array<string>): Object; - pickBy<A, T: { [id: string]: A }>( - object?: ?T, - predicate?: OPredicate<A, T> - ): Object; - result( - object?: ?Object, - path?: ?Array<string> | string, - defaultValue?: any - ): any; - set(object?: ?Object, path?: ?Array<string> | string, value: any): Object; - setWith<T>( - object: T, - path?: ?Array<string> | string, - value: any, - customizer?: (nsValue: any, key: string, nsObject: T) => any - ): Object; - toPairs(object?: ?Object | Array<*>): Array<[string, any]>; - toPairsIn(object?: ?Object): Array<[string, any]>; - transform( - collection: Object | Array<any>, - iteratee?: OIteratee<*>, - accumulator?: any - ): any; - unset(object?: ?Object, path?: ?Array<string> | string): boolean; - update(object: Object, path: string[] | string, updater: Function): Object; - updateWith( - object: Object, - path: string[] | string, - updater: Function, - customizer?: Function - ): Object; - values(object?: ?Object): Array<any>; - valuesIn(object?: ?Object): Array<any>; - - // Seq - // harder to read, but this is _() - (value: any): any; - chain<T>(value: T): any; - tap<T>(value: T, interceptor: (value: T) => any): T; - thru<T1, T2>(value: T1, interceptor: (value: T1) => T2): T2; - // TODO: _.prototype.* - - // String - camelCase(string?: ?string): string; - capitalize(string?: string): string; - deburr(string?: string): string; - endsWith(string?: string, target?: string, position?: number): boolean; - escape(string?: string): string; - escapeRegExp(string?: string): string; - kebabCase(string?: string): string; - lowerCase(string?: string): string; - lowerFirst(string?: string): string; - pad(string?: string, length?: number, chars?: string): string; - padEnd(string?: string, length?: number, chars?: string): string; - padStart(string?: string, length?: number, chars?: string): string; - parseInt(string: string, radix?: number): number; - repeat(string?: string, n?: number): string; - replace( - string?: string, - pattern: RegExp | string, - replacement: ((string: string) => string) | string - ): string; - snakeCase(string?: string): string; - split( - string?: string, - separator: RegExp | string, - limit?: number - ): Array<string>; - startCase(string?: string): string; - startsWith(string?: string, target?: string, position?: number): boolean; - template(string?: string, options?: TemplateSettings): Function; - toLower(string?: string): string; - toUpper(string?: string): string; - trim(string?: string, chars?: string): string; - trimEnd(string?: string, chars?: string): string; - trimStart(string?: string, chars?: string): string; - truncate(string?: string, options?: TruncateOptions): string; - unescape(string?: string): string; - upperCase(string?: string): string; - upperFirst(string?: string): string; - words(string?: string, pattern?: RegExp | string): Array<string>; - - // Util - attempt(func: Function, ...args: Array<any>): any; - bindAll(object?: ?Object, methodNames: Array<string>): Object; - bindAll(object?: ?Object, ...methodNames: Array<string>): Object; - cond(pairs: NestedArray<Function>): Function; - conforms(source: Object): Function; - constant<T>(value: T): () => T; - defaultTo<T1: string | boolean | Object, T2>( - value: T1, - defaultValue: T2 - ): T1; - // NaN is a number instead of its own type, otherwise it would behave like null/void - defaultTo<T1: number, T2>(value: T1, defaultValue: T2): T1 | T2; - defaultTo<T1: void | null, T2>(value: T1, defaultValue: T2): T2; - flow: $ComposeReverse; - flow(funcs?: Array<Function>): Function; - flowRight: $Compose; - flowRight(funcs?: Array<Function>): Function; - identity<T>(value: T): T; - iteratee(func?: any): Function; - matches(source: Object): Function; - matchesProperty(path?: ?Array<string> | string, srcValue: any): Function; - method(path?: ?Array<string> | string, ...args?: Array<any>): Function; - methodOf(object?: ?Object, ...args?: Array<any>): Function; - mixin<T: Function | Object>( - object?: T, - source: Object, - options?: { chain: boolean } - ): T; - noConflict(): Lodash; - noop(...args: Array<mixed>): void; - nthArg(n?: number): Function; - over(...iteratees: Array<Function>): Function; - over(iteratees: Array<Function>): Function; - overEvery(...predicates: Array<Function>): Function; - overEvery(predicates: Array<Function>): Function; - overSome(...predicates: Array<Function>): Function; - overSome(predicates: Array<Function>): Function; - property(path?: ?Array<string> | string): Function; - propertyOf(object?: ?Object): Function; - range(start: number, end: number, step?: number): Array<number>; - range(end: number, step?: number): Array<number>; - rangeRight(start: number, end: number, step?: number): Array<number>; - rangeRight(end: number, step?: number): Array<number>; - runInContext(context?: Object): Function; - - stubArray(): Array<*>; - stubFalse(): false; - stubObject(): {}; - stubString(): ""; - stubTrue(): true; - times(n: number, ...rest: Array<void>): Array<number>; - times<T>(n: number, iteratee: (i: number) => T): Array<T>; - toPath(value: any): Array<string>; - uniqueId(prefix?: string): string; - - // Properties - VERSION: string; - templateSettings: TemplateSettings; - } - - declare module.exports: Lodash; -} - -declare module "lodash/fp" { - declare type __CurriedFunction1<A, R, AA: A> = (...r: [AA]) => R; - declare type CurriedFunction1<A, R> = __CurriedFunction1<A, R, *>; - - declare type __CurriedFunction2<A, B, R, AA: A, BB: B> = (( - ...r: [AA] - ) => CurriedFunction1<BB, R>) & - ((...r: [AA, BB]) => R); - declare type CurriedFunction2<A, B, R> = __CurriedFunction2<A, B, R, *, *>; - - declare type __CurriedFunction3<A, B, C, R, AA: A, BB: B, CC: C> = (( - ...r: [AA] - ) => CurriedFunction2<BB, CC, R>) & - ((...r: [AA, BB]) => CurriedFunction1<CC, R>) & - ((...r: [AA, BB, CC]) => R); - declare type CurriedFunction3<A, B, C, R> = __CurriedFunction3< - A, - B, - C, - R, - *, - *, - * - >; - - declare type __CurriedFunction4< - A, - B, - C, - D, - R, - AA: A, - BB: B, - CC: C, - DD: D - > = ((...r: [AA]) => CurriedFunction3<BB, CC, DD, R>) & - ((...r: [AA, BB]) => CurriedFunction2<CC, DD, R>) & - ((...r: [AA, BB, CC]) => CurriedFunction1<DD, R>) & - ((...r: [AA, BB, CC, DD]) => R); - declare type CurriedFunction4<A, B, C, D, R> = __CurriedFunction4< - A, - B, - C, - D, - R, - *, - *, - *, - * - >; - - declare type __CurriedFunction5< - A, - B, - C, - D, - E, - R, - AA: A, - BB: B, - CC: C, - DD: D, - EE: E - > = ((...r: [AA]) => CurriedFunction4<BB, CC, DD, EE, R>) & - ((...r: [AA, BB]) => CurriedFunction3<CC, DD, EE, R>) & - ((...r: [AA, BB, CC]) => CurriedFunction2<DD, EE, R>) & - ((...r: [AA, BB, CC, DD]) => CurriedFunction1<EE, R>) & - ((...r: [AA, BB, CC, DD, EE]) => R); - declare type CurriedFunction5<A, B, C, D, E, R> = __CurriedFunction5< - A, - B, - C, - D, - E, - R, - *, - *, - *, - *, - * - >; - - declare type __CurriedFunction6< - A, - B, - C, - D, - E, - F, - R, - AA: A, - BB: B, - CC: C, - DD: D, - EE: E, - FF: F - > = ((...r: [AA]) => CurriedFunction5<BB, CC, DD, EE, FF, R>) & - ((...r: [AA, BB]) => CurriedFunction4<CC, DD, EE, FF, R>) & - ((...r: [AA, BB, CC]) => CurriedFunction3<DD, EE, FF, R>) & - ((...r: [AA, BB, CC, DD]) => CurriedFunction2<EE, FF, R>) & - ((...r: [AA, BB, CC, DD, EE]) => CurriedFunction1<FF, R>) & - ((...r: [AA, BB, CC, DD, EE, FF]) => R); - declare type CurriedFunction6<A, B, C, D, E, F, R> = __CurriedFunction6< - A, - B, - C, - D, - E, - F, - R, - *, - *, - *, - *, - *, - * - >; - - declare type Curry = (<A, R>((...r: [A]) => R) => CurriedFunction1<A, R>) & - (<A, B, R>((...r: [A, B]) => R) => CurriedFunction2<A, B, R>) & - (<A, B, C, R>((...r: [A, B, C]) => R) => CurriedFunction3<A, B, C, R>) & - (<A, B, C, D, R>( - (...r: [A, B, C, D]) => R - ) => CurriedFunction4<A, B, C, D, R>) & - (<A, B, C, D, E, R>( - (...r: [A, B, C, D, E]) => R - ) => CurriedFunction5<A, B, C, D, E, R>) & - (<A, B, C, D, E, F, R>( - (...r: [A, B, C, D, E, F]) => R - ) => CurriedFunction6<A, B, C, D, E, F, R>); - - declare type UnaryFn<A, R> = (a: A) => R; - - declare type TemplateSettings = { - escape?: RegExp, - evaluate?: RegExp, - imports?: Object, - interpolate?: RegExp, - variable?: string - }; - - declare type TruncateOptions = { - length?: number, - omission?: string, - separator?: RegExp | string - }; - - declare type DebounceOptions = { - leading?: boolean, - maxWait?: number, - trailing?: boolean - }; - - declare type ThrottleOptions = { - leading?: boolean, - trailing?: boolean - }; - - declare type NestedArray<T> = Array<Array<T>>; - - declare type matchesIterateeShorthand = Object; - declare type matchesPropertyIterateeShorthand = [string, any]; - declare type propertyIterateeShorthand = string; - - declare type OPredicate<A> = - | ((value: A) => any) - | matchesIterateeShorthand - | matchesPropertyIterateeShorthand - | propertyIterateeShorthand; - - declare type OIterateeWithResult<V, R> = Object | string | ((value: V) => R); - declare type OIteratee<O> = OIterateeWithResult<any, any>; - declare type OFlatMapIteratee<T, U> = OIterateeWithResult<any, Array<U>>; - - declare type Predicate<T> = - | ((value: T) => any) - | matchesIterateeShorthand - | matchesPropertyIterateeShorthand - | propertyIterateeShorthand; - - declare type _ValueOnlyIteratee<T> = (value: T) => mixed; - declare type ValueOnlyIteratee<T> = _ValueOnlyIteratee<T> | string; - declare type _Iteratee<T> = (item: T) => mixed; - declare type Iteratee<T> = _Iteratee<T> | Object | string; - declare type FlatMapIteratee<T, U> = - | ((item: T) => Array<U>) - | Object - | string; - declare type Comparator<T> = (item: T, item2: T) => boolean; - - declare type MapIterator<T, U> = ((item: T) => U) | propertyIterateeShorthand; - - declare type OMapIterator<T, U> = - | ((item: T) => U) - | propertyIterateeShorthand; - - declare class Lodash { - // Array - chunk<T>(size: number): (array: Array<T>) => Array<Array<T>>; - chunk<T>(size: number, array: Array<T>): Array<Array<T>>; - compact<T, N: T>(array: Array<N>): Array<T>; - concat<T, U, A: Array<T> | T, B: Array<U> | U>( - base: A - ): (elements: B) => Array<T | U>; - concat<T, U, A: Array<T> | T, B: Array<U> | U>( - base: A, - elements: B - ): Array<T | U>; - difference<T>(values: Array<T>): (array: Array<T>) => Array<T>; - difference<T>(values: Array<T>, array: Array<T>): Array<T>; - differenceBy<T>( - iteratee: ValueOnlyIteratee<T> - ): ((values: Array<T>) => (array: Array<T>) => T[]) & - ((values: Array<T>, array: Array<T>) => T[]); - differenceBy<T>( - iteratee: ValueOnlyIteratee<T>, - values: Array<T> - ): (array: Array<T>) => T[]; - differenceBy<T>( - iteratee: ValueOnlyIteratee<T>, - values: Array<T>, - array: Array<T> - ): T[]; - differenceWith<T>( - values: T[] - ): ((comparator: Comparator<T>) => (array: T[]) => T[]) & - ((comparator: Comparator<T>, array: T[]) => T[]); - differenceWith<T>( - values: T[], - comparator: Comparator<T> - ): (array: T[]) => T[]; - differenceWith<T>(values: T[], comparator: Comparator<T>, array: T[]): T[]; - drop<T>(n: number): (array: Array<T>) => Array<T>; - drop<T>(n: number, array: Array<T>): Array<T>; - dropLast<T>(n: number): (array: Array<T>) => Array<T>; - dropLast<T>(n: number, array: Array<T>): Array<T>; - dropRight<T>(n: number): (array: Array<T>) => Array<T>; - dropRight<T>(n: number, array: Array<T>): Array<T>; - dropRightWhile<T>(predicate: Predicate<T>): (array: Array<T>) => Array<T>; - dropRightWhile<T>(predicate: Predicate<T>, array: Array<T>): Array<T>; - dropWhile<T>(predicate: Predicate<T>): (array: Array<T>) => Array<T>; - dropWhile<T>(predicate: Predicate<T>, array: Array<T>): Array<T>; - dropLastWhile<T>(predicate: Predicate<T>): (array: Array<T>) => Array<T>; - dropLastWhile<T>(predicate: Predicate<T>, array: Array<T>): Array<T>; - fill<T, U>( - start: number - ): (( - end: number - ) => ((value: U) => (array: Array<T>) => Array<T | U>) & - ((value: U, array: Array<T>) => Array<T | U>)) & - ((end: number, value: U) => (array: Array<T>) => Array<T | U>) & - ((end: number, value: U, array: Array<T>) => Array<T | U>); - fill<T, U>( - start: number, - end: number - ): ((value: U) => (array: Array<T>) => Array<T | U>) & - ((value: U, array: Array<T>) => Array<T | U>); - fill<T, U>( - start: number, - end: number, - value: U - ): (array: Array<T>) => Array<T | U>; - fill<T, U>( - start: number, - end: number, - value: U, - array: Array<T> - ): Array<T | U>; - findIndex<T>(predicate: Predicate<T>): (array: $ReadOnlyArray<T>) => number; - findIndex<T>(predicate: Predicate<T>, array: $ReadOnlyArray<T>): number; - findIndexFrom<T>( - predicate: Predicate<T> - ): ((fromIndex: number) => (array: $ReadOnlyArray<T>) => number) & - ((fromIndex: number, array: $ReadOnlyArray<T>) => number); - findIndexFrom<T>( - predicate: Predicate<T>, - fromIndex: number - ): (array: $ReadOnlyArray<T>) => number; - findIndexFrom<T>( - predicate: Predicate<T>, - fromIndex: number, - array: $ReadOnlyArray<T> - ): number; - findLastIndex<T>( - predicate: Predicate<T> - ): (array: $ReadOnlyArray<T>) => number; - findLastIndex<T>(predicate: Predicate<T>, array: $ReadOnlyArray<T>): number; - findLastIndexFrom<T>( - predicate: Predicate<T> - ): ((fromIndex: number) => (array: $ReadOnlyArray<T>) => number) & - ((fromIndex: number, array: $ReadOnlyArray<T>) => number); - findLastIndexFrom<T>( - predicate: Predicate<T>, - fromIndex: number - ): (array: $ReadOnlyArray<T>) => number; - findLastIndexFrom<T>( - predicate: Predicate<T>, - fromIndex: number, - array: $ReadOnlyArray<T> - ): number; - // alias of _.head - first<T>(array: Array<T>): T; - flatten<T, X>(array: Array<Array<T> | X>): Array<T | X>; - unnest<T, X>(array: Array<Array<T> | X>): Array<T | X>; - flattenDeep<T>(array: any[]): Array<T>; - flattenDepth(depth: number): (array: any[]) => any[]; - flattenDepth(depth: number, array: any[]): any[]; - fromPairs<A, B>(pairs: Array<[A, B]>): { [key: A]: B }; - head<T>(array: Array<T>): T; - indexOf<T>(value: T): (array: Array<T>) => number; - indexOf<T>(value: T, array: Array<T>): number; - indexOfFrom<T>( - value: T - ): ((fromIndex: number) => (array: Array<T>) => number) & - ((fromIndex: number, array: Array<T>) => number); - indexOfFrom<T>(value: T, fromIndex: number): (array: Array<T>) => number; - indexOfFrom<T>(value: T, fromIndex: number, array: Array<T>): number; - initial<T>(array: Array<T>): Array<T>; - init<T>(array: Array<T>): Array<T>; - intersection<T>(a1: Array<T>): (a2: Array<T>) => Array<T>; - intersection<T>(a1: Array<T>, a2: Array<T>): Array<T>; - intersectionBy<T>( - iteratee: ValueOnlyIteratee<T> - ): ((a1: Array<T>) => (a2: Array<T>) => Array<T>) & - ((a1: Array<T>, a2: Array<T>) => Array<T>); - intersectionBy<T>( - iteratee: ValueOnlyIteratee<T>, - a1: Array<T> - ): (a2: Array<T>) => Array<T>; - intersectionBy<T>( - iteratee: ValueOnlyIteratee<T>, - a1: Array<T>, - a2: Array<T> - ): Array<T>; - intersectionWith<T>( - comparator: Comparator<T> - ): ((a1: Array<T>) => (a2: Array<T>) => Array<T>) & - ((a1: Array<T>, a2: Array<T>) => Array<T>); - intersectionWith<T>( - comparator: Comparator<T>, - a1: Array<T> - ): (a2: Array<T>) => Array<T>; - intersectionWith<T>( - comparator: Comparator<T>, - a1: Array<T>, - a2: Array<T> - ): Array<T>; - join<T>(separator: string): (array: Array<T>) => string; - join<T>(separator: string, array: Array<T>): string; - last<T>(array: Array<T>): T; - lastIndexOf<T>(value: T): (array: Array<T>) => number; - lastIndexOf<T>(value: T, array: Array<T>): number; - lastIndexOfFrom<T>( - value: T - ): ((fromIndex: number) => (array: Array<T>) => number) & - ((fromIndex: number, array: Array<T>) => number); - lastIndexOfFrom<T>( - value: T, - fromIndex: number - ): (array: Array<T>) => number; - lastIndexOfFrom<T>(value: T, fromIndex: number, array: Array<T>): number; - nth<T>(n: number): (array: T[]) => T; - nth<T>(n: number, array: T[]): T; - pull<T>(value: T): (array: Array<T>) => Array<T>; - pull<T>(value: T, array: Array<T>): Array<T>; - pullAll<T>(values: Array<T>): (array: Array<T>) => Array<T>; - pullAll<T>(values: Array<T>, array: Array<T>): Array<T>; - pullAllBy<T>( - iteratee: ValueOnlyIteratee<T> - ): ((values: Array<T>) => (array: Array<T>) => Array<T>) & - ((values: Array<T>, array: Array<T>) => Array<T>); - pullAllBy<T>( - iteratee: ValueOnlyIteratee<T>, - values: Array<T> - ): (array: Array<T>) => Array<T>; - pullAllBy<T>( - iteratee: ValueOnlyIteratee<T>, - values: Array<T>, - array: Array<T> - ): Array<T>; - pullAllWith<T>( - comparator: Function - ): ((values: T[]) => (array: T[]) => T[]) & - ((values: T[], array: T[]) => T[]); - pullAllWith<T>(comparator: Function, values: T[]): (array: T[]) => T[]; - pullAllWith<T>(comparator: Function, values: T[], array: T[]): T[]; - pullAt<T>(indexed: Array<number>): (array: Array<T>) => Array<T>; - pullAt<T>(indexed: Array<number>, array: Array<T>): Array<T>; - remove<T>(predicate: Predicate<T>): (array: Array<T>) => Array<T>; - remove<T>(predicate: Predicate<T>, array: Array<T>): Array<T>; - reverse<T>(array: Array<T>): Array<T>; - slice<T>( - start: number - ): ((end: number) => (array: Array<T>) => Array<T>) & - ((end: number, array: Array<T>) => Array<T>); - slice<T>(start: number, end: number): (array: Array<T>) => Array<T>; - slice<T>(start: number, end: number, array: Array<T>): Array<T>; - sortedIndex<T>(value: T): (array: Array<T>) => number; - sortedIndex<T>(value: T, array: Array<T>): number; - sortedIndexBy<T>( - iteratee: ValueOnlyIteratee<T> - ): ((value: T) => (array: Array<T>) => number) & - ((value: T, array: Array<T>) => number); - sortedIndexBy<T>( - iteratee: ValueOnlyIteratee<T>, - value: T - ): (array: Array<T>) => number; - sortedIndexBy<T>( - iteratee: ValueOnlyIteratee<T>, - value: T, - array: Array<T> - ): number; - sortedIndexOf<T>(value: T): (array: Array<T>) => number; - sortedIndexOf<T>(value: T, array: Array<T>): number; - sortedLastIndex<T>(value: T): (array: Array<T>) => number; - sortedLastIndex<T>(value: T, array: Array<T>): number; - sortedLastIndexBy<T>( - iteratee: ValueOnlyIteratee<T> - ): ((value: T) => (array: Array<T>) => number) & - ((value: T, array: Array<T>) => number); - sortedLastIndexBy<T>( - iteratee: ValueOnlyIteratee<T>, - value: T - ): (array: Array<T>) => number; - sortedLastIndexBy<T>( - iteratee: ValueOnlyIteratee<T>, - value: T, - array: Array<T> - ): number; - sortedLastIndexOf<T>(value: T): (array: Array<T>) => number; - sortedLastIndexOf<T>(value: T, array: Array<T>): number; - sortedUniq<T>(array: Array<T>): Array<T>; - sortedUniqBy<T>( - iteratee: (value: T) => mixed - ): (array: Array<T>) => Array<T>; - sortedUniqBy<T>(iteratee: (value: T) => mixed, array: Array<T>): Array<T>; - tail<T>(array: Array<T>): Array<T>; - take<T>(n: number): (array: Array<T>) => Array<T>; - take<T>(n: number, array: Array<T>): Array<T>; - takeRight<T>(n: number): (array: Array<T>) => Array<T>; - takeRight<T>(n: number, array: Array<T>): Array<T>; - takeLast<T>(n: number): (array: Array<T>) => Array<T>; - takeLast<T>(n: number, array: Array<T>): Array<T>; - takeRightWhile<T>(predicate: Predicate<T>): (array: Array<T>) => Array<T>; - takeRightWhile<T>(predicate: Predicate<T>, array: Array<T>): Array<T>; - takeLastWhile<T>(predicate: Predicate<T>): (array: Array<T>) => Array<T>; - takeLastWhile<T>(predicate: Predicate<T>, array: Array<T>): Array<T>; - takeWhile<T>(predicate: Predicate<T>): (array: Array<T>) => Array<T>; - takeWhile<T>(predicate: Predicate<T>, array: Array<T>): Array<T>; - union<T>(a1: Array<T>): (a2: Array<T>) => Array<T>; - union<T>(a1: Array<T>, a2: Array<T>): Array<T>; - unionBy<T>( - iteratee: ValueOnlyIteratee<T> - ): ((a1: Array<T>) => (a2: Array<T>) => Array<T>) & - ((a1: Array<T>, a2: Array<T>) => Array<T>); - unionBy<T>( - iteratee: ValueOnlyIteratee<T>, - a1: Array<T> - ): (a2: Array<T>) => Array<T>; - unionBy<T>( - iteratee: ValueOnlyIteratee<T>, - a1: Array<T>, - a2: Array<T> - ): Array<T>; - unionWith<T>( - comparator: Comparator<T> - ): ((a1: Array<T>) => (a2: Array<T>) => Array<T>) & - ((a1: Array<T>, a2: Array<T>) => Array<T>); - unionWith<T>( - comparator: Comparator<T>, - a1: Array<T> - ): (a2: Array<T>) => Array<T>; - unionWith<T>( - comparator: Comparator<T>, - a1: Array<T>, - a2: Array<T> - ): Array<T>; - uniq<T>(array: Array<T>): Array<T>; - uniqBy<T>(iteratee: ValueOnlyIteratee<T>): (array: Array<T>) => Array<T>; - uniqBy<T>(iteratee: ValueOnlyIteratee<T>, array: Array<T>): Array<T>; - uniqWith<T>(comparator: Comparator<T>): (array: Array<T>) => Array<T>; - uniqWith<T>(comparator: Comparator<T>, array: Array<T>): Array<T>; - unzip<T>(array: Array<T>): Array<T>; - unzipWith<T>(iteratee: Iteratee<T>): (array: Array<T>) => Array<T>; - unzipWith<T>(iteratee: Iteratee<T>, array: Array<T>): Array<T>; - without<T>(values: Array<T>): (array: Array<T>) => Array<T>; - without<T>(values: Array<T>, array: Array<T>): Array<T>; - xor<T>(a1: Array<T>): (a2: Array<T>) => Array<T>; - xor<T>(a1: Array<T>, a2: Array<T>): Array<T>; - symmetricDifference<T>(a1: Array<T>): (a2: Array<T>) => Array<T>; - symmetricDifference<T>(a1: Array<T>, a2: Array<T>): Array<T>; - xorBy<T>( - iteratee: ValueOnlyIteratee<T> - ): ((a1: Array<T>) => (a2: Array<T>) => Array<T>) & - ((a1: Array<T>, a2: Array<T>) => Array<T>); - xorBy<T>( - iteratee: ValueOnlyIteratee<T>, - a1: Array<T> - ): (a2: Array<T>) => Array<T>; - xorBy<T>( - iteratee: ValueOnlyIteratee<T>, - a1: Array<T>, - a2: Array<T> - ): Array<T>; - symmetricDifferenceBy<T>( - iteratee: ValueOnlyIteratee<T> - ): ((a1: Array<T>) => (a2: Array<T>) => Array<T>) & - ((a1: Array<T>, a2: Array<T>) => Array<T>); - symmetricDifferenceBy<T>( - iteratee: ValueOnlyIteratee<T>, - a1: Array<T> - ): (a2: Array<T>) => Array<T>; - symmetricDifferenceBy<T>( - iteratee: ValueOnlyIteratee<T>, - a1: Array<T>, - a2: Array<T> - ): Array<T>; - xorWith<T>( - comparator: Comparator<T> - ): ((a1: Array<T>) => (a2: Array<T>) => Array<T>) & - ((a1: Array<T>, a2: Array<T>) => Array<T>); - xorWith<T>( - comparator: Comparator<T>, - a1: Array<T> - ): (a2: Array<T>) => Array<T>; - xorWith<T>(comparator: Comparator<T>, a1: Array<T>, a2: Array<T>): Array<T>; - symmetricDifferenceWith<T>( - comparator: Comparator<T> - ): ((a1: Array<T>) => (a2: Array<T>) => Array<T>) & - ((a1: Array<T>, a2: Array<T>) => Array<T>); - symmetricDifferenceWith<T>( - comparator: Comparator<T>, - a1: Array<T> - ): (a2: Array<T>) => Array<T>; - symmetricDifferenceWith<T>( - comparator: Comparator<T>, - a1: Array<T>, - a2: Array<T> - ): Array<T>; - zip<A, B>(a1: A[]): (a2: B[]) => Array<[A, B]>; - zip<A, B>(a1: A[], a2: B[]): Array<[A, B]>; - zipAll(arrays: Array<Array<any>>): Array<any>; - zipObject<K, V>(props?: Array<K>): (values?: Array<V>) => { [key: K]: V }; - zipObject<K, V>(props?: Array<K>, values?: Array<V>): { [key: K]: V }; - zipObj(props: Array<any>): (values: Array<any>) => Object; - zipObj(props: Array<any>, values: Array<any>): Object; - zipObjectDeep(props: any[]): (values: any) => Object; - zipObjectDeep(props: any[], values: any): Object; - zipWith<T>( - iteratee: Iteratee<T> - ): ((a1: NestedArray<T>) => (a2: NestedArray<T>) => Array<T>) & - ((a1: NestedArray<T>, a2: NestedArray<T>) => Array<T>); - zipWith<T>( - iteratee: Iteratee<T>, - a1: NestedArray<T> - ): (a2: NestedArray<T>) => Array<T>; - zipWith<T>( - iteratee: Iteratee<T>, - a1: NestedArray<T>, - a2: NestedArray<T> - ): Array<T>; - // Collection - countBy<T>( - iteratee: ValueOnlyIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => { [string]: number }; - countBy<T>( - iteratee: ValueOnlyIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): { [string]: number }; - // alias of _.forEach - each<T>( - iteratee: Iteratee<T> | OIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => Array<T>; - each<T>( - iteratee: Iteratee<T> | OIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): Array<T>; - // alias of _.forEachRight - eachRight<T>( - iteratee: Iteratee<T> | OIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => Array<T>; - eachRight<T>( - iteratee: Iteratee<T> | OIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): Array<T>; - every<T>( - iteratee: Iteratee<T> | OIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => boolean; - every<T>( - iteratee: Iteratee<T> | OIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): boolean; - all<T>( - iteratee: Iteratee<T> | OIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => boolean; - all<T>( - iteratee: Iteratee<T> | OIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): boolean; - filter<T>( - predicate: Predicate<T> | OPredicate<T> - ): (collection: Array<T> | { [id: any]: T }) => Array<T>; - filter<T>( - predicate: Predicate<T> | OPredicate<T>, - collection: Array<T> | { [id: any]: T } - ): Array<T>; - find<T>( - predicate: Predicate<T> | OPredicate<T> - ): (collection: $ReadOnlyArray<T> | { [id: any]: T }) => T | void; - find<T>( - predicate: Predicate<T> | OPredicate<T>, - collection: $ReadOnlyArray<T> | { [id: any]: T } - ): T | void; - findFrom<T>( - predicate: Predicate<T> | OPredicate<T> - ): (( - fromIndex: number - ) => (collection: $ReadOnlyArray<T> | { [id: any]: T }) => T | void) & - (( - fromIndex: number, - collection: $ReadOnlyArray<T> | { [id: any]: T } - ) => T | void); - findFrom<T>( - predicate: Predicate<T> | OPredicate<T>, - fromIndex: number - ): (collection: Array<T> | { [id: any]: T }) => T | void; - findFrom<T>( - predicate: Predicate<T> | OPredicate<T>, - fromIndex: number, - collection: $ReadOnlyArray<T> | { [id: any]: T } - ): T | void; - findLast<T>( - predicate: Predicate<T> | OPredicate<T> - ): (collection: $ReadOnlyArray<T> | { [id: any]: T }) => T | void; - findLast<T>( - predicate: Predicate<T> | OPredicate<T>, - collection: $ReadOnlyArray<T> | { [id: any]: T } - ): T | void; - findLastFrom<T>( - predicate: Predicate<T> | OPredicate<T> - ): (( - fromIndex: number - ) => (collection: $ReadOnlyArray<T> | { [id: any]: T }) => T | void) & - (( - fromIndex: number, - collection: $ReadOnlyArray<T> | { [id: any]: T } - ) => T | void); - findLastFrom<T>( - predicate: Predicate<T> | OPredicate<T>, - fromIndex: number - ): (collection: $ReadOnlyArray<T> | { [id: any]: T }) => T | void; - findLastFrom<T>( - predicate: Predicate<T> | OPredicate<T>, - fromIndex: number, - collection: $ReadOnlyArray<T> | { [id: any]: T } - ): T | void; - flatMap<T, U>( - iteratee: FlatMapIteratee<T, U> | OFlatMapIteratee<T, U> - ): (collection: Array<T> | { [id: any]: T }) => Array<U>; - flatMap<T, U>( - iteratee: FlatMapIteratee<T, U> | OFlatMapIteratee<T, U>, - collection: Array<T> | { [id: any]: T } - ): Array<U>; - flatMapDeep<T, U>( - iteratee: FlatMapIteratee<T, U> | OFlatMapIteratee<T, U> - ): (collection: Array<T> | { [id: any]: T }) => Array<U>; - flatMapDeep<T, U>( - iteratee: FlatMapIteratee<T, U> | OFlatMapIteratee<T, U>, - collection: Array<T> | { [id: any]: T } - ): Array<U>; - flatMapDepth<T, U>( - iteratee: FlatMapIteratee<T, U> | OFlatMapIteratee<T, U> - ): (( - depth: number - ) => (collection: Array<T> | { [id: any]: T }) => Array<U>) & - ((depth: number, collection: Array<T> | { [id: any]: T }) => Array<U>); - flatMapDepth<T, U>( - iteratee: FlatMapIteratee<T, U> | OFlatMapIteratee<T, U>, - depth: number - ): (collection: Array<T> | { [id: any]: T }) => Array<U>; - flatMapDepth<T, U>( - iteratee: FlatMapIteratee<T, U> | OFlatMapIteratee<T, U>, - depth: number, - collection: Array<T> | { [id: any]: T } - ): Array<U>; - forEach<T>( - iteratee: Iteratee<T> | OIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => Array<T>; - forEach<T>( - iteratee: Iteratee<T> | OIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): Array<T>; - forEachRight<T>( - iteratee: Iteratee<T> | OIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => Array<T>; - forEachRight<T>( - iteratee: Iteratee<T> | OIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): Array<T>; - groupBy<V, T>( - iteratee: ValueOnlyIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => { [key: V]: Array<T> }; - groupBy<V, T>( - iteratee: ValueOnlyIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): { [key: V]: Array<T> }; - includes(value: string): (str: string) => boolean; - includes(value: string, str: string): boolean; - includes<T>(value: T): (collection: Array<T> | { [id: any]: T }) => boolean; - includes<T>(value: T, collection: Array<T> | { [id: any]: T }): boolean; - contains(value: string): (str: string) => boolean; - contains(value: string, str: string): boolean; - contains<T>(value: T): (collection: Array<T> | { [id: any]: T }) => boolean; - contains<T>(value: T, collection: Array<T> | { [id: any]: T }): boolean; - includesFrom( - value: string - ): ((fromIndex: number) => (str: string) => boolean) & - ((fromIndex: number, str: string) => boolean); - includesFrom(value: string, fromIndex: number): (str: string) => boolean; - includesFrom(value: string, fromIndex: number, str: string): boolean; - includesFrom<T>( - value: T - ): ((fromIndex: number) => (collection: Array<T>) => boolean) & - ((fromIndex: number, collection: Array<T>) => boolean); - includesFrom<T>( - value: T, - fromIndex: number - ): (collection: Array<T>) => boolean; - includesFrom<T>(value: T, fromIndex: number, collection: Array<T>): boolean; - invokeMap<T>( - path: ((value: T) => Array<string> | string) | Array<string> | string - ): (collection: Array<T> | { [id: any]: T }) => Array<any>; - invokeMap<T>( - path: ((value: T) => Array<string> | string) | Array<string> | string, - collection: Array<T> | { [id: any]: T } - ): Array<any>; - invokeArgsMap<T>( - path: ((value: T) => Array<string> | string) | Array<string> | string - ): (( - collection: Array<T> | { [id: any]: T } - ) => (args: Array<any>) => Array<any>) & - (( - collection: Array<T> | { [id: any]: T }, - args: Array<any> - ) => Array<any>); - invokeArgsMap<T>( - path: ((value: T) => Array<string> | string) | Array<string> | string, - collection: Array<T> | { [id: any]: T } - ): (args: Array<any>) => Array<any>; - invokeArgsMap<T>( - path: ((value: T) => Array<string> | string) | Array<string> | string, - collection: Array<T> | { [id: any]: T }, - args: Array<any> - ): Array<any>; - keyBy<T, V>( - iteratee: ValueOnlyIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => { [key: V]: T }; - keyBy<T, V>( - iteratee: ValueOnlyIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): { [key: V]: T }; - indexBy<T, V>( - iteratee: ValueOnlyIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => { [key: V]: T }; - indexBy<T, V>( - iteratee: ValueOnlyIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): { [key: V]: T }; - map<T, U>( - iteratee: MapIterator<T, U> | OMapIterator<T, U> - ): (collection: Array<T> | { [id: any]: T }) => Array<U>; - map<T, U>( - iteratee: MapIterator<T, U> | OMapIterator<T, U>, - collection: Array<T> | { [id: any]: T } - ): Array<U>; - map(iteratee: (char: string) => any): (str: string) => string; - map(iteratee: (char: string) => any, str: string): string; - pluck<T, U>( - iteratee: MapIterator<T, U> | OMapIterator<T, U> - ): (collection: Array<T> | { [id: any]: T }) => Array<U>; - pluck<T, U>( - iteratee: MapIterator<T, U> | OMapIterator<T, U>, - collection: Array<T> | { [id: any]: T } - ): Array<U>; - pluck(iteratee: (char: string) => any): (str: string) => string; - pluck(iteratee: (char: string) => any, str: string): string; - orderBy<T>( - iteratees: Array<Iteratee<T> | OIteratee<*>> | string - ): (( - orders: Array<"asc" | "desc"> | string - ) => (collection: Array<T> | { [id: any]: T }) => Array<T>) & - (( - orders: Array<"asc" | "desc"> | string, - collection: Array<T> | { [id: any]: T } - ) => Array<T>); - orderBy<T>( - iteratees: Array<Iteratee<T> | OIteratee<*>> | string, - orders: Array<"asc" | "desc"> | string - ): (collection: Array<T> | { [id: any]: T }) => Array<T>; - orderBy<T>( - iteratees: Array<Iteratee<T> | OIteratee<*>> | string, - orders: Array<"asc" | "desc"> | string, - collection: Array<T> | { [id: any]: T } - ): Array<T>; - partition<T>( - predicate: Predicate<T> | OPredicate<T> - ): (collection: Array<T> | { [id: any]: T }) => [Array<T>, Array<T>]; - partition<T>( - predicate: Predicate<T> | OPredicate<T>, - collection: Array<T> | { [id: any]: T } - ): [Array<T>, Array<T>]; - reduce<T, U>( - iteratee: (accumulator: U, value: T) => U - ): ((accumulator: U) => (collection: Array<T> | { [id: any]: T }) => U) & - ((accumulator: U, collection: Array<T> | { [id: any]: T }) => U); - reduce<T, U>( - iteratee: (accumulator: U, value: T) => U, - accumulator: U - ): (collection: Array<T> | { [id: any]: T }) => U; - reduce<T, U>( - iteratee: (accumulator: U, value: T) => U, - accumulator: U, - collection: Array<T> | { [id: any]: T } - ): U; - reduceRight<T, U>( - iteratee: (value: T, accumulator: U) => U - ): ((accumulator: U) => (collection: Array<T> | { [id: any]: T }) => U) & - ((accumulator: U, collection: Array<T> | { [id: any]: T }) => U); - reduceRight<T, U>( - iteratee: (value: T, accumulator: U) => U, - accumulator: U - ): (collection: Array<T> | { [id: any]: T }) => U; - reduceRight<T, U>( - iteratee: (value: T, accumulator: U) => U, - accumulator: U, - collection: Array<T> | { [id: any]: T } - ): U; - reject<T>( - predicate: Predicate<T> | OPredicate<T> - ): (collection: Array<T> | { [id: any]: T }) => Array<T>; - reject<T>( - predicate: Predicate<T> | OPredicate<T>, - collection: Array<T> | { [id: any]: T } - ): Array<T>; - sample<T>(collection: Array<T> | { [id: any]: T }): T; - sampleSize<T>( - n: number - ): (collection: Array<T> | { [id: any]: T }) => Array<T>; - sampleSize<T>(n: number, collection: Array<T> | { [id: any]: T }): Array<T>; - shuffle<T>(collection: Array<T> | { [id: any]: T }): Array<T>; - size(collection: Array<any> | Object): number; - some<T>( - predicate: Predicate<T> | OPredicate<T> - ): (collection: Array<T> | { [id: any]: T }) => boolean; - some<T>( - predicate: Predicate<T> | OPredicate<T>, - collection: Array<T> | { [id: any]: T } - ): boolean; - any<T>( - predicate: Predicate<T> | OPredicate<T> - ): (collection: Array<T> | { [id: any]: T }) => boolean; - any<T>( - predicate: Predicate<T> | OPredicate<T>, - collection: Array<T> | { [id: any]: T } - ): boolean; - sortBy<T>( - iteratees: Array<Iteratee<T> | OIteratee<T>> | Iteratee<T> | OIteratee<T> - ): (collection: Array<T> | { [id: any]: T }) => Array<T>; - sortBy<T>( - iteratees: Array<Iteratee<T> | OIteratee<T>> | Iteratee<T> | OIteratee<T>, - collection: Array<T> | { [id: any]: T } - ): Array<T>; - - // Date - now(): number; - - // Function - after(fn: Function): (n: number) => Function; - after(fn: Function, n: number): Function; - ary(func: Function): Function; - nAry(n: number): (func: Function) => Function; - nAry(n: number, func: Function): Function; - before(fn: Function): (n: number) => Function; - before(fn: Function, n: number): Function; - bind(func: Function): (thisArg: any) => Function; - bind(func: Function, thisArg: any): Function; - bindKey(obj: Object): (key: string) => Function; - bindKey(obj: Object, key: string): Function; - curry: Curry; - curryN(arity: number): (func: Function) => Function; - curryN(arity: number, func: Function): Function; - curryRight(func: Function): Function; - curryRightN(arity: number): (func: Function) => Function; - curryRightN(arity: number, func: Function): Function; - debounce(wait: number): <F: Function>(func: F) => F; - debounce<F: Function>(wait: number, func: F): F; - defer(func: Function): number; - delay(wait: number): (func: Function) => number; - delay(wait: number, func: Function): number; - flip(func: Function): Function; - memoize<F: Function>(func: F): F; - negate(predicate: Function): Function; - complement(predicate: Function): Function; - once(func: Function): Function; - overArgs(func: Function): (transforms: Array<Function>) => Function; - overArgs(func: Function, transforms: Array<Function>): Function; - useWith(func: Function): (transforms: Array<Function>) => Function; - useWith(func: Function, transforms: Array<Function>): Function; - partial(func: Function): (partials: any[]) => Function; - partial(func: Function, partials: any[]): Function; - partialRight(func: Function): (partials: Array<any>) => Function; - partialRight(func: Function, partials: Array<any>): Function; - rearg(indexes: Array<number>): (func: Function) => Function; - rearg(indexes: Array<number>, func: Function): Function; - rest(func: Function): Function; - unapply(func: Function): Function; - restFrom(start: number): (func: Function) => Function; - restFrom(start: number, func: Function): Function; - spread(func: Function): Function; - apply(func: Function): Function; - spreadFrom(start: number): (func: Function) => Function; - spreadFrom(start: number, func: Function): Function; - throttle(wait: number): (func: Function) => Function; - throttle(wait: number, func: Function): Function; - unary(func: Function): Function; - wrap(wrapper: Function): (value: any) => Function; - wrap(wrapper: Function, value: any): Function; - - // Lang - castArray(value: *): any[]; - clone<T>(value: T): T; - cloneDeep<T>(value: T): T; - cloneDeepWith<T, U>( - customizer: (value: T, key: number | string, object: T, stack: any) => U - ): (value: T) => U; - cloneDeepWith<T, U>( - customizer: (value: T, key: number | string, object: T, stack: any) => U, - value: T - ): U; - cloneWith<T, U>( - customizer: (value: T, key: number | string, object: T, stack: any) => U - ): (value: T) => U; - cloneWith<T, U>( - customizer: (value: T, key: number | string, object: T, stack: any) => U, - value: T - ): U; - conformsTo<T: { [key: string]: mixed }>( - predicates: T & { [key: string]: (x: any) => boolean } - ): (source: T) => boolean; - conformsTo<T: { [key: string]: mixed }>( - predicates: T & { [key: string]: (x: any) => boolean }, - source: T - ): boolean; - where<T: { [key: string]: mixed }>( - predicates: T & { [key: string]: (x: any) => boolean } - ): (source: T) => boolean; - where<T: { [key: string]: mixed }>( - predicates: T & { [key: string]: (x: any) => boolean }, - source: T - ): boolean; - conforms<T: { [key: string]: mixed }>( - predicates: T & { [key: string]: (x: any) => boolean } - ): (source: T) => boolean; - conforms<T: { [key: string]: mixed }>( - predicates: T & { [key: string]: (x: any) => boolean }, - source: T - ): boolean; - eq(value: any): (other: any) => boolean; - eq(value: any, other: any): boolean; - identical(value: any): (other: any) => boolean; - identical(value: any, other: any): boolean; - gt(value: any): (other: any) => boolean; - gt(value: any, other: any): boolean; - gte(value: any): (other: any) => boolean; - gte(value: any, other: any): boolean; - isArguments(value: any): boolean; - isArray(value: any): boolean; - isArrayBuffer(value: any): boolean; - isArrayLike(value: any): boolean; - isArrayLikeObject(value: any): boolean; - isBoolean(value: any): boolean; - isBuffer(value: any): boolean; - isDate(value: any): boolean; - isElement(value: any): boolean; - isEmpty(value: any): boolean; - isEqual(value: any): (other: any) => boolean; - isEqual(value: any, other: any): boolean; - equals(value: any): (other: any) => boolean; - equals(value: any, other: any): boolean; - isEqualWith<T, U>( - customizer: ( - objValue: any, - otherValue: any, - key: number | string, - object: T, - other: U, - stack: any - ) => boolean | void - ): ((value: T) => (other: U) => boolean) & - ((value: T, other: U) => boolean); - isEqualWith<T, U>( - customizer: ( - objValue: any, - otherValue: any, - key: number | string, - object: T, - other: U, - stack: any - ) => boolean | void, - value: T - ): (other: U) => boolean; - isEqualWith<T, U>( - customizer: ( - objValue: any, - otherValue: any, - key: number | string, - object: T, - other: U, - stack: any - ) => boolean | void, - value: T, - other: U - ): boolean; - isError(value: any): boolean; - isFinite(value: any): boolean; - isFunction(value: Function): true; - isFunction(value: number | string | void | null | Object): false; - isInteger(value: any): boolean; - isLength(value: any): boolean; - isMap(value: any): boolean; - isMatch(source: Object): (object: Object) => boolean; - isMatch(source: Object, object: Object): boolean; - whereEq(source: Object): (object: Object) => boolean; - whereEq(source: Object, object: Object): boolean; - isMatchWith<T: Object, U: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: number | string, - object: T, - source: U - ) => boolean | void - ): ((source: U) => (object: T) => boolean) & - ((source: U, object: T) => boolean); - isMatchWith<T: Object, U: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: number | string, - object: T, - source: U - ) => boolean | void, - source: U - ): (object: T) => boolean; - isMatchWith<T: Object, U: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: number | string, - object: T, - source: U - ) => boolean | void, - source: U, - object: T - ): boolean; - isNaN(value: any): boolean; - isNative(value: any): boolean; - isNil(value: any): boolean; - isNull(value: any): boolean; - isNumber(value: any): boolean; - isObject(value: any): boolean; - isObjectLike(value: any): boolean; - isPlainObject(value: any): boolean; - isRegExp(value: any): boolean; - isSafeInteger(value: any): boolean; - isSet(value: any): boolean; - isString(value: string): true; - isString( - value: number | boolean | Function | void | null | Object | Array<any> - ): false; - isSymbol(value: any): boolean; - isTypedArray(value: any): boolean; - isUndefined(value: any): boolean; - isWeakMap(value: any): boolean; - isWeakSet(value: any): boolean; - lt(value: any): (other: any) => boolean; - lt(value: any, other: any): boolean; - lte(value: any): (other: any) => boolean; - lte(value: any, other: any): boolean; - toArray(value: any): Array<any>; - toFinite(value: any): number; - toInteger(value: any): number; - toLength(value: any): number; - toNumber(value: any): number; - toPlainObject(value: any): Object; - toSafeInteger(value: any): number; - toString(value: any): string; - - // Math - add(augend: number): (addend: number) => number; - add(augend: number, addend: number): number; - ceil(number: number): number; - divide(dividend: number): (divisor: number) => number; - divide(dividend: number, divisor: number): number; - floor(number: number): number; - max<T>(array: Array<T>): T; - maxBy<T>(iteratee: Iteratee<T>): (array: Array<T>) => T; - maxBy<T>(iteratee: Iteratee<T>, array: Array<T>): T; - mean(array: Array<*>): number; - meanBy<T>(iteratee: Iteratee<T>): (array: Array<T>) => number; - meanBy<T>(iteratee: Iteratee<T>, array: Array<T>): number; - min<T>(array: Array<T>): T; - minBy<T>(iteratee: Iteratee<T>): (array: Array<T>) => T; - minBy<T>(iteratee: Iteratee<T>, array: Array<T>): T; - multiply(multiplier: number): (multiplicand: number) => number; - multiply(multiplier: number, multiplicand: number): number; - round(number: number): number; - subtract(minuend: number): (subtrahend: number) => number; - subtract(minuend: number, subtrahend: number): number; - sum(array: Array<*>): number; - sumBy<T>(iteratee: Iteratee<T>): (array: Array<T>) => number; - sumBy<T>(iteratee: Iteratee<T>, array: Array<T>): number; - - // number - clamp( - lower: number - ): ((upper: number) => (number: number) => number) & - ((upper: number, number: number) => number); - clamp(lower: number, upper: number): (number: number) => number; - clamp(lower: number, upper: number, number: number): number; - inRange( - start: number - ): ((end: number) => (number: number) => boolean) & - ((end: number, number: number) => boolean); - inRange(start: number, end: number): (number: number) => boolean; - inRange(start: number, end: number, number: number): boolean; - random(lower: number): (upper: number) => number; - random(lower: number, upper: number): number; - - // Object - assign(object: Object): (source: Object) => Object; - assign(object: Object, source: Object): Object; - assignAll(objects: Array<Object>): Object; - assignInAll(objects: Array<Object>): Object; - extendAll(objects: Array<Object>): Object; - assignIn<A, B>(a: A): (b: B) => A & B; - assignIn<A, B>(a: A, b: B): A & B; - assignInWith<T: Object, A: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void - ): ((object: T) => (s1: A) => Object) & ((object: T, s1: A) => Object); - assignInWith<T: Object, A: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void, - object: T - ): (s1: A) => Object; - assignInWith<T: Object, A: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void, - object: T, - s1: A - ): Object; - assignWith<T: Object, A: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void - ): ((object: T) => (s1: A) => Object) & ((object: T, s1: A) => Object); - assignWith<T: Object, A: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void, - object: T - ): (s1: A) => Object; - assignWith<T: Object, A: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void, - object: T, - s1: A - ): Object; - assignInAllWith( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: Object, - source: Object - ) => any | void - ): (objects: Array<Object>) => Object; - assignInAllWith( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: Object, - source: Object - ) => any | void, - objects: Array<Object> - ): Object; - extendAllWith( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: Object, - source: Object - ) => any | void - ): (objects: Array<Object>) => Object; - extendAllWith( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: Object, - source: Object - ) => any | void, - objects: Array<Object> - ): Object; - assignAllWith( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: Object, - source: Object - ) => any | void - ): (objects: Array<Object>) => Object; - assignAllWith( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: Object, - source: Object - ) => any | void, - objects: Array<Object> - ): Object; - at(paths: Array<string>): (object: Object) => Array<any>; - at(paths: Array<string>, object: Object): Array<any>; - 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>; - create<T>(prototype: T): $Supertype<T>; - defaults(source: Object): (object: Object) => Object; - defaults(source: Object, object: Object): Object; - defaultsAll(objects: Array<Object>): Object; - defaultsDeep(source: Object): (object: Object) => Object; - defaultsDeep(source: Object, object: Object): Object; - defaultsDeepAll(objects: Array<Object>): Object; - // alias for _.toPairs - entries(object: Object): Array<[string, any]>; - // alias for _.toPairsIn - entriesIn(object: Object): Array<[string, any]>; - // alias for _.assignIn - extend<A, B>(a: A): (b: B) => A & B; - extend<A, B>(a: A, b: B): A & B; - // alias for _.assignInWith - extendWith<T: Object, A: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void - ): ((object: T) => (s1: A) => Object) & ((object: T, s1: A) => Object); - extendWith<T: Object, A: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void, - object: T - ): (s1: A) => Object; - extendWith<T: Object, A: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A - ) => any | void, - object: T, - s1: A - ): Object; - findKey<A, T: { [id: any]: A }>( - predicate: OPredicate<A> - ): (object: T) => string | void; - findKey<A, T: { [id: any]: A }>( - predicate: OPredicate<A>, - object: T - ): string | void; - findLastKey<A, T: { [id: any]: A }>( - predicate: OPredicate<A> - ): (object: T) => string | void; - findLastKey<A, T: { [id: any]: A }>( - predicate: OPredicate<A>, - object: T - ): string | void; - forIn(iteratee: OIteratee<*>): (object: Object) => Object; - forIn(iteratee: OIteratee<*>, object: Object): Object; - forInRight(iteratee: OIteratee<*>): (object: Object) => Object; - forInRight(iteratee: OIteratee<*>, object: Object): Object; - forOwn(iteratee: OIteratee<*>): (object: Object) => Object; - forOwn(iteratee: OIteratee<*>, object: Object): Object; - forOwnRight(iteratee: OIteratee<*>): (object: Object) => Object; - forOwnRight(iteratee: OIteratee<*>, object: Object): Object; - functions(object: Object): Array<string>; - functionsIn(object: Object): Array<string>; - get(path: Array<string> | string): (object: Object | Array<any>) => any; - get(path: Array<string> | string, object: Object | Array<any>): any; - prop(path: Array<string> | string): (object: Object | Array<any>) => any; - prop(path: Array<string> | string, object: Object | Array<any>): any; - path(path: Array<string> | string): (object: Object | Array<any>) => any; - path(path: Array<string> | string, object: Object | Array<any>): any; - getOr( - defaultValue: any - ): (( - path: Array<string> | string - ) => (object: Object | Array<any>) => any) & - ((path: Array<string> | string, object: Object | Array<any>) => any); - getOr( - defaultValue: any, - path: Array<string> | string - ): (object: Object | Array<any>) => any; - getOr( - defaultValue: any, - path: Array<string> | string, - object: Object | Array<any> - ): any; - propOr( - defaultValue: any - ): (( - path: Array<string> | string - ) => (object: Object | Array<any>) => any) & - ((path: Array<string> | string, object: Object | Array<any>) => any); - propOr( - defaultValue: any, - path: Array<string> | string - ): (object: Object | Array<any>) => any; - propOr( - defaultValue: any, - path: Array<string> | string, - object: Object | Array<any> - ): any; - pathOr( - defaultValue: any - ): (( - path: Array<string> | string - ) => (object: Object | Array<any>) => any) & - ((path: Array<string> | string, object: Object | Array<any>) => any); - pathOr( - defaultValue: any, - path: Array<string> | string - ): (object: Object | Array<any>) => any; - pathOr( - defaultValue: any, - path: Array<string> | string, - object: Object | Array<any> - ): any; - has(path: Array<string> | string): (object: Object) => boolean; - has(path: Array<string> | string, object: Object): boolean; - hasIn(path: Array<string> | string): (object: Object) => boolean; - hasIn(path: Array<string> | string, object: Object): boolean; - invert(object: Object): Object; - invertObj(object: Object): Object; - invertBy(iteratee: Function): (object: Object) => Object; - invertBy(iteratee: Function, object: Object): Object; - invoke(path: Array<string> | string): (object: Object) => any; - invoke(path: Array<string> | string, object: Object): any; - invokeArgs( - path: Array<string> | string - ): ((object: Object) => (args: Array<any>) => any) & - ((object: Object, args: Array<any>) => any); - invokeArgs( - path: Array<string> | string, - object: Object - ): (args: Array<any>) => any; - invokeArgs( - path: Array<string> | string, - object: Object, - args: Array<any> - ): any; - keys<K>(object: { [key: K]: any }): Array<K>; - keys(object: Object): Array<string>; - keysIn(object: Object): Array<string>; - mapKeys(iteratee: OIteratee<*>): (object: Object) => Object; - mapKeys(iteratee: OIteratee<*>, object: Object): Object; - mapValues(iteratee: OIteratee<*>): (object: Object) => Object; - mapValues(iteratee: OIteratee<*>, object: Object): Object; - merge(object: Object): (source: Object) => Object; - merge(object: Object, source: Object): Object; - mergeAll(objects: Array<Object>): Object; - mergeWith<T: Object, A: Object, B: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B - ) => any | void - ): ((object: T) => (s1: A) => Object) & ((object: T, s1: A) => Object); - mergeWith<T: Object, A: Object, B: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B - ) => any | void, - object: T - ): (s1: A) => Object; - mergeWith<T: Object, A: Object, B: Object>( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: T, - source: A | B - ) => any | void, - object: T, - s1: A - ): Object; - mergeAllWith( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: Object, - source: Object - ) => any | void - ): (objects: Array<Object>) => Object; - mergeAllWith( - customizer: ( - objValue: any, - srcValue: any, - key: string, - object: Object, - source: Object - ) => any | void, - objects: Array<Object> - ): Object; - omit(props: Array<string>): (object: Object) => Object; - omit(props: Array<string>, object: Object): Object; - omitAll(props: Array<string>): (object: Object) => Object; - omitAll(props: Array<string>, object: Object): Object; - omitBy<A, T: { [id: any]: A }>( - predicate: OPredicate<A> - ): (object: T) => Object; - omitBy<A, T: { [id: any]: A }>(predicate: OPredicate<A>, object: T): Object; - pick(props: Array<string>): (object: Object) => Object; - pick(props: Array<string>, object: Object): Object; - pickAll(props: Array<string>): (object: Object) => Object; - pickAll(props: Array<string>, object: Object): Object; - pickBy<A, T: { [id: any]: A }>( - predicate: OPredicate<A> - ): (object: T) => Object; - pickBy<A, T: { [id: any]: A }>(predicate: OPredicate<A>, object: T): Object; - result(path: Array<string> | string): (object: Object) => any; - result(path: Array<string> | string, object: Object): any; - set( - path: Array<string> | string - ): ((value: any) => (object: Object) => Object) & - ((value: any, object: Object) => Object); - set(path: Array<string> | string, value: any): (object: Object) => Object; - set(path: Array<string> | string, value: any, object: Object): Object; - assoc( - path: Array<string> | string - ): ((value: any) => (object: Object) => Object) & - ((value: any, object: Object) => Object); - assoc(path: Array<string> | string, value: any): (object: Object) => Object; - assoc(path: Array<string> | string, value: any, object: Object): Object; - assocPath( - path: Array<string> | string - ): ((value: any) => (object: Object) => Object) & - ((value: any, object: Object) => Object); - assocPath( - path: Array<string> | string, - value: any - ): (object: Object) => Object; - assocPath(path: Array<string> | string, value: any, object: Object): Object; - setWith<T>( - customizer: (nsValue: any, key: string, nsObject: T) => any - ): (( - path: Array<string> | string - ) => ((value: any) => (object: T) => Object) & - ((value: any, object: T) => Object)) & - ((path: Array<string> | string, value: any) => (object: T) => Object) & - ((path: Array<string> | string, value: any, object: T) => Object); - setWith<T>( - customizer: (nsValue: any, key: string, nsObject: T) => any, - path: Array<string> | string - ): ((value: any) => (object: T) => Object) & - ((value: any, object: T) => Object); - setWith<T>( - customizer: (nsValue: any, key: string, nsObject: T) => any, - path: Array<string> | string, - value: any - ): (object: T) => Object; - setWith<T>( - customizer: (nsValue: any, key: string, nsObject: T) => any, - path: Array<string> | string, - value: any, - object: T - ): Object; - toPairs(object: Object | Array<*>): Array<[string, any]>; - toPairsIn(object: Object): Array<[string, any]>; - transform( - iteratee: OIteratee<*> - ): ((accumulator: any) => (collection: Object | Array<any>) => any) & - ((accumulator: any, collection: Object | Array<any>) => any); - transform( - iteratee: OIteratee<*>, - accumulator: any - ): (collection: Object | Array<any>) => any; - transform( - iteratee: OIteratee<*>, - accumulator: any, - collection: Object | Array<any> - ): any; - unset(path: Array<string> | string): (object: Object) => boolean; - unset(path: Array<string> | string, object: Object): boolean; - dissoc(path: Array<string> | string): (object: Object) => boolean; - dissoc(path: Array<string> | string, object: Object): boolean; - dissocPath(path: Array<string> | string): (object: Object) => boolean; - dissocPath(path: Array<string> | string, object: Object): boolean; - update( - path: string[] | string - ): ((updater: Function) => (object: Object) => Object) & - ((updater: Function, object: Object) => Object); - update( - path: string[] | string, - updater: Function - ): (object: Object) => Object; - update(path: string[] | string, updater: Function, object: Object): Object; - updateWith( - customizer: Function - ): (( - path: string[] | string - ) => ((updater: Function) => (object: Object) => Object) & - ((updater: Function, object: Object) => Object)) & - (( - path: string[] | string, - updater: Function - ) => (object: Object) => Object) & - ((path: string[] | string, updater: Function, object: Object) => Object); - updateWith( - customizer: Function, - path: string[] | string - ): ((updater: Function) => (object: Object) => Object) & - ((updater: Function, object: Object) => Object); - updateWith( - customizer: Function, - path: string[] | string, - updater: Function - ): (object: Object) => Object; - updateWith( - customizer: Function, - path: string[] | string, - updater: Function, - object: Object - ): Object; - values(object: Object): Array<any>; - valuesIn(object: Object): Array<any>; - - tap<T>(interceptor: (value: T) => any): (value: T) => T; - tap<T>(interceptor: (value: T) => any, value: T): T; - thru<T1, T2>(interceptor: (value: T1) => T2): (value: T1) => T2; - thru<T1, T2>(interceptor: (value: T1) => T2, value: T1): T2; - - // String - camelCase(string: string): string; - capitalize(string: string): string; - deburr(string: string): string; - endsWith(target: string): (string: string) => boolean; - endsWith(target: string, string: string): boolean; - escape(string: string): string; - escapeRegExp(string: string): string; - kebabCase(string: string): string; - lowerCase(string: string): string; - lowerFirst(string: string): string; - pad(length: number): (string: string) => string; - pad(length: number, string: string): string; - padChars( - chars: string - ): ((length: number) => (string: string) => string) & - ((length: number, string: string) => string); - padChars(chars: string, length: number): (string: string) => string; - padChars(chars: string, length: number, string: string): string; - padEnd(length: number): (string: string) => string; - padEnd(length: number, string: string): string; - padCharsEnd( - chars: string - ): ((length: number) => (string: string) => string) & - ((length: number, string: string) => string); - padCharsEnd(chars: string, length: number): (string: string) => string; - padCharsEnd(chars: string, length: number, string: string): string; - padStart(length: number): (string: string) => string; - padStart(length: number, string: string): string; - padCharsStart( - chars: string - ): ((length: number) => (string: string) => string) & - ((length: number, string: string) => string); - padCharsStart(chars: string, length: number): (string: string) => string; - padCharsStart(chars: string, length: number, string: string): string; - parseInt(radix: number): (string: string) => number; - parseInt(radix: number, string: string): number; - repeat(n: number): (string: string) => string; - repeat(n: number, string: string): string; - replace( - pattern: RegExp | string - ): (( - replacement: ((string: string) => string) | string - ) => (string: string) => string) & - (( - replacement: ((string: string) => string) | string, - string: string - ) => string); - replace( - pattern: RegExp | string, - replacement: ((string: string) => string) | string - ): (string: string) => string; - replace( - pattern: RegExp | string, - replacement: ((string: string) => string) | string, - string: string - ): string; - snakeCase(string: string): string; - split(separator: RegExp | string): (string: string) => Array<string>; - split(separator: RegExp | string, string: string): Array<string>; - startCase(string: string): string; - startsWith(target: string): (string: string) => boolean; - startsWith(target: string, string: string): boolean; - template(string: string): Function; - toLower(string: string): string; - toUpper(string: string): string; - trim(string: string): string; - trimChars(chars: string): (string: string) => string; - trimChars(chars: string, string: string): string; - trimEnd(string: string): string; - trimCharsEnd(chars: string): (string: string) => string; - trimCharsEnd(chars: string, string: string): string; - trimStart(string: string): string; - trimCharsStart(chars: string): (string: string) => string; - trimCharsStart(chars: string, string: string): string; - truncate(options: TruncateOptions): (string: string) => string; - truncate(options: TruncateOptions, string: string): string; - unescape(string: string): string; - upperCase(string: string): string; - upperFirst(string: string): string; - words(string: string): Array<string>; - - // Util - attempt(func: Function): any; - bindAll(methodNames: Array<string>): (object: Object) => Object; - bindAll(methodNames: Array<string>, object: Object): Object; - cond(pairs: NestedArray<Function>): Function; - constant<T>(value: T): () => T; - always<T>(value: T): () => T; - defaultTo<T1: string | boolean | Object, T2>( - defaultValue: T2 - ): (value: T1) => T1; - defaultTo<T1: string | boolean | Object, T2>( - defaultValue: T2, - value: T1 - ): T1; - // NaN is a number instead of its own type, otherwise it would behave like null/void - defaultTo<T1: number, T2>(defaultValue: T2): (value: T1) => T1 | T2; - defaultTo<T1: number, T2>(defaultValue: T2, value: T1): T1 | T2; - defaultTo<T1: void | null, T2>(defaultValue: T2): (value: T1) => T2; - defaultTo<T1: void | null, T2>(defaultValue: T2, value: T1): T2; - flow: $ComposeReverse; - flow(funcs: Array<Function>): Function; - pipe: $ComposeReverse; - pipe(funcs: Array<Function>): Function; - flowRight: $Compose; - flowRight(funcs: Array<Function>): Function; - compose: $Compose; - compose(funcs: Array<Function>): Function; - identity<T>(value: T): T; - iteratee(func: any): Function; - matches(source: Object): (object: Object) => boolean; - matches(source: Object, object: Object): boolean; - matchesProperty(path: Array<string> | string): (srcValue: any) => Function; - matchesProperty(path: Array<string> | string, srcValue: any): Function; - propEq(path: Array<string> | string): (srcValue: any) => Function; - propEq(path: Array<string> | string, srcValue: any): Function; - pathEq(path: Array<string> | string): (srcValue: any) => Function; - pathEq(path: Array<string> | string, srcValue: any): Function; - method(path: Array<string> | string): Function; - methodOf(object: Object): Function; - mixin<T: Function | Object>( - object: T - ): ((source: Object) => (options: { chain: boolean }) => T) & - ((source: Object, options: { chain: boolean }) => T); - mixin<T: Function | Object>( - object: T, - source: Object - ): (options: { chain: boolean }) => T; - mixin<T: Function | Object>( - object: T, - source: Object, - options: { chain: boolean } - ): T; - noConflict(): Lodash; - noop(...args: Array<mixed>): void; - nthArg(n: number): Function; - over(iteratees: Array<Function>): Function; - juxt(iteratees: Array<Function>): Function; - overEvery(predicates: Array<Function>): Function; - allPass(predicates: Array<Function>): Function; - overSome(predicates: Array<Function>): Function; - anyPass(predicates: Array<Function>): Function; - property( - path: Array<string> | string - ): (object: Object | Array<any>) => any; - property(path: Array<string> | string, object: Object | Array<any>): any; - propertyOf(object: Object): (path: Array<string> | string) => Function; - propertyOf(object: Object, path: Array<string> | string): Function; - range(start: number): (end: number) => Array<number>; - range(start: number, end: number): Array<number>; - rangeStep( - step: number - ): ((start: number) => (end: number) => Array<number>) & - ((start: number, end: number) => Array<number>); - rangeStep(step: number, start: number): (end: number) => Array<number>; - rangeStep(step: number, start: number, end: number): Array<number>; - rangeRight(start: number): (end: number) => Array<number>; - rangeRight(start: number, end: number): Array<number>; - rangeStepRight( - step: number - ): ((start: number) => (end: number) => Array<number>) & - ((start: number, end: number) => Array<number>); - rangeStepRight(step: number, start: number): (end: number) => Array<number>; - rangeStepRight(step: number, start: number, end: number): Array<number>; - runInContext(context: Object): Function; - - stubArray(): Array<*>; - stubFalse(): false; - F(): false; - stubObject(): {}; - stubString(): ""; - stubTrue(): true; - T(): true; - times<T>(iteratee: (i: number) => T): (n: number) => Array<T>; - times<T>(iteratee: (i: number) => T, n: number): Array<T>; - toPath(value: any): Array<string>; - uniqueId(prefix: string): string; - - __: any; - placeholder: any; - - convert(options: { - cap?: boolean, - curry?: boolean, - fixed?: boolean, - immutable?: boolean, - rearg?: boolean - }): void; - - // Properties - VERSION: string; - templateSettings: TemplateSettings; - } - - declare module.exports: Lodash; -} - -declare module "lodash/chunk" { - declare module.exports: $PropertyType<$Exports<"lodash">, "chunk">; -} - -declare module "lodash/compact" { - declare module.exports: $PropertyType<$Exports<"lodash">, "compact">; -} - -declare module "lodash/concat" { - declare module.exports: $PropertyType<$Exports<"lodash">, "concat">; -} - -declare module "lodash/difference" { - declare module.exports: $PropertyType<$Exports<"lodash">, "difference">; -} - -declare module "lodash/differenceBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "differenceBy">; -} - -declare module "lodash/differenceWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "differenceWith">; -} - -declare module "lodash/drop" { - declare module.exports: $PropertyType<$Exports<"lodash">, "drop">; -} - -declare module "lodash/dropRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "dropRight">; -} - -declare module "lodash/dropRightWhile" { - declare module.exports: $PropertyType<$Exports<"lodash">, "dropRightWhile">; -} - -declare module "lodash/dropWhile" { - declare module.exports: $PropertyType<$Exports<"lodash">, "dropWhile">; -} - -declare module "lodash/fill" { - declare module.exports: $PropertyType<$Exports<"lodash">, "fill">; -} - -declare module "lodash/findIndex" { - declare module.exports: $PropertyType<$Exports<"lodash">, "findIndex">; -} - -declare module "lodash/findLastIndex" { - declare module.exports: $PropertyType<$Exports<"lodash">, "findLastIndex">; -} - -declare module "lodash/first" { - declare module.exports: $PropertyType<$Exports<"lodash">, "first">; -} - -declare module "lodash/flatten" { - declare module.exports: $PropertyType<$Exports<"lodash">, "flatten">; -} - -declare module "lodash/flattenDeep" { - declare module.exports: $PropertyType<$Exports<"lodash">, "flattenDeep">; -} - -declare module "lodash/flattenDepth" { - declare module.exports: $PropertyType<$Exports<"lodash">, "flattenDepth">; -} - -declare module "lodash/fromPairs" { - declare module.exports: $PropertyType<$Exports<"lodash">, "fromPairs">; -} - -declare module "lodash/head" { - declare module.exports: $PropertyType<$Exports<"lodash">, "head">; -} - -declare module "lodash/indexOf" { - declare module.exports: $PropertyType<$Exports<"lodash">, "indexOf">; -} - -declare module "lodash/initial" { - declare module.exports: $PropertyType<$Exports<"lodash">, "initial">; -} - -declare module "lodash/intersection" { - declare module.exports: $PropertyType<$Exports<"lodash">, "intersection">; -} - -declare module "lodash/intersectionBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "intersectionBy">; -} - -declare module "lodash/intersectionWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "intersectionWith">; -} - -declare module "lodash/join" { - declare module.exports: $PropertyType<$Exports<"lodash">, "join">; -} - -declare module "lodash/last" { - declare module.exports: $PropertyType<$Exports<"lodash">, "last">; -} - -declare module "lodash/lastIndexOf" { - declare module.exports: $PropertyType<$Exports<"lodash">, "lastIndexOf">; -} - -declare module "lodash/nth" { - declare module.exports: $PropertyType<$Exports<"lodash">, "nth">; -} - -declare module "lodash/pull" { - declare module.exports: $PropertyType<$Exports<"lodash">, "pull">; -} - -declare module "lodash/pullAll" { - declare module.exports: $PropertyType<$Exports<"lodash">, "pullAll">; -} - -declare module "lodash/pullAllBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "pullAllBy">; -} - -declare module "lodash/pullAllWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "pullAllWith">; -} - -declare module "lodash/pullAt" { - declare module.exports: $PropertyType<$Exports<"lodash">, "pullAt">; -} - -declare module "lodash/remove" { - declare module.exports: $PropertyType<$Exports<"lodash">, "remove">; -} - -declare module "lodash/reverse" { - declare module.exports: $PropertyType<$Exports<"lodash">, "reverse">; -} - -declare module "lodash/slice" { - declare module.exports: $PropertyType<$Exports<"lodash">, "slice">; -} - -declare module "lodash/sortedIndex" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sortedIndex">; -} - -declare module "lodash/sortedIndexBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sortedIndexBy">; -} - -declare module "lodash/sortedIndexOf" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sortedIndexOf">; -} - -declare module "lodash/sortedLastIndex" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sortedLastIndex">; -} - -declare module "lodash/sortedLastIndexBy" { - declare module.exports: $PropertyType< - $Exports<"lodash">, - "sortedLastIndexBy" - >; -} - -declare module "lodash/sortedLastIndexOf" { - declare module.exports: $PropertyType< - $Exports<"lodash">, - "sortedLastIndexOf" - >; -} - -declare module "lodash/sortedUniq" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sortedUniq">; -} - -declare module "lodash/sortedUniqBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sortedUniqBy">; -} - -declare module "lodash/tail" { - declare module.exports: $PropertyType<$Exports<"lodash">, "tail">; -} - -declare module "lodash/take" { - declare module.exports: $PropertyType<$Exports<"lodash">, "take">; -} - -declare module "lodash/takeRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "takeRight">; -} - -declare module "lodash/takeRightWhile" { - declare module.exports: $PropertyType<$Exports<"lodash">, "takeRightWhile">; -} - -declare module "lodash/takeWhile" { - declare module.exports: $PropertyType<$Exports<"lodash">, "takeWhile">; -} - -declare module "lodash/union" { - declare module.exports: $PropertyType<$Exports<"lodash">, "union">; -} - -declare module "lodash/unionBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "unionBy">; -} - -declare module "lodash/unionWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "unionWith">; -} - -declare module "lodash/uniq" { - declare module.exports: $PropertyType<$Exports<"lodash">, "uniq">; -} - -declare module "lodash/uniqBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "uniqBy">; -} - -declare module "lodash/uniqWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "uniqWith">; -} - -declare module "lodash/unzip" { - declare module.exports: $PropertyType<$Exports<"lodash">, "unzip">; -} - -declare module "lodash/unzipWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "unzipWith">; -} - -declare module "lodash/without" { - declare module.exports: $PropertyType<$Exports<"lodash">, "without">; -} - -declare module "lodash/xor" { - declare module.exports: $PropertyType<$Exports<"lodash">, "xor">; -} - -declare module "lodash/xorBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "xorBy">; -} - -declare module "lodash/xorWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "xorWith">; -} - -declare module "lodash/zip" { - declare module.exports: $PropertyType<$Exports<"lodash">, "zip">; -} - -declare module "lodash/zipObject" { - declare module.exports: $PropertyType<$Exports<"lodash">, "zipObject">; -} - -declare module "lodash/zipObjectDeep" { - declare module.exports: $PropertyType<$Exports<"lodash">, "zipObjectDeep">; -} - -declare module "lodash/zipWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "zipWith">; -} - -declare module "lodash/countBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "countBy">; -} - -declare module "lodash/each" { - declare module.exports: $PropertyType<$Exports<"lodash">, "each">; -} - -declare module "lodash/eachRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "eachRight">; -} - -declare module "lodash/every" { - declare module.exports: $PropertyType<$Exports<"lodash">, "every">; -} - -declare module "lodash/filter" { - declare module.exports: $PropertyType<$Exports<"lodash">, "filter">; -} - -declare module "lodash/find" { - declare module.exports: $PropertyType<$Exports<"lodash">, "find">; -} - -declare module "lodash/findLast" { - declare module.exports: $PropertyType<$Exports<"lodash">, "findLast">; -} - -declare module "lodash/flatMap" { - declare module.exports: $PropertyType<$Exports<"lodash">, "flatMap">; -} - -declare module "lodash/flatMapDeep" { - declare module.exports: $PropertyType<$Exports<"lodash">, "flatMapDeep">; -} - -declare module "lodash/flatMapDepth" { - declare module.exports: $PropertyType<$Exports<"lodash">, "flatMapDepth">; -} - -declare module "lodash/forEach" { - declare module.exports: $PropertyType<$Exports<"lodash">, "forEach">; -} - -declare module "lodash/forEachRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "forEachRight">; -} - -declare module "lodash/groupBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "groupBy">; -} - -declare module "lodash/includes" { - declare module.exports: $PropertyType<$Exports<"lodash">, "includes">; -} - -declare module "lodash/invokeMap" { - declare module.exports: $PropertyType<$Exports<"lodash">, "invokeMap">; -} - -declare module "lodash/keyBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "keyBy">; -} - -declare module "lodash/map" { - declare module.exports: $PropertyType<$Exports<"lodash">, "map">; -} - -declare module "lodash/orderBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "orderBy">; -} - -declare module "lodash/partition" { - declare module.exports: $PropertyType<$Exports<"lodash">, "partition">; -} - -declare module "lodash/reduce" { - declare module.exports: $PropertyType<$Exports<"lodash">, "reduce">; -} - -declare module "lodash/reduceRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "reduceRight">; -} - -declare module "lodash/reject" { - declare module.exports: $PropertyType<$Exports<"lodash">, "reject">; -} - -declare module "lodash/sample" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sample">; -} - -declare module "lodash/sampleSize" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sampleSize">; -} - -declare module "lodash/shuffle" { - declare module.exports: $PropertyType<$Exports<"lodash">, "shuffle">; -} - -declare module "lodash/size" { - declare module.exports: $PropertyType<$Exports<"lodash">, "size">; -} - -declare module "lodash/some" { - declare module.exports: $PropertyType<$Exports<"lodash">, "some">; -} - -declare module "lodash/sortBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sortBy">; -} - -declare module "lodash/now" { - declare module.exports: $PropertyType<$Exports<"lodash">, "now">; -} - -declare module "lodash/after" { - declare module.exports: $PropertyType<$Exports<"lodash">, "after">; -} - -declare module "lodash/ary" { - declare module.exports: $PropertyType<$Exports<"lodash">, "ary">; -} - -declare module "lodash/before" { - declare module.exports: $PropertyType<$Exports<"lodash">, "before">; -} - -declare module "lodash/bind" { - declare module.exports: $PropertyType<$Exports<"lodash">, "bind">; -} - -declare module "lodash/bindKey" { - declare module.exports: $PropertyType<$Exports<"lodash">, "bindKey">; -} - -declare module "lodash/curry" { - declare module.exports: $PropertyType<$Exports<"lodash">, "curry">; -} - -declare module "lodash/curryRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "curryRight">; -} - -declare module "lodash/debounce" { - declare module.exports: $PropertyType<$Exports<"lodash">, "debounce">; -} - -declare module "lodash/defer" { - declare module.exports: $PropertyType<$Exports<"lodash">, "defer">; -} - -declare module "lodash/delay" { - declare module.exports: $PropertyType<$Exports<"lodash">, "delay">; -} - -declare module "lodash/flip" { - declare module.exports: $PropertyType<$Exports<"lodash">, "flip">; -} - -declare module "lodash/memoize" { - declare module.exports: $PropertyType<$Exports<"lodash">, "memoize">; -} - -declare module "lodash/negate" { - declare module.exports: $PropertyType<$Exports<"lodash">, "negate">; -} - -declare module "lodash/once" { - declare module.exports: $PropertyType<$Exports<"lodash">, "once">; -} - -declare module "lodash/overArgs" { - declare module.exports: $PropertyType<$Exports<"lodash">, "overArgs">; -} - -declare module "lodash/partial" { - declare module.exports: $PropertyType<$Exports<"lodash">, "partial">; -} - -declare module "lodash/partialRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "partialRight">; -} - -declare module "lodash/rearg" { - declare module.exports: $PropertyType<$Exports<"lodash">, "rearg">; -} - -declare module "lodash/rest" { - declare module.exports: $PropertyType<$Exports<"lodash">, "rest">; -} - -declare module "lodash/spread" { - declare module.exports: $PropertyType<$Exports<"lodash">, "spread">; -} - -declare module "lodash/throttle" { - declare module.exports: $PropertyType<$Exports<"lodash">, "throttle">; -} - -declare module "lodash/unary" { - declare module.exports: $PropertyType<$Exports<"lodash">, "unary">; -} - -declare module "lodash/wrap" { - declare module.exports: $PropertyType<$Exports<"lodash">, "wrap">; -} - -declare module "lodash/castArray" { - declare module.exports: $PropertyType<$Exports<"lodash">, "castArray">; -} - -declare module "lodash/clone" { - declare module.exports: $PropertyType<$Exports<"lodash">, "clone">; -} - -declare module "lodash/cloneDeep" { - declare module.exports: $PropertyType<$Exports<"lodash">, "cloneDeep">; -} - -declare module "lodash/cloneDeepWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "cloneDeepWith">; -} - -declare module "lodash/cloneWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "cloneWith">; -} - -declare module "lodash/conformsTo" { - declare module.exports: $PropertyType<$Exports<"lodash">, "conformsTo">; -} - -declare module "lodash/eq" { - declare module.exports: $PropertyType<$Exports<"lodash">, "eq">; -} - -declare module "lodash/gt" { - declare module.exports: $PropertyType<$Exports<"lodash">, "gt">; -} - -declare module "lodash/gte" { - declare module.exports: $PropertyType<$Exports<"lodash">, "gte">; -} - -declare module "lodash/isArguments" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isArguments">; -} - -declare module "lodash/isArray" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isArray">; -} - -declare module "lodash/isArrayBuffer" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isArrayBuffer">; -} - -declare module "lodash/isArrayLike" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isArrayLike">; -} - -declare module "lodash/isArrayLikeObject" { - declare module.exports: $PropertyType< - $Exports<"lodash">, - "isArrayLikeObject" - >; -} - -declare module "lodash/isBoolean" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isBoolean">; -} - -declare module "lodash/isBuffer" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isBuffer">; -} - -declare module "lodash/isDate" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isDate">; -} - -declare module "lodash/isElement" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isElement">; -} - -declare module "lodash/isEmpty" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isEmpty">; -} - -declare module "lodash/isEqual" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isEqual">; -} - -declare module "lodash/isEqualWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isEqualWith">; -} - -declare module "lodash/isError" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isError">; -} - -declare module "lodash/isFinite" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isFinite">; -} - -declare module "lodash/isFunction" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isFunction">; -} - -declare module "lodash/isInteger" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isInteger">; -} - -declare module "lodash/isLength" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isLength">; -} - -declare module "lodash/isMap" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isMap">; -} - -declare module "lodash/isMatch" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isMatch">; -} - -declare module "lodash/isMatchWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isMatchWith">; -} - -declare module "lodash/isNaN" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isNaN">; -} - -declare module "lodash/isNative" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isNative">; -} - -declare module "lodash/isNil" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isNil">; -} - -declare module "lodash/isNull" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isNull">; -} - -declare module "lodash/isNumber" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isNumber">; -} - -declare module "lodash/isObject" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isObject">; -} - -declare module "lodash/isObjectLike" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isObjectLike">; -} - -declare module "lodash/isPlainObject" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isPlainObject">; -} - -declare module "lodash/isRegExp" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isRegExp">; -} - -declare module "lodash/isSafeInteger" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isSafeInteger">; -} - -declare module "lodash/isSet" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isSet">; -} - -declare module "lodash/isString" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isString">; -} - -declare module "lodash/isSymbol" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isSymbol">; -} - -declare module "lodash/isTypedArray" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isTypedArray">; -} - -declare module "lodash/isUndefined" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isUndefined">; -} - -declare module "lodash/isWeakMap" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isWeakMap">; -} - -declare module "lodash/isWeakSet" { - declare module.exports: $PropertyType<$Exports<"lodash">, "isWeakSet">; -} - -declare module "lodash/lt" { - declare module.exports: $PropertyType<$Exports<"lodash">, "lt">; -} - -declare module "lodash/lte" { - declare module.exports: $PropertyType<$Exports<"lodash">, "lte">; -} - -declare module "lodash/toArray" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toArray">; -} - -declare module "lodash/toFinite" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toFinite">; -} - -declare module "lodash/toInteger" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toInteger">; -} - -declare module "lodash/toLength" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toLength">; -} - -declare module "lodash/toNumber" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toNumber">; -} - -declare module "lodash/toPlainObject" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toPlainObject">; -} - -declare module "lodash/toSafeInteger" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toSafeInteger">; -} - -declare module "lodash/toString" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toString">; -} - -declare module "lodash/add" { - declare module.exports: $PropertyType<$Exports<"lodash">, "add">; -} - -declare module "lodash/ceil" { - declare module.exports: $PropertyType<$Exports<"lodash">, "ceil">; -} - -declare module "lodash/divide" { - declare module.exports: $PropertyType<$Exports<"lodash">, "divide">; -} - -declare module "lodash/floor" { - declare module.exports: $PropertyType<$Exports<"lodash">, "floor">; -} - -declare module "lodash/max" { - declare module.exports: $PropertyType<$Exports<"lodash">, "max">; -} - -declare module "lodash/maxBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "maxBy">; -} - -declare module "lodash/mean" { - declare module.exports: $PropertyType<$Exports<"lodash">, "mean">; -} - -declare module "lodash/meanBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "meanBy">; -} - -declare module "lodash/min" { - declare module.exports: $PropertyType<$Exports<"lodash">, "min">; -} - -declare module "lodash/minBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "minBy">; -} - -declare module "lodash/multiply" { - declare module.exports: $PropertyType<$Exports<"lodash">, "multiply">; -} - -declare module "lodash/round" { - declare module.exports: $PropertyType<$Exports<"lodash">, "round">; -} - -declare module "lodash/subtract" { - declare module.exports: $PropertyType<$Exports<"lodash">, "subtract">; -} - -declare module "lodash/sum" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sum">; -} - -declare module "lodash/sumBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "sumBy">; -} - -declare module "lodash/clamp" { - declare module.exports: $PropertyType<$Exports<"lodash">, "clamp">; -} - -declare module "lodash/inRange" { - declare module.exports: $PropertyType<$Exports<"lodash">, "inRange">; -} - -declare module "lodash/random" { - declare module.exports: $PropertyType<$Exports<"lodash">, "random">; -} - -declare module "lodash/assign" { - declare module.exports: $PropertyType<$Exports<"lodash">, "assign">; -} - -declare module "lodash/assignIn" { - declare module.exports: $PropertyType<$Exports<"lodash">, "assignIn">; -} - -declare module "lodash/assignInWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "assignInWith">; -} - -declare module "lodash/assignWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "assignWith">; -} - -declare module "lodash/at" { - declare module.exports: $PropertyType<$Exports<"lodash">, "at">; -} - -declare module "lodash/create" { - declare module.exports: $PropertyType<$Exports<"lodash">, "create">; -} - -declare module "lodash/defaults" { - declare module.exports: $PropertyType<$Exports<"lodash">, "defaults">; -} - -declare module "lodash/defaultsDeep" { - declare module.exports: $PropertyType<$Exports<"lodash">, "defaultsDeep">; -} - -declare module "lodash/entries" { - declare module.exports: $PropertyType<$Exports<"lodash">, "entries">; -} - -declare module "lodash/entriesIn" { - declare module.exports: $PropertyType<$Exports<"lodash">, "entriesIn">; -} - -declare module "lodash/extend" { - declare module.exports: $PropertyType<$Exports<"lodash">, "extend">; -} - -declare module "lodash/extendWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "extendWith">; -} - -declare module "lodash/findKey" { - declare module.exports: $PropertyType<$Exports<"lodash">, "findKey">; -} - -declare module "lodash/findLastKey" { - declare module.exports: $PropertyType<$Exports<"lodash">, "findLastKey">; -} - -declare module "lodash/forIn" { - declare module.exports: $PropertyType<$Exports<"lodash">, "forIn">; -} - -declare module "lodash/forInRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "forInRight">; -} - -declare module "lodash/forOwn" { - declare module.exports: $PropertyType<$Exports<"lodash">, "forOwn">; -} - -declare module "lodash/forOwnRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "forOwnRight">; -} - -declare module "lodash/functions" { - declare module.exports: $PropertyType<$Exports<"lodash">, "functions">; -} - -declare module "lodash/functionsIn" { - declare module.exports: $PropertyType<$Exports<"lodash">, "functionsIn">; -} - -declare module "lodash/get" { - declare module.exports: $PropertyType<$Exports<"lodash">, "get">; -} - -declare module "lodash/has" { - declare module.exports: $PropertyType<$Exports<"lodash">, "has">; -} - -declare module "lodash/hasIn" { - declare module.exports: $PropertyType<$Exports<"lodash">, "hasIn">; -} - -declare module "lodash/invert" { - declare module.exports: $PropertyType<$Exports<"lodash">, "invert">; -} - -declare module "lodash/invertBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "invertBy">; -} - -declare module "lodash/invoke" { - declare module.exports: $PropertyType<$Exports<"lodash">, "invoke">; -} - -declare module "lodash/keys" { - declare module.exports: $PropertyType<$Exports<"lodash">, "keys">; -} - -declare module "lodash/keysIn" { - declare module.exports: $PropertyType<$Exports<"lodash">, "keysIn">; -} - -declare module "lodash/mapKeys" { - declare module.exports: $PropertyType<$Exports<"lodash">, "mapKeys">; -} - -declare module "lodash/mapValues" { - declare module.exports: $PropertyType<$Exports<"lodash">, "mapValues">; -} - -declare module "lodash/merge" { - declare module.exports: $PropertyType<$Exports<"lodash">, "merge">; -} - -declare module "lodash/mergeWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "mergeWith">; -} - -declare module "lodash/omit" { - declare module.exports: $PropertyType<$Exports<"lodash">, "omit">; -} - -declare module "lodash/omitBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "omitBy">; -} - -declare module "lodash/pick" { - declare module.exports: $PropertyType<$Exports<"lodash">, "pick">; -} - -declare module "lodash/pickBy" { - declare module.exports: $PropertyType<$Exports<"lodash">, "pickBy">; -} - -declare module "lodash/result" { - declare module.exports: $PropertyType<$Exports<"lodash">, "result">; -} - -declare module "lodash/set" { - declare module.exports: $PropertyType<$Exports<"lodash">, "set">; -} - -declare module "lodash/setWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "setWith">; -} - -declare module "lodash/toPairs" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toPairs">; -} - -declare module "lodash/toPairsIn" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toPairsIn">; -} - -declare module "lodash/transform" { - declare module.exports: $PropertyType<$Exports<"lodash">, "transform">; -} - -declare module "lodash/unset" { - declare module.exports: $PropertyType<$Exports<"lodash">, "unset">; -} - -declare module "lodash/update" { - declare module.exports: $PropertyType<$Exports<"lodash">, "update">; -} - -declare module "lodash/updateWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "updateWith">; -} - -declare module "lodash/values" { - declare module.exports: $PropertyType<$Exports<"lodash">, "values">; -} - -declare module "lodash/valuesIn" { - declare module.exports: $PropertyType<$Exports<"lodash">, "valuesIn">; -} - -declare module "lodash/chain" { - declare module.exports: $PropertyType<$Exports<"lodash">, "chain">; -} - -declare module "lodash/tap" { - declare module.exports: $PropertyType<$Exports<"lodash">, "tap">; -} - -declare module "lodash/thru" { - declare module.exports: $PropertyType<$Exports<"lodash">, "thru">; -} - -declare module "lodash/camelCase" { - declare module.exports: $PropertyType<$Exports<"lodash">, "camelCase">; -} - -declare module "lodash/capitalize" { - declare module.exports: $PropertyType<$Exports<"lodash">, "capitalize">; -} - -declare module "lodash/deburr" { - declare module.exports: $PropertyType<$Exports<"lodash">, "deburr">; -} - -declare module "lodash/endsWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "endsWith">; -} - -declare module "lodash/escape" { - declare module.exports: $PropertyType<$Exports<"lodash">, "escape">; -} - -declare module "lodash/escapeRegExp" { - declare module.exports: $PropertyType<$Exports<"lodash">, "escapeRegExp">; -} - -declare module "lodash/kebabCase" { - declare module.exports: $PropertyType<$Exports<"lodash">, "kebabCase">; -} - -declare module "lodash/lowerCase" { - declare module.exports: $PropertyType<$Exports<"lodash">, "lowerCase">; -} - -declare module "lodash/lowerFirst" { - declare module.exports: $PropertyType<$Exports<"lodash">, "lowerFirst">; -} - -declare module "lodash/pad" { - declare module.exports: $PropertyType<$Exports<"lodash">, "pad">; -} - -declare module "lodash/padEnd" { - declare module.exports: $PropertyType<$Exports<"lodash">, "padEnd">; -} - -declare module "lodash/padStart" { - declare module.exports: $PropertyType<$Exports<"lodash">, "padStart">; -} - -declare module "lodash/parseInt" { - declare module.exports: $PropertyType<$Exports<"lodash">, "parseInt">; -} - -declare module "lodash/repeat" { - declare module.exports: $PropertyType<$Exports<"lodash">, "repeat">; -} - -declare module "lodash/replace" { - declare module.exports: $PropertyType<$Exports<"lodash">, "replace">; -} - -declare module "lodash/snakeCase" { - declare module.exports: $PropertyType<$Exports<"lodash">, "snakeCase">; -} - -declare module "lodash/split" { - declare module.exports: $PropertyType<$Exports<"lodash">, "split">; -} - -declare module "lodash/startCase" { - declare module.exports: $PropertyType<$Exports<"lodash">, "startCase">; -} - -declare module "lodash/startsWith" { - declare module.exports: $PropertyType<$Exports<"lodash">, "startsWith">; -} - -declare module "lodash/template" { - declare module.exports: $PropertyType<$Exports<"lodash">, "template">; -} - -declare module "lodash/toLower" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toLower">; -} - -declare module "lodash/toUpper" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toUpper">; -} - -declare module "lodash/trim" { - declare module.exports: $PropertyType<$Exports<"lodash">, "trim">; -} - -declare module "lodash/trimEnd" { - declare module.exports: $PropertyType<$Exports<"lodash">, "trimEnd">; -} - -declare module "lodash/trimStart" { - declare module.exports: $PropertyType<$Exports<"lodash">, "trimStart">; -} - -declare module "lodash/truncate" { - declare module.exports: $PropertyType<$Exports<"lodash">, "truncate">; -} - -declare module "lodash/unescape" { - declare module.exports: $PropertyType<$Exports<"lodash">, "unescape">; -} - -declare module "lodash/upperCase" { - declare module.exports: $PropertyType<$Exports<"lodash">, "upperCase">; -} - -declare module "lodash/upperFirst" { - declare module.exports: $PropertyType<$Exports<"lodash">, "upperFirst">; -} - -declare module "lodash/words" { - declare module.exports: $PropertyType<$Exports<"lodash">, "words">; -} - -declare module "lodash/attempt" { - declare module.exports: $PropertyType<$Exports<"lodash">, "attempt">; -} - -declare module "lodash/bindAll" { - declare module.exports: $PropertyType<$Exports<"lodash">, "bindAll">; -} - -declare module "lodash/cond" { - declare module.exports: $PropertyType<$Exports<"lodash">, "cond">; -} - -declare module "lodash/conforms" { - declare module.exports: $PropertyType<$Exports<"lodash">, "conforms">; -} - -declare module "lodash/constant" { - declare module.exports: $PropertyType<$Exports<"lodash">, "constant">; -} - -declare module "lodash/defaultTo" { - declare module.exports: $PropertyType<$Exports<"lodash">, "defaultTo">; -} - -declare module "lodash/flow" { - declare module.exports: $PropertyType<$Exports<"lodash">, "flow">; -} - -declare module "lodash/flowRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "flowRight">; -} - -declare module "lodash/identity" { - declare module.exports: $PropertyType<$Exports<"lodash">, "identity">; -} - -declare module "lodash/iteratee" { - declare module.exports: $PropertyType<$Exports<"lodash">, "iteratee">; -} - -declare module "lodash/matches" { - declare module.exports: $PropertyType<$Exports<"lodash">, "matches">; -} - -declare module "lodash/matchesProperty" { - declare module.exports: $PropertyType<$Exports<"lodash">, "matchesProperty">; -} - -declare module "lodash/method" { - declare module.exports: $PropertyType<$Exports<"lodash">, "method">; -} - -declare module "lodash/methodOf" { - declare module.exports: $PropertyType<$Exports<"lodash">, "methodOf">; -} - -declare module "lodash/mixin" { - declare module.exports: $PropertyType<$Exports<"lodash">, "mixin">; -} - -declare module "lodash/noConflict" { - declare module.exports: $PropertyType<$Exports<"lodash">, "noConflict">; -} - -declare module "lodash/noop" { - declare module.exports: $PropertyType<$Exports<"lodash">, "noop">; -} - -declare module "lodash/nthArg" { - declare module.exports: $PropertyType<$Exports<"lodash">, "nthArg">; -} - -declare module "lodash/over" { - declare module.exports: $PropertyType<$Exports<"lodash">, "over">; -} - -declare module "lodash/overEvery" { - declare module.exports: $PropertyType<$Exports<"lodash">, "overEvery">; -} - -declare module "lodash/overSome" { - declare module.exports: $PropertyType<$Exports<"lodash">, "overSome">; -} - -declare module "lodash/property" { - declare module.exports: $PropertyType<$Exports<"lodash">, "property">; -} - -declare module "lodash/propertyOf" { - declare module.exports: $PropertyType<$Exports<"lodash">, "propertyOf">; -} - -declare module "lodash/range" { - declare module.exports: $PropertyType<$Exports<"lodash">, "range">; -} - -declare module "lodash/rangeRight" { - declare module.exports: $PropertyType<$Exports<"lodash">, "rangeRight">; -} - -declare module "lodash/runInContext" { - declare module.exports: $PropertyType<$Exports<"lodash">, "runInContext">; -} - -declare module "lodash/stubArray" { - declare module.exports: $PropertyType<$Exports<"lodash">, "stubArray">; -} - -declare module "lodash/stubFalse" { - declare module.exports: $PropertyType<$Exports<"lodash">, "stubFalse">; -} - -declare module "lodash/stubObject" { - declare module.exports: $PropertyType<$Exports<"lodash">, "stubObject">; -} - -declare module "lodash/stubString" { - declare module.exports: $PropertyType<$Exports<"lodash">, "stubString">; -} - -declare module "lodash/stubTrue" { - declare module.exports: $PropertyType<$Exports<"lodash">, "stubTrue">; -} - -declare module "lodash/times" { - declare module.exports: $PropertyType<$Exports<"lodash">, "times">; -} - -declare module "lodash/toPath" { - declare module.exports: $PropertyType<$Exports<"lodash">, "toPath">; -} - -declare module "lodash/uniqueId" { - declare module.exports: $PropertyType<$Exports<"lodash">, "uniqueId">; -} diff --git a/flow-typed/npm/normalizr_v2.x.x.js b/flow-typed/npm/normalizr_v2.x.x.js deleted file mode 100644 index 4c5132e0..00000000 --- a/flow-typed/npm/normalizr_v2.x.x.js +++ /dev/null @@ -1,26 +0,0 @@ -// flow-typed signature: 2950a094dd6d8e47a8535df1da5d65eb -// flow-typed version: da30fe6876/normalizr_v2.x.x/flow_>=v0.25.x - -declare class Normalizr$Schema { - define(nestedSchema: Object): void; -} -type Normalizr$SchemaOrObject = Normalizr$Schema | Object; - -declare module "normalizr" { - declare class Normalizr { - normalize( - obj: Object | Array<Object>, - schema: Normalizr$SchemaOrObject - ): Object; - Schema(key: string, options?: Object): Normalizr$Schema; - arrayOf( - schema: Normalizr$SchemaOrObject, - options?: Object - ): Normalizr$Schema; - valuesOf( - schema: Normalizr$SchemaOrObject, - options?: Object - ): Normalizr$Schema; - } - declare module.exports: Normalizr; -} diff --git a/flow-typed/npm/react-redux_v5.x.x.js b/flow-typed/npm/react-redux_v5.x.x.js deleted file mode 100644 index e0c8bc04..00000000 --- a/flow-typed/npm/react-redux_v5.x.x.js +++ /dev/null @@ -1,132 +0,0 @@ -// flow-typed signature: 59b0c4be0e1408f21e2446be96c79804 -// flow-typed version: 9092387fd2/react-redux_v5.x.x/flow_>=v0.54.x - -import type { Dispatch, Store } from "redux"; - -declare module "react-redux" { - /* - - S = State - A = Action - OP = OwnProps - SP = StateProps - DP = DispatchProps - - */ - - declare type MapStateToProps<S, OP: Object, SP: Object> = ( - state: S, - ownProps: OP - ) => ((state: S, ownProps: OP) => SP) | SP; - - declare type MapDispatchToProps<A, OP: Object, DP: Object> = - | ((dispatch: Dispatch<A>, ownProps: OP) => DP) - | DP; - - declare type MergeProps<SP, DP: Object, OP: Object, P: Object> = ( - stateProps: SP, - dispatchProps: DP, - ownProps: OP - ) => P; - - declare type Context = { store: Store<*, *> }; - - declare type ComponentWithDefaultProps<DP: {}, P: {}, CP: P> = Class< - React$Component<CP> - > & { defaultProps: DP }; - - declare class ConnectedComponentWithDefaultProps< - OP, - DP, - CP - > extends React$Component<OP> { - static defaultProps: DP, // <= workaround for https://github.com/facebook/flow/issues/4644 - static WrappedComponent: Class<React$Component<CP>>, - getWrappedInstance(): React$Component<CP>, - props: OP, - state: void - } - - declare class ConnectedComponent<OP, P> extends React$Component<OP> { - static WrappedComponent: Class<React$Component<P>>, - getWrappedInstance(): React$Component<P>, - props: OP, - state: void - } - - declare type ConnectedComponentWithDefaultPropsClass<OP, DP, CP> = Class< - ConnectedComponentWithDefaultProps<OP, DP, CP> - >; - - declare type ConnectedComponentClass<OP, P> = Class< - ConnectedComponent<OP, P> - >; - - declare type Connector<OP, P> = (<DP: {}, CP: {}>( - component: ComponentWithDefaultProps<DP, P, CP> - ) => ConnectedComponentWithDefaultPropsClass<OP, DP, CP>) & - ((component: React$ComponentType<P>) => ConnectedComponentClass<OP, P>); - - declare class Provider<S, A> extends React$Component<{ - store: Store<S, A>, - children?: any - }> {} - - declare function createProvider( - storeKey?: string, - subKey?: string - ): Provider<*, *>; - - declare type ConnectOptions = { - pure?: boolean, - withRef?: boolean - }; - - declare type Null = null | void; - - declare function connect<A, OP>( - ...rest: Array<void> // <= workaround for https://github.com/facebook/flow/issues/2360 - ): Connector<OP, $Supertype<{ dispatch: Dispatch<A> } & OP>>; - - declare function connect<A, OP>( - mapStateToProps: Null, - mapDispatchToProps: Null, - mergeProps: Null, - options: ConnectOptions - ): Connector<OP, $Supertype<{ dispatch: Dispatch<A> } & OP>>; - - declare function connect<S, A, OP, SP>( - mapStateToProps: MapStateToProps<S, OP, SP>, - mapDispatchToProps: Null, - mergeProps: Null, - options?: ConnectOptions - ): Connector<OP, $Supertype<SP & { dispatch: Dispatch<A> } & OP>>; - - declare function connect<A, OP, DP>( - mapStateToProps: Null, - mapDispatchToProps: MapDispatchToProps<A, OP, DP>, - mergeProps: Null, - options?: ConnectOptions - ): Connector<OP, $Supertype<DP & OP>>; - - declare function connect<S, A, OP, SP, DP>( - mapStateToProps: MapStateToProps<S, OP, SP>, - mapDispatchToProps: MapDispatchToProps<A, OP, DP>, - mergeProps: Null, - options?: ConnectOptions - ): Connector<OP, $Supertype<SP & DP & OP>>; - - declare function connect<S, A, OP, SP, DP, P>( - mapStateToProps: MapStateToProps<S, OP, SP>, - mapDispatchToProps: Null, - mergeProps: MergeProps<SP, DP, OP, P>, - options?: ConnectOptions - ): Connector<OP, P>; - - declare function connect<S, A, OP, SP, DP, P>( - mapStateToProps: MapStateToProps<S, OP, SP>, - mapDispatchToProps: MapDispatchToProps<A, OP, DP>, - mergeProps: MergeProps<SP, DP, OP, P>, - options?: ConnectOptions - ): Connector<OP, P>; -} diff --git a/flow-typed/npm/redux-saga_v1.x.x.js b/flow-typed/npm/redux-saga_v1.x.x.js deleted file mode 100644 index f7026733..00000000 --- a/flow-typed/npm/redux-saga_v1.x.x.js +++ /dev/null @@ -1,2125 +0,0 @@ -// flow-typed signature: 90448158f7585274ad62ef0febb8626d -// flow-typed version: 48a1b7b5fd/redux-saga_v1.x.x/flow_>=v0.76.0 - -declare module "redux-saga" { - // These types are copied directly from the redux libdef. - // Importing them in this libdef causes a loss in type coverage. - - // * uncomment next line: - // import type { Middleware} from 'redux'; - - // * remove next types - declare type DispatchAPI<A> = (action: A) => A; - declare type Dispatch<A: { type: string }> = DispatchAPI<A>; - - declare type MiddlewareAPI<S, A, D = Dispatch<A>> = { - dispatch: D, - getState(): S - }; - - declare type Middleware<S, A, D = Dispatch<A>> = (api: MiddlewareAPI<S, A, D>) => (next: D) => D; - - ////////////////////////////////////////////////////////////////////////// - - declare export var SAGA_LOCATION: "@@redux-saga/LOCATION"; - - declare export var CANCEL: "@@redux-saga/CANCEL_PROMISE"; - - declare export type TEnd = {| +type: "@@redux-saga/CHANNEL_END" |}; - - declare export var END: TEnd; - - declare export var isEnd: { - (input: TEnd): true, - (input: mixed): false - }; - - declare export type Predicate<T> = (arg: T) => boolean; - - declare export type MulticastChannel<T> = $ReadOnly<{| - take(cb: (message: T | TEnd) => void, matcher?: Predicate<T>): void, - put(message: T | TEnd): void, - close(): void - |}>; - - declare export interface Buffer<T> { - isEmpty(): boolean; - put(message: T): void; - take(): T | void; - flush(): Array<T>; - } - - declare export interface Task<RT> { - isRunning: () => boolean; - isCancelled: () => boolean; - result: () => RT | void; - error: () => Error | void; - cancel: () => void; - toPromise(): Promise<RT>; - setContext<C: {}>(props: $Shape<C>): void; - } - - declare export interface SagaMonitor { - effectTriggered?: (desc: { - +effectId: number, - +parentEffectId: number, - +label: string, - +root?: boolean, - +effect: Effect - }) => void; - effectResolved?: (effectId: number, result: mixed) => void; - effectRejected?: (effectId: number, error: any) => void; - effectCancelled?: (effectId: number) => void; - - actionDispatched?: <A>(action: A) => void; - } - - declare export type Saga<T> = Generator<Effect, T, any>; - - declare export type Unsubscribe = () => void; - - declare export type Subscribe<T> = (cb: (input: T | TEnd) => void) => Unsubscribe; - - declare export interface TakeableChannel<T> { - take(cb: (message: T | TEnd) => void): void - } - - declare export interface PuttableChannel<T> { - put(message: T | TEnd): void - } - - declare export interface FlushableChannel<T> { - flush(cb: (items: Array<T> | TEnd) => void): void - } - - - declare export interface EventChannel<T> { - take(cb: (message: T | TEnd) => void): void; - flush(cb: (items: Array<T> | TEnd) => void): void; - close(): void; - } - - declare export var eventChannel: <T>( - subscribe: Subscribe<T>, - buffer?: Buffer<T> - ) => EventChannel<T>; - - declare export interface Channel<T> { - take(cb: (message: T | TEnd) => void): void; - put(message: T | TEnd): void; - flush(cb: (items: Array<T> | TEnd) => void): void; - close(): void; - } - - declare export function channel<T>(buffer?: Buffer<T>): Channel<T>; - - declare export var buffers: $ReadOnly<{| - none: <T>() => Buffer<T>, - fixed: <T>(limit?: number) => Buffer<T>, - dropping: <T>(limit?: number) => Buffer<T>, - sliding: <T>(limit?: number) => Buffer<T>, - expanding: <T>(initialSize?: number) => Buffer<T> - |}>; - - declare export function multicastChannel<T>(): MulticastChannel<T>; - - declare export function stdChannel<T>(): MulticastChannel<T>; - - declare export type Logger = (level: "info" | "warning" | "error", ...args: Array<any>) => void; - - declare export type EffectMiddleware = (next: (effect: mixed) => void) => (effect: mixed) => void; - - declare export interface PredicateTakeableChannel<T> { - take(cb: (message: T | TEnd) => void, matcher?: Predicate<T>): void; - } - - declare type RunSagaOptions<A, S> = {| - channel?: PredicateTakeableChannel<A>, - dispatch?: (input: A) => mixed, - getState?: () => S, - context?: {}, - sagaMonitor?: SagaMonitor, - logger?: Logger, - effectMiddlewares?: Array<EffectMiddleware>, - onError?: (error: Error) => void - |}; - - declare export var runSaga: { - <A, S, R, Fn: () => Saga<R>>(options: RunSagaOptions<A, S>, saga: Fn): Task<R>, - <A, S, R, T1, Fn: T1 => Saga<R>>(options: RunSagaOptions<A, S>, saga: Fn, T1): Task<R>, - <A, S, R, T1, T2, Fn: (T1, T2) => Saga<R>>( - options: RunSagaOptions<A, S>, - saga: Fn, - T1, - T2 - ): Task<R>, - <A, S, R, T1, T2, T3, Fn: (T1, T2, T3) => Saga<R>>( - options: RunSagaOptions<A, S>, - saga: Fn, - T1, - T2, - T3 - ): Task<R>, - <A, S, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => Saga<R>>( - options: RunSagaOptions<A, S>, - saga: Fn, - T1, - T2, - T3, - T4 - ): Task<R>, - <A, S, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => Saga<R>>( - options: RunSagaOptions<A, S>, - saga: Fn, - T1, - T2, - T3, - T4, - T5 - ): Task<R>, - <A, S, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => Saga<R>>( - options: RunSagaOptions<A, S>, - saga: Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): Task<R>, - <A, S, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => Saga<R>>( - options: RunSagaOptions<A, S>, - saga: Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): Task<R>, - <A, S, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => Saga<R>>( - options: RunSagaOptions<A, S>, - saga: Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): Task<R> - }; - - declare export type SagaMiddleware<C: {}> = - { - <S, A, D>(api: MiddlewareAPI<S, A, D>): (next: D) => D, - run: { - <R, Fn: () => Saga<R>>(saga: Fn): Task<R>, - <R, T1, Fn: T1 => Saga<R>>(saga: Fn, T1): Task<R>, - <R, T1, T2, Fn: (T1, T2) => Saga<R>>(saga: Fn, T1, T2): Task<R>, - <R, T1, T2, T3, Fn: (T1, T2, T3) => Saga<R>>(saga: Fn, T1, T2, T3): Task<R>, - <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => Saga<R>>(saga: Fn, T1, T2, T3, T4): Task<R>, - <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => Saga<R>>( - saga: Fn, - T1, - T2, - T3, - T4, - T5 - ): Task<R>, - <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => Saga<R>>( - saga: Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): Task<R>, - <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => Saga<R>>( - saga: Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): Task<R>, - <R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => Saga<R>>( - saga: Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): Task<R> - }, - setContext: (props: $Shape<C>) => void - }; - - declare export type Emit<T> = (input: T) => void; - - declare export type SagaMiddlewareOptions<C: {}> = {| - context?: C, - sagaMonitor?: SagaMonitor, - logger?: Logger, - effectMiddlewares?: Array<EffectMiddleware>, - emitter?: <A>(emit: Emit<A>) => Emit<any>, - onError?: (error: Error) => void - |}; - - declare function sagaMiddlewareFactory<C>(options?: SagaMiddlewareOptions<C>): SagaMiddleware<C>; - - declare export default typeof sagaMiddlewareFactory; - - // Effect types - declare export type SubPattern = string | (any => boolean); - - declare export type Pattern = SubPattern | Array<SubPattern>; - - declare export interface IEffect<T, P, C: boolean> { - +type: T; - +payload: P; - +combinator: C; - } - - declare export type AllTakeEffect< - M: { maybe: true } | void - > = IEffect< - "TAKE", - $ReadOnly<{| - pattern: '*', - ...$Exact<M> - |}>, - false - >; - - declare export type TakeEffect< - P: { pattern: Pattern } | void, - C: { channel: TakeableChannel<*> } | void, - M: { maybe: true } | void - > = IEffect< - "TAKE", - $ReadOnly<{| - ...$Exact<P>, - ...$Exact<C>, - ...$Exact<M> - |}>, - false - >; - - declare export type PutEffect< - A: {}, - C: PuttableChannel<*> | null, - R: { resolve: true } | void - > = IEffect< - "PUT", - $ReadOnly<{| - action: A, - channel: C, - ...$Exact<R> - |}>, - false - >; - - declare export type CallEffect<Ctx, Fn: Function | string, Args: $ReadOnlyArray<*>> = IEffect< - "CALL", - $ReadOnly<{| - context: Ctx, - fn: Fn, - args: Args - |}>, - false - >; - - declare export type ForkEffect< - Ctx, - Fn: (...args: Array<*>) => *, - D: { detached: true } | void, - Args: $ReadOnlyArray<*> - > = IEffect< - "FORK", - $ReadOnly<{| - context: Ctx, - fn: Fn, - args: Args, - ...$Exact<D> - |}>, - false - >; - - declare export function detach<T1, T2, T3>( - effect: ForkEffect<T1, T2, *, T3> - ): ForkEffect<T1, T2, { detached: true }, T3>; - - declare export type CpsEffect<Ctx, Fn: (...args: Array<*>) => *, Args: $ReadOnlyArray<*>> = IEffect< - "CPS", - $ReadOnly<{| - context: Ctx, - fn: Fn, - args: Args - |}>, - false - >; - - declare export type JoinEffect<T: Task<*> | Array<Task<*>>> = IEffect<"JOIN", T, false>; - - declare export type SELF_CANCELLATION = "@@redux-saga/SELF_CANCELLATION"; - - declare export type CancelEffect< - T: Task<*> | $ReadOnlyArray<Task<*>> | SELF_CANCELLATION - > = IEffect<"CANCEL", T, false>; - - declare export type SelectEffect<Fn: Function | void, Args: $ReadOnlyArray<*>> = IEffect< - "SELECT", - $ReadOnly<{| - selector: Fn, - args: Args - |}>, - false - >; - - declare export type ActionChannelEffect<T, P: Pattern | void, B: Buffer<T> | void> = IEffect< - "ACTION_CHANNEL", - $ReadOnly<{| - buffer: B, - pattern: P - |}>, - false - >; - - declare export type FlushEffect<CH: FlushableChannel<*>> = IEffect<"FLUSH", CH, false>; - - declare export type CancelledEffect = IEffect<"CANCELLED", {||}, false>; - - declare export type SetContextEffect<T: {}> = IEffect<"SET_CONTEXT", T, false>; - - declare export type GetContextEffect<T> = IEffect<"GET_CONTEXT", T, false>; - - declare export type RaceEffect<R: { +[name: string]: Effect } | $ReadOnlyArray<Effect>> = IEffect< - "RACE", - R, - true - >; - - declare export type AllEffect = IEffect< - "ALL", - { +[name: string]: Effect } | $ReadOnlyArray<Effect>, - true - >; - - declare export type Effect = - | ActionChannelEffect<*, *, *> - | AllEffect - | CallEffect<*, *, *> - | CancelEffect<*> - | CancelledEffect - | CpsEffect<*, *, *> - | FlushEffect<*> - | ForkEffect<*, *, *, *> - | GetContextEffect<*> - | JoinEffect<*> - | PutEffect<*, *, *> - | RaceEffect<*> - | SelectEffect<*, *> - | SetContextEffect<*> - | TakeEffect<*, *, *> - | AllTakeEffect<*>; -} - -declare module "redux-saga/effects" { - import type { - ActionChannelEffect, - AllEffect, - Buffer, - CallEffect, - CancelEffect, - CancelledEffect, - Channel, - CpsEffect, - Effect, - FlushEffect, - ForkEffect, - GetContextEffect, - JoinEffect, - Pattern, - PutEffect, - RaceEffect, - Saga, - SelectEffect, - SetContextEffect, - TakeEffect, - Task, - TakeableChannel, - PuttableChannel, - FlushableChannel, - AllTakeEffect, - } from "redux-saga"; - - declare export var effectTypes: $ReadOnly<{| - TAKE: 'TAKE', - PUT: 'PUT', - ALL: 'ALL', - RACE: 'RACE', - CALL: 'CALL', - CPS: 'CPS', - FORK: 'FORK', - JOIN: 'JOIN', - CANCEL: 'CANCEL', - SELECT: 'SELECT', - ACTION_CHANNEL: 'ACTION_CHANNEL', - CANCELLED: 'CANCELLED', - FLUSH: 'FLUSH', - GET_CONTEXT: 'GET_CONTEXT', - SET_CONTEXT: 'SET_CONTEXT' - |}>; - - declare export var put: { - <A: {}>(action: A): PutEffect<A, null, void>, - <A: {}, T, CH: PuttableChannel<T>>(channel: CH, action: A): PutEffect<A, CH, void> - }; - - declare export var putResolve: { - <A: {}>(action: A): PutEffect<A, null, { resolve: true }>, - <A: {}, T, CH: PuttableChannel<T>>(channel: CH, action: A): PutEffect<A, CH, { resolve: true }> - }; - - declare export var call: { - // call(fn, ...args) - <R, Fn: () => R>(Fn): CallEffect<null, Fn, []>, - <R, T1, Fn: T1 => R>(Fn, T1): CallEffect<null, Fn, [T1]>, - <R, T1, T2, Fn: (T1, T2) => R>(Fn, T1, T2): CallEffect<null, Fn, [T1, T2]>, - <R, T1, T2, T3, Fn: (T1, T2, T3) => R>(Fn, T1, T2, T3): CallEffect<null, Fn, [T1, T2, T3]>, - <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - Fn, - T1, - T2, - T3, - T4 - ): CallEffect<null, Fn, [T1, T2, T3, T4]>, - <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - Fn, - T1, - T2, - T3, - T4, - T5 - ): CallEffect<null, Fn, [T1, T2, T3, T4, T5]>, - <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): CallEffect<null, Fn, [T1, T2, T3, T4, T5, T6]>, - <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): CallEffect<null, Fn, [T1, T2, T3, T4, T5, T6, T7]>, - <R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): CallEffect<null, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>, - - // call([context, fn], ...args) - <Ctx, R, Fn: () => R>(cfn: [Ctx, Fn]): CallEffect<Ctx, Fn, []>, - <Ctx, R, T1, Fn: T1 => R>(cfn: [Ctx, Fn], T1): CallEffect<Ctx, Fn, [T1]>, - <Ctx, R, T1, T2, Fn: (T1, T2) => R>(cfn: [Ctx, Fn], T1, T2): CallEffect<Ctx, Fn, [T1, T2]>, - <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3 - ): CallEffect<Ctx, Fn, [T1, T2, T3]>, - <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>, - <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>, - - // call([context, fnName], ...args) - <R, FnName: string, Fn: () => R, Ctx: { [FnName]: Fn }>( - cfn: [Ctx, FnName] - ): CallEffect<Ctx, Fn, []>, - <R, FnName: string, T1, Fn: T1 => R, Ctx: { [FnName]: Fn }>( - cfn: [Ctx, FnName], - T1 - ): CallEffect<Ctx, Fn, [T1]>, - <R, FnName: string, T1, T2, Fn: (T1, T2) => R, Ctx: { [FnName]: Fn }>( - cfn: [Ctx, FnName], - T1, - T2 - ): CallEffect<Ctx, Fn, [T1, T2]>, - <R, FnName: string, T1, T2, T3, Fn: (T1, T2, T3) => R, Ctx: { [FnName]: Fn }>( - cfn: [Ctx, FnName], - T1, - T2, - T3 - ): CallEffect<Ctx, Fn, [T1, T2, T3]>, - <R, FnName: string, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R, Ctx: { [FnName]: Fn }>( - cfn: [Ctx, FnName], - T1, - T2, - T3, - T4 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>, - <R, FnName: string, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R, Ctx: { [FnName]: Fn }>( - cfn: [Ctx, FnName], - T1, - T2, - T3, - T4, - T5 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>, - < - R, - FnName: string, - T1, - T2, - T3, - T4, - T5, - T6, - Fn: (T1, T2, T3, T4, T5, T6) => R, - Ctx: { [FnName]: Fn } - >( - cfn: [Ctx, FnName], - T1, - T2, - T3, - T4, - T5, - T6 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>, - < - R, - FnName: string, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - Fn: (T1, T2, T3, T4, T5, T6, T7) => R, - Ctx: { [FnName]: Fn } - >( - cfn: [Ctx, FnName], - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>, - < - R, - FnName: string, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R, - Ctx: { [FnName]: Fn } - >( - cfn: [Ctx, FnName], - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>, - - // call({context, fn}, ...args) - <Ctx, R, Fn: () => R>(cfn: { context: Ctx, fn: Fn }): CallEffect<Ctx, Fn, []>, - <Ctx, R, T1, Fn: T1 => R>(cfn: { context: Ctx, fn: Fn }, T1): CallEffect<Ctx, Fn, [T1]>, - <Ctx, R, T1, T2, Fn: (T1, T2) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2 - ): CallEffect<Ctx, Fn, [T1, T2]>, - <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3 - ): CallEffect<Ctx, Fn, [T1, T2, T3]>, - <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>, - <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5, - T6 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var apply: { - // apply(context, fn, args) - <Ctx, R, Fn: () => R>(Ctx, Fn): CallEffect<Ctx, Fn, []>, - <Ctx, R, T1, Fn: T1 => R>(Ctx, Fn, T1): CallEffect<Ctx, Fn, [T1]>, - <Ctx, R, T1, T2, Fn: (T1, T2) => R>(Ctx, Fn, T1, T2): CallEffect<Ctx, Fn, [T1, T2]>, - <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>( - Ctx, - Fn, - T1, - T2, - T3 - ): CallEffect<Ctx, Fn, [T1, T2, T3]>, - <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - Ctx, - Fn, - T1, - T2, - T3, - T4 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4]>, - <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - Ctx, - Fn, - T1, - T2, - T3, - T4, - T5 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - Ctx, - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - Ctx, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>( - Ctx, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): CallEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare type NodeCallback<R> = { - (err: Error): void, - (err: null | void | false, result: R): void - }; - - declare export var cps: { - // cps(fn, ...args) - <R, Fn: (NodeCallback<R>) => void>(Fn): CpsEffect<null, Fn, []>, - <R, T1, Fn: (T1, NodeCallback<R>) => void>(Fn, T1): CpsEffect<null, Fn, [T1]>, - <R, T1, T2, Fn: (T1, T2, NodeCallback<R>) => void>(Fn, T1, T2): CpsEffect<null, Fn, [T1, T2]>, - <R, T1, T2, T3, Fn: (T1, T2, T3, NodeCallback<R>) => void>( - Fn, - T1, - T2, - T3 - ): CpsEffect<null, Fn, [T1, T2, T3]>, - <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, NodeCallback<R>) => void>( - Fn, - T1, - T2, - T3, - T4 - ): CpsEffect<null, Fn, [T1, T2, T3, T4]>, - <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, NodeCallback<R>) => void>( - Fn, - T1, - T2, - T3, - T4, - T5 - ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5]>, - <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, NodeCallback<R>) => void>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5, T6]>, - <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7, NodeCallback<R>) => void>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5, T6, T7]>, - < - R, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8, NodeCallback<R>) => void - >( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): CpsEffect<null, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>, - - // cps([context, fn], ...args) - <Ctx, R, Fn: (NodeCallback<R>) => void>(cfn: [Ctx, Fn]): CpsEffect<Ctx, Fn, []>, - <Ctx, R, T1, Fn: (T1, NodeCallback<R>) => void>(cfn: [Ctx, Fn], T1): CpsEffect<Ctx, Fn, [T1]>, - <Ctx, R, T1, T2, Fn: (T1, T2, NodeCallback<R>) => void>( - cfn: [Ctx, Fn], - T1, - T2 - ): CpsEffect<Ctx, Fn, [T1, T2]>, - <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3, NodeCallback<R>) => void>( - cfn: [Ctx, Fn], - T1, - T2, - T3 - ): CpsEffect<Ctx, Fn, [T1, T2, T3]>, - <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, NodeCallback<R>) => void>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4]>, - <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, NodeCallback<R>) => void>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, NodeCallback<R>) => void>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7, NodeCallback<R>) => void>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>, - < - Ctx, - R, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8, NodeCallback<R>) => void - >( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]>, - - // cps({context, fn}, ...args) - <Ctx, R, Fn: (NodeCallback<R>) => void>(cfn: { context: Ctx, fn: Fn }): CpsEffect<Ctx, Fn, []>, - <Ctx, R, T1, Fn: (T1, NodeCallback<R>) => void>( - cfn: { context: Ctx, fn: Fn }, - T1 - ): CpsEffect<Ctx, Fn, [T1]>, - <Ctx, R, T1, T2, Fn: (T1, T2, NodeCallback<R>) => void>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2 - ): CpsEffect<Ctx, Fn, [T1, T2]>, - <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3, NodeCallback<R>) => void>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3 - ): CpsEffect<Ctx, Fn, [T1, T2, T3]>, - <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, NodeCallback<R>) => void>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4]>, - <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, NodeCallback<R>) => void>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, NodeCallback<R>) => void>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5, - T6 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7, NodeCallback<R>) => void>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7]>, - < - Ctx, - R, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8, NodeCallback<R>) => void - >( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): CpsEffect<Ctx, Fn, [T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var fork: { - // fork(fn, ...args) - <R, Fn: () => R>(Fn): ForkEffect<null, Fn, void, []>, - <R, T1, Fn: T1 => R>(Fn, T1): ForkEffect<null, Fn, void, [T1]>, - <R, T1, T2, Fn: (T1, T2) => R>(Fn, T1, T2): ForkEffect<null, Fn, void, [T1, T2]>, - <R, T1, T2, T3, Fn: (T1, T2, T3) => R>( - Fn, - T1, - T2, - T3 - ): ForkEffect<null, Fn, void, [T1, T2, T3]>, - <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - Fn, - T1, - T2, - T3, - T4 - ): ForkEffect<null, Fn, void, [T1, T2, T3, T4]>, - <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - Fn, - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<null, Fn, void, [T1, T2, T3, T4, T5]>, - <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<null, Fn, void, [T1, T2, T3, T4, T5, T6]>, - <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<null, Fn, void, [T1, T2, T3, T4, T5, T6, T7]>, - <R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<null, Fn, void, [T1, T2, T3, T4, T5, T6, T7, T8]>, - - // fork([context, fn], ...args) - <Ctx, R, Fn: () => R>(cfn: [Ctx, Fn]): ForkEffect<Ctx, Fn, void, []>, - <Ctx, R, T1, Fn: T1 => R>(cfn: [Ctx, Fn], T1): ForkEffect<Ctx, Fn, void, [T1]>, - <Ctx, R, T1, T2, Fn: (T1, T2) => R>( - cfn: [Ctx, Fn], - T1, - T2 - ): ForkEffect<Ctx, Fn, void, [T1, T2]>, - <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3]>, - <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4]>, - <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6, T7]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6, T7, T8]>, - - // fork({context, fn}, ...args) - <Ctx, R, Fn: () => R>(cfn: { context: Ctx, fn: Fn }): ForkEffect<Ctx, Fn, void, []>, - <Ctx, R, T1, Fn: T1 => R>(cfn: { context: Ctx, fn: Fn }, T1): ForkEffect<Ctx, Fn, void, [T1]>, - <Ctx, R, T1, T2, Fn: (T1, T2) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2 - ): ForkEffect<Ctx, Fn, void, [T1, T2]>, - <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3]>, - <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4]>, - <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6, T7]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>( - cfn: { context: Ctx, fn: Fn }, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<Ctx, Fn, void, [T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var spawn: { - // spawn(fn, ...args) - <R, Fn: () => R>(Fn): ForkEffect<null, Fn, { detached: true }, []>, - <R, T1, Fn: T1 => R>(Fn, T1): ForkEffect<null, Fn, { detached: true }, [T1]>, - <R, T1, T2, Fn: (T1, T2) => R>(Fn, T1, T2): ForkEffect<null, Fn, { detached: true }, [T1, T2]>, - <R, T1, T2, T3, Fn: (T1, T2, T3) => R>( - Fn, - T1, - T2, - T3 - ): ForkEffect<null, Fn, { detached: true }, [T1, T2, T3]>, - <R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - Fn, - T1, - T2, - T3, - T4 - ): ForkEffect<null, Fn, { detached: true }, [T1, T2, T3, T4]>, - <R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - Fn, - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<null, Fn, { detached: true }, [T1, T2, T3, T4, T5]>, - <R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<null, Fn, { detached: true }, [T1, T2, T3, T4, T5, T6]>, - <R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<null, Fn, { detached: true }, [T1, T2, T3, T4, T5, T6, T7]>, - <R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<null, Fn, { detached: true }, [T1, T2, T3, T4, T5, T6, T7, T8]>, - - // spawn([context, fn], ...args) - <Ctx, R, Fn: () => R>(cfn: [Ctx, Fn]): ForkEffect<Ctx, Fn, { detached: true }, []>, - <Ctx, R, T1, Fn: T1 => R>(cfn: [Ctx, Fn], T1): ForkEffect<Ctx, Fn, { detached: true }, [T1]>, - <Ctx, R, T1, T2, Fn: (T1, T2) => R>( - cfn: [Ctx, Fn], - T1, - T2 - ): ForkEffect<Ctx, Fn, { detached: true }, [T1, T2]>, - <Ctx, R, T1, T2, T3, Fn: (T1, T2, T3) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3 - ): ForkEffect<Ctx, Fn, { detached: true }, [T1, T2, T3]>, - <Ctx, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4 - ): ForkEffect<Ctx, Fn, { detached: true }, [T1, T2, T3, T4]>, - <Ctx, R, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<Ctx, Fn, { detached: true }, [T1, T2, T3, T4, T5]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<Ctx, Fn, { detached: true }, [T1, T2, T3, T4, T5, T6]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<Ctx, Fn, { detached: true }, [T1, T2, T3, T4, T5, T6, T7]>, - <Ctx, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R>( - cfn: [Ctx, Fn], - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<Ctx, Fn, { detached: true }, [T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var join: { - // join(task) - // join([...tasks]) - <T: Task<*>>(task: T): JoinEffect<T>, - <T: Array<Task<*>>>(tasks: T): JoinEffect<T> - }; - - declare export var cancel: { - // cancel() - // cancel(task) - // cancel([...tasks]) - (): CancelEffect<"@@redux-saga/SELF_CANCELLATION">, - <T: Task<*>>(task: T): CancelEffect<T>, - <T: Task<*>>(tasks: Array<T>): CancelEffect<$ReadOnlyArray<T>> - }; - - declare export var select: { - // select(selector, ...args) - (): SelectEffect<void, []>, - <S, R, Fn: S => R>(Fn): SelectEffect<Fn, []>, - <S, R, T1, Fn: (S, T1) => R>(Fn, T1): SelectEffect<Fn, [T1]>, - <S, R, T1, T2, Fn: (S, T1, T2) => R>(Fn, T1, T2): SelectEffect<Fn, [T1, T2]>, - <S, R, T1, T2, T3, Fn: (S, T1, T2, T3) => R>(Fn, T1, T2, T3): SelectEffect<Fn, [T1, T2, T3]>, - <S, R, T1, T2, T3, T4, Fn: (S, T1, T2, T3, T4) => R>( - Fn, - T1, - T2, - T3, - T4 - ): SelectEffect<Fn, [T1, T2, T3, T4]>, - <S, R, T1, T2, T3, T4, T5, Fn: (S, T1, T2, T3, T4, T5) => R>( - Fn, - T1, - T2, - T3, - T4, - T5 - ): SelectEffect<Fn, [T1, T2, T3, T4, T5]>, - <S, R, T1, T2, T3, T4, T5, T6, Fn: (S, T1, T2, T3, T4, T5, T6) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): SelectEffect<Fn, [T1, T2, T3, T4, T5, T6]>, - <S, R, T1, T2, T3, T4, T5, T6, T7, Fn: (S, T1, T2, T3, T4, T5, T6, T7) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): SelectEffect<Fn, [T1, T2, T3, T4, T5, T6, T7]>, - <S, R, T1, T2, T3, T4, T5, T6, T7, T8, Fn: (S, T1, T2, T3, T4, T5, T6, T7, T8) => R>( - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): SelectEffect<Fn, [T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var actionChannel: { - // actionChannel(pattern, [buffer]) - <BT>(): ActionChannelEffect<BT, void, void>, - <BT, P: Pattern>(pattern: P): ActionChannelEffect<BT, P, void>, - <BT, T, P: Pattern, B: Buffer<T>>(pattern: P, buffer: B): ActionChannelEffect<BT, P, B> - }; - - declare export var flush: { - // flush(channel) - <T, CH: FlushableChannel<T>>(channel: CH): FlushEffect<CH> - }; - - declare export var cancelled: { - // cancelled() - (): CancelledEffect - }; - - declare export var setContext: { - // setContext(props) - <T: {}>(props: T): SetContextEffect<T> - }; - - declare export var getContext: { - // getContext(prop) - <T: string>(prop: T): GetContextEffect<T> - }; - - declare export var race: { - // race(effects) - // race([...effects]) - <R: { +[name: string]: Effect }>(effects: R): RaceEffect<R>, - <R: $ReadOnlyArray<Effect>>(effects: R): RaceEffect<R> - }; - - declare export var all: { - // all(effects) - // all([...effects]) - (effects: { +[name: string]: Effect }): AllEffect, - (effects: $ReadOnlyArray<Effect>): AllEffect - }; - - declare export var take: { - // take(pattern) - // take(channel) - (): AllTakeEffect<void>, - <T, CH: TakeableChannel<T>>(channel: CH): TakeEffect<void, { channel: CH }, void>, - <P: Pattern>(pattern: P): TakeEffect<{ pattern: P }, void, void> - }; - - declare export var takeMaybe: { - // takeMaybe(pattern) - // takeMaybe(channel) - (): AllTakeEffect<{ maybe: true }>, - <T, CH: TakeableChannel<T>>(channel: CH): TakeEffect<void, { channel: CH }, { maybe: true }>, - <P: Pattern>(pattern: P): TakeEffect<{ pattern: P }, void, { maybe: true }> - }; - - declare export var takeEvery: { - // takeEvery(pattern, saga, ...args) - // takeEvery(channel, saga, ...args) - <A, R, P: TakeableChannel<*> | Pattern, Fn: A => R>(P, Fn): ForkEffect<null, Fn, void, [P, Fn]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, Fn: (T1, A) => R>( - P, - Fn, - T1 - ): ForkEffect<null, Fn, void, [P, Fn, T1]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, Fn: (T1, T2, A) => R>( - P, - Fn, - T1, - T2 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, Fn: (T1, T2, T3, A) => R>( - P, - Fn, - T1, - T2, - T3 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, A) => R>( - P, - Fn, - T1, - T2, - T3, - T4 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, A) => R>( - P, - Fn, - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, A) => R>( - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6]>, - < - A, - R, - P: TakeableChannel<*> | Pattern, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - Fn: (T1, T2, T3, T4, T5, T6, T7, A) => R - >( - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7]>, - < - A, - R, - P: TakeableChannel<*> | Pattern, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8, A) => R - >( - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var takeLatest: { - // takeLatest(pattern, saga, ...args) - // takeLatest(channel, saga, ...args) - <A, R, P: TakeableChannel<*> | Pattern, Fn: A => R>(P, Fn): ForkEffect<null, Fn, void, [P, Fn]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, Fn: (T1, A) => R>( - P, - Fn, - T1 - ): ForkEffect<null, Fn, void, [P, Fn, T1]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, Fn: (T1, T2, A) => R>( - P, - Fn, - T1, - T2 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, Fn: (T1, T2, T3, A) => R>( - P, - Fn, - T1, - T2, - T3 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, A) => R>( - P, - Fn, - T1, - T2, - T3, - T4 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, A) => R>( - P, - Fn, - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, A) => R>( - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6]>, - < - A, - R, - P: TakeableChannel<*> | Pattern, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - Fn: (T1, T2, T3, T4, T5, T6, T7, A) => R - >( - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7]>, - < - A, - R, - P: TakeableChannel<*> | Pattern, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8, A) => R - >( - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var takeLeading: { - // takeLeading(pattern, saga, ...args) - // takeLeading(channel, saga, ...args) - <A, R, P: TakeableChannel<*> | Pattern, Fn: A => R>(P, Fn): ForkEffect<null, Fn, void, [P, Fn]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, Fn: (T1, A) => R>( - P, - Fn, - T1 - ): ForkEffect<null, Fn, void, [P, Fn, T1]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, Fn: (T1, T2, A) => R>( - P, - Fn, - T1, - T2 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, Fn: (T1, T2, T3, A) => R>( - P, - Fn, - T1, - T2, - T3 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, A) => R>( - P, - Fn, - T1, - T2, - T3, - T4 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5, A) => R>( - P, - Fn, - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5]>, - <A, R, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6, A) => R>( - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6]>, - < - A, - R, - P: TakeableChannel<*> | Pattern, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - Fn: (T1, T2, T3, T4, T5, T6, T7, A) => R - >( - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7]>, - < - A, - R, - P: TakeableChannel<*> | Pattern, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8, A) => R - >( - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<null, Fn, void, [P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var delay: { - // delay(ms, [val]) - <T1: number>(timeout: T1): CallEffect<null, (ms: T1) => Promise<true>, [T1]>, - <T1: number, T2>(timeout: T1, T2): CallEffect<null, (ms: T1) => Promise<true>, [T1, T2]> - }; - - declare export var throttle: { - // throttle(ms, pattern, saga, ...args) - // throttle(ms, channel, saga, ...args) - <MS: number, P: TakeableChannel<*> | Pattern, A, R, Fn: A => R>( - MS, - P, - Fn - ): ForkEffect<null, Fn, void, [MS, P, Fn]>, - <MS: number, P: TakeableChannel<*> | Pattern, A, R, T1, Fn: (T1, A) => R>( - MS, - P, - Fn, - T1 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1]>, - <MS: number, P: TakeableChannel<*> | Pattern, A, R, T1, T2, Fn: (T1, T2, A) => R>( - MS, - P, - Fn, - T1, - T2 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2]>, - <MS: number, P: TakeableChannel<*> | Pattern, A, R, T1, T2, T3, Fn: (T1, T2, T3, A) => R>( - MS, - P, - Fn, - T1, - T2, - T3 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3]>, - <MS: number, P: TakeableChannel<*> | Pattern, A, R, T1, T2, T3, T4, Fn: (T1, T2, T3, T4, A) => R>( - MS, - P, - Fn, - T1, - T2, - T3, - T4 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4]>, - < - MS: number, - P: TakeableChannel<*> | Pattern, - A, - R, - T1, - T2, - T3, - T4, - T5, - Fn: (T1, T2, T3, T4, T5, A) => R - >( - MS, - P, - Fn, - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5]>, - < - MS: number, - P: TakeableChannel<*> | Pattern, - A, - R, - T1, - T2, - T3, - T4, - T5, - T6, - Fn: (T1, T2, T3, T4, T5, T6, A) => R - >( - MS, - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6]>, - < - MS: number, - P: TakeableChannel<*> | Pattern, - A, - R, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - Fn: (T1, T2, T3, T4, T5, T6, T7, A) => R - >( - MS, - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6, T7]>, - < - MS: number, - P: TakeableChannel<*> | Pattern, - A, - R, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8, A) => R - >( - MS, - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var debounce: { - // debounce(ms, pattern, saga, ...args) - // debounce(ms, channel, saga, ...args) - <R, MS: number, P: TakeableChannel<*> | Pattern, Fn: () => R>( - MS, - P, - Fn - ): ForkEffect<null, Fn, void, [MS, P, Fn]>, - <R, MS: number, P: TakeableChannel<*> | Pattern, T1, Fn: T1 => R>( - MS, - P, - Fn, - T1 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1]>, - <R, MS: number, P: TakeableChannel<*> | Pattern, T1, T2, Fn: (T1, T2) => R>( - MS, - P, - Fn, - T1, - T2 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2]>, - <R, MS: number, P: TakeableChannel<*> | Pattern, T1, T2, T3, Fn: (T1, T2, T3) => R>( - MS, - P, - Fn, - T1, - T2, - T3 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3]>, - <R, MS: number, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - MS, - P, - Fn, - T1, - T2, - T3, - T4 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4]>, - <R, MS: number, P: TakeableChannel<*> | Pattern, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - MS, - P, - Fn, - T1, - T2, - T3, - T4, - T5 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5]>, - < - R, - MS: number, - P: TakeableChannel<*> | Pattern, - T1, - T2, - T3, - T4, - T5, - T6, - Fn: (T1, T2, T3, T4, T5, T6) => R - >( - MS, - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6]>, - < - R, - MS: number, - P: TakeableChannel<*> | Pattern, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - Fn: (T1, T2, T3, T4, T5, T6, T7) => R - >( - MS, - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6, T7]>, - < - R, - MS: number, - P: TakeableChannel<*> | Pattern, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R - >( - MS, - P, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): ForkEffect<null, Fn, void, [MS, P, Fn, T1, T2, T3, T4, T5, T6, T7, T8]> - }; - - declare export var retry: { - // retry(maxTries, delay, fn, ...args) - <R, MT: number, D: number, Fn: () => R>(MT, D, Fn): CallEffect<null, Function, [MT, D, Fn]>, - <R, MT: number, D: number, T1, Fn: T1 => R>( - MT, - D, - Fn, - T1 - ): CallEffect<null, Function, [MT, D, Fn, T1]>, - <R, MT: number, D: number, T1, T2, Fn: (T1, T2) => R>( - MT, - D, - Fn, - T1, - T2 - ): CallEffect<null, Function, [MT, D, Fn, T1, T2]>, - <R, MT: number, D: number, T1, T2, T3, Fn: (T1, T2, T3) => R>( - MT, - D, - Fn, - T1, - T2, - T3 - ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3]>, - <R, MT: number, D: number, T1, T2, T3, T4, Fn: (T1, T2, T3, T4) => R>( - MT, - D, - Fn, - T1, - T2, - T3, - T4 - ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4]>, - <R, MT: number, D: number, T1, T2, T3, T4, T5, Fn: (T1, T2, T3, T4, T5) => R>( - MT, - D, - Fn, - T1, - T2, - T3, - T4, - T5 - ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4, T5]>, - <R, MT: number, D: number, T1, T2, T3, T4, T5, T6, Fn: (T1, T2, T3, T4, T5, T6) => R>( - MT, - D, - Fn, - T1, - T2, - T3, - T4, - T5, - T6 - ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4, T5, T6]>, - <R, MT: number, D: number, T1, T2, T3, T4, T5, T6, T7, Fn: (T1, T2, T3, T4, T5, T6, T7) => R>( - MT, - D, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7 - ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4, T5, T6, T7]>, - < - R, - MT: number, - D: number, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - Fn: (T1, T2, T3, T4, T5, T6, T7, T8) => R - >( - MT, - D, - Fn, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8 - ): CallEffect<null, Function, [MT, D, Fn, T1, T2, T3, T4, T5, T6, T7, T8]> - }; -} diff --git a/flow-typed/npm/redux_v3.x.x.js b/flow-typed/npm/redux_v3.x.x.js deleted file mode 100644 index e290f796..00000000 --- a/flow-typed/npm/redux_v3.x.x.js +++ /dev/null @@ -1,107 +0,0 @@ -// flow-typed signature: 76c3dfb5a40ce169d5c08fe80dbd029a -// flow-typed version: 37b1c6d953/redux_v3.x.x/flow_>=v0.33.x - -declare module 'redux' { - - /* - - S = State - A = Action - - */ - - declare type Dispatch<A: { +type: $Subtype<string> }> = (action: A) => A; - - declare type MiddlewareAPI<S, A> = { - dispatch: Dispatch<A>; - getState(): S; - }; - - declare type Store<S, A> = { - // rewrite MiddlewareAPI members in order to get nicer error messages (intersections produce long messages) - dispatch: Dispatch<A>; - getState(): S; - subscribe(listener: () => void): () => void; - replaceReducer(nextReducer: Reducer<S, A>): void - }; - - declare type Reducer<S, A> = (state: S, action: A) => S; - - declare type CombinedReducer<S, A> = (state: $Shape<S> & {} | void, action: A) => S; - - declare type Middleware<S, A> = - (api: MiddlewareAPI<S, A>) => - (next: Dispatch<A>) => Dispatch<A>; - - declare type StoreCreator<S, A> = { - (reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A>): Store<S, A>; - (reducer: Reducer<S, A>, preloadedState: S, enhancer?: StoreEnhancer<S, A>): Store<S, A>; - }; - - declare type StoreEnhancer<S, A> = (next: StoreCreator<S, A>) => StoreCreator<S, A>; - - declare function createStore<S, A>(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A>): Store<S, A>; - declare function createStore<S, A>(reducer: Reducer<S, A>, preloadedState: S, enhancer?: StoreEnhancer<S, A>): Store<S, A>; - - declare function applyMiddleware<S, A>(...middlewares: Array<Middleware<S, A>>): StoreEnhancer<S, A>; - - declare type ActionCreator<A, B> = (...args: Array<B>) => A; - declare type ActionCreators<K, A> = { [key: K]: ActionCreator<A, any> }; - - declare function bindActionCreators<A, C: ActionCreator<A, any>>(actionCreator: C, dispatch: Dispatch<A>): C; - declare function bindActionCreators<A, K, C: ActionCreators<K, A>>(actionCreators: C, dispatch: Dispatch<A>): C; - - declare function combineReducers<O: Object, A>(reducers: O): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>; - - declare function compose<A, B>(ab: (a: A) => B): (a: A) => B - declare function compose<A, B, C>( - bc: (b: B) => C, - ab: (a: A) => B - ): (a: A) => C - declare function compose<A, B, C, D>( - cd: (c: C) => D, - bc: (b: B) => C, - ab: (a: A) => B - ): (a: A) => D - declare function compose<A, B, C, D, E>( - de: (d: D) => E, - cd: (c: C) => D, - bc: (b: B) => C, - ab: (a: A) => B - ): (a: A) => E - declare function compose<A, B, C, D, E, F>( - ef: (e: E) => F, - de: (d: D) => E, - cd: (c: C) => D, - bc: (b: B) => C, - ab: (a: A) => B - ): (a: A) => F - declare function compose<A, B, C, D, E, F, G>( - fg: (f: F) => G, - ef: (e: E) => F, - de: (d: D) => E, - cd: (c: C) => D, - bc: (b: B) => C, - ab: (a: A) => B - ): (a: A) => G - declare function compose<A, B, C, D, E, F, G, H>( - gh: (g: G) => H, - fg: (f: F) => G, - ef: (e: E) => F, - de: (d: D) => E, - cd: (c: C) => D, - bc: (b: B) => C, - ab: (a: A) => B - ): (a: A) => H - declare function compose<A, B, C, D, E, F, G, H, I>( - hi: (h: H) => I, - gh: (g: G) => H, - fg: (f: F) => G, - ef: (e: E) => F, - de: (d: D) => E, - cd: (c: C) => D, - bc: (b: B) => C, - ab: (a: A) => B - ): (a: A) => I - -} diff --git a/flow-typed/npm/reselect_v3.x.x.js b/flow-typed/npm/reselect_v3.x.x.js deleted file mode 100644 index d1a71241..00000000 --- a/flow-typed/npm/reselect_v3.x.x.js +++ /dev/null @@ -1,890 +0,0 @@ -// flow-typed signature: 7242133add1d3bd16fc3e9d648152c63 -// flow-typed version: 00301f0d29/reselect_v3.x.x/flow_>=v0.47.x - -// flow-typed signature: 0199525b667f385f2e61dbeae3215f21 -// flow-typed version: b43dff3e0e/reselect_v3.x.x/flow_>=v0.28.x - -declare module "reselect" { - declare type Selector<-TState, TProps, TResult> = - (state: TState, props: TProps, ...rest: any[]) => TResult - - declare type SelectorCreator = { - <TState, TProps, TResult, T1>( - selector1: Selector<TState, TProps, T1>, - resultFunc: (arg1: T1) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1>( - selectors: [Selector<TState, TProps, T1>], - resultFunc: (arg1: T1) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - resultFunc: (arg1: T1, arg2: T2) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2>( - selectors: [Selector<TState, TProps, T1>, Selector<TState, TProps, T2>], - resultFunc: (arg1: T1, arg2: T2) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2, T3>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - resultFunc: (arg1: T1, arg2: T2, arg3: T3) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2, T3>( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3> - ], - resultFunc: (arg1: T1, arg2: T2, arg3: T3) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2, T3, T4>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - resultFunc: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2, T3, T4>( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4> - ], - resultFunc: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2, T3, T4, T5>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - resultFunc: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2, T3, T4, T5>( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5> - ], - resultFunc: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6 - ) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6>( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6 - ) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7 - ) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7>( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7 - ) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - selector8: Selector<TState, TProps, T8>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8 - ) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8>( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7>, - Selector<TState, TProps, T8> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8 - ) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - selector8: Selector<TState, TProps, T8>, - selector9: Selector<TState, TProps, T9>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9 - ) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7>, - Selector<TState, TProps, T8>, - Selector<TState, TProps, T9> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9 - ) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - selector8: Selector<TState, TProps, T8>, - selector9: Selector<TState, TProps, T9>, - selector10: Selector<TState, TProps, T10>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10 - ) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7>, - Selector<TState, TProps, T8>, - Selector<TState, TProps, T9>, - Selector<TState, TProps, T10> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10 - ) => TResult - ): Selector<TState, TProps, TResult>, - - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - selector8: Selector<TState, TProps, T8>, - selector9: Selector<TState, TProps, T9>, - selector10: Selector<TState, TProps, T10>, - selector11: Selector<TState, TProps, T11>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11 - ) => TResult - ): Selector<TState, TProps, TResult>, - <TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7>, - Selector<TState, TProps, T8>, - Selector<TState, TProps, T9>, - Selector<TState, TProps, T10>, - Selector<TState, TProps, T11> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11 - ) => TResult - ): Selector<TState, TProps, TResult>, - - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12 - >( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - selector8: Selector<TState, TProps, T8>, - selector9: Selector<TState, TProps, T9>, - selector10: Selector<TState, TProps, T10>, - selector11: Selector<TState, TProps, T11>, - selector12: Selector<TState, TProps, T12>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12 - ) => TResult - ): Selector<TState, TProps, TResult>, - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12 - >( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7>, - Selector<TState, TProps, T8>, - Selector<TState, TProps, T9>, - Selector<TState, TProps, T10>, - Selector<TState, TProps, T11>, - Selector<TState, TProps, T12> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12 - ) => TResult - ): Selector<TState, TProps, TResult>, - - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13 - >( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - selector8: Selector<TState, TProps, T8>, - selector9: Selector<TState, TProps, T9>, - selector10: Selector<TState, TProps, T10>, - selector11: Selector<TState, TProps, T11>, - selector12: Selector<TState, TProps, T12>, - selector13: Selector<TState, TProps, T13>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12, - arg13: T13 - ) => TResult - ): Selector<TState, TProps, TResult>, - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13 - >( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7>, - Selector<TState, TProps, T8>, - Selector<TState, TProps, T9>, - Selector<TState, TProps, T10>, - Selector<TState, TProps, T11>, - Selector<TState, TProps, T12>, - Selector<TState, TProps, T13> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12, - arg13: T13 - ) => TResult - ): Selector<TState, TProps, TResult>, - - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14 - >( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - selector8: Selector<TState, TProps, T8>, - selector9: Selector<TState, TProps, T9>, - selector10: Selector<TState, TProps, T10>, - selector11: Selector<TState, TProps, T11>, - selector12: Selector<TState, TProps, T12>, - selector13: Selector<TState, TProps, T13>, - selector14: Selector<TState, TProps, T14>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12, - arg13: T13, - arg14: T14 - ) => TResult - ): Selector<TState, TProps, TResult>, - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14 - >( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7>, - Selector<TState, TProps, T8>, - Selector<TState, TProps, T9>, - Selector<TState, TProps, T10>, - Selector<TState, TProps, T11>, - Selector<TState, TProps, T12>, - Selector<TState, TProps, T13>, - Selector<TState, TProps, T14> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12, - arg13: T13, - arg14: T14 - ) => TResult - ): Selector<TState, TProps, TResult>, - - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15 - >( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - selector8: Selector<TState, TProps, T8>, - selector9: Selector<TState, TProps, T9>, - selector10: Selector<TState, TProps, T10>, - selector11: Selector<TState, TProps, T11>, - selector12: Selector<TState, TProps, T12>, - selector13: Selector<TState, TProps, T13>, - selector14: Selector<TState, TProps, T14>, - selector15: Selector<TState, TProps, T15>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12, - arg13: T13, - arg14: T14, - arg15: T15 - ) => TResult - ): Selector<TState, TProps, TResult>, - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15 - >( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7>, - Selector<TState, TProps, T8>, - Selector<TState, TProps, T9>, - Selector<TState, TProps, T10>, - Selector<TState, TProps, T11>, - Selector<TState, TProps, T12>, - Selector<TState, TProps, T13>, - Selector<TState, TProps, T14>, - Selector<TState, TProps, T15> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12, - arg13: T13, - arg14: T14, - arg15: T15 - ) => TResult - ): Selector<TState, TProps, TResult>, - - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15, - T16 - >( - selector1: Selector<TState, TProps, T1>, - selector2: Selector<TState, TProps, T2>, - selector3: Selector<TState, TProps, T3>, - selector4: Selector<TState, TProps, T4>, - selector5: Selector<TState, TProps, T5>, - selector6: Selector<TState, TProps, T6>, - selector7: Selector<TState, TProps, T7>, - selector8: Selector<TState, TProps, T8>, - selector9: Selector<TState, TProps, T9>, - selector10: Selector<TState, TProps, T10>, - selector11: Selector<TState, TProps, T11>, - selector12: Selector<TState, TProps, T12>, - selector13: Selector<TState, TProps, T13>, - selector14: Selector<TState, TProps, T14>, - selector15: Selector<TState, TProps, T15>, - selector16: Selector<TState, TProps, T16>, - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12, - arg13: T13, - arg14: T14, - arg15: T15, - arg16: T16 - ) => TResult - ): Selector<TState, TProps, TResult>, - < - TState, - TProps, - TResult, - T1, - T2, - T3, - T4, - T5, - T6, - T7, - T8, - T9, - T10, - T11, - T12, - T13, - T14, - T15, - T16 - >( - selectors: [ - Selector<TState, TProps, T1>, - Selector<TState, TProps, T2>, - Selector<TState, TProps, T3>, - Selector<TState, TProps, T4>, - Selector<TState, TProps, T5>, - Selector<TState, TProps, T6>, - Selector<TState, TProps, T7>, - Selector<TState, TProps, T8>, - Selector<TState, TProps, T9>, - Selector<TState, TProps, T10>, - Selector<TState, TProps, T11>, - Selector<TState, TProps, T12>, - Selector<TState, TProps, T13>, - Selector<TState, TProps, T14>, - Selector<TState, TProps, T15>, - Selector<TState, TProps, T16> - ], - resultFunc: ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - arg7: T7, - arg8: T8, - arg9: T9, - arg10: T10, - arg11: T11, - arg12: T12, - arg13: T13, - arg14: T14, - arg15: T15, - arg16: T16 - ) => TResult - ): Selector<TState, TProps, TResult> - }; - - declare type Reselect = { - createSelector: SelectorCreator, - - defaultMemoize: <TFunc: Function>( - func: TFunc, - equalityCheck?: (a: any, b: any) => boolean - ) => TFunc, - - createSelectorCreator: ( - memoize: Function, - ...memoizeOptions: any[] - ) => SelectorCreator, - - createStructuredSelector: <TState, TProps>( - inputSelectors: { - [k: string | number]: Selector<TState, TProps, any> - }, - selectorCreator?: SelectorCreator - ) => Selector<TState, TProps, any> - }; - - declare module.exports: Reselect; -} diff --git a/flow-typed/npm/styled-components_v4.x.x.js b/flow-typed/npm/styled-components_v4.x.x.js deleted file mode 100644 index 54598e90..00000000 --- a/flow-typed/npm/styled-components_v4.x.x.js +++ /dev/null @@ -1,410 +0,0 @@ -// flow-typed signature: 8ae4cfa383fc58443d8d65b5301bf1c1 -// flow-typed version: 1a7d5ca288/styled-components_v4.x.x/flow_>=v0.75.x - -// @flow - -declare module 'styled-components' { - - declare export type Interpolation = - | (<P: {}>(executionContext: P) => string) - | CSSRules - | KeyFrames - | string - | number - - - declare export type CSSRules = Interpolation[] - - // This is not exported on purpose, since it's an implementation detail - declare type TaggedTemplateLiteral<R> = (strings : string[], ...interpolations : Interpolation[]) => R - - declare export type CSSConstructor = TaggedTemplateLiteral<CSSRules> - declare export type KeyFramesConstructor = TaggedTemplateLiteral<KeyFrames> - declare export type CreateGlobalStyleConstructor = TaggedTemplateLiteral<React$ComponentType<*>> - - declare interface Tag<T> { - styleTag: HTMLStyleElement | null; - getIds(): string[]; - hasNameForId(id: string, name: string): boolean; - insertMarker(id: string): T; - insertRules(id: string, cssRules: string[], name: ?string): void; - removeRules(id: string): void; - css(): string; - toHTML(additionalAttrs: ?string): string; - toElement(): React$Element<*>; - clone(): Tag<T>; - sealed: boolean; - } - - // The `any`/weak types in here all come from `styled-components` directly, since those definitions were just copied over - declare export class StyleSheet { - static get master() : StyleSheet; - static get instance() : StyleSheet; - static reset(forceServer? : boolean) : void; - - id : number; - forceServer : boolean; - target : ?HTMLElement; - tagMap : {[string]: Tag<any>}; // eslint-disable-line flowtype/no-weak-types - deferred: { [string]: string[] | void }; - rehydratedNames: { [string]: boolean }; - ignoreRehydratedNames: { [string]: boolean }; - tags: Tag<any>[]; // eslint-disable-line flowtype/no-weak-types - importRuleTag: Tag<any>; // eslint-disable-line flowtype/no-weak-types - capacity: number; - clones: StyleSheet[]; - - constructor(?HTMLElement) : this; - rehydrate() : this; - clone() : StyleSheet; - sealAllTags() : void; - makeTag(tag : ?Tag<any>) : Tag<any>; // eslint-disable-line flowtype/no-weak-types - getImportRuleTag() : Tag<any>; // eslint-disable-line flowtype/no-weak-types - getTagForId(id : string): Tag<any>; // eslint-disable-line flowtype/no-weak-types - hasId(id: string) : boolean; - hasNameForId(id: string, name: string) : boolean; - deferredInject(id : string, cssRules : string[]) : void; - inject(id: string, cssRules : string[], name? : string) : void; - remove(id : string) : void; - toHtml() : string; - toReactElements() : React$ElementType[]; - } - - declare export class KeyFrames { - id : string; - name : string; - rules : string[]; - - constructor(name : string, rules : string[]) : this; - inject(StyleSheet) : void; - toString() : string; - getName() : string; - } - - // I think any is appropriate here? - // eslint-disable-next-line flowtype/no-weak-types - declare export type Theme = {+[string] : any} - - declare export var css : CSSConstructor; - declare export var keyframes : KeyFramesConstructor; - declare export var createGlobalStyle : CreateGlobalStyleConstructor - declare export var ThemeProvider : React$ComponentType<{children?: ?React$Node, theme : Theme | (Theme) => Theme}> - - // This is a bit hard to read. Not sure how to make it more readable. I think adding line-breaks makes it worse. - declare type InjectedProps = { theme : Theme | void } - declare export function withTheme<Props : {}, Component: React$ComponentType<Props>>(WrappedComponent: Component) : React$ComponentType<$Diff<React$ElementConfig<$Supertype<Component>>, InjectedProps>>; - - - // @HACK This is a cheat to hide that the underlying type is "just a string" - // once we know of a better way, we should be able to update this accordingly. - // I don't think there _is_ a good way, currently. - // @NOTE Also not too sure about the naming of this... - declare export type StyledElementType<T> = T; - declare export type StyledComponentType<C> = { - [[call]]: TaggedTemplateLiteral<C>, - +attrs: <A: {}>(attributes: A | (props: React$ElementConfig<C>) => A) => TaggedTemplateLiteral<React$ComponentType<$Diff<React$ElementConfig<C>, A>>> - }; - - declare type StyledComponentList = { - a: StyledComponentType<StyledElementType<'a'>>, - abbr: StyledComponentType<StyledElementType<'abbr'>>, - address: StyledComponentType<StyledElementType<'address'>>, - area: StyledComponentType<StyledElementType<'area'>>, - article: StyledComponentType<StyledElementType<'article'>>, - aside: StyledComponentType<StyledElementType<'aside'>>, - audio: StyledComponentType<StyledElementType<'audio'>>, - b: StyledComponentType<StyledElementType<'b'>>, - base: StyledComponentType<StyledElementType<'base'>>, - bdi: StyledComponentType<StyledElementType<'bdi'>>, - bdo: StyledComponentType<StyledElementType<'bdo'>>, - big: StyledComponentType<StyledElementType<'big'>>, - blockquote: StyledComponentType<StyledElementType<'blockquote'>>, - body: StyledComponentType<StyledElementType<'body'>>, - br: StyledComponentType<StyledElementType<'br'>>, - button: StyledComponentType<StyledElementType<'button'>>, - canvas: StyledComponentType<StyledElementType<'canvas'>>, - caption: StyledComponentType<StyledElementType<'caption'>>, - cite: StyledComponentType<StyledElementType<'cite'>>, - code: StyledComponentType<StyledElementType<'code'>>, - col: StyledComponentType<StyledElementType<'col'>>, - colgroup: StyledComponentType<StyledElementType<'colgroup'>>, - data: StyledComponentType<StyledElementType<'data'>>, - datalist: StyledComponentType<StyledElementType<'datalist'>>, - dd: StyledComponentType<StyledElementType<'dd'>>, - del: StyledComponentType<StyledElementType<'del'>>, - details: StyledComponentType<StyledElementType<'details'>>, - dfn: StyledComponentType<StyledElementType<'dfn'>>, - dialog: StyledComponentType<StyledElementType<'dialog'>>, - div: StyledComponentType<StyledElementType<'div'>>, - dl: StyledComponentType<StyledElementType<'dl'>>, - dt: StyledComponentType<StyledElementType<'dt'>>, - em: StyledComponentType<StyledElementType<'em'>>, - embed: StyledComponentType<StyledElementType<'embed'>>, - fieldset: StyledComponentType<StyledElementType<'fieldset'>>, - figcaption: StyledComponentType<StyledElementType<'figcaption'>>, - figure: StyledComponentType<StyledElementType<'figure'>>, - footer: StyledComponentType<StyledElementType<'footer'>>, - form: StyledComponentType<StyledElementType<'form'>>, - h1: StyledComponentType<StyledElementType<'h1'>>, - h2: StyledComponentType<StyledElementType<'h2'>>, - h3: StyledComponentType<StyledElementType<'h3'>>, - h4: StyledComponentType<StyledElementType<'h4'>>, - h5: StyledComponentType<StyledElementType<'h5'>>, - h6: StyledComponentType<StyledElementType<'h6'>>, - head: StyledComponentType<StyledElementType<'head'>>, - header: StyledComponentType<StyledElementType<'header'>>, - hgroup: StyledComponentType<StyledElementType<'hgroup'>>, - hr: StyledComponentType<StyledElementType<'hr'>>, - html: StyledComponentType<StyledElementType<'html'>>, - i: StyledComponentType<StyledElementType<'i'>>, - iframe: StyledComponentType<StyledElementType<'iframe'>>, - img: StyledComponentType<StyledElementType<'img'>>, - input: StyledComponentType<StyledElementType<'input'>>, - ins: StyledComponentType<StyledElementType<'ins'>>, - kbd: StyledComponentType<StyledElementType<'kbd'>>, - keygen: StyledComponentType<StyledElementType<'keygen'>>, - label: StyledComponentType<StyledElementType<'label'>>, - legend: StyledComponentType<StyledElementType<'legend'>>, - li: StyledComponentType<StyledElementType<'li'>>, - link: StyledComponentType<StyledElementType<'link'>>, - main: StyledComponentType<StyledElementType<'main'>>, - map: StyledComponentType<StyledElementType<'map'>>, - mark: StyledComponentType<StyledElementType<'mark'>>, - menu: StyledComponentType<StyledElementType<'menu'>>, - menuitem: StyledComponentType<StyledElementType<'menuitem'>>, - meta: StyledComponentType<StyledElementType<'meta'>>, - meter: StyledComponentType<StyledElementType<'meter'>>, - nav: StyledComponentType<StyledElementType<'nav'>>, - noscript: StyledComponentType<StyledElementType<'noscript'>>, - object: StyledComponentType<StyledElementType<'object'>>, - ol: StyledComponentType<StyledElementType<'ol'>>, - optgroup: StyledComponentType<StyledElementType<'optgroup'>>, - option: StyledComponentType<StyledElementType<'option'>>, - output: StyledComponentType<StyledElementType<'output'>>, - p: StyledComponentType<StyledElementType<'p'>>, - param: StyledComponentType<StyledElementType<'param'>>, - picture: StyledComponentType<StyledElementType<'picture'>>, - pre: StyledComponentType<StyledElementType<'pre'>>, - progress: StyledComponentType<StyledElementType<'progress'>>, - q: StyledComponentType<StyledElementType<'q'>>, - rp: StyledComponentType<StyledElementType<'rp'>>, - rt: StyledComponentType<StyledElementType<'rt'>>, - ruby: StyledComponentType<StyledElementType<'ruby'>>, - s: StyledComponentType<StyledElementType<'s'>>, - samp: StyledComponentType<StyledElementType<'samp'>>, - script: StyledComponentType<StyledElementType<'script'>>, - section: StyledComponentType<StyledElementType<'section'>>, - select: StyledComponentType<StyledElementType<'select'>>, - small: StyledComponentType<StyledElementType<'small'>>, - source: StyledComponentType<StyledElementType<'source'>>, - span: StyledComponentType<StyledElementType<'span'>>, - strong: StyledComponentType<StyledElementType<'strong'>>, - style: StyledComponentType<StyledElementType<'style'>>, - sub: StyledComponentType<StyledElementType<'sub'>>, - summary: StyledComponentType<StyledElementType<'summary'>>, - sup: StyledComponentType<StyledElementType<'sup'>>, - table: StyledComponentType<StyledElementType<'table'>>, - tbody: StyledComponentType<StyledElementType<'tbody'>>, - td: StyledComponentType<StyledElementType<'td'>>, - textarea: StyledComponentType<StyledElementType<'textarea'>>, - tfoot: StyledComponentType<StyledElementType<'tfoot'>>, - th: StyledComponentType<StyledElementType<'th'>>, - thead: StyledComponentType<StyledElementType<'thead'>>, - time: StyledComponentType<StyledElementType<'time'>>, - title: StyledComponentType<StyledElementType<'title'>>, - tr: StyledComponentType<StyledElementType<'tr'>>, - track: StyledComponentType<StyledElementType<'track'>>, - u: StyledComponentType<StyledElementType<'u'>>, - ul: StyledComponentType<StyledElementType<'ul'>>, - var: StyledComponentType<StyledElementType<'var'>>, - video: StyledComponentType<StyledElementType<'video'>>, - wbr: StyledComponentType<StyledElementType<'wbr'>>, - - // SVG - circle: StyledComponentType<StyledElementType<'circle'>>, - clipPath: StyledComponentType<StyledElementType<'clipPath'>>, - defs: StyledComponentType<StyledElementType<'defs'>>, - ellipse: StyledComponentType<StyledElementType<'ellipse'>>, - g: StyledComponentType<StyledElementType<'g'>>, - image: StyledComponentType<StyledElementType<'image'>>, - line: StyledComponentType<StyledElementType<'line'>>, - linearGradient: StyledComponentType<StyledElementType<'linearGradient'>>, - mask: StyledComponentType<StyledElementType<'mask'>>, - path: StyledComponentType<StyledElementType<'path'>>, - pattern: StyledComponentType<StyledElementType<'pattern'>>, - polygon: StyledComponentType<StyledElementType<'polygon'>>, - polyline: StyledComponentType<StyledElementType<'polyline'>>, - radialGradient: StyledComponentType<StyledElementType<'radialGradient'>>, - rect: StyledComponentType<StyledElementType<'rect'>>, - stop: StyledComponentType<StyledElementType<'stop'>>, - svg: StyledComponentType<StyledElementType<'svg'>>, - text: StyledComponentType<StyledElementType<'text'>>, - tspan: StyledComponentType<StyledElementType<'tspan'>> - } - - declare export default StyledComponentList & { - [[call]]: <S : string>(S) => $ElementType<StyledComponentList, S>, - [[call]]: <P : {}, C : React$ComponentType<P>>(C) => StyledComponentType<C> - }; -} - - - -declare module 'styled-components/native' { - - declare export type Interpolation = - | (<P: {}>(executionContext: P) => string) - | CSSRules - | KeyFrames - | string - | number - - - declare export type CSSRules = Interpolation[] - - // This is not exported on purpose, since it's an implementation detail - declare type TaggedTemplateLiteral<R> = (strings : string[], ...interpolations : Interpolation[]) => R - - declare export type CSSConstructor = TaggedTemplateLiteral<CSSRules> - declare export type KeyFramesConstructor = TaggedTemplateLiteral<KeyFrames> - declare export type CreateGlobalStyleConstructor = TaggedTemplateLiteral<React$ComponentType<*>> - - declare interface Tag<T> { - styleTag: HTMLStyleElement | null; - getIds(): string[]; - hasNameForId(id: string, name: string): boolean; - insertMarker(id: string): T; - insertRules(id: string, cssRules: string[], name: ?string): void; - removeRules(id: string): void; - css(): string; - toHTML(additionalAttrs: ?string): string; - toElement(): React$Element<*>; - clone(): Tag<T>; - sealed: boolean; - } - - // The `any`/weak types in here all come from `styled-components` directly, since those definitions were just copied over - declare export class StyleSheet { - static get master() : StyleSheet; - static get instance() : StyleSheet; - static reset(forceServer? : boolean) : void; - - id : number; - forceServer : boolean; - target : ?HTMLElement; - tagMap : {[string]: Tag<any>}; // eslint-disable-line flowtype/no-weak-types - deferred: { [string]: string[] | void }; - rehydratedNames: { [string]: boolean }; - ignoreRehydratedNames: { [string]: boolean }; - tags: Tag<any>[]; // eslint-disable-line flowtype/no-weak-types - importRuleTag: Tag<any>; // eslint-disable-line flowtype/no-weak-types - capacity: number; - clones: StyleSheet[]; - - constructor(?HTMLElement) : this; - rehydrate() : this; - clone() : StyleSheet; - sealAllTags() : void; - makeTag(tag : ?Tag<any>) : Tag<any>; // eslint-disable-line flowtype/no-weak-types - getImportRuleTag() : Tag<any>; // eslint-disable-line flowtype/no-weak-types - getTagForId(id : string): Tag<any>; // eslint-disable-line flowtype/no-weak-types - hasId(id: string) : boolean; - hasNameForId(id: string, name: string) : boolean; - deferredInject(id : string, cssRules : string[]) : void; - inject(id: string, cssRules : string[], name? : string) : void; - remove(id : string) : void; - toHtml() : string; - toReactElements() : React$ElementType[]; - } - - declare export class KeyFrames { - id : string; - name : string; - rules : string[]; - - constructor(name : string, rules : string[]) : this; - inject(StyleSheet) : void; - toString() : string; - getName() : string; - } - - // I think any is appropriate here? - // eslint-disable-next-line flowtype/no-weak-types - declare export type Theme = {+[string] : any} - - declare export var css : CSSConstructor; - declare export var keyframes : KeyFramesConstructor; - declare export var createGlobalStyle : CreateGlobalStyleConstructor - declare export var ThemeProvider : React$ComponentType<{children?: ?React$Node, theme : Theme | (Theme) => Theme}> - - // This is a bit hard to read. Not sure how to make it more readable. I think adding line-breaks makes it worse. - declare type InjectedProps = { theme : Theme | void } - declare export function withTheme<Props : {}, Component: React$ComponentType<Props>>(WrappedComponent: Component) : React$ComponentType<$Diff<React$ElementConfig<$Supertype<Component>>, InjectedProps>>; - - - // @HACK This is a cheat to hide that the underlying type is "just a string" - // once we know of a better way, we should be able to update this accordingly. - // I don't think there _is_ a good way, currently. - // @NOTE Also not too sure about the naming of this... - declare export type StyledElementType<T> = T; - declare export type StyledComponentType<C> = { - [[call]]: TaggedTemplateLiteral<C>, - +attrs: <A: {}>(attributes: A) => TaggedTemplateLiteral<React$ComponentType<$Diff<React$ElementConfig<C>, A>>> - }; - - declare type StyledComponentList = { - ActivityIndicator: StyledComponentType<React$ComponentType<{}>>, - ActivityIndicatorIOS: StyledComponentType<React$ComponentType<{}>>, - ART: StyledComponentType<React$ComponentType<{}>>, - Button: StyledComponentType<React$ComponentType<{}>>, - DatePickerIOS: StyledComponentType<React$ComponentType<{}>>, - DrawerLayoutAndroid: StyledComponentType<React$ComponentType<{}>>, - Image: StyledComponentType<React$ComponentType<{}>>, - ImageBackground: StyledComponentType<React$ComponentType<{}>>, - ImageEditor: StyledComponentType<React$ComponentType<{}>>, - ImageStore: StyledComponentType<React$ComponentType<{}>>, - KeyboardAvoidingView: StyledComponentType<React$ComponentType<{}>>, - ListView: StyledComponentType<React$ComponentType<{}>>, - MapView: StyledComponentType<React$ComponentType<{}>>, - Modal: StyledComponentType<React$ComponentType<{}>>, - NavigatorIOS: StyledComponentType<React$ComponentType<{}>>, - Picker: StyledComponentType<React$ComponentType<{}>>, - PickerIOS: StyledComponentType<React$ComponentType<{}>>, - ProgressBarAndroid: StyledComponentType<React$ComponentType<{}>>, - ProgressViewIOS: StyledComponentType<React$ComponentType<{}>>, - ScrollView: StyledComponentType<React$ComponentType<{}>>, - SegmentedControlIOS: StyledComponentType<React$ComponentType<{}>>, - Slider: StyledComponentType<React$ComponentType<{}>>, - SliderIOS: StyledComponentType<React$ComponentType<{}>>, - SnapshotViewIOS: StyledComponentType<React$ComponentType<{}>>, - Switch: StyledComponentType<React$ComponentType<{}>>, - RecyclerViewBackedScrollView: StyledComponentType<React$ComponentType<{}>>, - RefreshControl: StyledComponentType<React$ComponentType<{}>>, - SafeAreaView: StyledComponentType<React$ComponentType<{}>>, - StatusBar: StyledComponentType<React$ComponentType<{}>>, - SwipeableListView: StyledComponentType<React$ComponentType<{}>>, - SwitchAndroid: StyledComponentType<React$ComponentType<{}>>, - SwitchIOS: StyledComponentType<React$ComponentType<{}>>, - TabBarIOS: StyledComponentType<React$ComponentType<{}>>, - Text: StyledComponentType<React$ComponentType<{}>>, - TextInput: StyledComponentType<React$ComponentType<{}>>, - ToastAndroid: StyledComponentType<React$ComponentType<{}>>, - ToolbarAndroid: StyledComponentType<React$ComponentType<{}>>, - Touchable: StyledComponentType<React$ComponentType<{}>>, - TouchableHighlight: StyledComponentType<React$ComponentType<{}>>, - TouchableNativeFeedback: StyledComponentType<React$ComponentType<{}>>, - TouchableOpacity: StyledComponentType<React$ComponentType<{}>>, - TouchableWithoutFeedback: StyledComponentType<React$ComponentType<{}>>, - View: StyledComponentType<React$ComponentType<{}>>, - ViewPagerAndroid: StyledComponentType<React$ComponentType<{}>>, - WebView: StyledComponentType<React$ComponentType<{}>>, - FlatList: StyledComponentType<React$ComponentType<{}>>, - SectionList: StyledComponentType<React$ComponentType<{}>>, - VirtualizedList: StyledComponentType<React$ComponentType<{}>>, - } - - declare export default StyledComponentList & { - [[call]]: <S : string>(S) => $ElementType<StyledComponentList, S>, - [[call]]: <P : {}, C : React$ComponentType<P>>(C) => StyledComponentType<C> - }; -} diff --git a/flow-typed/redux-persist.js.flow b/flow-typed/redux-persist.js.flow deleted file mode 100644 index cfa483a0..00000000 --- a/flow-typed/redux-persist.js.flow +++ /dev/null @@ -1,11 +0,0 @@ -// @flow - -declare module "redux-persist" { - declare export function autoRehydrate(): any - declare export function persistStore(any): any - declare export function persistReducer(any, any): any -} - -declare module "redux-persist/integration/react" { - declare export var PersistGate: any -} diff --git a/flow-typed/strorybook_v3.x.x.js b/flow-typed/strorybook_v3.x.x.js deleted file mode 100644 index b3f23695..00000000 --- a/flow-typed/strorybook_v3.x.x.js +++ /dev/null @@ -1,22 +0,0 @@ -// @flow -import React from 'react' - -declare function Callback(): React.Element<*> - -type Options = { - inline?: boolean -} - -declare module '@storybook/react' { - declare interface Story { - add: (storyName: string, callback: Function) => Story; - addWithInfo: (storyName: string, info: string | Function, storyFn?: Function | Options, options?: Options) => Story; - } - - declare function storiesOf(name: string, module: any): Story; - declare function action(name: string): Function; -} - -declare module '@storybook/addon-actions' { - declare function action(name: string): Function; -} From b8f9b7d799c650fb0546cf92928920623454100b Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Tue, 12 Mar 2019 02:53:24 +0900 Subject: [PATCH 20/25] refactor(typescript): containers --- app/components/A/tests/index.test.tsx | 1 + app/components/AutoLockScroll/index.tsx | 7 +- app/components/Chip/index.tsx | 11 ++- app/components/ColumnHeaderBookmark/index.tsx | 10 ++- .../{AddColumnModal.js => AddColumnModal.tsx} | 38 ++++----- .../AddColumnModal/{Card.js => Card.tsx} | 7 +- .../{LinkButton.js => LinkButton.tsx} | 7 +- .../AddColumnModal/{index.js => index.tsx} | 19 +++-- .../{Button.js => Button.tsx} | 10 ++- .../{index.js => index.tsx} | 13 ++- app/containers/App/{index.js => index.tsx} | 1 - .../{BookmarkButton.js => BookmarkButton.tsx} | 11 +-- .../BookmarkButton/{index.js => index.tsx} | 14 ++- .../BookmarkButton/{types.js => types.tsx} | 1 - .../BoxContainer/{index.js => index.tsx} | 56 ++++++------ .../ColumnBookmark/{index.js => index.tsx} | 35 ++++---- .../ColumnFollow/{index.js => index.tsx} | 35 ++++---- .../ColumnHistory/{index.js => index.tsx} | 26 +++--- .../ColumnManager/{index.js => index.tsx} | 46 +++++----- .../ColumnRanking/{index.js => index.tsx} | 34 ++++---- .../ColumnRankingR18/{index.js => index.tsx} | 38 ++++----- .../ColumnRecommended/{index.js => index.tsx} | 33 ++++--- .../FilterUsersIn/{index.js => index.tsx} | 10 +-- .../ColumnSearch/{index.js => index.tsx} | 42 ++++----- .../ColumnUserIllust/{index.js => index.tsx} | 33 +++---- .../DrawerManager/{index.js => index.tsx} | 13 ++- .../{FollowButton.js => FollowButton.tsx} | 41 +++++---- .../FollowButton/{index.js => index.tsx} | 14 +-- .../HeaderContainer/{index.js => index.tsx} | 15 ++-- .../{IllustPreview.js => IllustPreview.tsx} | 21 ++--- .../IllustPreview/{LazyImg.js => LazyImg.tsx} | 85 ++++++++++++------- .../IllustPreview/{index.js => index.tsx} | 22 ++--- .../Language/{index.js => index.tsx} | 17 ++-- .../{selectors.test.js => selectors.test.tsx} | 6 +- .../LoginModal/{index.js => index.tsx} | 10 +-- .../{selectors.test.js => selectors.test.tsx} | 20 ++--- .../{MultiPreview.js => MultiPreview.tsx} | 18 ++-- .../MangaPreview/{index.js => index.tsx} | 16 ++-- .../{ModalWrapper.js => ModalWrapper.tsx} | 22 ++--- .../ModalManeger/{index.js => index.tsx} | 18 ++-- .../ModalManeger/{sytles.js => sytles.tsx} | 3 - app/containers/Notify/saga.ts | 2 +- .../{Preview.js => Preview.tsx} | 5 +- .../PreviewFactory/{index.js => index.tsx} | 9 +- app/containers/Root/{index.js => index.tsx} | 9 +- .../SearchField/{Popover.js => Popover.tsx} | 17 ++-- .../{PopoverAuto.js => PopoverAuto.tsx} | 8 +- .../{SearchFiled.js => SearchFiled.tsx} | 50 ++++++----- .../{UsersOver.js => UsersOver.tsx} | 6 +- .../SearchField/{index.js => index.tsx} | 12 +-- .../SettingModal/{Card.js => Card.tsx} | 4 +- .../{LimitSetting.js => LimitSetting.tsx} | 2 - .../{SettingModal.js => SettingModal.tsx} | 48 +++++------ .../SettingModal/{index.js => index.tsx} | 11 ++- app/containers/Table/{Table.js => Table.tsx} | 27 +++--- app/containers/Table/{index.js => index.tsx} | 10 +-- .../{index.js => index.tsx} | 12 +-- .../{index.js => index.tsx} | 23 +++-- package.json | 3 +- tsconfig.json | 10 +-- yarn.lock | 24 +++++- 61 files changed, 586 insertions(+), 585 deletions(-) rename app/containers/AddColumnModal/{AddColumnModal.js => AddColumnModal.tsx} (82%) rename app/containers/AddColumnModal/{Card.js => Card.tsx} (92%) rename app/containers/AddColumnModal/{LinkButton.js => LinkButton.tsx} (90%) rename app/containers/AddColumnModal/{index.js => index.tsx} (82%) rename app/containers/AddNewColumnButton/{Button.js => Button.tsx} (77%) rename app/containers/AddNewColumnButton/{index.js => index.tsx} (58%) rename app/containers/App/{index.js => index.tsx} (98%) rename app/containers/BookmarkButton/{BookmarkButton.js => BookmarkButton.tsx} (88%) rename app/containers/BookmarkButton/{index.js => index.tsx} (76%) rename app/containers/BookmarkButton/{types.js => types.tsx} (83%) rename app/containers/BoxContainer/{index.js => index.tsx} (78%) rename app/containers/ColumnBookmark/{index.js => index.tsx} (76%) rename app/containers/ColumnFollow/{index.js => index.tsx} (76%) rename app/containers/ColumnHistory/{index.js => index.tsx} (78%) rename app/containers/ColumnManager/{index.js => index.tsx} (77%) rename app/containers/ColumnRanking/{index.js => index.tsx} (73%) rename app/containers/ColumnRankingR18/{index.js => index.tsx} (71%) rename app/containers/ColumnRecommended/{index.js => index.tsx} (78%) rename app/containers/ColumnSearch/FilterUsersIn/{index.js => index.tsx} (92%) rename app/containers/ColumnSearch/{index.js => index.tsx} (81%) rename app/containers/ColumnUserIllust/{index.js => index.tsx} (79%) rename app/containers/DrawerManager/{index.js => index.tsx} (79%) rename app/containers/FollowButton/{FollowButton.js => FollowButton.tsx} (76%) rename app/containers/FollowButton/{index.js => index.tsx} (59%) rename app/containers/HeaderContainer/{index.js => index.tsx} (83%) rename app/containers/IllustPreview/{IllustPreview.js => IllustPreview.tsx} (87%) rename app/containers/IllustPreview/{LazyImg.js => LazyImg.tsx} (76%) rename app/containers/IllustPreview/{index.js => index.tsx} (81%) rename app/containers/Language/{index.js => index.tsx} (89%) rename app/containers/Language/tests/{selectors.test.js => selectors.test.tsx} (69%) rename app/containers/LoginModal/{index.js => index.tsx} (73%) rename app/containers/LoginModal/tests/{selectors.test.js => selectors.test.tsx} (80%) rename app/containers/MangaPreview/{MultiPreview.js => MultiPreview.tsx} (65%) rename app/containers/MangaPreview/{index.js => index.tsx} (72%) rename app/containers/ModalManeger/{ModalWrapper.js => ModalWrapper.tsx} (82%) rename app/containers/ModalManeger/{index.js => index.tsx} (80%) rename app/containers/ModalManeger/{sytles.js => sytles.tsx} (98%) rename app/containers/PreviewFactory/{Preview.js => Preview.tsx} (86%) rename app/containers/PreviewFactory/{index.js => index.tsx} (65%) rename app/containers/Root/{index.js => index.tsx} (89%) rename app/containers/SearchField/{Popover.js => Popover.tsx} (86%) rename app/containers/SearchField/{PopoverAuto.js => PopoverAuto.tsx} (88%) rename app/containers/SearchField/{SearchFiled.js => SearchFiled.tsx} (80%) rename app/containers/SearchField/{UsersOver.js => UsersOver.tsx} (89%) rename app/containers/SearchField/{index.js => index.tsx} (78%) rename app/containers/SettingModal/{Card.js => Card.tsx} (88%) rename app/containers/SettingModal/{LimitSetting.js => LimitSetting.tsx} (98%) rename app/containers/SettingModal/{SettingModal.js => SettingModal.tsx} (85%) rename app/containers/SettingModal/{index.js => index.tsx} (85%) rename app/containers/Table/{Table.js => Table.tsx} (64%) rename app/containers/Table/{index.js => index.tsx} (68%) rename app/containers/UserDrawerContainer/{index.js => index.tsx} (80%) rename app/containers/UserPopoverContainer/{index.js => index.tsx} (69%) diff --git a/app/components/A/tests/index.test.tsx b/app/components/A/tests/index.test.tsx index a86b93be..ae770513 100644 --- a/app/components/A/tests/index.test.tsx +++ b/app/components/A/tests/index.test.tsx @@ -1,6 +1,7 @@ import * as React from 'react' import { mount } from 'enzyme' // eslint-disable-next-line import/no-unassigned-import +// eslint-disable-next-line import/no-unassigned-import import 'jest-styled-components' import A from '..' diff --git a/app/components/AutoLockScroll/index.tsx b/app/components/AutoLockScroll/index.tsx index 91e89133..8b6219e2 100644 --- a/app/components/AutoLockScroll/index.tsx +++ b/app/components/AutoLockScroll/index.tsx @@ -11,6 +11,8 @@ function getElementBody() { } class AutoLockScroll extends React.Component<Props> { + locked: boolean = false + componentDidMount() { if (this.props.lock === true) { this.preventScrolling() @@ -33,8 +35,6 @@ class AutoLockScroll extends React.Component<Props> { this.allowScrolling() } - locked: boolean = false - preventScrolling() { if (this.locked) { return @@ -61,8 +61,9 @@ class AutoLockScroll extends React.Component<Props> { body.style.overflow = originalBodyOverflow || '' originalBodyOverflow = null } - } // eslint-disable-next-line class-methods-use-this + } + // eslint-disable-next-line class-methods-use-this render() { return null } diff --git a/app/components/Chip/index.tsx b/app/components/Chip/index.tsx index 47fae443..dce81dc4 100644 --- a/app/components/Chip/index.tsx +++ b/app/components/Chip/index.tsx @@ -3,10 +3,11 @@ import styled from 'styled-components' import DeleteIcon from '../Icons/DeleteIcon' export interface Props { - children?: React.Node | null | undefined - onClick?: Function - onRequestDelete?: Function + children?: React.ReactNode + onClick?: any + onRequestDelete?: any } + const StyledChip = styled.div` display: flex; box-sizing: border-box; @@ -22,6 +23,7 @@ const StyledChip = styled.div` vertical-align: baseline; border-radius: 16px; ` + const InnerChip = styled.span` color: rgba(0, 0, 0, 0.87); font-size: 14px; @@ -32,13 +34,14 @@ const InnerChip = styled.span` user-select: none; white-space: nowrap; ` + const icnonStyle = { cursor: 'pointer', margin: '4px 4px 0px -8px', } class Chip extends React.PureComponent<Props> { - handleRequestDelete = (e: Event) => { + handleRequestDelete = (e: any) => { e.stopPropagation() if (this.props.onRequestDelete) { diff --git a/app/components/ColumnHeaderBookmark/index.tsx b/app/components/ColumnHeaderBookmark/index.tsx index 5aff385f..18245785 100644 --- a/app/components/ColumnHeaderBookmark/index.tsx +++ b/app/components/ColumnHeaderBookmark/index.tsx @@ -18,22 +18,23 @@ class ColumnHeaderSetting extends React.PureComponent<Props, State> { minBookmarks: 0, } + _sendBookmark = debounce(() => { + this.props.setMinBookmarks(this.state.minBookmarks) + }, 400) + componentWillMount() { this.setState({ minBookmarks: this.props.minBookmarks, }) } - handleSlider = (event: Event, value: number) => { + handleSlider = (event: any, value: number) => { this.setState({ minBookmarks: value, }) this._sendBookmark() } - _sendBookmark = debounce(() => { - this.props.setMinBookmarks(this.state.minBookmarks) - }, 400) render() { const { minBookmarks } = this.state @@ -59,4 +60,5 @@ const Wrap = styled.div` flex-direction: column; color: #eee; ` + export default ColumnHeaderSetting diff --git a/app/containers/AddColumnModal/AddColumnModal.js b/app/containers/AddColumnModal/AddColumnModal.tsx similarity index 82% rename from app/containers/AddColumnModal/AddColumnModal.js rename to app/containers/AddColumnModal/AddColumnModal.tsx index 1479e2ad..78263ed4 100644 --- a/app/containers/AddColumnModal/AddColumnModal.js +++ b/app/containers/AddColumnModal/AddColumnModal.tsx @@ -1,26 +1,24 @@ -// @flow import * as React from 'react' -import { injectIntl, FormattedMessage, type IntlShape } from 'react-intl' -import type { Mode } from 'containers/ColumnRanking/reducer' +import { injectIntl, FormattedMessage, IntlShape } from 'react-intl' +import { Mode } from 'containers/ColumnRanking/reducer' import rankingMessages from 'containers/ColumnRanking/messages' -import type { R18Mode } from 'containers/ColumnRankingR18/reducer' +import { R18Mode } from 'containers/ColumnRankingR18/reducer' import rankingR18Messages from 'containers/ColumnRankingR18/messages' import Card from './Card' import LinkButton from './LinkButton' import messages from './messages' import { Content, Header, Wrap } from './styles' -export type Props = { - addRecommended: () => void, - addBookmark: () => void, - addBookmarkPrivate: () => void, - addFollow: () => void, - addFollowPrivate: () => void, - addHistory: () => void, - addIllustRanking: (mode: Mode) => void, - addIllustR18Ranking: (mode: R18Mode) => void, +export interface Props { + addRecommended: () => undefined + addBookmark: () => undefined + addBookmarkPrivate: () => undefined + addFollow: () => undefined + addFollowPrivate: () => undefined + addHistory: () => undefined + addIllustRanking: (mode: Mode) => undefined + addIllustR18Ranking: (mode: R18Mode) => undefined } - const rankingMode = [ 'day', 'week', @@ -30,7 +28,6 @@ const rankingMode = [ 'week_original', 'week_rookie', ] - const rankingR18Mode = [ 'day_r18', 'week_r18', @@ -39,9 +36,14 @@ const rankingR18Mode = [ 'week_r18g', ] -function SelectColumnModal(props: Props & { intl: IntlShape }) { +function SelectColumnModal( + props: Props & { + intl: IntlShape + } +) { const IllustRankingLinks = rankingMode.map(v => { const handleClick = () => props.addIllustRanking(v) + return ( <LinkButton text={props.intl.formatMessage(rankingMessages[v])} @@ -50,9 +52,9 @@ function SelectColumnModal(props: Props & { intl: IntlShape }) { /> ) }) - const IllustR18RankingLinks = rankingR18Mode.map(v => { const handleClick = () => props.addIllustR18Ranking(v) + return ( <LinkButton text={props.intl.formatMessage(rankingR18Messages[v])} @@ -61,7 +63,6 @@ function SelectColumnModal(props: Props & { intl: IntlShape }) { /> ) }) - const { addBookmark, addBookmarkPrivate, @@ -70,7 +71,6 @@ function SelectColumnModal(props: Props & { intl: IntlShape }) { addHistory, addRecommended, } = props - return ( <Wrap> <Header> diff --git a/app/containers/AddColumnModal/Card.js b/app/containers/AddColumnModal/Card.tsx similarity index 92% rename from app/containers/AddColumnModal/Card.js rename to app/containers/AddColumnModal/Card.tsx index 6ac682f1..f59bd0c4 100644 --- a/app/containers/AddColumnModal/Card.js +++ b/app/containers/AddColumnModal/Card.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' @@ -16,7 +15,6 @@ const Wrap = styled.div` background: #fff; overflow-y: auto; ` - const Title = styled.div` font-size: 14px; padding-left: 16px; @@ -26,7 +24,6 @@ const Title = styled.div` box-sizing: border-box; line-height: 40px; ` - const ListWrap = styled.div` padding: 0; margin: 0; @@ -38,8 +35,8 @@ const List = ({ children }: { children?: React.Node }) => ( ) interface Props { - title: string | React.Element<any>; - children?: React.Node; + title: string | React.Element + children?: React.Node } const Card = ({ title, children }: Props) => ( diff --git a/app/containers/AddColumnModal/LinkButton.js b/app/containers/AddColumnModal/LinkButton.tsx similarity index 90% rename from app/containers/AddColumnModal/LinkButton.js rename to app/containers/AddColumnModal/LinkButton.tsx index 107e32b0..4e9077e3 100644 --- a/app/containers/AddColumnModal/LinkButton.js +++ b/app/containers/AddColumnModal/LinkButton.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' @@ -18,14 +17,12 @@ const Wrap = styled.div` background-color: rgba(0, 0, 0, 0.098); } ` - const InnerButton = styled.div` padding: 10px 16px 10px 17px; ` - interface Props { - text: string | React.Element<any>; - onClick: () => void; + text: string | React.Element + onClick: () => undefined } const LinkButton = ({ text, onClick }: Props) => ( diff --git a/app/containers/AddColumnModal/index.js b/app/containers/AddColumnModal/index.tsx similarity index 82% rename from app/containers/AddColumnModal/index.js rename to app/containers/AddColumnModal/index.tsx index 4753f6b5..a1596020 100644 --- a/app/containers/AddColumnModal/index.js +++ b/app/containers/AddColumnModal/index.tsx @@ -1,40 +1,46 @@ -// @flow -import { connect, type Connector } from 'react-redux' -import type { Dispatch } from 'types' +import { connect, Connector } from 'react-redux' +import { Dispatch } from 'types' import { addColumn as addRankingColumn } from 'containers/ColumnRanking/actions' import { addColumn as addRankingR18Column } from 'containers/ColumnRankingR18/actions' import { addColumn as addBookmarkColumn } from 'containers/ColumnBookmark/actions' import { addColumn as addFollowColumn } from 'containers/ColumnFollow/actions' import { addColumn as addRecommendedColumn } from 'containers/ColumnRecommended/actions' import { addColumnHistory } from 'containers/ColumnHistory/actions' -import type { Mode } from 'containers/ColumnRanking/reducer' -import type { R18Mode } from 'containers/ColumnRankingR18/reducer' +import { Mode } from 'containers/ColumnRanking/reducer' +import { R18Mode } from 'containers/ColumnRankingR18/reducer' import Modal from './AddColumnModal' -import type { Props } from './AddColumnModal' +import { Props } from './AddColumnModal' function mapDispatchToProps(dispatch: Dispatch) { return { addRecommended() { dispatch(addRecommendedColumn('recommended')) }, + addHistory() { dispatch(addColumnHistory()) }, + addBookmark() { dispatch(addBookmarkColumn('public')) }, + addBookmarkPrivate() { dispatch(addBookmarkColumn('private')) }, + addFollow() { dispatch(addFollowColumn('public')) }, + addFollowPrivate() { dispatch(addFollowColumn('private')) }, + addIllustRanking(mode: Mode) { dispatch(addRankingColumn(mode)) }, + addIllustR18Ranking(mode: R18Mode) { dispatch(addRankingR18Column(mode)) }, @@ -45,5 +51,4 @@ const connector: Connector<{}, Props> = connect( undefined, mapDispatchToProps ) - export default connector(Modal) diff --git a/app/containers/AddNewColumnButton/Button.js b/app/containers/AddNewColumnButton/Button.tsx similarity index 77% rename from app/containers/AddNewColumnButton/Button.js rename to app/containers/AddNewColumnButton/Button.tsx index b869de10..876d48fb 100644 --- a/app/containers/AddNewColumnButton/Button.js +++ b/app/containers/AddNewColumnButton/Button.tsx @@ -1,15 +1,19 @@ -// @flow import * as React from 'react' import { FormattedMessage } from 'react-intl' import Button from 'components/common/Button' import messages from './messages' export interface Props { - onClick: () => void; + onClick: () => undefined } const AddColumnButton = ({ onClick }: Props) => ( - <a style={{ margin: '0 10px' }} onClick={onClick}> + <a + style={{ + margin: '0 10px', + }} + onClick={onClick} + > <Button label={<FormattedMessage {...messages.addColumn} />} /> </a> ) diff --git a/app/containers/AddNewColumnButton/index.js b/app/containers/AddNewColumnButton/index.tsx similarity index 58% rename from app/containers/AddNewColumnButton/index.js rename to app/containers/AddNewColumnButton/index.tsx index d94489ad..3d7581e1 100644 --- a/app/containers/AddNewColumnButton/index.js +++ b/app/containers/AddNewColumnButton/index.tsx @@ -1,12 +1,11 @@ -// @flow -import { connect, type Connector } from 'react-redux' -import type { Dispatch } from 'types' -import type { User } from 'types/user' +import { connect, Connector } from 'react-redux' +import { Dispatch } from 'types' +import { User } from 'types/user' import { addColumn } from '../ColumnUserIllust/actions' -import AddColumnButton, { type Props } from './Button' +import AddColumnButton, { Props } from './Button' -type OP = { - user: User, +interface OP { + user: User } const mapDispatchToProps = (dispatch: Dispatch, { user }) => ({ diff --git a/app/containers/App/index.js b/app/containers/App/index.tsx similarity index 98% rename from app/containers/App/index.js rename to app/containers/App/index.tsx index 6b8b51c9..929fa92b 100644 --- a/app/containers/App/index.js +++ b/app/containers/App/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import MainView from 'components/MainView' import Table from 'containers/Table' diff --git a/app/containers/BookmarkButton/BookmarkButton.js b/app/containers/BookmarkButton/BookmarkButton.tsx similarity index 88% rename from app/containers/BookmarkButton/BookmarkButton.js rename to app/containers/BookmarkButton/BookmarkButton.tsx index 72876639..b492bd30 100644 --- a/app/containers/BookmarkButton/BookmarkButton.js +++ b/app/containers/BookmarkButton/BookmarkButton.tsx @@ -1,10 +1,8 @@ -// @flow import * as React from 'react' import IconButton from 'material-ui/IconButton' import FavoriteIcon from 'material-ui/svg-icons/action/favorite' const iconSize = 18 - const styles = { button: { width: 32, @@ -15,13 +13,11 @@ const styles = { height: iconSize, }, } - const hoverColor = '#b94343' - export interface Props { - addBookmark: () => void; - deleteBookmark: () => void; - isBookmarked: boolean; + addBookmark: () => undefined + deleteBookmark: () => undefined + isBookmarked: boolean } const BookmarkButton = ({ @@ -30,7 +26,6 @@ const BookmarkButton = ({ deleteBookmark, }: Props) => { const onClick = isBookmarked ? deleteBookmark : addBookmark - return ( <IconButton onClick={onClick} style={styles.button} iconStyle={styles.icon}> <FavoriteIcon diff --git a/app/containers/BookmarkButton/index.js b/app/containers/BookmarkButton/index.tsx similarity index 76% rename from app/containers/BookmarkButton/index.js rename to app/containers/BookmarkButton/index.tsx index 16484aa3..90fd924b 100644 --- a/app/containers/BookmarkButton/index.js +++ b/app/containers/BookmarkButton/index.tsx @@ -1,8 +1,7 @@ -// @flow -import { connect, type Connector } from 'react-redux' +import { connect, Connector } from 'react-redux' import { createSelector } from 'reselect' -import type { Dispatch } from 'types' -import BookmarkButton, { type Props } from './BookmarkButton' +import { Dispatch } from 'types' +import BookmarkButton, { Props } from './BookmarkButton' import { addBookmarkRequest, deleteBookmarkRequest } from './actions' import { makeIsBookmarked } from './selectors' @@ -17,18 +16,17 @@ const mapDispatchToProps = (dispatch: Dispatch, { id }) => ({ addBookmark() { dispatch(addBookmarkRequest(id, 'public')) }, + deleteBookmark() { dispatch(deleteBookmarkRequest(id)) }, }) -type OP = { - id: number, +interface OP { + id: number } - const connector: Connector<OP, Props> = connect( mapStateToProps, mapDispatchToProps ) - export default connector(BookmarkButton) diff --git a/app/containers/BookmarkButton/types.js b/app/containers/BookmarkButton/types.tsx similarity index 83% rename from app/containers/BookmarkButton/types.js rename to app/containers/BookmarkButton/types.tsx index 7c60d952..dc1477f6 100644 --- a/app/containers/BookmarkButton/types.js +++ b/app/containers/BookmarkButton/types.tsx @@ -1,2 +1 @@ -// @flow export type Restrict = 'public' | 'private' diff --git a/app/containers/BoxContainer/index.js b/app/containers/BoxContainer/index.tsx similarity index 78% rename from app/containers/BoxContainer/index.js rename to app/containers/BoxContainer/index.tsx index a023b0dc..c02dc2b3 100644 --- a/app/containers/BoxContainer/index.js +++ b/app/containers/BoxContainer/index.tsx @@ -1,12 +1,11 @@ -// @flow import { remote } from 'electron' import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { connect, Connector } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' -import type { User } from 'types/user' -import { injectIntl, type IntlShape } from 'react-intl' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' +import { User } from 'types/user' +import { injectIntl, IntlShape } from 'react-intl' import { openDrawer } from 'containers/DrawerManager/actions' import { openIllustViewer } from 'containers/IllustPreview/actions' import { addColumn } from 'containers/ColumnSearch/actions' @@ -16,22 +15,26 @@ import { makeSelectIllust } from 'containers/IllustById/selectors' import createMenu from './createMenu' import * as selectors from './selectors' -type Props = { - illust: Illust, - user: User, - isIllustOnly: boolean, - isShowCaption: boolean, - openUserDrawer: (userId: number) => void, - openPreview: (type: 'illust' | 'manga') => void, - addColumnSearchIllust: Function, - // for context menu - dispatch: Dispatch, +interface Props { + illust: Illust + user: User + isIllustOnly: boolean + isShowCaption: boolean + openUserDrawer: (userId: number) => undefined + openPreview: (type: 'illust' | 'manga') => undefined + addColumnSearchIllust: Function + dispatch: Dispatch } -class BoxContainer extends React.Component<Props & { intl: IntlShape }> { +class BoxContainer extends React.Component< + Props & { + intl: IntlShape + } +> { shouldComponentUpdate(nextProps: Props) { const { illust, isIllustOnly, isShowCaption } = this.props const nextIllust = nextProps.illust + if (nextIllust.isBookmarked !== illust.isBookmarked) { return true } else if (nextIllust.totalBookmarks !== illust.totalBookmarks) { @@ -41,26 +44,27 @@ class BoxContainer extends React.Component<Props & { intl: IntlShape }> { } else if (nextProps.isIllustOnly !== isIllustOnly) { return true } + return false } handleTagClick = (tag: string) => { this.props.addColumnSearchIllust(tag) } - handleContextMenu = (e: Event) => { e.preventDefault() - const { dispatch, illust, intl } = this.props + const menu = createMenu({ + dispatch, + illust, + intl, + }) // $FlowFixMe - const menu = createMenu({ dispatch, illust, intl }) - // $FlowFixMe menu.popup(remote.getCurrentWindow()) } render() { const { openPreview, openUserDrawer, illust } = this.props - return ( <Box id={illust.id} @@ -74,10 +78,9 @@ class BoxContainer extends React.Component<Props & { intl: IntlShape }> { } } -type OP = { - id: number, +interface OP { + id: number } - const mapStateToProps = createStructuredSelector({ illust: makeSelectIllust(), user: selectors.makeSelectUser(), @@ -88,6 +91,7 @@ const mapStateToProps = createStructuredSelector({ const mapDispatchToProps = (dispatch: Dispatch, { id }) => { return { dispatch, + openPreview(type: 'illust' | 'manga') { if (type === 'illust') { dispatch(openIllustViewer(id)) @@ -95,9 +99,11 @@ const mapDispatchToProps = (dispatch: Dispatch, { id }) => { dispatch(openMangaPreview(id)) } }, + openUserDrawer(userId: number) { dispatch(openDrawer(userId)) }, + addColumnSearchIllust(tag: string) { dispatch(addColumn(tag)) }, diff --git a/app/containers/ColumnBookmark/index.js b/app/containers/ColumnBookmark/index.tsx similarity index 76% rename from app/containers/ColumnBookmark/index.js rename to app/containers/ColumnBookmark/index.tsx index 7ae7d1b6..66a03ef0 100644 --- a/app/containers/ColumnBookmark/index.js +++ b/app/containers/ColumnBookmark/index.tsx @@ -1,33 +1,30 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { connect, Connector } from 'react-redux' import { createStructuredSelector } from 'reselect' -import { injectIntl, type IntlShape } from 'react-intl' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' +import { injectIntl, IntlShape } from 'react-intl' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' import IllustList from 'components/IllustList' import ColumnRoot from 'components/ColumnRoot' import ColumnHeader from 'components/ColumnHeader' import ColumnBody from 'components/ColumnBody' -import type { ColumnProps } from '../ColumnManager' -import type { ColumnId } from './reducer' +import { ColumnProps } from '../ColumnManager' +import { ColumnId } from './reducer' import { makeSelectIllusts } from './selectors' import * as actions from './actions' import messages from './messages' -type OP = { - id: ColumnId, +interface OP { + id: ColumnId } - type Props = { - illusts: Array<Illust>, - onFetch: () => void, - onNext: () => void, + illusts: Illust[] + onFetch: () => undefined + onNext: () => undefined } & OP & ColumnProps - -type InjectProp = { - intl: IntlShape, +interface InjectProp { + intl: IntlShape } class ColumnBookMark extends React.PureComponent<Props & InjectProp> { @@ -44,11 +41,9 @@ class ColumnBookMark extends React.PureComponent<Props & InjectProp> { intl, onHeaderClick, setNode, - } = this.props + } = this.props // TODO リミットをstoreに保存 - // TODO リミットをstoreに保存 const hasMore = illusts.length < 200 - return ( <ColumnRoot> <ColumnHeader @@ -79,6 +74,7 @@ function mapDispatchToProps(dispatch: Dispatch, { id }: OP) { onFetch() { dispatch(actions.fetch(id)) }, + onNext() { dispatch(actions.fetchNext(id)) }, @@ -89,5 +85,4 @@ const connector: Connector<OP, Props> = connect( mapStateToProps, mapDispatchToProps ) - export default connector(injectIntl(ColumnBookMark)) diff --git a/app/containers/ColumnFollow/index.js b/app/containers/ColumnFollow/index.tsx similarity index 76% rename from app/containers/ColumnFollow/index.js rename to app/containers/ColumnFollow/index.tsx index b857eb45..6a32f695 100644 --- a/app/containers/ColumnFollow/index.js +++ b/app/containers/ColumnFollow/index.tsx @@ -1,33 +1,30 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { connect, Connector } from 'react-redux' import { createStructuredSelector } from 'reselect' -import { injectIntl, type IntlShape } from 'react-intl' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' +import { injectIntl, IntlShape } from 'react-intl' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' import IllustList from 'components/IllustList' import ColumnRoot from 'components/ColumnRoot' import ColumnBody from 'components/ColumnBody' import ColumnHeader from 'components/ColumnHeader' -import { type ColumnProps } from '../ColumnManager' -import type { ColumnId } from './reducer' +import { ColumnProps } from '../ColumnManager' +import { ColumnId } from './reducer' import { makeSelectIllusts } from './selectors' import * as actions from './actions' import messages from './messages' -type OP = { - id: ColumnId, +interface OP { + id: ColumnId } - type Props = { - illusts: Array<Illust>, - onFetch: () => void, - onNext: () => void, + illusts: Illust[] + onFetch: () => undefined + onNext: () => undefined } & OP & ColumnProps - -type InjectProp = { - intl: IntlShape, +interface InjectProp { + intl: IntlShape } class ColumnFollow extends React.Component<Props & InjectProp> { @@ -44,11 +41,9 @@ class ColumnFollow extends React.Component<Props & InjectProp> { intl, onHeaderClick, setNode, - } = this.props + } = this.props // TODO リミットをstoreに保存 - // TODO リミットをstoreに保存 const hasMore = illusts.length < 200 - return ( <ColumnRoot> <ColumnHeader @@ -79,6 +74,7 @@ function mapDispatchToProps(dispatch: Dispatch, { id }: OP) { onFetch() { dispatch(actions.fetch(id)) }, + onNext() { dispatch(actions.fetchNext(id)) }, @@ -89,5 +85,4 @@ const connector: Connector<OP, Props> = connect( mapStateToProps, mapDispatchToProps ) - export default connector(injectIntl(ColumnFollow)) diff --git a/app/containers/ColumnHistory/index.js b/app/containers/ColumnHistory/index.tsx similarity index 78% rename from app/containers/ColumnHistory/index.js rename to app/containers/ColumnHistory/index.tsx index 22233a6d..f50473e3 100644 --- a/app/containers/ColumnHistory/index.js +++ b/app/containers/ColumnHistory/index.tsx @@ -1,35 +1,31 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { connect, Connector } from 'react-redux' import { createStructuredSelector } from 'reselect' -import { injectIntl, type IntlShape } from 'react-intl' -import type { Illust } from 'types/illust' +import { injectIntl, IntlShape } from 'react-intl' +import { Illust } from 'types/illust' import IllustList from 'components/IllustList' import ColumnRoot from 'components/ColumnRoot' import ColumnBody from 'components/ColumnBody' import ColumnHeader from 'components/ColumnHeader' -import type { ColumnProps } from '../ColumnManager' -import type { ColumnId } from './reducer' +import { ColumnProps } from '../ColumnManager' +import { ColumnId } from './reducer' import { makeSelectIllusts } from './selectors' import messages from './messages' -type OP = { - id: ColumnId, +interface OP { + id: ColumnId } - type Props = { - illusts: Array<Illust>, + illusts: Illust[] } & OP & ColumnProps - -type InjectProp = { - intl: IntlShape, +interface InjectProp { + intl: IntlShape } class ColumnHistory extends React.PureComponent<Props & InjectProp> { render() { const { illusts, id, onClose, intl, onHeaderClick, setNode } = this.props - return ( <ColumnRoot> <ColumnHeader @@ -56,7 +52,5 @@ class ColumnHistory extends React.PureComponent<Props & InjectProp> { const mapStateToProps = createStructuredSelector({ illusts: makeSelectIllusts(), }) - const connector: Connector<OP, Props> = connect(mapStateToProps) - export default connector(injectIntl(ColumnHistory)) diff --git a/app/containers/ColumnManager/index.js b/app/containers/ColumnManager/index.tsx similarity index 77% rename from app/containers/ColumnManager/index.js rename to app/containers/ColumnManager/index.tsx index 5dcee10e..a5be0ece 100644 --- a/app/containers/ColumnManager/index.js +++ b/app/containers/ColumnManager/index.tsx @@ -1,9 +1,9 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { Dispatch } from 'redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' import { removeTable } from 'containers/Table/actions' -import scrollToTopBind, { type HandleHeaderClick } from 'utils/scrollToTopBind' +import scrollToTopBind, { HandleHeaderClick } from 'utils/scrollToTopBind' import ColumnRanking from '../ColumnRanking' import ColumnRankingR18 from '../ColumnRankingR18' import ColumnBookmark from '../ColumnBookmark' @@ -12,31 +12,34 @@ import ColumnUserIllust from '../ColumnUserIllust' import ColumnSearch from '../ColumnSearch' import ColumnHistory from '../ColumnHistory' import ColumnRecommended from '../ColumnRecommended' -import type { ColumnManagerId, ColumnType } from './reducer' +import { ColumnManagerId, ColumnType } from './reducer' import { makeSelectColumnId, makeSelectType } from './selectors' -export type Props = { - id: any, // TODO - type: ColumnType, - onClose: () => void, +export interface Props { + id: any + type: ColumnType + onClose: () => undefined } -type State = { - onHeaderClick: HandleHeaderClick, +interface State { + onHeaderClick: HandleHeaderClick } -export type ColumnProps = { - onHeaderClick: HandleHeaderClick, - setNode: () => void, - onClose: () => void, +export interface ColumnProps { + onHeaderClick: HandleHeaderClick + setNode: () => undefined + onClose: () => undefined } class ColumnManager extends React.PureComponent<Props, State> { - state: State = { onHeaderClick: () => {} } - + state: State = { + onHeaderClick: () => {}, + } setNode = node => { if (node) { - this.setState({ onHeaderClick: scrollToTopBind(node) }) + this.setState({ + onHeaderClick: scrollToTopBind(node), + }) } } @@ -74,14 +77,14 @@ class ColumnManager extends React.PureComponent<Props, State> { <ColumnRecommended {...rest} {...this.state} setNode={this.setNode} /> ) } + return null } } -type OP = { - id: ColumnManagerId, +interface OP { + id: ColumnManagerId } - const mapStateToProps = createStructuredSelector({ id: makeSelectColumnId(), type: makeSelectType(), @@ -93,9 +96,8 @@ const mapDispatchToProps = (dispatch: Dispatch, { id }: OP) => ({ }, }) -const connector: Connector<OP, Props> = connect( +const connector = connect( mapStateToProps, mapDispatchToProps ) - export default connector(ColumnManager) diff --git a/app/containers/ColumnRanking/index.js b/app/containers/ColumnRanking/index.tsx similarity index 73% rename from app/containers/ColumnRanking/index.js rename to app/containers/ColumnRanking/index.tsx index b59a641e..e2dd7cae 100644 --- a/app/containers/ColumnRanking/index.js +++ b/app/containers/ColumnRanking/index.tsx @@ -1,34 +1,33 @@ -// @flow import * as React from 'react' import { bindActionCreators } from 'redux' -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import { injectIntl, type IntlShape } from 'react-intl' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' +import { injectIntl, IntlShape } from 'react-intl' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' import IllustList from 'components/IllustList' import ColumnRoot from 'components/ColumnRoot' import ColumnBody from 'components/ColumnBody' import ColumnHeader from 'components/ColumnHeader' -import type { ColumnProps } from '../ColumnManager' -import type { ColumnId } from './reducer' +import { ColumnProps } from '../ColumnManager' +import { ColumnId } from './reducer' import { makeSelectIllusts } from './selectors' import * as actions from './actions' import messages from './messages' -type OP = { - id: ColumnId, +interface OP { + id: ColumnId } type Props = { - illusts: Array<Illust>, - onNext: () => void, - actions: typeof actions, + illusts: Illust[] + onNext: () => undefined + actions: typeof actions } & OP & ColumnProps -type InjectProp = { - intl: IntlShape, +interface InjectProp { + intl: IntlShape } class ColumnRanking extends React.Component<Props & InjectProp> { @@ -45,11 +44,9 @@ class ColumnRanking extends React.Component<Props & InjectProp> { } render() { - const { illusts, id, onClose, intl, setNode } = this.props + const { illusts, id, onClose, intl, setNode } = this.props // TODO リミットをstoreに保存 - // TODO リミットをstoreに保存 const hasMore = illusts.length < 200 - return ( <ColumnRoot> <ColumnHeader @@ -81,9 +78,8 @@ function mapDispatch(dispatch: Dispatch) { } } -const connector: Connector<OP, Props> = connect( +const connector = connect( mapState, mapDispatch ) - export default connector(injectIntl(ColumnRanking)) diff --git a/app/containers/ColumnRankingR18/index.js b/app/containers/ColumnRankingR18/index.tsx similarity index 71% rename from app/containers/ColumnRankingR18/index.js rename to app/containers/ColumnRankingR18/index.tsx index 827ab8a8..f84344f7 100644 --- a/app/containers/ColumnRankingR18/index.js +++ b/app/containers/ColumnRankingR18/index.tsx @@ -1,34 +1,31 @@ -// @flow import * as React from 'react' import { bindActionCreators } from 'redux' -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import { injectIntl, type IntlShape } from 'react-intl' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' +import { injectIntl, IntlShape } from 'react-intl' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' import IllustList from 'components/IllustList' import ColumnRoot from 'components/ColumnRoot' import ColumnBody from 'components/ColumnBody' import ColumnHeader from 'components/ColumnHeader' -import type { ColumnProps } from '../ColumnManager' -import type { ColumnId } from './reducer' +import { ColumnProps } from '../ColumnManager' +import { ColumnId } from './reducer' import { makeSelectIllusts } from './selectors' import * as actions from './actions' import messages from './messages' -type OP = { - id: ColumnId, +interface OP { + id: ColumnId } - type Props = { - illusts: Array<Illust>, - onNext: () => void, - actions: typeof actions, + illusts: Illust[] + onNext: () => undefined + actions: typeof actions } & OP & ColumnProps - -type InjectProp = { - intl: IntlShape, +interface InjectProp { + intl: IntlShape } class ColumnRankingR18 extends React.Component<Props & InjectProp> { @@ -45,15 +42,13 @@ class ColumnRankingR18 extends React.Component<Props & InjectProp> { } render() { - const { illusts, id, onClose, intl, setNode } = this.props + const { illusts, id, onClose, intl, setNode } = this.props // TODO リミットをstoreに保存 - // TODO リミットをstoreに保存 const hasMore = illusts.length < 200 - return ( <ColumnRoot> <ColumnHeader - name={intl.formatMessage(messages[id])} + name={intl.formatMessage(messages[id] as any)} onClose={onClose} onTopClick={this.handleTop} /> @@ -81,9 +76,8 @@ function mapDispatch(dispatch: Dispatch) { } } -const connector: Connector<OP, Props> = connect( +const connector = connect( mapState, mapDispatch ) - export default connector(injectIntl(ColumnRankingR18)) diff --git a/app/containers/ColumnRecommended/index.js b/app/containers/ColumnRecommended/index.tsx similarity index 78% rename from app/containers/ColumnRecommended/index.js rename to app/containers/ColumnRecommended/index.tsx index b4ee4bfa..37a09ab6 100644 --- a/app/containers/ColumnRecommended/index.js +++ b/app/containers/ColumnRecommended/index.tsx @@ -1,29 +1,27 @@ -// @flow import * as React from 'react' import { bindActionCreators } from 'redux' -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import { injectIntl, type IntlShape } from 'react-intl' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' +import { injectIntl, IntlShape } from 'react-intl' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' import IllustList from 'components/IllustList' import ColumnRoot from 'components/ColumnRoot' import ColumnBody from 'components/ColumnBody' import ColumnHeader from 'components/ColumnHeader' -import type { ColumnProps } from '../ColumnManager' +import { ColumnProps } from '../ColumnManager' import { makeSelectIllusts } from './selectors' import * as actions from './actions' import messages from './messages' type Props = { - illusts: Array<Illust>, - onFetch: () => void, - onNext: () => void, - actions: typeof actions, + illusts: Illust[] + onFetch: () => undefined + onNext: () => undefined + actions: typeof actions } & ColumnProps - -type InjectProp = { - intl: IntlShape, +interface InjectProp { + intl: IntlShape } class ColumnRecommended extends React.Component<Props & InjectProp> { @@ -38,11 +36,9 @@ class ColumnRecommended extends React.Component<Props & InjectProp> { } render() { - const { illusts, onClose, onNext, intl, setNode } = this.props + const { illusts, onClose, onNext, intl, setNode } = this.props // TODO リミットをstoreに保存 - // TODO リミットをstoreに保存 const hasMore = illusts.length < 1000 - return ( <ColumnRoot> <ColumnHeader @@ -73,16 +69,17 @@ function mapDispatch(dispatch: Dispatch) { onFetch() { dispatch(actions.fetch('recommended')) }, + onNext() { dispatch(actions.fetch('recommended')) }, + actions: bindActionCreators(actions, dispatch), } } -const connector: Connector<{}, Props> = connect( +const connector = connect( mapState, mapDispatch ) - export default connector(injectIntl(ColumnRecommended)) diff --git a/app/containers/ColumnSearch/FilterUsersIn/index.js b/app/containers/ColumnSearch/FilterUsersIn/index.tsx similarity index 92% rename from app/containers/ColumnSearch/FilterUsersIn/index.js rename to app/containers/ColumnSearch/FilterUsersIn/index.tsx index 5d89e843..c46bed8e 100644 --- a/app/containers/ColumnSearch/FilterUsersIn/index.js +++ b/app/containers/ColumnSearch/FilterUsersIn/index.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import { RadioButton, RadioButtonGroup } from 'material-ui/RadioButton' @@ -8,21 +7,20 @@ const Wrap = styled.div` flex-direction: column; color: #eee; ` - const styles = { color: '#eee', } - interface Props { - defaultValue: string; - onChange: Function; + defaultValue: string + onChange: Function } class FilterUsersIn extends React.Component<Props> { - handleChange = (e: Event, value: ?string) => { + handleChange = (e: Event, value: string | null | undefined) => { if (!value) { return } + this.props.onChange(Number(value)) } diff --git a/app/containers/ColumnSearch/index.js b/app/containers/ColumnSearch/index.tsx similarity index 81% rename from app/containers/ColumnSearch/index.js rename to app/containers/ColumnSearch/index.tsx index 1acb1728..c4e8f0b8 100644 --- a/app/containers/ColumnSearch/index.js +++ b/app/containers/ColumnSearch/index.tsx @@ -1,34 +1,32 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' import IllustList from 'components/IllustList' import ColumnRoot from 'components/ColumnRoot' import ColumnBody from 'components/ColumnBody' import ColumnHeader from 'components/ColumnHeader' import ColumnHeaderBookmark from 'components/ColumnHeaderBookmark' -import type { ColumnProps } from '../ColumnManager' +import { ColumnProps } from '../ColumnManager' import FilterUsersIn from './FilterUsersIn' -import type { ColumnId } from './reducer' +// import { ColumnId } from './reducer' import * as selectors from './selectors' import * as actions from './actions' -type OP = { - id: ColumnId, +interface OP { + id: string } - type Props = { - illusts: Array<Illust>, - minBookmarks: number, - hasMore: boolean, - usersIn: number, - onFetch: () => void, - onNext: () => void, - setMinBookmarks: number => void, - onFilterUsersIn: number => void, - onStartWatch: Function, + illusts: Illust[] + minBookmarks: number + hasMore: boolean + usersIn: number + onFetch: () => undefined + onNext: () => undefined + setMinBookmarks: (a: number) => undefined + onFilterUsersIn: (a: number) => undefined + onStartWatch: any } & OP & ColumnProps @@ -53,7 +51,6 @@ class ColumnSearch extends React.PureComponent<Props> { setNode, onFilterUsersIn, } = this.props - return ( <ColumnRoot> <ColumnHeader name={id} onClose={onClose} onTopClick={onHeaderClick}> @@ -93,24 +90,27 @@ function mapDispatchToProps(dispatch: Dispatch, { id }: OP) { onStartWatch() { dispatch(actions.startWatch(id)) }, + onFilterUsersIn(usersIn) { dispatch(actions.usersIn(id, usersIn)) }, + onFetch() { dispatch(actions.fetch(id)) }, + onNext() { dispatch(actions.fetchNext(id)) }, + setMinBookmarks(minBookmarks) { dispatch(actions.setMinBookbook(id, minBookmarks)) }, } } -const connector: Connector<OP, Props> = connect( +const connector = connect( mapStateToProps, mapDispatchToProps ) - export default connector(ColumnSearch) diff --git a/app/containers/ColumnUserIllust/index.js b/app/containers/ColumnUserIllust/index.tsx similarity index 79% rename from app/containers/ColumnUserIllust/index.js rename to app/containers/ColumnUserIllust/index.tsx index 20c60510..ac2b52a5 100644 --- a/app/containers/ColumnUserIllust/index.js +++ b/app/containers/ColumnUserIllust/index.tsx @@ -1,28 +1,26 @@ -// @flow import * as React from 'react' -import type { User } from 'types/user' -import { connect, type Connector } from 'react-redux' +import { User } from 'types/user' +import { connect, Connector } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' import IllustList from 'components/IllustList' import ColumnRoot from 'components/ColumnRoot' import ColumnBody from 'components/ColumnBody' import ColumnHeader from 'components/ColumnHeader' -import type { ColumnProps } from '../ColumnManager' -import type { ColumnId } from './reducer' +import { ColumnProps } from '../ColumnManager' +import { ColumnId } from './reducer' import { makeSelectIllusts, makeSelectUser } from './selectors' import * as actions from './actions' -type OP = { - id: ColumnId, +interface OP { + id: ColumnId } - type Props = { - illusts: Array<Illust>, - user: User, - onFetch: () => void, - onNext: () => void, + illusts: Illust[] + user: User + onFetch: () => undefined + onNext: () => undefined } & OP & ColumnProps @@ -41,16 +39,13 @@ class ColumnUserIllust extends React.Component<Props> { onHeaderClick, setNode, } = this.props - const name = user && user.name if (!name) { return null - } + } // TODO リミットをstoreに保存 - // TODO リミットをstoreに保存 const hasMore = illusts.length < 200 - return ( <ColumnRoot> <ColumnHeader @@ -82,6 +77,7 @@ function mapDispatchToProps(dispatch: Dispatch, { id }: OP) { onFetch() { dispatch(actions.fetch(id)) }, + onNext() { dispatch(actions.fetchNext(id)) }, @@ -92,5 +88,4 @@ const connector: Connector<OP, Props> = connect( mapStateToProps, mapDispatchToProps ) - export default connector(ColumnUserIllust) diff --git a/app/containers/DrawerManager/index.js b/app/containers/DrawerManager/index.tsx similarity index 79% rename from app/containers/DrawerManager/index.js rename to app/containers/DrawerManager/index.tsx index 43eb321f..14e5df93 100644 --- a/app/containers/DrawerManager/index.js +++ b/app/containers/DrawerManager/index.tsx @@ -1,15 +1,15 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { Dispatch } from 'redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' import Drawer from 'components/Drawer' import UserDrawerContainer from 'containers/UserDrawerContainer' import { closeDrawer } from './actions' import { makeSelectOpen } from './selectors' -type Props = { - onRequestClose: () => void, - open: boolean, +interface Props { + onRequestClose: () => undefined + open: boolean } function DrawerManager(props: Props) { @@ -30,9 +30,8 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ }, }) -const connector: Connector<{}, Props> = connect( +const connector = connect( mapStateToProps, mapDispatchToProps ) - export default connector(DrawerManager) diff --git a/app/containers/FollowButton/FollowButton.js b/app/containers/FollowButton/FollowButton.tsx similarity index 76% rename from app/containers/FollowButton/FollowButton.js rename to app/containers/FollowButton/FollowButton.tsx index 4a1ffe95..28554ecc 100644 --- a/app/containers/FollowButton/FollowButton.js +++ b/app/containers/FollowButton/FollowButton.tsx @@ -1,18 +1,16 @@ -// @flow import * as React from 'react' -import type { User } from 'types/user' +import { User } from 'types/user' import Button from 'components/common/Button' import { FormattedMessage } from 'react-intl' import messages from './messages' -export type Props = { - user: User, - onClick: () => void, +export interface Props { + user: User + onClick: () => undefined } - -type State = { - isFollowing: boolean, - isFollowed: boolean, +interface State { + isFollowing: boolean + isFollowed: boolean } function selectLabel( @@ -24,6 +22,7 @@ function selectLabel( } else if (!isFollowed && isFollowing) { return <FormattedMessage {...messages.following} /> } + return <FormattedMessage {...messages.follow} /> } @@ -37,24 +36,31 @@ class FollowButton extends React.PureComponent<Props, State> { const { user: { isFollowed }, } = this.props - this.setState({ isFollowed }) + this.setState({ + isFollowed, + }) } handleMouseEnter = () => { - this.setState({ isFollowing: false }) + this.setState({ + isFollowing: false, + }) } - handleMouseLeave = () => { - this.setState({ isFollowing: true }) + this.setState({ + isFollowing: true, + }) } - handleClickUnFollow = () => { - this.setState({ isFollowed: false }) + this.setState({ + isFollowed: false, + }) this.props.onClick() } - handleClickFollow = () => { - this.setState({ isFollowing: true }) + this.setState({ + isFollowing: true, + }) this.props.onClick() } @@ -73,6 +79,7 @@ class FollowButton extends React.PureComponent<Props, State> { /> ) } + return <Button onClick={this.handleClickFollow} label={label} /> } } diff --git a/app/containers/FollowButton/index.js b/app/containers/FollowButton/index.tsx similarity index 59% rename from app/containers/FollowButton/index.js rename to app/containers/FollowButton/index.tsx index 76f6c0a3..1962a2a7 100644 --- a/app/containers/FollowButton/index.js +++ b/app/containers/FollowButton/index.tsx @@ -1,10 +1,12 @@ -// @flow -import { connect, type Connector } from 'react-redux' -import type { User } from 'types/user' +import { connect } from 'react-redux' +import { Dispatch } from 'redux' +import { User } from 'types/user' import { followRequest, unFollowRequest } from './actions' -import FollowButton, { type Props } from './FollowButton' +import FollowButton, { Props } from './FollowButton' -type OwnProps = { user: User } +interface OwnProps { + user: User +} const mapDispatchToProps = (dispatch: Dispatch, { user }) => ({ onClick() { @@ -16,7 +18,7 @@ const mapDispatchToProps = (dispatch: Dispatch, { user }) => ({ }, }) -const connector: Connector<OwnProps, Props> = connect( +const connector = connect( null, mapDispatchToProps ) diff --git a/app/containers/HeaderContainer/index.js b/app/containers/HeaderContainer/index.tsx similarity index 83% rename from app/containers/HeaderContainer/index.js rename to app/containers/HeaderContainer/index.tsx index d7c4f97c..05177edc 100644 --- a/app/containers/HeaderContainer/index.js +++ b/app/containers/HeaderContainer/index.tsx @@ -1,8 +1,7 @@ -// @flow -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' -import Header, { type Props } from 'components/Sidebar' +import { Dispatch } from 'types' +import Header, { Props } from 'components/Sidebar' import { logout } from '../LoginModal/actions' import { openModal } from '../ModalManeger/actions' import { @@ -25,27 +24,33 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ onLogout() { dispatch(logout()) }, + onClickAdd() { dispatch(openModal('AddColumn')) }, + onToggleDropdown() { dispatch(toggleDropdown()) }, + onCloseDropdown() { dispatch(closeDropdown()) }, + onOpenFilterModal() { dispatch(openModal('Setting')) }, + toggleSearchField() { dispatch(toggleSearchField()) }, + closeSearchField() { dispatch(closeSearchField()) }, }) -const connector: Connector<{}, Props> = connect( +const connector = connect( mapStateToProps, mapDispatchToProps ) diff --git a/app/containers/IllustPreview/IllustPreview.js b/app/containers/IllustPreview/IllustPreview.tsx similarity index 87% rename from app/containers/IllustPreview/IllustPreview.js rename to app/containers/IllustPreview/IllustPreview.tsx index 09d0d865..4ee4feca 100644 --- a/app/containers/IllustPreview/IllustPreview.js +++ b/app/containers/IllustPreview/IllustPreview.tsx @@ -1,19 +1,17 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import LazyImg from './LazyImg' interface Props { - from: string; - original: string; - width: number; - height: number; - isLoaded: boolean; - onLoad: () => void; - onUnLoad: () => void; - onClose: () => void; + from: string + original: string + width: number + height: number + isLoaded: boolean + onLoad: () => undefined + onUnLoad: () => undefined + onClose: () => undefined } - export default class IllustPreview extends React.PureComponent<Props> { componentWillUnmount() { this.props.onUnLoad() @@ -27,7 +25,6 @@ export default class IllustPreview extends React.PureComponent<Props> { handleOnClose = () => { this.props.onClose() } - escToClose = (event: Event) => { // $FlowFixMe if (event.keyCode === 27) { @@ -37,7 +34,6 @@ export default class IllustPreview extends React.PureComponent<Props> { render() { const { width, height, from, original } = this.props - return ( <StyledPreview onClick={this.handleOnClose}> <LazyImg @@ -53,7 +49,6 @@ export default class IllustPreview extends React.PureComponent<Props> { ) } } - const StyledPreview = styled.div` display: flex; position: fixed; diff --git a/app/containers/IllustPreview/LazyImg.js b/app/containers/IllustPreview/LazyImg.tsx similarity index 76% rename from app/containers/IllustPreview/LazyImg.js rename to app/containers/IllustPreview/LazyImg.tsx index bf6fcd18..382117cb 100644 --- a/app/containers/IllustPreview/LazyImg.js +++ b/app/containers/IllustPreview/LazyImg.tsx @@ -1,29 +1,46 @@ -// @flow import * as React from 'react' import styled, { keyframes } from 'styled-components' import CloseButton from 'components/common/CloseButton' import { LazyImgWrapper as Wrapper } from './styles' interface Size { - width: number | 'auto'; - height: number | 'auto'; + width: number | 'auto' + height: number | 'auto' } function calcSize(width: number, height: number): Size { const { innerWidth, innerHeight } = window + if (height > innerHeight && width > innerWidth) { return width * innerHeight < height * innerWidth - ? { width: 'auto', height: innerHeight } - : { width: innerWidth, height: 'auto' } + ? { + width: 'auto', + height: innerHeight, + } + : { + width: innerWidth, + height: 'auto', + } } + if (height > innerHeight) { - return { width: 'auto', height: innerHeight } + return { + width: 'auto', + height: innerHeight, + } } + if (width > innerWidth) { - return { width: innerWidth, height: 'auto' } + return { + width: innerWidth, + height: 'auto', + } } - return { width, height } + return { + width, + height, + } } function calcMarginTop(node: HTMLElement | null): number { @@ -42,21 +59,19 @@ function calcMarginTop(node: HTMLElement | null): number { } interface Props { - from: string; - original: string; - width: number; - height: number; - isLoaded: boolean; - onLoad: () => void; - onClose: () => void; + from: string + original: string + width: number + height: number + isLoaded: boolean + onLoad: () => undefined + onClose: () => undefined } - interface State { - isClicked: boolean; - fromMarginTop: number; - toMarginTop: number; + isClicked: boolean + fromMarginTop: number + toMarginTop: number } - export default class LazyImg extends React.PureComponent<Props, State> { to: HTMLElement | null from: HTMLElement | null @@ -65,17 +80,15 @@ export default class LazyImg extends React.PureComponent<Props, State> { fromMarginTop: 0, toMarginTop: 0, } - handleLoad = () => { if (!this.from) { return } + this.setState({ fromMarginTop: calcMarginTop(this.from), }) - const img = new Image() - img.addEventListener('load', () => { if (this.to) { this.props.onLoad() @@ -84,13 +97,13 @@ export default class LazyImg extends React.PureComponent<Props, State> { }) } }) - img.src = this.props.original } - handleClick = (event: Event) => { event.stopPropagation() - this.setState({ isClicked: !this.state.isClicked }) + this.setState({ + isClicked: !this.state.isClicked, + }) } render() { @@ -102,8 +115,14 @@ export default class LazyImg extends React.PureComponent<Props, State> { return ( <Wrapper> <CloseButton - style={{ color: '#676767', top: '10px', right: '10px' }} - iconStyle={{ fill: 'white' }} + style={{ + color: '#676767', + top: '10px', + right: '10px', + }} + iconStyle={{ + fill: 'white', + }} onClick={onClose} /> <Img @@ -124,7 +143,12 @@ export default class LazyImg extends React.PureComponent<Props, State> { return ( <Wrapper> - <CloseButton onClick={onClose} iconStyle={{ fill: 'white' }} /> + <CloseButton + onClick={onClose} + iconStyle={{ + fill: 'white', + }} + /> <FromImg src={this.props.from} marginTop={this.state.fromMarginTop} @@ -139,7 +163,6 @@ export default class LazyImg extends React.PureComponent<Props, State> { ) } } - const FromImg = styled.img` width: auto; height: auto; @@ -150,13 +173,11 @@ const FromImg = styled.img` user-select: none; cursor: wait; ` - const fadeIn = keyframes` 0% { filter: blur(1px); } 100% { filter: none; } ` - const Img = styled.img` width: auto; height: auto; diff --git a/app/containers/IllustPreview/index.js b/app/containers/IllustPreview/index.tsx similarity index 81% rename from app/containers/IllustPreview/index.js rename to app/containers/IllustPreview/index.tsx index 281e7de4..f1774807 100644 --- a/app/containers/IllustPreview/index.js +++ b/app/containers/IllustPreview/index.tsx @@ -1,9 +1,8 @@ -// @flow import React, { Component } from 'react' -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' import { coloseIllustViewer, startImgLoading, @@ -12,11 +11,11 @@ import { import * as selectors from './selectors' import Preview from './IllustPreview' -type Props = { - illust: Illust, - show: boolean, - isImgLoading: boolean, - dispatch: Dispatch, +interface Props { + illust: Illust + show: boolean + isImgLoading: boolean + dispatch: Dispatch } class IllustPreviewContainer extends Component<Props> { @@ -29,11 +28,9 @@ class IllustPreviewContainer extends Component<Props> { handleClose = () => { this.props.dispatch(coloseIllustViewer()) } - handleLoad = () => { this.props.dispatch(finishImgLoading()) } - handleUnLoad = () => { this.props.dispatch(startImgLoading()) } @@ -62,6 +59,5 @@ const mapStateToProps = createStructuredSelector({ show: selectors.makeSelectIsImage(), isImgLoading: selectors.makeSelectIsImgLoding(), }) - -const connecter: Connector<{}, Props> = connect(mapStateToProps) +const connecter = connect(mapStateToProps) export default connecter(IllustPreviewContainer) diff --git a/app/containers/Language/index.js b/app/containers/Language/index.tsx similarity index 89% rename from app/containers/Language/index.js rename to app/containers/Language/index.tsx index c838fd42..5746229e 100644 --- a/app/containers/Language/index.js +++ b/app/containers/Language/index.tsx @@ -1,29 +1,25 @@ -// @flow import electron from 'electron' import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { connect, Connector } from 'react-redux' import { IntlProvider } from 'react-intl' import { createStructuredSelector } from 'reselect' import { makeSelectLocale } from './selectors' import { DEFAULT_LOCALE } from './reducer' import * as actions from './actions' -type OP = { - messages: Object, - children?: React.Element<*>, +interface OP { + messages: object + children?: React.Element } - type Props = { - locale: ?string, + locale: string | null | undefined } & typeof actions & OP - export class Language extends React.Component<Props> { componentDidMount() { if (!this.props.locale) { const app = electron.remote.app || electron.app const sysLocale = app.getLocale().toLowerCase() - const locale = ['id', 'ja', 'zh', 'zh-tw'].includes(sysLocale) ? sysLocale : 'en' @@ -34,7 +30,6 @@ export class Language extends React.Component<Props> { render() { const { locale, messages, children } = this.props const localeMessages = (messages && locale && messages[locale]) || {} - return ( <IntlProvider defaultLocale={DEFAULT_LOCALE} @@ -47,11 +42,9 @@ export class Language extends React.Component<Props> { ) } } - const mapStateToProps = createStructuredSelector({ locale: makeSelectLocale(), }) - const connector: Connector<OP, Props> = connect( mapStateToProps, actions diff --git a/app/containers/Language/tests/selectors.test.js b/app/containers/Language/tests/selectors.test.tsx similarity index 69% rename from app/containers/Language/tests/selectors.test.js rename to app/containers/Language/tests/selectors.test.tsx index 24053d77..870d9dcd 100644 --- a/app/containers/Language/tests/selectors.test.js +++ b/app/containers/Language/tests/selectors.test.tsx @@ -2,6 +2,10 @@ import { makeSelectLocale } from '../selectors' test('makeSelectLocale', () => { - const state = { Language: { locale: 'en' } } + const state = { + Language: { + locale: 'en', + }, + } expect(makeSelectLocale()(state)).toMatchSnapshot() }) diff --git a/app/containers/LoginModal/index.js b/app/containers/LoginModal/index.tsx similarity index 73% rename from app/containers/LoginModal/index.js rename to app/containers/LoginModal/index.tsx index 49e5fb56..4f7ca7d1 100644 --- a/app/containers/LoginModal/index.js +++ b/app/containers/LoginModal/index.tsx @@ -1,8 +1,7 @@ -// @flow -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import LoginModal, { type Props } from 'components/LoginModal' -import type { Dispatch } from 'types' +import LoginModal, { Props } from 'components/LoginModal' +import { Dispatch } from 'types' import { loginRequest } from './actions' import * as selectors from './selectors' @@ -19,9 +18,8 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ }, }) -const connector: Connector<{}, Props> = connect( +const connector = connect( mapStateToProps, mapDispatchToProps ) - export default connector(LoginModal) diff --git a/app/containers/LoginModal/tests/selectors.test.js b/app/containers/LoginModal/tests/selectors.test.tsx similarity index 80% rename from app/containers/LoginModal/tests/selectors.test.js rename to app/containers/LoginModal/tests/selectors.test.tsx index 893fd85a..840f3b28 100644 --- a/app/containers/LoginModal/tests/selectors.test.js +++ b/app/containers/LoginModal/tests/selectors.test.tsx @@ -14,10 +14,7 @@ const mockStore = { const createMock = s => { return { - LoginModal: { - ...mockStore, - ...s, - }, + LoginModal: { ...mockStore, ...s }, } } @@ -25,20 +22,23 @@ test('makeSelectInfo', () => { const getInfo = selectors.makeSelectInfo() expect(getInfo(mockStore)).toMatchSnapshot() }) - test('makeSelectIsLoginFailure', () => { const s = selectors.makeSelectIsLoginFailure() expect(s(mockStore)).toBe(false) }) - test('makeSelectIsLoading', () => { const s = selectors.makeSelectIsLoading() expect(s(mockStore)).toBe(false) }) - test('getMyId', () => { expect(selectors.getMyId(mockStore)).toBeNull() - expect(selectors.getMyId(createMock({ account: { id: '1' } }))).toStrictEqual( - '1' - ) + expect( + selectors.getMyId( + createMock({ + account: { + id: '1', + }, + }) + ) + ).toStrictEqual('1') }) diff --git a/app/containers/MangaPreview/MultiPreview.js b/app/containers/MangaPreview/MultiPreview.tsx similarity index 65% rename from app/containers/MangaPreview/MultiPreview.js rename to app/containers/MangaPreview/MultiPreview.tsx index 7ff6cf9a..a319bb79 100644 --- a/app/containers/MangaPreview/MultiPreview.js +++ b/app/containers/MangaPreview/MultiPreview.tsx @@ -1,24 +1,26 @@ -// @flow import * as React from 'react' -import type { MetaPages } from 'types/illust' +import { MetaPages } from 'types/illust' import CloseButton from 'components/common/CloseButton' import { Wrapper, Item, Img } from './styles' -type Props = { - pages: MetaPages, - onClose: () => void, +interface Props { + pages: MetaPages + onClose: () => undefined } - export default function MultiPreview({ pages, onClose }: Props) { const imgs = pages.map(page => ( <Item key={page.imageUrls.medium}> <Img src={page.imageUrls.large} /> </Item> )) - return ( <Wrapper onClick={onClose}> - <CloseButton onClick={onClose} style={{ position: 'fixed' }} /> + <CloseButton + onClick={onClose} + style={{ + position: 'fixed', + }} + /> {imgs} </Wrapper> ) diff --git a/app/containers/MangaPreview/index.js b/app/containers/MangaPreview/index.tsx similarity index 72% rename from app/containers/MangaPreview/index.js rename to app/containers/MangaPreview/index.tsx index 9b1d0b47..21383087 100644 --- a/app/containers/MangaPreview/index.js +++ b/app/containers/MangaPreview/index.tsx @@ -1,16 +1,15 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' -import type { Illust } from 'types/illust' +import { Dispatch } from 'types' +import { Illust } from 'types/illust' import { closeMangaPreview } from './actions' import MultiPreview from './MultiPreview' import { makeSelectIllust } from './selectors' -type Props = { - illust: Illust, - close: () => void, +interface Props { + illust: Illust + close: () => undefined } function MangaPreviewContainer({ illust, close }: Props) { @@ -24,8 +23,7 @@ function MangaPreviewContainer({ illust, close }: Props) { const mapStateToProps = createStructuredSelector({ illust: makeSelectIllust(), }) - -const connector: Connector<{}, Props> = connect( +const connector = connect( mapStateToProps, (dispatch: Dispatch) => { return { diff --git a/app/containers/ModalManeger/ModalWrapper.js b/app/containers/ModalManeger/ModalWrapper.tsx similarity index 82% rename from app/containers/ModalManeger/ModalWrapper.js rename to app/containers/ModalManeger/ModalWrapper.tsx index 38f3e180..1d8fe600 100644 --- a/app/containers/ModalManeger/ModalWrapper.js +++ b/app/containers/ModalManeger/ModalWrapper.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import EventListener from 'react-event-listener' import handleEscCreater from 'utils/handleEscCreater' @@ -7,25 +6,22 @@ import CloseButton from 'components/common/CloseButton' import { Content, Wrap } from './sytles' interface Props { - open: boolean; - onRequestClose?: Function; - children?: React.Node; - onClose: Function; + open: boolean + onRequestClose?: Function + children?: React.Node + onClose: Function } - export default class ModalWrapper extends React.Component<Props> { node: HTMLElement - requestClose = () => { this.props.onClose() const { onRequestClose } = this.props + if (onRequestClose) { onRequestClose(false) } } - handleKeyUp = handleEscCreater(this.requestClose) - setNode = (node: HTMLElement | null) => { if (node) { this.node = node @@ -46,7 +42,13 @@ export default class ModalWrapper extends React.Component<Props> { <CloseButton onClick={onClose} /> {open && children} </Content> - <Overlay show={open} style={{ zIndex: 800 }} onClick={onClose} /> + <Overlay + show={open} + style={{ + zIndex: 800, + }} + onClick={onClose} + /> </Wrap> ) } diff --git a/app/containers/ModalManeger/index.js b/app/containers/ModalManeger/index.tsx similarity index 80% rename from app/containers/ModalManeger/index.js rename to app/containers/ModalManeger/index.tsx index 5d8cd41d..95eec7c3 100644 --- a/app/containers/ModalManeger/index.js +++ b/app/containers/ModalManeger/index.tsx @@ -1,20 +1,19 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' +import { Dispatch } from 'types' import LoginModal from '../LoginModal' import AddColumnModal from '../AddColumnModal' import SettingModal from '../SettingModal' -import type { ModalType } from './reducer' +import { ModalType } from './reducer' import { closeModal } from './actions' import ModalWrapper from './ModalWrapper' import { makeSelectType, makeSelectOpen } from './selector' -type Props = { - type: ModalType, - open: boolean, - closeModal: () => void, +interface Props { + type: ModalType + open: boolean + closeModal: () => undefined } function Modal({ type, open, closeModal }: Props) { @@ -26,6 +25,7 @@ function Modal({ type, open, closeModal }: Props) { } else if (type === 'Login') { return <LoginModal /> } + return <AddColumnModal /> } @@ -47,7 +47,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ }, }) -const connector: Connector<{}, Props> = connect( +const connector = connect( mapStateToProps, mapDispatchToProps ) diff --git a/app/containers/ModalManeger/sytles.js b/app/containers/ModalManeger/sytles.tsx similarity index 98% rename from app/containers/ModalManeger/sytles.js rename to app/containers/ModalManeger/sytles.tsx index 55108c8a..a01baa76 100644 --- a/app/containers/ModalManeger/sytles.js +++ b/app/containers/ModalManeger/sytles.tsx @@ -1,4 +1,3 @@ -// @flow import styled, { keyframes } from 'styled-components' export const Wrap = styled.div` @@ -14,7 +13,6 @@ export const Wrap = styled.div` left: 0; z-index: 700; ` - const fadeIn = keyframes` 0% { opacity: 0; @@ -28,7 +26,6 @@ const fadeIn = keyframes` margin-top: 0; } ` - export const Content = styled.div` z-index: 900; position: relative; diff --git a/app/containers/Notify/saga.ts b/app/containers/Notify/saga.ts index 9d60b842..069cd849 100644 --- a/app/containers/Notify/saga.ts +++ b/app/containers/Notify/saga.ts @@ -1,5 +1,5 @@ -import { select, takeEvery } from 'redux-saga/effects' import { shell } from 'electron' +import { select, takeEvery } from 'redux-saga/effects' import { Illust } from 'types/illust' import { User } from 'types/user' import { getSelectIllust } from '../IllustById/selectors' diff --git a/app/containers/PreviewFactory/Preview.js b/app/containers/PreviewFactory/Preview.tsx similarity index 86% rename from app/containers/PreviewFactory/Preview.js rename to app/containers/PreviewFactory/Preview.tsx index 38e9e751..d1f5804b 100644 --- a/app/containers/PreviewFactory/Preview.js +++ b/app/containers/PreviewFactory/Preview.tsx @@ -1,11 +1,10 @@ -// @flow import * as React from 'react' import IllustPreview from '../IllustPreview' import MangaPreview from '../MangaPreview' export interface Props { - isOpenImage: boolean; - isOpenManga: boolean; + isOpenImage: boolean + isOpenManga: boolean } const Preview = ({ isOpenImage, isOpenManga }: Props) => { diff --git a/app/containers/PreviewFactory/index.js b/app/containers/PreviewFactory/index.tsx similarity index 65% rename from app/containers/PreviewFactory/index.js rename to app/containers/PreviewFactory/index.tsx index de9c5b25..4518e37d 100644 --- a/app/containers/PreviewFactory/index.js +++ b/app/containers/PreviewFactory/index.tsx @@ -1,15 +1,12 @@ -// @flow -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' import { makeSelectOpen } from '../MangaPreview/selectors' import { makeSelectIsImage } from '../IllustPreview/selectors' -import Preview, { type Props } from './Preview' +import Preview, { Props } from './Preview' const mapStateToProps = createStructuredSelector({ isOpenImage: makeSelectIsImage(), isOpenManga: makeSelectOpen(), }) - -const connecter: Connector<{}, Props> = connect(mapStateToProps) - +const connecter = connect(mapStateToProps) export default connecter(Preview) diff --git a/app/containers/Root/index.js b/app/containers/Root/index.tsx similarity index 89% rename from app/containers/Root/index.js rename to app/containers/Root/index.tsx index 6165887c..7fa50bb7 100644 --- a/app/containers/Root/index.js +++ b/app/containers/Root/index.tsx @@ -1,17 +1,16 @@ -// @flow import * as React from 'react' import { Provider } from 'react-redux' import { PersistGate } from 'redux-persist/integration/react' import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider' import App from 'containers/App' import Language from 'containers/Language' -import type { Store } from 'types' +import { Store } from 'types' import { GlobalStyle } from '../../styles/global-styles' import { translationMessages } from '../../i18n' -type Props = { - store: Store, - persistor: any, +interface Props { + store: Store + persistor: any } function Root({ store, persistor }: Props) { diff --git a/app/containers/SearchField/Popover.js b/app/containers/SearchField/Popover.tsx similarity index 86% rename from app/containers/SearchField/Popover.js rename to app/containers/SearchField/Popover.tsx index 23ac869a..a92e9bd5 100644 --- a/app/containers/SearchField/Popover.js +++ b/app/containers/SearchField/Popover.tsx @@ -1,20 +1,17 @@ -// @flow import * as React from 'react' import styled from 'styled-components' interface ItemProps { - start: string; - end: string; - onClick: () => void; + start: string + end: string + onClick: () => undefined } - export const Item = ({ start, end, onClick }: ItemProps) => ( <ItemWrap onClick={onClick}> <u>{start}</u> {end} </ItemWrap> ) - const ItemWrap = styled.div` height: 45px; padding: 0 12px; @@ -25,21 +22,17 @@ const ItemWrap = styled.div` background-color: rgb(230, 239, 247); } ` - interface Props { - title: string | React.Element<any>; - children?: React.Node; + title: string | React.Element + children?: React.Node } - const Wrap = styled.div` box-sizing: border-box; background: white; ` - const Content = styled.div` padding-top: 4px; ` - const Title = styled.div` background-color: #e7e7e7; font-size: 0.8rem; diff --git a/app/containers/SearchField/PopoverAuto.js b/app/containers/SearchField/PopoverAuto.tsx similarity index 88% rename from app/containers/SearchField/PopoverAuto.js rename to app/containers/SearchField/PopoverAuto.tsx index 9a1ba6e7..744d6d4d 100644 --- a/app/containers/SearchField/PopoverAuto.js +++ b/app/containers/SearchField/PopoverAuto.tsx @@ -1,18 +1,18 @@ -// @flow import * as React from 'react' import { FormattedMessage } from 'react-intl' import Popover, { Item } from './Popover' import messages from './messages' interface Props { - value: string; - keywords: string[]; - onClick: (word: string) => void; + value: string + keywords: string[] + onClick: (word: string) => undefined } const PopoverAuto = ({ value, keywords, onClick }: Props) => { const list = keywords.map(keyword => { const handleClick = () => onClick(keyword) + const start = keyword.slice(0, value.length) const end = keyword.slice(value.length) return <Item key={keyword} onClick={handleClick} start={start} end={end} /> diff --git a/app/containers/SearchField/SearchFiled.js b/app/containers/SearchField/SearchFiled.tsx similarity index 80% rename from app/containers/SearchField/SearchFiled.js rename to app/containers/SearchField/SearchFiled.tsx index 66e6cceb..0ad589fd 100644 --- a/app/containers/SearchField/SearchFiled.js +++ b/app/containers/SearchField/SearchFiled.tsx @@ -1,6 +1,5 @@ -// @flow import React, { Component } from 'react' -import { injectIntl, type IntlShape } from 'react-intl' +import { injectIntl, IntlShape } from 'react-intl' import { findDOMNode } from 'react-dom' import { throttle } from 'lodash' import PopoverAuto from './PopoverAuto' @@ -8,23 +7,24 @@ import UsersOver from './UsersOver' import messages from './messages' import { Field, Input, Popup, Wrap } from './styles' -type InjectProp = { - intl: IntlShape, +interface InjectProp { + intl: IntlShape } - -export type Props = { - keywords: Array<string>, - onClose: () => void, - onFetch: (word: string) => void, - onSubmit: (tag: string) => void, +export interface Props { + keywords: string[] + onClose: () => undefined + onFetch: (word: string) => undefined + onSubmit: (tag: string) => undefined } - -type State = { - value: string, +interface State { + value: string } class SearchField extends Component<Props & InjectProp, State> { - state: State = { value: '', keywords: [] } + state: State = { + value: '', + keywords: [], + } componentDidMount() { window.addEventListener('click', this._handleClose) @@ -36,40 +36,47 @@ class SearchField extends Component<Props & InjectProp, State> { handleChange = ({ target }: Event) => { if (target instanceof HTMLInputElement) { - this.setState({ value: target.value }) + this.setState({ + value: target.value, + }) + this._autoComplte() } } - _handleClose = (event: any) => { event.preventDefault() let node = event.target + while (node) { if (node === findDOMNode(this)) { return } + node = node.parentNode } + this.props.onClose() } - _autoComplte = throttle(() => { const { value } = this.state + if (value === '') { return } + this.props.onFetch(value) }, 200) - - handleSubmit = (event: SyntheticKeyboardEvent<>) => { + handleSubmit = (event: SyntheticKeyboardEvent) => { // eslint-disable-line no-undef const text = this.state.value.trim() + if (event.which === 13 && text !== '') { this.props.onSubmit(text) - this.setState({ value: '' }) + this.setState({ + value: '', + }) } } - handleClick = (keyword: string) => { if (keyword !== '') { this.props.onSubmit(keyword) @@ -80,7 +87,6 @@ class SearchField extends Component<Props & InjectProp, State> { const { intl, keywords } = this.props const { formatMessage } = intl const { value } = this.state - return ( <Wrap> <Field> diff --git a/app/containers/SearchField/UsersOver.js b/app/containers/SearchField/UsersOver.tsx similarity index 89% rename from app/containers/SearchField/UsersOver.js rename to app/containers/SearchField/UsersOver.tsx index 058b1c02..eb31860b 100644 --- a/app/containers/SearchField/UsersOver.js +++ b/app/containers/SearchField/UsersOver.tsx @@ -1,16 +1,16 @@ -// @flow import * as React from 'react' import Popover, { Item } from './Popover' interface Props { - value: string; - onClick: (word: string) => void; + value: string + onClick: (word: string) => undefined } const UsersOver = ({ value, onClick }: Props) => { const bookmarkNumbers = [100, 500, 1000, 3000, 5000, 10000] const list = bookmarkNumbers.map(v => { const handleClick = () => onClick(`${value}${v}users入り`) + return ( <Item key={v} onClick={handleClick} start={value} end={`${v}users入り`} /> ) diff --git a/app/containers/SearchField/index.js b/app/containers/SearchField/index.tsx similarity index 78% rename from app/containers/SearchField/index.js rename to app/containers/SearchField/index.tsx index db726ff3..82e919bc 100644 --- a/app/containers/SearchField/index.js +++ b/app/containers/SearchField/index.tsx @@ -1,11 +1,10 @@ -// @flow -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' +import { Dispatch } from 'types' import { closeSearchField } from '../HeaderContainer/actions' import { addColumn } from '../ColumnSearch/actions' import SearchField from './SearchFiled' -import type { Props } from './SearchFiled' +import { Props } from './SearchFiled' import * as actions from './actions' import { makeSelectKeyword } from './selectors' @@ -13,9 +12,11 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ onFetch(word: string) { dispatch(actions.fetchRequest(word)) }, + onSubmit(tag: string) { dispatch(addColumn(tag)) }, + onClose() { dispatch(closeSearchField()) }, @@ -24,8 +25,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ const mapStateToProps = createStructuredSelector({ keywords: makeSelectKeyword(), }) - -const connector: Connector<{}, Props> = connect( +const connector = connect( mapStateToProps, mapDispatchToProps ) diff --git a/app/containers/SettingModal/Card.js b/app/containers/SettingModal/Card.tsx similarity index 88% rename from app/containers/SettingModal/Card.js rename to app/containers/SettingModal/Card.tsx index fede86ef..5f4011fc 100644 --- a/app/containers/SettingModal/Card.js +++ b/app/containers/SettingModal/Card.tsx @@ -1,9 +1,8 @@ -// @flow import * as React from 'react' import styled from 'styled-components' interface Props { - children?: React.Node; + children?: React.Node } const Card = ({ children }: Props) => <Wrap>{children}</Wrap> @@ -14,5 +13,4 @@ const Wrap = styled.div` margin: 10px; padding: 10px; ` - export default Card diff --git a/app/containers/SettingModal/LimitSetting.js b/app/containers/SettingModal/LimitSetting.tsx similarity index 98% rename from app/containers/SettingModal/LimitSetting.js rename to app/containers/SettingModal/LimitSetting.tsx index b1a05de4..0838530b 100644 --- a/app/containers/SettingModal/LimitSetting.js +++ b/app/containers/SettingModal/LimitSetting.tsx @@ -1,4 +1,3 @@ -// @flow import * as React from 'react' import styled from 'styled-components' import Subheader from 'material-ui/Subheader' @@ -16,7 +15,6 @@ const Discription = styled.div` white-space: wrap; padding: 5px 20px; ` - const A = styled.a` color: rgba(37, 143, 233, 0.8); text-decoration: underline; diff --git a/app/containers/SettingModal/SettingModal.js b/app/containers/SettingModal/SettingModal.tsx similarity index 85% rename from app/containers/SettingModal/SettingModal.js rename to app/containers/SettingModal/SettingModal.tsx index c1cbffb2..61b24ca3 100644 --- a/app/containers/SettingModal/SettingModal.js +++ b/app/containers/SettingModal/SettingModal.tsx @@ -1,4 +1,3 @@ -// @flow import React, { Component } from 'react' import { FormattedMessage } from 'react-intl' import { List, ListItem } from 'material-ui/List' @@ -14,43 +13,43 @@ import messages from './messages' import { ChipWrap, Field, Icon, Input, TagFilter, Wrap } from './styles' export interface Props { - onDelete: (tag: string) => void; - onSubmit: (tag: string) => void; - onCheckShowText: (isShow: boolean) => void; - onCheckIllustOnly: (isShow: boolean) => void; - onSelectLanguage: (locale: string) => void; - onRemoveCache: Function; - tags: string[]; - isShowCaption: boolean; - isIllustOnly: boolean; - locale: string; + onDelete: (tag: string) => undefined + onSubmit: (tag: string) => undefined + onCheckShowText: (isShow: boolean) => undefined + onCheckIllustOnly: (isShow: boolean) => undefined + onSelectLanguage: (locale: string) => undefined + onRemoveCache: Function + tags: string[] + isShowCaption: boolean + isIllustOnly: boolean + locale: string } - interface State { - value: string; + value: string } - export default class SettingFilterModal extends Component<Props, State> { - state: State = { value: '' } - + state: State = { + value: '', + } handleCangeInput = (event: any) => { if (event.target && event.target.value) { - this.setState({ value: event.target.value }) + this.setState({ + value: event.target.value, + }) } } - handleSubmit = (event: any) => { if (event.keyCode === 13 && this.state.value !== '') { event.preventDefault() this.props.onSubmit(this.state.value) - this.setState({ value: '' }) + this.setState({ + value: '', + }) } } - handleCheckShowText = () => { this.props.onCheckShowText(!this.props.isShowCaption) } - handleCheckSetOnlyIllust = () => { this.props.onCheckIllustOnly(!this.props.isIllustOnly) } @@ -63,7 +62,6 @@ export default class SettingFilterModal extends Component<Props, State> { locale, onSelectLanguage, } = this.props - return ( <Wrap> <Card> @@ -136,9 +134,9 @@ export default class SettingFilterModal extends Component<Props, State> { </Card> <LimitSetting /> {/* <Card> - <RedText onClick={this.props.onRemoveCache}> - <FormattedMessage {...messages.cache} /> - </RedText> + <RedText onClick={this.props.onRemoveCache}> + <FormattedMessage {...messages.cache} /> + </RedText> </Card> */} </Wrap> ) diff --git a/app/containers/SettingModal/index.js b/app/containers/SettingModal/index.tsx similarity index 85% rename from app/containers/SettingModal/index.js rename to app/containers/SettingModal/index.tsx index 2fd04bf1..0ff5f8d0 100644 --- a/app/containers/SettingModal/index.js +++ b/app/containers/SettingModal/index.tsx @@ -1,7 +1,6 @@ -// @flow -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' +import { Dispatch } from 'types' import { changeLocale } from 'containers/Language/actions' import { makeSelectLocale } from '../Language/selectors' import { @@ -12,7 +11,7 @@ import { removeCache, } from './actions' import Modal from './SettingModal' -import type { Props } from './SettingModal' +import { Props } from './SettingModal' import { makeSelectIsShowCaption, makeSelectIsShowOnlyIllust, @@ -32,14 +31,14 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ onSelectLanguage: (locale: string) => dispatch(changeLocale(locale)), onCheckShowText: (show: boolean) => dispatch(setShowCaption(show)), onCheckIllustOnly: (show: boolean) => dispatch(setShowOnlyIllust(show)), + onRemoveCache() { dispatch(removeCache()) }, }) -const connector: Connector<{}, Props> = connect( +const connector = connect( mapStateToProps, mapDispatchToProps ) - export default connector(Modal) diff --git a/app/containers/Table/Table.js b/app/containers/Table/Table.tsx similarity index 64% rename from app/containers/Table/Table.js rename to app/containers/Table/Table.tsx index bf66d164..6f8577ed 100644 --- a/app/containers/Table/Table.js +++ b/app/containers/Table/Table.tsx @@ -1,13 +1,12 @@ -// @flow import * as React from 'react' import { SortablePane, Pane } from 'react-sortable-pane' import ColumnManager from '../ColumnManager' -import type { TableIds } from './reducer' -import typeof { setTable } from './actions' +import { TableIds } from './reducer' +import { setTable } from './actions' -export type Props = { - ids: TableIds, - setTabel: setTable, +export interface Props { + ids: TableIds + setTabel: typeof setTable } const Table = ({ ids, setTabel }: Props) => { @@ -20,14 +19,22 @@ const Table = ({ ids, setTabel }: Props) => { const panes = ids.map(key => ( <Pane key={key} - size={{ width: 280, height: '100%' }} - style={{ zIndex: 1 }} - resizable={{ x: true, y: false, xy: false }} + size={{ + width: 280, + height: '100%', + }} + style={{ + zIndex: 1, + }} + resizable={{ + x: true, + y: false, + xy: false, + }} > <ColumnManager id={key} /> </Pane> )) - return ( <SortablePane order={ids} diff --git a/app/containers/Table/index.js b/app/containers/Table/index.tsx similarity index 68% rename from app/containers/Table/index.js rename to app/containers/Table/index.tsx index 6911ace3..224ff441 100644 --- a/app/containers/Table/index.js +++ b/app/containers/Table/index.tsx @@ -1,9 +1,9 @@ -// @flow -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import Tabel, { type Props } from './Table' +import { Dispatch } from 'types' +import Tabel from './Table' import { makeSelectIds } from './selectors' -import type { TableIds } from './reducer' +import { TableIds } from './reducer' import * as actions from './actions' const mapStateToProps = createStructuredSelector({ @@ -18,7 +18,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => { } } -const connector: Connector<{}, Props> = connect( +const connector = connect( mapStateToProps, mapDispatchToProps ) diff --git a/app/containers/UserDrawerContainer/index.js b/app/containers/UserDrawerContainer/index.tsx similarity index 80% rename from app/containers/UserDrawerContainer/index.js rename to app/containers/UserDrawerContainer/index.tsx index 8dcab6db..1fa8569e 100644 --- a/app/containers/UserDrawerContainer/index.js +++ b/app/containers/UserDrawerContainer/index.tsx @@ -1,10 +1,9 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' +import { connect } from 'react-redux' import { createStructuredSelector } from 'reselect' -import type { Dispatch } from 'types' +import { Dispatch } from 'types' import Loading from 'components/Loading' -import UserDrawer, { type Props } from 'components/UserDrawer' +import UserDrawer, { Props } from 'components/UserDrawer' import { makeSelectUser, makeSelectProfile, @@ -15,9 +14,11 @@ import * as actions from './actions' function UserDrawerContainer(props: Props) { const { user, profile } = props + if (profile && user) { return <UserDrawer {...props} /> } + return <Loading /> } @@ -28,13 +29,14 @@ const mapStateToProps = createStructuredSelector({ profile: makeSelectProfile(), }) -const connector: Connector<{}, Props> = connect( +const connector = connect( mapStateToProps, (dispatch: Dispatch) => { return { onNextIllust() { dispatch(actions.nextIllustPage()) }, + onNextManga() { dispatch(actions.nextMangaPage()) }, diff --git a/app/containers/UserPopoverContainer/index.js b/app/containers/UserPopoverContainer/index.tsx similarity index 69% rename from app/containers/UserPopoverContainer/index.js rename to app/containers/UserPopoverContainer/index.tsx index b0b55fb5..d597ae45 100644 --- a/app/containers/UserPopoverContainer/index.js +++ b/app/containers/UserPopoverContainer/index.tsx @@ -1,22 +1,20 @@ -// @flow import * as React from 'react' -import { connect, type Connector } from 'react-redux' -import type { Dispatch } from 'types' +import { connect } from 'react-redux' +import { Dispatch } from 'types' import { createStructuredSelector } from 'reselect' -import type { User } from 'types/user' -import type { Illust } from 'types/illust' +import { User } from 'types/user' +import { Illust } from 'types/illust' import UserPopover from 'components/UserPopover' import { open } from './actions' import { makeLimitedIllust } from './selectors' -type OP = { - onClick: () => void, - user: User, +interface OP { + onClick: () => undefined + user: User } - type Props = { - illusts: Array<Illust>, - open: Function, + illusts: Illust[] + open: Function } & OP class UserPopoverContainer extends React.PureComponent<Props> { @@ -33,8 +31,7 @@ class UserPopoverContainer extends React.PureComponent<Props> { const mapStateToProps = createStructuredSelector({ illusts: makeLimitedIllust(), }) - -const connector: Connector<OP, Props> = connect( +const connector = connect( mapStateToProps, (dispatch: Dispatch, { user }) => ({ open() { diff --git a/package.json b/package.json index adb68466..11458cb9 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "build:renderer": "node config/scripts/webpack build-renderer", "lint": "npm run lint:js && npm run lint:css", "lint:css": "stylelint \"app/**/*.js\"", - "lint:js": "eslint \"app/**/*.(tsx,ts)\"", + "lint:js": "eslint \"app/**/*.{tsx,ts}\"", "hot-updates-server": "node config/scripts/webpack hot-server", "start-hot-renderer": "node config/scripts/hot-renderer", "postinstall": "npm run build:dll && electron-builder install-app-deps", @@ -102,6 +102,7 @@ "@types/ms": "^0.7.30", "@types/react": "^16.8.6", "@types/react-intl": "^2.3.17", + "@types/react-redux": "^7.0.3", "@types/styled-components": "^4.1.12", "all-contributors-cli": "6.8.1", "babel-eslint": "10.0.2", diff --git a/tsconfig.json b/tsconfig.json index 3f8b7ffa..43963922 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,10 +2,10 @@ "extends": "@akameco/tsconfig", "compilerOptions": { "lib": ["dom", "esnext"], - "rootDirs": ["types", "styles", "components", "containers"] + "baseUrl": "./", + "paths": { + "*": ["./app/*"] + } }, - "include": [ - "node_modules/babel-plugin-react-intl-auto/**/*.d.ts", - "types/intl" - ] + "include": ["./app/types/intl.d.ts"] } diff --git a/yarn.lock b/yarn.lock index 78a09554..81d2e69f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1124,6 +1124,13 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/hoist-non-react-statics@*": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz#a59c0c995cc885bef1b8ec2241b114f9b35b517b" + integrity sha512-O2OGyW9wlO2bbDmZRH17MecArQfsIa1g//ve2IJk6BnmwEglFz5kdhP1BlgeqjVNH5IHIhsc83DWFo8StCe8+Q== + dependencies: + "@types/react" "*" + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -1209,6 +1216,15 @@ "@types/prop-types" "*" "@types/react" "*" +"@types/react-redux@^7.0.3": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.0.3.tgz#b8dc3faa954b7f28e4b0209bcf9209b45251ed6b" + integrity sha512-6qsIHHNwF41viooUgR2lXHL81v3uyeJsugq9YCMYE4g2bDyG710G/I/w5nbn7AQ9XfuOLUwrWfm3edV7gDJ9AQ== + dependencies: + "@types/hoist-non-react-statics" "*" + "@types/react" "*" + redux "^4.0.0" + "@types/react@*", "@types/react@^16.8.6": version "16.8.6" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.6.tgz#fa1de3fe56cc9b6afeddc73d093d7f30fd5e31cc" @@ -9327,10 +9343,10 @@ redux-saga@^1.0.2: dependencies: "@redux-saga/core" "^1.0.3" -"redux@>=0.10 <5", redux@^4.0.1: - version "4.0.4" - resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.4.tgz#4ee1aeb164b63d6a1bcc57ae4aa0b6e6fa7a3796" - integrity sha512-vKv4WdiJxOWKxK0yRoaK3Y4pxxB0ilzVx6dszU2W8wLxlb2yikRph4iV/ymtdJ6ZxpBLFbyrxklnT5yBbQSl3Q== +"redux@>=0.10 <5", redux@^4.0.0, redux@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.1.tgz#436cae6cc40fbe4727689d7c8fae44808f1bfef5" + integrity sha512-R7bAtSkk7nY6O/OYMVR9RiBI+XghjF9rlbl5806HJbQph0LJVHZrU5oaO4q70eUKiqMRqm4y07KLTlMZ2BlVmg== dependencies: loose-envify "^1.4.0" symbol-observable "^1.2.0" From 91fe19e34fc16362bd76cced30d911cd18ee356a Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Tue, 12 Mar 2019 02:56:41 +0900 Subject: [PATCH 21/25] chore(scripts): ts.js --- ts.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 ts.js diff --git a/ts.js b/ts.js new file mode 100644 index 00000000..cfe81e96 --- /dev/null +++ b/ts.js @@ -0,0 +1,37 @@ +const fs = require('fs') +const path = require('path') +const glob = require('glob') +const del = require('del') +const { promisify } = require('util') +const { compile } = require('flow-to-typescript') + +const globP = promisify(glob) + +// const path = 'path/to/file.js.flow' +// const file = readFileSync(path, 'utf-8') +async function main() { + // const files = await promisify(glob)('app/components/**/*.js') + // console.log(files) + // const files = await promisify(glob)('app/(containers)/**/*.js') + // const files = await globP('app/containers/**/+(styles|sagas|saga).js') + // const files = await globP('app/*.js') + // const files = await globP('app/styles/*.js') + // const files = await globP('app/containers/**/+(selector).js') + const files = await globP('app/containers/**/*.js') + for (const file of files) { + console.log(file) + const input = fs.readFileSync(file, 'utf8') + // console.log(file) + const result = await compile(input).catch(console.error) + // console.log(result) + const outputFile = file.replace(path.parse(file).ext, '.tsx') + // const outputFile = file.replace(path.parse(file).ext, '.ts') + fs.writeFileSync(outputFile, result) + await del(file) + } +} + +main() +// const files = fs.readdirSync(path.resolve(__dirname, 'app/components')) +// console.log(files) +// compile(file, path).then(ts => writeFileSync('path/to/file.ts', ts)) From f62ec90a9a60a5f7b99a42168bae2cc129e5ff2c Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Mon, 26 Aug 2019 03:45:57 +0900 Subject: [PATCH 22/25] chore: rm .storybook --- .storybook/addons.js | 1 - .storybook/config.js | 39 ------------------------------------ .storybook/webpack.config.js | 25 ----------------------- 3 files changed, 65 deletions(-) delete mode 100644 .storybook/addons.js delete mode 100644 .storybook/config.js delete mode 100644 .storybook/webpack.config.js diff --git a/.storybook/addons.js b/.storybook/addons.js deleted file mode 100644 index 17bb3281..00000000 --- a/.storybook/addons.js +++ /dev/null @@ -1 +0,0 @@ -import '@storybook/addon-actions/register' diff --git a/.storybook/config.js b/.storybook/config.js deleted file mode 100644 index ab52ec8d..00000000 --- a/.storybook/config.js +++ /dev/null @@ -1,39 +0,0 @@ -// @flow -import * as React from 'react' -// $FlowFixMe -import { configure, setAddon, addDecorator } from '@storybook/react' -// import infoAddon, { setDefaults } from '@storybook/addon-info' -// $FlowFixMe -import { withKnobs } from '@storybook/addon-knobs' -import styled, { ThemeProvider } from 'styled-components' -import theme, { key } from '../app/styles/styleTheme' - -// setDefaults({ inline: true }) -// setAddon(infoAddon) - -const Background = styled.div` - background: ${key('base')}; - min-width: 400px; - width: 100%; - min-height: 400px; - height: 100%; -` - -const ThemeDecorator = storyFn => ( - <ThemeProvider theme={theme}> - <Background>{storyFn()}</Background> - </ThemeProvider> -) - -addDecorator(ThemeDecorator) -addDecorator(withKnobs) - -// $FlowFixMe -const context = require.context('../app/', true, /example\.js$/) -function loadStories() { - context.keys().forEach(context) -} - -configure(() => { - loadStories() -}, module) diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js deleted file mode 100644 index db1cc3d8..00000000 --- a/.storybook/webpack.config.js +++ /dev/null @@ -1,25 +0,0 @@ -// you can use this file to add your custom webpack plugins, loaders and anything you like. -// This is just the basic way to add addional webpack configurations. -// For more information refer the docs: https://getstorybook.io/docs/configurations/custom-webpack-config - -// IMPORTANT -// When you add this file, we won't add the default configurations which is similar -// to "React Create App". This only has babel loader to load JavaScript. -const path = require('path') - -const appPath = path.resolve(process.cwd(), 'app') - -module.exports = { - plugins: [ - // your custom plugins - ], - module: { - loaders: [ - // add your custom loaders. - ], - }, - resolve: { - extensions: ['.js', '.json'], - modules: [appPath, 'node_modules'], - }, -} From ec62ab7e584d1bffc2e22569f8c6d302161d9da2 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Mon, 26 Aug 2019 03:48:12 +0900 Subject: [PATCH 23/25] refactor: rm flow --- .eslintignore | 1 - .eslintrc | 3 +- .flowconfig | 49 ----------------- .prettierignore | 2 - app/components/TextAutoLink/index.tsx | 2 +- .../Language/tests/selectors.test.tsx | 1 - .../LoginModal/tests/selectors.test.tsx | 1 - app/store.ts | 13 ++--- app/utils/update.ts | 16 +++--- babel.config.js | 2 +- config/templates/index.test.js.tmp | 1 - config/templates/reducer.js.tmp | 1 - config/templates/reducer.test.js.tmp | 1 - config/templates/selectors.js.tmp | 1 - config/webpack/webpack.config.base.babel.js | 4 +- .../webpack/webpack.config.main.prod.babel.js | 2 +- .../webpack.config.production.babel.js | 2 +- .../webpack.config.renderer.dev.babel.js | 2 +- .../webpack.config.renderer.prod.babel.js | 2 +- jest.config.js | 1 - jest.setup.js | 1 - package.json | 5 +- yarn.lock | 52 +++++++++---------- 23 files changed, 49 insertions(+), 116 deletions(-) delete mode 100644 .flowconfig diff --git a/.eslintignore b/.eslintignore index 80dab97a..45385b3f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,5 @@ release/* dist/* -flow-typed/* main.js app/node_modules/* node_modules/* diff --git a/.eslintrc b/.eslintrc index 9882e5a0..43aebdc7 100644 --- a/.eslintrc +++ b/.eslintrc @@ -31,7 +31,6 @@ "max-lines-per-function": 0, "no-shadow": 0, "react/no-deprecated": 0, - "react/no-find-dom-node": 0, - "flowtype/require-compound-type-alias": 0 + "react/no-find-dom-node": 0 } } diff --git a/.flowconfig b/.flowconfig deleted file mode 100644 index d3652655..00000000 --- a/.flowconfig +++ /dev/null @@ -1,49 +0,0 @@ -[ignore] -.*/dist/.* -.*/release/.* -.*/node_modules/electron-packager/* -.*/styled-components/src/.* -.*/styled-components/dangerfile.js -.*/styled-components/lib/models/InlineStyle.js.flow -.*/stylelint/lib/.* -.*/react-event-listener/.* -*/node_modules/babel-plugin-flow-runtime/.* -.*/node_modules/react-sortable-pane/lib/react-sortable-pane.es5.js.flow -.*/node_modules/react-sortable-pane/lib/react-sortable-pane.js.flow -.*/node_modules/redux-persist/.* -.*/git/.* - -[include] - -[libs] -node_modules/styled-components/flow-typed/react-native.js -node_modules/styled-components/flow-typed/glamor_vx.x.x.js -node_modules/styled-components/flow-typed/inline-style-prefixer_vx.x.x.js - -[options] -emoji=true - -esproposal.class_instance_fields=enable - -module.file_ext=.js -module.file_ext=.json -module.file_ext=.yml - -module.name_mapper='^components\/\(.*\)$' -> '<PROJECT_ROOT>/app/components/\1' -module.name_mapper='^components$' -> '<PROJECT_ROOT>/app/components' - -module.name_mapper='^containers\/\(.*\)$' -> '<PROJECT_ROOT>/app/containers/\1' -module.name_mapper='^containers$' -> '<PROJECT_ROOT>/app/containers' - -module.name_mapper='^reducers\/\(.*\)$' -> '<PROJECT_ROOT>/app/reducers/\1' -module.name_mapper='^reducers$' -> '<PROJECT_ROOT>/app/reducers' - -module.name_mapper='^types\/\(.*\)$' -> '<PROJECT_ROOT>/app/types/\1' -module.name_mapper='^types$' -> '<PROJECT_ROOT>/app/types' - -module.name_mapper='^services/\(.*\)$' -> '<PROJECT_ROOT>/app/services/\1' -module.name_mapper='^services$' -> '<PROJECT_ROOT>/appconstans/services' - -module.name_mapper='^utils/\(.*\)$' -> '<PROJECT_ROOT>/app/utils/\1' - -module.name_mapper='^styles/\(.*\)$' -> '<PROJECT_ROOT>/app/styles/\1' diff --git a/.prettierignore b/.prettierignore index cfef5450..bb7cfd98 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,11 +1,9 @@ -flow-typed/npm lib dist node_modules app/main.js coverage dll -flow-typed release package.json .github diff --git a/app/components/TextAutoLink/index.tsx b/app/components/TextAutoLink/index.tsx index 1d12ce89..ceae9ad8 100644 --- a/app/components/TextAutoLink/index.tsx +++ b/app/components/TextAutoLink/index.tsx @@ -1,7 +1,7 @@ import * as React from 'react' import { link } from 'autolinker' -interface Props { +type Props = { text: string } diff --git a/app/containers/Language/tests/selectors.test.tsx b/app/containers/Language/tests/selectors.test.tsx index 870d9dcd..4448ee4a 100644 --- a/app/containers/Language/tests/selectors.test.tsx +++ b/app/containers/Language/tests/selectors.test.tsx @@ -1,4 +1,3 @@ -// @noflow import { makeSelectLocale } from '../selectors' test('makeSelectLocale', () => { diff --git a/app/containers/LoginModal/tests/selectors.test.tsx b/app/containers/LoginModal/tests/selectors.test.tsx index 840f3b28..7aadf40e 100644 --- a/app/containers/LoginModal/tests/selectors.test.tsx +++ b/app/containers/LoginModal/tests/selectors.test.tsx @@ -1,4 +1,3 @@ -// @noflow import * as selectors from '../selectors' import { initialState } from '../reducer' diff --git a/app/store.ts b/app/store.ts index 00f5623d..71ebf082 100644 --- a/app/store.ts +++ b/app/store.ts @@ -2,7 +2,7 @@ import { createStore, applyMiddleware, compose } from 'redux' import createSagaMiddleware from 'redux-saga' import { persistStore, persistReducer } from 'redux-persist' import localForage from 'localforage' -import { Store } from 'types' +import { Store } from './types' import reducer from './reducer' import mySaga from './sagas' import { version } from './package.json' @@ -25,30 +25,31 @@ const persistConfig = { const persistedReducer = persistReducer(persistConfig, reducer) export default function configureStore( initialState: object = {} -): { - store: Store - persistor: any -} { +): { store: Store; persistor: any } { const middleware = [] const sagaMiddleware = createSagaMiddleware() middleware.push(sagaMiddleware) const enhancer = compose( applyMiddleware(...middleware), + // @ts-ignore window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() ) const store = createStore(persistedReducer, initialState, enhancer) sagaMiddleware.run(mySaga) persistor = persistStore(store) + // @ts-ignore if (module.hot) { // Enable Webpack hot module replacement for reducers + // @ts-ignore module.hot.accept('./reducer', () => { - const nextRootReducer = require('./reducer') // eslint-disable-line global-require + const nextRootReducer = require('./reducer') store.replaceReducer(nextRootReducer) }) } return { + // @ts-ignore store, persistor, } diff --git a/app/utils/update.ts b/app/utils/update.ts index d87772a6..6b8c9f99 100644 --- a/app/utils/update.ts +++ b/app/utils/update.ts @@ -1,12 +1,10 @@ -function update< - T, - State extends { - [a: string]: T - }, - Action extends { - id: any - } ->(state: State, action: Action, subject: Partial<T>): State { +import { AnyAction } from 'redux' + +function update<T, State extends { [a: string]: T }, Action extends AnyAction>( + state: State, + action: Action, + subject: Partial<T> +): State { return { ...state, [action.id]: { ...state[action.id], ...subject } } } diff --git a/babel.config.js b/babel.config.js index 546324ec..f8979b13 100644 --- a/babel.config.js +++ b/babel.config.js @@ -16,7 +16,7 @@ module.exports = api => { }, ], [require('@babel/preset-react'), { development }], - require('@babel/preset-flow'), + require('@babel/preset-typescript'), ], plugins: [ [require('babel-plugin-react-intl-auto'), { removePrefix: 'app/' }], diff --git a/config/templates/index.test.js.tmp b/config/templates/index.test.js.tmp index 821613d0..2011bef0 100644 --- a/config/templates/index.test.js.tmp +++ b/config/templates/index.test.js.tmp @@ -1,4 +1,3 @@ -// @flow import React from 'react' import { mount } from 'enzyme' import toJSON from 'enzyme-to-json' diff --git a/config/templates/reducer.js.tmp b/config/templates/reducer.js.tmp index 8aeb1381..c417848a 100644 --- a/config/templates/reducer.js.tmp +++ b/config/templates/reducer.js.tmp @@ -1,4 +1,3 @@ -// @flow import type { Action } from './actionTypes' import * as Actions from './constants' diff --git a/config/templates/reducer.test.js.tmp b/config/templates/reducer.test.js.tmp index 2a872ff8..9e543cf3 100644 --- a/config/templates/reducer.test.js.tmp +++ b/config/templates/reducer.test.js.tmp @@ -1,4 +1,3 @@ -// @flow import reducer from '../reducer' import * as actions from '../actions' diff --git a/config/templates/selectors.js.tmp b/config/templates/selectors.js.tmp index 05964ddf..ceb605ae 100644 --- a/config/templates/selectors.js.tmp +++ b/config/templates/selectors.js.tmp @@ -1,4 +1,3 @@ -// @flow import { createSelector } from 'reselect' import type { State } from 'types/state' diff --git a/config/webpack/webpack.config.base.babel.js b/config/webpack/webpack.config.base.babel.js index 30684950..47be8e02 100644 --- a/config/webpack/webpack.config.base.babel.js +++ b/config/webpack/webpack.config.base.babel.js @@ -11,7 +11,7 @@ export default { module: { rules: [ { - test: /\.js$/, + test: /\.(js|ts|tsx)$/, exclude: /node_modules/, use: { loader: 'babel-loader', @@ -30,7 +30,7 @@ export default { }, resolve: { - extensions: ['.js', '.json'], + extensions: ['.js', '.ts', '.tsx', '.json'], modules: [appPath, 'node_modules'], }, diff --git a/config/webpack/webpack.config.main.prod.babel.js b/config/webpack/webpack.config.main.prod.babel.js index a82c739d..6175a25d 100644 --- a/config/webpack/webpack.config.main.prod.babel.js +++ b/config/webpack/webpack.config.main.prod.babel.js @@ -9,7 +9,7 @@ export default merge.smart(baseConfig, { target: 'electron-main', - entry: ['./app/main.dev'], + entry: ['./app/main.dev.ts'], // 'main.js' in root output: { diff --git a/config/webpack/webpack.config.production.babel.js b/config/webpack/webpack.config.production.babel.js index 37788b52..41999203 100644 --- a/config/webpack/webpack.config.production.babel.js +++ b/config/webpack/webpack.config.production.babel.js @@ -7,7 +7,7 @@ module.exports = merge(baseConfig, { devtool: false, mode: 'production', - entry: ['./app/index'], + entry: ['./app/index.tsx'], output: { publicPath: '../dist/', diff --git a/config/webpack/webpack.config.renderer.dev.babel.js b/config/webpack/webpack.config.renderer.dev.babel.js index 68ec05da..6f9d4c02 100644 --- a/config/webpack/webpack.config.renderer.dev.babel.js +++ b/config/webpack/webpack.config.renderer.dev.babel.js @@ -33,7 +33,7 @@ export default merge.smart(baseConfig, { 'react-hot-loader/patch', `webpack-dev-server/client?http://localhost:${port}/`, 'webpack/hot/only-dev-server', - path.resolve(process.cwd(), 'app/index.js'), + path.resolve(process.cwd(), 'app/index.tsx'), ], output: { diff --git a/config/webpack/webpack.config.renderer.prod.babel.js b/config/webpack/webpack.config.renderer.prod.babel.js index 6278928f..062fa541 100644 --- a/config/webpack/webpack.config.renderer.prod.babel.js +++ b/config/webpack/webpack.config.renderer.prod.babel.js @@ -10,7 +10,7 @@ export default merge.smart(baseConfig, { target: 'electron-renderer', - entry: ['./app/index'], + entry: ['./app/index.tsx'], output: { path: path.resolve(process.cwd(), 'app/dist'), diff --git a/jest.config.js b/jest.config.js index 6a0fcc4b..67a250ff 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,3 @@ -// @flow 'use strict' module.exports = { diff --git a/jest.setup.js b/jest.setup.js index b15581ae..3d6cd1d5 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -1,4 +1,3 @@ -// @flow import { configure } from 'enzyme' import Adapter from 'enzyme-adapter-react-16' diff --git a/package.json b/package.json index 11458cb9..a2df23b9 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "start": "cross-env NODE_ENV=production electron ./app/", "dev": "cross-env START_HOT=1 npm run hot-updates-server", "test": "npm run jest", - "test:ci": "cross-env NODE_ENV=test npm run flow && npm run jest --ci", + "test:ci": "cross-env NODE_ENV=test npm run jest --ci", "test:watch": "cross-env NODE_ENV=test jest --watch", "jest": "cross-env NODE_ENV=test jest", "fmt": "prettier --write '**/*.{js,json,md,ts,tsx}'", @@ -93,8 +93,8 @@ "@babel/plugin-transform-modules-commonjs": "7.5.0", "@babel/polyfill": "7.4.4", "@babel/preset-env": "7.5.5", - "@babel/preset-flow": "7.0.0", "@babel/preset-react": "7.0.0", + "@babel/preset-typescript": "^7.3.3", "@babel/register": "7.5.5", "@types/camelcase-keys": "^4.0.0", "@types/jest": "^24.0.9", @@ -135,7 +135,6 @@ "extract-react-intl-messages": "1.0.2", "extract-zip": "1.6.7", "file-loader": "3.0.1", - "flow-runtime": "0.17.0", "flow-to-typescript": "^1.0.0", "husky": "2.7.0", "jest": "24.8.0", diff --git a/yarn.lock b/yarn.lock index 81d2e69f..88b5fa37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -349,13 +349,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-flow@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.2.0.tgz#a765f061f803bc48f240c26f8747faf97c26bf7c" - integrity sha512-r6YMuZDWLtLlu0kqIim5o/3TNRAlWb073HwT3e2nKf9I8IIvOggPrnILYPsrrKilmn/mYEMCf/Z07w3yQJF6dg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-json-strings@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" @@ -384,6 +377,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-syntax-typescript@^7.2.0": + version "7.3.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz#a7cc3f66119a9f7ebe2de5383cce193473d65991" + integrity sha512-dGwbSMA1YhVS8+31CnPR7LB4pcbrzcV99wQzby4uAfrkZPYZlQ7ImwdpzLqi6Z6IL02b8IAL379CaMwo0x5Lag== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-arrow-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" @@ -467,14 +467,6 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-flow-strip-types@^7.0.0": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.4.4.tgz#d267a081f49a8705fc9146de0768c6b58dccd8f7" - integrity sha512-WyVedfeEIILYEaWGAUWzVNyqG4sfsNooMhXWsu/YzOvVGcsnPb5PguysjJqI3t3qiaYj0BR8T2f5njdjTGe44Q== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.2.0" - "@babel/plugin-transform-for-of@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" @@ -661,6 +653,15 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-typescript@^7.3.2": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.5.5.tgz#6d862766f09b2da1cb1f7d505fe2aedab6b7d4b8" + integrity sha512-pehKf4m640myZu5B2ZviLaiBlxMCjSZ1qTEO459AXKX5GnPueyulJeCqZFs1nz/Ya2dDzXQ1NxZ/kKNWyD4h6w== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.5.5" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-typescript" "^7.2.0" + "@babel/plugin-transform-unicode-regex@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz#ab4634bb4f14d36728bf5978322b35587787970f" @@ -734,14 +735,6 @@ js-levenshtein "^1.1.3" semver "^5.5.0" -"@babel/preset-flow@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" - integrity sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" - "@babel/preset-react@7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.0.0.tgz#e86b4b3d99433c7b3e9e91747e2653958bc6b3c0" @@ -753,6 +746,14 @@ "@babel/plugin-transform-react-jsx-self" "^7.0.0" "@babel/plugin-transform-react-jsx-source" "^7.0.0" +"@babel/preset-typescript@^7.3.3": + version "7.3.3" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.3.3.tgz#88669911053fa16b2b276ea2ede2ca603b3f307a" + integrity sha512-mzMVuIP4lqtn4du2ynEfdO0+RYcslwrZiJHXu4MGaC1ctJiW2fyaeDrtjJGs7R/KebZ1sgowcIoWf4uRpEfKEg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-typescript" "^7.3.2" + "@babel/register@7.5.5", "@babel/register@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.5.5.tgz#40fe0d474c8c8587b28d6ae18a03eddad3dac3c1" @@ -4882,11 +4883,6 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== -flow-runtime@0.17.0: - version "0.17.0" - resolved "https://registry.yarnpkg.com/flow-runtime/-/flow-runtime-0.17.0.tgz#ff57dd22bd7b0682c7beff20c3590f6a4a8286e3" - integrity sha512-x621HugMPrtU68ddiRX0TkNRif9PS6ml3oeP6oo0k+Kv2issqCmifC4ZX59XnLUh9dfmBcj4GoZJXu4oe8L28Q== - flow-to-typescript@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/flow-to-typescript/-/flow-to-typescript-1.0.0.tgz#c12f973a557314f253a8e6a30315ea02acc33d56" From 7fbb9b7c6ccdbd8d0f59469eaed335b20928e586 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Mon, 26 Aug 2019 03:49:11 +0900 Subject: [PATCH 24/25] chore: remove flow-to-typescript --- package.json | 1 - yarn.lock | 5 ----- 2 files changed, 6 deletions(-) diff --git a/package.json b/package.json index a2df23b9..ae6f33ca 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,6 @@ "extract-react-intl-messages": "1.0.2", "extract-zip": "1.6.7", "file-loader": "3.0.1", - "flow-to-typescript": "^1.0.0", "husky": "2.7.0", "jest": "24.8.0", "jest-styled-components": "6.3.3", diff --git a/yarn.lock b/yarn.lock index 88b5fa37..8a07438d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4883,11 +4883,6 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== -flow-to-typescript@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/flow-to-typescript/-/flow-to-typescript-1.0.0.tgz#c12f973a557314f253a8e6a30315ea02acc33d56" - integrity sha512-R7sM1Y/W/F3A9RaGeZTm1pouDZQYB8MDPgIqigNdNYbMJzF3yMrMfE09yRqByFyVuv7qxkPI0eZMhBvb6ATDpw== - flush-write-stream@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" From 7166cca260eb8fb33591f27b0fe9b75dbab2e805 Mon Sep 17 00:00:00 2001 From: akameco <akameco.t@gmail.com> Date: Fri, 29 Nov 2019 02:28:09 +0900 Subject: [PATCH 25/25] wip --- app/i18n/en.yml | 17 - app/i18n/ja.yml | 17 - app/i18n/zh.yml | 17 - app/main.dev.ts | 6 +- config/scripts/extract-intl.js | 4 +- package.json | 10 +- yarn.lock | 722 +++++++++++++++------------------ 7 files changed, 333 insertions(+), 460 deletions(-) diff --git a/app/i18n/en.yml b/app/i18n/en.yml index 465af179..87082105 100644 --- a/app/i18n/en.yml +++ b/app/i18n/en.yml @@ -1,20 +1,3 @@ -components: - Dropdown: - logout: Logout - setting: Settings - LoginModal: - error: Login Error - login: Login - password: Password - username: Username - errorInfo: Check your username and password. - loginLoading: Logging in... - UserDrawer: - tabManga: 'Manga ({count})' - addColumn: Add to Column - tabIllust: 'Illustration ({count})' - ColumnHeaderBookmark: - bookmarkFilter: Filter Bookmarks containers: BoxContainer: save: Save Original Image diff --git a/app/i18n/ja.yml b/app/i18n/ja.yml index ad013d32..e6be9535 100644 --- a/app/i18n/ja.yml +++ b/app/i18n/ja.yml @@ -1,20 +1,3 @@ -components: - Dropdown: - logout: ログアウト - setting: 設定 - LoginModal: - error: ログインに失敗しました。 - login: ログイン - password: パスワード - username: ユーザー名 - errorInfo: ユーザ名とパスワードを確認してください。 - loginLoading: ログイン中.. - UserDrawer: - tabManga: 'マンガ ({count})' - addColumn: カラムに追加 - tabIllust: 'イラスト ({count})' - ColumnHeaderBookmark: - bookmarkFilter: ブックマークフィルタ containers: BoxContainer: save: オリジナルサイズの画像を保存 diff --git a/app/i18n/zh.yml b/app/i18n/zh.yml index cc35ccc8..74ed2ab3 100644 --- a/app/i18n/zh.yml +++ b/app/i18n/zh.yml @@ -1,20 +1,3 @@ -components: - Dropdown: - logout: 注销 - setting: 设置 - LoginModal: - error: 登录失败 - login: 登录 - password: 密码 - username: 用户名 - errorInfo: 请检查您的用户名或密码 - loginLoading: 登录中... - UserDrawer: - tabManga: '漫画 ({count})' - addColumn: 添加该列 - tabIllust: '插画 ({count})' - ColumnHeaderBookmark: - bookmarkFilter: 过滤书签 containers: BoxContainer: save: 下载原图 diff --git a/app/main.dev.ts b/app/main.dev.ts index aa0543e8..70adb3e9 100644 --- a/app/main.dev.ts +++ b/app/main.dev.ts @@ -1,4 +1,4 @@ -/* eslint global-require: 0, flowtype-errors/show-errors: 0, camelcase: 1 */ +/* eslint global-require: 0, camelcase: 1 */ import electron from 'electron' import referer from 'electron-referer' import ms from 'ms' @@ -96,7 +96,7 @@ function createMainWindow() { referer('http://www.pixiv.net', win) }) webContents.on('new-window', (event: Event, url: string) => { - if (/intent\/twitter/.test(url)) { + if (url.includes("intent/twitter")) { return } @@ -113,7 +113,7 @@ function openTweet(url: string) { }) const page = tweetWin.webContents page.on('will-navigate', (event, url) => { - if (/twitter\.com\/intent\/tweet\/complete/.test(url)) { + if (url.includes("twitter.com/intent/tweet/complete")) { tweetWin.close() } diff --git a/config/scripts/extract-intl.js b/config/scripts/extract-intl.js index 1bf153a9..759a06c7 100644 --- a/config/scripts/extract-intl.js +++ b/config/scripts/extract-intl.js @@ -1,8 +1,8 @@ 'use strict' -const extractMessages = require('extract-react-intl-messages') +const extractMessages = require('extract-react-intl-messages').default const locales = ['en', 'ja', 'zh'] -const files = 'app/**/messages.js' +const files = 'app/**/messages.ts' const buildDir = 'app/i18n' const opts = { defaultLocale: 'ja', diff --git a/package.json b/package.json index ae6f33ca..dd63b5b1 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "react": "^16.8.3", "react-dom": "^16.8.3", "react-event-listener": "^0.6.6", - "react-intl": "^2.8.0", + "react-intl": "^3.2.0", "react-redux": "^7.0.0", "react-sortable-pane": "^1.0.4", "redux": "^4.0.1", @@ -101,7 +101,7 @@ "@types/lodash": "^4.14.122", "@types/ms": "^0.7.30", "@types/react": "^16.8.6", - "@types/react-intl": "^2.3.17", + "@types/react-intl": "^3.0.0", "@types/react-redux": "^7.0.3", "@types/styled-components": "^4.1.12", "all-contributors-cli": "6.8.1", @@ -113,8 +113,8 @@ "babel-plugin-create-redux-action-type": "0.1.2", "babel-plugin-dev-expression": "0.2.2", "babel-plugin-object-rest-spread": "0.0.0", - "babel-plugin-react-intl": "4.1.5", - "babel-plugin-react-intl-auto": "1.7.2", + "babel-plugin-react-intl": "4.1.16", + "babel-plugin-react-intl-auto": "2.2.0", "babel-plugin-redux-action-compose": "0.3.0", "babel-plugin-redux-state-compose": "0.4.0", "chalk": "2.4.2", @@ -132,7 +132,7 @@ "eslint": "5.16.0", "eslint-config-precure": "4.18.0", "execa": "1.0.0", - "extract-react-intl-messages": "1.0.2", + "extract-react-intl-messages": "^2.0.0", "extract-zip": "1.6.7", "file-loader": "3.0.1", "husky": "2.7.0", diff --git a/yarn.lock b/yarn.lock index 8a07438d..9f50a46e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -36,7 +36,7 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/core@7.5.5", "@babel/core@>=7.2.2", "@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.4.5": +"@babel/core@7.5.5", "@babel/core@>=7.2.2", "@babel/core@^7.1.0", "@babel/core@^7.4.5", "@babel/core@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" integrity sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg== @@ -766,7 +766,7 @@ pirates "^4.0.0" source-map-support "^0.5.9" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.4.5": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== @@ -839,6 +839,25 @@ resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.4.tgz#a87b4b04e5ae14a88d48ebef15015f6b7d1f5677" integrity sha512-kBa+cDHOR9jpRJ+kcGMsysrls0leukrm68DmFQoMIWQcXdr2cZvyvypWuGYT7U+9kAExUE7+T7r6G3C3A6L8MQ== +"@formatjs/intl-relativetimeformat@^3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-3.0.2.tgz#09943f6e008aba611f973edab284e1051d977951" + integrity sha512-smy2oNh+gi/Gr7kPYL5EaRUW3lBjn3yaPfHyDAljzabN3ZVhZsVl8oZV78HlQYoXz1h1GFpj/GbO5xkjSzffPw== + dependencies: + "@formatjs/intl-utils" "^1.0.1" + +"@formatjs/intl-unified-numberformat@^0.4.9": + version "0.4.9" + resolved "https://registry.yarnpkg.com/@formatjs/intl-unified-numberformat/-/intl-unified-numberformat-0.4.9.tgz#343ce36d8c95bd5529ce80120a4abbf933cae69e" + integrity sha512-llHvEZTaMEStXK7mFjUMcsS3Qtxd3csdgyo2j/fvjk+NdEBjGYrEO7gdLhGAjh6sDeRGFzMze91ScrwLK3ukqw== + dependencies: + "@formatjs/intl-utils" "^1.0.1" + +"@formatjs/intl-utils@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@formatjs/intl-utils/-/intl-utils-1.0.1.tgz#cc24ffbf36c05793ab9cd1eceee12ca95b1d7e08" + integrity sha512-Q9mHePkcnNkazb+89mZtYj01YMKxDO/VtsZI56MDzb2Cfed0dPugXZHpXgSXYPmd/4C6gp0M759xGEGFX3JS+w== + "@jest/console@^24.7.1", "@jest/console@^24.9.0": version "24.9.0" resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" @@ -1097,9 +1116,9 @@ "@babel/types" "^7.3.0" "@types/camelcase-keys@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@types/camelcase-keys/-/camelcase-keys-4.0.0.tgz#528da23e7bd41068ee25e3ba52a96a4d0d263ed5" - integrity sha1-Uo2iPnvUEGjuJeO6UqlqTQ0mPtU= + version "4.1.0" + resolved "https://registry.yarnpkg.com/@types/camelcase-keys/-/camelcase-keys-4.1.0.tgz#8af7f2581879cfc4392e7f21449f6a8c79a82dc4" + integrity sha512-g4Oli0vfPtWxhK4uI7XhxwRFTsJjsG9khtUgw+ab31W+qSKJKKL0sN/I4hzPPg+pm72awz6d2fuw2JBeN97tpQ== "@types/debug@^4.1.4": version "4.1.5" @@ -1125,12 +1144,18 @@ "@types/minimatch" "*" "@types/node" "*" -"@types/hoist-non-react-statics@*": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz#a59c0c995cc885bef1b8ec2241b114f9b35b517b" - integrity sha512-O2OGyW9wlO2bbDmZRH17MecArQfsIa1g//ve2IJk6BnmwEglFz5kdhP1BlgeqjVNH5IHIhsc83DWFo8StCe8+Q== +"@types/hoist-non-react-statics@^3.3.0", "@types/hoist-non-react-statics@^3.3.1": + version "3.3.1" + resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f" + integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA== dependencies: "@types/react" "*" + hoist-non-react-statics "^3.3.0" + +"@types/invariant@^2.2.30": + version "2.2.30" + resolved "https://registry.yarnpkg.com/@types/invariant/-/invariant-2.2.30.tgz#20efa342807606ada5483731a8137cb1561e5fe9" + integrity sha512-98fB+yo7imSD2F7PF7GIpELNgtLNgo5wjivu0W5V4jx+KVVJxo6p/qN4zdzSTBWy4/sN3pPyXwnhRSD28QX+ag== "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" @@ -1158,9 +1183,9 @@ integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA== "@types/jest@^24.0.9": - version "24.0.9" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.9.tgz#74ce9cf337f25e189aa18f76ab3d65e8669b55f2" - integrity sha512-k3OOeevcBYLR5pdsOv5g3OP94h3mrJmLPHFEPWgbbVy2tGv0TZ/TlygiC848ogXhK8NL0I5up7YYtwpCp8xCJA== + version "24.0.18" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.18.tgz#9c7858d450c59e2164a8a9df0905fc5091944498" + integrity sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ== dependencies: "@types/jest-diff" "*" @@ -1170,9 +1195,9 @@ integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A== "@types/lodash@^4.14.122": - version "4.14.122" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.122.tgz#3e31394c38cf1e5949fb54c1192cbc406f152c6c" - integrity sha512-9IdED8wU93ty8gP06ninox+42SBSJHp2IAamsSYMUY76mshRTeUsid/gtbl8ovnOwy8im41ib4cxTiIYMXGKew== + version "4.14.138" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.138.tgz#34f52640d7358230308344e579c15b378d91989e" + integrity sha512-A4uJgHz4hakwNBdHNPdxOTkYmXNgmUAKLbXZ7PKGslgeV0Mb8P3BlbYfPovExek1qnod4pDfRbxuzcVs3dlFLg== "@types/minimatch@*": version "3.0.3" @@ -1185,14 +1210,14 @@ integrity sha512-OftRLCgAzJP7vmKn9by/GVjnf4hloz/pXNOwPo0vKGAfXI7GqWXJi9N2kRar4cP5s1dGwuwcagWqO6iHBTq1Mg== "@types/node@*": - version "12.7.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44" - integrity sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg== + version "12.7.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.4.tgz#64db61e0359eb5a8d99b55e05c729f130a678b04" + integrity sha512-W0+n1Y+gK/8G2P/piTkBBN38Qc5Q1ZSO6B5H3QmPCUewaiXOo2GCAWZ4ElZCcNhjJuBSUSLGFUJnmlCn5+nxOQ== "@types/node@^10.12.18": - version "10.14.16" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.16.tgz#4d690c96cbb7b2728afea0e260d680501b3da5cf" - integrity sha512-/opXIbfn0P+VLt+N8DE4l8Mn8rbhiJgabU96ZJ0p9mxOkIks5gh6RUnpHak7Yh0SFkyjO/ODbxsQQPV2bpMmyA== + version "10.14.17" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.17.tgz#b96d4dd3e427382482848948041d3754d40fd5ce" + integrity sha512-p/sGgiPaathCfOtqu2fx5Mu1bcjuP8ALFg4xpGgNkcin7LwRyzUKniEHBKdcE1RPsenq5JVPIpMTJSygLboygQ== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -1200,36 +1225,39 @@ integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== "@types/prop-types@*": - version "15.7.1" - resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6" - integrity sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg== + version "15.7.2" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.2.tgz#0e58ae66773d7fd7c372a493aff740878ec9ceaa" + integrity sha512-f8JzJNWVhKtc9dg/dyDNfliTKNOJSLa7Oht/ElZdF/UbMUmAH3rLmAk3ODNjw0mZajDEgatA03tRjB4+Dp/tzA== -"@types/react-intl@^2.3.17": - version "2.3.17" - resolved "https://registry.yarnpkg.com/@types/react-intl/-/react-intl-2.3.17.tgz#e1fc6e46e8af58bdef9531259d509380a8a99e8e" - integrity sha512-FGd6J1GQ7zvl1GZ3BBev83B7nfak8dqoR2PZ+l5MoisKMpd4xOLhZJC1ugpmk3Rz5F85t6HbOg9mYqXW97BsNA== +"@types/react-intl@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/react-intl/-/react-intl-3.0.0.tgz#a2cce0024b6cfe403be28ccf67f49d720fa810ec" + integrity sha512-k8F3d05XQGEqSWIfK97bBjZe4z9RruXU9Wa7OZ2iUC5pdeIpzuQDZe/9C2J3Xir5//ZtAkhcv08Wfx3n5TBTQg== + dependencies: + react-intl "*" "@types/react-native@*": - version "0.57.38" - resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.57.38.tgz#2ff6ed1a7cc207afbfd87bf496513d96931d1446" - integrity sha512-bmY2ad/vQgP0HMT7Q7EQzirDBt5ibp+kBHclTnY7/i5MrdqE1oY+3b9NkDg3ohXlumr7p5stAG6I55nhfeUV6Q== + version "0.60.11" + resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.60.11.tgz#c797f89180291c3a1d6f573f1e89644c8c17f60e" + integrity sha512-JAe7/UCGhnXxTwHCix1Gs6EbbCTeqU8TxxKHKNrsVtECZ9cPYp1UmJoDIDaNTz8o1/9nTFOtPj7CvHp2hWpEIQ== dependencies: "@types/prop-types" "*" "@types/react" "*" "@types/react-redux@^7.0.3": - version "7.0.3" - resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.0.3.tgz#b8dc3faa954b7f28e4b0209bcf9209b45251ed6b" - integrity sha512-6qsIHHNwF41viooUgR2lXHL81v3uyeJsugq9YCMYE4g2bDyG710G/I/w5nbn7AQ9XfuOLUwrWfm3edV7gDJ9AQ== + version "7.1.2" + resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.2.tgz#02303b77d87e54f327c09507cf80ee3ca3063898" + integrity sha512-Iim6UCtD0mZX9U3jBuT6ZObBZ8UlakoOgefiRgi5wakfbNnXd3TUwwUMgi3Ijc0fxsPLZ5ULoz0oDy15YIaLmQ== dependencies: - "@types/hoist-non-react-statics" "*" + "@types/hoist-non-react-statics" "^3.3.0" "@types/react" "*" + hoist-non-react-statics "^3.3.0" redux "^4.0.0" "@types/react@*", "@types/react@^16.8.6": - version "16.8.6" - resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.6.tgz#fa1de3fe56cc9b6afeddc73d093d7f30fd5e31cc" - integrity sha512-bN9qDjEMltmHrl0PZRI4IF2AbB7V5UlRfG+OOduckVnRQ4VzXVSzy/1eLAh778IEqhTnW0mmgL9yShfinNverA== + version "16.9.2" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.2.tgz#6d1765431a1ad1877979013906731aae373de268" + integrity sha512-jYP2LWwlh+FTqGd9v7ynUKZzjj98T8x7Yclz479QdRhHfuW9yQ+0jjnD31eXSXutmBpppj5PYNLYLRfnZJvcfg== dependencies: "@types/prop-types" "*" csstype "^2.2.0" @@ -1240,9 +1268,9 @@ integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== "@types/styled-components@^4.1.12": - version "4.1.12" - resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-4.1.12.tgz#62c19bd1aa37b1a904d36c179a0fec66c24ac99c" - integrity sha512-Du0bltHm5sWkDnXzYi6cMNhnSKWHQW6//at359DtRJNfjeG1SdtqQPX6jiVtrUkBJ1JsjxqT18DssYBLJ/fg/A== + version "4.1.18" + resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-4.1.18.tgz#348804fe5a399ae0a46550afaf030085815ad931" + integrity sha512-VrHkgvjbxQXOw0xWSUckusUUZ4y/jqN1u7kF29ngh0oE6uOrlZHleTgqeUqylQqHQIeQ8MxFb50BRHy8ju5DHg== dependencies: "@types/react" "*" "@types/react-native" "*" @@ -1477,9 +1505,9 @@ integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== abab@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f" - integrity sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w== + version "2.0.1" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.1.tgz#3fa17797032b71410ec372e11668f4b4ffc86a82" + integrity sha512-1zSbbCuoIjafKZ3mblY5ikvAb0ODUbqBnFuUb7f6uLeQhhGJ0vEV4ntmtxKLT2WgXCO94E07BjunsIw1jOMPZw== abbrev@1: version "1.1.1" @@ -1699,14 +1727,6 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -aria-query@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" - integrity sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w= - dependencies: - ast-types-flow "0.0.7" - commander "^2.11.0" - arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" @@ -1737,11 +1757,6 @@ array-find-index@^1.0.1: resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= -array-find@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-find/-/array-find-1.0.0.tgz#6c8e286d11ed768327f8e62ecee87353ca3e78b8" - integrity sha1-bI4obRHtdoMn+OYuzuhzU8o+eLg= - array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -1838,11 +1853,6 @@ assign-symbols@^1.0.0: resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= -ast-types-flow@0.0.7, ast-types-flow@^0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" - integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0= - astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" @@ -1921,13 +1931,6 @@ axios@^0.19.0: follow-redirects "1.5.10" is-buffer "^2.0.2" -axobject-query@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.2.tgz#ea187abe5b9002b377f925d8bf7d1c561adf38f9" - integrity sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww== - dependencies: - ast-types-flow "0.0.7" - babel-add-flow-comments@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/babel-add-flow-comments/-/babel-add-flow-comments-0.1.1.tgz#e5592565a0e0bb2ac3530b0919f2acd3975b75b4" @@ -1977,7 +1980,7 @@ babel-errors@^1.0.1: resolved "https://registry.yarnpkg.com/babel-errors/-/babel-errors-1.1.1.tgz#43f7142dd3b365633c758d155bffa3ba41523794" integrity sha1-Q/cULdOzZWM8dY0VW/+jukFSN5Q= -babel-eslint@10.0.2, babel-eslint@^10.0.1, babel-eslint@^10.0.2: +babel-eslint@10.0.2: version "10.0.2" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.2.tgz#182d5ac204579ff0881684b040560fdcc1558456" integrity sha512-UdsurWPtgiPgpJ06ryUnuaSXC2s0WoSZnQmEpbAH65XZSdwowgN5MvyP7e88nW07FYXv72erVtpBkxyDVKhH1Q== @@ -1989,6 +1992,18 @@ babel-eslint@10.0.2, babel-eslint@^10.0.1, babel-eslint@^10.0.2: eslint-scope "3.7.1" eslint-visitor-keys "^1.0.0" +babel-eslint@^10.0.1: + version "10.0.3" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a" + integrity sha512-z3U7eMY6r/3f3/JB9mTsLjyxrv0Yb1zb8PCWCLpguxfCzBIZUwy23R1t/XKewP+8mEN2Ck8Dtr4q20z6ce6SoA== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + eslint-visitor-keys "^1.0.0" + resolve "^1.12.0" + babel-explode-module@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/babel-explode-module/-/babel-explode-module-1.4.0.tgz#b20076f0ee5ff28e8f16baa3146fe136a27c6504" @@ -2155,35 +2170,24 @@ babel-plugin-object-rest-spread@0.0.0: resolved "https://registry.yarnpkg.com/babel-plugin-object-rest-spread/-/babel-plugin-object-rest-spread-0.0.0.tgz#5a998ae19eb74065418399ac08ec4a01a9bf8d87" integrity sha1-WpmK4Z63QGVBg5msCOxKAam/jYc= -babel-plugin-react-intl-auto@1.7.2: - version "1.7.2" - resolved "https://registry.yarnpkg.com/babel-plugin-react-intl-auto/-/babel-plugin-react-intl-auto-1.7.2.tgz#2b913a828adbcdffb21c871b333d5b9d75b5a404" - integrity sha512-fhirzWigbJBO5v0GdQ1CO8mkhmaSLPbbJNg16fGyEqr+AEos/pMGLbB5zqFMeSvYzg7JI+cA7mWMGfFbBIxaMA== +babel-plugin-react-intl-auto@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-react-intl-auto/-/babel-plugin-react-intl-auto-2.2.0.tgz#8cbac7bab7ed495177cbe3c2f1af821052164c57" + integrity sha512-L6IS4NQCr+uGw8yOJ+tBfm5R0UhrM2mZyhN+X7jCsnEhTcWopkWe7geLm7AzJC2SWFXnr7phwXlJbN4erwKRrA== dependencies: - "@babel/types" "^7.4.4" + "@babel/types" "^7.5.5" murmurhash3js "^3.0.1" -babel-plugin-react-intl@4.1.5: - version "4.1.5" - resolved "https://registry.yarnpkg.com/babel-plugin-react-intl/-/babel-plugin-react-intl-4.1.5.tgz#7e65f1d18a4f54c4813e18c6f9c4d72f6167a69f" - integrity sha512-wERgTY+NUiaO1fY3yRXB9XYDtMlhyrIlCyixSO5vgQ48OJQL5A6bZ9HBz6OA+2I2ciSjCmQOxj38eEQczzStKw== +babel-plugin-react-intl@4.1.16, babel-plugin-react-intl@^4.1.15: + version "4.1.16" + resolved "https://registry.yarnpkg.com/babel-plugin-react-intl/-/babel-plugin-react-intl-4.1.16.tgz#96d63a007f2aa77b53b93bf7d5ba4f4da8dc7937" + integrity sha512-JzP+HkF7C+eOAcruygiRIrBgikh2n2xsV3hMBYib3SlqTxZu2pEW2g85nk8Zm1TJ32LvPOEnvZKwWnB0443/CQ== dependencies: "@babel/core" "^7.4.5" "@babel/helper-plugin-utils" "^7.0.0" "@types/babel__core" "^7.1.2" fs-extra "^8.0.1" - intl-messageformat-parser "^3.0.1" - -babel-plugin-react-intl@^3.0.1: - version "3.5.1" - resolved "https://registry.yarnpkg.com/babel-plugin-react-intl/-/babel-plugin-react-intl-3.5.1.tgz#57d22cae27238b4020403b13de9e763267937648" - integrity sha512-1jlEJCSmLaJM4tjIKpu64UZ833COCHmwR77bFJDOye+zlwf80uR1b8p41l4tClx1QsrfI+qV6w/5AiPYQgaMUQ== - dependencies: - "@babel/core" "^7.4.5" - "@babel/helper-plugin-utils" "^7.0.0" - "@types/babel__core" "^7.1.2" - fs-extra "^8.0.1" - intl-messageformat-parser "^1.8.1" + intl-messageformat-parser "^3.1.0" babel-plugin-redux-action-compose@0.3.0: version "0.3.0" @@ -2549,13 +2553,13 @@ browserify-zlib@^0.2.0: pako "~1.0.5" browserslist@^4.6.0, browserslist@^4.6.3, browserslist@^4.6.6: - version "4.6.6" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.6.tgz#6e4bf467cde520bc9dbdf3747dafa03531cec453" - integrity sha512-D2Nk3W9JL9Fp/gIcWei8LrERCS+eXu9AM5cfXA8WEZ84lFks+ARnZ0q/R69m2SV3Wjma83QDDPxsNKXUwdIsyA== + version "4.7.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.7.0.tgz#9ee89225ffc07db03409f2fee524dc8227458a17" + integrity sha512-9rGNDtnj+HaahxiVV38Gn8n8Lr8REKsel68v1sPFfIGEK6uSXTY3h9acgiT1dZVtOOUtifo/Dn8daDQ5dUgVsA== dependencies: - caniuse-lite "^1.0.30000984" - electron-to-chromium "^1.3.191" - node-releases "^1.1.25" + caniuse-lite "^1.0.30000989" + electron-to-chromium "^1.3.247" + node-releases "^1.1.29" bser@^2.0.0: version "2.1.0" @@ -2754,7 +2758,7 @@ camelize@^1.0.0: resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b" integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs= -caniuse-lite@^1.0.30000980, caniuse-lite@^1.0.30000984: +caniuse-lite@^1.0.30000980, caniuse-lite@^1.0.30000989: version "1.0.30000989" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000989.tgz#b9193e293ccf7e4426c5245134b8f2a56c0ac4b9" integrity sha512-vrMcvSuMz16YY6GSVZ0dWDTJP8jqk3iFQ/Aq5iqblPwxSVVZI+zxDyTX0VPqtQsDnfdrBDcsmhgTEOh5R8Lbpw== @@ -3013,7 +3017,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@^2.11.0, commander@^2.14.1, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@^2.8.1, commander@^2.9.0, commander@~2.20.0: +commander@^2.14.1, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@^2.8.1, commander@^2.9.0, commander@~2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== @@ -3306,9 +3310,9 @@ css-select@~1.2.0: nth-check "~1.0.1" css-to-react-native@^2.2.2: - version "2.3.1" - resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-2.3.1.tgz#cf0f61e0514846e2d4dc188b0886e29d8bef64a2" - integrity sha512-yO+oEx1Lf+hDKasqQRVrAvzMCz825Huh1VMlEEDlRWyAhFb/FWb6I0KpEF1PkyKQ7NEdcx9d5M2ZEWgJAsgPvQ== + version "2.3.2" + resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-2.3.2.tgz#e75e2f8f7aa385b4c3611c52b074b70a002f2e7d" + integrity sha512-VOFaeZA053BqvvvqIA8c9n0+9vFppVBAHCp6JgFTtTMU3Mzi+XnelJ9XC9ul3BqFzZyQ5N+H0SnwsWT2Ebchxw== dependencies: camelize "^1.0.0" css-color-keywords "^1.0.0" @@ -3358,11 +3362,6 @@ cyclist@~0.2.2: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= -damerau-levenshtein@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.5.tgz#780cf7144eb2e8dbd1c3bb83ae31100ccc31a414" - integrity sha512-CBCRqFnpu715iPmw1KrdOrzRqbdFwQTwAWyyyYS42+iAgHCuXZ+/TdMgQkUENPomxEz9z1BEzuQU2Xw0kUuAgA== - dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -3448,9 +3447,16 @@ dedent@^0.7.0: integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= deep-equal@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" - integrity sha1-9dJgKStmDghO/0zbyfCK0yR0SLU= + version "1.1.0" + resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.0.tgz#3103cdf8ab6d32cf4a8df7865458f2b8d33f3745" + integrity sha512-ZbfWJq/wN1Z273o7mUSjILYqehAktR2NVoSrOukDkU9kg2v/Uv89yU4Cvz8seJeAmtN5oqiefKq8FPuXOboqLw== + dependencies: + is-arguments "^1.0.4" + is-date-object "^1.0.1" + is-regex "^1.0.4" + object-is "^1.0.1" + object-keys "^1.1.1" + regexp.prototype.flags "^1.2.0" deep-extend@^0.6.0: version "0.6.0" @@ -3516,19 +3522,7 @@ del@^3.0.0: pify "^3.0.0" rimraf "^2.2.8" -del@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/del/-/del-4.0.0.tgz#4fa27e92c366cb45b9bdaa56a9b8703dced17437" - integrity sha512-/BnSJ+SuZyLu7xMn48kZY0nMXDi+5KNmR4g8n21Wivsl8+B9njV6/5kcTNE9juSprp0zRWBU28JuHUq0FqK1Nw== - dependencies: - globby "^6.1.0" - is-path-cwd "^2.0.0" - is-path-in-cwd "^2.0.0" - p-map "^2.0.0" - pify "^4.0.1" - rimraf "^2.6.2" - -del@^4.1.1: +del@^4.0.0, del@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" integrity sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ== @@ -3820,9 +3814,9 @@ ee-first@1.1.1: integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= ejs@^2.6.1, ejs@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.2.tgz#3a32c63d1cd16d11266cd4703b14fec4e74ab4f6" - integrity sha512-PcW2a0tyTuPHz3tWyYqtK6r1fZ3gp+3Sop8Ph+ZYN81Ob5rwmbHEzaqs10N3BEsaGTkh/ooniXK+WwszGlc2+Q== + version "2.7.1" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.1.tgz#5b5ab57f718b79d4aca9254457afecd36fa80228" + integrity sha512-kS/gEPzZs3Y1rRsbGX4UOSjtP/CeJP0CxSNZHYxGfVM/VgLcv0ZqM7C45YyTj2DI2g7+P9Dd24C+IMIg6D0nYQ== electron-builder@21.2.0: version "21.2.0" @@ -3911,10 +3905,10 @@ electron-publish@21.2.0: lazy-val "^1.0.4" mime "^2.4.4" -electron-to-chromium@^1.3.191: - version "1.3.240" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.240.tgz#8e278c4d2b3a96fa865725589277c05c8a1e9584" - integrity sha512-cMlX5lQpTzLZI0CsC4Mt2sl6z3jz1RvN/8rIqqwqWy3LYCnu8TUf5o8sqST44nP6zIEdjZb0opXq6qswE9o9pA== +electron-to-chromium@^1.3.247: + version "1.3.252" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.252.tgz#5b6261965b564a0f4df0f1c86246487897017f52" + integrity sha512-NWJ5TztDnjExFISZHFwpoJjMbLUifsNBnx7u2JI0gCw6SbKyQYYWWtBHasO/jPtHym69F4EZuTpRNGN11MT/jg== electron@5.0.8: version "5.0.8" @@ -3931,9 +3925,9 @@ elegant-spinner@^1.0.1: integrity sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4= elliptic@^6.0.0: - version "6.5.0" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.0.tgz#2b8ed4c891b7de3200e14412a5b8248c7af505ca" - integrity sha512-eFOJTMyCYb7xtE/caJ6JJu+bhi67WCYNbkGSknu20pmM8Ke/bqOfdnZWxyoGN26JgfxTbXrsCkEw4KheCT/KGg== + version "6.5.1" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.1.tgz#c380f5f909bf1b9b4428d028cd18d3b0efd6b52b" + integrity sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg== dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -3943,7 +3937,7 @@ elliptic@^6.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" -emoji-regex@^7.0.1, emoji-regex@^7.0.2: +emoji-regex@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== @@ -3986,15 +3980,6 @@ enhanced-resolve@4.1.0, enhanced-resolve@^4.1.0: memory-fs "^0.4.0" tapable "^1.0.0" -enhanced-resolve@~0.9.0: - version "0.9.1" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz#4d6e689b3725f86090927ccc86cd9f1635b89e2e" - integrity sha1-TW5omzcl+GCQknzMhs2fFjW4ni4= - dependencies: - graceful-fs "^4.1.2" - memory-fs "^0.2.0" - tapable "^0.1.8" - entities@^1.1.1, entities@~1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" @@ -4085,16 +4070,20 @@ error-ex@^1.2.0, error-ex@^1.3.1: is-arrayish "^0.2.1" es-abstract@^1.10.0, es-abstract@^1.11.0, es-abstract@^1.12.0, es-abstract@^1.13.0, es-abstract@^1.5.1, es-abstract@^1.7.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" - integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== + version "1.14.1" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.14.1.tgz#6e8d84b445ec9c610781e74a6d52cc31aac5b4ca" + integrity sha512-cp/Tb1oA/rh2X7vqeSOvM+TSo3UkJLX70eNihgVEvnzwAgikjkTFr/QVgRCaxjm0knCNQzNoxxxcw2zO2LJdZA== dependencies: es-to-primitive "^1.2.0" function-bind "^1.1.1" has "^1.0.3" + has-symbols "^1.0.0" is-callable "^1.1.4" is-regex "^1.0.4" - object-keys "^1.0.12" + object-inspect "^1.6.0" + object-keys "^1.1.1" + string.prototype.trimleft "^2.0.0" + string.prototype.trimright "^2.0.0" es-to-primitive@^1.2.0: version "1.2.0" @@ -4135,24 +4124,6 @@ eslint-ast-utils@^1.0.0: lodash.get "^4.4.2" lodash.zip "^4.2.0" -eslint-config-kentcdodds@^14.3.2: - version "14.4.0" - resolved "https://registry.yarnpkg.com/eslint-config-kentcdodds/-/eslint-config-kentcdodds-14.4.0.tgz#eba0a6d5f34796249e861f39cdefeefbf8369ccb" - integrity sha512-q9kj1robzBNzo9io1jNZceFF8JQbOR5/UievhUa4lZo+EPvKDnEa136iit1wprlEDQZrru928p8M2tBkrEUDQg== - dependencies: - babel-eslint "^10.0.2" - eslint-config-prettier "^6.1.0" - eslint-import-resolver-webpack "^0.11.1" - eslint-plugin-babel "^5.3.0" - eslint-plugin-import "^2.18.2" - eslint-plugin-jest "^22.15.1" - eslint-plugin-jsx-a11y "^6.2.3" - eslint-plugin-react "^7.14.3" - eslint-plugin-react-hooks "^1.7.0" - read-pkg-up "^6.0.0" - semver "^6.3.0" - webpack "^4.39.2" - eslint-config-precure@4.18.0: version "4.18.0" resolved "https://registry.yarnpkg.com/eslint-config-precure/-/eslint-config-precure-4.18.0.tgz#cb197c1f59e709765e9ac3fdaab619ca956e3b34" @@ -4171,10 +4142,10 @@ eslint-config-precure@4.18.0: eslint-plugin-unicorn "^9.0.0" ptils "^0.3.0" -eslint-config-prettier@^6.0.0, eslint-config-prettier@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.1.0.tgz#e6f678ba367fbd1273998d5510f76f004e9dce7b" - integrity sha512-k9fny9sPjIBQ2ftFTesJV21Rg4R/7a7t7LCtZVrYQiHEp8Nnuk3EGaDmsKSAnsPj0BYcgB2zxzHa2NTkIxcOLg== +eslint-config-prettier@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.2.0.tgz#80e0b8714e3f6868c4ac2a25fbf39c02e73527a7" + integrity sha512-VLsgK/D+S/FEsda7Um1+N8FThec6LqE3vhcMyp8mlmto97y3fGf3DX7byJexGuOb1QY0Z/zz222U5t+xSfcZDQ== dependencies: get-stdin "^6.0.0" @@ -4186,22 +4157,6 @@ eslint-import-resolver-node@^0.3.2: debug "^2.6.9" resolve "^1.5.0" -eslint-import-resolver-webpack@^0.11.1: - version "0.11.1" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.11.1.tgz#fcf1fd57a775f51e18f442915f85dd6ba45d2f26" - integrity sha512-eK3zR7xVQR/MaoBWwGuD+CULYVuqe5QFlDukman71aI6IboCGzggDUohHNfu1ZeBnbHcUHJc0ywWoXUBNB6qdg== - dependencies: - array-find "^1.0.0" - debug "^2.6.8" - enhanced-resolve "~0.9.0" - find-root "^1.1.0" - has "^1.0.1" - interpret "^1.0.0" - lodash "^4.17.4" - node-libs-browser "^1.0.0 || ^2.0.0" - resolve "^1.10.0" - semver "^5.3.0" - eslint-module-utils@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.1.tgz#7b4675875bf96b0dbf1b21977456e5bb1f5e018c" @@ -4210,13 +4165,6 @@ eslint-module-utils@^2.4.0: debug "^2.6.8" pkg-dir "^2.0.0" -eslint-plugin-babel@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-5.3.0.tgz#2e7f251ccc249326da760c1a4c948a91c32d0023" - integrity sha512-HPuNzSPE75O+SnxHIafbW5QB45r2w78fxqwK3HmjqIUoPfPzVrq6rD+CINU3yzoDSzEhUkX07VUphbF73Lth/w== - dependencies: - eslint-rule-composer "^0.3.0" - eslint-plugin-flowtype@^3.6.1: version "3.13.0" resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.13.0.tgz#e241ebd39c0ce519345a3f074ec1ebde4cf80f2c" @@ -4224,7 +4172,7 @@ eslint-plugin-flowtype@^3.6.1: dependencies: lodash "^4.17.15" -eslint-plugin-import@^2.17.2, eslint-plugin-import@^2.18.2: +eslint-plugin-import@^2.17.2: version "2.18.2" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6" integrity sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ== @@ -4241,28 +4189,13 @@ eslint-plugin-import@^2.17.2, eslint-plugin-import@^2.18.2: read-pkg-up "^2.0.0" resolve "^1.11.0" -eslint-plugin-jest@^22.13.3, eslint-plugin-jest@^22.15.1: - version "22.15.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.15.2.tgz#e3c10d9391f787744e31566f69ebb70c3a98e398" - integrity sha512-p4NME9TgXIt+KgpxcXyNBvO30ZKxwFAO1dJZBc2OGfDnXVEtPwEyNs95GSr6RIE3xLHdjd8ngDdE2icRRXrbxg== +eslint-plugin-jest@^22.13.3: + version "22.16.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.16.0.tgz#30c4e0e9dc331beb2e7369b70dd1363690c1ce05" + integrity sha512-eBtSCDhO1k7g3sULX/fuRK+upFQ7s548rrBtxDyM1fSoY7dTWp/wICjrJcDZKVsW7tsFfH22SG+ZaxG5BZodIg== dependencies: "@typescript-eslint/experimental-utils" "^1.13.0" -eslint-plugin-jsx-a11y@^6.2.3: - version "6.2.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.3.tgz#b872a09d5de51af70a97db1eea7dc933043708aa" - integrity sha512-CawzfGt9w83tyuVekn0GDPU9ytYtxyxyFZ3aSWROmnRRFQFT2BiPJd7jvRdzNDi6oLWaS2asMeYSNMjWTV4eNg== - dependencies: - "@babel/runtime" "^7.4.5" - aria-query "^3.0.0" - array-includes "^3.0.3" - ast-types-flow "^0.0.7" - axobject-query "^2.0.2" - damerau-levenshtein "^1.0.4" - emoji-regex "^7.0.2" - has "^1.0.3" - jsx-ast-utils "^2.2.1" - eslint-plugin-prettier@^3.0.1: version "3.1.0" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d" @@ -4270,12 +4203,12 @@ eslint-plugin-prettier@^3.0.1: dependencies: prettier-linter-helpers "^1.0.0" -eslint-plugin-react-hooks@^1.6.0, eslint-plugin-react-hooks@^1.7.0: +eslint-plugin-react-hooks@^1.6.0: version "1.7.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz#6210b6d5a37205f0b92858f895a4e827020a7d04" integrity sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA== -eslint-plugin-react@^7.12.4, eslint-plugin-react@^7.14.3: +eslint-plugin-react@^7.12.4: version "7.14.3" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz#911030dd7e98ba49e1b2208599571846a66bdf13" integrity sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA== @@ -4308,11 +4241,6 @@ eslint-plugin-unicorn@^9.0.0: reserved-words "^0.1.2" safe-regex "^2.0.1" -eslint-rule-composer@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" - integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== - eslint-scope@3.7.1: version "3.7.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" @@ -4610,33 +4538,26 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extract-react-intl-messages@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/extract-react-intl-messages/-/extract-react-intl-messages-1.0.2.tgz#d2496d91127d1409bb6425f742c52312aa2f6063" - integrity sha512-RgZEhBy+NoRgP7zbXZIvx4iT51/Yhg0/L9VzANnyfGz1nsxfGPrLQ7VA7t5MVjelPnkE+k7WLDvQ1XDkjOYMXA== +extract-react-intl-messages@^2.0.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/extract-react-intl-messages/-/extract-react-intl-messages-2.3.2.tgz#3162c972dbeb76c09cc69040721389442f27b013" + integrity sha512-p5OjAT6NxwtgiJu2qhaSPTFBY4W55h3mwGfhp1iXJ62vYaMmpkroC4j1U5QjaLKtNAkBx6E8fXXVvociwiF7Mw== dependencies: - extract-react-intl "^0.9.0" + "@babel/core" "^7.5.5" + babel-plugin-react-intl "^4.1.15" flat "^4.1.0" + glob "^7.1.4" js-yaml "^3.13.1" load-json-file "^6.2.0" + lodash.merge "^4.6.2" + lodash.mergewith "^4.6.2" lodash.pick "^4.4.0" meow "^5.0.0" mkdirp "^0.5.1" - sort-keys "^3.0.0" - write-json-file "^4.1.1" - -extract-react-intl@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/extract-react-intl/-/extract-react-intl-0.9.0.tgz#7eb9de48d222d483eefd4975afc965a1a43e667a" - integrity sha512-O/AqANf7QIXlZPvXeuBr8aXbK/sFMZ0gn26YcRXUSsBaSSFHEvXVrLlQO6nGTAOOVghLoVRS52im5ylPbpdD6g== - dependencies: - "@babel/core" "^7.0.0" - babel-plugin-react-intl "^3.0.1" - glob "^7.1.3" - lodash.merge "^4.6.1" - lodash.mergewith "^4.6.1" pify "^4.0.1" - read-babelrc-up "^0.3.1" + read-babelrc-up "^0.4.0" + sort-keys "^4.0.0" + write-json-file "^4.1.1" extract-zip@1.6.7, extract-zip@^1.0.3: version "1.6.7" @@ -4810,11 +4731,6 @@ find-cache-dir@^2.0.0, find-cache-dir@^2.1.0: make-dir "^2.0.0" pkg-dir "^3.0.0" -find-root@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" - integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== - find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -4904,11 +4820,11 @@ follow-redirects@1.5.10: debug "=3.1.0" follow-redirects@^1.0.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.7.0.tgz#489ebc198dc0e7f64167bd23b03c4c19b5784c76" - integrity sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ== + version "1.8.1" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.8.1.tgz#24804f9eaab67160b0e840c085885d606371a35b" + integrity sha512-micCIbldHioIegeKs41DoH0KS3AXfFzgS30qVkM6z/XOE/GJgvmsoc839NUqa1B9udYe9dQxgv7KFwng6+p/dw== dependencies: - debug "^3.2.6" + debug "^3.0.0" for-in@^1.0.2: version "1.0.2" @@ -5007,7 +4923,7 @@ fsevents@^1.2.7: nan "^2.12.1" node-pre-gyp "^0.12.0" -function-bind@^1.1.1: +function-bind@^1.0.2, function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== @@ -5280,9 +5196,9 @@ handle-thing@^2.0.0: integrity sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ== handlebars@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67" - integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw== + version "4.2.0" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.2.0.tgz#57ce8d2175b9bbb3d8b3cf3e4217b1aec8ddcb2e" + integrity sha512-Kb4xn5Qh1cxAKvQnzNWZ512DhABzyFNmsaJf3OAkWNa4NkaqWcNI8Tao8Tasi0/F4JD9oyG0YxuFyvyR57d+Gw== dependencies: neo-async "^2.6.0" optimist "^0.6.1" @@ -5762,44 +5678,33 @@ internal-ip@^4.3.0: default-gateway "^4.2.0" ipaddr.js "^1.9.0" -interpret@1.2.0, interpret@^1.0.0: +interpret@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== -intl-format-cache@^2.0.5: - version "2.2.9" - resolved "https://registry.yarnpkg.com/intl-format-cache/-/intl-format-cache-2.2.9.tgz#fb560de20c549cda20b569cf1ffb6dc62b5b93b4" - integrity sha512-Zv/u8wRpekckv0cLkwpVdABYST4hZNTDaX7reFetrYTJwxExR2VyTqQm+l0WmL0Qo8Mjb9Tf33qnfj0T7pjxdQ== +intl-format-cache@^4.1.19: + version "4.1.19" + resolved "https://registry.yarnpkg.com/intl-format-cache/-/intl-format-cache-4.1.19.tgz#43da8f621693dbd770683caacdae049ff3e6f31a" + integrity sha512-LIkxfB1KriplBCKsrmWNdmk/fYNFDFkPtmEmPr0zoErypdEsxN9Fpq8VOkIg/JvJk0VMFaDCyjaJ+JRCDqbi2g== -intl-messageformat-parser@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-1.4.0.tgz#b43d45a97468cadbe44331d74bb1e8dea44fc075" - integrity sha1-tD1FqXRoytvkQzHXS7Ho3qRPwHU= - -intl-messageformat-parser@^1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-1.8.1.tgz#0eb14c5618333be4c95c409457b66c8c33ddcc01" - integrity sha512-IMSCKVf0USrM/959vj3xac7s8f87sc+80Y/ipBzdKy4ifBv5Gsj2tZ41EAaURVg01QU71fYr77uA8Meh6kELbg== - -intl-messageformat-parser@^3.0.1: - version "3.0.7" - resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-3.0.7.tgz#d28493501a1bc40a094239b7ef26fe9412558e72" - integrity sha512-L16VbbV3NFaiZV65XwOIH9fBe52TS2EkOR0k8Y4ratsgTE7KPEbcUCUrz/iEQwJo7BcWY4ohkZbeYZRgAiPR1Q== +intl-locales-supported@^1.4.5: + version "1.4.7" + resolved "https://registry.yarnpkg.com/intl-locales-supported/-/intl-locales-supported-1.4.7.tgz#24acc88e1337429dbf1926463e6234c1325bbe6d" + integrity sha512-3arwVxqTBWRom7NiK9GUB25qLtJToH3QYxqMjbbq/+R3Pz3mMQo4GbWQxgM57Aj0bQnrZipht1fwous+QIPduQ== -intl-messageformat@^2.0.0, intl-messageformat@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-2.2.0.tgz#345bcd46de630b7683330c2e52177ff5eab484fc" - integrity sha1-NFvNRt5jC3aDMwwuUhd/9eq0hPw= - dependencies: - intl-messageformat-parser "1.4.0" +intl-messageformat-parser@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-3.1.0.tgz#747e3dbafaf1c1fd07dffa6e4f54ed60e0336ca7" + integrity sha512-HUa6oLTy3Q+X0mpmk3g5as8WiM1F2AtssfsmNbFUu4yf+y/eD6aggpbnfjxT4uTJFL9JhcsE2gQfzAF2PTTsFg== -intl-relativeformat@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/intl-relativeformat/-/intl-relativeformat-2.2.0.tgz#6aca95d019ec8d30b6c5653b6629f9983ea5b6c5" - integrity sha512-4bV/7kSKaPEmu6ArxXf9xjv1ny74Zkwuey8Pm01NH4zggPP7JHwg2STk8Y3JdspCKRDriwIyLRfEXnj2ZLr4Bw== +intl-messageformat@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-7.1.6.tgz#3844b0c65d07eabdf016c1f0a5f1964d24f364a5" + integrity sha512-ef0s+0tNrgNQCZkD3qA1MfYodbMq+pFrqe52E8p9A3lt0euOMtAAUFCKWloT1Ia5bdsjIffdO2F8J1s3LxPoVg== dependencies: - intl-messageformat "^2.0.0" + intl-format-cache "^4.1.19" + intl-messageformat-parser "^3.1.0" invariant@^2.1.1, invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" @@ -5865,6 +5770,11 @@ is-alphanumerical@^1.0.0: is-alphabetical "^1.0.0" is-decimal "^1.0.0" +is-arguments@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.0.4.tgz#3faf966c7cba0ff437fb31f6250082fcf0448cf3" + integrity sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA== + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -6064,9 +5974,9 @@ is-path-cwd@^1.0.0: integrity sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0= is-path-cwd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.0.0.tgz#d4777a8e227a00096a31f030db3770f84b116c02" - integrity sha512-m5dHHzpOXEiv18JEORttBO64UgTEypx99vCxQLjbBvGhOJxnTNglYoFXxwo6AbsQb79sqqycQEHv2hWkHZAijA== + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" + integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== is-path-in-cwd@^1.0.0: version "1.0.1" @@ -6076,11 +5986,11 @@ is-path-in-cwd@^1.0.0: is-path-inside "^1.0.0" is-path-in-cwd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-2.0.0.tgz#68e452a6eec260500cec21e029c0a44cc0dcd2ea" - integrity sha512-6Vz5Gc9s/sDA3JBVu0FzWufm8xaBsqy1zn8Q6gmvGP6nSDMw78aS4poBNeatWjaRpTpxxLn1WOndAiOlk+qY8A== + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz#bfe2dca26c69f397265a4009963602935a053acb" + integrity sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ== dependencies: - is-path-inside "^1.0.0" + is-path-inside "^2.1.0" is-path-inside@^1.0.0: version "1.0.1" @@ -6089,6 +5999,13 @@ is-path-inside@^1.0.0: dependencies: path-is-inside "^1.0.1" +is-path-inside@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-2.1.0.tgz#7c9810587d659a40d27bcdb4d5616eab059494b2" + integrity sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg== + dependencies: + path-is-inside "^1.0.2" + is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" @@ -6730,13 +6647,12 @@ json-buffer@3.0.0: integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg= json-fixer@^1.3.1-0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/json-fixer/-/json-fixer-1.3.1.tgz#22189c66699801475114aacf54de0ec61e53e95b" - integrity sha512-cXDbm60QRRn/3h+uPmVdgt2rBP4VPTQo4OZO+ptw4iZIpT9REfgj/I7/0YVplpEFWph/WGNjto7TPgou2uyfOw== + version "1.3.2" + resolved "https://registry.yarnpkg.com/json-fixer/-/json-fixer-1.3.2.tgz#80aa07b2784e45d6bc7c6fb0a6c8b66a750b7494" + integrity sha512-9Z60lwBP3/SnwnvmIIb13xjXyOpD0ezVAcjfQQHgMbs2Gsl5g5mogfobQO8C0mCSafLwC5lHtxYPwdT1dADrzw== dependencies: "@babel/runtime" "^7.4.5" chalk "^2.4.2" - eslint-config-kentcdodds "^14.3.2" pegjs "^0.10.0" json-loader@0.5.7: @@ -6810,7 +6726,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^2.1.0, jsx-ast-utils@^2.2.1: +jsx-ast-utils@^2.1.0: version "2.2.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz#4d4973ebf8b9d2837ee91a8208cc66f3a2776cfb" integrity sha512-v3FxCcAf20DayI+uxnCuw795+oOIkVu6EnJ1+kSzhqqTZHNkTZ7B66ZgLp4oLJ/gbA64cI0B7WRoHZMSRdyVRQ== @@ -7132,12 +7048,12 @@ lodash.kebabcase@^4.0.1: resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= -lodash.merge@^4.6.0, lodash.merge@^4.6.1: +lodash.merge@^4.6.0, lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash.mergewith@^4.6.1: +lodash.mergewith@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55" integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ== @@ -7409,11 +7325,6 @@ memoize-one@^5.0.0: resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.1.1.tgz#047b6e3199b508eaec03504de71229b8eb1d75c0" integrity sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA== -memory-fs@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.2.0.tgz#f2bb25368bc121e391c2520de92969caee0a0290" - integrity sha1-8rslNovBIeORwlIN6Slpyu4KApA= - memory-fs@^0.4.0, memory-fs@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" @@ -7515,11 +7426,16 @@ miller-rabin@^4.0.0: bn.js "^4.0.0" brorand "^1.0.1" -mime-db@1.40.0, "mime-db@>= 1.40.0 < 2": +mime-db@1.40.0: version "1.40.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== +"mime-db@>= 1.40.0 < 2": + version "1.41.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.41.0.tgz#9110408e1f6aa1b34aef51f2c9df3caddf46b6a0" + integrity sha512-B5gxBI+2K431XW8C2rcc/lhppbuji67nf9v39eH8pkWoZDxnAL0PxdpH32KYRScniF8qDHBDlI+ipgg5WrCUYw== + mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24: version "2.1.24" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" @@ -7532,7 +7448,7 @@ mime@1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mime@^2.0.3, mime@^2.4.2, mime@^2.4.4: +mime@^2.0.3, mime@^2.4.4: version "2.4.4" resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.4.tgz#bd7b91135fc6b01cde3e9bae33d659b63d8857e5" integrity sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA== @@ -7605,9 +7521,9 @@ minimist@~0.0.1: integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= minipass@^2.2.1, minipass@^2.3.5: - version "2.4.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.4.0.tgz#38f0af94f42fb6f34d3d7d82a90e2c99cd3ff485" - integrity sha512-6PmOuSP4NnZXzs2z6rbwzLJu/c5gdzYg1mRI/WIYdx45iiX7T+a4esOzavD6V/KmBzAaopFSTZPZcUx73bqKWA== + version "2.5.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.5.0.tgz#dddb1d001976978158a05badfcbef4a771612857" + integrity sha512-9FwMVYhn6ERvMR8XFdOavRz4QK/VJV8elU1x50vYexf9lslDcWe/f4HBRxCPd185ekRSjU6CfYyJCECa/CQy7Q== dependencies: safe-buffer "^5.1.2" yallist "^3.0.0" @@ -7733,9 +7649,9 @@ natural-compare@^1.4.0: integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= nearley@^2.7.10: - version "2.18.0" - resolved "https://registry.yarnpkg.com/nearley/-/nearley-2.18.0.tgz#a9193612dd6d528a2e47e743b1dc694cfe105223" - integrity sha512-/zQOMCeJcioI0xJtd5RpBiWw2WP7wLe6vq8/3Yu0rEwgus/G/+pViX80oA87JdVgjRt2895mZSv2VfZmy4W1uw== + version "2.19.0" + resolved "https://registry.yarnpkg.com/nearley/-/nearley-2.19.0.tgz#37717781d0fd0f2bfc95e233ebd75678ca4bda46" + integrity sha512-2v52FTw7RPqieZr3Gth1luAXZR7Je6q3KaDHY5bjl/paDUdMu35fZ8ICNgiYJRr3tf3NMvIQQR1r27AvEr9CRA== dependencies: commander "^2.19.0" moo "^0.4.3" @@ -7798,7 +7714,7 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= -"node-libs-browser@^1.0.0 || ^2.0.0", node-libs-browser@^2.2.1: +node-libs-browser@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.2.1.tgz#b64f513d18338625f90346d27b0d235e631f6425" integrity sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q== @@ -7859,10 +7775,10 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.25: - version "1.1.28" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.28.tgz#503c3c70d0e4732b84e7aaa2925fbdde10482d4a" - integrity sha512-AQw4emh6iSXnCpDiFe0phYcThiccmkNWMZnFZ+lDJjAP8J0m2fVd59duvUUyuTirQOhIAajTFkzG6FHCLBO59g== +node-releases@^1.1.29: + version "1.1.29" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.29.tgz#86a57c6587a30ecd6726449e5d293466b0a0bb86" + integrity sha512-R5bDhzh6I+tpi/9i2hrrvGJ3yKPYzlVOORDkXhnZuwi5D3q1I5w4vYy24PJXTcLk9Q0kws9TO77T75bcK8/ysQ== dependencies: semver "^5.3.0" @@ -8026,7 +7942,7 @@ object-is@^1.0.1: resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6" integrity sha1-CqYOyZiaCz7Xlc9NBvYs8a1lObY= -object-keys@^1.0.11, object-keys@^1.0.12: +object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== @@ -8850,9 +8766,9 @@ pseudomap@^1.0.2: integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= psl@^1.1.24, psl@^1.1.28: - version "1.3.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.3.0.tgz#e1ebf6a3b5564fa8376f3da2275da76d875ca1bd" - integrity sha512-avHdspHO+9rQTLbv1RO+MPYeP/SzsCoxofjVnHanETfQhTJrmB0HlDoW+EiN/R+C0BZ+gERab9NY0lPN2TxNag== + version "1.3.1" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.3.1.tgz#d5aa3873a35ec450bc7db9012ad5a7246f6fc8bd" + integrity sha512-2KLd5fKOdAfShtY2d/8XDWVRnmp3zp40Qt6ge2zBPFARLXOGUf2fHD5eg+TV/5oxBtQKVhjUaKFsAaE4HnwfSA== ptils@^0.3.0: version "0.3.0" @@ -9048,16 +8964,22 @@ react-hot-loader@4.12.10: shallowequal "^1.1.0" source-map "^0.7.3" -react-intl@^2.8.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-2.9.0.tgz#c97c5d17d4718f1575fdbd5a769f96018a3b1843" - integrity sha512-27jnDlb/d2A7mSJwrbOBnUgD+rPep+abmoJE511Tf8BnoONIAUehy/U1zZCHGO17mnOwMWxqN4qC0nW11cD6rA== +react-intl@*, react-intl@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-3.2.0.tgz#fa882b69dd5e3cecbfbf71d26f726f6855203b1c" + integrity sha512-TAElrF1kV6SHGSkYrPojnsUALRTSFqlEJTOJuyivLdA4St1LinkgmMuoHEaldzTyG/bBhF2LkzF9OlTOAglfDA== dependencies: + "@formatjs/intl-relativetimeformat" "^3.0.2" + "@formatjs/intl-unified-numberformat" "^0.4.9" + "@types/hoist-non-react-statics" "^3.3.1" + "@types/invariant" "^2.2.30" hoist-non-react-statics "^3.3.0" - intl-format-cache "^2.0.5" - intl-messageformat "^2.1.0" - intl-relativeformat "^2.1.0" + intl-format-cache "^4.1.19" + intl-locales-supported "^1.4.5" + intl-messageformat "^7.1.6" + intl-messageformat-parser "^3.1.0" invariant "^2.1.1" + shallow-equal "^1.1.0" react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6, react-is@^16.9.0: version "16.9.0" @@ -9079,16 +9001,16 @@ react-motion@^0.5.2: raf "^3.1.0" react-redux@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.1.0.tgz#72af7cf490a74acdc516ea9c1dd80e25af9ea0b2" - integrity sha512-hyu/PoFK3vZgdLTg9ozbt7WF3GgX5+Yn3pZm5/96/o4UueXA+zj08aiSC9Mfj2WtD1bvpIb3C5yvskzZySzzaw== + version "7.1.1" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.1.1.tgz#ce6eee1b734a7a76e0788b3309bf78ff6b34fa0a" + integrity sha512-QsW0vcmVVdNQzEkrgzh2W3Ksvr8cqpAv5FhEk7tNEft+5pp7rXxAudTz3VOPawRkLIepItpkEIyLcN/VVXzjTg== dependencies: - "@babel/runtime" "^7.4.5" + "@babel/runtime" "^7.5.5" hoist-non-react-statics "^3.3.0" invariant "^2.2.4" loose-envify "^1.4.0" prop-types "^15.7.2" - react-is "^16.8.6" + react-is "^16.9.0" react-sortable-pane@^1.0.4: version "1.1.0" @@ -9142,12 +9064,12 @@ react@^16.8.3: object-assign "^4.1.1" prop-types "^15.6.2" -read-babelrc-up@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/read-babelrc-up/-/read-babelrc-up-0.3.1.tgz#4903b773ce68c00ca9f2aec4cace3ef72f851eb7" - integrity sha512-DAFetxQZKpiIAmjpnbxTAJ5lohBaKhRTfcfexApDmkVBGgg8ScbXCFhzZ3KYlagTNK0Bja0xPvQwcGLer6ukxg== +read-babelrc-up@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/read-babelrc-up/-/read-babelrc-up-0.4.0.tgz#9810afd08abefb9f03eaf3f6396e77a75489e099" + integrity sha512-gWVXJPjXExtjVFgmyZ/Fv1B00ULe1SZLlyIcCnWOWcJIHCH88d4rrfJzBzKTIkwrqoBmvgCsTl1KDRNS1nOh6A== dependencies: - find-up "^3.0.0" + find-up "^4.0.0" json5 "^2.1.0" read-config-file@5.0.0: @@ -9178,7 +9100,7 @@ read-pkg-up@4.0.0, read-pkg-up@^4.0.0: find-up "^3.0.0" read-pkg "^3.0.0" -read-pkg-up@6.0.0, read-pkg-up@^6.0.0: +read-pkg-up@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-6.0.0.tgz#da75ce72762f2fa1f20c5a40d4dd80c77db969e3" integrity sha512-odtTvLl+EXo1eTsMnoUHRmg/XmXdTkwXVxy4VFE9Kp6cCq7b3l7QMdBndND3eAFzrbSAXC/WCUOQQ9rLjifKZw== @@ -9335,9 +9257,9 @@ redux-saga@^1.0.2: "@redux-saga/core" "^1.0.3" "redux@>=0.10 <5", redux@^4.0.0, redux@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.1.tgz#436cae6cc40fbe4727689d7c8fae44808f1bfef5" - integrity sha512-R7bAtSkk7nY6O/OYMVR9RiBI+XghjF9rlbl5806HJbQph0LJVHZrU5oaO4q70eUKiqMRqm4y07KLTlMZ2BlVmg== + version "4.0.4" + resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.4.tgz#4ee1aeb164b63d6a1bcc57ae4aa0b6e6fa7a3796" + integrity sha512-vKv4WdiJxOWKxK0yRoaK3Y4pxxB0ilzVx6dszU2W8wLxlb2yikRph4iV/ymtdJ6ZxpBLFbyrxklnT5yBbQSl3Q== dependencies: loose-envify "^1.4.0" symbol-observable "^1.2.0" @@ -9385,9 +9307,16 @@ regex-not@^1.0.0, regex-not@^1.0.2: safe-regex "^1.1.0" regexp-tree@^0.1.6, regexp-tree@~0.1.1: - version "0.1.11" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.11.tgz#c9c7f00fcf722e0a56c7390983a7a63dd6c272f3" - integrity sha512-7/l/DgapVVDzZobwMCCgMlqiqyLFJ0cduo/j+3BcDJIB+yJdsYCfKuI3l/04NV+H/rfNRdPIDbXNZHM9XvQatg== + version "0.1.13" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.13.tgz#5b19ab9377edc68bc3679256840bb29afc158d7f" + integrity sha512-hwdV/GQY5F8ReLZWO+W1SRoN5YfpOKY6852+tBFcma72DKBIcHjPRIlIvQN35bCOljuAfP2G2iB0FC/w236mUw== + +regexp.prototype.flags@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.2.0.tgz#6b30724e306a27833eeb171b66ac8890ba37e41c" + integrity sha512-ztaw4M1VqgMwl9HlPpOuiYgItcHlunW0He2fE6eNfT6E/CF2FtYi9ofOYe4mKntstYk0Fyh/rDRBdS3AnxjlrA== + dependencies: + define-properties "^1.1.2" regexpp@^2.0.1: version "2.0.1" @@ -9635,7 +9564,7 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.3.2, resolve@^1.3.3, resolve@^1.5.0: +resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.12.0, resolve@^1.3.2, resolve@^1.3.3, resolve@^1.5.0: version "1.12.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== @@ -9674,7 +9603,7 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" -rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: +rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -9722,9 +9651,9 @@ run-queue@^1.0.0, run-queue@^1.0.3: aproba "^1.1.1" rxjs@^6.3.3, rxjs@^6.4.0: - version "6.5.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" - integrity sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg== + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" + integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== dependencies: tslib "^1.9.0" @@ -9773,9 +9702,9 @@ sane@^4.0.3: walker "~1.0.5" sanitize-filename@^1.6.2: - version "1.6.2" - resolved "https://registry.yarnpkg.com/sanitize-filename/-/sanitize-filename-1.6.2.tgz#01b4fc8809f14e9d22761fe70380fe7f3f902185" - integrity sha512-cmTzND7RMxUB+f7gI+4+KAVHWEg0lfXvQJdko+FXDP5bNbGIdx4KMP5pX6lv5jfT9jSf6OBbjyxjFtZQwYA/ig== + version "1.6.3" + resolved "https://registry.yarnpkg.com/sanitize-filename/-/sanitize-filename-1.6.3.tgz#755ebd752045931977e30b2025d340d7c9090378" + integrity sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg== dependencies: truncate-utf8-bytes "^1.0.0" @@ -9868,9 +9797,9 @@ send@0.17.1: statuses "~1.5.0" serialize-javascript@^1.7.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.8.0.tgz#9515fc687232e2321aea1ca7a529476eb34bb480" - integrity sha512-3tHgtF4OzDmeKYj6V9nSyceRS0UJ3C7VqyD2Yj28vC/z2j6jG5FmFGahOKMD9CrglxTm3tETr87jEypaYV8DUg== + version "1.9.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.9.0.tgz#5b77019d7c3b85fe91b33ae424c53dcbfb6618bd" + integrity sha512-UkGlcYMtw4d9w7YfCtJFgdRTps8N4L0A48R+SmcGL57ki1+yHwJXnalk5bjgrw+ljv6SfzjzPjhohod2qllg/Q== serve-index@^1.9.1: version "1.9.1" @@ -9933,6 +9862,11 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" +shallow-equal@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shallow-equal/-/shallow-equal-1.2.0.tgz#fd828d2029ff4e19569db7e19e535e94e2d1f5cc" + integrity sha512-Z21pVxR4cXsfwpMKMhCEIO1PCi5sp7KEp+CmOpBQ+E8GpHwKOw2sEzk7sgblM3d/j4z4gakoWEoPcjK0VJQogA== + shallowequal@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" @@ -9966,9 +9900,9 @@ simple-assign@^0.1.0: integrity sha1-F/0wZqXz13OPUDIbsPFMooHMS6o= simple-git@^1.85.0: - version "1.124.0" - resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.124.0.tgz#10a73cc1af303832b5c11720d4256e134fba35ca" - integrity sha512-ks9mBoO4ODQy/xGLC8Cc+YDvj/hho/IKgPhi6h5LI/sA+YUdHc3v0DEoHzM29VmulubpGCxMJUSFmyXNsjNMEA== + version "1.126.0" + resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.126.0.tgz#0c345372275139c8433b8277f4b3e155092aa434" + integrity sha512-47mqHxgZnN8XRa9HbpWprzUv3Ooqz9RY/LSZgvA7jCkW8jcwLahMz7LKugY91KZehfG0sCVPtgXiU72hd6b1Bw== dependencies: debug "^4.0.1" @@ -10070,6 +10004,13 @@ sort-keys@^3.0.0: dependencies: is-plain-obj "^2.0.0" +sort-keys@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-4.0.0.tgz#56dc5e256637bfe3fec8db0dc57c08b1a2be22d6" + integrity sha512-hlJLzrn/VN49uyNkZ8+9b+0q9DjmmYcYOnbMQtpkLrYpPwRApDPZfmqbUfJnAA3sb/nRib+nDot7Zi/1ER1fuA== + dependencies: + is-plain-obj "^2.0.0" + source-list-map@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" @@ -10341,6 +10282,22 @@ string.prototype.trim@^1.1.2: es-abstract "^1.13.0" function-bind "^1.1.1" +string.prototype.trimleft@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.0.0.tgz#68b6aa8e162c6a80e76e3a8a0c2e747186e271ff" + integrity sha1-aLaqjhYsaoDnbjqKDC50cYbicf8= + dependencies: + define-properties "^1.1.2" + function-bind "^1.0.2" + +string.prototype.trimright@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.0.0.tgz#ab4a56d802a01fbe7293e11e84f24dc8164661dd" + integrity sha1-q0pW2AKgH75yk+EehPJNyBZGYd0= + dependencies: + define-properties "^1.1.2" + function-bind "^1.0.2" + string_decoder@^1.0.0, string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -10612,11 +10569,6 @@ table@^5.2.3: slice-ansi "^2.1.0" string-width "^3.0.0" -tapable@^0.1.8: - version "0.1.10" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.1.10.tgz#29c35707c2b70e50d07482b5d202e8ed446dafd4" - integrity sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q= - tapable@^1.0.0, tapable@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" @@ -10969,9 +10921,9 @@ typescript-tuple@^2.1.0: typescript-compare "^0.0.2" typescript@^3.3.3333: - version "3.3.3333" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6" - integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw== + version "3.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54" + integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw== ua-parser-js@^0.7.18: version "0.7.20" @@ -11133,9 +11085,9 @@ unset-value@^1.0.0: isobject "^3.0.0" upath@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.2.tgz#3db658600edaeeccbe6db5e684d67ee8c2acd068" - integrity sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q== + version "1.2.0" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" + integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== update-notifier@^3.0.1: version "3.0.1" @@ -11400,12 +11352,13 @@ webpack-cli@3.3.6: yargs "13.2.4" webpack-dev-middleware@^3.7.0: - version "3.7.0" - resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.7.0.tgz#ef751d25f4e9a5c8a35da600c5fda3582b5c6cff" - integrity sha512-qvDesR1QZRIAZHOE3iQ4CXLZZSQ1lAUsSpnQmlB1PBfoN/xdRjmge3Dok0W4IdaVLJOGJy3sGI4sZHwjRU0PCA== + version "3.7.1" + resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.7.1.tgz#1167aea02afa034489869b8368fe9fed1aea7d09" + integrity sha512-5MWu9SH1z3hY7oHOV6Kbkz5x7hXbxK56mGHNqHTe6d+ewxOwKUxoUJBs7QIaJb33lPjl9bJZ3X0vCoooUzC36A== dependencies: memory-fs "^0.4.1" - mime "^2.4.2" + mime "^2.4.4" + mkdirp "^0.5.1" range-parser "^1.2.1" webpack-log "^2.0.0" @@ -11498,35 +11451,6 @@ webpack@4.39.1: watchpack "^1.6.0" webpack-sources "^1.4.1" -webpack@^4.39.2: - version "4.39.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.39.2.tgz#c9aa5c1776d7c309d1b3911764f0288c8c2816aa" - integrity sha512-AKgTfz3xPSsEibH00JfZ9sHXGUwIQ6eZ9tLN8+VLzachk1Cw2LVmy+4R7ZiwTa9cZZ15tzySjeMui/UnSCAZhA== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-module-context" "1.8.5" - "@webassemblyjs/wasm-edit" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - acorn "^6.2.1" - ajv "^6.10.2" - ajv-keywords "^3.4.1" - chrome-trace-event "^1.0.2" - enhanced-resolve "^4.1.0" - eslint-scope "^4.0.3" - json-parse-better-errors "^1.0.2" - loader-runner "^2.4.0" - loader-utils "^1.2.3" - memory-fs "^0.4.1" - micromatch "^3.1.10" - mkdirp "^0.5.1" - neo-async "^2.6.1" - node-libs-browser "^2.2.1" - schema-utils "^1.0.0" - tapable "^1.1.3" - terser-webpack-plugin "^1.4.1" - watchpack "^1.6.0" - webpack-sources "^1.4.1" - websocket-driver@>=0.5.1: version "0.7.3" resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.3.tgz#a2d4e0d4f4f116f1e6297eba58b05d430100e9f9"