From 8ff1f29a5b58e120035812e1f606476b16570875 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Thu, 19 Oct 2017 12:49:08 +0100 Subject: [PATCH 001/322] Node: remove redundant widen of query type to any --- types/node/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index d8e8fe3358..fedc0d99b6 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2188,7 +2188,6 @@ declare module "url" { export interface Url extends UrlObject { port?: string; - query?: any; } export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url; From 0e652b0a41843f5e851f434df376427e834c2911 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Thu, 19 Oct 2017 12:49:23 +0100 Subject: [PATCH 002/322] Node: rename URL types for clarity --- types/node/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index fedc0d99b6..e54d972797 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2171,7 +2171,7 @@ declare module "child_process" { } declare module "url" { - export interface UrlObject { + export interface InputUrlObject { auth?: string; hash?: string; host?: string; @@ -2186,13 +2186,13 @@ declare module "url" { slashes?: boolean; } - export interface Url extends UrlObject { + export interface OutputUrlObject extends InputUrlObject { port?: string; } - export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url; + export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): OutputUrlObject; export function format(URL: URL, options?: URLFormatOptions): string; - export function format(urlObject: UrlObject | string): string; + export function format(urlObject: InputUrlObject | string): string; export function resolve(from: string, to: string): string; export interface URLFormatOptions { From 901b2ad5187b29eac80a3ca8efa947f41372f43b Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Thu, 19 Oct 2017 12:55:39 +0100 Subject: [PATCH 003/322] Node: add and share `ParsedUrlQuery` type --- types/node/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index e54d972797..44c8b68283 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -796,8 +796,10 @@ declare module "querystring" { decodeURIComponent?: Function; } + interface ParsedUrlQuery { [key: string]: string | string[]; } + export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; - export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): { [key: string]: string | string[] }; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): T; export function escape(str: string): string; export function unescape(str: string): string; @@ -2171,6 +2173,8 @@ declare module "child_process" { } declare module "url" { + import { ParsedUrlQuery } from 'querystring'; + export interface InputUrlObject { auth?: string; hash?: string; @@ -2181,7 +2185,7 @@ declare module "url" { pathname?: string; port?: string | number; protocol?: string; - query?: string | null | { [key: string]: string | string[] }; + query?: string | null | ParsedUrlQuery; search?: string; slashes?: boolean; } From 9038ae1fe32a46899e2dc8494e7921d7fb8727f8 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Thu, 19 Oct 2017 18:57:56 +0100 Subject: [PATCH 004/322] Revert "Node: rename URL types for clarity" This reverts commit 0e652b0a41843f5e851f434df376427e834c2911. --- types/node/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 44c8b68283..2ffe900742 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2175,7 +2175,7 @@ declare module "child_process" { declare module "url" { import { ParsedUrlQuery } from 'querystring'; - export interface InputUrlObject { + export interface UrlObject { auth?: string; hash?: string; host?: string; @@ -2190,13 +2190,13 @@ declare module "url" { slashes?: boolean; } - export interface OutputUrlObject extends InputUrlObject { + export interface Url extends UrlObject { port?: string; } - export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): OutputUrlObject; + export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url; export function format(URL: URL, options?: URLFormatOptions): string; - export function format(urlObject: InputUrlObject | string): string; + export function format(urlObject: UrlObject | string): string; export function resolve(from: string, to: string): string; export interface URLFormatOptions { From c2b55c10e78105a910c1ead11282bf1243562aa9 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Wed, 25 Oct 2017 17:46:15 +0100 Subject: [PATCH 005/322] Create `UrlObjectCommon` and move wider `port` type to `UrlObject` --- types/node/index.d.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 2ffe900742..bdbfa67817 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2175,7 +2175,7 @@ declare module "child_process" { declare module "url" { import { ParsedUrlQuery } from 'querystring'; - export interface UrlObject { + export interface UrlObjectCommon { auth?: string; hash?: string; host?: string; @@ -2183,14 +2183,17 @@ declare module "url" { href?: string; path?: string; pathname?: string; - port?: string | number; protocol?: string; query?: string | null | ParsedUrlQuery; search?: string; slashes?: boolean; } - export interface Url extends UrlObject { + export interface UrlObject extends UrlObjectCommon { + port?: string | number; + } + + export interface Url extends UrlObjectCommon { port?: string; } From d12e7c1f38054306aaf30e74baa9785b56719ffd Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Wed, 25 Oct 2017 17:46:33 +0100 Subject: [PATCH 006/322] Specify wider `query` for `UrlObject` --- types/node/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index bdbfa67817..ac7081f7e2 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2184,17 +2184,18 @@ declare module "url" { path?: string; pathname?: string; protocol?: string; - query?: string | null | ParsedUrlQuery; search?: string; slashes?: boolean; } export interface UrlObject extends UrlObjectCommon { port?: string | number; + query?: string | null | { [key: string]: any }; } export interface Url extends UrlObjectCommon { port?: string; + query?: string | null | ParsedUrlQuery; } export function parse(urlStr: string, parseQueryString?: boolean, slashesDenoteHost?: boolean): Url; From 95f225e44a1a35edef109c4d28a8026b0b081648 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Wed, 25 Oct 2017 17:47:06 +0100 Subject: [PATCH 007/322] Document types --- types/node/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index ac7081f7e2..7e38b30625 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2188,11 +2188,13 @@ declare module "url" { slashes?: boolean; } + // Input to `url.format` export interface UrlObject extends UrlObjectCommon { port?: string | number; query?: string | null | { [key: string]: any }; } + // Output of `url.parse` export interface Url extends UrlObjectCommon { port?: string; query?: string | null | ParsedUrlQuery; From 9cc1b19ab0ff0c5c06f9af38b9f6fdabc5e38429 Mon Sep 17 00:00:00 2001 From: "U-SWRI16\\svogel" Date: Fri, 27 Oct 2017 19:38:55 -0500 Subject: [PATCH 008/322] Adding props export to all elements. --- types/reactstrap/index.d.ts | 152 +++++++++--------- types/reactstrap/lib/Alert.d.ts | 7 +- types/reactstrap/lib/Badge.d.ts | 5 +- types/reactstrap/lib/Breadcrumb.d.ts | 5 +- types/reactstrap/lib/BreadcrumbItem.d.ts | 6 +- types/reactstrap/lib/Button.d.ts | 5 +- types/reactstrap/lib/ButtonDropdown.d.ts | 12 +- types/reactstrap/lib/ButtonGroup.d.ts | 5 +- types/reactstrap/lib/ButtonToolbar.d.ts | 5 +- types/reactstrap/lib/Card.d.ts | 6 +- types/reactstrap/lib/CardBlock.d.ts | 6 +- types/reactstrap/lib/CardBody.d.ts | 5 +- types/reactstrap/lib/CardColumns.d.ts | 5 +- types/reactstrap/lib/CardDeck.d.ts | 5 +- types/reactstrap/lib/CardFooter.d.ts | 5 +- types/reactstrap/lib/CardGroup.d.ts | 5 +- types/reactstrap/lib/CardHeader.d.ts | 5 +- types/reactstrap/lib/CardImg.d.ts | 5 +- types/reactstrap/lib/CardImgOverlay.d.ts | 5 +- types/reactstrap/lib/CardLink.d.ts | 5 +- types/reactstrap/lib/CardSubtitle.d.ts | 5 +- types/reactstrap/lib/CardText.d.ts | 5 +- types/reactstrap/lib/CardTitle.d.ts | 5 +- types/reactstrap/lib/Col.d.ts | 5 +- types/reactstrap/lib/Collapse.d.ts | 5 +- types/reactstrap/lib/Container.d.ts | 5 +- types/reactstrap/lib/Dropdown.d.ts | 7 +- types/reactstrap/lib/DropdownItem.d.ts | 5 +- types/reactstrap/lib/DropdownMenu.d.ts | 5 +- types/reactstrap/lib/DropdownToggle.d.ts | 5 +- types/reactstrap/lib/Fade.d.ts | 5 +- types/reactstrap/lib/Form.d.ts | 5 +- types/reactstrap/lib/FormFeedback.d.ts | 5 +- types/reactstrap/lib/FormGroup.d.ts | 5 +- types/reactstrap/lib/FormText.d.ts | 5 +- types/reactstrap/lib/Input.d.ts | 5 +- types/reactstrap/lib/InputGroup.d.ts | 5 +- types/reactstrap/lib/InputGroupAddon.d.ts | 5 +- types/reactstrap/lib/InputGroupButton.d.ts | 5 +- types/reactstrap/lib/Jumbotron.d.ts | 5 +- types/reactstrap/lib/Label.d.ts | 5 +- types/reactstrap/lib/ListGroup.d.ts | 5 +- types/reactstrap/lib/ListGroupItem.d.ts | 7 +- .../reactstrap/lib/ListGroupItemHeading.d.ts | 5 +- types/reactstrap/lib/ListGroupItemText.d.ts | 5 +- types/reactstrap/lib/Media.d.ts | 5 +- types/reactstrap/lib/Modal.d.ts | 5 +- types/reactstrap/lib/ModalBody.d.ts | 5 +- types/reactstrap/lib/ModalFooter.d.ts | 5 +- types/reactstrap/lib/ModalHeader.d.ts | 5 +- types/reactstrap/lib/Nav.d.ts | 5 +- types/reactstrap/lib/NavDropdown.d.ts | 12 +- types/reactstrap/lib/NavItem.d.ts | 5 +- types/reactstrap/lib/NavLink.d.ts | 5 +- types/reactstrap/lib/Navbar.d.ts | 5 +- types/reactstrap/lib/NavbarBrand.d.ts | 5 +- types/reactstrap/lib/NavbarToggler.d.ts | 5 +- types/reactstrap/lib/Pagination.d.ts | 5 +- types/reactstrap/lib/PaginationItem.d.ts | 5 +- types/reactstrap/lib/PaginationLink.d.ts | 5 +- types/reactstrap/lib/Popover.d.ts | 5 +- types/reactstrap/lib/PopoverContent.d.ts | 5 +- types/reactstrap/lib/PopoverTitle.d.ts | 5 +- types/reactstrap/lib/Progress.d.ts | 5 +- types/reactstrap/lib/Row.d.ts | 5 +- types/reactstrap/lib/TabContent.d.ts | 5 +- types/reactstrap/lib/TabPane.d.ts | 5 +- types/reactstrap/lib/Table.d.ts | 5 +- types/reactstrap/lib/Tag.d.ts | 5 +- types/reactstrap/lib/TetherContent.d.ts | 5 +- types/reactstrap/lib/Tooltip.d.ts | 9 +- types/reactstrap/lib/Uncontrolled.d.ts | 42 ++--- 72 files changed, 238 insertions(+), 333 deletions(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 81d4cec5bd..f653585c8f 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -8,80 +8,78 @@ export interface CSSModule { [className: string]: string; } -export { default as Alert } from './lib/Alert'; -export { default as Badge } from './lib/Badge'; -export { default as Breadcrumb } from './lib/Breadcrumb'; -export { default as BreadcrumbItem } from './lib/BreadcrumbItem'; -export { default as Button } from './lib/Button'; -export { default as ButtonDropdown } from './lib/ButtonDropdown'; -export { default as ButtonGroup } from './lib/ButtonGroup'; -export { default as ButtonToolbar } from './lib/ButtonToolbar'; -export { default as Card } from './lib/Card'; -export { default as CardBody } from './lib/CardBody'; -export { default as CardBlock } from './lib/CardBlock'; -export { default as CardColumns } from './lib/CardColumns'; -export { default as CardDeck } from './lib/CardDeck'; -export { default as CardFooter } from './lib/CardFooter'; -export { default as CardGroup } from './lib/CardGroup'; -export { default as CardHeader } from './lib/CardHeader'; -export { default as CardImg } from './lib/CardImg'; -export { default as CardImgOverlay } from './lib/CardImgOverlay'; -export { default as CardLink } from './lib/CardLink'; -export { default as CardSubtitle } from './lib/CardSubtitle'; -export { default as CardText } from './lib/CardText'; -export { default as CardTitle } from './lib/CardTitle'; -export { default as Col } from './lib/Col'; -export { default as Collapse } from './lib/Collapse'; -export { default as Container } from './lib/Container'; -export { default as Dropdown } from './lib/Dropdown'; -export { default as DropdownItem } from './lib/DropdownItem'; -export { default as DropdownMenu } from './lib/DropdownMenu'; -export { default as DropdownToggle } from './lib/DropdownToggle'; -export { default as Fade } from './lib/Fade'; -export { default as Form } from './lib/Form'; -export { default as FormFeedback } from './lib/FormFeedback'; -export { default as FormGroup } from './lib/FormGroup'; -export { default as FormText } from './lib/FormText'; -export { default as Input } from './lib/Input'; -export { default as InputGroup } from './lib/InputGroup'; -export { default as InputGroupAddon } from './lib/InputGroupAddon'; -export { default as InputGroupButton } from './lib/InputGroupButton'; -export { default as Jumbotron } from './lib/Jumbotron'; -export { default as Label } from './lib/Label'; -export { default as ListGroup } from './lib/ListGroup'; -export { default as ListGroupItem } from './lib/ListGroupItem'; -export { default as ListGroupItemHeading } from './lib/ListGroupItemHeading'; -export { default as ListGroupItemText } from './lib/ListGroupItemText'; -export { default as Media } from './lib/Media'; -export { default as Modal } from './lib/Modal'; -export { default as ModalBody } from './lib/ModalBody'; -export { default as ModalFooter } from './lib/ModalFooter'; -export { default as ModalHeader } from './lib/ModalHeader'; -export { default as Nav } from './lib/Nav'; -export { default as Navbar } from './lib/Navbar'; -export { default as NavbarBrand } from './lib/NavbarBrand'; -export { default as NavbarToggler } from './lib/NavbarToggler'; -export { default as NavDropdown } from './lib/NavDropdown'; -export { default as NavItem } from './lib/NavItem'; -export { default as NavLink } from './lib/NavLink'; -export { default as Pagination } from './lib/Pagination'; -export { default as PaginationItem } from './lib/PaginationItem'; -export { default as PaginationLink } from './lib/PaginationLink'; -export { default as Popover } from './lib/Popover'; -export { default as PopoverContent } from './lib/PopoverContent'; -export { default as PopoverTitle } from './lib/PopoverTitle'; -export { default as Progress } from './lib/Progress'; -export { default as Row } from './lib/Row'; -export { default as TabContent } from './lib/TabContent'; -export { default as Table } from './lib/Table'; -export { default as TabPane } from './lib/TabPane'; -export { default as Tag } from './lib/Tag'; -export { default as TetherContent } from './lib/TetherContent'; -export { default as Tooltip } from './lib/Tooltip'; -export { - UncontrolledAlert, - UncontrolledButtonDropdown, - UncontrolledDropdown, - UncontrolledNavDropdown, - UncontrolledTooltip -} from './lib/Uncontrolled'; +export { Alert, AlertProps } from './lib/Alert'; +export { Badge, BadgeProps } from './lib/Badge'; +export { Breadcrumb, BreadcrumbProps } from './lib/Breadcrumb'; +export { BreadcrumbItem, BreadcrumbItemProps } from './lib/BreadcrumbItem'; +export { Button, ButtonProps } from './lib/Button'; +export { ButtonDropdown, ButtonDropdownProps } from './lib/ButtonDropdown'; +export { ButtonGroup, ButtonGroupProps } from './lib/ButtonGroup'; +export { ButtonToolbar, ButtonToolbarProps } from './lib/ButtonToolbar'; +export { Card, CardProps } from './lib/Card'; +export { CardBody, CardBodyProps } from './lib/CardBody'; +export { CardBlock, CardBlockProps } from './lib/CardBlock'; +export { CardColumns, CardColumnsProps } from './lib/CardColumns'; +export { CardDeck, CardDeckProps } from './lib/CardDeck'; +export { CardFooter, CardFooterProps } from './lib/CardFooter'; +export { CardGroup, CardGroupProps } from './lib/CardGroup'; +export { CardHeader, CardHeaderProps } from './lib/CardHeader'; +export { CardImg, CardImgProps } from './lib/CardImg'; +export { CardImgOverlay, CardImgOverlayProps } from './lib/CardImgOverlay'; +export { CardLink, CardLinkProps } from './lib/CardLink'; +export { CardSubtitle, CardSubtitleProps } from './lib/CardSubtitle'; +export { CardText, CardTextProps } from './lib/CardText'; +export { CardTitle, CardTitleProps } from './lib/CardTitle'; +export { Col, ColProps } from './lib/Col'; +export { Collapse, CollapseProps } from './lib/Collapse'; +export { Container, ContainerProps } from './lib/Container'; +export { Dropdown, DropdownProps } from './lib/Dropdown'; +export { DropdownItem, DropdownItemProps } from './lib/DropdownItem'; +export { DropdownMenu, DropdownMenuProps } from './lib/DropdownMenu'; +export { DropdownToggle, DropdownToggleProps } from './lib/DropdownToggle'; +export { Fade, FadeProps } from './lib/Fade'; +export { Form, FormProps } from './lib/Form'; +export { FormFeedback, FormFeedbackProps } from './lib/FormFeedback'; +export { FormGroup, FormGroupProps } from './lib/FormGroup'; +export { FormText, FormTextProps } from './lib/FormText'; +export { Input, InputProps } from './lib/Input'; +export { InputGroup, InputGroupProps } from './lib/InputGroup'; +export { InputGroupAddon, InputGroupAddonProps } from './lib/InputGroupAddon'; +export { InputGroupButton, InputGroupButtonProps } from './lib/InputGroupButton'; +export { Jumbotron, JumbotronProps } from './lib/Jumbotron'; +export { Label, LabelProps } from './lib/Label'; +export { ListGroup, ListGroupProps } from './lib/ListGroup'; +export { ListGroupItem, ListGroupItemProps } from './lib/ListGroupItem'; +export { ListGroupItemHeading, ListGroupItemHeadingProps } from './lib/ListGroupItemHeading'; +export { ListGroupItemText, ListGroupItemTextProps } from './lib/ListGroupItemText'; +export { Media, MediaProps } from './lib/Media'; +export { Modal, ModalProps } from './lib/Modal'; +export { ModalBody, ModalBodyProps } from './lib/ModalBody'; +export { ModalFooter, ModalFooterProps } from './lib/ModalFooter'; +export { ModalHeader, ModalHeaderProps } from './lib/ModalHeader'; +export { Nav, NavProps } from './lib/Nav'; +export { Navbar, NavbarProps } from './lib/Navbar'; +export { NavbarBrand, NavbarBrandProps } from './lib/NavbarBrand'; +export { NavbarToggler, NavbarTogglerProps } from './lib/NavbarToggler'; +export { NavDropdown, NavDropdownProps } from './lib/NavDropdown'; +export { NavItem, NavItemProps } from './lib/NavItem'; +export { NavLink, NavLinkProps } from './lib/NavLink'; +export { Pagination, PaginationProps } from './lib/Pagination'; +export { PaginationItem, PaginationItemProps } from './lib/PaginationItem'; +export { PaginationLink, PaginationLinkProps } from './lib/PaginationLink'; +export { Popover, PopoverProps } from './lib/Popover'; +export { PopoverContent, PopoverContentProps } from './lib/PopoverContent'; +export { PopoverTitle, PopoverTitleProps } from './lib/PopoverTitle'; +export { Progress, ProgressProps } from './lib/Progress'; +export { Row, RowProps } from './lib/Row'; +export { TabContent, TabContentProps } from './lib/TabContent'; +export { Table, TableProps } from './lib/Table'; +export { TabPane, TabPaneProps } from './lib/TabPane'; +export { Tag, TagProps } from './lib/Tag'; +export { TetherContent, TetherContentProps } from './lib/TetherContent'; +export { Tooltip, TooltipProps } from './lib/Tooltip'; +export { UncontrolledAlert, UncontrolledAlertProps } from './lib/Uncontrolled'; +export { UncontrolledButtonDropdown, UncontrolledButtonDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledDropdown, UncontrolledDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledNavDropdown, UncontrolledNavDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledTooltip, UncontrolledTooltipProps } from './lib/Uncontrolled'; diff --git a/types/reactstrap/lib/Alert.d.ts b/types/reactstrap/lib/Alert.d.ts index e29d62cb0d..1b4f6eb884 100644 --- a/types/reactstrap/lib/Alert.d.ts +++ b/types/reactstrap/lib/Alert.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface UncontrolledProps { +export interface UncontrolledAlertProps { className?: string; cssModule?: CSSModule; color?: string; @@ -10,10 +10,9 @@ export interface UncontrolledProps { transitionLeaveTimeout?: number; } -interface Props extends UncontrolledProps { +export interface AlertProps extends UncontrolledAlertProps { isOpen?: boolean; toggle?: () => void; } -declare var Alert: React.StatelessComponent; -export default Alert; +export const Alert: React.StatelessComponent; diff --git a/types/reactstrap/lib/Badge.d.ts b/types/reactstrap/lib/Badge.d.ts index 51f72e39d3..4c21dcac42 100644 --- a/types/reactstrap/lib/Badge.d.ts +++ b/types/reactstrap/lib/Badge.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface BadgeProps { color?: string; pill?: boolean; tag?: React.ReactType; @@ -8,5 +8,4 @@ interface Props { cssModule?: CSSModule; } -declare var Badge: React.StatelessComponent; -export default Badge; +export const Badge: React.StatelessComponent; diff --git a/types/reactstrap/lib/Breadcrumb.d.ts b/types/reactstrap/lib/Breadcrumb.d.ts index 54f581288c..26839e9140 100644 --- a/types/reactstrap/lib/Breadcrumb.d.ts +++ b/types/reactstrap/lib/Breadcrumb.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface BreadcrumbProps { tag?: string; className?: string; cssModule?: CSSModule; } -declare var Breadcrumb: React.StatelessComponent; -export default Breadcrumb; +export const Breadcrumb: React.StatelessComponent; diff --git a/types/reactstrap/lib/BreadcrumbItem.d.ts b/types/reactstrap/lib/BreadcrumbItem.d.ts index 0277305b21..d8deed883a 100644 --- a/types/reactstrap/lib/BreadcrumbItem.d.ts +++ b/types/reactstrap/lib/BreadcrumbItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface BreadcrumbItemProps { tag?: React.ReactType; active?: boolean; className?: string; @@ -10,6 +10,4 @@ interface Props { [others: string]: any; } -declare var BreadcrumbItem: React.StatelessComponent; -export default BreadcrumbItem; - +export const BreadcrumbItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index e6ec222c14..e75c6f0b1c 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface ButtonProps extends React.HTMLProps { outline?: boolean; active?: boolean; block?: boolean; @@ -17,5 +17,4 @@ interface Props extends React.HTMLProps { cssModule?: CSSModule; } -declare var Button: React.StatelessComponent; -export default Button; +export const Button: React.StatelessComponent; diff --git a/types/reactstrap/lib/ButtonDropdown.d.ts b/types/reactstrap/lib/ButtonDropdown.d.ts index 9ab54c7502..bb26a03685 100644 --- a/types/reactstrap/lib/ButtonDropdown.d.ts +++ b/types/reactstrap/lib/ButtonDropdown.d.ts @@ -1,12 +1,8 @@ -import { - UncontrolledProps as DropdownUncontrolledProps, - Props as DropdownProps -} from './Dropdown'; +import { UncontrolledDropdownProps, DropdownProps } from './Dropdown'; // tslint:disable-next-line -export interface UncontrolledProps extends DropdownUncontrolledProps { } +export interface UncontrolledButtonDropdownProps extends UncontrolledDropdownProps { } // tslint:disable-next-line -interface Props extends DropdownProps { } +export interface ButtonDropdownProps extends DropdownProps { } -declare var ButtonDropdown: React.StatelessComponent; -export default ButtonDropdown; \ No newline at end of file +export const ButtonDropdown: React.StatelessComponent; diff --git a/types/reactstrap/lib/ButtonGroup.d.ts b/types/reactstrap/lib/ButtonGroup.d.ts index d807ea33cf..033c3075f9 100644 --- a/types/reactstrap/lib/ButtonGroup.d.ts +++ b/types/reactstrap/lib/ButtonGroup.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ButtonGroupProps { tag?: React.ReactType; 'aria-label'?: string; className?: string; @@ -10,5 +10,4 @@ interface Props { vertical?: boolean; } -declare var ButtonGroup: React.StatelessComponent; -export default ButtonGroup; +export const ButtonGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/ButtonToolbar.d.ts b/types/reactstrap/lib/ButtonToolbar.d.ts index fea31dd5d5..3e16b331c3 100644 --- a/types/reactstrap/lib/ButtonToolbar.d.ts +++ b/types/reactstrap/lib/ButtonToolbar.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ButtonToolbarProps { tag?: React.ReactType; 'aria-label'?: string; className?: string; @@ -8,5 +8,4 @@ interface Props { role?: string; } -declare var ButtonToolbar: React.StatelessComponent; -export default ButtonToolbar; +export const ButtonToolbar: React.StatelessComponent; diff --git a/types/reactstrap/lib/Card.d.ts b/types/reactstrap/lib/Card.d.ts index 0dbde7f879..f6d0d5e265 100644 --- a/types/reactstrap/lib/Card.d.ts +++ b/types/reactstrap/lib/Card.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardProps { tag?: React.ReactType; inverse?: boolean; color?: string; @@ -11,6 +11,4 @@ interface Props { style?: React.CSSProperties; } -declare var Card: React.StatelessComponent; -export default Card; - +export const Card: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardBlock.d.ts b/types/reactstrap/lib/CardBlock.d.ts index 0aa31a63a7..905884b786 100644 --- a/types/reactstrap/lib/CardBlock.d.ts +++ b/types/reactstrap/lib/CardBlock.d.ts @@ -1,11 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardBlockProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardBlock: React.StatelessComponent; -export default CardBlock; - +export const CardBlock: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardBody.d.ts b/types/reactstrap/lib/CardBody.d.ts index 2b94e52ea8..eeb9c8fe8d 100644 --- a/types/reactstrap/lib/CardBody.d.ts +++ b/types/reactstrap/lib/CardBody.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardBodyProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardBody: React.StatelessComponent; -export default CardBody; +export const CardBody: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardColumns.d.ts b/types/reactstrap/lib/CardColumns.d.ts index 0cc1a80a1a..e1d00fa389 100644 --- a/types/reactstrap/lib/CardColumns.d.ts +++ b/types/reactstrap/lib/CardColumns.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardColumnsProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardColumns: React.StatelessComponent; -export default CardColumns; +export const CardColumns: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardDeck.d.ts b/types/reactstrap/lib/CardDeck.d.ts index 1a5882aa54..15b3660f9d 100644 --- a/types/reactstrap/lib/CardDeck.d.ts +++ b/types/reactstrap/lib/CardDeck.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardDeckProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardDeck: React.StatelessComponent; -export default CardDeck; +export const CardDeck: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardFooter.d.ts b/types/reactstrap/lib/CardFooter.d.ts index 0956cb06c9..2b320c48b5 100644 --- a/types/reactstrap/lib/CardFooter.d.ts +++ b/types/reactstrap/lib/CardFooter.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardFooterProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardFooter: React.StatelessComponent; -export default CardFooter; +export const CardFooter: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardGroup.d.ts b/types/reactstrap/lib/CardGroup.d.ts index 5c0a0a1ab1..93fdd04bb0 100644 --- a/types/reactstrap/lib/CardGroup.d.ts +++ b/types/reactstrap/lib/CardGroup.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardGroupProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardGroup: React.StatelessComponent; -export default CardGroup; +export const CardGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardHeader.d.ts b/types/reactstrap/lib/CardHeader.d.ts index f063057c92..d9d942c3d8 100644 --- a/types/reactstrap/lib/CardHeader.d.ts +++ b/types/reactstrap/lib/CardHeader.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardHeaderProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardHeader: React.StatelessComponent; -export default CardHeader; +export const CardHeader: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardImg.d.ts b/types/reactstrap/lib/CardImg.d.ts index 1c3fee274b..dd479691b5 100644 --- a/types/reactstrap/lib/CardImg.d.ts +++ b/types/reactstrap/lib/CardImg.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardImgProps { tag?: React.ReactType; top?: boolean; bottom?: boolean; @@ -12,5 +12,4 @@ interface Props { alt?: string; } -declare var CardImg: React.StatelessComponent; -export default CardImg; +export const CardImg: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardImgOverlay.d.ts b/types/reactstrap/lib/CardImgOverlay.d.ts index 05519847b2..22333a55c2 100644 --- a/types/reactstrap/lib/CardImgOverlay.d.ts +++ b/types/reactstrap/lib/CardImgOverlay.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardImgOverlayProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardImgOverlay: React.StatelessComponent; -export default CardImgOverlay; +export const CardImgOverlay: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 3edf6b24f8..9afc204f96 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardLinkProps { tag?: React.ReactType; getRef?: string | ((instance: HTMLButtonElement) => any); className?: string; @@ -8,5 +8,4 @@ interface Props { href?: string; } -declare var CardLink: React.StatelessComponent; -export default CardLink; +export const CardLink: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardSubtitle.d.ts b/types/reactstrap/lib/CardSubtitle.d.ts index bfacd4e794..36e847367c 100644 --- a/types/reactstrap/lib/CardSubtitle.d.ts +++ b/types/reactstrap/lib/CardSubtitle.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardSubtitleProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardSubtitle: React.StatelessComponent; -export default CardSubtitle; +export const CardSubtitle: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardText.d.ts b/types/reactstrap/lib/CardText.d.ts index 13177fba67..297a561d50 100644 --- a/types/reactstrap/lib/CardText.d.ts +++ b/types/reactstrap/lib/CardText.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardTextProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardText: React.StatelessComponent; -export default CardText; +export const CardText: React.StatelessComponent; diff --git a/types/reactstrap/lib/CardTitle.d.ts b/types/reactstrap/lib/CardTitle.d.ts index 2843800a4e..52b9556945 100644 --- a/types/reactstrap/lib/CardTitle.d.ts +++ b/types/reactstrap/lib/CardTitle.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface CardTitleProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var CardTitle: React.StatelessComponent; -export default CardTitle; +export const CardTitle: React.StatelessComponent; diff --git a/types/reactstrap/lib/Col.d.ts b/types/reactstrap/lib/Col.d.ts index a2ea76d607..cf2fd098fa 100644 --- a/types/reactstrap/lib/Col.d.ts +++ b/types/reactstrap/lib/Col.d.ts @@ -9,7 +9,7 @@ export type ColumnProps offset?: string | number }; -interface Props extends React.HTMLProps { +export interface ColProps extends React.HTMLProps { xs?: ColumnProps; sm?: ColumnProps; md?: ColumnProps; @@ -20,5 +20,4 @@ interface Props extends React.HTMLProps { widths?: string[]; } -declare var Col: React.StatelessComponent; -export default Col; +export const Col: React.StatelessComponent; diff --git a/types/reactstrap/lib/Collapse.d.ts b/types/reactstrap/lib/Collapse.d.ts index 50160bbcf6..5647bf68b3 100644 --- a/types/reactstrap/lib/Collapse.d.ts +++ b/types/reactstrap/lib/Collapse.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface CollapseProps extends React.HTMLProps { isOpen?: boolean; classNames?: string; cssModule?: CSSModule; @@ -14,5 +14,4 @@ interface Props extends React.HTMLProps { onClosed?: () => void; } -declare var Collapse: React.StatelessComponent; -export default Collapse; +export const Collapse: React.StatelessComponent; diff --git a/types/reactstrap/lib/Container.d.ts b/types/reactstrap/lib/Container.d.ts index f49951ba26..08d702af4b 100644 --- a/types/reactstrap/lib/Container.d.ts +++ b/types/reactstrap/lib/Container.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface ContainerProps { tag?: React.ReactType; fluid?: boolean; className?: string; cssModule?: CSSModule; } -declare var Container: React.StatelessComponent; -export default Container; +export const Container: React.StatelessComponent; diff --git a/types/reactstrap/lib/Dropdown.d.ts b/types/reactstrap/lib/Dropdown.d.ts index 19d1500cbe..fce1de08b1 100644 --- a/types/reactstrap/lib/Dropdown.d.ts +++ b/types/reactstrap/lib/Dropdown.d.ts @@ -2,14 +2,14 @@ import { CSSModule } from '../index'; -export interface UncontrolledProps { +export interface UncontrolledDropdownProps { isOpen?: boolean; toggle?: () => void; className?: string; cssModule?: CSSModule; } -export interface Props extends UncontrolledProps { +export interface DropdownProps extends UncontrolledDropdownProps { disabled?: boolean; dropup?: boolean; group?: boolean; @@ -18,5 +18,4 @@ export interface Props extends UncontrolledProps { tether?: boolean | Tether.ITetherOptions; } -declare var Dropdown: React.StatelessComponent; -export default Dropdown; +export const Dropdown: React.StatelessComponent; diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index 6fae837041..fe9a33cf8e 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface DropdownItemProps { disabled?: boolean; divider?: boolean; tag?: React.ReactType; @@ -11,5 +11,4 @@ interface Props { href?: string; } -declare var DropdownItem: React.StatelessComponent; -export default DropdownItem; +export const DropdownItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/DropdownMenu.d.ts b/types/reactstrap/lib/DropdownMenu.d.ts index 7fae41b04b..e206ebd6d9 100644 --- a/types/reactstrap/lib/DropdownMenu.d.ts +++ b/types/reactstrap/lib/DropdownMenu.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface DropdownMenuProps { tag?: React.ReactType; right?: boolean; className?: string; cssModule?: CSSModule; } -declare var DropdownMenu: React.StatelessComponent; -export default DropdownMenu; +export const DropdownMenu: React.StatelessComponent; diff --git a/types/reactstrap/lib/DropdownToggle.d.ts b/types/reactstrap/lib/DropdownToggle.d.ts index 5ef49db71f..df1cb7f845 100644 --- a/types/reactstrap/lib/DropdownToggle.d.ts +++ b/types/reactstrap/lib/DropdownToggle.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface DropdownToggleProps { caret?: boolean; className?: string; cssModule?: CSSModule; @@ -15,5 +15,4 @@ interface Props { size?: string; } -declare var DropdownToggle: React.StatelessComponent; -export default DropdownToggle; +export const DropdownToggle: React.StatelessComponent; diff --git a/types/reactstrap/lib/Fade.d.ts b/types/reactstrap/lib/Fade.d.ts index 30862d2e17..2c13430af9 100644 --- a/types/reactstrap/lib/Fade.d.ts +++ b/types/reactstrap/lib/Fade.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface FadeProps { baseClass?: string; baseClassIn?: string; tag?: React.ReactType; @@ -16,5 +16,4 @@ interface Props { onEnter?: () => void; } -declare var Fade: React.StatelessComponent; -export default Fade; +export const Fade: React.StatelessComponent; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index dd06a2f855..4481bd8912 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface FormProps extends React.HTMLProps { inline?: boolean; tag?: React.ReactType; getRef?: string | ((instance: HTMLButtonElement) => any); @@ -8,5 +8,4 @@ interface Props extends React.HTMLProps { cssModule?: CSSModule; } -declare var Form: React.StatelessComponent; -export default Form; +export const Form: React.StatelessComponent; diff --git a/types/reactstrap/lib/FormFeedback.d.ts b/types/reactstrap/lib/FormFeedback.d.ts index 7fde21b062..ac6f0f5003 100644 --- a/types/reactstrap/lib/FormFeedback.d.ts +++ b/types/reactstrap/lib/FormFeedback.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface FormFeedbackProps { tag?: string; className?: string; cssModule?: CSSModule; } -declare var FormFeedback: React.StatelessComponent; -export default FormFeedback; +export const FormFeedback: React.StatelessComponent; diff --git a/types/reactstrap/lib/FormGroup.d.ts b/types/reactstrap/lib/FormGroup.d.ts index 6031ff2f75..65c0da639b 100644 --- a/types/reactstrap/lib/FormGroup.d.ts +++ b/types/reactstrap/lib/FormGroup.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface FormGroupProps extends React.HTMLProps { row?: boolean; check?: boolean; disabled?: boolean; @@ -10,5 +10,4 @@ interface Props extends React.HTMLProps { cssModule?: CSSModule; } -declare var FormGroup: React.StatelessComponent; -export default FormGroup; +export const FormGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/FormText.d.ts b/types/reactstrap/lib/FormText.d.ts index 3cfab3511e..c8af8f56c8 100644 --- a/types/reactstrap/lib/FormText.d.ts +++ b/types/reactstrap/lib/FormText.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface FormTextProps { inline?: boolean; tag?: React.ReactType; color?: string; @@ -8,5 +8,4 @@ interface Props { cssModule?: CSSModule; } -declare var FormText: React.StatelessComponent; -export default FormText; +export const FormText: React.StatelessComponent; diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index 541016ca02..0029367c90 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -33,7 +33,7 @@ interface Intermediate extends React.InputHTMLAttributes { size?: any; } -interface InputProps extends Intermediate { +export interface InputProps extends Intermediate { type?: InputType; size?: string; state?: string; @@ -48,5 +48,4 @@ interface InputProps extends Intermediate { // Maybe reactstrap will support an 'isStatic' alias in the future } -declare var Input: React.StatelessComponent; -export default Input; +export const Input: React.StatelessComponent; diff --git a/types/reactstrap/lib/InputGroup.d.ts b/types/reactstrap/lib/InputGroup.d.ts index 2de95edc94..abd7fcd381 100644 --- a/types/reactstrap/lib/InputGroup.d.ts +++ b/types/reactstrap/lib/InputGroup.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface InputGroupProps { tag?: React.ReactType; size?: string; className?: string; cssModule?: CSSModule; } -declare var InputGroup: React.StatelessComponent; -export default InputGroup; +export const InputGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/InputGroupAddon.d.ts b/types/reactstrap/lib/InputGroupAddon.d.ts index a98eb5d821..7ddbc3b4c1 100644 --- a/types/reactstrap/lib/InputGroupAddon.d.ts +++ b/types/reactstrap/lib/InputGroupAddon.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface InputGroupAddonProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var InputGroupAddon: React.StatelessComponent; -export default InputGroupAddon; +export const InputGroupAddon: React.StatelessComponent; diff --git a/types/reactstrap/lib/InputGroupButton.d.ts b/types/reactstrap/lib/InputGroupButton.d.ts index fa7cb1995a..90a93ff8ed 100644 --- a/types/reactstrap/lib/InputGroupButton.d.ts +++ b/types/reactstrap/lib/InputGroupButton.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface InputGroupButtonProps { tag?: React.ReactType; groupClassName?: string; groupAttributes?: any; @@ -9,5 +9,4 @@ interface Props { color?: string; } -declare var InputGroupButton: React.StatelessComponent; -export default InputGroupButton; +export const InputGroupButton: React.StatelessComponent; diff --git a/types/reactstrap/lib/Jumbotron.d.ts b/types/reactstrap/lib/Jumbotron.d.ts index cc1f65c956..4ade1eabaa 100644 --- a/types/reactstrap/lib/Jumbotron.d.ts +++ b/types/reactstrap/lib/Jumbotron.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface JumbotronProps { tag?: React.ReactType; fluid?: boolean; className?: string; cssModule?: CSSModule; } -declare var Jumbotron: React.StatelessComponent; -export default Jumbotron; +export const Jumbotron: React.StatelessComponent; diff --git a/types/reactstrap/lib/Label.d.ts b/types/reactstrap/lib/Label.d.ts index eb496d90a3..3688aaf233 100644 --- a/types/reactstrap/lib/Label.d.ts +++ b/types/reactstrap/lib/Label.d.ts @@ -5,7 +5,7 @@ interface Intermediate extends React.LabelHTMLAttributes { size?: any; } -interface Props extends Intermediate { +export interface LabelProps extends Intermediate { hidden?: boolean; check?: boolean; inline?: boolean; @@ -22,5 +22,4 @@ interface Props extends Intermediate { xl?: ColumnProps; } -declare var Label: React.StatelessComponent; -export default Label; +export const Label: React.StatelessComponent; diff --git a/types/reactstrap/lib/ListGroup.d.ts b/types/reactstrap/lib/ListGroup.d.ts index 861c7a1d06..bef63da796 100644 --- a/types/reactstrap/lib/ListGroup.d.ts +++ b/types/reactstrap/lib/ListGroup.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface ListGroupProps { tag?: React.ReactType; flush?: boolean; className?: string; cssModule?: CSSModule; } -declare var ListGroup: React.StatelessComponent; -export default ListGroup; +export const ListGroup: React.StatelessComponent; diff --git a/types/reactstrap/lib/ListGroupItem.d.ts b/types/reactstrap/lib/ListGroupItem.d.ts index b2241998dc..44a70b6ec4 100644 --- a/types/reactstrap/lib/ListGroupItem.d.ts +++ b/types/reactstrap/lib/ListGroupItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ListGroupItemProps { tag?: React.ReactType; active?: boolean; disabled?: boolean; @@ -9,9 +9,8 @@ interface Props { className?: string; cssModule?: CSSModule; href?: string; - + onClick?: React.MouseEventHandler; } -declare var ListGroupItem: React.StatelessComponent; -export default ListGroupItem; +export const ListGroupItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/ListGroupItemHeading.d.ts b/types/reactstrap/lib/ListGroupItemHeading.d.ts index 869a6b2708..f44317f541 100644 --- a/types/reactstrap/lib/ListGroupItemHeading.d.ts +++ b/types/reactstrap/lib/ListGroupItemHeading.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface ListGroupItemHeadingProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var ListGroupItemHeading: React.StatelessComponent; -export default ListGroupItemHeading; +export const ListGroupItemHeading: React.StatelessComponent; diff --git a/types/reactstrap/lib/ListGroupItemText.d.ts b/types/reactstrap/lib/ListGroupItemText.d.ts index df263f30d8..a19803e4fe 100644 --- a/types/reactstrap/lib/ListGroupItemText.d.ts +++ b/types/reactstrap/lib/ListGroupItemText.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface ListGroupItemTextProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var ListGroupItemText: React.StatelessComponent; -export default ListGroupItemText; +export const ListGroupItemText: React.StatelessComponent; diff --git a/types/reactstrap/lib/Media.d.ts b/types/reactstrap/lib/Media.d.ts index c5408d85d7..9276c0708f 100644 --- a/types/reactstrap/lib/Media.d.ts +++ b/types/reactstrap/lib/Media.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface MediaProps { body?: boolean; bottom?: boolean; className?: string; @@ -17,5 +17,4 @@ interface Props { alt?: string; } -declare var Media: React.StatelessComponent; -export default Media; +export const Media: React.StatelessComponent; diff --git a/types/reactstrap/lib/Modal.d.ts b/types/reactstrap/lib/Modal.d.ts index 1e239fbe12..eb7d2a0f15 100644 --- a/types/reactstrap/lib/Modal.d.ts +++ b/types/reactstrap/lib/Modal.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ModalProps { isOpen?: boolean; autoFocus?: boolean; size?: string; @@ -19,5 +19,4 @@ interface Props { fade?: boolean; } -declare var Modal: React.StatelessComponent; -export default Modal; +export const Modal: React.StatelessComponent; diff --git a/types/reactstrap/lib/ModalBody.d.ts b/types/reactstrap/lib/ModalBody.d.ts index 98933b2fc2..1238f7d54a 100644 --- a/types/reactstrap/lib/ModalBody.d.ts +++ b/types/reactstrap/lib/ModalBody.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface ModalBodyProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var ModalBody: React.StatelessComponent; -export default ModalBody; +export const ModalBody: React.StatelessComponent; diff --git a/types/reactstrap/lib/ModalFooter.d.ts b/types/reactstrap/lib/ModalFooter.d.ts index 84b3da7ec8..d7cafe275b 100644 --- a/types/reactstrap/lib/ModalFooter.d.ts +++ b/types/reactstrap/lib/ModalFooter.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface ModalFooterProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var ModalFooter: React.StatelessComponent; -export default ModalFooter; +export const ModalFooter: React.StatelessComponent; diff --git a/types/reactstrap/lib/ModalHeader.d.ts b/types/reactstrap/lib/ModalHeader.d.ts index 494c9685a3..5792fea0d1 100644 --- a/types/reactstrap/lib/ModalHeader.d.ts +++ b/types/reactstrap/lib/ModalHeader.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ModalHeaderProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; @@ -8,5 +8,4 @@ interface Props { toggle?: () => void; } -declare var ModalHeader: React.StatelessComponent; -export default ModalHeader; +export const ModalHeader: React.StatelessComponent; diff --git a/types/reactstrap/lib/Nav.d.ts b/types/reactstrap/lib/Nav.d.ts index c646e94304..e42556fadd 100644 --- a/types/reactstrap/lib/Nav.d.ts +++ b/types/reactstrap/lib/Nav.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface NavProps extends React.HTMLProps { inline?: boolean; disabled?: boolean; tabs?: boolean; @@ -13,5 +13,4 @@ interface Props extends React.HTMLProps { vertical?: boolean; } -declare var Nav: React.StatelessComponent; -export default Nav; +export const Nav: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavDropdown.d.ts b/types/reactstrap/lib/NavDropdown.d.ts index 6b480d495a..dfa15afa17 100644 --- a/types/reactstrap/lib/NavDropdown.d.ts +++ b/types/reactstrap/lib/NavDropdown.d.ts @@ -1,12 +1,8 @@ -import { - UncontrolledProps as DropdownUncontrolledProps, - Props as DropdownProps -} from './Dropdown'; +import { UncontrolledDropdownProps, DropdownProps } from './Dropdown'; // tslint:disable-next-line -export interface UncontrolledProps extends DropdownUncontrolledProps { } +export interface UncontrolledNavDropdownProps extends UncontrolledDropdownProps { } // tslint:disable-next-line -interface Props extends DropdownProps { } +export interface NavDropdownProps extends DropdownProps { } -declare var NavDropdown: React.StatelessComponent; -export default NavDropdown; \ No newline at end of file +export const NavDropdown: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavItem.d.ts b/types/reactstrap/lib/NavItem.d.ts index db19f92c56..8e6e7631d2 100644 --- a/types/reactstrap/lib/NavItem.d.ts +++ b/types/reactstrap/lib/NavItem.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface NavItemProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var NavItem: React.StatelessComponent; -export default NavItem; +export const NavItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 2871fad72e..13f5710551 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface NavLinkProps extends React.HTMLProps { tag?: React.ReactType; getRef?: string | ((instance: HTMLButtonElement) => any); disabled?: boolean; @@ -11,5 +11,4 @@ interface Props extends React.HTMLProps { href?: string; } -declare var NavLink: React.StatelessComponent; -export default NavLink; +export const NavLink: React.StatelessComponent; diff --git a/types/reactstrap/lib/Navbar.d.ts b/types/reactstrap/lib/Navbar.d.ts index 58f9235140..76616a7be2 100644 --- a/types/reactstrap/lib/Navbar.d.ts +++ b/types/reactstrap/lib/Navbar.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface NavbarProps { light?: boolean; dark?: boolean; inverse?: boolean; @@ -16,5 +16,4 @@ interface Props { expand?: boolean | string; } -declare var Navbar: React.StatelessComponent; -export default Navbar; +export const Navbar: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavbarBrand.d.ts b/types/reactstrap/lib/NavbarBrand.d.ts index 3748a2903f..0aa80597b9 100644 --- a/types/reactstrap/lib/NavbarBrand.d.ts +++ b/types/reactstrap/lib/NavbarBrand.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface NavbarBrandProps extends React.HTMLProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var NavbarBrand: React.StatelessComponent; -export default NavbarBrand; +export const NavbarBrand: React.StatelessComponent; diff --git a/types/reactstrap/lib/NavbarToggler.d.ts b/types/reactstrap/lib/NavbarToggler.d.ts index 282eeaa672..5dd2df7057 100644 --- a/types/reactstrap/lib/NavbarToggler.d.ts +++ b/types/reactstrap/lib/NavbarToggler.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface NavbarTogglerProps extends React.HTMLProps { tag?: React.ReactType; type?: string; className?: string; @@ -9,5 +9,4 @@ interface Props extends React.HTMLProps { left?: boolean; } -declare var NavbarToggler: React.StatelessComponent; -export default NavbarToggler; +export const NavbarToggler: React.StatelessComponent; diff --git a/types/reactstrap/lib/Pagination.d.ts b/types/reactstrap/lib/Pagination.d.ts index a34401be35..3b19364c30 100644 --- a/types/reactstrap/lib/Pagination.d.ts +++ b/types/reactstrap/lib/Pagination.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface PaginationProps { className?: string; cssModule?: CSSModule; size?: string; } -declare var Pagination: React.StatelessComponent; -export default Pagination; +export const Pagination: React.StatelessComponent; diff --git a/types/reactstrap/lib/PaginationItem.d.ts b/types/reactstrap/lib/PaginationItem.d.ts index 183a7e9d84..3ed0400dcd 100644 --- a/types/reactstrap/lib/PaginationItem.d.ts +++ b/types/reactstrap/lib/PaginationItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface PaginationItemProps { className?: string; cssModule?: CSSModule; active?: boolean; @@ -8,5 +8,4 @@ interface Props { tag?: React.ReactType; } -declare var PaginationItem: React.StatelessComponent; -export default PaginationItem; +export const PaginationItem: React.StatelessComponent; diff --git a/types/reactstrap/lib/PaginationLink.d.ts b/types/reactstrap/lib/PaginationLink.d.ts index 16e194578d..5c2a1d5711 100644 --- a/types/reactstrap/lib/PaginationLink.d.ts +++ b/types/reactstrap/lib/PaginationLink.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps { +export interface PaginationLinkProps extends React.HTMLProps { 'aria-label'?: string; className?: string; cssModule?: CSSModule; @@ -9,5 +9,4 @@ interface Props extends React.HTMLProps { tag?: React.ReactType; } -declare var PaginationLink: React.StatelessComponent; -export default PaginationLink; +export const PaginationLink: React.StatelessComponent; diff --git a/types/reactstrap/lib/Popover.d.ts b/types/reactstrap/lib/Popover.d.ts index b779a33ede..69fe27cb88 100644 --- a/types/reactstrap/lib/Popover.d.ts +++ b/types/reactstrap/lib/Popover.d.ts @@ -20,7 +20,7 @@ type Placement | 'left middle' | 'left bottom'; -interface Props { +export interface PopoverProps { placement?: Placement; target: string; isOpen?: boolean; @@ -30,5 +30,4 @@ interface Props { toggle?: () => void; } -declare var Popover: React.StatelessComponent; -export default Popover; +export const Popover: React.StatelessComponent; diff --git a/types/reactstrap/lib/PopoverContent.d.ts b/types/reactstrap/lib/PopoverContent.d.ts index cac45d14cb..a062d4d2c9 100644 --- a/types/reactstrap/lib/PopoverContent.d.ts +++ b/types/reactstrap/lib/PopoverContent.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface PopoverContentProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var PopoverContent: React.StatelessComponent; -export default PopoverContent; +export const PopoverContent: React.StatelessComponent; diff --git a/types/reactstrap/lib/PopoverTitle.d.ts b/types/reactstrap/lib/PopoverTitle.d.ts index 796de02658..e21bdd1729 100644 --- a/types/reactstrap/lib/PopoverTitle.d.ts +++ b/types/reactstrap/lib/PopoverTitle.d.ts @@ -1,10 +1,9 @@ import { CSSModule } from '../index'; -interface Props { +export interface PopoverTitleProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; } -declare var PopoverTitle: React.StatelessComponent; -export default PopoverTitle; +export const PopoverTitle: React.StatelessComponent; diff --git a/types/reactstrap/lib/Progress.d.ts b/types/reactstrap/lib/Progress.d.ts index 09c4304373..5f67befa37 100644 --- a/types/reactstrap/lib/Progress.d.ts +++ b/types/reactstrap/lib/Progress.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface ProgressProps { bar?: boolean; multi?: boolean; tag?: string; @@ -14,5 +14,4 @@ interface Props { barClassName?: string; } -declare var Progress: React.StatelessComponent; -export default Progress; +export const Progress: React.StatelessComponent; diff --git a/types/reactstrap/lib/Row.d.ts b/types/reactstrap/lib/Row.d.ts index 1ffbb9f7e6..5a57601a0a 100644 --- a/types/reactstrap/lib/Row.d.ts +++ b/types/reactstrap/lib/Row.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props extends React.HTMLProps< HTMLElement> { +export interface RowProps extends React.HTMLProps< HTMLElement> { className?: string; cssModule?: CSSModule; tag?: React.ReactType; noGutters?: boolean; } -declare var Row: React.StatelessComponent; -export default Row; +export const Row: React.StatelessComponent; diff --git a/types/reactstrap/lib/TabContent.d.ts b/types/reactstrap/lib/TabContent.d.ts index af6feec078..5a8654ded9 100644 --- a/types/reactstrap/lib/TabContent.d.ts +++ b/types/reactstrap/lib/TabContent.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface TabContentProps { tag?: React.ReactType; activeTab?: number | string; className?: string; cssModule?: CSSModule; } -declare var TabContent: React.StatelessComponent; -export default TabContent; +export const TabContent: React.StatelessComponent; diff --git a/types/reactstrap/lib/TabPane.d.ts b/types/reactstrap/lib/TabPane.d.ts index 9eead420be..c1c7c1f470 100644 --- a/types/reactstrap/lib/TabPane.d.ts +++ b/types/reactstrap/lib/TabPane.d.ts @@ -1,11 +1,10 @@ import { CSSModule } from '../index'; -interface Props { +export interface TabPaneProps { tag?: React.ReactType; className?: string; cssModule?: CSSModule; tabId?: number | string; } -declare var TabPane: React.StatelessComponent; -export default TabPane; +export const TabPane: React.StatelessComponent; diff --git a/types/reactstrap/lib/Table.d.ts b/types/reactstrap/lib/Table.d.ts index ec8bfc43fd..f65af70e60 100644 --- a/types/reactstrap/lib/Table.d.ts +++ b/types/reactstrap/lib/Table.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface TableProps { className?: string; cssModule?: CSSModule; size?: string; @@ -14,5 +14,4 @@ interface Props { responsiveTag?: React.ReactType; } -declare var Table: React.StatelessComponent; -export default Table; +export const Table: React.StatelessComponent; diff --git a/types/reactstrap/lib/Tag.d.ts b/types/reactstrap/lib/Tag.d.ts index 7dce8876f2..bbc94d2120 100644 --- a/types/reactstrap/lib/Tag.d.ts +++ b/types/reactstrap/lib/Tag.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -interface Props { +export interface TagProps { color?: string; pill?: boolean; tag?: React.ReactType; @@ -8,5 +8,4 @@ interface Props { cssModule?: CSSModule; } -declare var Tag: React.StatelessComponent; -export default Tag; +export const Tag: React.StatelessComponent; diff --git a/types/reactstrap/lib/TetherContent.d.ts b/types/reactstrap/lib/TetherContent.d.ts index cbc22373e3..2ebe419ed5 100644 --- a/types/reactstrap/lib/TetherContent.d.ts +++ b/types/reactstrap/lib/TetherContent.d.ts @@ -2,7 +2,7 @@ import { CSSModule } from '../index'; -interface Props { +export interface TetherContentProps { className?: string; cssModule?: CSSModule; arrow?: string; @@ -14,5 +14,4 @@ interface Props { style?: React.CSSProperties; } -declare var TetherContent: React.StatelessComponent; -export default TetherContent; +export const TetherContent: React.StatelessComponent; diff --git a/types/reactstrap/lib/Tooltip.d.ts b/types/reactstrap/lib/Tooltip.d.ts index 9dba615084..9afa72f233 100644 --- a/types/reactstrap/lib/Tooltip.d.ts +++ b/types/reactstrap/lib/Tooltip.d.ts @@ -20,7 +20,7 @@ type Placement | 'left middle' | 'left bottom'; -export interface UncontrolledProps { +export interface UncontrolledTooltipProps { placement?: Placement; target: string; disabled?: boolean; @@ -32,12 +32,9 @@ export interface UncontrolledProps { delay?: number | { show: number, hide: number }; } -interface Props extends UncontrolledProps { +export interface TooltipProps extends UncontrolledTooltipProps { toggle?: () => void; isOpen?: boolean; } - - -declare var Tooltip: React.StatelessComponent; -export default Tooltip; +export const Tooltip: React.StatelessComponent; diff --git a/types/reactstrap/lib/Uncontrolled.d.ts b/types/reactstrap/lib/Uncontrolled.d.ts index 151ee012d3..b3b292dd6b 100644 --- a/types/reactstrap/lib/Uncontrolled.d.ts +++ b/types/reactstrap/lib/Uncontrolled.d.ts @@ -1,29 +1,17 @@ -import { - UncontrolledProps as AlertUncontrolledProps -} from './Alert'; -import { - UncontrolledProps as ButtonDropdownUncontrolledProps -} from './ButtonDropdown'; -import { - UncontrolledProps as DropdownUncontrolledProps -} from './Dropdown'; -import { - UncontrolledProps as NavDropdownUncontrolledProps -} from './NavDropdown'; -import { - UncontrolledProps as TooltipUncontrolledProps -} from './Tooltip'; +import { UncontrolledAlertProps } from './Alert'; +import { UncontrolledButtonDropdownProps } from './ButtonDropdown'; +import { UncontrolledDropdownProps } from './Dropdown'; +import { UncontrolledNavDropdownProps } from './NavDropdown'; +import { UncontrolledTooltipProps } from './Tooltip'; -declare var UncontrolledAlert: React.StatelessComponent; -declare var UncontrolledButtonDropdown: React.StatelessComponent; -declare var UncontrolledDropdown: React.StatelessComponent; -declare var UncontrolledNavDropdown: React.StatelessComponent; -declare var UncontrolledTooltip: React.StatelessComponent; +export const UncontrolledAlert: React.StatelessComponent; +export const UncontrolledButtonDropdown: React.StatelessComponent; +export const UncontrolledDropdown: React.StatelessComponent; +export const UncontrolledNavDropdown: React.StatelessComponent; +export const UncontrolledTooltip: React.StatelessComponent; -export { - UncontrolledAlert, - UncontrolledButtonDropdown, - UncontrolledDropdown, - UncontrolledNavDropdown, - UncontrolledTooltip -} \ No newline at end of file +export { UncontrolledAlertProps } from './Alert'; +export { UncontrolledButtonDropdownProps } from './ButtonDropdown'; +export { UncontrolledDropdownProps } from './Dropdown'; +export { UncontrolledNavDropdownProps } from './NavDropdown'; +export { UncontrolledTooltipProps } from './Tooltip'; From b0b139c633d6b1fe8fa973b9ee8df20c0477a3a0 Mon Sep 17 00:00:00 2001 From: FaithForHumans Date: Fri, 10 Nov 2017 19:22:40 -0600 Subject: [PATCH 009/322] Adding export defaults back. --- types/reactstrap/lib/Alert.d.ts | 1 + types/reactstrap/lib/Badge.d.ts | 1 + types/reactstrap/lib/Breadcrumb.d.ts | 1 + types/reactstrap/lib/BreadcrumbItem.d.ts | 1 + types/reactstrap/lib/Button.d.ts | 1 + types/reactstrap/lib/ButtonDropdown.d.ts | 1 + types/reactstrap/lib/ButtonGroup.d.ts | 1 + types/reactstrap/lib/ButtonToolbar.d.ts | 1 + types/reactstrap/lib/Card.d.ts | 1 + types/reactstrap/lib/CardBlock.d.ts | 1 + types/reactstrap/lib/CardBody.d.ts | 1 + types/reactstrap/lib/CardColumns.d.ts | 1 + types/reactstrap/lib/CardDeck.d.ts | 1 + types/reactstrap/lib/CardFooter.d.ts | 1 + types/reactstrap/lib/CardGroup.d.ts | 1 + types/reactstrap/lib/CardHeader.d.ts | 1 + types/reactstrap/lib/CardImg.d.ts | 1 + types/reactstrap/lib/CardImgOverlay.d.ts | 1 + types/reactstrap/lib/CardLink.d.ts | 1 + types/reactstrap/lib/CardSubtitle.d.ts | 1 + types/reactstrap/lib/CardText.d.ts | 1 + types/reactstrap/lib/CardTitle.d.ts | 1 + types/reactstrap/lib/Col.d.ts | 1 + types/reactstrap/lib/Collapse.d.ts | 1 + types/reactstrap/lib/Container.d.ts | 1 + types/reactstrap/lib/Dropdown.d.ts | 1 + types/reactstrap/lib/DropdownItem.d.ts | 1 + types/reactstrap/lib/DropdownMenu.d.ts | 1 + types/reactstrap/lib/DropdownToggle.d.ts | 1 + types/reactstrap/lib/Fade.d.ts | 1 + types/reactstrap/lib/Form.d.ts | 1 + types/reactstrap/lib/FormFeedback.d.ts | 1 + types/reactstrap/lib/FormGroup.d.ts | 1 + types/reactstrap/lib/FormText.d.ts | 1 + types/reactstrap/lib/Input.d.ts | 1 + types/reactstrap/lib/InputGroup.d.ts | 1 + types/reactstrap/lib/InputGroupAddon.d.ts | 1 + types/reactstrap/lib/InputGroupButton.d.ts | 1 + types/reactstrap/lib/Jumbotron.d.ts | 1 + types/reactstrap/lib/Label.d.ts | 1 + types/reactstrap/lib/ListGroup.d.ts | 1 + types/reactstrap/lib/ListGroupItem.d.ts | 1 + types/reactstrap/lib/ListGroupItemHeading.d.ts | 1 + types/reactstrap/lib/ListGroupItemText.d.ts | 1 + types/reactstrap/lib/Media.d.ts | 1 + types/reactstrap/lib/Modal.d.ts | 1 + types/reactstrap/lib/ModalBody.d.ts | 1 + types/reactstrap/lib/ModalFooter.d.ts | 1 + types/reactstrap/lib/ModalHeader.d.ts | 1 + types/reactstrap/lib/Nav.d.ts | 1 + types/reactstrap/lib/NavDropdown.d.ts | 1 + types/reactstrap/lib/NavItem.d.ts | 1 + types/reactstrap/lib/NavLink.d.ts | 1 + types/reactstrap/lib/Navbar.d.ts | 1 + types/reactstrap/lib/NavbarBrand.d.ts | 1 + types/reactstrap/lib/NavbarToggler.d.ts | 1 + types/reactstrap/lib/Pagination.d.ts | 1 + types/reactstrap/lib/PaginationItem.d.ts | 1 + types/reactstrap/lib/PaginationLink.d.ts | 1 + types/reactstrap/lib/Popover.d.ts | 1 + types/reactstrap/lib/PopoverContent.d.ts | 1 + types/reactstrap/lib/PopoverTitle.d.ts | 1 + types/reactstrap/lib/Progress.d.ts | 1 + types/reactstrap/lib/Row.d.ts | 1 + types/reactstrap/lib/TabContent.d.ts | 1 + types/reactstrap/lib/TabPane.d.ts | 1 + types/reactstrap/lib/Table.d.ts | 1 + types/reactstrap/lib/Tag.d.ts | 1 + types/reactstrap/lib/TetherContent.d.ts | 1 + types/reactstrap/lib/Tooltip.d.ts | 1 + 70 files changed, 70 insertions(+) diff --git a/types/reactstrap/lib/Alert.d.ts b/types/reactstrap/lib/Alert.d.ts index 1b4f6eb884..6ce7c0fe0e 100644 --- a/types/reactstrap/lib/Alert.d.ts +++ b/types/reactstrap/lib/Alert.d.ts @@ -16,3 +16,4 @@ export interface AlertProps extends UncontrolledAlertProps { } export const Alert: React.StatelessComponent; +export default Alert; diff --git a/types/reactstrap/lib/Badge.d.ts b/types/reactstrap/lib/Badge.d.ts index 4c21dcac42..328e3abf36 100644 --- a/types/reactstrap/lib/Badge.d.ts +++ b/types/reactstrap/lib/Badge.d.ts @@ -9,3 +9,4 @@ export interface BadgeProps { } export const Badge: React.StatelessComponent; +export default Badge; diff --git a/types/reactstrap/lib/Breadcrumb.d.ts b/types/reactstrap/lib/Breadcrumb.d.ts index 26839e9140..62ccf477a9 100644 --- a/types/reactstrap/lib/Breadcrumb.d.ts +++ b/types/reactstrap/lib/Breadcrumb.d.ts @@ -7,3 +7,4 @@ export interface BreadcrumbProps { } export const Breadcrumb: React.StatelessComponent; +export default Breadcrumb; diff --git a/types/reactstrap/lib/BreadcrumbItem.d.ts b/types/reactstrap/lib/BreadcrumbItem.d.ts index d8deed883a..81d18f0f76 100644 --- a/types/reactstrap/lib/BreadcrumbItem.d.ts +++ b/types/reactstrap/lib/BreadcrumbItem.d.ts @@ -11,3 +11,4 @@ export interface BreadcrumbItemProps { } export const BreadcrumbItem: React.StatelessComponent; +export default BreadcrumbItem; diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index cf5348d659..f4a8b4e4cd 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -18,3 +18,4 @@ export interface ButtonProps extends React.HTMLProps { } export const Button: React.StatelessComponent; +export default Button; diff --git a/types/reactstrap/lib/ButtonDropdown.d.ts b/types/reactstrap/lib/ButtonDropdown.d.ts index bb26a03685..284818f88f 100644 --- a/types/reactstrap/lib/ButtonDropdown.d.ts +++ b/types/reactstrap/lib/ButtonDropdown.d.ts @@ -6,3 +6,4 @@ export interface UncontrolledButtonDropdownProps extends UncontrolledDropdownPro export interface ButtonDropdownProps extends DropdownProps { } export const ButtonDropdown: React.StatelessComponent; +export default ButtonDropdown; diff --git a/types/reactstrap/lib/ButtonGroup.d.ts b/types/reactstrap/lib/ButtonGroup.d.ts index 033c3075f9..cf51a29326 100644 --- a/types/reactstrap/lib/ButtonGroup.d.ts +++ b/types/reactstrap/lib/ButtonGroup.d.ts @@ -11,3 +11,4 @@ export interface ButtonGroupProps { } export const ButtonGroup: React.StatelessComponent; +export default ButtonGroup; diff --git a/types/reactstrap/lib/ButtonToolbar.d.ts b/types/reactstrap/lib/ButtonToolbar.d.ts index 3e16b331c3..e57b84337a 100644 --- a/types/reactstrap/lib/ButtonToolbar.d.ts +++ b/types/reactstrap/lib/ButtonToolbar.d.ts @@ -9,3 +9,4 @@ export interface ButtonToolbarProps { } export const ButtonToolbar: React.StatelessComponent; +export default ButtonToolbar; diff --git a/types/reactstrap/lib/Card.d.ts b/types/reactstrap/lib/Card.d.ts index f6d0d5e265..8398d3b631 100644 --- a/types/reactstrap/lib/Card.d.ts +++ b/types/reactstrap/lib/Card.d.ts @@ -12,3 +12,4 @@ export interface CardProps { } export const Card: React.StatelessComponent; +export default Card; diff --git a/types/reactstrap/lib/CardBlock.d.ts b/types/reactstrap/lib/CardBlock.d.ts index 905884b786..a4eae1cf6e 100644 --- a/types/reactstrap/lib/CardBlock.d.ts +++ b/types/reactstrap/lib/CardBlock.d.ts @@ -7,3 +7,4 @@ export interface CardBlockProps { } export const CardBlock: React.StatelessComponent; +export default CardBlock; diff --git a/types/reactstrap/lib/CardBody.d.ts b/types/reactstrap/lib/CardBody.d.ts index eeb9c8fe8d..9ff4ba1f7e 100644 --- a/types/reactstrap/lib/CardBody.d.ts +++ b/types/reactstrap/lib/CardBody.d.ts @@ -7,3 +7,4 @@ export interface CardBodyProps { } export const CardBody: React.StatelessComponent; +export default CardBody; diff --git a/types/reactstrap/lib/CardColumns.d.ts b/types/reactstrap/lib/CardColumns.d.ts index e1d00fa389..4853240671 100644 --- a/types/reactstrap/lib/CardColumns.d.ts +++ b/types/reactstrap/lib/CardColumns.d.ts @@ -7,3 +7,4 @@ export interface CardColumnsProps { } export const CardColumns: React.StatelessComponent; +export default CardColumns; diff --git a/types/reactstrap/lib/CardDeck.d.ts b/types/reactstrap/lib/CardDeck.d.ts index 15b3660f9d..963d617383 100644 --- a/types/reactstrap/lib/CardDeck.d.ts +++ b/types/reactstrap/lib/CardDeck.d.ts @@ -7,3 +7,4 @@ export interface CardDeckProps { } export const CardDeck: React.StatelessComponent; +export default CardDeck; diff --git a/types/reactstrap/lib/CardFooter.d.ts b/types/reactstrap/lib/CardFooter.d.ts index 2b320c48b5..415406a14c 100644 --- a/types/reactstrap/lib/CardFooter.d.ts +++ b/types/reactstrap/lib/CardFooter.d.ts @@ -7,3 +7,4 @@ export interface CardFooterProps { } export const CardFooter: React.StatelessComponent; +export default CardFooter; diff --git a/types/reactstrap/lib/CardGroup.d.ts b/types/reactstrap/lib/CardGroup.d.ts index 93fdd04bb0..be69f617e7 100644 --- a/types/reactstrap/lib/CardGroup.d.ts +++ b/types/reactstrap/lib/CardGroup.d.ts @@ -7,3 +7,4 @@ export interface CardGroupProps { } export const CardGroup: React.StatelessComponent; +export default CardGroup; diff --git a/types/reactstrap/lib/CardHeader.d.ts b/types/reactstrap/lib/CardHeader.d.ts index d9d942c3d8..e9a468e2e4 100644 --- a/types/reactstrap/lib/CardHeader.d.ts +++ b/types/reactstrap/lib/CardHeader.d.ts @@ -7,3 +7,4 @@ export interface CardHeaderProps { } export const CardHeader: React.StatelessComponent; +export default CardHeader; diff --git a/types/reactstrap/lib/CardImg.d.ts b/types/reactstrap/lib/CardImg.d.ts index dd479691b5..76bd9a18f2 100644 --- a/types/reactstrap/lib/CardImg.d.ts +++ b/types/reactstrap/lib/CardImg.d.ts @@ -13,3 +13,4 @@ export interface CardImgProps { } export const CardImg: React.StatelessComponent; +export default CardImg; diff --git a/types/reactstrap/lib/CardImgOverlay.d.ts b/types/reactstrap/lib/CardImgOverlay.d.ts index 22333a55c2..0511d38e8b 100644 --- a/types/reactstrap/lib/CardImgOverlay.d.ts +++ b/types/reactstrap/lib/CardImgOverlay.d.ts @@ -7,3 +7,4 @@ export interface CardImgOverlayProps { } export const CardImgOverlay: React.StatelessComponent; +export default CardImgOverlay; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 7aa8492438..68ef38fa62 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -9,3 +9,4 @@ export interface CardLinkProps { } export const CardLink: React.StatelessComponent; +export default CardLink; diff --git a/types/reactstrap/lib/CardSubtitle.d.ts b/types/reactstrap/lib/CardSubtitle.d.ts index 36e847367c..5c2cbe574f 100644 --- a/types/reactstrap/lib/CardSubtitle.d.ts +++ b/types/reactstrap/lib/CardSubtitle.d.ts @@ -7,3 +7,4 @@ export interface CardSubtitleProps { } export const CardSubtitle: React.StatelessComponent; +export default CardSubtitle; diff --git a/types/reactstrap/lib/CardText.d.ts b/types/reactstrap/lib/CardText.d.ts index 297a561d50..1b411717f5 100644 --- a/types/reactstrap/lib/CardText.d.ts +++ b/types/reactstrap/lib/CardText.d.ts @@ -7,3 +7,4 @@ export interface CardTextProps { } export const CardText: React.StatelessComponent; +export default CardText; diff --git a/types/reactstrap/lib/CardTitle.d.ts b/types/reactstrap/lib/CardTitle.d.ts index 52b9556945..483a47adb7 100644 --- a/types/reactstrap/lib/CardTitle.d.ts +++ b/types/reactstrap/lib/CardTitle.d.ts @@ -7,3 +7,4 @@ export interface CardTitleProps { } export const CardTitle: React.StatelessComponent; +export default CardTitle; diff --git a/types/reactstrap/lib/Col.d.ts b/types/reactstrap/lib/Col.d.ts index cf2fd098fa..c1bc6a0cd9 100644 --- a/types/reactstrap/lib/Col.d.ts +++ b/types/reactstrap/lib/Col.d.ts @@ -21,3 +21,4 @@ export interface ColProps extends React.HTMLProps { } export const Col: React.StatelessComponent; +export default Col; diff --git a/types/reactstrap/lib/Collapse.d.ts b/types/reactstrap/lib/Collapse.d.ts index 5647bf68b3..d926fd677d 100644 --- a/types/reactstrap/lib/Collapse.d.ts +++ b/types/reactstrap/lib/Collapse.d.ts @@ -15,3 +15,4 @@ export interface CollapseProps extends React.HTMLProps { } export const Collapse: React.StatelessComponent; +export default Collapse; diff --git a/types/reactstrap/lib/Container.d.ts b/types/reactstrap/lib/Container.d.ts index 08d702af4b..63906b7bf3 100644 --- a/types/reactstrap/lib/Container.d.ts +++ b/types/reactstrap/lib/Container.d.ts @@ -8,3 +8,4 @@ export interface ContainerProps { } export const Container: React.StatelessComponent; +export default Container; diff --git a/types/reactstrap/lib/Dropdown.d.ts b/types/reactstrap/lib/Dropdown.d.ts index fce1de08b1..93a0ee1ce5 100644 --- a/types/reactstrap/lib/Dropdown.d.ts +++ b/types/reactstrap/lib/Dropdown.d.ts @@ -19,3 +19,4 @@ export interface DropdownProps extends UncontrolledDropdownProps { } export const Dropdown: React.StatelessComponent; +export default Dropdown; diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index d8d4718563..194d89bf0b 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -13,3 +13,4 @@ export interface DropdownItemProps { } export const DropdownItem: React.StatelessComponent; +export default DropdownItem; diff --git a/types/reactstrap/lib/DropdownMenu.d.ts b/types/reactstrap/lib/DropdownMenu.d.ts index e206ebd6d9..1bbf642a09 100644 --- a/types/reactstrap/lib/DropdownMenu.d.ts +++ b/types/reactstrap/lib/DropdownMenu.d.ts @@ -8,3 +8,4 @@ export interface DropdownMenuProps { } export const DropdownMenu: React.StatelessComponent; +export default DropdownMenu; diff --git a/types/reactstrap/lib/DropdownToggle.d.ts b/types/reactstrap/lib/DropdownToggle.d.ts index df1cb7f845..8f395b998d 100644 --- a/types/reactstrap/lib/DropdownToggle.d.ts +++ b/types/reactstrap/lib/DropdownToggle.d.ts @@ -16,3 +16,4 @@ export interface DropdownToggleProps { } export const DropdownToggle: React.StatelessComponent; +export default DropdownToggle; diff --git a/types/reactstrap/lib/Fade.d.ts b/types/reactstrap/lib/Fade.d.ts index 2c13430af9..ab77d7fb61 100644 --- a/types/reactstrap/lib/Fade.d.ts +++ b/types/reactstrap/lib/Fade.d.ts @@ -17,3 +17,4 @@ export interface FadeProps { } export const Fade: React.StatelessComponent; +export default Fade; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index 7e61d24429..507b617a12 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -9,3 +9,4 @@ export interface FormProps extends React.HTMLProps { } export const Form: React.StatelessComponent; +export default Form; diff --git a/types/reactstrap/lib/FormFeedback.d.ts b/types/reactstrap/lib/FormFeedback.d.ts index ac6f0f5003..e9479bc53d 100644 --- a/types/reactstrap/lib/FormFeedback.d.ts +++ b/types/reactstrap/lib/FormFeedback.d.ts @@ -7,3 +7,4 @@ export interface FormFeedbackProps { } export const FormFeedback: React.StatelessComponent; +export default FormFeedback; diff --git a/types/reactstrap/lib/FormGroup.d.ts b/types/reactstrap/lib/FormGroup.d.ts index 65c0da639b..c3e4d384db 100644 --- a/types/reactstrap/lib/FormGroup.d.ts +++ b/types/reactstrap/lib/FormGroup.d.ts @@ -11,3 +11,4 @@ export interface FormGroupProps extends React.HTMLProps { } export const FormGroup: React.StatelessComponent; +export default FormGroup; diff --git a/types/reactstrap/lib/FormText.d.ts b/types/reactstrap/lib/FormText.d.ts index c8af8f56c8..ca4e1858fe 100644 --- a/types/reactstrap/lib/FormText.d.ts +++ b/types/reactstrap/lib/FormText.d.ts @@ -9,3 +9,4 @@ export interface FormTextProps { } export const FormText: React.StatelessComponent; +export default FormText; diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index d332718152..cc7377ca1f 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -49,3 +49,4 @@ export interface InputProps extends Intermediate { } export const Input: React.StatelessComponent; +export default Input; diff --git a/types/reactstrap/lib/InputGroup.d.ts b/types/reactstrap/lib/InputGroup.d.ts index abd7fcd381..9a6ac719bb 100644 --- a/types/reactstrap/lib/InputGroup.d.ts +++ b/types/reactstrap/lib/InputGroup.d.ts @@ -8,3 +8,4 @@ export interface InputGroupProps { } export const InputGroup: React.StatelessComponent; +export default InputGroup; diff --git a/types/reactstrap/lib/InputGroupAddon.d.ts b/types/reactstrap/lib/InputGroupAddon.d.ts index 7ddbc3b4c1..63ac88c455 100644 --- a/types/reactstrap/lib/InputGroupAddon.d.ts +++ b/types/reactstrap/lib/InputGroupAddon.d.ts @@ -7,3 +7,4 @@ export interface InputGroupAddonProps { } export const InputGroupAddon: React.StatelessComponent; +export default InputGroupAddon; diff --git a/types/reactstrap/lib/InputGroupButton.d.ts b/types/reactstrap/lib/InputGroupButton.d.ts index 90a93ff8ed..f51c61b3d1 100644 --- a/types/reactstrap/lib/InputGroupButton.d.ts +++ b/types/reactstrap/lib/InputGroupButton.d.ts @@ -10,3 +10,4 @@ export interface InputGroupButtonProps { } export const InputGroupButton: React.StatelessComponent; +export default InputGroupButton; diff --git a/types/reactstrap/lib/Jumbotron.d.ts b/types/reactstrap/lib/Jumbotron.d.ts index 4ade1eabaa..885bbe5f8f 100644 --- a/types/reactstrap/lib/Jumbotron.d.ts +++ b/types/reactstrap/lib/Jumbotron.d.ts @@ -8,3 +8,4 @@ export interface JumbotronProps { } export const Jumbotron: React.StatelessComponent; +export default Jumbotron; diff --git a/types/reactstrap/lib/Label.d.ts b/types/reactstrap/lib/Label.d.ts index 3688aaf233..26728059e0 100644 --- a/types/reactstrap/lib/Label.d.ts +++ b/types/reactstrap/lib/Label.d.ts @@ -23,3 +23,4 @@ export interface LabelProps extends Intermediate { } export const Label: React.StatelessComponent; +export default Label; diff --git a/types/reactstrap/lib/ListGroup.d.ts b/types/reactstrap/lib/ListGroup.d.ts index bef63da796..aec7fa4045 100644 --- a/types/reactstrap/lib/ListGroup.d.ts +++ b/types/reactstrap/lib/ListGroup.d.ts @@ -8,3 +8,4 @@ export interface ListGroupProps { } export const ListGroup: React.StatelessComponent; +export default ListGroup; diff --git a/types/reactstrap/lib/ListGroupItem.d.ts b/types/reactstrap/lib/ListGroupItem.d.ts index 44a70b6ec4..5b610f87e2 100644 --- a/types/reactstrap/lib/ListGroupItem.d.ts +++ b/types/reactstrap/lib/ListGroupItem.d.ts @@ -14,3 +14,4 @@ export interface ListGroupItemProps { } export const ListGroupItem: React.StatelessComponent; +export default ListGroupItem; diff --git a/types/reactstrap/lib/ListGroupItemHeading.d.ts b/types/reactstrap/lib/ListGroupItemHeading.d.ts index f44317f541..3e8d83a0dc 100644 --- a/types/reactstrap/lib/ListGroupItemHeading.d.ts +++ b/types/reactstrap/lib/ListGroupItemHeading.d.ts @@ -7,3 +7,4 @@ export interface ListGroupItemHeadingProps { } export const ListGroupItemHeading: React.StatelessComponent; +export default ListGroupItemHeading; diff --git a/types/reactstrap/lib/ListGroupItemText.d.ts b/types/reactstrap/lib/ListGroupItemText.d.ts index a19803e4fe..ad83a45831 100644 --- a/types/reactstrap/lib/ListGroupItemText.d.ts +++ b/types/reactstrap/lib/ListGroupItemText.d.ts @@ -7,3 +7,4 @@ export interface ListGroupItemTextProps { } export const ListGroupItemText: React.StatelessComponent; +export default ListGroupItemText; diff --git a/types/reactstrap/lib/Media.d.ts b/types/reactstrap/lib/Media.d.ts index 9276c0708f..17b65f25f0 100644 --- a/types/reactstrap/lib/Media.d.ts +++ b/types/reactstrap/lib/Media.d.ts @@ -18,3 +18,4 @@ export interface MediaProps { } export const Media: React.StatelessComponent; +export default Media; diff --git a/types/reactstrap/lib/Modal.d.ts b/types/reactstrap/lib/Modal.d.ts index eb7d2a0f15..77122f64b4 100644 --- a/types/reactstrap/lib/Modal.d.ts +++ b/types/reactstrap/lib/Modal.d.ts @@ -20,3 +20,4 @@ export interface ModalProps { } export const Modal: React.StatelessComponent; +export default Modal; diff --git a/types/reactstrap/lib/ModalBody.d.ts b/types/reactstrap/lib/ModalBody.d.ts index 1238f7d54a..a2693cbf28 100644 --- a/types/reactstrap/lib/ModalBody.d.ts +++ b/types/reactstrap/lib/ModalBody.d.ts @@ -7,3 +7,4 @@ export interface ModalBodyProps { } export const ModalBody: React.StatelessComponent; +export default ModalBody; diff --git a/types/reactstrap/lib/ModalFooter.d.ts b/types/reactstrap/lib/ModalFooter.d.ts index d7cafe275b..0241dcde84 100644 --- a/types/reactstrap/lib/ModalFooter.d.ts +++ b/types/reactstrap/lib/ModalFooter.d.ts @@ -7,3 +7,4 @@ export interface ModalFooterProps { } export const ModalFooter: React.StatelessComponent; +export default ModalFooter; diff --git a/types/reactstrap/lib/ModalHeader.d.ts b/types/reactstrap/lib/ModalHeader.d.ts index 5792fea0d1..a235d73183 100644 --- a/types/reactstrap/lib/ModalHeader.d.ts +++ b/types/reactstrap/lib/ModalHeader.d.ts @@ -9,3 +9,4 @@ export interface ModalHeaderProps { } export const ModalHeader: React.StatelessComponent; +export default ModalHeader; diff --git a/types/reactstrap/lib/Nav.d.ts b/types/reactstrap/lib/Nav.d.ts index e42556fadd..23bf1e58c5 100644 --- a/types/reactstrap/lib/Nav.d.ts +++ b/types/reactstrap/lib/Nav.d.ts @@ -14,3 +14,4 @@ export interface NavProps extends React.HTMLProps { } export const Nav: React.StatelessComponent; +export default Nav; diff --git a/types/reactstrap/lib/NavDropdown.d.ts b/types/reactstrap/lib/NavDropdown.d.ts index dfa15afa17..22e408489b 100644 --- a/types/reactstrap/lib/NavDropdown.d.ts +++ b/types/reactstrap/lib/NavDropdown.d.ts @@ -6,3 +6,4 @@ export interface UncontrolledNavDropdownProps extends UncontrolledDropdownProps export interface NavDropdownProps extends DropdownProps { } export const NavDropdown: React.StatelessComponent; +export default NavDropdown; diff --git a/types/reactstrap/lib/NavItem.d.ts b/types/reactstrap/lib/NavItem.d.ts index 8e6e7631d2..cb32a4fad1 100644 --- a/types/reactstrap/lib/NavItem.d.ts +++ b/types/reactstrap/lib/NavItem.d.ts @@ -7,3 +7,4 @@ export interface NavItemProps { } export const NavItem: React.StatelessComponent; +export default NavItem; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 1fd7d14abc..7fa907c453 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -12,3 +12,4 @@ export interface NavLinkProps extends React.HTMLProps { } export const NavLink: React.StatelessComponent; +export default NavLink; diff --git a/types/reactstrap/lib/Navbar.d.ts b/types/reactstrap/lib/Navbar.d.ts index 76616a7be2..fd52feeae8 100644 --- a/types/reactstrap/lib/Navbar.d.ts +++ b/types/reactstrap/lib/Navbar.d.ts @@ -17,3 +17,4 @@ export interface NavbarProps { } export const Navbar: React.StatelessComponent; +export default Navbar; diff --git a/types/reactstrap/lib/NavbarBrand.d.ts b/types/reactstrap/lib/NavbarBrand.d.ts index 0aa80597b9..8e3328ab81 100644 --- a/types/reactstrap/lib/NavbarBrand.d.ts +++ b/types/reactstrap/lib/NavbarBrand.d.ts @@ -7,3 +7,4 @@ export interface NavbarBrandProps extends React.HTMLProps { } export const NavbarBrand: React.StatelessComponent; +export default NavbarBrand; diff --git a/types/reactstrap/lib/NavbarToggler.d.ts b/types/reactstrap/lib/NavbarToggler.d.ts index 5dd2df7057..1855e2c41c 100644 --- a/types/reactstrap/lib/NavbarToggler.d.ts +++ b/types/reactstrap/lib/NavbarToggler.d.ts @@ -10,3 +10,4 @@ export interface NavbarTogglerProps extends React.HTMLProps { } export const NavbarToggler: React.StatelessComponent; +export default NavbarToggler; diff --git a/types/reactstrap/lib/Pagination.d.ts b/types/reactstrap/lib/Pagination.d.ts index 3b19364c30..dd1a0c9d51 100644 --- a/types/reactstrap/lib/Pagination.d.ts +++ b/types/reactstrap/lib/Pagination.d.ts @@ -7,3 +7,4 @@ export interface PaginationProps { } export const Pagination: React.StatelessComponent; +export default Pagination; diff --git a/types/reactstrap/lib/PaginationItem.d.ts b/types/reactstrap/lib/PaginationItem.d.ts index 3ed0400dcd..1e8efa8712 100644 --- a/types/reactstrap/lib/PaginationItem.d.ts +++ b/types/reactstrap/lib/PaginationItem.d.ts @@ -9,3 +9,4 @@ export interface PaginationItemProps { } export const PaginationItem: React.StatelessComponent; +export default PaginationItem; diff --git a/types/reactstrap/lib/PaginationLink.d.ts b/types/reactstrap/lib/PaginationLink.d.ts index 5c2a1d5711..c57bee37ac 100644 --- a/types/reactstrap/lib/PaginationLink.d.ts +++ b/types/reactstrap/lib/PaginationLink.d.ts @@ -10,3 +10,4 @@ export interface PaginationLinkProps extends React.HTMLProps } export const PaginationLink: React.StatelessComponent; +export default PaginationLink; diff --git a/types/reactstrap/lib/Popover.d.ts b/types/reactstrap/lib/Popover.d.ts index 69fe27cb88..e9e757572e 100644 --- a/types/reactstrap/lib/Popover.d.ts +++ b/types/reactstrap/lib/Popover.d.ts @@ -31,3 +31,4 @@ export interface PopoverProps { } export const Popover: React.StatelessComponent; +export default Popover; diff --git a/types/reactstrap/lib/PopoverContent.d.ts b/types/reactstrap/lib/PopoverContent.d.ts index a062d4d2c9..ea72f4dfb4 100644 --- a/types/reactstrap/lib/PopoverContent.d.ts +++ b/types/reactstrap/lib/PopoverContent.d.ts @@ -7,3 +7,4 @@ export interface PopoverContentProps { } export const PopoverContent: React.StatelessComponent; +export default PopoverContent; diff --git a/types/reactstrap/lib/PopoverTitle.d.ts b/types/reactstrap/lib/PopoverTitle.d.ts index e21bdd1729..9711058424 100644 --- a/types/reactstrap/lib/PopoverTitle.d.ts +++ b/types/reactstrap/lib/PopoverTitle.d.ts @@ -7,3 +7,4 @@ export interface PopoverTitleProps { } export const PopoverTitle: React.StatelessComponent; +export default PopoverTitle; diff --git a/types/reactstrap/lib/Progress.d.ts b/types/reactstrap/lib/Progress.d.ts index 5f67befa37..9ab522746c 100644 --- a/types/reactstrap/lib/Progress.d.ts +++ b/types/reactstrap/lib/Progress.d.ts @@ -15,3 +15,4 @@ export interface ProgressProps { } export const Progress: React.StatelessComponent; +export default Progress; diff --git a/types/reactstrap/lib/Row.d.ts b/types/reactstrap/lib/Row.d.ts index 5a57601a0a..30d202e919 100644 --- a/types/reactstrap/lib/Row.d.ts +++ b/types/reactstrap/lib/Row.d.ts @@ -8,3 +8,4 @@ export interface RowProps extends React.HTMLProps< HTMLElement> { } export const Row: React.StatelessComponent; +export default Row; diff --git a/types/reactstrap/lib/TabContent.d.ts b/types/reactstrap/lib/TabContent.d.ts index 5a8654ded9..1aced21b02 100644 --- a/types/reactstrap/lib/TabContent.d.ts +++ b/types/reactstrap/lib/TabContent.d.ts @@ -8,3 +8,4 @@ export interface TabContentProps { } export const TabContent: React.StatelessComponent; +export default TabContent; diff --git a/types/reactstrap/lib/TabPane.d.ts b/types/reactstrap/lib/TabPane.d.ts index c1c7c1f470..1d588e7304 100644 --- a/types/reactstrap/lib/TabPane.d.ts +++ b/types/reactstrap/lib/TabPane.d.ts @@ -8,3 +8,4 @@ export interface TabPaneProps { } export const TabPane: React.StatelessComponent; +export default TabPane; diff --git a/types/reactstrap/lib/Table.d.ts b/types/reactstrap/lib/Table.d.ts index f65af70e60..b49c6a5920 100644 --- a/types/reactstrap/lib/Table.d.ts +++ b/types/reactstrap/lib/Table.d.ts @@ -15,3 +15,4 @@ export interface TableProps { } export const Table: React.StatelessComponent; +export default Table; diff --git a/types/reactstrap/lib/Tag.d.ts b/types/reactstrap/lib/Tag.d.ts index bbc94d2120..0f2ed5bd07 100644 --- a/types/reactstrap/lib/Tag.d.ts +++ b/types/reactstrap/lib/Tag.d.ts @@ -9,3 +9,4 @@ export interface TagProps { } export const Tag: React.StatelessComponent; +export default Tag; diff --git a/types/reactstrap/lib/TetherContent.d.ts b/types/reactstrap/lib/TetherContent.d.ts index 2ebe419ed5..7dd32ae381 100644 --- a/types/reactstrap/lib/TetherContent.d.ts +++ b/types/reactstrap/lib/TetherContent.d.ts @@ -15,3 +15,4 @@ export interface TetherContentProps { } export const TetherContent: React.StatelessComponent; +export default TetherContent; diff --git a/types/reactstrap/lib/Tooltip.d.ts b/types/reactstrap/lib/Tooltip.d.ts index 9afa72f233..21a99707e8 100644 --- a/types/reactstrap/lib/Tooltip.d.ts +++ b/types/reactstrap/lib/Tooltip.d.ts @@ -38,3 +38,4 @@ export interface TooltipProps extends UncontrolledTooltipProps { } export const Tooltip: React.StatelessComponent; +export default Tooltip; From 3022724dfabf8dcfc28d8e29995e53ae2da957a0 Mon Sep 17 00:00:00 2001 From: FaithForHumans Date: Sat, 11 Nov 2017 11:46:44 -0600 Subject: [PATCH 010/322] Fixing line length issue --- types/reactstrap/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 86f4bf0bd8..ff6f8201b3 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -1,6 +1,10 @@ // Type definitions for reactstrap 5.0 // Project: https://github.com/reactstrap/reactstrap#readme -// Definitions by: Ali Hammad Baig , Marco Falkenberg , Danilo Barros , Fábio Paiva , FaithForHumans +// Definitions by: Ali Hammad Baig + Marco Falkenberg + Danilo Barros + Fábio Paiva + FaithForHumans // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 7339043a326321481e43279e68a375712edecbec Mon Sep 17 00:00:00 2001 From: FaithForHumans Date: Sat, 11 Nov 2017 11:52:28 -0600 Subject: [PATCH 011/322] Forgotten comments... --- types/reactstrap/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index ff6f8201b3..ae06cdd7cf 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -1,10 +1,10 @@ // Type definitions for reactstrap 5.0 // Project: https://github.com/reactstrap/reactstrap#readme // Definitions by: Ali Hammad Baig - Marco Falkenberg - Danilo Barros - Fábio Paiva - FaithForHumans +// Marco Falkenberg +// Danilo Barros +// Fábio Paiva +// FaithForHumans // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 3903644020d82e98c452656db4c2adb774ff2e49 Mon Sep 17 00:00:00 2001 From: Miloslav Nenadal Date: Mon, 13 Nov 2017 17:38:52 +0100 Subject: [PATCH 012/322] [ramda]: Fix `prop` type --- types/ramda/index.d.ts | 3 +-- types/ramda/ramda-tests.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 6ff65f6df3..4a4f65be43 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1447,9 +1447,8 @@ declare namespace R { /** * Returns a function that when supplied an object returns the indicated property of that object, if it exists. - * Note: TS1.9 # replace any by dictionary */ - prop

(p: P, obj: Record): T; + prop

(p: P, obj: T): T[P]; prop

(p: P): (obj: Record) => T; /** diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 426bb63471..28a944a63c 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1535,6 +1535,16 @@ class Rectangle { () => { const x: number = R.prop("x", {x: 100}); // => 100 + const obj = { + str: 'string', + num: 5, + }; + + const strVal: string = R.prop('str', obj); // => 'string' + const numVal: number = R.prop('num', obj); // => 5 + + const strValCur: string = R.prop('str')(obj); // => 'string' + const numValCur: number = R.prop('num')(obj); // => 5 }; () => { From 533581997cdaaa211505f467fd68b3c622d007d6 Mon Sep 17 00:00:00 2001 From: Adam Pyle Date: Thu, 16 Nov 2017 12:20:01 +1100 Subject: [PATCH 013/322] Added additional parameters for chrome/chrome-app * Added extra parameters to LaunchData per API docs https://developer.chrome.com/apps/app_runtime#event-onLaunched * Changed typescript version required to 2.4 since named enums are used --- types/chrome/chrome-app.d.ts | 28 +++++++++++++++++++++++++++- types/chrome/index.d.ts | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/types/chrome/chrome-app.d.ts b/types/chrome/chrome-app.d.ts index f80b335125..5c847325e0 100644 --- a/types/chrome/chrome-app.d.ts +++ b/types/chrome/chrome-app.d.ts @@ -1,6 +1,6 @@ // Type definitions for Chrome packaged application development // Project: http://developer.chrome.com/apps/ -// Definitions by: Adam Lay , MIZUNE Pine , MIZUSHIMA Junki , Ingvar Stepanyan +// Definitions by: Adam Lay , MIZUNE Pine , MIZUSHIMA Junki , Ingvar Stepanyan , Adam Pyle // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -21,12 +21,38 @@ declare namespace chrome.app { // App Runtime //////////////////// declare namespace chrome.app.runtime { + enum LaunchSource { + "untracked" = "untracked", + "app_launcher" = "app_launcher", + "new_tab_page" = "new_tab_page", + "reload" = "reload", + "restart" = "restart", + "load_and_launch" = "load_and_launch", + "command_line" = "command_line", + "file_handler" = "file_handler", + "url_handler" = "url_handler", + "system_tray" = "system_tray", + "about_page" = "about_page", + "keyboard" = "keyboard", + "extensions_page" = "extensions_page", + "management_api" = "management_api", + "ephemeral_app" = "ephemeral_app", + "background" = "background", + "kiosk" = "kiosk", + "chrome_internal" = "chrome_internal", + "test" = "test", + "installed_notification" = "installed_notification", + "context_menu" = "context_menu", + } interface LaunchData { id?: string; items?: LaunchDataItem[]; url?: string; referrerUrl?: string; isKioskSession?: boolean; + isPublicSession?: boolean; + source?: LaunchSource; + actionData?: {}; } interface LaunchDataItem { diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index bb2b4afcb5..16ed80730f 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -2,7 +2,7 @@ // Project: http://developer.chrome.com/extensions/ // Definitions by: Matthew Kimber , otiai10 , couven92 , RReverser , sreimer15 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 /// From d312fbdb3c2fb8a8f0528b2a1e1740051b13216e Mon Sep 17 00:00:00 2001 From: Adam Pyle Date: Thu, 16 Nov 2017 12:20:01 +1100 Subject: [PATCH 014/322] Added additional parameters for chrome/chrome-app * Added extra parameters to LaunchData per API docs https://developer.chrome.com/apps/app_runtime#event-onLaunched * Changed typescript version required to 2.4 since named enums are used ** Also for sion-chrome since this depends on chrome --- types/chrome/chrome-app.d.ts | 28 +++++++++++++++++++++++++++- types/chrome/index.d.ts | 2 +- types/sinon-chrome/index.d.ts | 2 +- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/types/chrome/chrome-app.d.ts b/types/chrome/chrome-app.d.ts index f80b335125..5c847325e0 100644 --- a/types/chrome/chrome-app.d.ts +++ b/types/chrome/chrome-app.d.ts @@ -1,6 +1,6 @@ // Type definitions for Chrome packaged application development // Project: http://developer.chrome.com/apps/ -// Definitions by: Adam Lay , MIZUNE Pine , MIZUSHIMA Junki , Ingvar Stepanyan +// Definitions by: Adam Lay , MIZUNE Pine , MIZUSHIMA Junki , Ingvar Stepanyan , Adam Pyle // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -21,12 +21,38 @@ declare namespace chrome.app { // App Runtime //////////////////// declare namespace chrome.app.runtime { + enum LaunchSource { + "untracked" = "untracked", + "app_launcher" = "app_launcher", + "new_tab_page" = "new_tab_page", + "reload" = "reload", + "restart" = "restart", + "load_and_launch" = "load_and_launch", + "command_line" = "command_line", + "file_handler" = "file_handler", + "url_handler" = "url_handler", + "system_tray" = "system_tray", + "about_page" = "about_page", + "keyboard" = "keyboard", + "extensions_page" = "extensions_page", + "management_api" = "management_api", + "ephemeral_app" = "ephemeral_app", + "background" = "background", + "kiosk" = "kiosk", + "chrome_internal" = "chrome_internal", + "test" = "test", + "installed_notification" = "installed_notification", + "context_menu" = "context_menu", + } interface LaunchData { id?: string; items?: LaunchDataItem[]; url?: string; referrerUrl?: string; isKioskSession?: boolean; + isPublicSession?: boolean; + source?: LaunchSource; + actionData?: {}; } interface LaunchDataItem { diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index bb2b4afcb5..16ed80730f 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -2,7 +2,7 @@ // Project: http://developer.chrome.com/extensions/ // Definitions by: Matthew Kimber , otiai10 , couven92 , RReverser , sreimer15 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 /// diff --git a/types/sinon-chrome/index.d.ts b/types/sinon-chrome/index.d.ts index 89434cf791..bc33b04d17 100644 --- a/types/sinon-chrome/index.d.ts +++ b/types/sinon-chrome/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/vitalets/sinon-chrome // Definitions by: Tim Perry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 /// /// From 2ffb22d223144c24609e2379e05ef13d3075c762 Mon Sep 17 00:00:00 2001 From: Adam Pyle Date: Thu, 16 Nov 2017 12:45:41 +1100 Subject: [PATCH 015/322] Added new line after newly created enum --- types/chrome/chrome-app.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/chrome/chrome-app.d.ts b/types/chrome/chrome-app.d.ts index 5c847325e0..561544c00c 100644 --- a/types/chrome/chrome-app.d.ts +++ b/types/chrome/chrome-app.d.ts @@ -44,6 +44,7 @@ declare namespace chrome.app.runtime { "installed_notification" = "installed_notification", "context_menu" = "context_menu", } + interface LaunchData { id?: string; items?: LaunchDataItem[]; From 47be1628ef7e0b1ba7246eee0581f541e37b165a Mon Sep 17 00:00:00 2001 From: Paito Anderson Date: Thu, 16 Nov 2017 10:24:14 -0500 Subject: [PATCH 016/322] Added react-native-popup-dialog --- types/react-native-popup-dialog/index.d.ts | 85 +++++++++++++++++++ .../react-native-popup-dialog-tests.tsx | 60 +++++++++++++ types/react-native-popup-dialog/tsconfig.json | 25 ++++++ types/react-native-popup-dialog/tslint.json | 1 + 4 files changed, 171 insertions(+) create mode 100644 types/react-native-popup-dialog/index.d.ts create mode 100644 types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx create mode 100644 types/react-native-popup-dialog/tsconfig.json create mode 100644 types/react-native-popup-dialog/tslint.json diff --git a/types/react-native-popup-dialog/index.d.ts b/types/react-native-popup-dialog/index.d.ts new file mode 100644 index 0000000000..d867d9361c --- /dev/null +++ b/types/react-native-popup-dialog/index.d.ts @@ -0,0 +1,85 @@ +// Type definitions for react-native-popup-dialog 0.9 +// Project: https://github.com/jacklam718/react-native-popup-dialog/blob/master/README.md +// Definitions by: Paito Anderson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; +import { GestureResponderEvent, StyleProp, ViewStyle } from 'react-native'; + +export type AlignTypes = 'left' | 'right' | 'center'; +export type OverlayPointerEventTypes = 'auto' | 'none'; +export type SlideFromTypes = 'top' | 'bottom' | 'left' | 'right'; + +export interface DialogButtonProps { + text: string; + align?: AlignTypes; + onPress?: (event: GestureResponderEvent) => void; + buttonStyle?: StyleProp; + textStyle?: StyleProp; + textContainerStyle?: StyleProp; + disabled?: boolean; + activeOpacity?: number; +} + +export interface DialogTitleProps { + title: string; + titleStyle?: StyleProp; + titleTextStyle?: StyleProp; + titleAlign?: AlignTypes; + haveTitleBar?: boolean; +} + +export interface OverlayProps { + onPress: (event: GestureResponderEvent) => void; + backgroundColor?: string; + opacity?: number; + animationDuration?: number; + showOverlay?: boolean; + pointerEvents?: string; +} + +export interface PopupDialogProps { + dialogTitle?: any; + width?: number; + height?: number; + dialogAnimation?: FadeAnimation | ScaleAnimation | SlideAnimation; + dialogStyle?: StyleProp; + containerStyle?: StyleProp; + animationDuration?: number; + overlayPointerEvents?: OverlayPointerEventTypes; + overlayBackgroundColor?: string; + overlayOpacity?: number; + dismissOnTouchOutside?: boolean; + dismissOnHardwareBackPress?: boolean; + haveOverlay?: boolean; + show?: boolean; + onShown?: () => void; + onDismissed?: () => void; + actions?: any[]; +} + +export class FadeAnimation { + constructor(toValue?: number); + constructor(params: { toValue?: number, animationDuration?: number }); + toValue(toValue: number): void; + createAnimations(): object; +} + +export class ScaleAnimation { + constructor(toValue?: number); + toValue(toValue: number): void; + createAnimations(): object; +} + +export class SlideAnimation { + constructor(toValue?: number); + constructor(params: { toValue?: number, slideFrom?: SlideFromTypes }); + toValue(toValue: number): void; + createAnimations(): object; +} + +export class DialogButton extends React.Component { } +export class DialogTitle extends React.Component { } +export class Overlay extends React.Component { } +export default class PopupDialog extends React.Component { } diff --git a/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx b/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx new file mode 100644 index 0000000000..6646111d89 --- /dev/null +++ b/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx @@ -0,0 +1,60 @@ +import * as React from 'react'; +import { StyleSheet, View } from 'react-native'; +import PopupDialog, { + DialogTitle, + DialogButton, + SlideAnimation, + ScaleAnimation, + FadeAnimation, + } from 'react-native-popup-dialog'; + +const slideAnimation = new SlideAnimation({ slideFrom: 'bottom' }); +const scaleAnimation = new ScaleAnimation(); +const fadeAnimation = new FadeAnimation({ animationDuration: 150 }); + +class Test extends React.Component { + render() { + return ( + + } + dialogAnimation={fadeAnimation} + /> + } + dialogAnimation={scaleAnimation} + actions={[ + {}} + key="button-1" + />, + ]} + /> + } + width={300} + height={300} + dialogAnimation={slideAnimation} + containerStyle={styles.testStyle} + dialogStyle={styles.testStyle} + animationDuration={150} + overlayPointerEvents='auto' + overlayBackgroundColor='white' + overlayOpacity={0.5} + dismissOnTouchOutside={false} + dismissOnHardwareBackPress={false} + haveOverlay={true} + show={true} + onShown={() => { console.log('onShown'); }} + onDismissed={() => { console.log('onDismissed'); }} + /> + ); + } +} + +const styles = StyleSheet.create({ + testStyle: { + paddingTop: 10, + } +}); diff --git a/types/react-native-popup-dialog/tsconfig.json b/types/react-native-popup-dialog/tsconfig.json new file mode 100644 index 0000000000..ee710ade52 --- /dev/null +++ b/types/react-native-popup-dialog/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-popup-dialog-tests.tsx" + ] +} diff --git a/types/react-native-popup-dialog/tslint.json b/types/react-native-popup-dialog/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-popup-dialog/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5d46bcf51b11947bec4a09d90af727fcd8001582 Mon Sep 17 00:00:00 2001 From: Paito Anderson Date: Thu, 16 Nov 2017 10:30:20 -0500 Subject: [PATCH 017/322] Fixed Overlay Typo --- types/react-native-popup-dialog/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native-popup-dialog/index.d.ts b/types/react-native-popup-dialog/index.d.ts index d867d9361c..b1e1bb0fff 100644 --- a/types/react-native-popup-dialog/index.d.ts +++ b/types/react-native-popup-dialog/index.d.ts @@ -81,5 +81,5 @@ export class SlideAnimation { export class DialogButton extends React.Component { } export class DialogTitle extends React.Component { } -export class Overlay extends React.Component { } +export class Overlay extends React.Component { } export default class PopupDialog extends React.Component { } From 057e01934e29eed3443f12fc424bcbc61ffdfe69 Mon Sep 17 00:00:00 2001 From: york yao Date: Fri, 17 Nov 2017 07:47:05 +0800 Subject: [PATCH 018/322] do not force to require at least one parameter considering using the spread operator --- types/ioredis/index.d.ts | 88 +++++++++++++++++----------------- types/ioredis/ioredis-tests.ts | 3 ++ 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index ec1dbe3512..384f0cdb03 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -78,9 +78,9 @@ declare namespace IORedis { strlen(key: string, callback: (err: Error, res: number) => void): void; strlen(key: string): Promise; - del(key: string, ...keys: string[]): any; + del(...keys: string[]): any; - exists(key: string, ...keys: string[]): any; + exists(...keys: string[]): any; setbit(key: string, offset: number, value: any, callback: (err: Error, res: number) => void): void; setbit(key: string, offset: number, value: any): Promise; @@ -103,11 +103,11 @@ declare namespace IORedis { decr(key: string, callback: (err: Error, res: number) => void): void; decr(key: string): Promise; - mget(key: string, ...keys: string[]): any; + mget(...keys: string[]): any; - rpush(key: string, value: any, ...values: string[]): any; + rpush(key: string, ...values: any[]): any; - lpush(key: string, value: any, ...values: string[]): any; + lpush(key: string, ...values: any[]): any; rpushx(key: string, value: any, callback: (err: Error, res: number) => void): void; rpushx(key: string, value: any): Promise; @@ -124,9 +124,9 @@ declare namespace IORedis { lpop(key: string, callback: (err: Error, res: string) => void): void; lpop(key: string): Promise; - brpop(key: string, ...keys: string[]): any; + brpop(...keys: string[]): any; - blpop(key: string, ...keys: string[]): any; + blpop(...keys: string[]): any; brpoplpush(source: string, destination: string, timeout: number, callback: (err: Error, res: any) => void): void; brpoplpush(source: string, destination: string, timeout: number): Promise; @@ -173,17 +173,17 @@ declare namespace IORedis { srandmember(key: string, count: number, callback: (err: Error, res: any) => void): void; srandmember(key: string, count?: number): Promise; - sinter(key: string, ...keys: string[]): any; + sinter(...keys: string[]): any; - sinterstore(destination: string, key: string, ...keys: string[]): any; + sinterstore(destination: string, ...keys: string[]): any; - sunion(key: string, ...keys: string[]): any; + sunion(...keys: string[]): any; - sunionstore(destination: string, key: string, ...keys: string[]): any; + sunionstore(destination: string, ...keys: string[]): any; - sdiff(key: string, ...keys: string[]): any; + sdiff(...keys: string[]): any; - sdiffstore(destination: string, key: string, ...keys: string[]): any; + sdiffstore(destination: string, ...keys: string[]): any; smembers(key: string, callback: (err: Error, res: any) => void): void; smembers(key: string): Promise; @@ -193,7 +193,7 @@ declare namespace IORedis { zincrby(key: string, increment: number, member: string, callback: (err: Error, res: any) => void): void; zincrby(key: string, increment: number, member: string): Promise; - zrem(key: string, member: string, ...members: any[]): any; + zrem(key: string, ...members: any[]): any; zremrangebyscore(key: string, min: number, max: number, callback: (err: Error, res: any) => void): void; zremrangebyscore(key: string, min: number, max: number): Promise; @@ -243,7 +243,7 @@ declare namespace IORedis { hmset(key: string, field: string, value: any, ...args: string[]): any; - hmget(key: string, field: string, ...fields: string[]): any; + hmget(key: string, ...fields: string[]): any; hincrby(key: string, field: string, increment: number, callback: (err: Error, res: number) => void): void; hincrby(key: string, field: string, increment: number): Promise; @@ -251,7 +251,7 @@ declare namespace IORedis { hincrbyfloat(key: string, field: string, increment: number, callback: (err: Error, res: number) => void): void; hincrbyfloat(key: string, field: string, increment: number): Promise; - hdel(key: string, field: string, ...fields: string[]): any; + hdel(key: string, ...fields: string[]): any; hlen(key: string, callback: (err: Error, res: number) => void): void; hlen(key: string): Promise; @@ -388,18 +388,18 @@ declare namespace IORedis { config(...args: any[]): any; - subscribe(channel: string, ...channels: any[]): any; + subscribe(...channels: any[]): any; unsubscribe(...channels: string[]): any; - psubscribe(pattern: string, ...patterns: string[]): any; + psubscribe(...patterns: string[]): any; punsubscribe(...patterns: string[]): any; publish(channel: string, message: string, callback: (err: Error, res: number) => void): void; publish(channel: string, message: string): Promise; - watch(key: string, ...keys: string[]): any; + watch(...keys: string[]): any; unwatch(callback: (err: Error, res: string) => void): void; unwatch(): Promise; @@ -432,11 +432,11 @@ declare namespace IORedis { zscan(key: string, cursor: number, ...args: any[]): any; - pfmerge(destkey: string, sourcekey: string, ...sourcekeys: string[]): any; + pfmerge(destkey: string, ...sourcekeys: string[]): any; - pfadd(key: string, element: string, ...elements: string[]): any; + pfadd(key: string, ...elements: string[]): any; - pfcount(key: string, ...keys: string[]): any; + pfcount(...keys: string[]): any; pipeline(commands?: string[][]): Pipeline; @@ -464,9 +464,9 @@ declare namespace IORedis { strlen(key: string, callback?: (err: Error, res: number) => void): Pipeline; - del(key: string, ...keys: string[]): Pipeline; + del(...keys: string[]): Pipeline; - exists(key: string, ...keys: string[]): Pipeline; + exists(...keys: string[]): Pipeline; setbit(key: string, offset: number, value: any, callback?: (err: Error, res: number) => void): Pipeline; @@ -482,11 +482,11 @@ declare namespace IORedis { decr(key: string, callback?: (err: Error, res: number) => void): Pipeline; - mget(key: string, ...keys: string[]): Pipeline; + mget(...keys: string[]): Pipeline; - rpush(key: string, value: any, ...values: string[]): Pipeline; + rpush(key: string, ...values: any[]): Pipeline; - lpush(key: string, value: any, ...values: string[]): Pipeline; + lpush(key: string, ...values: any[]): Pipeline; rpushx(key: string, value: any, callback?: (err: Error, res: number) => void): Pipeline; @@ -498,9 +498,9 @@ declare namespace IORedis { lpop(key: string, callback?: (err: Error, res: string) => void): Pipeline; - brpop(key: string, ...keys: string[]): Pipeline; + brpop(...keys: string[]): Pipeline; - blpop(key: string, ...keys: string[]): Pipeline; + blpop(...keys: string[]): Pipeline; brpoplpush(source: string, destination: string, timeout: number, callback?: (err: Error, res: any) => void): Pipeline; @@ -534,17 +534,17 @@ declare namespace IORedis { srandmember(key: string, callback?: (err: Error, res: any) => void): Pipeline; srandmember(key: string, count: number, callback?: (err: Error, res: any) => void): Pipeline; - sinter(key: string, ...keys: string[]): Pipeline; + sinter(...keys: string[]): Pipeline; - sinterstore(destination: string, key: string, ...keys: string[]): Pipeline; + sinterstore(destination: string, ...keys: string[]): Pipeline; - sunion(key: string, ...keys: string[]): Pipeline; + sunion(...keys: string[]): Pipeline; - sunionstore(destination: string, key: string, ...keys: string[]): Pipeline; + sunionstore(destination: string, ...keys: string[]): Pipeline; - sdiff(key: string, ...keys: string[]): Pipeline; + sdiff(...keys: string[]): Pipeline; - sdiffstore(destination: string, key: string, ...keys: string[]): Pipeline; + sdiffstore(destination: string, ...keys: string[]): Pipeline; smembers(key: string, callback?: (err: Error, res: any) => void): Pipeline; @@ -552,7 +552,7 @@ declare namespace IORedis { zincrby(key: string, increment: number, member: string, callback?: (err: Error, res: any) => void): Pipeline; - zrem(key: string, member: string, ...members: any[]): Pipeline; + zrem(key: string, ...members: any[]): Pipeline; zremrangebyscore(key: string, min: number, max: number, callback?: (err: Error, res: any) => void): Pipeline; @@ -590,13 +590,13 @@ declare namespace IORedis { hmset(key: string, field: string, value: any, ...args: string[]): Pipeline; - hmget(key: string, field: string, ...fields: string[]): Pipeline; + hmget(key: string, ...fields: string[]): Pipeline; hincrby(key: string, field: string, increment: number, callback?: (err: Error, res: number) => void): Pipeline; hincrbyfloat(key: string, field: string, increment: number, callback?: (err: Error, res: number) => void): Pipeline; - hdel(key: string, field: string, ...fields: string[]): Pipeline; + hdel(key: string, ...fields: string[]): Pipeline; hlen(key: string, callback?: (err: Error, res: number) => void): Pipeline; @@ -692,17 +692,17 @@ declare namespace IORedis { config(...args: any[]): Pipeline; - subscribe(channel: string, ...channels: any[]): Pipeline; + subscribe(...channels: any[]): Pipeline; unsubscribe(...channels: string[]): Pipeline; - psubscribe(pattern: string, ...patterns: string[]): Pipeline; + psubscribe(...patterns: string[]): Pipeline; punsubscribe(...patterns: string[]): Pipeline; publish(channel: string, message: string, callback?: (err: Error, res: number) => void): Pipeline; - watch(key: string, ...keys: string[]): Pipeline; + watch(...keys: string[]): Pipeline; unwatch(callback?: (err: Error, res: string) => void): Pipeline; @@ -732,11 +732,11 @@ declare namespace IORedis { zscan(key: string, cursor: number, ...args: any[]): Pipeline; - pfmerge(destkey: string, sourcekey: string, ...sourcekeys: string[]): Pipeline; + pfmerge(destkey: string, ...sourcekeys: string[]): Pipeline; - pfadd(key: string, element: string, ...elements: string[]): Pipeline; + pfadd(key: string, ...elements: string[]): Pipeline; - pfcount(key: string, ...keys: string[]): Pipeline; + pfcount(...keys: string[]): Pipeline; } interface Cluster extends NodeJS.EventEmitter, Commander { diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index 02b62def62..99c7efada3 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -104,3 +104,6 @@ redis.multi([ ]).exec((err, results) => { // results = [[null, 'OK'], [null, 'bar']] }); + +const keys = [ 'foo', 'bar' ]; +redis.mget(...keys); From 5d2c78fa139f647789d70a3f5aeb1c3d18820a5c Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Fri, 17 Nov 2017 21:30:48 +1100 Subject: [PATCH 019/322] Add core types for heatmap.js Previous implementation only covered undocumented Leaflet.js extension. This commit adds in types for documented API. - Conform to standard DefinitelyTyped linter - Enable `strictNullChecks` - Add types for Heatmap.js API - Update Leaflet types so that `latField` and `lngField` are strictly enforced by type system. Closes #13999 --- types/heatmap.js/heatmap.js-tests.ts | 309 ++++++++++++++++++--- types/heatmap.js/index.d.ts | 389 +++++++++++++++++++-------- types/heatmap.js/tsconfig.json | 2 +- types/heatmap.js/tslint.json | 78 +----- 4 files changed, 551 insertions(+), 227 deletions(-) diff --git a/types/heatmap.js/heatmap.js-tests.ts b/types/heatmap.js/heatmap.js-tests.ts index c2f2d34c16..198c214198 100644 --- a/types/heatmap.js/heatmap.js-tests.ts +++ b/types/heatmap.js/heatmap.js-tests.ts @@ -1,42 +1,283 @@ +// tslint:disable-next-line no-object-literal-type-assertion +const container = {} as HTMLElement; +// -- h337.HeatmapConfiguration -- -var baseLayer = L.tileLayer( - 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © CloudMade', - maxZoom: 18 - }); +{ + const config: h337.HeatmapConfiguration = { container }; + config; // $ExpectType HeatmapConfiguration<"value", "x", "y"> +} -var testData: HeatmapData = { - max: 8, - data: [ - { - lat: 24.6408, - lng:46.7728, - count: 3 - }, { - lat: 50.75, - lng: -1.55, - count: 1 +{ + // $ExpectError + const config: h337.HeatmapConfiguration = {}; +} + +{ + const config: h337.HeatmapConfiguration = { + container, + xField: 'x', + yField: 'y', + valueField: 'value', + }; +} + +{ + // $ExpectError + const config: h337.HeatmapConfiguration = { + container, + valueField: 'foo', + }; +} + +{ + const config: h337.HeatmapConfiguration<'foo'> = { + container, + valueField: 'foo', + }; + config; // $ExpectType HeatmapConfiguration<"foo", "x", "y"> +} + +// -- h337.create -- + +{ + h337.create(); // $ExpectError +} + +{ + // $ExpectType Heatmap<"value", "x", "y"> + h337.create({ container }); + + // $ExpectType Heatmap<"count", "xPos", "yPos"> + h337.create<"count", "xPos", "yPos">({ + container, + valueField: "count", + xField: "xPos", + yField: "yPos", + }); + + const config: h337.HeatmapConfiguration<"count", "xPos", "yPos"> = { + container, + valueField: "count", + xField: "xPos", + yField: "yPos", + }; + // $ExpectType Heatmap<"count", "xPos", "yPos"> + h337.create(config); +} + +// -- Heatmap#addData -- + +{ + const heatmap = h337.create({ container }); + + // $ExpectType Heatmap<"value", "x", "y"> + heatmap.addData({ x: 1, y: 1, value: 5 }); + + heatmap.addData([ + { x: 1, y: 1, value: 1 }, + { x: 2, y: 2, value: 2 }, + ]); + + heatmap.addData({ x: null, y: 1, value: 1 }); // $ExpectError + heatmap.addData({ x: 1, y: null, value: 1 }); // $ExpectError + heatmap.addData({ x: 1, y: 1, value: null }); // $ExpectError + heatmap.addData({ y: 1, value: 1 }); // $ExpectError + heatmap.addData({ x: 1, value: 1 }); // $ExpectError + heatmap.addData({ x: 1, y: 1, }); // $ExpectError +} + +{ + const heatmap = h337.create<"count", "xPos", "yPos">({ + container, + xField: "xPos", + yField: "yPos", + valueField: "count", + }); + + // $ExpectType Heatmap<"count", "xPos", "yPos"> + heatmap.addData({ xPos: 1, yPos: 1, count: 5 }); + + heatmap.addData([ + { xPos: 1, yPos: 1, count: 1 }, + { xPos: 2, yPos: 2, count: 2 }, + ]); + + heatmap.addData({ xPos: null, yPos: 1, count: 1 }); // $ExpectError + heatmap.addData({ xPos: 1, yPos: null, count: 1 }); // $ExpectError + heatmap.addData({ xPos: 1, yPos: 1, count: null }); // $ExpectError + heatmap.addData({ yPos: 1, count: 1 }); // $ExpectError + heatmap.addData({ xPos: 1, count: 1 }); // $ExpectError + heatmap.addData({ xPos: 1, yPos: 1, }); // $ExpectError +} + +// -- Heatmap#setData -- + +{ + const validData: ReadonlyArray = + [{ x: 1, y: 2, value: 1 }]; + + const heatmap = h337.create({ container }); + heatmap.setData({ max: 5, data: validData }); // $ExpectError + heatmap.setData({ min: 5, data: validData }); // $ExpectError + + // $ExpectType Heatmap<"value", "x", "y"> + heatmap.setData({ + min: 0, + max: 1, + data: validData + }); + + heatmap.setData({ // $ExpectError + min: 0, + max: 1, + data: [{ xPos: 1, yPos: 2, value: 5 }] + }); +} + +{ + const validData: ReadonlyArray> = + [{ xPos: 1, yPos: 2, count: 1 }]; + + const heatmap = h337.create<"count", "xPos", "yPos">({ container }); + heatmap.setData({ max: 5, data: validData }); // $ExpectError + heatmap.setData({ min: 5, data: validData }); // $ExpectError + + // $ExpectType Heatmap<"count", "xPos", "yPos"> + heatmap.setData({ + min: 0, + max: 1, + data: validData + }); + + heatmap.setData({ // $ExpectError + min: 0, + max: 1, + data: [{ x: 1, y: 2, value: 5 }] + }); +} + +// -- Heatmap#setDataMax / Heatmap#setDataMin -- + +{ + const heatmap = h337.create({ container }); + + // $ExpectType Heatmap<"value", "x", "y"> + heatmap.setDataMax(500); + heatmap.setDataMax(null); // $ExpectError + heatmap.setDataMax(); // $ExpectError + + heatmap.setDataMin(500); + heatmap.setDataMin(null); // $ExpectError + heatmap.setDataMin(); // $ExpectError +} + +// -- Heatmap#configure -- + +{ + const heatmap = h337.create({ container }); + + heatmap.configure({}); // $ExpectError + + // $ExpectType Heatmap<"value", "x", "y"> + heatmap.configure({ container }); + + const nextHeatmap = heatmap.configure<"count", "xPos", "yPos">({ + container, + valueField: "count", + xField: "xPos", + yField: "yPos" + }); + + nextHeatmap; // $ExpectType Heatmap<"count", "xPos", "yPos"> + + // $ExpectType Heatmap<"count", "xPos", "yPos"> + nextHeatmap.configure({ container }); +} + +// -- Heatmap#getValueAt -- + +{ + // $ExpectType number + h337.create({ container }).getValueAt({ x: 0, y: 1 }); + + // $ExpectType number + h337.create<"foo", "bar", "baz">({ container }).getValueAt({ x: 0, y: 1 }); +} + +// -- Heatmap#getData -- + +{ + // $ExpectType HeatmapData + h337.create({ container }).getData(); + + // $ExpectType HeatmapData + h337.create<"foo", "bar", "baz">({ container }).getData(); +} + +// -- Heatmap#getDataURL -- + +{ + // $ExpectType string + h337.create({ container }).getDataURL(); +} + +// -- Heatmap#repaint -- +{ + // $ExpectType Heatmap<"value", "x", "y"> + h337.create({ container }).repaint(); + + // $ExpectType Heatmap<"foo", "bar", "baz"> + h337.create<"foo", "bar", "baz">({ container }).repaint(); +} + +// -- Leaflet plugin -- + +{ + const baseLayer = L.tileLayer( + 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + // tslint:disable-next-line max-line-length + attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © CloudMade', + maxZoom: 18 } - ] -}; + ); -var config : HeatmapConfiguration = { - radius: 2, - maxOpacity: .8, - scaleRadius: true, - useLocalExtrema: true, - latField: 'lat', - lngField: 'lng', - valueField: 'count' -}; + const testData: h337.HeatmapData> = { + min: 1, + max: 3, + data: [ + { + lat: 24.6408, + lng: 46.7728, + count: 3 + }, { + lat: 50.75, + lng: -1.55, + count: 1 + } + ] + }; -var heatmapLayer = new HeatmapOverlay(config); + const config: h337.HeatmapOverlayConfiguration<'count'> = { + radius: 2, + maxOpacity: .8, + scaleRadius: true, + useLocalExtrema: true, + latField: 'lat', + lngField: 'lng', + valueField: 'count' + }; + config; // $ExpectType HeatmapOverlayConfiguration<"count", "lat", "lng"> -var map = new L.Map('map-canvas', { - center: new L.LatLng(25.6586, -80.3568), - zoom: 4, - layers: [baseLayer, heatmapLayer] -}); + const heatmapLayer = new HeatmapOverlay(config); + heatmapLayer; // $ExpectType HeatmapOverlay<"count", "lat", "lng"> -heatmapLayer.setData(testData); + const map = new L.Map('map-canvas', { + center: new L.LatLng(25.6586, -80.3568), + zoom: 4, + layers: [baseLayer, heatmapLayer] + }); + + // $ExpectType void + heatmapLayer.setData(testData); +} diff --git a/types/heatmap.js/index.d.ts b/types/heatmap.js/index.d.ts index e6c0a4aec1..f97f83fc19 100644 --- a/types/heatmap.js/index.d.ts +++ b/types/heatmap.js/index.d.ts @@ -1,127 +1,291 @@ -// Type definitions for heatmap.js v2.0 +// Type definitions for heatmap.js 2.0 // Project: https://github.com/pa7/heatmap.js/ // Definitions by: Yang Guan +// Rhys van der Waerden // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 + +export as namespace h337; + +/* + * Create a heatmap instance. A Heatmap can be customized with the configObject. + */ +export function create< + V extends string = 'value', + X extends string = 'x', + Y extends string = 'y' +>( + configObject: HeatmapConfiguration +): Heatmap; + +export function register(pluginKey: string, plugin: any): void; + +/* + * Heatmap instances are returned by h337.create. A heatmap instance has its own + * internal datastore and renderer where you can manipulate data. As a result + * the heatmap gets updated (either partially or completely, depending on + * whether it's necessary). + */ +export class Heatmap { + /* + * Use this functionality only for adding datapoints on the fly, not for data + * initialization! heatmapInstance.addData adds a single or multiple + * datapoints to the heatmap's datastore. + */ + addData(dataPoint: DataPoint | ReadonlyArray>): this; + + /* + * Initialize a heatmap instance with the given dataset. Removes all + * previously existing points from the heatmap instance and re-initializes + * the datastore. + */ + setData(data: HeatmapData>): this; + + /* + * Changes the upper bound of your dataset and triggers a complete + * rerendering. + */ + setDataMax(number: number): this; + + /* + * Changes the lower bound of your dataset and triggers a complete + * rerendering. + */ + setDataMin(number: number): this; + + /* + * Reconfigures a heatmap instance after it has been initialized. Triggers a + * complete rerendering. + * + * NOTE: This returns a reference to itself, but also offers an opportunity + * to change the `xField`, `yField` and `valueField` options, which can + * change the type of the `Heatmap` instance. + */ + configure< + Vn extends string = V, + Xn extends string = X, + Yn extends string = Y + >(configObject: HeatmapConfiguration): Heatmap; + + /** + * Returns value at datapoint position. + * + * The returned value is an interpolated value based on the gradient blending + * if point is not in store. + * + * NOTE: This function uses `x` and `y` instead of custom `xField` and + * `yField` + */ + getValueAt(point: Point<'x', 'y'>): number; + + /* + * Returns a persistable and reimportable (with setData) JSON object. + */ + getData(): HeatmapData; + + /* + * Returns dataURL string. + * + * The returned value is the base64 encoded dataURL of the heatmap instance. + */ + getDataURL(): string; + + /* + * Repaints the whole heatmap canvas. + */ + repaint(): this; +} + +export interface BaseHeatmapConfiguration { + /* + * A background color string in form of hexcode, color name, or rgb(a) + */ + backgroundColor?: string; + + /* + * The blur factor that will be applied to all datapoints. The higher the + * blur factor is, the smoother the gradients will be + * Default value: 0.85 + */ + blur?: number; + + /* + * An object that represents the gradient. + * Syntax: {[key: number in range [0,1]]: color} + */ + gradient?: { [key: string]: string }; + + /* + * The maximal opacity the highest value in the heatmap will have. (will be + * overridden if opacity set) + * Default value: 0.6 + */ + maxOpacity?: number; + + /* + * The minimum opacity the lowest value in the heatmap will have (will be + * overridden if opacity set) + */ + minOpacity?: number; + + /* + * A global opacity for the whole heatmap. This overrides maxOpacity and + * minOpacity if set + * Default value: 0.6 + */ + opacity?: number; + + /* + * The radius each datapoint will have (if not specified on the datapoint + * itself) + */ + radius?: number; + + /** + * Scales the radius based on map zoom. + */ + scaleRadius?: boolean; + + /* + * The property name of the value/weight in a datapoint + * Default value: 'value' + */ + valueField?: V; + + /** + * Pass a callback to receive extrema change updates. Useful for DOM + * legends. + */ + onExtremaChange?: () => void; + + /* + * Indicate whether the heatmap should use a global extrema or a local + * extrema (the maximum and minimum of the currently displayed viewport) + */ + useLocalExtrema?: boolean; +} + +/* + * Configuration object of a heatmap + */ +export interface HeatmapConfiguration< + V extends string = 'value', + X extends string = 'x', + Y extends string = 'y', +> extends BaseHeatmapConfiguration { + /* + * A DOM node where the heatmap canvas should be appended (heatmap will adapt to + * the node's size) + */ + container: HTMLElement; + + /* + * The property name of your x coordinate in a datapoint + * Default value: 'x' + */ + xField?: X; + + /* + * The property name of your y coordinate in a datapoint + * Default value: 'y' + */ + yField?: Y; +} + +export interface HeatmapOverlayConfiguration< + V extends string = 'value', + TLat extends string = 'lat', + TLong extends string = 'lng', +> extends BaseHeatmapConfiguration { + /* + * The property name of your latitude coordinate in a datapoint + * Default value: 'x' + */ + latField?: TLat; + + /* + * The property name of your longitude coordinate in a datapoint + * Default value: 'y' + */ + lngField?: TLong; +} + +/* + * A position in the heatmap. + */ +export type Point = + Record; + +/* + * A single data point on a heatmap. The interface of the data point can be + * overridden by providing alternative values for `xKey` and `yKey` in the + * config object. + */ +export type DataPoint< + V extends string = 'value', + X extends string = 'x', + Y extends string = 'y', +> = + Record & Point; + +/* + * Type of data returned by `Heatmap#getData`, which ignores custom `xField`, + * `yField` and `valueField`. + */ +export interface DataCircle { + x: number; + y: number; + value: number; + radius: number; +} + +/* + * An object representing the set of data points on a heatmap + */ +export interface HeatmapData { + /* + * An array of data points + */ + data: ReadonlyArray; + + /* + * Max value of the valueField + */ + max: number; + + /* + * Min value of the valueField + */ + min: number; +} + +// -- Leaflet plugin -- import * as Leaflet from "leaflet"; declare global { /* - * Configuration object of a heatmap - */ - interface HeatmapConfiguration { - + * The overlay layer to be added onto leaflet map + */ + class HeatmapOverlay< + V extends string, + TLat extends string, + TLng extends string + > implements Leaflet.ILayer { /* - * A background color string in form of hexcode, color name, or rgb(a) - */ - backgroundColor?: string; - - /* - * The blur factor that will be applied to all datapoints. The higher the - * blur factor is, the smoother the gradients will be - * Default value: 0.85 - */ - blur?: number; - - /* - * An object that represents the gradient - */ - gradient?: any; - - /* - * The property name of your latitude coordinate in a datapoint - * Default value: 'x' - */ - latField?: string; - - /* - * The property name of your longitude coordinate in a datapoint - * Default value: 'y' - */ - lngField?: string; - - /* - * The maximal opacity the highest value in the heatmap will have. (will be - * overridden if opacity set) - * Default value: 0.6 - */ - maxOpacity?: number; - - /* - * The minimum opacity the lowest value in the heatmap will have (will be - * overridden if opacity set) - */ - minOpacity?: number; - - /* - * A global opacity for the whole heatmap. This overrides maxOpacity and - * minOpacity if set - */ - opacity?: number; - - /* - * The radius each datapoint will have (if not specified on the datapoint - * itself) - */ - radius?: number; - - /** - * Scales the radius based on map zoom. + * Initialization function */ - scaleRadius?: boolean; + constructor(configuration: HeatmapOverlayConfiguration); /* - * Indicate whether the heatmap should use a global extrema or a local - * extrema (the maximum and minimum of the currently displayed viewport) - */ - useLocalExtrema?: boolean; + * Initialize a heatmap instance with the given dataset + */ + setData(data: HeatmapData>): void; /* - * The property name of the value/weight in a datapoint - * Default value: 'value' - */ - valueField?: string; - } - - /* - * A single data point on a heatmap. The keys are specified by - * HeatmapConfig.latField, HeatmapConfig.lngField and HeatmapConfig.valueField - */ - interface HeatmapDataPoint { - [index: string]: number; - } - - /* - * An object representing the set of data points on a heatmap - */ - interface HeatmapData { - - /* - * An array of HeatmapDataPoints - */ - data: HeatmapDataPoint[]; - - /* - * Max value of the valueField - */ - max?: number; - - /* - * Min value of the valueField - */ - min?: number; - } - - /* - * The overlay layer to be added onto leaflet map - */ - class HeatmapOverlay { - - /* - * Initialization function - */ - constructor(configuration: HeatmapConfiguration) + * Experimential... not ready. + */ + addData(data: DataPoint | ReadonlyArray>): void; /* * Create DOM elements for an overlay, adding them to map panes and puts @@ -134,10 +298,5 @@ declare global { * previously added by onAdd() */ onRemove(map: Leaflet.Map): void; - - /* - * Initialize a heatmap instance with the given dataset - */ - setData(data: HeatmapData): void; } } diff --git a/types/heatmap.js/tsconfig.json b/types/heatmap.js/tsconfig.json index 06fa28716f..2e22853a34 100644 --- a/types/heatmap.js/tsconfig.json +++ b/types/heatmap.js/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/heatmap.js/tslint.json b/types/heatmap.js/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/heatmap.js/tslint.json +++ b/types/heatmap.js/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } From 86ba50fb2fc45c6e956b4a47354f4ac1584a61f2 Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Sat, 18 Nov 2017 16:15:38 +1100 Subject: [PATCH 020/322] heatmap.js: declare const container in tests More idiomatic and avoids a tslint disable comment. --- types/heatmap.js/heatmap.js-tests.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/heatmap.js/heatmap.js-tests.ts b/types/heatmap.js/heatmap.js-tests.ts index 198c214198..d7c9c76c2b 100644 --- a/types/heatmap.js/heatmap.js-tests.ts +++ b/types/heatmap.js/heatmap.js-tests.ts @@ -1,5 +1,4 @@ -// tslint:disable-next-line no-object-literal-type-assertion -const container = {} as HTMLElement; +declare const container: HTMLElement; // -- h337.HeatmapConfiguration -- From 0e6cdf8acde1c2261e4ef3d25113b3905bf26e52 Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Sat, 18 Nov 2017 16:17:22 +1100 Subject: [PATCH 021/322] heatmap.js: Remove tests for required fields These tests are not needed. --- types/heatmap.js/heatmap.js-tests.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/types/heatmap.js/heatmap.js-tests.ts b/types/heatmap.js/heatmap.js-tests.ts index d7c9c76c2b..af0c021b3f 100644 --- a/types/heatmap.js/heatmap.js-tests.ts +++ b/types/heatmap.js/heatmap.js-tests.ts @@ -7,11 +7,6 @@ declare const container: HTMLElement; config; // $ExpectType HeatmapConfiguration<"value", "x", "y"> } -{ - // $ExpectError - const config: h337.HeatmapConfiguration = {}; -} - { const config: h337.HeatmapConfiguration = { container, @@ -39,10 +34,6 @@ declare const container: HTMLElement; // -- h337.create -- -{ - h337.create(); // $ExpectError -} - { // $ExpectType Heatmap<"value", "x", "y"> h337.create({ container }); @@ -176,8 +167,6 @@ declare const container: HTMLElement; { const heatmap = h337.create({ container }); - heatmap.configure({}); // $ExpectError - // $ExpectType Heatmap<"value", "x", "y"> heatmap.configure({ container }); From ceb5223a75e4e7d3366d0209980a4c3c02a60525 Mon Sep 17 00:00:00 2001 From: Bryan Hughes Date: Sat, 18 Nov 2017 15:31:32 -0800 Subject: [PATCH 022/322] Added part of the Raspi IO ecosystem --- types/raspi-board/index.d.ts | 27 +++++++++++++++++++ types/raspi-board/raspi-board-tests.ts | 6 +++++ types/raspi-board/tsconfig.json | 23 ++++++++++++++++ types/raspi-board/tslint.json | 1 + types/raspi-peripheral/index.d.ts | 17 ++++++++++++ .../raspi-peripheral-tests.ts | 5 ++++ types/raspi-peripheral/tsconfig.json | 23 ++++++++++++++++ types/raspi-peripheral/tslint.json | 1 + types/raspi/index.d.ts | 7 +++++ types/raspi/raspi-tests.ts | 3 +++ types/raspi/tsconfig.json | 23 ++++++++++++++++ types/raspi/tslint.json | 1 + 12 files changed, 137 insertions(+) create mode 100644 types/raspi-board/index.d.ts create mode 100644 types/raspi-board/raspi-board-tests.ts create mode 100644 types/raspi-board/tsconfig.json create mode 100644 types/raspi-board/tslint.json create mode 100644 types/raspi-peripheral/index.d.ts create mode 100644 types/raspi-peripheral/raspi-peripheral-tests.ts create mode 100644 types/raspi-peripheral/tsconfig.json create mode 100644 types/raspi-peripheral/tslint.json create mode 100644 types/raspi/index.d.ts create mode 100644 types/raspi/raspi-tests.ts create mode 100644 types/raspi/tsconfig.json create mode 100644 types/raspi/tslint.json diff --git a/types/raspi-board/index.d.ts b/types/raspi-board/index.d.ts new file mode 100644 index 0000000000..a244577c2b --- /dev/null +++ b/types/raspi-board/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for raspi-board 5.0 +// Project: https://github.com/nebrius/raspi-board +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export const VERSION_1_MODEL_A = "rpi1_a"; +export const VERSION_1_MODEL_B_REV_1 = "rpi1_b1"; +export const VERSION_1_MODEL_B_REV_2 = "rpi1_b2"; +export const VERSION_1_MODEL_B_PLUS = "rpi1_bplus"; +export const VERSION_1_MODEL_A_PLUS = "rpi1_aplus"; +export const VERSION_1_MODEL_ZERO = "rpi1_zero"; +export const VERSION_1_MODEL_ZERO_W = "rpi1_zerow"; +export const VERSION_2_MODEL_B = "rpi2_b"; +export const VERSION_3_MODEL_B = "rpi3_b"; +export const VERSION_UNKNOWN = "unknown"; +export interface PinInfo { + pins: string[]; + peripherals: string[]; + gpio: number; +} +export function getBoardRevision(): string; +export function getPins(): { + [wiringpi: number]: PinInfo; +}; +export function getPinNumber(alias: string | number): number | null; +export function getGpioNumber(alias: string | number): number | null; diff --git a/types/raspi-board/raspi-board-tests.ts b/types/raspi-board/raspi-board-tests.ts new file mode 100644 index 0000000000..23195168cf --- /dev/null +++ b/types/raspi-board/raspi-board-tests.ts @@ -0,0 +1,6 @@ +import { getBoardRevision, getPins, getPinNumber, getGpioNumber } from 'raspi-board'; + +getBoardRevision(); +getPins(); +getPinNumber('GPIO18'); +getGpioNumber('GPIO18'); diff --git a/types/raspi-board/tsconfig.json b/types/raspi-board/tsconfig.json new file mode 100644 index 0000000000..a55a514726 --- /dev/null +++ b/types/raspi-board/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-board-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi-board/tslint.json b/types/raspi-board/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi-board/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/raspi-peripheral/index.d.ts b/types/raspi-peripheral/index.d.ts new file mode 100644 index 0000000000..d52ed3ec6c --- /dev/null +++ b/types/raspi-peripheral/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for raspi-peripheral 2.0 +// Project: https://github.com/nebrius/raspi-peripheral +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// +import { EventEmitter } from 'events'; +export class Peripheral extends EventEmitter { + private _alive; + readonly alive: boolean; + private _pins; + readonly pins: number[]; + constructor(pins: string | number | Array); + destroy(): void; + validateAlive(): void; +} diff --git a/types/raspi-peripheral/raspi-peripheral-tests.ts b/types/raspi-peripheral/raspi-peripheral-tests.ts new file mode 100644 index 0000000000..dc16f863a2 --- /dev/null +++ b/types/raspi-peripheral/raspi-peripheral-tests.ts @@ -0,0 +1,5 @@ +import { Peripheral } from 'raspi-peripheral'; + +const myPeripheral = new Peripheral('GPIO2'); +myPeripheral.alive; +myPeripheral.pins.filter((pin) => true); diff --git a/types/raspi-peripheral/tsconfig.json b/types/raspi-peripheral/tsconfig.json new file mode 100644 index 0000000000..4b24a67971 --- /dev/null +++ b/types/raspi-peripheral/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-peripheral-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi-peripheral/tslint.json b/types/raspi-peripheral/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi-peripheral/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/raspi/index.d.ts b/types/raspi/index.d.ts new file mode 100644 index 0000000000..9df97fe3cc --- /dev/null +++ b/types/raspi/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for raspi 5.0 +// Project: https://github.com/nebrius/raspi +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export function init(cb: () => void): void; diff --git a/types/raspi/raspi-tests.ts b/types/raspi/raspi-tests.ts new file mode 100644 index 0000000000..705aeacc31 --- /dev/null +++ b/types/raspi/raspi-tests.ts @@ -0,0 +1,3 @@ +import { init } from 'raspi'; + +init(() => {}); diff --git a/types/raspi/tsconfig.json b/types/raspi/tsconfig.json new file mode 100644 index 0000000000..6906d607cf --- /dev/null +++ b/types/raspi/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi/tslint.json b/types/raspi/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From f07f6a8da9a83b5a2246f2112dcb01156ed2323b Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Sun, 19 Nov 2017 12:51:25 +1100 Subject: [PATCH 023/322] heatmap.js: JSDoc Convert comments to JSDoc and add code examples. Remove "NOTE" on `getValueAt` which is redundant due to types. --- types/heatmap.js/index.d.ts | 189 +++++++++++++++++++++++++++--------- 1 file changed, 142 insertions(+), 47 deletions(-) diff --git a/types/heatmap.js/index.d.ts b/types/heatmap.js/index.d.ts index f97f83fc19..288d50b448 100644 --- a/types/heatmap.js/index.d.ts +++ b/types/heatmap.js/index.d.ts @@ -7,8 +7,40 @@ export as namespace h337; -/* +/** * Create a heatmap instance. A Heatmap can be customized with the configObject. + * + * @example Simple configuration with standard gradient + * + * // create configuration object + * var config = { + * container: document.getElementById('heatmapContainer'), + * radius: 10, + * maxOpacity: .5, + * minOpacity: 0, + * blur: .75 + * }; + * // create heatmap with configuration + * var heatmapInstance = h337.create(config); + * + * @example Custom gradient configuration + * + * // create configuration object + * var config = { + * container: document.getElementById('heatmapContainer'), + * radius: 10, + * maxOpacity: .5, + * minOpacity: 0, + * blur: .75, + * gradient: { + * // enter n keys between 0 and 1 here + * // for gradient color customization + * '.5': 'blue', + * '.8': 'red', + * '.95': 'white' + * } + * }; + * var heatmapInstance = h337.create(config); */ export function create< V extends string = 'value', @@ -20,46 +52,94 @@ export function create< export function register(pluginKey: string, plugin: any): void; -/* +/** * Heatmap instances are returned by h337.create. A heatmap instance has its own * internal datastore and renderer where you can manipulate data. As a result * the heatmap gets updated (either partially or completely, depending on * whether it's necessary). */ export class Heatmap { - /* + /** * Use this functionality only for adding datapoints on the fly, not for data * initialization! heatmapInstance.addData adds a single or multiple * datapoints to the heatmap's datastore. + * + * @example A single datapoint + * + * var dataPoint = { + * x: 5, // x coordinate of the datapoint, a number + * y: 5, // y coordinate of the datapoint, a number + * value: 100 // the value at datapoint(x, y) + * }; + * heatmapInstance.addData(dataPoint); + * + * @example multiple datapoints + * + * // for data initialization use setData!! + * var dataPoints = [dataPoint, dataPoint, dataPoint, dataPoint]; + * heatmapInstance.addData(dataPoints); */ addData(dataPoint: DataPoint | ReadonlyArray>): this; - /* + /** * Initialize a heatmap instance with the given dataset. Removes all * previously existing points from the heatmap instance and re-initializes * the datastore. + * + * @example + * + * var data = { + * max: 100, + * min: 0, + * data: [ + * dataPoint, dataPoint, dataPoint, dataPoint + * ] + * }; + * heatmapInstance.setData(data); */ setData(data: HeatmapData>): this; - /* + /** * Changes the upper bound of your dataset and triggers a complete * rerendering. + * + * @example + * + * heatmapInstance.setDataMax(200); + * // setting the maximum value triggers a complete rerendering of the heatmap + * heatmapInstance.setDataMax(100); */ setDataMax(number: number): this; - /* + /** * Changes the lower bound of your dataset and triggers a complete * rerendering. + * + * @example + * + * heatmapInstance.setDataMin(10); + * // setting the minimum value triggers a complete rerendering of the heatmap + * heatmapInstance.setDataMin(0); */ setDataMin(number: number): this; - /* + /** * Reconfigures a heatmap instance after it has been initialized. Triggers a * complete rerendering. * * NOTE: This returns a reference to itself, but also offers an opportunity * to change the `xField`, `yField` and `valueField` options, which can * change the type of the `Heatmap` instance. + * + * @example + * + * var nuConfig = { + * radius: 10, + * maxOpacity: .5, + * minOpacity: 0, + * blur: .75 + * }; + * heatmapInstance.configure(nuConfig); */ configure< Vn extends string = V, @@ -73,69 +153,84 @@ export class Heatmap { * The returned value is an interpolated value based on the gradient blending * if point is not in store. * - * NOTE: This function uses `x` and `y` instead of custom `xField` and - * `yField` + * @example + * + * heatmapInstance.addData({ x: 10, y: 10, value: 100}); + * // get the value at x=10, y=10 + * heatmapInstance.getValueAt({ x: 10, y: 10 }); // returns 100 */ getValueAt(point: Point<'x', 'y'>): number; - /* + /** * Returns a persistable and reimportable (with setData) JSON object. + * + * @example + * + * var currentData = heatmapInstance.getData(); + * // now let's create a new instance and set the data + * var heatmap2 = h337.create(config); + * heatmap2.setData(currentData); // now both heatmap instances have the same content */ getData(): HeatmapData; - /* + /** * Returns dataURL string. * * The returned value is the base64 encoded dataURL of the heatmap instance. + * + * @example + * + * heatmapInstance.getDataURL(); // data:image/png;base64... + * // ready for saving locally or on the server */ getDataURL(): string; - /* + /** * Repaints the whole heatmap canvas. */ repaint(): this; } export interface BaseHeatmapConfiguration { - /* + /** * A background color string in form of hexcode, color name, or rgb(a) */ backgroundColor?: string; - /* + /** * The blur factor that will be applied to all datapoints. The higher the * blur factor is, the smoother the gradients will be * Default value: 0.85 */ blur?: number; - /* + /** * An object that represents the gradient. * Syntax: {[key: number in range [0,1]]: color} */ gradient?: { [key: string]: string }; - /* + /** * The maximal opacity the highest value in the heatmap will have. (will be * overridden if opacity set) * Default value: 0.6 */ maxOpacity?: number; - /* + /** * The minimum opacity the lowest value in the heatmap will have (will be * overridden if opacity set) */ minOpacity?: number; - /* + /** * A global opacity for the whole heatmap. This overrides maxOpacity and * minOpacity if set * Default value: 0.6 */ opacity?: number; - /* + /** * The radius each datapoint will have (if not specified on the datapoint * itself) */ @@ -146,7 +241,7 @@ export interface BaseHeatmapConfiguration { */ scaleRadius?: boolean; - /* + /** * The property name of the value/weight in a datapoint * Default value: 'value' */ @@ -158,14 +253,14 @@ export interface BaseHeatmapConfiguration { */ onExtremaChange?: () => void; - /* + /** * Indicate whether the heatmap should use a global extrema or a local * extrema (the maximum and minimum of the currently displayed viewport) */ useLocalExtrema?: boolean; } -/* +/** * Configuration object of a heatmap */ export interface HeatmapConfiguration< @@ -173,19 +268,19 @@ export interface HeatmapConfiguration< X extends string = 'x', Y extends string = 'y', > extends BaseHeatmapConfiguration { - /* + /** * A DOM node where the heatmap canvas should be appended (heatmap will adapt to * the node's size) */ container: HTMLElement; - /* + /** * The property name of your x coordinate in a datapoint * Default value: 'x' */ xField?: X; - /* + /** * The property name of your y coordinate in a datapoint * Default value: 'y' */ @@ -197,26 +292,26 @@ export interface HeatmapOverlayConfiguration< TLat extends string = 'lat', TLong extends string = 'lng', > extends BaseHeatmapConfiguration { - /* + /** * The property name of your latitude coordinate in a datapoint * Default value: 'x' */ latField?: TLat; - /* + /** * The property name of your longitude coordinate in a datapoint * Default value: 'y' */ lngField?: TLong; } -/* +/** * A position in the heatmap. */ export type Point = Record; -/* +/** * A single data point on a heatmap. The interface of the data point can be * overridden by providing alternative values for `xKey` and `yKey` in the * config object. @@ -228,8 +323,8 @@ export type DataPoint< > = Record & Point; -/* - * Type of data returned by `Heatmap#getData`, which ignores custom `xField`, +/** + * Type of data returned by `Heatmap#hello`, which ignores custom `xField`, * `yField` and `valueField`. */ export interface DataCircle { @@ -239,21 +334,21 @@ export interface DataCircle { radius: number; } -/* +/** * An object representing the set of data points on a heatmap */ export interface HeatmapData { - /* + /** * An array of data points */ data: ReadonlyArray; - /* + /** * Max value of the valueField */ max: number; - /* + /** * Min value of the valueField */ min: number; @@ -264,7 +359,7 @@ export interface HeatmapData { import * as Leaflet from "leaflet"; declare global { - /* + /** * The overlay layer to be added onto leaflet map */ class HeatmapOverlay< @@ -272,31 +367,31 @@ declare global { TLat extends string, TLng extends string > implements Leaflet.ILayer { - /* + /** * Initialization function */ constructor(configuration: HeatmapOverlayConfiguration); - /* + /** * Initialize a heatmap instance with the given dataset */ setData(data: HeatmapData>): void; - /* + /** * Experimential... not ready. */ addData(data: DataPoint | ReadonlyArray>): void; - /* - * Create DOM elements for an overlay, adding them to map panes and puts - * listeners on relevant map events - */ + /** + * Create DOM elements for an overlay, adding them to map panes and puts + * listeners on relevant map events + */ onAdd(map: Leaflet.Map): void; - /* - * Remove the overlay's elements from the DOM and remove listeners - * previously added by onAdd() - */ + /** + * Remove the overlay's elements from the DOM and remove listeners + * previously added by onAdd() + */ onRemove(map: Leaflet.Map): void; } } From 3a88a0abc4fa65bcdc67cd0573ce294dc1bf78d8 Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Mon, 20 Nov 2017 22:15:10 +1100 Subject: [PATCH 024/322] heatmap.js: Remove `Point` type Inline type that is used in only one place. --- types/heatmap.js/index.d.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/types/heatmap.js/index.d.ts b/types/heatmap.js/index.d.ts index 288d50b448..265f17f5fb 100644 --- a/types/heatmap.js/index.d.ts +++ b/types/heatmap.js/index.d.ts @@ -159,7 +159,7 @@ export class Heatmap { * // get the value at x=10, y=10 * heatmapInstance.getValueAt({ x: 10, y: 10 }); // returns 100 */ - getValueAt(point: Point<'x', 'y'>): number; + getValueAt(point: { x: number, y: number }): number; /** * Returns a persistable and reimportable (with setData) JSON object. @@ -305,12 +305,6 @@ export interface HeatmapOverlayConfiguration< lngField?: TLong; } -/** - * A position in the heatmap. - */ -export type Point = - Record; - /** * A single data point on a heatmap. The interface of the data point can be * overridden by providing alternative values for `xKey` and `yKey` in the @@ -320,8 +314,7 @@ export type DataPoint< V extends string = 'value', X extends string = 'x', Y extends string = 'y', -> = - Record & Point; +> = Record; /** * Type of data returned by `Heatmap#hello`, which ignores custom `xField`, From 8813939634ce428363c432f9c3ef5837a0f91f90 Mon Sep 17 00:00:00 2001 From: allipierre Date: Mon, 20 Nov 2017 15:46:15 +0100 Subject: [PATCH 025/322] add optional Parameter to confirmOptions --- types/confirmDialog/index.d.ts | 98 ++++ types/confirmDialog/jquery-confirm.ts | 644 ++++++++++++++++++++++++++ types/confirmDialog/tsconfig.json | 21 + types/confirmDialog/tslint.json | 31 ++ 4 files changed, 794 insertions(+) create mode 100644 types/confirmDialog/index.d.ts create mode 100644 types/confirmDialog/jquery-confirm.ts create mode 100644 types/confirmDialog/tsconfig.json create mode 100644 types/confirmDialog/tslint.json diff --git a/types/confirmDialog/index.d.ts b/types/confirmDialog/index.d.ts new file mode 100644 index 0000000000..d205b45957 --- /dev/null +++ b/types/confirmDialog/index.d.ts @@ -0,0 +1,98 @@ +// Type definitions for jquery-confirm v3.3.0 https://craftpip.github.io/jquery-confirm/ +// Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js +// Definitions by: Alli Pierre Yotti https://github.com/allipierre +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface JQueryStatic { + /** + * confirm Dialog + * @param {confirmOptions} pOtions + */ + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + + /** + * confirm alert + * @param {any} pMessage + */ + alert( pMessage?: any | string, title?:string): void; + + /** + * confirm Dialog + * @param {any} pMessage + */ + dialog( pOtions: options.confirmOptions | string): void; +} + + +interface JQuery { + /** + * confirm Dialog + * @param {confirmOptions} pOtions + */ + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + + /** + * confirm alert + * @param {any} pMessage + */ + alert( pMessage?: any, title?:string): void; + + /** + * confirm Dialog + * @param {any} pMessage + */ + dialog( pOtions: options.confirmOptions | any): void; +} + +interface Window { + setContentAppend: any; +} + + + +declare namespace options { + + interface confirmOptions { + buttons? : buttonOptionss | any, + title? : string | boolean, + content? : string | Function, + onContentReady?: Function, + lazyOpen?: boolean, + closeIcon?: boolean | Function, + type?: string, + typeAnimated?: boolean, + icon?: string, + closeIconClass?: string, + columnClass?: string, + containerFluid?: boolean, + boxWidth?: string, + useBootstrap?: boolean, + bootstrapClasses?: any, + draggable?: boolean, + dragWindowBorder?: boolean, + dragWindowGap?: number, + contentLoaded?: Function, + autoClose?: String, + backgroundDismiss?: boolean | Function | string, + backgroundDismissAnimation?: string, + escapeKey?: string | boolean, + onOpenBefore?:Function, + onOpen?: Function, + onClose?: Function, + onDestroy?: Function, + onAction?: Function + + + } + + interface buttonOptionss { + cancel?: Function, + confirm?: Function + } + +} + +declare namespace jconfirm { + let defaults: any; + +} diff --git a/types/confirmDialog/jquery-confirm.ts b/types/confirmDialog/jquery-confirm.ts new file mode 100644 index 0000000000..109558a737 --- /dev/null +++ b/types/confirmDialog/jquery-confirm.ts @@ -0,0 +1,644 @@ +/// +/// +namespace server { + export interface Iperson { + title: string, + content: string, + + + } +} + +class Confirm implements server.Iperson { + private title_: string; + private conTent_: string; + constructor(public title: string, public content: string) { + this.title_ = title; + this.conTent_ = content; + } + + + public confirm() { + $.confirm({ + title: 'Confirm!', + content: 'Simple confirm!', + buttons: { + confirm: function() { + $.alert('Confirmed!'); + }, + cancel: function(cancel: string) { + $.alert('Canceled! ' + cancel); + }, + somethingElse: { + text: 'Something else', + btnClass: 'btn-blue', + keys: ['enter', 'shift'], + action: function() { + alert('Something else?'); + } + } + } + }); + } + + public alert() { + $.alert({ + title: 'Alert!', + content: 'Simple alert!', + }); + } + + public confirm1() { + $.confirm({ + title: 'Prompt!', + content: '' + + '

' + + '
' + + '' + + '' + + '
' + + '
', + buttons: { + formSubmit: { + text: 'Submit', + btnClass: 'btn-blue', + action: function() { + let name = this.$content.find('.name').val(); + if (!name) { + $.alert('provide a valid name'); + return false; + } + $.alert('Your name is ' + name); + } + }, + cancel: function() { + //close + }, + }, + onContentReady: function() { + // bind to events + var jc = this; + this.$content.find('form').on('submit', function(e) { + // if the user submits the form by pressing enter in the field. + e.preventDefault(); + jc.$$formSubmit.trigger('click'); // reference the button and click it + }); + } + }); + + } + + public dialog() { + $.dialog({ + title: 'Text content!', + content: 'Simple modal!' + }); + } + public confirm_2() { + $('.atwitter').val(); + $('.atwitter').text(); + $('a.twitter').confirm({ + content: "...", + }); + $('a.twitter').confirm({ + buttons: { + hey: function() { + location.href = this.$target.attr('href'); + } + } + }); + } + + public confirm_3() { + $.alert('Content here', 'Title here'); + $.confirm('A message', 'Title is optional'); + $.dialog('Just to let you know'); + } + + public confirm_4() { + var a = $.confirm({ + lazyOpen: true, + }); + a.open(); + a.close(); + a.toggle(); // toggle open close. + + } + + public confirm_5() { + $.confirm({ + buttons: { + hello: function(helloButton) { + // shorthand method to define a button + // the button key will be used as button name + }, + hey: function(heyButton) { + // access the button using jquery + this.$$hello.trigger('click'); // click the 'hello' button + this.$$hey.prop('disabled', true); // disable the current button using jquery method + + // jconfirm button methods, all methods listed here + this.buttons.hello.setText('Helloooo'); // setText for 'hello' button + this.buttons.hey.disable(); // disable with button function provided by jconfirm + this.buttons.hey.enable(); // enable with button function provided by jconfirm + // the button's instance is passed as the first argument, for quick access + heyButton === this.buttons.hey + }, + heyThere: { + text: 'Hey there!', // text for button + btnClass: 'btn-blue', // class for the button + keys: ['enter', 'a'], // keyboard event for button + isHidden: false, // initially not hidden + isDisabled: false, // initially not disabled + action: function(heyThereButton) { + // longhand method to define a button + // provides more features + } + }, + } + }); + + } + + public confirm_6() { + $.confirm({ + buttons: { + hey: function() { + // here the button key 'hey' will be used as the text. + $.alert('You clicked on "hey".'); + }, + heyThere: { + text: 'hey there!', // With spaces and symbols + action: function() { + $.alert('You clicked on "heyThere"'); + } + } + } + }); + } + + public confirm_7() { + $.confirm({ + content: 'Time to use your keyboard, press shift, alert, A or B', + buttons: { + specialKey: { + text: 'On behalf of shift', + keys: ['shift', 'alt'], + action: function() { + $.alert('Shift or Alt was pressed'); + } + }, + alphabet: { + text: 'A, B', + keys: ['a', 'b'], + action: function() { + $.alert('A or B was pressed'); + } + } + } + }); + } + + public confirm_8() { + $.confirm({ + closeIcon: true, // explicitly show the close icon + buttons: { + buttonA: { + text: 'button a', + action: function(buttonA) { + this.buttons.resetButton.setText('reset button!!!'); + this.buttons.resetButton.disable(); + this.buttons.resetButton.enable(); + this.buttons.resetButton.hide(); + this.buttons.resetButton.show(); + this.buttons.resetButton.addClass('btn-red'); + this.buttons.resetButton.removeClass('btn-red'); + // or + this.$$resetButton // button's jquery element reference, go crazy + this.buttons.buttonA == buttonA // both are the same. + return false; // prevent the modal from closing + } + }, + resetButton: function(resetButton) {} + } + }); + } + + + public confirm_9() { + $.confirm({ + title: 'Encountered an error!', + content: 'Something went downhill, this may be serious', + type: 'red', + typeAnimated: true, + buttons: { + tryAgain: { + text: 'Try again', + btnClass: 'btn-red', + action: function() {} + }, + close: function() {} + } + }); + } + + public confirm_10() { + $.confirm({ + icon: 'glyphicon glyphicon-heart', + title: 'glyphicon' + }); + $.confirm({ + icon: 'fa fa-warning', + title: 'font-awesome' + }); + $.confirm({ + icon: 'fa fa-spinner fa-spin', + title: 'Working!', + content: 'Sit back, we are processing your request!' + }); + } + + public confirm_11() { + $.confirm({ + closeIcon: true + }); + + $.confirm({ + closeIcon: true, + closeIconClass: 'fa fa-close' + }); + } + + public confirm_12() { + $.confirm({ + closeIcon: function() { + return false; + }, + buttons: { + aRandomButton: function() { + $.alert('A random button is called, and i prevent closing the modal'); + return false; // you shall not pass + }, + close: function() {} + } + }); + } + + public confirm_13() { + $.confirm({ + columnClass: 'small' + }); + $.confirm({ + columnClass: 'col-md-4 col-md-offset-4', + }); + $.confirm({ + columnClass: 'col-md-12' + }); + $.confirm({ + columnClass: 'col-md-4 col-md-offset-8 col-xs-4 col-xs-offset-8', + containerFluid: true, // this will add 'container-fluid' instead of 'container' + }); + } + + public confirm_14() { + $.confirm({ + boxWidth: '30%', + useBootstrap: false, + }); + $.confirm({ + boxWidth: '500px', + useBootstrap: false, + }); + } + + public confirm_15() { + $.confirm({ + bootstrapClasses: { + container: 'container', + containerFluid: 'container-fluid', + row: 'row', + }, + }); + + $.confirm({ + title: 'Hello there', + content: 'click and hold on the title to drag', + draggable: true, + }); + + $.confirm({ + title: 'Hello there', + content: 'Drag this modal out of the window', + draggable: true, + dragWindowBorder: false, + }); + $.confirm({ + title: 'Hello there', + content: 'try to drag this modal out of the window', + draggable: true, + dragWindowGap: 0, // number of px of distance + }); + } + + public ajaxLoading() { + $.confirm({ + title: 'Title', + content: 'url:text.txt', + onContentReady: function() { + var self = this; + this.setContentPrepend('
Prepended text
'); + setTimeout(function() { + self.setContentAppend('
Appended text after 2 seconds
'); + }, 2000); + }, + columnClass: 'medium', + }); + + $.confirm({ + content: function() { + var self = this; + return $.ajax({ + url: 'bower.json', + dataType: 'json', + method: 'get' + }).done(function(response) { + self.setContent('Description: ' + response.description); + self.setContentAppend('
Version: ' + response.version); + self.setTitle(response.name); + }).fail(function() { + self.setContent('Something went wrong.'); + }); + } + }); + + $.confirm({ + content: 'url:text.txt', + contentLoaded: function(data, status, xhr) { + // data is already set in content + this.setContentAppend('
Status: ' + status); + } + }); + + $.confirm({ + content: function() { + var self = this; + self.setContent('Checking callback flow'); + return $.ajax({ + url: 'bower.json', + dataType: 'json', + method: 'get' + }).done(function(response) { + self.setContentAppend('
Done!
'); + }).fail(function() { + self.setContentAppend('
Fail!
'); + }).always(function() { + self.setContentAppend('
Always!
'); + }); + }, + contentLoaded: function(data, status, xhr) { + self.setContentAppend('
Content loaded!
'); + }, + onContentReady: function() { + this.setContentAppend('
Content ready!
'); + } + }); + + } + + public autoClose() { + $.confirm({ + title: 'Delete user?', + content: 'This dialog will automatically trigger \'cancel\' in 6 seconds if you don\'t respond.', + autoClose: 'cancelAction|8000', + buttons: { + deleteUser: { + text: 'delete user', + action: function() { + $.alert('Deleted the user!'); + } + }, + cancelAction: function() { + $.alert('action is canceled'); + } + } + }); + $.confirm({ + title: 'Logout?', + content: 'Your time is out, you will be automatically logged out in 10 seconds.', + autoClose: 'logoutUser|10000', + buttons: { + logoutUser: { + text: 'logout myself', + action: function() { + $.alert('The user was logged out'); + } + }, + cancel: function() { + $.alert('canceled'); + } + } + }); + } + + public backgroundDismisse() { + $.confirm({ + backgroundDismiss: true, // this will just close the modal + }); + $.confirm({ + backgroundDismiss: function() { + return false; // modal wont close. + }, + }); + $.confirm({ + backgroundDismiss: function() { + return 'buttonName'; // the button will handle it + }, + }); + $.confirm({ + backgroundDismiss: 'buttonName', + content: 'in here the backgroundDismiss action is handled by buttonName' + + '
', + buttons: { + buttonName: function() { + var $checkbox = this.$content.find('#enableCheckbox'); + return $checkbox.prop('checked'); + }, + close: function() {} + } + }); + } + + public backgroundDismisseAnimation(){ + $.confirm({ + backgroundDismiss: false, + backgroundDismissAnimation: 'shake', +}); +$.confirm({ + backgroundDismiss: false, + backgroundDismissAnimation: 'glow', +}); + } + + public escapeKey(){ + $.confirm({ + escapeKey: true, + backgroundDismiss: false, +}); +$.confirm({ + escapeKey: 'buttonName', + buttons: { + buttonName: function(){ + $.alert('Button name was called'); + }, + close: function(){ + } + } +}); + } + public rtlSupport(){ + $.alert({ + title: 'پیغام', + content: 'این یک متن به زبان شیرین فارسی است', + rtl: true, + closeIcon: true, + buttons: { + confirm: { + text: 'تایید', + btnClass: 'btn-blue', + action: function () { + $.alert('تایید شد.'); + } + }, + cancel: { + text: 'انصراف', + action: function () { + } + } + } +}); + + } + + public callBack(){ + $.confirm({ + title: false, + content: 'url:callback.html', + onContentReady: function () { + // when content is fetched & rendered in DOM + alert('onContentReady'); + var self = this; + this.buttons.ok.disable(); + this.$content.find('.btn').click(function(){ + self.$content.find('input').val('Chuck norris'); + self.buttons.ok.enable(); + }); + }, + contentLoaded: function(data, status, xhr){ + // when content is fetched + alert('contentLoaded: ' + status); + }, + onOpenBefore: function () { + // before the modal is displayed. + alert('onOpenBefore'); + }, + onOpen: function () { + // after the modal is displayed. + alert('onOpen'); + }, + onClose: function () { + // before the modal is hidden. + alert('onClose'); + }, + onDestroy: function () { + // when the modal is removed from DOM + alert('onDestroy'); + }, + onAction: function (btnName) { + // when a button is clicked, with the button name + alert('onAction: ' + btnName); + }, + buttons: { + ok: function(){ + } + } +}); + } + public globalSettings(){ + jconfirm.defaults = { + title: 'Hello', + titleClass: '', + type: 'default', + typeAnimated: true, + draggable: true, + dragWindowGap: 15, + dragWindowBorder: true, + animateFromElement: true, + smoothContent: true, + content: 'Are you sure to continue?', + buttons: {}, + defaultButtons: { + ok: { + action: function () { + } + }, + close: { + action: function () { + } + }, + }, + contentLoaded: function(data, status, xhr){ + }, + icon: '', + lazyOpen: false, + bgOpacity: null, + theme: 'light', + animation: 'scale', + closeAnimation: 'scale', + animationSpeed: 400, + animationBounce: 1, + rtl: false, + container: 'body', + containerFluid: false, + backgroundDismiss: false, + backgroundDismissAnimation: 'shake', + autoClose: false, + closeIcon: null, + closeIconClass: false, + watchInterval: 100, + columnClass: 'col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1', + boxWidth: '50%', + scrollToPreviousElement: true, + scrollToPreviousElementAnimate: true, + useBootstrap: true, + offsetTop: 40, + offsetBottom: 40, + bootstrapClasses: { + container: 'container', + containerFluid: 'container-fluid', + row: 'row', + }, + onContentReady: function () {}, + onOpenBefore: function () {}, + onOpen: function () {}, + onClose: function () {}, + onDestroy: function () {}, + onAction: function () {} +}; + } + + public api(){ + var jc = $.confirm({ + title: 'awesome', + onContentReady: function(){ + // this === jc + //jc.setTitle(title: string); + } +}); + } + +} + + +var firstName: string = 'Pierre'; +var lastName: string = 'Yotti'; +var type = new Confirm(firstName, lastName); diff --git a/types/confirmDialog/tsconfig.json b/types/confirmDialog/tsconfig.json new file mode 100644 index 0000000000..6949afdda5 --- /dev/null +++ b/types/confirmDialog/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "types", + "typeRoots": ["types"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery_confirm.ts" + ] +} diff --git a/types/confirmDialog/tslint.json b/types/confirmDialog/tslint.json new file mode 100644 index 0000000000..2f73ea817c --- /dev/null +++ b/types/confirmDialog/tslint.json @@ -0,0 +1,31 @@ +{ + "rules": { + "max-line-length": { + "options": [ + 120 + ] + }, + "new-parens": true, + "no-arg": true, + "no-bitwise": true, + "no-conditional-assignment": true, + "no-consecutive-blank-lines": false, + "no-console": { + "options": [ + "debug", + "info", + "log", + "time", + "timeEnd", + "trace" + ] + } + }, + "jsRules": { + "max-line-length": { + "options": [ + 120 + ] + } + } +} From e01be3c7700e3544cc907fd443ff48b4b234803c Mon Sep 17 00:00:00 2001 From: allipierre Date: Mon, 20 Nov 2017 16:01:57 +0100 Subject: [PATCH 026/322] add optional Parameter to confirmOptions --- types/confirmDialog/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/confirmDialog/index.d.ts b/types/confirmDialog/index.d.ts index d205b45957..417a299618 100644 --- a/types/confirmDialog/index.d.ts +++ b/types/confirmDialog/index.d.ts @@ -5,7 +5,7 @@ interface JQueryStatic { /** - * confirm Dialog + * jquery confirm Dialog * @param {confirmOptions} pOtions */ confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; From 966fb905c89979fabc1480ad959c813e137a3594 Mon Sep 17 00:00:00 2001 From: allipierre Date: Mon, 20 Nov 2017 16:10:05 +0100 Subject: [PATCH 027/322] add optional Parameter to confirmOptions --- types/confirmDialog/index.d.ts | 98 ---- types/confirmDialog/jquery-confirm.ts | 644 -------------------------- types/confirmDialog/tsconfig.json | 21 - types/confirmDialog/tslint.json | 31 -- 4 files changed, 794 deletions(-) delete mode 100644 types/confirmDialog/index.d.ts delete mode 100644 types/confirmDialog/jquery-confirm.ts delete mode 100644 types/confirmDialog/tsconfig.json delete mode 100644 types/confirmDialog/tslint.json diff --git a/types/confirmDialog/index.d.ts b/types/confirmDialog/index.d.ts deleted file mode 100644 index 417a299618..0000000000 --- a/types/confirmDialog/index.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -// Type definitions for jquery-confirm v3.3.0 https://craftpip.github.io/jquery-confirm/ -// Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js -// Definitions by: Alli Pierre Yotti https://github.com/allipierre -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface JQueryStatic { - /** - * jquery confirm Dialog - * @param {confirmOptions} pOtions - */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; - - /** - * confirm alert - * @param {any} pMessage - */ - alert( pMessage?: any | string, title?:string): void; - - /** - * confirm Dialog - * @param {any} pMessage - */ - dialog( pOtions: options.confirmOptions | string): void; -} - - -interface JQuery { - /** - * confirm Dialog - * @param {confirmOptions} pOtions - */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; - - /** - * confirm alert - * @param {any} pMessage - */ - alert( pMessage?: any, title?:string): void; - - /** - * confirm Dialog - * @param {any} pMessage - */ - dialog( pOtions: options.confirmOptions | any): void; -} - -interface Window { - setContentAppend: any; -} - - - -declare namespace options { - - interface confirmOptions { - buttons? : buttonOptionss | any, - title? : string | boolean, - content? : string | Function, - onContentReady?: Function, - lazyOpen?: boolean, - closeIcon?: boolean | Function, - type?: string, - typeAnimated?: boolean, - icon?: string, - closeIconClass?: string, - columnClass?: string, - containerFluid?: boolean, - boxWidth?: string, - useBootstrap?: boolean, - bootstrapClasses?: any, - draggable?: boolean, - dragWindowBorder?: boolean, - dragWindowGap?: number, - contentLoaded?: Function, - autoClose?: String, - backgroundDismiss?: boolean | Function | string, - backgroundDismissAnimation?: string, - escapeKey?: string | boolean, - onOpenBefore?:Function, - onOpen?: Function, - onClose?: Function, - onDestroy?: Function, - onAction?: Function - - - } - - interface buttonOptionss { - cancel?: Function, - confirm?: Function - } - -} - -declare namespace jconfirm { - let defaults: any; - -} diff --git a/types/confirmDialog/jquery-confirm.ts b/types/confirmDialog/jquery-confirm.ts deleted file mode 100644 index 109558a737..0000000000 --- a/types/confirmDialog/jquery-confirm.ts +++ /dev/null @@ -1,644 +0,0 @@ -/// -/// -namespace server { - export interface Iperson { - title: string, - content: string, - - - } -} - -class Confirm implements server.Iperson { - private title_: string; - private conTent_: string; - constructor(public title: string, public content: string) { - this.title_ = title; - this.conTent_ = content; - } - - - public confirm() { - $.confirm({ - title: 'Confirm!', - content: 'Simple confirm!', - buttons: { - confirm: function() { - $.alert('Confirmed!'); - }, - cancel: function(cancel: string) { - $.alert('Canceled! ' + cancel); - }, - somethingElse: { - text: 'Something else', - btnClass: 'btn-blue', - keys: ['enter', 'shift'], - action: function() { - alert('Something else?'); - } - } - } - }); - } - - public alert() { - $.alert({ - title: 'Alert!', - content: 'Simple alert!', - }); - } - - public confirm1() { - $.confirm({ - title: 'Prompt!', - content: '' + - '
' + - '
' + - '' + - '' + - '
' + - '
', - buttons: { - formSubmit: { - text: 'Submit', - btnClass: 'btn-blue', - action: function() { - let name = this.$content.find('.name').val(); - if (!name) { - $.alert('provide a valid name'); - return false; - } - $.alert('Your name is ' + name); - } - }, - cancel: function() { - //close - }, - }, - onContentReady: function() { - // bind to events - var jc = this; - this.$content.find('form').on('submit', function(e) { - // if the user submits the form by pressing enter in the field. - e.preventDefault(); - jc.$$formSubmit.trigger('click'); // reference the button and click it - }); - } - }); - - } - - public dialog() { - $.dialog({ - title: 'Text content!', - content: 'Simple modal!' - }); - } - public confirm_2() { - $('.atwitter').val(); - $('.atwitter').text(); - $('a.twitter').confirm({ - content: "...", - }); - $('a.twitter').confirm({ - buttons: { - hey: function() { - location.href = this.$target.attr('href'); - } - } - }); - } - - public confirm_3() { - $.alert('Content here', 'Title here'); - $.confirm('A message', 'Title is optional'); - $.dialog('Just to let you know'); - } - - public confirm_4() { - var a = $.confirm({ - lazyOpen: true, - }); - a.open(); - a.close(); - a.toggle(); // toggle open close. - - } - - public confirm_5() { - $.confirm({ - buttons: { - hello: function(helloButton) { - // shorthand method to define a button - // the button key will be used as button name - }, - hey: function(heyButton) { - // access the button using jquery - this.$$hello.trigger('click'); // click the 'hello' button - this.$$hey.prop('disabled', true); // disable the current button using jquery method - - // jconfirm button methods, all methods listed here - this.buttons.hello.setText('Helloooo'); // setText for 'hello' button - this.buttons.hey.disable(); // disable with button function provided by jconfirm - this.buttons.hey.enable(); // enable with button function provided by jconfirm - // the button's instance is passed as the first argument, for quick access - heyButton === this.buttons.hey - }, - heyThere: { - text: 'Hey there!', // text for button - btnClass: 'btn-blue', // class for the button - keys: ['enter', 'a'], // keyboard event for button - isHidden: false, // initially not hidden - isDisabled: false, // initially not disabled - action: function(heyThereButton) { - // longhand method to define a button - // provides more features - } - }, - } - }); - - } - - public confirm_6() { - $.confirm({ - buttons: { - hey: function() { - // here the button key 'hey' will be used as the text. - $.alert('You clicked on "hey".'); - }, - heyThere: { - text: 'hey there!', // With spaces and symbols - action: function() { - $.alert('You clicked on "heyThere"'); - } - } - } - }); - } - - public confirm_7() { - $.confirm({ - content: 'Time to use your keyboard, press shift, alert, A or B', - buttons: { - specialKey: { - text: 'On behalf of shift', - keys: ['shift', 'alt'], - action: function() { - $.alert('Shift or Alt was pressed'); - } - }, - alphabet: { - text: 'A, B', - keys: ['a', 'b'], - action: function() { - $.alert('A or B was pressed'); - } - } - } - }); - } - - public confirm_8() { - $.confirm({ - closeIcon: true, // explicitly show the close icon - buttons: { - buttonA: { - text: 'button a', - action: function(buttonA) { - this.buttons.resetButton.setText('reset button!!!'); - this.buttons.resetButton.disable(); - this.buttons.resetButton.enable(); - this.buttons.resetButton.hide(); - this.buttons.resetButton.show(); - this.buttons.resetButton.addClass('btn-red'); - this.buttons.resetButton.removeClass('btn-red'); - // or - this.$$resetButton // button's jquery element reference, go crazy - this.buttons.buttonA == buttonA // both are the same. - return false; // prevent the modal from closing - } - }, - resetButton: function(resetButton) {} - } - }); - } - - - public confirm_9() { - $.confirm({ - title: 'Encountered an error!', - content: 'Something went downhill, this may be serious', - type: 'red', - typeAnimated: true, - buttons: { - tryAgain: { - text: 'Try again', - btnClass: 'btn-red', - action: function() {} - }, - close: function() {} - } - }); - } - - public confirm_10() { - $.confirm({ - icon: 'glyphicon glyphicon-heart', - title: 'glyphicon' - }); - $.confirm({ - icon: 'fa fa-warning', - title: 'font-awesome' - }); - $.confirm({ - icon: 'fa fa-spinner fa-spin', - title: 'Working!', - content: 'Sit back, we are processing your request!' - }); - } - - public confirm_11() { - $.confirm({ - closeIcon: true - }); - - $.confirm({ - closeIcon: true, - closeIconClass: 'fa fa-close' - }); - } - - public confirm_12() { - $.confirm({ - closeIcon: function() { - return false; - }, - buttons: { - aRandomButton: function() { - $.alert('A random button is called, and i prevent closing the modal'); - return false; // you shall not pass - }, - close: function() {} - } - }); - } - - public confirm_13() { - $.confirm({ - columnClass: 'small' - }); - $.confirm({ - columnClass: 'col-md-4 col-md-offset-4', - }); - $.confirm({ - columnClass: 'col-md-12' - }); - $.confirm({ - columnClass: 'col-md-4 col-md-offset-8 col-xs-4 col-xs-offset-8', - containerFluid: true, // this will add 'container-fluid' instead of 'container' - }); - } - - public confirm_14() { - $.confirm({ - boxWidth: '30%', - useBootstrap: false, - }); - $.confirm({ - boxWidth: '500px', - useBootstrap: false, - }); - } - - public confirm_15() { - $.confirm({ - bootstrapClasses: { - container: 'container', - containerFluid: 'container-fluid', - row: 'row', - }, - }); - - $.confirm({ - title: 'Hello there', - content: 'click and hold on the title to drag', - draggable: true, - }); - - $.confirm({ - title: 'Hello there', - content: 'Drag this modal out of the window', - draggable: true, - dragWindowBorder: false, - }); - $.confirm({ - title: 'Hello there', - content: 'try to drag this modal out of the window', - draggable: true, - dragWindowGap: 0, // number of px of distance - }); - } - - public ajaxLoading() { - $.confirm({ - title: 'Title', - content: 'url:text.txt', - onContentReady: function() { - var self = this; - this.setContentPrepend('
Prepended text
'); - setTimeout(function() { - self.setContentAppend('
Appended text after 2 seconds
'); - }, 2000); - }, - columnClass: 'medium', - }); - - $.confirm({ - content: function() { - var self = this; - return $.ajax({ - url: 'bower.json', - dataType: 'json', - method: 'get' - }).done(function(response) { - self.setContent('Description: ' + response.description); - self.setContentAppend('
Version: ' + response.version); - self.setTitle(response.name); - }).fail(function() { - self.setContent('Something went wrong.'); - }); - } - }); - - $.confirm({ - content: 'url:text.txt', - contentLoaded: function(data, status, xhr) { - // data is already set in content - this.setContentAppend('
Status: ' + status); - } - }); - - $.confirm({ - content: function() { - var self = this; - self.setContent('Checking callback flow'); - return $.ajax({ - url: 'bower.json', - dataType: 'json', - method: 'get' - }).done(function(response) { - self.setContentAppend('
Done!
'); - }).fail(function() { - self.setContentAppend('
Fail!
'); - }).always(function() { - self.setContentAppend('
Always!
'); - }); - }, - contentLoaded: function(data, status, xhr) { - self.setContentAppend('
Content loaded!
'); - }, - onContentReady: function() { - this.setContentAppend('
Content ready!
'); - } - }); - - } - - public autoClose() { - $.confirm({ - title: 'Delete user?', - content: 'This dialog will automatically trigger \'cancel\' in 6 seconds if you don\'t respond.', - autoClose: 'cancelAction|8000', - buttons: { - deleteUser: { - text: 'delete user', - action: function() { - $.alert('Deleted the user!'); - } - }, - cancelAction: function() { - $.alert('action is canceled'); - } - } - }); - $.confirm({ - title: 'Logout?', - content: 'Your time is out, you will be automatically logged out in 10 seconds.', - autoClose: 'logoutUser|10000', - buttons: { - logoutUser: { - text: 'logout myself', - action: function() { - $.alert('The user was logged out'); - } - }, - cancel: function() { - $.alert('canceled'); - } - } - }); - } - - public backgroundDismisse() { - $.confirm({ - backgroundDismiss: true, // this will just close the modal - }); - $.confirm({ - backgroundDismiss: function() { - return false; // modal wont close. - }, - }); - $.confirm({ - backgroundDismiss: function() { - return 'buttonName'; // the button will handle it - }, - }); - $.confirm({ - backgroundDismiss: 'buttonName', - content: 'in here the backgroundDismiss action is handled by buttonName' + - '
', - buttons: { - buttonName: function() { - var $checkbox = this.$content.find('#enableCheckbox'); - return $checkbox.prop('checked'); - }, - close: function() {} - } - }); - } - - public backgroundDismisseAnimation(){ - $.confirm({ - backgroundDismiss: false, - backgroundDismissAnimation: 'shake', -}); -$.confirm({ - backgroundDismiss: false, - backgroundDismissAnimation: 'glow', -}); - } - - public escapeKey(){ - $.confirm({ - escapeKey: true, - backgroundDismiss: false, -}); -$.confirm({ - escapeKey: 'buttonName', - buttons: { - buttonName: function(){ - $.alert('Button name was called'); - }, - close: function(){ - } - } -}); - } - public rtlSupport(){ - $.alert({ - title: 'پیغام', - content: 'این یک متن به زبان شیرین فارسی است', - rtl: true, - closeIcon: true, - buttons: { - confirm: { - text: 'تایید', - btnClass: 'btn-blue', - action: function () { - $.alert('تایید شد.'); - } - }, - cancel: { - text: 'انصراف', - action: function () { - } - } - } -}); - - } - - public callBack(){ - $.confirm({ - title: false, - content: 'url:callback.html', - onContentReady: function () { - // when content is fetched & rendered in DOM - alert('onContentReady'); - var self = this; - this.buttons.ok.disable(); - this.$content.find('.btn').click(function(){ - self.$content.find('input').val('Chuck norris'); - self.buttons.ok.enable(); - }); - }, - contentLoaded: function(data, status, xhr){ - // when content is fetched - alert('contentLoaded: ' + status); - }, - onOpenBefore: function () { - // before the modal is displayed. - alert('onOpenBefore'); - }, - onOpen: function () { - // after the modal is displayed. - alert('onOpen'); - }, - onClose: function () { - // before the modal is hidden. - alert('onClose'); - }, - onDestroy: function () { - // when the modal is removed from DOM - alert('onDestroy'); - }, - onAction: function (btnName) { - // when a button is clicked, with the button name - alert('onAction: ' + btnName); - }, - buttons: { - ok: function(){ - } - } -}); - } - public globalSettings(){ - jconfirm.defaults = { - title: 'Hello', - titleClass: '', - type: 'default', - typeAnimated: true, - draggable: true, - dragWindowGap: 15, - dragWindowBorder: true, - animateFromElement: true, - smoothContent: true, - content: 'Are you sure to continue?', - buttons: {}, - defaultButtons: { - ok: { - action: function () { - } - }, - close: { - action: function () { - } - }, - }, - contentLoaded: function(data, status, xhr){ - }, - icon: '', - lazyOpen: false, - bgOpacity: null, - theme: 'light', - animation: 'scale', - closeAnimation: 'scale', - animationSpeed: 400, - animationBounce: 1, - rtl: false, - container: 'body', - containerFluid: false, - backgroundDismiss: false, - backgroundDismissAnimation: 'shake', - autoClose: false, - closeIcon: null, - closeIconClass: false, - watchInterval: 100, - columnClass: 'col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1', - boxWidth: '50%', - scrollToPreviousElement: true, - scrollToPreviousElementAnimate: true, - useBootstrap: true, - offsetTop: 40, - offsetBottom: 40, - bootstrapClasses: { - container: 'container', - containerFluid: 'container-fluid', - row: 'row', - }, - onContentReady: function () {}, - onOpenBefore: function () {}, - onOpen: function () {}, - onClose: function () {}, - onDestroy: function () {}, - onAction: function () {} -}; - } - - public api(){ - var jc = $.confirm({ - title: 'awesome', - onContentReady: function(){ - // this === jc - //jc.setTitle(title: string); - } -}); - } - -} - - -var firstName: string = 'Pierre'; -var lastName: string = 'Yotti'; -var type = new Confirm(firstName, lastName); diff --git a/types/confirmDialog/tsconfig.json b/types/confirmDialog/tsconfig.json deleted file mode 100644 index 6949afdda5..0000000000 --- a/types/confirmDialog/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "types", - "typeRoots": ["types"], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "jquery_confirm.ts" - ] -} diff --git a/types/confirmDialog/tslint.json b/types/confirmDialog/tslint.json deleted file mode 100644 index 2f73ea817c..0000000000 --- a/types/confirmDialog/tslint.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "rules": { - "max-line-length": { - "options": [ - 120 - ] - }, - "new-parens": true, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": { - "options": [ - "debug", - "info", - "log", - "time", - "timeEnd", - "trace" - ] - } - }, - "jsRules": { - "max-line-length": { - "options": [ - 120 - ] - } - } -} From 77ceb8cd3835f63eeb3d45b97337ec7502860140 Mon Sep 17 00:00:00 2001 From: allipierre Date: Mon, 20 Nov 2017 16:11:02 +0100 Subject: [PATCH 028/322] add optional Parameter to confirmOptions --- types/confirmdialog/index.d.ts | 98 ++++ types/confirmdialog/jquery-confirm.ts | 644 ++++++++++++++++++++++++++ types/confirmdialog/tsconfig.json | 21 + types/confirmdialog/tslint.json | 31 ++ 4 files changed, 794 insertions(+) create mode 100644 types/confirmdialog/index.d.ts create mode 100644 types/confirmdialog/jquery-confirm.ts create mode 100644 types/confirmdialog/tsconfig.json create mode 100644 types/confirmdialog/tslint.json diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts new file mode 100644 index 0000000000..8ab3145c32 --- /dev/null +++ b/types/confirmdialog/index.d.ts @@ -0,0 +1,98 @@ +// Type definitions for jquery-confirm v3.3.0 https://craftpip.github.io/jquery-confirm/ +// Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js +// Definitions by: Alli Pierre Yotti https://github.com/allipierre +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface JQueryStatic { + /** + * confirm Dialog + * @param {confirmOptions} pOtions + */ + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + + /** + * confirm alert + * @param {any} pMessage + */ + alert( pMessage?: any | string, title?:string): void; + + /** + * confirm Dialog + * @param {any} pMessage + */ + dialog( pOtions: options.confirmOptions | string): void; +} + + +interface JQuery { + /** + * confirm Dialog + * @param {confirmOptions} pOtions + */ + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + + /** + * confirm alert + * @param {any} pMessage + */ + alert( pMessage?: any, title?:string): void; + + /** + * confirm Dialog + * @param {any} pMessage + */ + dialog( pOtions: options.confirmOptions | any): void; +} + +interface Window { + setContentAppend: any; +} + + + +declare namespace options { + + interface confirmOptions { + buttons? : buttonOptionss | any, + title? : string | boolean, + content? : string | Function, + onContentReady?: Function, + lazyOpen?: boolean, + closeIcon?: boolean | Function, + type?: string, + typeAnimated?: boolean, + icon?: string, + closeIconClass?: string, + columnClass?: string, + containerFluid?: boolean, + boxWidth?: string, + useBootstrap?: boolean, + bootstrapClasses?: any, + draggable?: boolean, + dragWindowBorder?: boolean, + dragWindowGap?: number, + contentLoaded?: Function, + autoClose?: String, + backgroundDismiss?: boolean | Function | string, + backgroundDismissAnimation?: string, + escapeKey?: string | boolean, + onOpenBefore?:Function, + onOpen?: Function, + onClose?: Function, + onDestroy?: Function, + onAction?: Function + + + } + + interface buttonOptionss { + cancel?: Function, + confirm?: Function + } + +} + +declare namespace jconfirm { + let defaults: any; + +} diff --git a/types/confirmdialog/jquery-confirm.ts b/types/confirmdialog/jquery-confirm.ts new file mode 100644 index 0000000000..109558a737 --- /dev/null +++ b/types/confirmdialog/jquery-confirm.ts @@ -0,0 +1,644 @@ +/// +/// +namespace server { + export interface Iperson { + title: string, + content: string, + + + } +} + +class Confirm implements server.Iperson { + private title_: string; + private conTent_: string; + constructor(public title: string, public content: string) { + this.title_ = title; + this.conTent_ = content; + } + + + public confirm() { + $.confirm({ + title: 'Confirm!', + content: 'Simple confirm!', + buttons: { + confirm: function() { + $.alert('Confirmed!'); + }, + cancel: function(cancel: string) { + $.alert('Canceled! ' + cancel); + }, + somethingElse: { + text: 'Something else', + btnClass: 'btn-blue', + keys: ['enter', 'shift'], + action: function() { + alert('Something else?'); + } + } + } + }); + } + + public alert() { + $.alert({ + title: 'Alert!', + content: 'Simple alert!', + }); + } + + public confirm1() { + $.confirm({ + title: 'Prompt!', + content: '' + + '
' + + '
' + + '' + + '' + + '
' + + '
', + buttons: { + formSubmit: { + text: 'Submit', + btnClass: 'btn-blue', + action: function() { + let name = this.$content.find('.name').val(); + if (!name) { + $.alert('provide a valid name'); + return false; + } + $.alert('Your name is ' + name); + } + }, + cancel: function() { + //close + }, + }, + onContentReady: function() { + // bind to events + var jc = this; + this.$content.find('form').on('submit', function(e) { + // if the user submits the form by pressing enter in the field. + e.preventDefault(); + jc.$$formSubmit.trigger('click'); // reference the button and click it + }); + } + }); + + } + + public dialog() { + $.dialog({ + title: 'Text content!', + content: 'Simple modal!' + }); + } + public confirm_2() { + $('.atwitter').val(); + $('.atwitter').text(); + $('a.twitter').confirm({ + content: "...", + }); + $('a.twitter').confirm({ + buttons: { + hey: function() { + location.href = this.$target.attr('href'); + } + } + }); + } + + public confirm_3() { + $.alert('Content here', 'Title here'); + $.confirm('A message', 'Title is optional'); + $.dialog('Just to let you know'); + } + + public confirm_4() { + var a = $.confirm({ + lazyOpen: true, + }); + a.open(); + a.close(); + a.toggle(); // toggle open close. + + } + + public confirm_5() { + $.confirm({ + buttons: { + hello: function(helloButton) { + // shorthand method to define a button + // the button key will be used as button name + }, + hey: function(heyButton) { + // access the button using jquery + this.$$hello.trigger('click'); // click the 'hello' button + this.$$hey.prop('disabled', true); // disable the current button using jquery method + + // jconfirm button methods, all methods listed here + this.buttons.hello.setText('Helloooo'); // setText for 'hello' button + this.buttons.hey.disable(); // disable with button function provided by jconfirm + this.buttons.hey.enable(); // enable with button function provided by jconfirm + // the button's instance is passed as the first argument, for quick access + heyButton === this.buttons.hey + }, + heyThere: { + text: 'Hey there!', // text for button + btnClass: 'btn-blue', // class for the button + keys: ['enter', 'a'], // keyboard event for button + isHidden: false, // initially not hidden + isDisabled: false, // initially not disabled + action: function(heyThereButton) { + // longhand method to define a button + // provides more features + } + }, + } + }); + + } + + public confirm_6() { + $.confirm({ + buttons: { + hey: function() { + // here the button key 'hey' will be used as the text. + $.alert('You clicked on "hey".'); + }, + heyThere: { + text: 'hey there!', // With spaces and symbols + action: function() { + $.alert('You clicked on "heyThere"'); + } + } + } + }); + } + + public confirm_7() { + $.confirm({ + content: 'Time to use your keyboard, press shift, alert, A or B', + buttons: { + specialKey: { + text: 'On behalf of shift', + keys: ['shift', 'alt'], + action: function() { + $.alert('Shift or Alt was pressed'); + } + }, + alphabet: { + text: 'A, B', + keys: ['a', 'b'], + action: function() { + $.alert('A or B was pressed'); + } + } + } + }); + } + + public confirm_8() { + $.confirm({ + closeIcon: true, // explicitly show the close icon + buttons: { + buttonA: { + text: 'button a', + action: function(buttonA) { + this.buttons.resetButton.setText('reset button!!!'); + this.buttons.resetButton.disable(); + this.buttons.resetButton.enable(); + this.buttons.resetButton.hide(); + this.buttons.resetButton.show(); + this.buttons.resetButton.addClass('btn-red'); + this.buttons.resetButton.removeClass('btn-red'); + // or + this.$$resetButton // button's jquery element reference, go crazy + this.buttons.buttonA == buttonA // both are the same. + return false; // prevent the modal from closing + } + }, + resetButton: function(resetButton) {} + } + }); + } + + + public confirm_9() { + $.confirm({ + title: 'Encountered an error!', + content: 'Something went downhill, this may be serious', + type: 'red', + typeAnimated: true, + buttons: { + tryAgain: { + text: 'Try again', + btnClass: 'btn-red', + action: function() {} + }, + close: function() {} + } + }); + } + + public confirm_10() { + $.confirm({ + icon: 'glyphicon glyphicon-heart', + title: 'glyphicon' + }); + $.confirm({ + icon: 'fa fa-warning', + title: 'font-awesome' + }); + $.confirm({ + icon: 'fa fa-spinner fa-spin', + title: 'Working!', + content: 'Sit back, we are processing your request!' + }); + } + + public confirm_11() { + $.confirm({ + closeIcon: true + }); + + $.confirm({ + closeIcon: true, + closeIconClass: 'fa fa-close' + }); + } + + public confirm_12() { + $.confirm({ + closeIcon: function() { + return false; + }, + buttons: { + aRandomButton: function() { + $.alert('A random button is called, and i prevent closing the modal'); + return false; // you shall not pass + }, + close: function() {} + } + }); + } + + public confirm_13() { + $.confirm({ + columnClass: 'small' + }); + $.confirm({ + columnClass: 'col-md-4 col-md-offset-4', + }); + $.confirm({ + columnClass: 'col-md-12' + }); + $.confirm({ + columnClass: 'col-md-4 col-md-offset-8 col-xs-4 col-xs-offset-8', + containerFluid: true, // this will add 'container-fluid' instead of 'container' + }); + } + + public confirm_14() { + $.confirm({ + boxWidth: '30%', + useBootstrap: false, + }); + $.confirm({ + boxWidth: '500px', + useBootstrap: false, + }); + } + + public confirm_15() { + $.confirm({ + bootstrapClasses: { + container: 'container', + containerFluid: 'container-fluid', + row: 'row', + }, + }); + + $.confirm({ + title: 'Hello there', + content: 'click and hold on the title to drag', + draggable: true, + }); + + $.confirm({ + title: 'Hello there', + content: 'Drag this modal out of the window', + draggable: true, + dragWindowBorder: false, + }); + $.confirm({ + title: 'Hello there', + content: 'try to drag this modal out of the window', + draggable: true, + dragWindowGap: 0, // number of px of distance + }); + } + + public ajaxLoading() { + $.confirm({ + title: 'Title', + content: 'url:text.txt', + onContentReady: function() { + var self = this; + this.setContentPrepend('
Prepended text
'); + setTimeout(function() { + self.setContentAppend('
Appended text after 2 seconds
'); + }, 2000); + }, + columnClass: 'medium', + }); + + $.confirm({ + content: function() { + var self = this; + return $.ajax({ + url: 'bower.json', + dataType: 'json', + method: 'get' + }).done(function(response) { + self.setContent('Description: ' + response.description); + self.setContentAppend('
Version: ' + response.version); + self.setTitle(response.name); + }).fail(function() { + self.setContent('Something went wrong.'); + }); + } + }); + + $.confirm({ + content: 'url:text.txt', + contentLoaded: function(data, status, xhr) { + // data is already set in content + this.setContentAppend('
Status: ' + status); + } + }); + + $.confirm({ + content: function() { + var self = this; + self.setContent('Checking callback flow'); + return $.ajax({ + url: 'bower.json', + dataType: 'json', + method: 'get' + }).done(function(response) { + self.setContentAppend('
Done!
'); + }).fail(function() { + self.setContentAppend('
Fail!
'); + }).always(function() { + self.setContentAppend('
Always!
'); + }); + }, + contentLoaded: function(data, status, xhr) { + self.setContentAppend('
Content loaded!
'); + }, + onContentReady: function() { + this.setContentAppend('
Content ready!
'); + } + }); + + } + + public autoClose() { + $.confirm({ + title: 'Delete user?', + content: 'This dialog will automatically trigger \'cancel\' in 6 seconds if you don\'t respond.', + autoClose: 'cancelAction|8000', + buttons: { + deleteUser: { + text: 'delete user', + action: function() { + $.alert('Deleted the user!'); + } + }, + cancelAction: function() { + $.alert('action is canceled'); + } + } + }); + $.confirm({ + title: 'Logout?', + content: 'Your time is out, you will be automatically logged out in 10 seconds.', + autoClose: 'logoutUser|10000', + buttons: { + logoutUser: { + text: 'logout myself', + action: function() { + $.alert('The user was logged out'); + } + }, + cancel: function() { + $.alert('canceled'); + } + } + }); + } + + public backgroundDismisse() { + $.confirm({ + backgroundDismiss: true, // this will just close the modal + }); + $.confirm({ + backgroundDismiss: function() { + return false; // modal wont close. + }, + }); + $.confirm({ + backgroundDismiss: function() { + return 'buttonName'; // the button will handle it + }, + }); + $.confirm({ + backgroundDismiss: 'buttonName', + content: 'in here the backgroundDismiss action is handled by buttonName' + + '
', + buttons: { + buttonName: function() { + var $checkbox = this.$content.find('#enableCheckbox'); + return $checkbox.prop('checked'); + }, + close: function() {} + } + }); + } + + public backgroundDismisseAnimation(){ + $.confirm({ + backgroundDismiss: false, + backgroundDismissAnimation: 'shake', +}); +$.confirm({ + backgroundDismiss: false, + backgroundDismissAnimation: 'glow', +}); + } + + public escapeKey(){ + $.confirm({ + escapeKey: true, + backgroundDismiss: false, +}); +$.confirm({ + escapeKey: 'buttonName', + buttons: { + buttonName: function(){ + $.alert('Button name was called'); + }, + close: function(){ + } + } +}); + } + public rtlSupport(){ + $.alert({ + title: 'پیغام', + content: 'این یک متن به زبان شیرین فارسی است', + rtl: true, + closeIcon: true, + buttons: { + confirm: { + text: 'تایید', + btnClass: 'btn-blue', + action: function () { + $.alert('تایید شد.'); + } + }, + cancel: { + text: 'انصراف', + action: function () { + } + } + } +}); + + } + + public callBack(){ + $.confirm({ + title: false, + content: 'url:callback.html', + onContentReady: function () { + // when content is fetched & rendered in DOM + alert('onContentReady'); + var self = this; + this.buttons.ok.disable(); + this.$content.find('.btn').click(function(){ + self.$content.find('input').val('Chuck norris'); + self.buttons.ok.enable(); + }); + }, + contentLoaded: function(data, status, xhr){ + // when content is fetched + alert('contentLoaded: ' + status); + }, + onOpenBefore: function () { + // before the modal is displayed. + alert('onOpenBefore'); + }, + onOpen: function () { + // after the modal is displayed. + alert('onOpen'); + }, + onClose: function () { + // before the modal is hidden. + alert('onClose'); + }, + onDestroy: function () { + // when the modal is removed from DOM + alert('onDestroy'); + }, + onAction: function (btnName) { + // when a button is clicked, with the button name + alert('onAction: ' + btnName); + }, + buttons: { + ok: function(){ + } + } +}); + } + public globalSettings(){ + jconfirm.defaults = { + title: 'Hello', + titleClass: '', + type: 'default', + typeAnimated: true, + draggable: true, + dragWindowGap: 15, + dragWindowBorder: true, + animateFromElement: true, + smoothContent: true, + content: 'Are you sure to continue?', + buttons: {}, + defaultButtons: { + ok: { + action: function () { + } + }, + close: { + action: function () { + } + }, + }, + contentLoaded: function(data, status, xhr){ + }, + icon: '', + lazyOpen: false, + bgOpacity: null, + theme: 'light', + animation: 'scale', + closeAnimation: 'scale', + animationSpeed: 400, + animationBounce: 1, + rtl: false, + container: 'body', + containerFluid: false, + backgroundDismiss: false, + backgroundDismissAnimation: 'shake', + autoClose: false, + closeIcon: null, + closeIconClass: false, + watchInterval: 100, + columnClass: 'col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1', + boxWidth: '50%', + scrollToPreviousElement: true, + scrollToPreviousElementAnimate: true, + useBootstrap: true, + offsetTop: 40, + offsetBottom: 40, + bootstrapClasses: { + container: 'container', + containerFluid: 'container-fluid', + row: 'row', + }, + onContentReady: function () {}, + onOpenBefore: function () {}, + onOpen: function () {}, + onClose: function () {}, + onDestroy: function () {}, + onAction: function () {} +}; + } + + public api(){ + var jc = $.confirm({ + title: 'awesome', + onContentReady: function(){ + // this === jc + //jc.setTitle(title: string); + } +}); + } + +} + + +var firstName: string = 'Pierre'; +var lastName: string = 'Yotti'; +var type = new Confirm(firstName, lastName); diff --git a/types/confirmdialog/tsconfig.json b/types/confirmdialog/tsconfig.json new file mode 100644 index 0000000000..6949afdda5 --- /dev/null +++ b/types/confirmdialog/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "types", + "typeRoots": ["types"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery_confirm.ts" + ] +} diff --git a/types/confirmdialog/tslint.json b/types/confirmdialog/tslint.json new file mode 100644 index 0000000000..2f73ea817c --- /dev/null +++ b/types/confirmdialog/tslint.json @@ -0,0 +1,31 @@ +{ + "rules": { + "max-line-length": { + "options": [ + 120 + ] + }, + "new-parens": true, + "no-arg": true, + "no-bitwise": true, + "no-conditional-assignment": true, + "no-consecutive-blank-lines": false, + "no-console": { + "options": [ + "debug", + "info", + "log", + "time", + "timeEnd", + "trace" + ] + } + }, + "jsRules": { + "max-line-length": { + "options": [ + 120 + ] + } + } +} From 1558ac449a86b8b74c64d08b3aef4c7c55f4f193 Mon Sep 17 00:00:00 2001 From: allipierre Date: Mon, 20 Nov 2017 16:22:17 +0100 Subject: [PATCH 029/322] add optional Parameter to confirmOptions --- types/confirmdialog/index.d.ts | 4 ++-- types/confirmdialog/tsconfig.json | 9 ++++----- types/confirmdialog/tslint.json | 32 +------------------------------ 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index 8ab3145c32..e2b3072fee 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -8,7 +8,7 @@ interface JQueryStatic { * confirm Dialog * @param {confirmOptions} pOtions */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | any; /** * confirm alert @@ -29,7 +29,7 @@ interface JQuery { * confirm Dialog * @param {confirmOptions} pOtions */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | any; /** * confirm alert diff --git a/types/confirmdialog/tsconfig.json b/types/confirmdialog/tsconfig.json index 6949afdda5..b612d7b4be 100644 --- a/types/confirmdialog/tsconfig.json +++ b/types/confirmdialog/tsconfig.json @@ -2,20 +2,19 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "baseUrl": "types", - "typeRoots": ["types"], + "baseUrl": "../", + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "jquery_confirm.ts" + "jquery-confirm.ts" ] } diff --git a/types/confirmdialog/tslint.json b/types/confirmdialog/tslint.json index 2f73ea817c..3db14f85ea 100644 --- a/types/confirmdialog/tslint.json +++ b/types/confirmdialog/tslint.json @@ -1,31 +1 @@ -{ - "rules": { - "max-line-length": { - "options": [ - 120 - ] - }, - "new-parens": true, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": { - "options": [ - "debug", - "info", - "log", - "time", - "timeEnd", - "trace" - ] - } - }, - "jsRules": { - "max-line-length": { - "options": [ - 120 - ] - } - } -} +{ "extends": "dtslint/dt.json" } From 96df8480f9ed35a2f0a56b6103cbaa1a6cf3b477 Mon Sep 17 00:00:00 2001 From: allipierre Date: Mon, 20 Nov 2017 17:08:07 +0100 Subject: [PATCH 030/322] add optional Parameter to confirmOptions --- package.json | 3 + types/confirmdialog/index.d.ts | 8 +- types/confirmdialog/jquery-confirm.ts | 205 ++------------------------ types/confirmdialog/tsconfig.json | 7 +- types/confirmdialog/tslint.json | 32 +++- 5 files changed, 52 insertions(+), 203 deletions(-) diff --git a/package.json b/package.json index db67595b77..a9ddbdd977 100644 --- a/package.json +++ b/package.json @@ -23,5 +23,8 @@ "devDependencies": { "dtslint": "github:Microsoft/dtslint#production", "types-publisher": "Microsoft/types-publisher#production" + }, + "dependencies": { + "@types/jquery": "^3.2.16" } } diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index e2b3072fee..7844857464 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -5,10 +5,10 @@ interface JQueryStatic { /** - * confirm Dialog + * confirm Dialog * @param {confirmOptions} pOtions */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | any; + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; /** * confirm alert @@ -29,7 +29,7 @@ interface JQuery { * confirm Dialog * @param {confirmOptions} pOtions */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | any; + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; /** * confirm alert @@ -72,7 +72,7 @@ declare namespace options { dragWindowBorder?: boolean, dragWindowGap?: number, contentLoaded?: Function, - autoClose?: String, + autoClose?: string, backgroundDismiss?: boolean | Function | string, backgroundDismissAnimation?: string, escapeKey?: string | boolean, diff --git a/types/confirmdialog/jquery-confirm.ts b/types/confirmdialog/jquery-confirm.ts index 109558a737..2f63c28f60 100644 --- a/types/confirmdialog/jquery-confirm.ts +++ b/types/confirmdialog/jquery-confirm.ts @@ -63,7 +63,7 @@ class Confirm implements server.Iperson { text: 'Submit', btnClass: 'btn-blue', action: function() { - let name = this.$content.find('.name').val(); + let name; if (!name) { $.alert('provide a valid name'); return false; @@ -76,13 +76,7 @@ class Confirm implements server.Iperson { }, }, onContentReady: function() { - // bind to events - var jc = this; - this.$content.find('form').on('submit', function(e) { - // if the user submits the form by pressing enter in the field. - e.preventDefault(); - jc.$$formSubmit.trigger('click'); // reference the button and click it - }); + } }); @@ -128,11 +122,11 @@ class Confirm implements server.Iperson { public confirm_5() { $.confirm({ buttons: { - hello: function(helloButton) { + hello: function(helloButton:string) { // shorthand method to define a button // the button key will be used as button name }, - hey: function(heyButton) { + hey: function(heyButton:string) { // access the button using jquery this.$$hello.trigger('click'); // click the 'hello' button this.$$hey.prop('disabled', true); // disable the current button using jquery method @@ -150,7 +144,7 @@ class Confirm implements server.Iperson { keys: ['enter', 'a'], // keyboard event for button isHidden: false, // initially not hidden isDisabled: false, // initially not disabled - action: function(heyThereButton) { + action: function(heyThereButton:string) { // longhand method to define a button // provides more features } @@ -205,21 +199,12 @@ class Confirm implements server.Iperson { buttons: { buttonA: { text: 'button a', - action: function(buttonA) { - this.buttons.resetButton.setText('reset button!!!'); - this.buttons.resetButton.disable(); - this.buttons.resetButton.enable(); - this.buttons.resetButton.hide(); - this.buttons.resetButton.show(); - this.buttons.resetButton.addClass('btn-red'); - this.buttons.resetButton.removeClass('btn-red'); - // or - this.$$resetButton // button's jquery element reference, go crazy - this.buttons.buttonA == buttonA // both are the same. + action: function(buttonA:HTMLElement) { + return false; // prevent the modal from closing } }, - resetButton: function(resetButton) {} + resetButton: function(resetButton:HTMLElement) {} } }); } @@ -340,133 +325,7 @@ class Confirm implements server.Iperson { }); } - public ajaxLoading() { - $.confirm({ - title: 'Title', - content: 'url:text.txt', - onContentReady: function() { - var self = this; - this.setContentPrepend('
Prepended text
'); - setTimeout(function() { - self.setContentAppend('
Appended text after 2 seconds
'); - }, 2000); - }, - columnClass: 'medium', - }); - $.confirm({ - content: function() { - var self = this; - return $.ajax({ - url: 'bower.json', - dataType: 'json', - method: 'get' - }).done(function(response) { - self.setContent('Description: ' + response.description); - self.setContentAppend('
Version: ' + response.version); - self.setTitle(response.name); - }).fail(function() { - self.setContent('Something went wrong.'); - }); - } - }); - - $.confirm({ - content: 'url:text.txt', - contentLoaded: function(data, status, xhr) { - // data is already set in content - this.setContentAppend('
Status: ' + status); - } - }); - - $.confirm({ - content: function() { - var self = this; - self.setContent('Checking callback flow'); - return $.ajax({ - url: 'bower.json', - dataType: 'json', - method: 'get' - }).done(function(response) { - self.setContentAppend('
Done!
'); - }).fail(function() { - self.setContentAppend('
Fail!
'); - }).always(function() { - self.setContentAppend('
Always!
'); - }); - }, - contentLoaded: function(data, status, xhr) { - self.setContentAppend('
Content loaded!
'); - }, - onContentReady: function() { - this.setContentAppend('
Content ready!
'); - } - }); - - } - - public autoClose() { - $.confirm({ - title: 'Delete user?', - content: 'This dialog will automatically trigger \'cancel\' in 6 seconds if you don\'t respond.', - autoClose: 'cancelAction|8000', - buttons: { - deleteUser: { - text: 'delete user', - action: function() { - $.alert('Deleted the user!'); - } - }, - cancelAction: function() { - $.alert('action is canceled'); - } - } - }); - $.confirm({ - title: 'Logout?', - content: 'Your time is out, you will be automatically logged out in 10 seconds.', - autoClose: 'logoutUser|10000', - buttons: { - logoutUser: { - text: 'logout myself', - action: function() { - $.alert('The user was logged out'); - } - }, - cancel: function() { - $.alert('canceled'); - } - } - }); - } - - public backgroundDismisse() { - $.confirm({ - backgroundDismiss: true, // this will just close the modal - }); - $.confirm({ - backgroundDismiss: function() { - return false; // modal wont close. - }, - }); - $.confirm({ - backgroundDismiss: function() { - return 'buttonName'; // the button will handle it - }, - }); - $.confirm({ - backgroundDismiss: 'buttonName', - content: 'in here the backgroundDismiss action is handled by buttonName' + - '
', - buttons: { - buttonName: function() { - var $checkbox = this.$content.find('#enableCheckbox'); - return $checkbox.prop('checked'); - }, - close: function() {} - } - }); - } public backgroundDismisseAnimation(){ $.confirm({ @@ -519,50 +378,7 @@ $.confirm({ } - public callBack(){ - $.confirm({ - title: false, - content: 'url:callback.html', - onContentReady: function () { - // when content is fetched & rendered in DOM - alert('onContentReady'); - var self = this; - this.buttons.ok.disable(); - this.$content.find('.btn').click(function(){ - self.$content.find('input').val('Chuck norris'); - self.buttons.ok.enable(); - }); - }, - contentLoaded: function(data, status, xhr){ - // when content is fetched - alert('contentLoaded: ' + status); - }, - onOpenBefore: function () { - // before the modal is displayed. - alert('onOpenBefore'); - }, - onOpen: function () { - // after the modal is displayed. - alert('onOpen'); - }, - onClose: function () { - // before the modal is hidden. - alert('onClose'); - }, - onDestroy: function () { - // when the modal is removed from DOM - alert('onDestroy'); - }, - onAction: function (btnName) { - // when a button is clicked, with the button name - alert('onAction: ' + btnName); - }, - buttons: { - ok: function(){ - } - } -}); - } + public globalSettings(){ jconfirm.defaults = { title: 'Hello', @@ -586,8 +402,7 @@ $.confirm({ } }, }, - contentLoaded: function(data, status, xhr){ - }, + icon: '', lazyOpen: false, bgOpacity: null, diff --git a/types/confirmdialog/tsconfig.json b/types/confirmdialog/tsconfig.json index b612d7b4be..b43b979bcc 100644 --- a/types/confirmdialog/tsconfig.json +++ b/types/confirmdialog/tsconfig.json @@ -2,13 +2,14 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": ["../"], + "baseUrl": "types", + "typeRoots": ["types"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/confirmdialog/tslint.json b/types/confirmdialog/tslint.json index 3db14f85ea..2f73ea817c 100644 --- a/types/confirmdialog/tslint.json +++ b/types/confirmdialog/tslint.json @@ -1 +1,31 @@ -{ "extends": "dtslint/dt.json" } +{ + "rules": { + "max-line-length": { + "options": [ + 120 + ] + }, + "new-parens": true, + "no-arg": true, + "no-bitwise": true, + "no-conditional-assignment": true, + "no-consecutive-blank-lines": false, + "no-console": { + "options": [ + "debug", + "info", + "log", + "time", + "timeEnd", + "trace" + ] + } + }, + "jsRules": { + "max-line-length": { + "options": [ + 120 + ] + } + } +} From f0d25f25f893335f62ca489edd941fb9524097cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brikou=20Carr=C3=A9?= Date: Tue, 21 Nov 2017 22:22:34 +0100 Subject: [PATCH 031/322] Typo with jwtid params --- types/jsonwebtoken/index.d.ts | 64 +++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/types/jsonwebtoken/index.d.ts b/types/jsonwebtoken/index.d.ts index 335a6f52b7..766042e627 100644 --- a/types/jsonwebtoken/index.d.ts +++ b/types/jsonwebtoken/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for jsonwebtoken 7.2.0 +// Type definitions for jsonwebtoken 7.2.1 // Project: https://github.com/auth0/node-jsonwebtoken -// Definitions by: Maxime LUCE , Daniel Heim +// Definitions by: Maxime LUCE , +// Daniel Heim , +// Brice BERNARD // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -51,7 +53,6 @@ export interface SignOptions { noTimestamp?: boolean; header?: object; encoding?: string; - } export interface VerifyOptions { @@ -61,7 +62,7 @@ export interface VerifyOptions { issuer?: string | string[]; ignoreExpiration?: boolean; ignoreNotBefore?: boolean; - jwtId?: string; + jwtid?: string; subject?: string; /** *@deprecated @@ -76,14 +77,17 @@ export interface DecodeOptions { } export interface VerifyCallback { - (err: JsonWebTokenError | NotBeforeError | TokenExpiredError, decoded: object | string): void; + ( + err: JsonWebTokenError | NotBeforeError | TokenExpiredError, + decoded: object | string, + ): void; } export interface SignCallback { (err: Error, encoded: string): void; } -export type Secret = string | Buffer | {key: string, passphrase: string} +export type Secret = string | Buffer | { key: string; passphrase: string }; /** * Synchronously sign the given payload into a JSON Web Token string @@ -92,7 +96,11 @@ export type Secret = string | Buffer | {key: string, passphrase: string} * @param {SignOptions} [options] - Options for the signature * @returns {String} The JSON Web Token string */ -export declare function sign(payload: string | Buffer | object, secretOrPrivateKey: Secret, options?: SignOptions): string; +export declare function sign( + payload: string | Buffer | object, + secretOrPrivateKey: Secret, + options?: SignOptions, +): string; /** * Sign the given payload into a JSON Web Token string @@ -101,8 +109,17 @@ export declare function sign(payload: string | Buffer | object, secretOrPrivateK * @param {SignOptions} [options] - Options for the signature * @param {Function} callback - Callback to get the encoded token on */ -export declare function sign(payload: string | Buffer | object, secretOrPrivateKey: Secret, callback: SignCallback): void; -export declare function sign(payload: string | Buffer | object, secretOrPrivateKey: Secret, options: SignOptions, callback: SignCallback): void; +export declare function sign( + payload: string | Buffer | object, + secretOrPrivateKey: Secret, + callback: SignCallback, +): void; +export declare function sign( + payload: string | Buffer | object, + secretOrPrivateKey: Secret, + options: SignOptions, + callback: SignCallback, +): void; /** * Synchronously verify given token using a secret or a public key to get a decoded token @@ -111,8 +128,15 @@ export declare function sign(payload: string | Buffer | object, secretOrPrivateK * @param {VerifyOptions} [options] - Options for the verification * @returns The decoded token. */ -declare function verify(token: string, secretOrPublicKey: string | Buffer): object | string; -declare function verify(token: string, secretOrPublicKey: string | Buffer, options?: VerifyOptions): object | string; +declare function verify( + token: string, + secretOrPublicKey: string | Buffer, +): object | string; +declare function verify( + token: string, + secretOrPublicKey: string | Buffer, + options?: VerifyOptions, +): object | string; /** * Asynchronously verify given token using a secret or a public key to get a decoded token @@ -121,8 +145,17 @@ declare function verify(token: string, secretOrPublicKey: string | Buffer, optio * @param {VerifyOptions} [options] - Options for the verification * @param {Function} callback - Callback to get the decoded token on */ -declare function verify(token: string, secretOrPublicKey: string | Buffer, callback?: VerifyCallback): void; -declare function verify(token: string, secretOrPublicKey: string | Buffer, options?: VerifyOptions, callback?: VerifyCallback): void; +declare function verify( + token: string, + secretOrPublicKey: string | Buffer, + callback?: VerifyCallback, +): void; +declare function verify( + token: string, + secretOrPublicKey: string | Buffer, + options?: VerifyOptions, + callback?: VerifyCallback, +): void; /** * Returns the decoded payload without verifying if the signature is valid. @@ -130,4 +163,7 @@ declare function verify(token: string, secretOrPublicKey: string | Buffer, optio * @param {DecodeOptions} [options] - Options for decoding * @returns {Object} The decoded Token */ -declare function decode(token: string, options?: DecodeOptions): null | object | string; +declare function decode( + token: string, + options?: DecodeOptions, +): null | object | string; From 3ed8da33614d61dbf65c080d3a0f0e9cc5324736 Mon Sep 17 00:00:00 2001 From: allipierre Date: Wed, 22 Nov 2017 19:19:13 +0100 Subject: [PATCH 032/322] remove some errors --- types/confirmdialog/jquery-confirm.ts | 232 ++++++++++++++++++++++++-- types/confirmdialog/tsconfig.json | 2 +- 2 files changed, 223 insertions(+), 11 deletions(-) diff --git a/types/confirmdialog/jquery-confirm.ts b/types/confirmdialog/jquery-confirm.ts index 2f63c28f60..e75057f504 100644 --- a/types/confirmdialog/jquery-confirm.ts +++ b/types/confirmdialog/jquery-confirm.ts @@ -63,7 +63,7 @@ class Confirm implements server.Iperson { text: 'Submit', btnClass: 'btn-blue', action: function() { - let name; + let name = this.$content.find('.name').val(); if (!name) { $.alert('provide a valid name'); return false; @@ -76,7 +76,13 @@ class Confirm implements server.Iperson { }, }, onContentReady: function() { - + // bind to events + var jc = this; + this.$content.find('form').on('submit', function(e) { + // if the user submits the form by pressing enter in the field. + e.preventDefault(); + jc.$$formSubmit.trigger('click'); // reference the button and click it + }); } }); @@ -122,11 +128,11 @@ class Confirm implements server.Iperson { public confirm_5() { $.confirm({ buttons: { - hello: function(helloButton:string) { + hello: function(helloButton) { // shorthand method to define a button // the button key will be used as button name }, - hey: function(heyButton:string) { + hey: function(heyButton) { // access the button using jquery this.$$hello.trigger('click'); // click the 'hello' button this.$$hey.prop('disabled', true); // disable the current button using jquery method @@ -144,7 +150,7 @@ class Confirm implements server.Iperson { keys: ['enter', 'a'], // keyboard event for button isHidden: false, // initially not hidden isDisabled: false, // initially not disabled - action: function(heyThereButton:string) { + action: function(heyThereButton) { // longhand method to define a button // provides more features } @@ -199,12 +205,21 @@ class Confirm implements server.Iperson { buttons: { buttonA: { text: 'button a', - action: function(buttonA:HTMLElement) { - + action: function(buttonA) { + this.buttons.resetButton.setText('reset button!!!'); + this.buttons.resetButton.disable(); + this.buttons.resetButton.enable(); + this.buttons.resetButton.hide(); + this.buttons.resetButton.show(); + this.buttons.resetButton.addClass('btn-red'); + this.buttons.resetButton.removeClass('btn-red'); + // or + this.$$resetButton // button's jquery element reference, go crazy + this.buttons.buttonA == buttonA // both are the same. return false; // prevent the modal from closing } }, - resetButton: function(resetButton:HTMLElement) {} + resetButton: function(resetButton) {} } }); } @@ -325,7 +340,133 @@ class Confirm implements server.Iperson { }); } + public ajaxLoading() { + $.confirm({ + title: 'Title', + content: 'url:text.txt', + onContentReady: function() { + var self = this; + this.setContentPrepend('
Prepended text
'); + setTimeout(function() { + self.setContentAppend('
Appended text after 2 seconds
'); + }, 2000); + }, + columnClass: 'medium', + }); + $.confirm({ + content: function() { + var self = this; + return $.ajax({ + url: 'bower.json', + dataType: 'json', + method: 'get' + }).done(function(response) { + self.setContent('Description: ' + response.description); + self.setContentAppend('
Version: ' + response.version); + self.setTitle(response.name); + }).fail(function() { + self.setContent('Something went wrong.'); + }); + } + }); + + $.confirm({ + content: 'url:text.txt', + contentLoaded: function(data, status, xhr) { + // data is already set in content + this.setContentAppend('
Status: ' + status); + } + }); + + $.confirm({ + content: function() { + var self = this; + self.setContent('Checking callback flow'); + return $.ajax({ + url: 'bower.json', + dataType: 'json', + method: 'get' + }).done(function(response) { + self.setContentAppend('
Done!
'); + }).fail(function() { + self.setContentAppend('
Fail!
'); + }).always(function() { + self.setContentAppend('
Always!
'); + }); + }, + contentLoaded: function(data, status, xhr) { + self.setContentAppend('
Content loaded!
'); + }, + onContentReady: function() { + this.setContentAppend('
Content ready!
'); + } + }); + + } + + public autoClose() { + $.confirm({ + title: 'Delete user?', + content: 'This dialog will automatically trigger \'cancel\' in 6 seconds if you don\'t respond.', + autoClose: 'cancelAction|8000', + buttons: { + deleteUser: { + text: 'delete user', + action: function() { + $.alert('Deleted the user!'); + } + }, + cancelAction: function() { + $.alert('action is canceled'); + } + } + }); + $.confirm({ + title: 'Logout?', + content: 'Your time is out, you will be automatically logged out in 10 seconds.', + autoClose: 'logoutUser|10000', + buttons: { + logoutUser: { + text: 'logout myself', + action: function() { + $.alert('The user was logged out'); + } + }, + cancel: function() { + $.alert('canceled'); + } + } + }); + } + + public backgroundDismisse() { + $.confirm({ + backgroundDismiss: true, // this will just close the modal + }); + $.confirm({ + backgroundDismiss: function() { + return false; // modal wont close. + }, + }); + $.confirm({ + backgroundDismiss: function() { + return 'buttonName'; // the button will handle it + }, + }); + $.confirm({ + backgroundDismiss: 'buttonName', + content: 'in here the backgroundDismiss action is handled by buttonName' + + '
', + buttons: { + buttonName: function() { + var $checkbox = this.$content.find('#enableCheckbox'); + return $checkbox.prop('checked'); + }, + close: function() {} + } + }); + } public backgroundDismisseAnimation(){ $.confirm({ @@ -378,7 +519,50 @@ $.confirm({ } - + public callBack(){ + $.confirm({ + title: false, + content: 'url:callback.html', + onContentReady: function () { + // when content is fetched & rendered in DOM + alert('onContentReady'); + var self = this; + this.buttons.ok.disable(); + this.$content.find('.btn').click(function(){ + self.$content.find('input').val('Chuck norris'); + self.buttons.ok.enable(); + }); + }, + contentLoaded: function(data, status, xhr){ + // when content is fetched + alert('contentLoaded: ' + status); + }, + onOpenBefore: function () { + // before the modal is displayed. + alert('onOpenBefore'); + }, + onOpen: function () { + // after the modal is displayed. + alert('onOpen'); + }, + onClose: function () { + // before the modal is hidden. + alert('onClose'); + }, + onDestroy: function () { + // when the modal is removed from DOM + alert('onDestroy'); + }, + onAction: function (btnName) { + // when a button is clicked, with the button name + alert('onAction: ' + btnName); + }, + buttons: { + ok: function(){ + } + } +}); + } public globalSettings(){ jconfirm.defaults = { title: 'Hello', @@ -402,7 +586,8 @@ $.confirm({ } }, }, - + contentLoaded: function(data, status, xhr){ + }, icon: '', lazyOpen: false, bgOpacity: null, @@ -451,6 +636,33 @@ $.confirm({ }); } + + public confirm_84() { + $.confirm({ + closeIcon: true, + buttons: { + buttonA: { + text: 'button a', + action: function (buttonA: HTMLElement) { + this.buttons.resetButton.setText('reset button!!!'); + this.buttons.resetButton.disable(); + this.buttons.resetButton.enable(); + this.buttons.resetButton.hide(); + this.buttons.resetButton.show(); + this.buttons.resetButton.addClass('btn-red'); + this.buttons.resetButton.removeClass('btn-red'); + // or + this.$$resetButton // button's jquery element reference, go crazy + this.buttons.buttonA == buttonA // both are the same. + return false; // prevent the modal from closing + } + }, + resetButton: function (resetButton: string) { + } + } +}); + } + } diff --git a/types/confirmdialog/tsconfig.json b/types/confirmdialog/tsconfig.json index b43b979bcc..6949afdda5 100644 --- a/types/confirmdialog/tsconfig.json +++ b/types/confirmdialog/tsconfig.json @@ -16,6 +16,6 @@ }, "files": [ "index.d.ts", - "jquery-confirm.ts" + "jquery_confirm.ts" ] } From 7c07552f854b63c28e773e79a7e4c43adc6a6622 Mon Sep 17 00:00:00 2001 From: allipierre Date: Thu, 23 Nov 2017 12:16:06 +0100 Subject: [PATCH 033/322] remove some errors --- .../confirmdialog/{jquery-confirm.ts => confirmdialog-tests.ts} | 0 types/confirmdialog/tsconfig.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename types/confirmdialog/{jquery-confirm.ts => confirmdialog-tests.ts} (100%) diff --git a/types/confirmdialog/jquery-confirm.ts b/types/confirmdialog/confirmdialog-tests.ts similarity index 100% rename from types/confirmdialog/jquery-confirm.ts rename to types/confirmdialog/confirmdialog-tests.ts diff --git a/types/confirmdialog/tsconfig.json b/types/confirmdialog/tsconfig.json index 6949afdda5..98bea3c511 100644 --- a/types/confirmdialog/tsconfig.json +++ b/types/confirmdialog/tsconfig.json @@ -16,6 +16,6 @@ }, "files": [ "index.d.ts", - "jquery_confirm.ts" + "confirmdialog-tests.ts" ] } From c0ec4daf141dd756afcc723a22a1f4065cd86a5d Mon Sep 17 00:00:00 2001 From: allipierre Date: Thu, 23 Nov 2017 12:28:10 +0100 Subject: [PATCH 034/322] remove some errors --- types/confirmdialog/confirmdialog-tests.ts | 2 -- types/confirmdialog/index.d.ts | 4 +-- types/confirmdialog/tsconfig.json | 4 +-- types/confirmdialog/tslint.json | 32 +--------------------- 4 files changed, 5 insertions(+), 37 deletions(-) diff --git a/types/confirmdialog/confirmdialog-tests.ts b/types/confirmdialog/confirmdialog-tests.ts index e75057f504..9f0fd9430d 100644 --- a/types/confirmdialog/confirmdialog-tests.ts +++ b/types/confirmdialog/confirmdialog-tests.ts @@ -1,5 +1,3 @@ -/// -/// namespace server { export interface Iperson { title: string, diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index 7844857464..c22896c8c2 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for jquery-confirm v3.3.0 https://craftpip.github.io/jquery-confirm/ +// Type definitions for confirmdialog v3.3.0 // Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js -// Definitions by: Alli Pierre Yotti https://github.com/allipierre +// Definitions by: Alli Pierre Yotti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface JQueryStatic { diff --git a/types/confirmdialog/tsconfig.json b/types/confirmdialog/tsconfig.json index 98bea3c511..76f091224e 100644 --- a/types/confirmdialog/tsconfig.json +++ b/types/confirmdialog/tsconfig.json @@ -8,8 +8,8 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "baseUrl": "types", - "typeRoots": ["types"], + "baseUrl": "../", + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/confirmdialog/tslint.json b/types/confirmdialog/tslint.json index 2f73ea817c..3db14f85ea 100644 --- a/types/confirmdialog/tslint.json +++ b/types/confirmdialog/tslint.json @@ -1,31 +1 @@ -{ - "rules": { - "max-line-length": { - "options": [ - 120 - ] - }, - "new-parens": true, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": { - "options": [ - "debug", - "info", - "log", - "time", - "timeEnd", - "trace" - ] - } - }, - "jsRules": { - "max-line-length": { - "options": [ - 120 - ] - } - } -} +{ "extends": "dtslint/dt.json" } From 07de29ea090ab572e14efbfb6b7e4e98ae7bff20 Mon Sep 17 00:00:00 2001 From: allipierre Date: Thu, 23 Nov 2017 14:21:18 +0100 Subject: [PATCH 035/322] remove some errors --- package.json | 3 +- types/concaveman/concaveman-tests.ts | 2 +- types/concaveman/index.d.ts | 4 +- types/confirmdialog/confirmdialog-tests.ts | 531 +-------------------- types/confirmdialog/index.d.ts | 2 + 5 files changed, 12 insertions(+), 530 deletions(-) diff --git a/package.json b/package.json index a9ddbdd977..bef061f5bf 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "types-publisher": "Microsoft/types-publisher#production" }, "dependencies": { - "@types/jquery": "^3.2.16" + "@types/jquery": "^3.2.16", + "jquery": "^3.2.1" } } diff --git a/types/concaveman/concaveman-tests.ts b/types/concaveman/concaveman-tests.ts index 736d616ad9..1d951b5448 100644 --- a/types/concaveman/concaveman-tests.ts +++ b/types/concaveman/concaveman-tests.ts @@ -1,4 +1,4 @@ import * as concaveman from 'concaveman'; var points = [[10, 20], [30, 12.5]]; -var polygon = concaveman(points); \ No newline at end of file +var polygon = concaveman(points); diff --git a/types/concaveman/index.d.ts b/types/concaveman/index.d.ts index a5b55c8fa3..4c10ca6928 100644 --- a/types/concaveman/index.d.ts +++ b/types/concaveman/index.d.ts @@ -6,7 +6,7 @@ declare module "concaveman" { /** * A very fast 2D concave hull algorithm in JavaScript (generates a general outline of a point set). - * + * * @name concaveman * @param {Array>} points is an array of [x, y] points. * @param {number} [concavity=2] is a relative measure of concavity. 1 results in a relatively detailed shape, Infinity results in a convex hull. You can use values lower than 1, but they can produce pretty crazy shapes. @@ -15,7 +15,7 @@ declare module "concaveman" { * @example * var points = [[10, 20], [30, 12.5], ...]; * var polygon = concaveman(points); - * + * * //=hull */ function concaveman(points: number[][], concavity?: number, lengthThreshold?: number): number[][]; diff --git a/types/confirmdialog/confirmdialog-tests.ts b/types/confirmdialog/confirmdialog-tests.ts index 9f0fd9430d..77812221af 100644 --- a/types/confirmdialog/confirmdialog-tests.ts +++ b/types/confirmdialog/confirmdialog-tests.ts @@ -1,3 +1,6 @@ +import * as $ from 'jquery'; + + namespace server { export interface Iperson { title: string, @@ -46,521 +49,7 @@ class Confirm implements server.Iperson { }); } - public confirm1() { - $.confirm({ - title: 'Prompt!', - content: '' + - '
' + - '
' + - '' + - '' + - '
' + - '
', - buttons: { - formSubmit: { - text: 'Submit', - btnClass: 'btn-blue', - action: function() { - let name = this.$content.find('.name').val(); - if (!name) { - $.alert('provide a valid name'); - return false; - } - $.alert('Your name is ' + name); - } - }, - cancel: function() { - //close - }, - }, - onContentReady: function() { - // bind to events - var jc = this; - this.$content.find('form').on('submit', function(e) { - // if the user submits the form by pressing enter in the field. - e.preventDefault(); - jc.$$formSubmit.trigger('click'); // reference the button and click it - }); - } - }); - } - - public dialog() { - $.dialog({ - title: 'Text content!', - content: 'Simple modal!' - }); - } - public confirm_2() { - $('.atwitter').val(); - $('.atwitter').text(); - $('a.twitter').confirm({ - content: "...", - }); - $('a.twitter').confirm({ - buttons: { - hey: function() { - location.href = this.$target.attr('href'); - } - } - }); - } - - public confirm_3() { - $.alert('Content here', 'Title here'); - $.confirm('A message', 'Title is optional'); - $.dialog('Just to let you know'); - } - - public confirm_4() { - var a = $.confirm({ - lazyOpen: true, - }); - a.open(); - a.close(); - a.toggle(); // toggle open close. - - } - - public confirm_5() { - $.confirm({ - buttons: { - hello: function(helloButton) { - // shorthand method to define a button - // the button key will be used as button name - }, - hey: function(heyButton) { - // access the button using jquery - this.$$hello.trigger('click'); // click the 'hello' button - this.$$hey.prop('disabled', true); // disable the current button using jquery method - - // jconfirm button methods, all methods listed here - this.buttons.hello.setText('Helloooo'); // setText for 'hello' button - this.buttons.hey.disable(); // disable with button function provided by jconfirm - this.buttons.hey.enable(); // enable with button function provided by jconfirm - // the button's instance is passed as the first argument, for quick access - heyButton === this.buttons.hey - }, - heyThere: { - text: 'Hey there!', // text for button - btnClass: 'btn-blue', // class for the button - keys: ['enter', 'a'], // keyboard event for button - isHidden: false, // initially not hidden - isDisabled: false, // initially not disabled - action: function(heyThereButton) { - // longhand method to define a button - // provides more features - } - }, - } - }); - - } - - public confirm_6() { - $.confirm({ - buttons: { - hey: function() { - // here the button key 'hey' will be used as the text. - $.alert('You clicked on "hey".'); - }, - heyThere: { - text: 'hey there!', // With spaces and symbols - action: function() { - $.alert('You clicked on "heyThere"'); - } - } - } - }); - } - - public confirm_7() { - $.confirm({ - content: 'Time to use your keyboard, press shift, alert, A or B', - buttons: { - specialKey: { - text: 'On behalf of shift', - keys: ['shift', 'alt'], - action: function() { - $.alert('Shift or Alt was pressed'); - } - }, - alphabet: { - text: 'A, B', - keys: ['a', 'b'], - action: function() { - $.alert('A or B was pressed'); - } - } - } - }); - } - - public confirm_8() { - $.confirm({ - closeIcon: true, // explicitly show the close icon - buttons: { - buttonA: { - text: 'button a', - action: function(buttonA) { - this.buttons.resetButton.setText('reset button!!!'); - this.buttons.resetButton.disable(); - this.buttons.resetButton.enable(); - this.buttons.resetButton.hide(); - this.buttons.resetButton.show(); - this.buttons.resetButton.addClass('btn-red'); - this.buttons.resetButton.removeClass('btn-red'); - // or - this.$$resetButton // button's jquery element reference, go crazy - this.buttons.buttonA == buttonA // both are the same. - return false; // prevent the modal from closing - } - }, - resetButton: function(resetButton) {} - } - }); - } - - - public confirm_9() { - $.confirm({ - title: 'Encountered an error!', - content: 'Something went downhill, this may be serious', - type: 'red', - typeAnimated: true, - buttons: { - tryAgain: { - text: 'Try again', - btnClass: 'btn-red', - action: function() {} - }, - close: function() {} - } - }); - } - - public confirm_10() { - $.confirm({ - icon: 'glyphicon glyphicon-heart', - title: 'glyphicon' - }); - $.confirm({ - icon: 'fa fa-warning', - title: 'font-awesome' - }); - $.confirm({ - icon: 'fa fa-spinner fa-spin', - title: 'Working!', - content: 'Sit back, we are processing your request!' - }); - } - - public confirm_11() { - $.confirm({ - closeIcon: true - }); - - $.confirm({ - closeIcon: true, - closeIconClass: 'fa fa-close' - }); - } - - public confirm_12() { - $.confirm({ - closeIcon: function() { - return false; - }, - buttons: { - aRandomButton: function() { - $.alert('A random button is called, and i prevent closing the modal'); - return false; // you shall not pass - }, - close: function() {} - } - }); - } - - public confirm_13() { - $.confirm({ - columnClass: 'small' - }); - $.confirm({ - columnClass: 'col-md-4 col-md-offset-4', - }); - $.confirm({ - columnClass: 'col-md-12' - }); - $.confirm({ - columnClass: 'col-md-4 col-md-offset-8 col-xs-4 col-xs-offset-8', - containerFluid: true, // this will add 'container-fluid' instead of 'container' - }); - } - - public confirm_14() { - $.confirm({ - boxWidth: '30%', - useBootstrap: false, - }); - $.confirm({ - boxWidth: '500px', - useBootstrap: false, - }); - } - - public confirm_15() { - $.confirm({ - bootstrapClasses: { - container: 'container', - containerFluid: 'container-fluid', - row: 'row', - }, - }); - - $.confirm({ - title: 'Hello there', - content: 'click and hold on the title to drag', - draggable: true, - }); - - $.confirm({ - title: 'Hello there', - content: 'Drag this modal out of the window', - draggable: true, - dragWindowBorder: false, - }); - $.confirm({ - title: 'Hello there', - content: 'try to drag this modal out of the window', - draggable: true, - dragWindowGap: 0, // number of px of distance - }); - } - - public ajaxLoading() { - $.confirm({ - title: 'Title', - content: 'url:text.txt', - onContentReady: function() { - var self = this; - this.setContentPrepend('
Prepended text
'); - setTimeout(function() { - self.setContentAppend('
Appended text after 2 seconds
'); - }, 2000); - }, - columnClass: 'medium', - }); - - $.confirm({ - content: function() { - var self = this; - return $.ajax({ - url: 'bower.json', - dataType: 'json', - method: 'get' - }).done(function(response) { - self.setContent('Description: ' + response.description); - self.setContentAppend('
Version: ' + response.version); - self.setTitle(response.name); - }).fail(function() { - self.setContent('Something went wrong.'); - }); - } - }); - - $.confirm({ - content: 'url:text.txt', - contentLoaded: function(data, status, xhr) { - // data is already set in content - this.setContentAppend('
Status: ' + status); - } - }); - - $.confirm({ - content: function() { - var self = this; - self.setContent('Checking callback flow'); - return $.ajax({ - url: 'bower.json', - dataType: 'json', - method: 'get' - }).done(function(response) { - self.setContentAppend('
Done!
'); - }).fail(function() { - self.setContentAppend('
Fail!
'); - }).always(function() { - self.setContentAppend('
Always!
'); - }); - }, - contentLoaded: function(data, status, xhr) { - self.setContentAppend('
Content loaded!
'); - }, - onContentReady: function() { - this.setContentAppend('
Content ready!
'); - } - }); - - } - - public autoClose() { - $.confirm({ - title: 'Delete user?', - content: 'This dialog will automatically trigger \'cancel\' in 6 seconds if you don\'t respond.', - autoClose: 'cancelAction|8000', - buttons: { - deleteUser: { - text: 'delete user', - action: function() { - $.alert('Deleted the user!'); - } - }, - cancelAction: function() { - $.alert('action is canceled'); - } - } - }); - $.confirm({ - title: 'Logout?', - content: 'Your time is out, you will be automatically logged out in 10 seconds.', - autoClose: 'logoutUser|10000', - buttons: { - logoutUser: { - text: 'logout myself', - action: function() { - $.alert('The user was logged out'); - } - }, - cancel: function() { - $.alert('canceled'); - } - } - }); - } - - public backgroundDismisse() { - $.confirm({ - backgroundDismiss: true, // this will just close the modal - }); - $.confirm({ - backgroundDismiss: function() { - return false; // modal wont close. - }, - }); - $.confirm({ - backgroundDismiss: function() { - return 'buttonName'; // the button will handle it - }, - }); - $.confirm({ - backgroundDismiss: 'buttonName', - content: 'in here the backgroundDismiss action is handled by buttonName' + - '
', - buttons: { - buttonName: function() { - var $checkbox = this.$content.find('#enableCheckbox'); - return $checkbox.prop('checked'); - }, - close: function() {} - } - }); - } - - public backgroundDismisseAnimation(){ - $.confirm({ - backgroundDismiss: false, - backgroundDismissAnimation: 'shake', -}); -$.confirm({ - backgroundDismiss: false, - backgroundDismissAnimation: 'glow', -}); - } - - public escapeKey(){ - $.confirm({ - escapeKey: true, - backgroundDismiss: false, -}); -$.confirm({ - escapeKey: 'buttonName', - buttons: { - buttonName: function(){ - $.alert('Button name was called'); - }, - close: function(){ - } - } -}); - } - public rtlSupport(){ - $.alert({ - title: 'پیغام', - content: 'این یک متن به زبان شیرین فارسی است', - rtl: true, - closeIcon: true, - buttons: { - confirm: { - text: 'تایید', - btnClass: 'btn-blue', - action: function () { - $.alert('تایید شد.'); - } - }, - cancel: { - text: 'انصراف', - action: function () { - } - } - } -}); - - } - - public callBack(){ - $.confirm({ - title: false, - content: 'url:callback.html', - onContentReady: function () { - // when content is fetched & rendered in DOM - alert('onContentReady'); - var self = this; - this.buttons.ok.disable(); - this.$content.find('.btn').click(function(){ - self.$content.find('input').val('Chuck norris'); - self.buttons.ok.enable(); - }); - }, - contentLoaded: function(data, status, xhr){ - // when content is fetched - alert('contentLoaded: ' + status); - }, - onOpenBefore: function () { - // before the modal is displayed. - alert('onOpenBefore'); - }, - onOpen: function () { - // after the modal is displayed. - alert('onOpen'); - }, - onClose: function () { - // before the modal is hidden. - alert('onClose'); - }, - onDestroy: function () { - // when the modal is removed from DOM - alert('onDestroy'); - }, - onAction: function (btnName) { - // when a button is clicked, with the button name - alert('onAction: ' + btnName); - }, - buttons: { - ok: function(){ - } - } -}); - } public globalSettings(){ jconfirm.defaults = { title: 'Hello', @@ -584,8 +73,7 @@ $.confirm({ } }, }, - contentLoaded: function(data, status, xhr){ - }, + icon: '', lazyOpen: false, bgOpacity: null, @@ -642,16 +130,7 @@ $.confirm({ buttonA: { text: 'button a', action: function (buttonA: HTMLElement) { - this.buttons.resetButton.setText('reset button!!!'); - this.buttons.resetButton.disable(); - this.buttons.resetButton.enable(); - this.buttons.resetButton.hide(); - this.buttons.resetButton.show(); - this.buttons.resetButton.addClass('btn-red'); - this.buttons.resetButton.removeClass('btn-red'); - // or - this.$$resetButton // button's jquery element reference, go crazy - this.buttons.buttonA == buttonA // both are the same. + return false; // prevent the modal from closing } }, diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index c22896c8c2..ade096d977 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Alli Pierre Yotti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + interface JQueryStatic { /** * confirm Dialog @@ -21,6 +22,7 @@ interface JQueryStatic { * @param {any} pMessage */ dialog( pOtions: options.confirmOptions | string): void; + } From 3a84e4eed4b4dc2fa67fdbb131c068c09fc58fbc Mon Sep 17 00:00:00 2001 From: allipierre Date: Thu, 23 Nov 2017 15:40:52 +0100 Subject: [PATCH 036/322] remove some errors --- package.json | 6 ++-- types/confirmdialog/confirmdialog-tests.ts | 3 -- types/confirmdialog/index.d.ts | 8 ++++-- types/confirmdialog/tsconfig.json | 1 + types/confirmdialog/tslint.json | 32 +++++++++++++++++++++- 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index bef061f5bf..246d0b9d61 100644 --- a/package.json +++ b/package.json @@ -22,10 +22,12 @@ }, "devDependencies": { "dtslint": "github:Microsoft/dtslint#production", - "types-publisher": "Microsoft/types-publisher#production" + "types-publisher": "Microsoft/types-publisher#production", + "typescript": "^2.6.1" }, "dependencies": { "@types/jquery": "^3.2.16", - "jquery": "^3.2.1" + "jquery": "^3.1.1", + "typescript": "^2.6.1" } } diff --git a/types/confirmdialog/confirmdialog-tests.ts b/types/confirmdialog/confirmdialog-tests.ts index 77812221af..47ba509dc4 100644 --- a/types/confirmdialog/confirmdialog-tests.ts +++ b/types/confirmdialog/confirmdialog-tests.ts @@ -1,6 +1,3 @@ -import * as $ from 'jquery'; - - namespace server { export interface Iperson { title: string, diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index ade096d977..d20e0f8a27 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -3,13 +3,14 @@ // Definitions by: Alli Pierre Yotti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// -interface JQueryStatic { + interface JQueryStatic { /** * confirm Dialog * @param {confirmOptions} pOtions */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; /** * confirm alert @@ -26,7 +27,7 @@ interface JQueryStatic { } -interface JQuery { + interface JQuery { /** * confirm Dialog * @param {confirmOptions} pOtions @@ -52,6 +53,7 @@ interface Window { + declare namespace options { interface confirmOptions { diff --git a/types/confirmdialog/tsconfig.json b/types/confirmdialog/tsconfig.json index 76f091224e..187a733dba 100644 --- a/types/confirmdialog/tsconfig.json +++ b/types/confirmdialog/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": ["../"], "types": [], diff --git a/types/confirmdialog/tslint.json b/types/confirmdialog/tslint.json index 3db14f85ea..2f73ea817c 100644 --- a/types/confirmdialog/tslint.json +++ b/types/confirmdialog/tslint.json @@ -1 +1,31 @@ -{ "extends": "dtslint/dt.json" } +{ + "rules": { + "max-line-length": { + "options": [ + 120 + ] + }, + "new-parens": true, + "no-arg": true, + "no-bitwise": true, + "no-conditional-assignment": true, + "no-consecutive-blank-lines": false, + "no-console": { + "options": [ + "debug", + "info", + "log", + "time", + "timeEnd", + "trace" + ] + } + }, + "jsRules": { + "max-line-length": { + "options": [ + 120 + ] + } + } +} From 4bdef7f72fcae62f3379075492a32a364fc36fa5 Mon Sep 17 00:00:00 2001 From: allipierre Date: Thu, 23 Nov 2017 16:59:32 +0100 Subject: [PATCH 037/322] Remove interface confirmOptions --- package.json | 1 + types/concaveman/index.d.ts | 1 + types/confirmdialog/confirmdialog-tests.ts | 61 ------------ types/confirmdialog/index.d.ts | 81 +--------------- types/confirmdialog/tsconfig.json | 3 +- types/confirmdialog/tslint.json | 104 +++++++++++++++------ 6 files changed, 83 insertions(+), 168 deletions(-) diff --git a/package.json b/package.json index 246d0b9d61..61b734fec2 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "lint": "dtslint types" }, "devDependencies": { + "@types/node": "^8.0.53", "dtslint": "github:Microsoft/dtslint#production", "types-publisher": "Microsoft/types-publisher#production", "typescript": "^2.6.1" diff --git a/types/concaveman/index.d.ts b/types/concaveman/index.d.ts index 4c10ca6928..ed5da84fc9 100644 --- a/types/concaveman/index.d.ts +++ b/types/concaveman/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Denis Carriere // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare module "concaveman" { /** * A very fast 2D concave hull algorithm in JavaScript (generates a general outline of a point set). diff --git a/types/confirmdialog/confirmdialog-tests.ts b/types/confirmdialog/confirmdialog-tests.ts index 47ba509dc4..e1008442e1 100644 --- a/types/confirmdialog/confirmdialog-tests.ts +++ b/types/confirmdialog/confirmdialog-tests.ts @@ -47,67 +47,6 @@ class Confirm implements server.Iperson { } - public globalSettings(){ - jconfirm.defaults = { - title: 'Hello', - titleClass: '', - type: 'default', - typeAnimated: true, - draggable: true, - dragWindowGap: 15, - dragWindowBorder: true, - animateFromElement: true, - smoothContent: true, - content: 'Are you sure to continue?', - buttons: {}, - defaultButtons: { - ok: { - action: function () { - } - }, - close: { - action: function () { - } - }, - }, - - icon: '', - lazyOpen: false, - bgOpacity: null, - theme: 'light', - animation: 'scale', - closeAnimation: 'scale', - animationSpeed: 400, - animationBounce: 1, - rtl: false, - container: 'body', - containerFluid: false, - backgroundDismiss: false, - backgroundDismissAnimation: 'shake', - autoClose: false, - closeIcon: null, - closeIconClass: false, - watchInterval: 100, - columnClass: 'col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1', - boxWidth: '50%', - scrollToPreviousElement: true, - scrollToPreviousElementAnimate: true, - useBootstrap: true, - offsetTop: 40, - offsetBottom: 40, - bootstrapClasses: { - container: 'container', - containerFluid: 'container-fluid', - row: 'row', - }, - onContentReady: function () {}, - onOpenBefore: function () {}, - onOpen: function () {}, - onClose: function () {}, - onDestroy: function () {}, - onAction: function () {} -}; - } public api(){ var jc = $.confirm({ diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index d20e0f8a27..0f6b49cb5a 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js // Definitions by: Alli Pierre Yotti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// TypeScript Version: 2.3 /// interface JQueryStatic { @@ -10,7 +10,7 @@ * confirm Dialog * @param {confirmOptions} pOtions */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + confirm( pOtions: any | string, title?:string): boolean | void | HTMLElement | any; /** * confirm alert @@ -22,81 +22,6 @@ * confirm Dialog * @param {any} pMessage */ - dialog( pOtions: options.confirmOptions | string): void; - -} - - - interface JQuery { - /** - * confirm Dialog - * @param {confirmOptions} pOtions - */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; - - /** - * confirm alert - * @param {any} pMessage - */ - alert( pMessage?: any, title?:string): void; - - /** - * confirm Dialog - * @param {any} pMessage - */ - dialog( pOtions: options.confirmOptions | any): void; -} - -interface Window { - setContentAppend: any; -} - - - - -declare namespace options { - - interface confirmOptions { - buttons? : buttonOptionss | any, - title? : string | boolean, - content? : string | Function, - onContentReady?: Function, - lazyOpen?: boolean, - closeIcon?: boolean | Function, - type?: string, - typeAnimated?: boolean, - icon?: string, - closeIconClass?: string, - columnClass?: string, - containerFluid?: boolean, - boxWidth?: string, - useBootstrap?: boolean, - bootstrapClasses?: any, - draggable?: boolean, - dragWindowBorder?: boolean, - dragWindowGap?: number, - contentLoaded?: Function, - autoClose?: string, - backgroundDismiss?: boolean | Function | string, - backgroundDismissAnimation?: string, - escapeKey?: string | boolean, - onOpenBefore?:Function, - onOpen?: Function, - onClose?: Function, - onDestroy?: Function, - onAction?: Function - - - } - - interface buttonOptionss { - cancel?: Function, - confirm?: Function - } - -} - -declare namespace jconfirm { - let defaults: any; + dialog( pOtions: any | string): void; } diff --git a/types/confirmdialog/tsconfig.json b/types/confirmdialog/tsconfig.json index 187a733dba..95f33eb036 100644 --- a/types/confirmdialog/tsconfig.json +++ b/types/confirmdialog/tsconfig.json @@ -13,7 +13,8 @@ "typeRoots": ["../"], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "target": "es6" }, "files": [ "index.d.ts", diff --git a/types/confirmdialog/tslint.json b/types/confirmdialog/tslint.json index 2f73ea817c..a41bf5d19a 100644 --- a/types/confirmdialog/tslint.json +++ b/types/confirmdialog/tslint.json @@ -1,31 +1,79 @@ { - "rules": { - "max-line-length": { - "options": [ - 120 - ] - }, - "new-parens": true, - "no-arg": true, - "no-bitwise": true, - "no-conditional-assignment": true, - "no-consecutive-blank-lines": false, - "no-console": { - "options": [ - "debug", - "info", - "log", - "time", - "timeEnd", - "trace" - ] + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false } - }, - "jsRules": { - "max-line-length": { - "options": [ - 120 - ] - } - } } From 19f62c87dca1cd8ae5efd5b44a28dca41c06c2b2 Mon Sep 17 00:00:00 2001 From: allipierre Date: Thu, 23 Nov 2017 17:08:10 +0100 Subject: [PATCH 038/322] perform some alert dialog --- types/confirmdialog/confirmdialog-tests.ts | 61 ++++++++++++++++++ types/confirmdialog/index.d.ts | 75 ++++++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/types/confirmdialog/confirmdialog-tests.ts b/types/confirmdialog/confirmdialog-tests.ts index e1008442e1..47ba509dc4 100644 --- a/types/confirmdialog/confirmdialog-tests.ts +++ b/types/confirmdialog/confirmdialog-tests.ts @@ -47,6 +47,67 @@ class Confirm implements server.Iperson { } + public globalSettings(){ + jconfirm.defaults = { + title: 'Hello', + titleClass: '', + type: 'default', + typeAnimated: true, + draggable: true, + dragWindowGap: 15, + dragWindowBorder: true, + animateFromElement: true, + smoothContent: true, + content: 'Are you sure to continue?', + buttons: {}, + defaultButtons: { + ok: { + action: function () { + } + }, + close: { + action: function () { + } + }, + }, + + icon: '', + lazyOpen: false, + bgOpacity: null, + theme: 'light', + animation: 'scale', + closeAnimation: 'scale', + animationSpeed: 400, + animationBounce: 1, + rtl: false, + container: 'body', + containerFluid: false, + backgroundDismiss: false, + backgroundDismissAnimation: 'shake', + autoClose: false, + closeIcon: null, + closeIconClass: false, + watchInterval: 100, + columnClass: 'col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1', + boxWidth: '50%', + scrollToPreviousElement: true, + scrollToPreviousElementAnimate: true, + useBootstrap: true, + offsetTop: 40, + offsetBottom: 40, + bootstrapClasses: { + container: 'container', + containerFluid: 'container-fluid', + row: 'row', + }, + onContentReady: function () {}, + onOpenBefore: function () {}, + onOpen: function () {}, + onClose: function () {}, + onDestroy: function () {}, + onAction: function () {} +}; + } public api(){ var jc = $.confirm({ diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index 0f6b49cb5a..d8a025c8c8 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -25,3 +25,78 @@ dialog( pOtions: any | string): void; } + + + interface JQuery { + /** + * confirm Dialog + * @param {confirmOptions} pOtions + */ + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + + /** + * confirm alert + * @param {any} pMessage + */ + alert( pMessage?: any, title?:string): void; + + /** + * confirm Dialog + * @param {any} pMessage + */ + dialog( pOtions: options.confirmOptions | any): void; +} + +interface Window { + setContentAppend: any; +} + + + + +declare namespace options { + + interface confirmOptions { + buttons? : buttonOptionss | any, + title? : string | boolean, + content? : string | Function, + onContentReady?: Function, + lazyOpen?: boolean, + closeIcon?: boolean | Function, + type?: string, + typeAnimated?: boolean, + icon?: string, + closeIconClass?: string, + columnClass?: string, + containerFluid?: boolean, + boxWidth?: string, + useBootstrap?: boolean, + bootstrapClasses?: any, + draggable?: boolean, + dragWindowBorder?: boolean, + dragWindowGap?: number, + contentLoaded?: Function, + autoClose?: string, + backgroundDismiss?: boolean | Function | string, + backgroundDismissAnimation?: string, + escapeKey?: string | boolean, + onOpenBefore?:Function, + onOpen?: Function, + onClose?: Function, + onDestroy?: Function, + onAction?: Function + + + } + + interface buttonOptionss { + cancel?: Function, + confirm?: Function + } + +} + +declare namespace jconfirm { + let defaults: any; + +} From 0abd2e83e5c2a9ef371b2527e8091dc6821cf8b2 Mon Sep 17 00:00:00 2001 From: allipierre Date: Thu, 23 Nov 2017 17:12:52 +0100 Subject: [PATCH 039/322] add interface confirmOptions --- types/confirmdialog/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index d8a025c8c8..9be4d62489 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -10,7 +10,7 @@ * confirm Dialog * @param {confirmOptions} pOtions */ - confirm( pOtions: any | string, title?:string): boolean | void | HTMLElement | any; + confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; /** * confirm alert @@ -22,7 +22,7 @@ * confirm Dialog * @param {any} pMessage */ - dialog( pOtions: any | string): void; + dialog( pOtions: options.confirmOptions | string): void; } From 7dca1f3ac764c88f235c61d3270622bcab2869b6 Mon Sep 17 00:00:00 2001 From: Alex Lyman Date: Thu, 23 Nov 2017 12:09:01 -0800 Subject: [PATCH 040/322] Add type definitions for the loadware package --- types/loadware/index.d.ts | 16 ++++++++++++++++ types/loadware/loadware-tests.ts | 20 ++++++++++++++++++++ types/loadware/tsconfig.json | 23 +++++++++++++++++++++++ types/loadware/tslint.json | 1 + 4 files changed, 60 insertions(+) create mode 100644 types/loadware/index.d.ts create mode 100644 types/loadware/loadware-tests.ts create mode 100644 types/loadware/tsconfig.json create mode 100644 types/loadware/tslint.json diff --git a/types/loadware/index.d.ts b/types/loadware/index.d.ts new file mode 100644 index 0000000000..dc3f13437c --- /dev/null +++ b/types/loadware/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for loadware 2.0.0 +// Project: https://github.com/franciscop/loadware +// Definitions by: A.J.J. Lyman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// tslint:disable-next-line:ban-types +type AnyFunction = Function; + +declare function loadware(...loadable: Array>): ReadonlyArray; + +declare namespace loadware { + type Loadable = string | F | RecursiveLoadable; + interface RecursiveLoadable extends Array> { } +} + +export = loadware; diff --git a/types/loadware/loadware-tests.ts b/types/loadware/loadware-tests.ts new file mode 100644 index 0000000000..630d3fd351 --- /dev/null +++ b/types/loadware/loadware-tests.ts @@ -0,0 +1,20 @@ +import loadware = require("loadware"); + +interface Context { __ContextMarker: never; } +interface Response { __ResponseMarker: never; } +type Middleware = (ctx: Context) => void; + +loadware( + (_: Context) => {}, + [ + (_: Context) => {}, + 'loadware/requires-strings' + ], + [ + [ + [ + (_: Context) => {} + ] + ] + ] +); diff --git a/types/loadware/tsconfig.json b/types/loadware/tsconfig.json new file mode 100644 index 0000000000..5921615bf8 --- /dev/null +++ b/types/loadware/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "loadware-tests.ts" + ] +} \ No newline at end of file diff --git a/types/loadware/tslint.json b/types/loadware/tslint.json new file mode 100644 index 0000000000..c17ac4dd6d --- /dev/null +++ b/types/loadware/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dtslint.json" } From 15e10d681ca534c7764e88995874664dbec4104d Mon Sep 17 00:00:00 2001 From: allipierre Date: Thu, 23 Nov 2017 23:46:11 +0100 Subject: [PATCH 041/322] Added type definitions for jquery-notifier --- types/jquery-notifier/index.d.ts | 0 types/jquery-notifier/jquery-notifier-tests.ts | 0 types/jquery-notifier/jquery-notifier.d.ts | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 types/jquery-notifier/index.d.ts create mode 100644 types/jquery-notifier/jquery-notifier-tests.ts create mode 100644 types/jquery-notifier/jquery-notifier.d.ts diff --git a/types/jquery-notifier/index.d.ts b/types/jquery-notifier/index.d.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/jquery-notifier/jquery-notifier-tests.ts b/types/jquery-notifier/jquery-notifier-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/jquery-notifier/jquery-notifier.d.ts b/types/jquery-notifier/jquery-notifier.d.ts new file mode 100644 index 0000000000..e69de29bb2 From ea879349f0e056cb668caee1b0ce6c7b6e95f96e Mon Sep 17 00:00:00 2001 From: allipierre Date: Fri, 24 Nov 2017 00:12:54 +0100 Subject: [PATCH 042/322] Added type definitions for juery-notifier --- types/jquery-notifier/index.d.ts | 19 +++++ .../jquery-notifier/jquery-notifier-tests.ts | 36 +++++++++ types/jquery-notifier/jquery-notifier.d.ts | 0 types/jquery-notifier/tsconfig.json | 24 ++++++ types/jquery-notifier/tslint.json | 79 +++++++++++++++++++ 5 files changed, 158 insertions(+) delete mode 100644 types/jquery-notifier/jquery-notifier.d.ts create mode 100644 types/jquery-notifier/tsconfig.json create mode 100644 types/jquery-notifier/tslint.json diff --git a/types/jquery-notifier/index.d.ts b/types/jquery-notifier/index.d.ts index e69de29bb2..d67901b056 100644 --- a/types/jquery-notifier/index.d.ts +++ b/types/jquery-notifier/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for Notifier +// Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js +// Definitions by: Alli Pierre Yotti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare namespace notifier { + /** + * notifier.show(title, msg, type, icon, timeout); + * @param {title} title + * @param {msg} msg + * @param {type} type + * @param {icon} icon + * @param {timeout} timeout + */ + function show(title: string, msg: string, type: string, icon: string, timeout?: number): string | number; + function hide(notificationId: string | number): boolean; + +} diff --git a/types/jquery-notifier/jquery-notifier-tests.ts b/types/jquery-notifier/jquery-notifier-tests.ts index e69de29bb2..9d73bce3c5 100644 --- a/types/jquery-notifier/jquery-notifier-tests.ts +++ b/types/jquery-notifier/jquery-notifier-tests.ts @@ -0,0 +1,36 @@ +notifier.show('Hello!', 'I am a default notification.', '', '', 0); +notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', '', 0); +notifier.show('Well Done!', 'You just submit your resume successfuly.', '', '', 0); +notifier.show('Warning!', 'The data presented here can be change.', '', '', 0); +notifier.show('Sorry!', 'Could not complete your transaction.', '', '', 0); + + +notifier.show('Default!', 'I am a default notification.', '', 'img/clock-48.png', 0); +notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 0); +notifier.show('Well Done!', 'You just submit your resume successfuly.', '', 'img/ok-48.png', 0); +notifier.show('Warning!', 'The data presented here can be change.', '', 'img/medium_priority-48.png', 0); +notifier.show('Sorry!', 'Could not complete your transaction.', '', 'img/high_priority-48.png', 0); + + + +notifier.show('Default!', 'I am a default notification.', '', 'img/clock-48.png', 4000); +notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 4000); +notifier.show('Well Done!', 'You just submit your resume successfuly.', '', 'img/ok-48.png', 4000); +notifier.show('Warning!', 'The data presented here can be change.', '', 'img/medium_priority-48.png', 4000); +notifier.show('Sorry!', 'Could not complete your transaction.', '', 'img/high_priority-48.png', 4000); + + + + + var notificationId:string | number; + + var showNotification = function () { + notificationId = notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 4000); + }; + + var hideNotification = function () { + notifier.hide(notificationId); + }; + + document.querySelector('#btn-nt-show').addEventListener('click', showNotification); + document.querySelector('#btn-nt-hide').addEventListener('click', hideNotification); diff --git a/types/jquery-notifier/jquery-notifier.d.ts b/types/jquery-notifier/jquery-notifier.d.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/types/jquery-notifier/tsconfig.json b/types/jquery-notifier/tsconfig.json new file mode 100644 index 0000000000..b2178bf718 --- /dev/null +++ b/types/jquery-notifier/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery-notifier-tests.ts" + ] +} diff --git a/types/jquery-notifier/tslint.json b/types/jquery-notifier/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/jquery-notifier/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From 9d13bdab54ff3164c1e2243bf80658c54ffb68fd Mon Sep 17 00:00:00 2001 From: allipierre Date: Fri, 24 Nov 2017 00:19:43 +0100 Subject: [PATCH 043/322] Add types definition for jquery-notifier --- types/jquery-notifier/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery-notifier/index.d.ts b/types/jquery-notifier/index.d.ts index d67901b056..4c733ce0df 100644 --- a/types/jquery-notifier/index.d.ts +++ b/types/jquery-notifier/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Notifier -// Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js +// Project: https://github.com/allipierre/jquery-notifier // Definitions by: Alli Pierre Yotti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 85ed772c92df82221ac132a0e9d33c561c31c184 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 09:44:54 +0900 Subject: [PATCH 044/322] Cleanup unnecessary rule invalidation setting --- types/ejs/tslint.json | 67 +------------------------------------------ 1 file changed, 1 insertion(+), 66 deletions(-) diff --git a/types/ejs/tslint.json b/types/ejs/tslint.json index a41bf5d19a..95db3aea31 100644 --- a/types/ejs/tslint.json +++ b/types/ejs/tslint.json @@ -1,79 +1,14 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, "callable-types": false, - "comment-format": false, "dt-header": false, - "eofline": false, "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } } From 326da556b0920c36bc290bb32bf5cf4acfc0d183 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 09:49:25 +0900 Subject: [PATCH 045/322] Cleanup lint ignore error: dt-header --- types/ejs/index.d.ts | 4 ++-- types/ejs/tslint.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index a5bfb23ee9..8eae387b06 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for ejs.js v2.3.3 +// Type definitions for ejs.js 2.3 // Project: http://ejs.co/ -// Definitions by: Ben Liddicott +// Definitions by: Ben Liddicott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Ejs { diff --git a/types/ejs/tslint.json b/types/ejs/tslint.json index 95db3aea31..6c97118099 100644 --- a/types/ejs/tslint.json +++ b/types/ejs/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { "callable-types": false, - "dt-header": false, "export-just-namespace": false, "interface-over-type-literal": false, "no-padding": false, From d22dd362f4defa0656a364ee416dfdcc473e57cd Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 09:51:00 +0900 Subject: [PATCH 046/322] Cleanup lint error: no-padding --- types/ejs/index.d.ts | 1 - types/ejs/tslint.json | 1 - 2 files changed, 2 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index 8eae387b06..c1c1969be3 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -46,7 +46,6 @@ declare namespace Ejs { generateSource(): any; parseTemplateText(): string[]; scanLine(line: string): any; - } namespace Template { interface MODES { diff --git a/types/ejs/tslint.json b/types/ejs/tslint.json index 6c97118099..d01f83708a 100644 --- a/types/ejs/tslint.json +++ b/types/ejs/tslint.json @@ -4,7 +4,6 @@ "callable-types": false, "export-just-namespace": false, "interface-over-type-literal": false, - "no-padding": false, "no-var-keyword": false, "object-literal-shorthand": false, "prefer-const": false, From 8f627efc6476dd4ef9e7cd3addbc6af436237bff Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 09:52:18 +0900 Subject: [PATCH 047/322] Cleanup lint ignore error: callable-types --- types/ejs/index.d.ts | 4 +--- types/ejs/tslint.json | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index c1c1969be3..5a52399e17 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -19,9 +19,7 @@ declare namespace Ejs { function clearCache(): any; - interface TemplateFunction { - (data: Data): any; - } + type TemplateFunction = (data: Data) => any; interface Options { cache?: any; filename?: string; diff --git a/types/ejs/tslint.json b/types/ejs/tslint.json index d01f83708a..001a94fd06 100644 --- a/types/ejs/tslint.json +++ b/types/ejs/tslint.json @@ -1,7 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "callable-types": false, "export-just-namespace": false, "interface-over-type-literal": false, "no-var-keyword": false, From dd60fa13a8f28fdde72de494ae6e42ba10d14bcb Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 09:53:35 +0900 Subject: [PATCH 048/322] Cleanup lint ignore error: prefer-const --- types/ejs/ejs-tests.ts | 4 ++-- types/ejs/tslint.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/ejs/ejs-tests.ts b/types/ejs/ejs-tests.ts index b5b46f03b5..f7ad42ab73 100644 --- a/types/ejs/ejs-tests.ts +++ b/types/ejs/ejs-tests.ts @@ -1,3 +1,3 @@ import ejs = require("ejs"); -var people = ['geddy', 'neil', 'alex']; -var html = ejs.render('<%= people.join(", "); %>', { people: people }); +const people = ['geddy', 'neil', 'alex']; +const html = ejs.render('<%= people.join(", "); %>', { people: people }); diff --git a/types/ejs/tslint.json b/types/ejs/tslint.json index 001a94fd06..f697c232f4 100644 --- a/types/ejs/tslint.json +++ b/types/ejs/tslint.json @@ -5,7 +5,6 @@ "interface-over-type-literal": false, "no-var-keyword": false, "object-literal-shorthand": false, - "prefer-const": false, "unified-signatures": false } } From 57f6d33af3bc0d6796eb1199802c5007138e57b2 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 09:54:56 +0900 Subject: [PATCH 049/322] Cleanup lint ignore error: no-var-keyword --- types/ejs/index.d.ts | 8 ++++---- types/ejs/tslint.json | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index 5a52399e17..7532fbd3cc 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -6,8 +6,8 @@ declare namespace Ejs { type Data = { [name: string]: any }; type Dependencies = string[]; - var cache: Cache; - var localsName: string; + let cache: Cache; + let localsName: string; function resolveInclude(name: string, filename: string): string; function compile(template: string, opts?: Options): (TemplateFunction); function render(template: string, data?: Data, opts?: Options): string; @@ -76,8 +76,8 @@ declare namespace Ejs { function isAbsolute(path: string): boolean; function join(...args: string[]): string; function relative(from: string, to: string): string; - var sep: string; - var delimiter: string; + let sep: string; + let delimiter: string; function dirname(path: string): string; function basename(path: string): string; function extname(path: string): string; diff --git a/types/ejs/tslint.json b/types/ejs/tslint.json index f697c232f4..06b9038d96 100644 --- a/types/ejs/tslint.json +++ b/types/ejs/tslint.json @@ -3,7 +3,6 @@ "rules": { "export-just-namespace": false, "interface-over-type-literal": false, - "no-var-keyword": false, "object-literal-shorthand": false, "unified-signatures": false } From 33d331a29745e77550f90deef9246691bc9c45b2 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 09:59:13 +0900 Subject: [PATCH 050/322] cleanup lint ignore error: export-just-namespace --- types/ejs/index.d.ts | 152 ++++++++++++++++++++---------------------- types/ejs/tslint.json | 1 - 2 files changed, 74 insertions(+), 79 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index 7532fbd3cc..0fade248a9 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -3,85 +3,81 @@ // Definitions by: Ben Liddicott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace Ejs { - type Data = { [name: string]: any }; - type Dependencies = string[]; - let cache: Cache; - let localsName: string; - function resolveInclude(name: string, filename: string): string; - function compile(template: string, opts?: Options): (TemplateFunction); - function render(template: string, data?: Data, opts?: Options): string; +export type Data = { [name: string]: any }; +export type Dependencies = string[]; +export let cache: Cache; +export let localsName: string; +export function resolveInclude(name: string, filename: string): string; +export function compile(template: string, opts?: Options): (TemplateFunction); +export function render(template: string, data?: Data, opts?: Options): string; - type RenderFileCallback = (err: Error, str?: string) => T; - function renderFile(path: string, cb: RenderFileCallback): T; - function renderFile(path: string, data: Data, cb: RenderFileCallback): T; - function renderFile(path: string, data: Data, opts: Options, cb: RenderFileCallback): T; +export type RenderFileCallback = (err: Error, str?: string) => T; +export function renderFile(path: string, cb: RenderFileCallback): T; +export function renderFile(path: string, data: Data, cb: RenderFileCallback): T; +export function renderFile(path: string, data: Data, opts: Options, cb: RenderFileCallback): T; - function clearCache(): any; +export function clearCache(): any; - type TemplateFunction = (data: Data) => any; - interface Options { - cache?: any; - filename?: string; - context?: any; - compileDebug?: boolean; - client?: boolean; - delimiter?: string; - debug?: any; - _with?: boolean; - } - class Template { - constructor(text: string, opts: Options); - opts: Options; - templateText: string; - mode: string; - truncate: boolean; - currentLine: number; - source: string; - dependencies: Dependencies; - createRegex(): RegExp; - compile(): TemplateFunction; - generateSource(): any; - parseTemplateText(): string[]; - scanLine(line: string): any; - } - namespace Template { - interface MODES { - EVAL: string; - ESCAPED: string; - RAW: string; - COMMENT: string; - LITERAL: string; - } - } - function escapeRegexChars(s: string): string; - function escapeXML(markup: string): string; - function shallowCopy(to: T1, fro: any): T1; - interface Cache { - _data: { [name: string]: any }; - set(key: string, val: any): any; - get(key: string): any; - } - function resolve(from1: string, to: string): string; - function resolve(from1: string, from2: string, to: string): string; - function resolve(from1: string, from2: string, from3: string, to: string): string; - function resolve(from1: string, from2: string, from3: string, from4: string, to: string): string; - function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, to: string): string; - function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, to: string): string; - function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, to: string): string; - function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, to: string): string; - function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, from9: string, to: string): string; - function resolve(...args: string[]): string; - function normalize(path: string): string; - function isAbsolute(path: string): boolean; - function join(...args: string[]): string; - function relative(from: string, to: string): string; - let sep: string; - let delimiter: string; - function dirname(path: string): string; - function basename(path: string): string; - function extname(path: string): string; - function filter(xs: any, f: any): any; // TODO WHUT? +export type TemplateFunction = (data: Data) => any; +export interface Options { + cache?: any; + filename?: string; + context?: any; + compileDebug?: boolean; + client?: boolean; + delimiter?: string; + debug?: any; + _with?: boolean; } - -export = Ejs; +export class Template { + constructor(text: string, opts: Options); + opts: Options; + templateText: string; + mode: string; + truncate: boolean; + currentLine: number; + source: string; + dependencies: Dependencies; + createRegex(): RegExp; + compile(): TemplateFunction; + generateSource(): any; + parseTemplateText(): string[]; + scanLine(line: string): any; +} +export namespace Template { + interface MODES { + EVAL: string; + ESCAPED: string; + RAW: string; + COMMENT: string; + LITERAL: string; + } +} +export function escapeRegexChars(s: string): string; +export function escapeXML(markup: string): string; +export function shallowCopy(to: T1, fro: any): T1; +export interface Cache { + _data: { [name: string]: any }; + set(key: string, val: any): any; + get(key: string): any; +} +export function resolve(from1: string, to: string): string; +export function resolve(from1: string, from2: string, to: string): string; +export function resolve(from1: string, from2: string, from3: string, to: string): string; +export function resolve(from1: string, from2: string, from3: string, from4: string, to: string): string; +export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, to: string): string; +export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, to: string): string; +export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, to: string): string; +export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, to: string): string; +export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, from9: string, to: string): string; +export function resolve(...args: string[]): string; +export function normalize(path: string): string; +export function isAbsolute(path: string): boolean; +export function join(...args: string[]): string; +export function relative(from: string, to: string): string; +export let sep: string; +export let delimiter: string; +export function dirname(path: string): string; +export function basename(path: string): string; +export function extname(path: string): string; +export function filter(xs: any, f: any): any; // TODO WHUT? diff --git a/types/ejs/tslint.json b/types/ejs/tslint.json index 06b9038d96..a3126dd180 100644 --- a/types/ejs/tslint.json +++ b/types/ejs/tslint.json @@ -1,7 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "export-just-namespace": false, "interface-over-type-literal": false, "object-literal-shorthand": false, "unified-signatures": false From a9b2387bce0ff711a7c3543e705e91b9dbad2c1e Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 10:01:17 +0900 Subject: [PATCH 051/322] Cleanup lint ignore error: interface-over-type-literal --- types/ejs/index.d.ts | 4 +++- types/ejs/tslint.json | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index 0fade248a9..b7a8c6a191 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -3,7 +3,9 @@ // Definitions by: Ben Liddicott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export type Data = { [name: string]: any }; +export interface Data { + [name: string]: any; +} export type Dependencies = string[]; export let cache: Cache; export let localsName: string; diff --git a/types/ejs/tslint.json b/types/ejs/tslint.json index a3126dd180..ffc654f941 100644 --- a/types/ejs/tslint.json +++ b/types/ejs/tslint.json @@ -1,7 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-over-type-literal": false, "object-literal-shorthand": false, "unified-signatures": false } From 00121a0418878414f9b1510725e4031c418f8b2b Mon Sep 17 00:00:00 2001 From: Alex Lyman Date: Thu, 23 Nov 2017 18:56:17 -0800 Subject: [PATCH 052/322] Fix linting failure. Weird, when I run lint locally, it demands that I have the tslint.json derived from "dtslint/dtslint.json" but Travis CI apparently disagrees and wants "dtslint/dt.json". --- types/loadware/index.d.ts | 2 +- types/loadware/tslint.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/loadware/index.d.ts b/types/loadware/index.d.ts index dc3f13437c..7c45225d44 100644 --- a/types/loadware/index.d.ts +++ b/types/loadware/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for loadware 2.0.0 +// Type definitions for loadware 2.0 // Project: https://github.com/franciscop/loadware // Definitions by: A.J.J. Lyman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/loadware/tslint.json b/types/loadware/tslint.json index c17ac4dd6d..6746359dda 100644 --- a/types/loadware/tslint.json +++ b/types/loadware/tslint.json @@ -1 +1,3 @@ -{ "extends": "dtslint/dtslint.json" } +{ + "extends": "dtslint/dt.json" +} From eeb464569d58173070ecd79a0beb6707bc2498c4 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 12:00:35 +0900 Subject: [PATCH 053/322] There is no resolve(). --- types/ejs/index.d.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index b7a8c6a191..76a47ca94c 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -63,16 +63,6 @@ export interface Cache { set(key: string, val: any): any; get(key: string): any; } -export function resolve(from1: string, to: string): string; -export function resolve(from1: string, from2: string, to: string): string; -export function resolve(from1: string, from2: string, from3: string, to: string): string; -export function resolve(from1: string, from2: string, from3: string, from4: string, to: string): string; -export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, to: string): string; -export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, to: string): string; -export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, to: string): string; -export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, to: string): string; -export function resolve(from1: string, from2: string, from3: string, from4: string, from5: string, from6: string, from7: string, from8: string, from9: string, to: string): string; -export function resolve(...args: string[]): string; export function normalize(path: string): string; export function isAbsolute(path: string): boolean; export function join(...args: string[]): string; From 996c9c0db36aba5406bb84e7b7da69cfabca3b51 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 13:07:06 +0900 Subject: [PATCH 054/322] Add Options. --- types/ejs/index.d.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index 76a47ca94c..7918de773a 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -22,14 +22,19 @@ export function clearCache(): any; export type TemplateFunction = (data: Data) => any; export interface Options { - cache?: any; + cache?: boolean; filename?: string; + root?: string; context?: any; compileDebug?: boolean; client?: boolean; delimiter?: string; - debug?: any; + debug?: boolean; + strict?: boolean; _with?: boolean; + localsName?: string; + rmWhitespace?: boolean; + escape?(str: string): string; } export class Template { constructor(text: string, opts: Options); From 5d9f85b6934b9487354930b0bf646e291f125970 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 13:07:34 +0900 Subject: [PATCH 055/322] Delete Not API class --- types/ejs/index.d.ts | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index 7918de773a..a64deb7ded 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -36,30 +36,7 @@ export interface Options { rmWhitespace?: boolean; escape?(str: string): string; } -export class Template { - constructor(text: string, opts: Options); - opts: Options; - templateText: string; - mode: string; - truncate: boolean; - currentLine: number; - source: string; - dependencies: Dependencies; - createRegex(): RegExp; - compile(): TemplateFunction; - generateSource(): any; - parseTemplateText(): string[]; - scanLine(line: string): any; -} -export namespace Template { - interface MODES { - EVAL: string; - ESCAPED: string; - RAW: string; - COMMENT: string; - LITERAL: string; - } -} + export function escapeRegexChars(s: string): string; export function escapeXML(markup: string): string; export function shallowCopy(to: T1, fro: any): T1; From b6df77415caf3bf4703e85f939483641ee84b75d Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 13:38:46 +0900 Subject: [PATCH 056/322] Delete unexported export --- types/ejs/index.d.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index a64deb7ded..49d1cb368b 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -6,7 +6,6 @@ export interface Data { [name: string]: any; } -export type Dependencies = string[]; export let cache: Cache; export let localsName: string; export function resolveInclude(name: string, filename: string): string; @@ -39,19 +38,9 @@ export interface Options { export function escapeRegexChars(s: string): string; export function escapeXML(markup: string): string; -export function shallowCopy(to: T1, fro: any): T1; export interface Cache { _data: { [name: string]: any }; set(key: string, val: any): any; get(key: string): any; } -export function normalize(path: string): string; -export function isAbsolute(path: string): boolean; -export function join(...args: string[]): string; -export function relative(from: string, to: string): string; -export let sep: string; export let delimiter: string; -export function dirname(path: string): string; -export function basename(path: string): string; -export function extname(path: string): string; -export function filter(xs: any, f: any): any; // TODO WHUT? From cd4e399afff7203e02201a629fe9a833598bca99 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 13:52:23 +0900 Subject: [PATCH 057/322] ADD JSDoc and add isDir from resolveInclude(). and typed clearCache(). --- types/ejs/index.d.ts | 89 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 5 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index 49d1cb368b..771ab220e6 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -2,45 +2,124 @@ // Project: http://ejs.co/ // Definitions by: Ben Liddicott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 export interface Data { [name: string]: any; } +/** + * EJS template function cache. This can be a LRU object from lru-cache NPM + * module. By default, it is {@link module:utils.cache}, a simple in-process + * cache that grows continuously. + */ export let cache: Cache; +/** + * Name of the object containing the locals. + * + * This variable is overridden by {@link Options}`.localsName` if it is not + * `undefined`. + */ export let localsName: string; -export function resolveInclude(name: string, filename: string): string; +/** + * Get the path to the included file from the parent file path and the + * specified path. + */ +export function resolveInclude(name: string, filename: string, isDir: boolean): string; +/** + * Compile the given `str` of ejs into a template function. + */ export function compile(template: string, opts?: Options): (TemplateFunction); +/** + * Render the given `template` of ejs. + * + * If you would like to include options but not data, you need to explicitly + * call this function with `data` being an empty object or `null`. + */ export function render(template: string, data?: Data, opts?: Options): string; export type RenderFileCallback = (err: Error, str?: string) => T; + +/** + * Render an EJS file at the given `path` and callback `cb(err, str)`. + * + * If you would like to include options but not data, you need to explicitly + * call this function with `data` being an empty object or `null`. + */ export function renderFile(path: string, cb: RenderFileCallback): T; export function renderFile(path: string, data: Data, cb: RenderFileCallback): T; export function renderFile(path: string, data: Data, opts: Options, cb: RenderFileCallback): T; -export function clearCache(): any; +/** + * Clear intermediate JavaScript cache. Calls {@link Cache#reset}. + */ +export function clearCache(): void; export type TemplateFunction = (data: Data) => any; export interface Options { + /** Compiled functions are cached, requires `filename` */ cache?: boolean; + /** + * The name of the file being rendered. Not required if you are using `renderFile()`. + * Used by `cache` to key caches, and for includes. + */ filename?: string; + /** Set project root for includes with an absolute path (/file.ejs). */ root?: string; + /** Function execution context */ context?: any; + /** When `false` no debug instrumentation is compiled */ compileDebug?: boolean; + /** When `true`, compiles a function that can be rendered in the browser without needing to load the EJS Runtime (ejs.min.js). */ client?: boolean; + /** Character to use with angle brackets for open/close */ delimiter?: string; + /** Output generated function body */ debug?: boolean; + /** When set to `true`, generated function is in strict mode */ strict?: boolean; + /** + * Whether or not to use `with() {}` constructs. + * If `false` then the locals will be stored in the `locals` object. Set to `false` in strict mode. + */ _with?: boolean; + /** Name to use for the object storing local variables when not using `with` Defaults to `locals` */ localsName?: string; + /** + * Remove all safe-to-remove whitespace, including leading and trailing whitespace. + * It also enables a safer version of `-%>` line slurping for all scriptlet tags (it does not strip new lines of tags in the middle of a line). + */ rmWhitespace?: boolean; + /** + * The escaping function used with `<%=` construct. + * It is used in rendering and is `.toString()`ed in the generation of client functions. + * (By default escapes XML). + */ escape?(str: string): string; } export function escapeRegexChars(s: string): string; +/** + * Escape characters reserved in XML. + * + * This is simply an export of {@link module:utils.escapeXML}. + * + * If `markup` is `undefined` or `null`, the empty string is returned. + */ export function escapeXML(markup: string): string; export interface Cache { - _data: { [name: string]: any }; - set(key: string, val: any): any; - get(key: string): any; + _data: { [name: string]: TemplateFunction; }; + set(key: string, val: TemplateFunction): TemplateFunction; + get(key: string): TemplateFunction; } export let delimiter: string; + +/** + * Custom file loader. Useful for template preprocessing or restricting access + * to a certain part of the filesystem. + */ +export function fileLoader(filePath: string): string; + +/** + * Name for detection of EJS. + */ +export const name = "ejs"; From b8cabc4f9961690607009150de7e7eca79bbaadc Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 13:55:09 +0900 Subject: [PATCH 058/322] Add Tests and Cleanup ignore lint errors --- types/ejs/ejs-tests.ts | 34 +++++++++++++++++++++++++++++++++- types/ejs/tslint.json | 8 +------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/types/ejs/ejs-tests.ts b/types/ejs/ejs-tests.ts index f7ad42ab73..8c6dae9965 100644 --- a/types/ejs/ejs-tests.ts +++ b/types/ejs/ejs-tests.ts @@ -1,3 +1,35 @@ import ejs = require("ejs"); +import * as fs from 'graceful-fs'; + +const fileName = 'test.ejs'; const people = ['geddy', 'neil', 'alex']; -const html = ejs.render('<%= people.join(", "); %>', { people: people }); +const data = { people }; +const template = '<%= people.join(", "); %>'; +const options = {delimiter: '$'}; +let result: string; +let cacheResult: string; +let ejsFunction: ejs.TemplateFunction; + +const SimpleCallback = (err: any, html?: string) => { + if (err) { + return null; + } + return html; +}; + +result = ejs.render(template); +result = ejs.render(template, data); +result = ejs.render(template, data, options); + +cacheResult = ejs.renderFile(fileName, SimpleCallback); +cacheResult = ejs.renderFile(fileName, data, SimpleCallback); +cacheResult = ejs.renderFile(fileName, data, options, SimpleCallback); + +ejsFunction = ejs.compile(template); +ejsFunction({}); +ejsFunction(data); +ejs.compile(template, options); + +ejs.fileLoader = (str: string) => str; + +ejs.clearCache(); diff --git a/types/ejs/tslint.json b/types/ejs/tslint.json index ffc654f941..3db14f85ea 100644 --- a/types/ejs/tslint.json +++ b/types/ejs/tslint.json @@ -1,7 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "object-literal-shorthand": false, - "unified-signatures": false - } -} +{ "extends": "dtslint/dt.json" } From ae1ea523661007e218fc57e903e58859fafc431d Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 14:03:37 +0900 Subject: [PATCH 059/322] Fixed Cache methods --- types/ejs/ejs-tests.ts | 4 ++++ types/ejs/index.d.ts | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/ejs/ejs-tests.ts b/types/ejs/ejs-tests.ts index 8c6dae9965..40c610dd59 100644 --- a/types/ejs/ejs-tests.ts +++ b/types/ejs/ejs-tests.ts @@ -1,5 +1,7 @@ import ejs = require("ejs"); import * as fs from 'graceful-fs'; +import LRU = require("lru-cache"); +import { TemplateFunction } from "ejs"; const fileName = 'test.ejs'; const people = ['geddy', 'neil', 'alex']; @@ -33,3 +35,5 @@ ejs.compile(template, options); ejs.fileLoader = (str: string) => str; ejs.clearCache(); + +ejs.cache = LRU(100); diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index 771ab220e6..9d1294e681 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -107,8 +107,7 @@ export function escapeRegexChars(s: string): string; */ export function escapeXML(markup: string): string; export interface Cache { - _data: { [name: string]: TemplateFunction; }; - set(key: string, val: TemplateFunction): TemplateFunction; + set(key: string, val: TemplateFunction): void; get(key: string): TemplateFunction; } export let delimiter: string; From a8f40e9d04cdd6db77b40eae834f875de91e1caa Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 24 Nov 2017 14:13:23 +0900 Subject: [PATCH 060/322] remove test import graceful-fs --- types/ejs/ejs-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/ejs/ejs-tests.ts b/types/ejs/ejs-tests.ts index 40c610dd59..89b0479529 100644 --- a/types/ejs/ejs-tests.ts +++ b/types/ejs/ejs-tests.ts @@ -1,5 +1,4 @@ import ejs = require("ejs"); -import * as fs from 'graceful-fs'; import LRU = require("lru-cache"); import { TemplateFunction } from "ejs"; From c55d3e9d4b9d2ea354e56504fd69b8aabd8e3445 Mon Sep 17 00:00:00 2001 From: allipierre Date: Fri, 24 Nov 2017 08:17:19 +0100 Subject: [PATCH 061/322] remove other rules in tslint.json --- types/confirmdialog/confirmdialog-tests.ts | 68 ++++++--------- types/confirmdialog/index.d.ts | 85 +++++++++---------- types/confirmdialog/tslint.json | 80 +---------------- types/jquery-notifier/index.d.ts | 5 +- .../jquery-notifier/jquery-notifier-tests.ts | 23 ++--- types/jquery-notifier/tslint.json | 80 +---------------- 6 files changed, 77 insertions(+), 264 deletions(-) diff --git a/types/confirmdialog/confirmdialog-tests.ts b/types/confirmdialog/confirmdialog-tests.ts index 47ba509dc4..cd2ad0e8ca 100644 --- a/types/confirmdialog/confirmdialog-tests.ts +++ b/types/confirmdialog/confirmdialog-tests.ts @@ -1,37 +1,27 @@ -namespace server { - export interface Iperson { - title: string, - content: string, - - - } -} - -class Confirm implements server.Iperson { +class Confirm { private title_: string; private conTent_: string; - constructor(public title: string, public content: string) { + constructor(title: string, content: string) { this.title_ = title; this.conTent_ = content; } - - public confirm() { + confirm() { $.confirm({ title: 'Confirm!', content: 'Simple confirm!', buttons: { - confirm: function() { + confirm: () => { $.alert('Confirmed!'); }, - cancel: function(cancel: string) { + cancel: (cancel: string) => { $.alert('Canceled! ' + cancel); }, somethingElse: { text: 'Something else', btnClass: 'btn-blue', keys: ['enter', 'shift'], - action: function() { + action: () => { alert('Something else?'); } } @@ -39,15 +29,14 @@ class Confirm implements server.Iperson { }); } - public alert() { + alert() { $.alert({ title: 'Alert!', content: 'Simple alert!', }); } - - public globalSettings(){ + globalSettings() { jconfirm.defaults = { title: 'Hello', titleClass: '', @@ -62,11 +51,11 @@ class Confirm implements server.Iperson { buttons: {}, defaultButtons: { ok: { - action: function () { + action: () => { } }, close: { - action: function () { + action: () => { } }, }, @@ -100,46 +89,41 @@ class Confirm implements server.Iperson { containerFluid: 'container-fluid', row: 'row', }, - onContentReady: function () {}, - onOpenBefore: function () {}, - onOpen: function () {}, - onClose: function () {}, - onDestroy: function () {}, - onAction: function () {} + onContentReady: () => {}, + onOpenBefore: () => {}, + onOpen: () => {}, + onClose: () => {}, + onDestroy: () => {}, + onAction: () => {} }; } - public api(){ - var jc = $.confirm({ + api() { + const jc = $.confirm({ title: 'awesome', - onContentReady: function(){ - // this === jc - //jc.setTitle(title: string); + onContentReady: () => { + jc.setTitle(); } }); } - - public confirm_84() { + confirm_84() { $.confirm({ closeIcon: true, buttons: { buttonA: { text: 'button a', - action: function (buttonA: HTMLElement) { - + action: (buttonA: string) => { return false; // prevent the modal from closing } }, - resetButton: function (resetButton: string) { + resetButton: (resetButton: string) => { } } }); } - } - -var firstName: string = 'Pierre'; -var lastName: string = 'Yotti'; -var type = new Confirm(firstName, lastName); +let firstName = 'Pierre'; +let lastName = 'Yotti'; +let type = new Confirm(firstName, lastName); diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index 9be4d62489..39a507f8ac 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for confirmdialog v3.3.0 +// Type definitions for confirmdialog 3.3 // Project: https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js // Definitions by: Alli Pierre Yotti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 + /// interface JQueryStatic { @@ -10,93 +11,83 @@ * confirm Dialog * @param {confirmOptions} pOtions */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + confirm(pOtions: options.confirmOptions | string, title?: string): any; /** * confirm alert * @param {any} pMessage */ - alert( pMessage?: any | string, title?:string): void; + alert(pMessage?: any | string, title?: string): any; /** * confirm Dialog * @param {any} pMessage */ - dialog( pOtions: options.confirmOptions | string): void; - + dialog(pOtions: options.confirmOptions | string): any; } - interface JQuery { /** * confirm Dialog * @param {confirmOptions} pOtions */ - confirm( pOtions: options.confirmOptions | string, title?:string): boolean | void | HTMLElement | any; + confirm(pOtions: options.confirmOptions | string, title?: string): any; /** * confirm alert * @param {any} pMessage */ - alert( pMessage?: any, title?:string): void; + alert(pMessage?: any, title?: string): any; /** * confirm Dialog * @param {any} pMessage */ - dialog( pOtions: options.confirmOptions | any): void; + dialog(pOtions: options.confirmOptions | any): any; } interface Window { setContentAppend: any; } - - - declare namespace options { - interface confirmOptions { - buttons? : buttonOptionss | any, - title? : string | boolean, - content? : string | Function, - onContentReady?: Function, - lazyOpen?: boolean, - closeIcon?: boolean | Function, - type?: string, - typeAnimated?: boolean, - icon?: string, - closeIconClass?: string, - columnClass?: string, - containerFluid?: boolean, - boxWidth?: string, - useBootstrap?: boolean, - bootstrapClasses?: any, - draggable?: boolean, - dragWindowBorder?: boolean, - dragWindowGap?: number, - contentLoaded?: Function, - autoClose?: string, - backgroundDismiss?: boolean | Function | string, - backgroundDismissAnimation?: string, - escapeKey?: string | boolean, - onOpenBefore?:Function, - onOpen?: Function, - onClose?: Function, - onDestroy?: Function, - onAction?: Function - - + buttons?: buttonOptionss | any; + title?: string | boolean; + content?: any; + onContentReady?: any; + lazyOpen?: boolean; + closeIcon?: boolean | any; + type?: string; + typeAnimated?: boolean; + icon?: string; + closeIconClass?: string; + columnClass?: string; + containerFluid?: boolean; + boxWidth?: string; + useBootstrap?: boolean; + bootstrapClasses?: any; + draggable?: boolean; + dragWindowBorder?: boolean; + dragWindowGap?: number; + contentLoaded?: () => void; + autoClose?: string; + backgroundDismiss?: boolean | any | string; + backgroundDismissAnimation?: string; + escapeKey?: string | boolean; + onOpenBefore?: () => void; + onOpen?: () => void; + onClose?: () => void; + onDestroy?: () => void; + onAction?: () => void; } interface buttonOptionss { - cancel?: Function, - confirm?: Function + cancel?: () => void; + confirm?: () => void; } - } declare namespace jconfirm { let defaults: any; - } diff --git a/types/confirmdialog/tslint.json b/types/confirmdialog/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/confirmdialog/tslint.json +++ b/types/confirmdialog/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } diff --git a/types/jquery-notifier/index.d.ts b/types/jquery-notifier/index.d.ts index 4c733ce0df..855b3e50b1 100644 --- a/types/jquery-notifier/index.d.ts +++ b/types/jquery-notifier/index.d.ts @@ -1,9 +1,8 @@ -// Type definitions for Notifier +// Type definitions for notifier 1.0 // Project: https://github.com/allipierre/jquery-notifier // Definitions by: Alli Pierre Yotti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace notifier { /** * notifier.show(title, msg, type, icon, timeout); @@ -14,6 +13,6 @@ declare namespace notifier { * @param {timeout} timeout */ function show(title: string, msg: string, type: string, icon: string, timeout?: number): string | number; - function hide(notificationId: string | number): boolean; + function hide(notificationId: string | number): boolean; } diff --git a/types/jquery-notifier/jquery-notifier-tests.ts b/types/jquery-notifier/jquery-notifier-tests.ts index 9d73bce3c5..18804758be 100644 --- a/types/jquery-notifier/jquery-notifier-tests.ts +++ b/types/jquery-notifier/jquery-notifier-tests.ts @@ -4,33 +4,28 @@ notifier.show('Well Done!', 'You just submit your resume successfuly.', '', '', notifier.show('Warning!', 'The data presented here can be change.', '', '', 0); notifier.show('Sorry!', 'Could not complete your transaction.', '', '', 0); - notifier.show('Default!', 'I am a default notification.', '', 'img/clock-48.png', 0); notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 0); notifier.show('Well Done!', 'You just submit your resume successfuly.', '', 'img/ok-48.png', 0); notifier.show('Warning!', 'The data presented here can be change.', '', 'img/medium_priority-48.png', 0); notifier.show('Sorry!', 'Could not complete your transaction.', '', 'img/high_priority-48.png', 0); - - notifier.show('Default!', 'I am a default notification.', '', 'img/clock-48.png', 4000); notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 4000); notifier.show('Well Done!', 'You just submit your resume successfuly.', '', 'img/ok-48.png', 4000); notifier.show('Warning!', 'The data presented here can be change.', '', 'img/medium_priority-48.png', 4000); notifier.show('Sorry!', 'Could not complete your transaction.', '', 'img/high_priority-48.png', 4000); +let notificationId: string | number; +let showNotification = () => { + notificationId = notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 4000); +}; +let hideNotification = () => { + notifier.hide(notificationId); +}; - var notificationId:string | number; +document.querySelector('#btn-nt-show').addEventListener('click', showNotification); - var showNotification = function () { - notificationId = notifier.show('Reminder!', 'You have a meeting at 10:30 AM.', '', 'img/survey-48.png', 4000); - }; - - var hideNotification = function () { - notifier.hide(notificationId); - }; - - document.querySelector('#btn-nt-show').addEventListener('click', showNotification); - document.querySelector('#btn-nt-hide').addEventListener('click', hideNotification); +document.querySelector('#btn-nt-hide').addEventListener('click', hideNotification); diff --git a/types/jquery-notifier/tslint.json b/types/jquery-notifier/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/jquery-notifier/tslint.json +++ b/types/jquery-notifier/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } From 7ffa7f591a9133c11ce8e625a0f6ed4c5e5a0011 Mon Sep 17 00:00:00 2001 From: allipierre Date: Fri, 24 Nov 2017 08:47:03 +0100 Subject: [PATCH 062/322] remove other rules in tslint.json --- package.json | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/package.json b/package.json index 61b734fec2..db67595b77 100644 --- a/package.json +++ b/package.json @@ -21,14 +21,7 @@ "lint": "dtslint types" }, "devDependencies": { - "@types/node": "^8.0.53", "dtslint": "github:Microsoft/dtslint#production", - "types-publisher": "Microsoft/types-publisher#production", - "typescript": "^2.6.1" - }, - "dependencies": { - "@types/jquery": "^3.2.16", - "jquery": "^3.1.1", - "typescript": "^2.6.1" + "types-publisher": "Microsoft/types-publisher#production" } } From e2fa7e85cc5af5740a22f63d1ba6037284669b38 Mon Sep 17 00:00:00 2001 From: allipierre Date: Fri, 24 Nov 2017 09:11:19 +0100 Subject: [PATCH 063/322] remove param in commentar --- types/confirmdialog/index.d.ts | 12 ++++++------ types/jquery-notifier/index.d.ts | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index 39a507f8ac..1b7d106fac 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -9,19 +9,19 @@ interface JQueryStatic { /** * confirm Dialog - * @param {confirmOptions} pOtions + * {confirmOptions} pOtions */ confirm(pOtions: options.confirmOptions | string, title?: string): any; /** * confirm alert - * @param {any} pMessage + * {any} pMessage */ alert(pMessage?: any | string, title?: string): any; /** * confirm Dialog - * @param {any} pMessage + * {any} pMessage */ dialog(pOtions: options.confirmOptions | string): any; } @@ -29,19 +29,19 @@ interface JQuery { /** * confirm Dialog - * @param {confirmOptions} pOtions + * {confirmOptions} pOtions */ confirm(pOtions: options.confirmOptions | string, title?: string): any; /** * confirm alert - * @param {any} pMessage + * {any} pMessage */ alert(pMessage?: any, title?: string): any; /** * confirm Dialog - * @param {any} pMessage + * {any} pMessage */ dialog(pOtions: options.confirmOptions | any): any; } diff --git a/types/jquery-notifier/index.d.ts b/types/jquery-notifier/index.d.ts index 855b3e50b1..bf9d0ff93b 100644 --- a/types/jquery-notifier/index.d.ts +++ b/types/jquery-notifier/index.d.ts @@ -6,11 +6,11 @@ declare namespace notifier { /** * notifier.show(title, msg, type, icon, timeout); - * @param {title} title - * @param {msg} msg - * @param {type} type - * @param {icon} icon - * @param {timeout} timeout + * {title} title + * {msg} msg + * {type} type + * {icon} icon + * {timeout} timeout */ function show(title: string, msg: string, type: string, icon: string, timeout?: number): string | number; From 9f47e5d4c4a9f5dae9ae7816779af8110b97de2c Mon Sep 17 00:00:00 2001 From: allipierre Date: Fri, 24 Nov 2017 09:18:46 +0100 Subject: [PATCH 064/322] remove any union --- types/confirmdialog/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index 1b7d106fac..212a3aa271 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -17,7 +17,7 @@ * confirm alert * {any} pMessage */ - alert(pMessage?: any | string, title?: string): any; + alert(pMessage?: any, title?: string): any; /** * confirm Dialog @@ -57,7 +57,7 @@ declare namespace options { content?: any; onContentReady?: any; lazyOpen?: boolean; - closeIcon?: boolean | any; + closeIcon?: any; type?: string; typeAnimated?: boolean; icon?: string; @@ -72,7 +72,7 @@ declare namespace options { dragWindowGap?: number; contentLoaded?: () => void; autoClose?: string; - backgroundDismiss?: boolean | any | string; + backgroundDismiss?: any; backgroundDismissAnimation?: string; escapeKey?: string | boolean; onOpenBefore?: () => void; From 4bc06272e9692de2ce2dde36128422fb2237071d Mon Sep 17 00:00:00 2001 From: allipierre Date: Fri, 24 Nov 2017 09:25:19 +0100 Subject: [PATCH 065/322] remove any union --- types/confirmdialog/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/confirmdialog/index.d.ts b/types/confirmdialog/index.d.ts index 212a3aa271..9b98ab2389 100644 --- a/types/confirmdialog/index.d.ts +++ b/types/confirmdialog/index.d.ts @@ -43,7 +43,7 @@ * confirm Dialog * {any} pMessage */ - dialog(pOtions: options.confirmOptions | any): any; + dialog(pOtions: options.confirmOptions): any; } interface Window { @@ -52,7 +52,7 @@ interface Window { declare namespace options { interface confirmOptions { - buttons?: buttonOptionss | any; + buttons?: any; title?: string | boolean; content?: any; onContentReady?: any; From 9d5c2cb2e19ccbd87cfd38b972a445732ff1b6dc Mon Sep 17 00:00:00 2001 From: Ilya Petukhov Date: Fri, 24 Nov 2017 12:22:37 +0300 Subject: [PATCH 066/322] Add type definitions for the fixed-data-table-2 package --- .../fixed-data-table-2-tests.tsx | 196 +++++ types/fixed-data-table-2/index.d.ts | 677 ++++++++++++++++++ types/fixed-data-table-2/tsconfig.json | 22 + types/fixed-data-table-2/tslint.json | 3 + 4 files changed, 898 insertions(+) create mode 100644 types/fixed-data-table-2/fixed-data-table-2-tests.tsx create mode 100644 types/fixed-data-table-2/index.d.ts create mode 100644 types/fixed-data-table-2/tsconfig.json create mode 100644 types/fixed-data-table-2/tslint.json diff --git a/types/fixed-data-table-2/fixed-data-table-2-tests.tsx b/types/fixed-data-table-2/fixed-data-table-2-tests.tsx new file mode 100644 index 0000000000..3b34d6a44a --- /dev/null +++ b/types/fixed-data-table-2/fixed-data-table-2-tests.tsx @@ -0,0 +1,196 @@ +/** + * The tests are based on tests from types/fixed-data-table + */ + +import * as React from "react"; +import { Table, Cell, Column, CellProps } from "fixed-data-table-2"; + +// create your Table +class MyTable1 extends React.Component { + render() { + return ( + + // add columns +
+ ); + } +} + +// create your Columns +class MyTable2 extends React.Component { + render() { + return ( + + Basic content} + width={200} + /> +
+ ); + } +} + +// provide Custom Data +interface MyTable3State { + myTableData: Array<{ name: string }>; +} + +class MyTable3 extends React.Component<{}, MyTable3State> { + constructor(props: {}) { + super(props); + + this.state = { + myTableData: [ + { name: "Rylan" }, + { name: "Amelia" }, + { name: "Estevan" }, + { name: "Florence" }, + { name: "Tressa" }, + ] + }; + } + + render() { + return ( + + Name} + cell={(props) => ( + + {this.state.myTableData[props.rowIndex].name} + + )} + width={200} + /> +
+ ); + } +} + +// Create Reusable Cells +interface RowData { + [field: string]: string; +} + +interface MyCellProps extends CellProps { + field: string; + myData: RowData[]; +} + +class MyTextCell extends React.Component { + render() { + const { rowIndex, field, myData } = this.props; + + return ( + + {myData[rowIndex!][field]} + + ); + } +} + +class MyLinkCell extends React.Component { + render() { + const { rowIndex, field, myData } = this.props; + const link: string = myData[rowIndex!][field]; + + return ( + + {link} + + ); + } +} + +interface MyTable4State { + tableData: RowData[]; +} + +class MyTable4 extends React.Component<{}, MyTable4State> { + constructor(props: {}) { + super(props); + this.state = { + tableData: [ + { name: "Rylan", email: "Angelita_Weimann42@gmail.com" }, + { name: "Amelia", email: "Dexter.Trantow57@hotmail.com" }, + { name: "Estevan", email: "Aimee7@hotmail.com" }, + { name: "Florence", email: "Jarrod.Bernier13@yahoo.com" }, + { name: "Tressa", email: "Yadira1@hotmail.com" } + ] + }; + } + + render() { + return ( + + { + ["name", "email"].map(field => + {field}} + cell={ + + } + width={200} /> + ) + } +
+ ); + } +} + +// Listen for events +class MyTable5 extends React.Component { + render() { + return ( + { }} + onScrollEnd={(x: number, y: number) => { }} + onContentHeightChange={(newHeight: number) => { }} + onRowClick={(event: React.SyntheticEvent
, rowIndex: number) => { }} + onRowDoubleClick={(event: React.SyntheticEvent
, rowIndex: number) => { }} + onRowMouseDown={(event: React.SyntheticEvent
, rowIndex: number) => { }} + onRowMouseEnter={(event: React.SyntheticEvent
, rowIndex: number) => { }} + onRowMouseLeave={(event: React.SyntheticEvent
, rowIndex: number) => { }} + onColumnResizeEndCallback={(newColumnWidth: number, columnKey: string) => { }}> + // add columns +
+ ); + } +} diff --git a/types/fixed-data-table-2/index.d.ts b/types/fixed-data-table-2/index.d.ts new file mode 100644 index 0000000000..a39397a228 --- /dev/null +++ b/types/fixed-data-table-2/index.d.ts @@ -0,0 +1,677 @@ +// Type definitions for fixed-data-table-2 0.8 +// Project: https://github.com/schrodinger/fixed-data-table-2 +// Definitions by: Ilya Petukhov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from "react"; + +export as namespace FixedDataTable; + +export interface RowProps { + /** the row index */ + rowIndex: number; + + /** supplied from the Table or rowHeightGetter */ + height: number; + + /** supplied from the Table */ + width: number; +} + +export interface ColumnReorderEndEvent { + /** the column before the new location of this one */ + columnBefore?: string; + + /** the column after the new location of this one */ + columnAfter?: string; + + /** the column key that was just reordered */ + reorderColumn: string; +} + +export type ElementOrFunc

= string | React.ReactElement | ((props: P) => (string | React.ReactElement)); + +export type TableRowEventHandler = (event: React.SyntheticEvent, rowIndex: number) => void; + +/** + * Data grid component with fixed or scrollable header and columns. + * + * The layout of the data table is as follows: + * + * ``` + * +---------------------------------------------------+ + * | Fixed Column Group | Scrollable Column Group | + * | Header | Header | + * | | | + * +---------------------------------------------------+ + * | | | + * | Fixed Header Columns | Scrollable Header Columns | + * | | | + * +-----------------------+---------------------------+ + * | | | + * | Fixed Body Columns | Scrollable Body Columns | + * | | | + * +-----------------------+---------------------------+ + * | | | + * | Fixed Footer Columns | Scrollable Footer Columns | + * | | | + * +-----------------------+---------------------------+ + * ``` + * + * - Fixed Column Group Header: These are the headers for a group + * of columns if included in the table that do not scroll + * vertically or horizontally. + * + * - Scrollable Column Group Header: The header for a group of columns + * that do not move while scrolling vertically, but move horizontally + * with the horizontal scrolling. + * + * - Fixed Header Columns: The header columns that do not move while scrolling + * vertically or horizontally. + * + * - Scrollable Header Columns: The header columns that do not move + * while scrolling vertically, but move horizontally with the horizontal + * scrolling. + * + * - Fixed Body Columns: The body columns that do not move while scrolling + * horizontally, but move vertically with the vertical scrolling. + * + * - Scrollable Body Columns: The body columns that move while scrolling + * vertically or horizontally. + */ +export interface TableProps extends React.ClassAttributes
{ + /** + * Pixel width of table. If all columns do not fit, + * a horizontal scrollbar will appear. + */ + width: number; + + /** + * Pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + height?: number; + + /** + * Class name to be passed into parent container + */ + className?: string; + + /** + * Maximum pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + maxHeight?: number; + + /** + * Pixel height of table's owner, this is used in a managed scrolling + * situation when you want to slide the table up from below the fold + * without having to constantly update the height on every scroll tick. + * Instead, vary this property on scroll. By using `ownerHeight`, we + * over-render the table while making sure the footer and horizontal + * scrollbar of the table are visible when the current space for the table + * in view is smaller than the final, over-flowing height of table. It + * allows us to avoid resizing and reflowing table when it is moving in the + * view. + * + * This is used if `ownerHeight < height` (or `maxHeight`). + */ + ownerHeight?: number; + + overflowX?: 'hidden' | 'auto'; + overflowY?: 'hidden' | 'auto'; + + /** + * Boolean flag indicating of touch scrolling should be enabled + * This feature is current in beta and may have bugs + */ + touchScrollEnabled?: boolean; + + /** Boolean flags to control if scrolling with keys is enabled */ + keyboardScrollEnabled?: boolean; + /** Boolean flags to control if scrolling with keys is enabled */ + keyboardPageEnabled?: boolean; + + /** Hide the scrollbar but still enable scroll functionality */ + showScrollbarX?: boolean; + /** Hide the scrollbar but still enable scroll functionality */ + showScrollbarY?: boolean; + + /** + * Callback when horizontally scrolling the grid. + * + * Return false to stop propagation. + */ + onHorizontalScroll?: (scrollPos: number) => boolean; + + /** + * Callback when vertically scrolling the grid. + * + * Return false to stop propagation. + */ + onVerticalScroll?: (scrollPos: number) => boolean; + + /** + * Number of rows in the table. + */ + rowsCount: number; + + /** + * Pixel height of rows unless `rowHeightGetter` is specified and returns + * different value. + */ + rowHeight: number; + + /** + * If specified, `rowHeightGetter(index)` is called for each row and the + * returned value overrides `rowHeight` for particular row. + */ + rowHeightGetter?: (index: number) => number; + + /** + * Pixel height of sub-row unless `subRowHeightGetter` is specified and returns + * different value. Defaults to 0 and no sub-row being displayed. + */ + subRowHeight?: number; + + /** + * If specified, `subRowHeightGetter(index)` is called for each row and the + * returned value overrides `subRowHeight` for particular row. + */ + subRowHeightGetter?: (index: number) => number; + + /** + * The row expanded for table row. + * This can either be a React element, or a function that generates + * a React Element. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * rowIndex; number // (the row index) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Table) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + rowExpanded?: ElementOrFunc; + + /** + * To get any additional CSS classes that should be added to a row, + * `rowClassNameGetter(index)` is called. + */ + rowClassNameGetter?: (index: number) => string; + + /** + * If specified, `rowKeyGetter(index)` is called for each row and the + * returned value overrides `key` for the particular row. + */ + rowKeyGetter?: (index: number) => string; + + /** + * Pixel height of the column group header. + */ + groupHeaderHeight?: number; + + /** + * Pixel height of header. + */ + headerHeight: number; + + /** + * Pixel height of fixedDataTableCellGroupLayout/cellGroupWrapper. + * Default is headerHeight and groupHeaderHeight. + * + * This can be used with CSS to make a header cell span both the group & normal header row. + * Setting this to a value larger than height will cause the content to + * overflow the height. This is useful when adding a 2nd table as the group + * header and vertically merging the 2 headers when a column is not part + * of a group. Here are the necessary CSS changes: + * + * Both headers: + * - cellGroupWrapper needs overflow-x: hidden and pointer-events: none + * - cellGroup needs pointer-events: auto to reenable them on child els + * Group header: + * - Layout/main needs overflow: visible and a higher z-index + * - CellLayout/main needs overflow-y: visible + * - cellGroup needs overflow: visible + */ + cellGroupWrapperHeight?: number; + + /** + * Pixel height of footer. + */ + footerHeight?: number; + + /** + * Value of horizontal scroll. + */ + scrollLeft?: number; + + /** + * Index of column to scroll to. + */ + scrollToColumn?: number; + + /** + * Value of vertical scroll. + */ + scrollTop?: number; + + /** + * Index of row to scroll to. + */ + scrollToRow?: number; + + /** + * Callback that is called when scrolling starts with current horizontal + * and vertical scroll values. + */ + onScrollStart?: (x: number, y: number) => void; + + /** + * Callback that is called when scrolling ends or stops with new horizontal + * and vertical scroll values. + */ + onScrollEnd?: (x: number, y: number) => void; + + /** + * If enabled scroll events will not be propagated outside of the table. + */ + stopScrollPropagation?: boolean; + + /** + * Callback that is called when `rowHeightGetter` returns a different height + * for a row than the `rowHeight` prop. This is necessary because initially + * table estimates heights of some parts of the content. + */ + onContentHeightChange?: (newHeight: number) => void; + + /** + * Callback that is called when a row is clicked. + */ + onRowClick?: TableRowEventHandler; + + /** + * Callback that is called when a row is double clicked. + */ + onRowDoubleClick?: TableRowEventHandler; + + /** + * Callback that is called when a mouse-down event happens on a row. + */ + onRowMouseDown?: TableRowEventHandler; + + /** + * Callback that is called when a mouse-up event happens on a row. + */ + onRowMouseUp?: TableRowEventHandler; + + /** + * Callback that is called when a mouse-enter event happens on a row. + */ + onRowMouseEnter?: TableRowEventHandler; + + /** + * Callback that is called when a mouse-leave event happens on a row. + */ + onRowMouseLeave?: TableRowEventHandler; + + /** + * Callback that is called when a touch-start event happens on a row. + */ + onRowTouchStart?: TableRowEventHandler; + + /** + * Callback that is called when a touch-end event happens on a row. + */ + onRowTouchEnd?: TableRowEventHandler; + + /** + * Callback that is called when a touch-move event happens on a row. + */ + onRowTouchMove?: TableRowEventHandler; + + /** + * Callback that is called when resizer has been released + * and column needs to be updated. + * + * Required if the isResizable property is true on any column. + * + * ``` + * function( + * newColumnWidth: number, + * columnKey: string, + * ) + * ``` + */ + onColumnResizeEndCallback?: (newColumnWidth: number, columnKey: string) => void; + + /** + * Callback that is called when reordering has been completed + * and columns need to be updated. + * + * ``` + * function( + * event { + * columnBefore: string|undefined, // the column before the new location of this one + * columnAfter: string|undefined, // the column after the new location of this one + * reorderColumn: string, // the column key that was just reordered + * } + * ) + * ``` + */ + onColumnReorderEndCallback?: (event: ColumnReorderEndEvent) => void; + + /** + * Whether a column is currently being resized. + */ + isColumnResizing?: boolean; + + /** + * Whether columns are currently being reordered. + */ + isColumnReordering?: boolean; + + /** + * The number of rows outside the viewport to prerender. Defaults to roughly + * half of the number of visible rows. + */ + bufferRowCount?: number; +} + +export class Table extends React.Component { +} + +export interface ColumnHeaderProps { + columnKey?: string; + + /** supplied from the Table or rowHeightGetter */ + height: number; + + /** supplied from the Column */ + width: number; +} + +export interface ColumnCellProps extends ColumnHeaderProps { + /** the row index of the cell */ + rowIndex: number; +} + +/** + * Component that defines the attributes of table column. + */ +export interface ColumnProps extends React.ClassAttributes { + /** + * The horizontal alignment of the table cell content. + */ + align?: 'left' | 'center' | 'right'; + + /** + * Controls if the column is fixed when scrolling in the X axis. + * + * defaultValue: false + */ + fixed?: boolean; + + /** + * Controls if the column is fixed to the right side of the table + * when scrolling in the X axis. + * + * defaultValue: false + */ + fixedRight?: boolean; + + /** + * The header cell for this column. + * This can either be a string a React element, or a function that generates + * a React Element. Passing in a string will render a default header cell + * with that string. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + header?: ElementOrFunc; + + /** + * This is the body cell that will be cloned for this column. + * This can either be a string a React element, or a function that generates + * a React Element. Passing in a string will render a default header cell + * with that string. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * rowIndex; number // (the row index of the cell) + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + cell?: ElementOrFunc; + + /** + * This is the footer cell for this column. + * This can either be a string a React element, or a function that generates + * a React Element. Passing in a string will render a default header cell + * with that string. By default, the React element passed in can expect to + * receive the following props: + * + * ``` + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the + * first argument. + */ + footer?: ElementOrFunc; + + /** + * This is used to uniquely identify the column, and is not required unless + * you a resizing columns. This will be the key given in the + * `onColumnResizeEndCallback` on the Table. + */ + columnKey?: string | number; + + /** + * The pixel width of the column. + */ + width: number; + + /** + * If this is a resizable column this is its minimum pixel width. + */ + minWidth?: number; + + /** + * If this is a resizable column this is its maximum pixel width. + */ + maxWidth?: number; + + /** + * The grow factor relative to other columns. Same as the flex-grow API + * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available + * extra width and distribute it proportionally according to all columns' + * flexGrow values. Defaults to zero (no-flexing). + */ + flexGrow?: number; + + /** + * Whether the column can be resized with the + * FixedDataTableColumnResizeHandle. Please note that if a column + * has a flex grow, once you resize the column this will be set to 0. + * + * This property only provides the UI for the column resizing. If this + * is set to true, you will need to set the onColumnResizeEndCallback table + * property and render your columns appropriately. + */ + isResizable?: boolean; + + /** + * Whether the column can be dragged to reorder. + */ + isReorderable?: boolean; + + /** + * Whether cells in this column can be removed from document when outside + * of viewport as a result of horizontal scrolling. + * Setting this property to true allows the table to not render cells in + * particular column that are outside of viewport for visible rows. This + * allows to create table with many columns and not have vertical scrolling + * performance drop. + * Setting the property to false will keep previous behaviour and keep + * cell rendered if the row it belongs to is visible. + * + * defaultValue: false + */ + allowCellsRecycling?: boolean; + + /** + * Flag to enable performance check when rendering. Stops the component from + * rendering if none of it's passed in props have changed + */ + pureRendering?: boolean; +} + +export class Column extends React.Component { +} + +export interface ColumnGroupHeaderProps { + /* supplied from the groupHeaderHeight */ + height: number; + + /* supplied from the Column */ + width: number; +} + +/** + * Component that defines the attributes of a table column group. + */ +export interface ColumnGroupProps extends React.ClassAttributes { + /** + * The horizontal alignment of the table cell content. + */ + align?: 'left' | 'center' | 'right'; + + /** + * Controls if the column group is fixed when scrolling in the X axis. + * + * defaultValue: false + */ + fixed?: boolean; + + /** + * This is the header cell for this column group. + * This can either be a string or a React element. Passing in a string + * will render a default footer cell with that string. By default, the React + * element passed in can expect to receive the following props: + * + * ``` + * props: { + * height: number // (supplied from the groupHeaderHeight) + * width: number // (supplied from the Column) + * } + * ``` + * + * Because you are passing in your own React element, you can feel free to + * pass in whatever props you may want or need. + * + * You can also pass in a function that returns a react elemnt, with the + * props object above passed in as the first parameter. + */ + header?: string | React.ReactElement | ((props: ColumnGroupHeaderProps) => (string | React.ReactElement)); +} + +export class ColumnGroup extends React.Component { +} + +/** + * Component that handles default cell layout and styling. + * + * All props unless specified below will be set onto the top level `div` + * rendered by the cell. + * + * Example usage via from a `Column`: + * ``` + * const MyColumn = ( + * ( + * + * Cell number: {rowIndex} + * + * )} + * width={100} + * /> + * ); + * ``` + */ +export interface CellProps extends React.HTMLAttributes { + /** + * Outer height of the cell. + */ + height?: number; + + /** + * Outer width of the cell. + */ + width?: number; + + /** + * Optional prop that if specified on the `Column` will be passed to the + * cell. It can be used to uniquely identify which column is the cell is in. + */ + columnKey?: string | number; + + /** + * Optional prop that represents the rows index in the table. + * For the 'cell' prop of a Column, this parameter will exist for any + * cell in a row with a positive index. + * + * Below that entry point the user is welcome to consume or + * pass the prop through at their discretion. + */ + rowIndex?: number; +} + +export class Cell extends React.Component { +} diff --git a/types/fixed-data-table-2/tsconfig.json b/types/fixed-data-table-2/tsconfig.json new file mode 100644 index 0000000000..c548d5c369 --- /dev/null +++ b/types/fixed-data-table-2/tsconfig.json @@ -0,0 +1,22 @@ +{ + "files": [ + "index.d.ts", + "fixed-data-table-2-tests.tsx" + ], + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "jsx":"preserve", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/fixed-data-table-2/tslint.json b/types/fixed-data-table-2/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/fixed-data-table-2/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 704b79a52d4024e138f49ed67e955c2b7f134d53 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Fri, 24 Nov 2017 09:37:47 +0000 Subject: [PATCH 067/322] Lodash: clamp: add overload for upper bound only --- types/lodash/index.d.ts | 10 ++++++++++ types/lodash/lodash-tests.ts | 2 ++ 2 files changed, 12 insertions(+) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index f038846d22..a21751543c 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -11535,6 +11535,10 @@ declare namespace _ { lower: number, upper: number ): number; + clamp( + number: number, + upper: number + ): number; } interface LoDashImplicitWrapper { @@ -11545,6 +11549,9 @@ declare namespace _ { lower: number, upper: number ): number; + clamp( + upper: number + ): number; } interface LoDashExplicitWrapper { @@ -11555,6 +11562,9 @@ declare namespace _ { lower: number, upper: number ): LoDashExplicitWrapper; + clamp( + upper: number + ): LoDashExplicitWrapper; } //_.inRange diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index e40569204d..4d41516307 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -9871,8 +9871,10 @@ namespace TestInClamp { let result: number; result = _.clamp(3, 2, 4); + result = _.clamp(3, 4); result = _(3).clamp(2, 4); + result = _(3).clamp(4); } { From 1dc398652e4947d5202be6d03d6cb23bf5cd16d2 Mon Sep 17 00:00:00 2001 From: Jacob Bom Date: Sat, 25 Nov 2017 23:52:39 +0100 Subject: [PATCH 068/322] Add firefox-webext-browser types for FireFox WebExtension Development --- .../firefox-webext-browser-tests.ts | 2 + types/firefox-webext-browser/index.d.ts | 3123 +++++++++++++++++ types/firefox-webext-browser/tsconfig.json | 23 + types/firefox-webext-browser/tslint.json | 8 + 4 files changed, 3156 insertions(+) create mode 100644 types/firefox-webext-browser/firefox-webext-browser-tests.ts create mode 100644 types/firefox-webext-browser/index.d.ts create mode 100644 types/firefox-webext-browser/tsconfig.json create mode 100644 types/firefox-webext-browser/tslint.json diff --git a/types/firefox-webext-browser/firefox-webext-browser-tests.ts b/types/firefox-webext-browser/firefox-webext-browser-tests.ts new file mode 100644 index 0000000000..879b8af0bb --- /dev/null +++ b/types/firefox-webext-browser/firefox-webext-browser-tests.ts @@ -0,0 +1,2 @@ +// No tests yet +true; diff --git a/types/firefox-webext-browser/index.d.ts b/types/firefox-webext-browser/index.d.ts new file mode 100644 index 0000000000..2063abc93e --- /dev/null +++ b/types/firefox-webext-browser/index.d.ts @@ -0,0 +1,3123 @@ +// Type definitions for WebExtension Development in FireFox 58.0 +// Project: https://developer.mozilla.org/en-US/Add-ons/WebExtensions +// Definitions by: Jacob Bom +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +interface EventListener any> { + addListener: (callback: T) => void; + removeListener: (listener: T) => void; + hasListener: (listener: T) => boolean; +} + +declare namespace browser.alarms { + /* alarms types */ + interface Alarm { + name: string; + scheduledTime: number; + periodInMinutes?: number; + } + + /* alarms functions */ + function create(alarmInfo: { + when?: number; + delayInMinutes?: number; + periodInMinutes?: number; + }): void; + function create(name: string, alarmInfo: { + when?: number; + delayInMinutes?: number; + periodInMinutes?: number; + }): void; + + function get(name?: string): Promise; + + function getAll(): Promise; + + function clear(name?: string): Promise; + + function clearAll(): Promise; + + /* alarms events */ + const onAlarm: EventListener<(name: Alarm) => void>; +} + +declare namespace browser.manifest { + /* manifest types */ + type OptionalPermission = OptionalPermissionEnum; + + type Permission = string | OptionalPermission | PermissionEnum; + + interface ProtocolHandler { + name: string; + protocol: string | ProtocolHandlerProtocolEnum; + uriTemplate: ExtensionURL | HttpURL; + } + + interface WebExtensionManifest { + protocol_handlers?: ProtocolHandler[]; + default_locale?: string; + manifest_version: number; + minimum_chrome_version?: string; + minimum_opera_version?: string; + applications?: { + gecko?: FirefoxSpecificProperties; + }; + browser_specific_settings?: { + gecko?: FirefoxSpecificProperties; + }; + name: string; + short_name?: string; + description?: string; + author?: string; + version: string; + homepage_url?: string; + icons?: { + [key: number]: string; + }; + incognito?: WebExtensionManifestIncognitoEnum; + background?: { + page: ExtensionURL; + persistent?: PersistentBackgroundProperty; + } | { + scripts: ExtensionURL[]; + persistent?: PersistentBackgroundProperty; + }; + options_ui?: { + page: ExtensionURL; + browser_style?: boolean; + chrome_style?: boolean; + open_in_tab?: boolean; + }; + content_scripts?: ContentScript[]; + content_security_policy?: string; + permissions?: PermissionOrOrigin[]; + optional_permissions?: OptionalPermissionOrOrigin[]; + web_accessible_resources?: string[]; + developer?: { + name?: string; + url?: string; + }; + theme?: ThemeType; + browser_action?: { + default_title?: string; + default_icon?: IconPath; + theme_icons?: ThemeIcons[]; + default_popup?: string; + browser_style?: boolean; + default_area?: WebExtensionManifestBrowserActionDefaultAreaEnum; + }; + chrome_settings_overrides?: { + homepage?: string; + search_provider?: { + name: string; + keyword?: string; + search_url: string; + favicon_url?: string; + suggest_url?: string; + instant_url?: string; + image_url?: string; + search_url_post_params?: string; + instant_url_post_params?: string; + image_url_post_params?: string; + alternate_urls?: string[]; + prepopulated_id?: number; + is_default?: boolean; + }; + }; + commands?: { + suggested_key?: { + default?: KeyName; + mac?: KeyName; + linux?: KeyName; + windows?: KeyName; + chromeos?: string; + android?: string; + ios?: string; + additionalProperties?: string; + }; + description?: string; + }; + devtools_page?: ExtensionURL; + omnibox?: { + keyword: string; + }; + page_action?: { + default_title?: string; + default_icon?: IconPath; + default_popup?: string; + browser_style?: boolean; + }; + sidebar_action?: { + default_title?: string; + default_icon?: IconPath; + browser_style?: boolean; + default_panel: string; + }; + chrome_url_overrides?: { + newtab?: ExtensionURL; + bookmarks?: ExtensionURL; + history?: ExtensionURL; + }; + } + + interface WebExtensionLangpackManifest { + manifest_version: number; + applications?: { + gecko?: FirefoxSpecificProperties; + }; + browser_specific_settings?: { + gecko?: FirefoxSpecificProperties; + }; + name: string; + short_name?: string; + description?: string; + author?: string; + version: string; + homepage_url?: string; + langpack_id: string; + languages: { + [key: string]: { + chrome_resources: { + [key: string]: ExtensionURL | { + [key: string]: ExtensionURL; + }; + }; + version: string; + }; + }; + sources?: { + [key: string]: { + base_path: ExtensionURL; + paths?: string[]; + }; + }; + } + + interface ThemeIcons { + light: ExtensionURL; + dark: ExtensionURL; + size: number; + } + + type OptionalPermissionOrOrigin = OptionalPermission | MatchPattern; + + type PermissionOrOrigin = Permission | MatchPattern; + + type HttpURL = string; + + type ExtensionURL = string; + + type ImageDataOrExtensionURL = string; + + type ExtensionID = string | string; + + interface FirefoxSpecificProperties { + id?: ExtensionID; + update_url?: string; + strict_min_version?: string; + strict_max_version?: string; + } + + type MatchPattern = string | string | MatchPatternEnum; + + type MatchPatternInternal = string | string | MatchPatternInternalEnum; + + interface ContentScript { + matches: MatchPattern[]; + exclude_matches?: MatchPattern[]; + include_globs?: string[]; + exclude_globs?: string[]; + css?: ExtensionURL[]; + js?: ExtensionURL[]; + all_frames?: boolean; + match_about_blank?: boolean; + run_at?: extensionTypes.RunAt; + } + + type IconPath = { + [key: number]: ExtensionURL; + } | ExtensionURL; + + type IconImageData = { + [key: number]: ImageData; + } | ImageData; + + type ImageData = any; + + type UnrecognizedProperty = any; + + type PersistentBackgroundProperty = boolean; + + type NativeManifest = { + name: string; + description: string; + path: string; + type: NativeManifestTypeEnum; + allowed_extensions: ExtensionID[]; + } | { + name: ExtensionID; + description: string; + data: any; + type: NativeManifestTypeEnum; + }; + + interface ThemeType { + images?: { + additional_backgrounds?: ImageDataOrExtensionURL[]; + headerURL?: ImageDataOrExtensionURL; + theme_frame?: ImageDataOrExtensionURL; + }; + colors?: { + accentcolor?: string; + frame?: number[]; + tab_text?: number[]; + textcolor?: string; + toolbar?: string; + toolbar_text?: string; + bookmark_text?: string; + toolbar_field?: string; + toolbar_field_text?: string; + toolbar_top_separator?: string; + toolbar_bottom_separator?: string; + toolbar_vertical_separator?: string; + }; + icons?: { + back?: ExtensionURL; + forward?: ExtensionURL; + reload?: ExtensionURL; + stop?: ExtensionURL; + bookmark_star?: ExtensionURL; + bookmark_menu?: ExtensionURL; + downloads?: ExtensionURL; + home?: ExtensionURL; + app_menu?: ExtensionURL; + cut?: ExtensionURL; + copy?: ExtensionURL; + paste?: ExtensionURL; + new_window?: ExtensionURL; + new_private_window?: ExtensionURL; + save_page?: ExtensionURL; + print?: ExtensionURL; + history?: ExtensionURL; + full_screen?: ExtensionURL; + find?: ExtensionURL; + options?: ExtensionURL; + addons?: ExtensionURL; + developer?: ExtensionURL; + synced_tabs?: ExtensionURL; + open_file?: ExtensionURL; + sidebars?: ExtensionURL; + subscribe?: ExtensionURL; + text_encoding?: ExtensionURL; + email_link?: ExtensionURL; + forget?: ExtensionURL; + pocket?: ExtensionURL; + getmsg?: ExtensionURL; + newmsg?: ExtensionURL; + address?: ExtensionURL; + reply?: ExtensionURL; + replyall?: ExtensionURL; + replylist?: ExtensionURL; + forwarding?: ExtensionURL; + delete?: ExtensionURL; + junk?: ExtensionURL; + file?: ExtensionURL; + nextUnread?: ExtensionURL; + prevUnread?: ExtensionURL; + mark?: ExtensionURL; + tag?: ExtensionURL; + compact?: ExtensionURL; + archive?: ExtensionURL; + chat?: ExtensionURL; + nextMsg?: ExtensionURL; + prevMsg?: ExtensionURL; + QFB?: ExtensionURL; + conversation?: ExtensionURL; + newcard?: ExtensionURL; + newlist?: ExtensionURL; + editcard?: ExtensionURL; + newim?: ExtensionURL; + send?: ExtensionURL; + spelling?: ExtensionURL; + attach?: ExtensionURL; + security?: ExtensionURL; + save?: ExtensionURL; + quote?: ExtensionURL; + buddy?: ExtensionURL; + join_chat?: ExtensionURL; + chat_accounts?: ExtensionURL; + calendar?: ExtensionURL; + tasks?: ExtensionURL; + synchronize?: ExtensionURL; + newevent?: ExtensionURL; + newtask?: ExtensionURL; + editevent?: ExtensionURL; + today?: ExtensionURL; + category?: ExtensionURL; + complete?: ExtensionURL; + priority?: ExtensionURL; + saveandclose?: ExtensionURL; + attendees?: ExtensionURL; + privacy?: ExtensionURL; + status?: ExtensionURL; + freebusy?: ExtensionURL; + timezones?: ExtensionURL; + }; + properties?: { + additional_backgrounds_alignment?: ThemeTypeAdditionalBackgroundsAlignmentEnum[]; + additional_backgrounds_tiling?: ThemeTypeAdditionalBackgroundsTilingEnum[]; + }; + } + + type KeyName = string | string | string; + + enum OptionalPermissionEnum { + browserSettings = "browserSettings", + cookies = "cookies", + clipboardRead = "clipboardRead", + clipboardWrite = "clipboardWrite", + geolocation = "geolocation", + idle = "idle", + notifications = "notifications", + topSites = "topSites", + webNavigation = "webNavigation", + webRequest = "webRequest", + webRequestBlocking = "webRequestBlocking", + bookmarks = "bookmarks", + find = "find", + history = "history", + activeTab = "activeTab", + tabs = "tabs" + } + + enum PermissionEnum { + contextualIdentities = "contextualIdentities", + downloads = "downloads", + downloadsopen = "downloads.open", + identity = "identity", + management = "management", + alarms = "alarms", + mozillaAddons = "mozillaAddons", + storage = "storage", + unlimitedStorage = "unlimitedStorage", + privacy = "privacy", + proxy = "proxy", + nativeMessaging = "nativeMessaging", + theme = "theme", + browsingData = "browsingData", + devtools = "devtools", + geckoProfiler = "geckoProfiler", + menus = "menus", + contextMenus = "contextMenus", + pkcs11 = "pkcs11", + sessions = "sessions" + } + + enum ProtocolHandlerProtocolEnum { + bitcoin = "bitcoin", + geo = "geo", + gopher = "gopher", + im = "im", + irc = "irc", + ircs = "ircs", + magnet = "magnet", + mailto = "mailto", + mms = "mms", + news = "news", + nntp = "nntp", + sip = "sip", + sms = "sms", + smsto = "smsto", + ssh = "ssh", + tel = "tel", + urn = "urn", + webcal = "webcal", + wtai = "wtai", + xmpp = "xmpp" + } + + enum WebExtensionManifestIncognitoEnum { + spanning = "spanning" + } + + enum WebExtensionManifestBrowserActionDefaultAreaEnum { + navbar = "navbar", + menupanel = "menupanel", + tabstrip = "tabstrip", + personaltoolbar = "personaltoolbar" + } + + enum MatchPatternEnum { + all_urls = "" + } + + enum MatchPatternInternalEnum { + all_urls = "" + } + + enum NativeManifestTypeEnum { + pkcs11 = "pkcs11", + stdio = "stdio" + } + + enum NativeManifestTypeEnum { + storage = "storage" + } + + enum ThemeTypeAdditionalBackgroundsAlignmentEnum { + bottom = "bottom", + center = "center", + left = "left", + right = "right", + top = "top", + centerbottom = "center bottom", + centercenter = "center center", + centertop = "center top", + leftbottom = "left bottom", + leftcenter = "left center", + lefttop = "left top", + rightbottom = "right bottom", + rightcenter = "right center", + righttop = "right top" + } + + enum ThemeTypeAdditionalBackgroundsTilingEnum { + norepeat = "no-repeat", + repeat = "repeat", + repeatx = "repeat-x", + repeaty = "repeat-y" + } +} + +declare namespace browser.browserSettings { + /* browserSettings types */ + enum ImageAnimationBehavior { + normal = "normal", + none = "none", + once = "once" + } + + /* browserSettings properties */ + const allowPopupsForUserEvents: types.Setting; + + const cacheEnabled: types.Setting; + + const homepageOverride: types.Setting; + + const imageAnimationBehavior: types.Setting; + + const newTabPageOverride: types.Setting; + + const webNotificationsDisabled: types.Setting; +} + +declare namespace browser.clipboard { + type ArrayBuffer = any; + + enum SetImageDataEnum { + jpeg = "jpeg", + png = "png" + } + + /* clipboard functions */ + function setImageData(imageData: ArrayBuffer, imageType: SetImageDataEnum): void; +} + +declare namespace browser.contextualIdentities { + /* contextualIdentities types */ + interface ContextualIdentity { + name: string; + icon: string; + iconUrl: string; + color: string; + colorCode: string; + cookieStoreId: string; + } + + /* contextualIdentities functions */ + function get(cookieStoreId: string): void; + + function query(details: { + name?: string; + }): void; + + function create(details: { + name: string; + color: string; + icon: string; + }): void; + + function update(cookieStoreId: string, details: { + name?: string; + color?: string; + icon?: string; + }): void; + + function remove(cookieStoreId: string): void; + + /* contextualIdentities events */ + const onUpdated: EventListener<(changeInfo: { + contextualIdentity: ContextualIdentity; + }) => void>; + + const onCreated: EventListener<(changeInfo: { + contextualIdentity: ContextualIdentity; + }) => void>; + + const onRemoved: EventListener<(changeInfo: { + contextualIdentity: ContextualIdentity; + }) => void>; +} + +declare namespace browser.cookies { + /* cookies types */ + interface Cookie { + name: string; + value: string; + domain: string; + hostOnly: boolean; + path: string; + secure: boolean; + httpOnly: boolean; + session: boolean; + expirationDate?: number; + storeId: string; + } + + interface CookieStore { + id: string; + tabIds: number[]; + incognito: boolean; + } + + enum OnChangedCause { + evicted = "evicted", + expired = "expired", + explicit = "explicit", + expired_overwrite = "expired_overwrite", + overwrite = "overwrite" + } + + /* cookies functions */ + function get(details: { + url: string; + name: string; + storeId?: string; + }): Promise; + + function getAll(details: { + url?: string; + name?: string; + domain?: string; + path?: string; + secure?: boolean; + session?: boolean; + storeId?: string; + }): Promise; + + function set(details: { + url: string; + name?: string; + value?: string; + domain?: string; + path?: string; + secure?: boolean; + httpOnly?: boolean; + expirationDate?: number; + storeId?: string; + }): Promise; + + function remove(details: { + url: string; + name: string; + storeId?: string; + }): Promise<{ + url: string; + name: string; + storeId: string; + }>; + + function getAllCookieStores(): Promise; + + /* cookies events */ + const onChanged: EventListener<(changeInfo: { + removed: boolean; + cookie: Cookie; + cause: OnChangedCause; + }) => void>; +} + +declare namespace browser.downloads { + /* downloads types */ + enum FilenameConflictAction { + uniquify = "uniquify", + overwrite = "overwrite", + prompt = "prompt" + } + + enum InterruptReason { + FILE_FAILED = "FILE_FAILED", + FILE_ACCESS_DENIED = "FILE_ACCESS_DENIED", + FILE_NO_SPACE = "FILE_NO_SPACE", + FILE_NAME_TOO_LONG = "FILE_NAME_TOO_LONG", + FILE_TOO_LARGE = "FILE_TOO_LARGE", + FILE_VIRUS_INFECTED = "FILE_VIRUS_INFECTED", + FILE_TRANSIENT_ERROR = "FILE_TRANSIENT_ERROR", + FILE_BLOCKED = "FILE_BLOCKED", + FILE_SECURITY_CHECK_FAILED = "FILE_SECURITY_CHECK_FAILED", + FILE_TOO_SHORT = "FILE_TOO_SHORT", + NETWORK_FAILED = "NETWORK_FAILED", + NETWORK_TIMEOUT = "NETWORK_TIMEOUT", + NETWORK_DISCONNECTED = "NETWORK_DISCONNECTED", + NETWORK_SERVER_DOWN = "NETWORK_SERVER_DOWN", + NETWORK_INVALID_REQUEST = "NETWORK_INVALID_REQUEST", + SERVER_FAILED = "SERVER_FAILED", + SERVER_NO_RANGE = "SERVER_NO_RANGE", + SERVER_BAD_CONTENT = "SERVER_BAD_CONTENT", + SERVER_UNAUTHORIZED = "SERVER_UNAUTHORIZED", + SERVER_CERT_PROBLEM = "SERVER_CERT_PROBLEM", + SERVER_FORBIDDEN = "SERVER_FORBIDDEN", + USER_CANCELED = "USER_CANCELED", + USER_SHUTDOWN = "USER_SHUTDOWN", + CRASH = "CRASH" + } + + enum DangerType { + file = "file", + url = "url", + content = "content", + uncommon = "uncommon", + host = "host", + unwanted = "unwanted", + safe = "safe", + accepted = "accepted" + } + + enum State { + in_progress = "in_progress", + interrupted = "interrupted", + complete = "complete" + } + + interface DownloadItem { + id: number; + url: string; + referrer?: string; + filename: string; + incognito: boolean; + danger: DangerType; + mime: string; + startTime: string; + endTime?: string; + estimatedEndTime?: string; + state: State; + paused: boolean; + canResume: boolean; + error?: InterruptReason; + bytesReceived: number; + totalBytes: number; + fileSize: number; + exists: boolean; + byExtensionId?: string; + byExtensionName?: string; + } + + interface StringDelta { + current?: string; + previous?: string; + } + + interface DoubleDelta { + current?: number; + previous?: number; + } + + interface BooleanDelta { + current?: boolean; + previous?: boolean; + } + + type DownloadTime = string | extensionTypes.Date; + + interface DownloadQuery { + query?: string[]; + startedBefore?: DownloadTime; + startedAfter?: DownloadTime; + endedBefore?: DownloadTime; + endedAfter?: DownloadTime; + totalBytesGreater?: number; + totalBytesLess?: number; + filenameRegex?: string; + urlRegex?: string; + limit?: number; + orderBy?: string[]; + id?: number; + url?: string; + filename?: string; + danger?: DangerType; + mime?: string; + startTime?: string; + endTime?: string; + state?: State; + paused?: boolean; + error?: InterruptReason; + bytesReceived?: number; + totalBytes?: number; + fileSize?: number; + exists?: boolean; + } + + enum DownloadMethodEnum { + GET = "GET", + POST = "POST" + } + + /* downloads functions */ + function download(options: { + url: string; + filename?: string; + incognito?: boolean; + conflictAction?: FilenameConflictAction; + saveAs?: boolean; + method?: DownloadMethodEnum; + headers?: Array<{ + name: string; + value: string; + }>; + body?: string; + }): Promise; + + function search(query: DownloadQuery): Promise; + + function pause(downloadId: number): Promise; + + function resume(downloadId: number): Promise; + + function cancel(downloadId: number): Promise; + + function getFileIcon(downloadId: number, options?: { + size?: number; + }): Promise; + + function open(downloadId: number): Promise; + + function show(downloadId: number): Promise; + + function showDefaultFolder(): void; + + function erase(query: DownloadQuery): Promise; + + function removeFile(downloadId: number): Promise; + + function acceptDanger(downloadId: number): void; + + function drag(downloadId: number): void; + + function setShelfEnabled(enabled: boolean): void; + + /* downloads events */ + const onCreated: EventListener<(downloadItem: DownloadItem) => void>; + + const onErased: EventListener<(downloadId: number) => void>; + + const onChanged: EventListener<(downloadDelta: { + id: number; + url?: StringDelta; + filename?: StringDelta; + danger?: StringDelta; + mime?: StringDelta; + startTime?: StringDelta; + endTime?: StringDelta; + state?: StringDelta; + canResume?: BooleanDelta; + paused?: BooleanDelta; + error?: StringDelta; + totalBytes?: DoubleDelta; + fileSize?: DoubleDelta; + exists?: BooleanDelta; + }) => void>; +} + +declare namespace browser.events { + /* events types */ + interface Rule { + id?: string; + tags?: string[]; + conditions: any[]; + actions: any[]; + priority?: number; + } + + class Event { + addListener(): void; + + removeListener(): void; + + hasListener(): boolean; + + hasListeners(): boolean; + + addRules(eventName: string, webViewInstanceId: number, rules: Rule[]): void; + + getRules(eventName: string, webViewInstanceId: number, ruleIdentifiers?: string[]): void; + + removeRules(eventName: string, webViewInstanceId: number, ruleIdentifiers?: string[]): void; + } + + interface UrlFilter { + hostContains?: string; + hostEquals?: string; + hostPrefix?: string; + hostSuffix?: string; + pathContains?: string; + pathEquals?: string; + pathPrefix?: string; + pathSuffix?: string; + queryContains?: string; + queryEquals?: string; + queryPrefix?: string; + querySuffix?: string; + urlContains?: string; + urlEquals?: string; + urlMatches?: string; + originAndPathMatches?: string; + urlPrefix?: string; + urlSuffix?: string; + schemes?: string[]; + ports?: Array; + } +} + +declare namespace browser.extension { + /* extension types */ + enum ViewType { + tab = "tab", + popup = "popup", + sidebar = "sidebar" + } + + /* extension properties */ + const lastError: { + message: string; + } | undefined; + + const inIncognitoContext: boolean | undefined; + + /* extension functions */ + function getURL(path: string): string; + + function getViews(fetchProperties?: { + type?: ViewType; + windowId?: number; + tabId?: number; + }): object/*Window*/[]; + + function getBackgroundPage(): object/*Window*/; + + function isAllowedIncognitoAccess(): Promise; + + function isAllowedFileSchemeAccess(): Promise; + + function setUpdateUrlData(data: string): void; + + /* extension events */ + const onRequest: EventListener<(request: any, sender: runtime.MessageSender, sendResponse: () => void) => void> + | EventListener<(sender: runtime.MessageSender, sendResponse: () => void) => void>; + + const onRequestExternal: EventListener<(request: any, sender: runtime.MessageSender, sendResponse: () => void) => void> + | EventListener<(sender: runtime.MessageSender, sendResponse: () => void) => void>; +} + +declare namespace browser.extensionTypes { + /* extensionTypes types */ + enum ImageFormat { + jpeg = "jpeg", + png = "png" + } + + interface ImageDetails { + format?: ImageFormat; + quality?: number; + } + + enum RunAt { + document_start = "document_start", + document_end = "document_end", + document_idle = "document_idle" + } + + enum CSSOrigin { + user = "user", + author = "author" + } + + interface InjectDetails { + code?: string; + file?: string; + allFrames?: boolean; + matchAboutBlank?: boolean; + frameId?: number; + runAt?: RunAt; + cssOrigin?: CSSOrigin; + } + + type Date = string | number | object/*Date*/; +} + +declare namespace browser.i18n { + /* i18n types */ + type LanguageCode = string; + + /* i18n functions */ + function getAcceptLanguages(): Promise; + + function getMessage(messageName: string, substitutions?: any): string; + + function getUILanguage(): string; + + function detectLanguage(text: string): Promise<{ + isReliable: boolean; + languages: Array<{ + language: LanguageCode; + percentage: number; + }>; + }>; +} + +declare namespace browser.identity { + /* identity types */ + interface AccountInfo { + id: string; + } + + /* identity functions */ + function getAccounts(): Promise; + + function getAuthToken(details?: { + interactive?: boolean; + account?: AccountInfo; + scopes?: string[]; + }): Promise; + + function getProfileUserInfo(): Promise<{ + email: string; + id: string; + }>; + + function removeCachedAuthToken(details: { + token: string; + }): Promise<{ + email: string; + id: string; + }>; + + function launchWebAuthFlow(details: { + url: string; + interactive?: boolean; + }): Promise; + + function getRedirectURL(path?: string): string; + + /* identity events */ + const onSignInChanged: EventListener<(account: AccountInfo, signedIn: boolean) => void>; +} + +declare namespace browser.idle { + /* idle types */ + enum IdleState { + active = "active", + idle = "idle" + } + + /* idle functions */ + function queryState(detectionIntervalInSeconds: number): Promise; + + function setDetectionInterval(intervalInSeconds: number): void; + + /* idle events */ + const onStateChanged: EventListener<(newState: IdleState) => void>; +} + +declare namespace browser.management { + /* management types */ + interface IconInfo { + size: number; + url: string; + } + + enum ExtensionDisabledReason { + unknown = "unknown", + permissions_increase = "permissions_increase" + } + + enum ExtensionType { + extension = "extension", + theme = "theme" + } + + enum ExtensionInstallType { + development = "development", + normal = "normal", + sideload = "sideload", + other = "other" + } + + interface ExtensionInfo { + id: string; + name: string; + shortName?: string; + description: string; + version: string; + versionName?: string; + mayDisable: boolean; + enabled: boolean; + disabledReason?: ExtensionDisabledReason; + type: ExtensionType; + homepageUrl?: string; + updateUrl?: string; + optionsUrl: string; + icons?: IconInfo[]; + permissions?: string[]; + hostPermissions?: string[]; + installType: ExtensionInstallType; + } + + /* management functions */ + function getAll(): Promise; + + function get(id: manifest.ExtensionID): Promise; + + function getSelf(): Promise; + + function uninstallSelf(options?: { + showConfirmDialog?: boolean; + dialogMessage?: string; + }): Promise; + + function setEnabled(id: string, enabled: boolean): Promise; + + /* management events */ + const onDisabled: EventListener<(info: ExtensionInfo) => void>; + + const onEnabled: EventListener<(info: ExtensionInfo) => void>; + + const onInstalled: EventListener<(info: ExtensionInfo) => void>; + + const onUninstalled: EventListener<(info: ExtensionInfo) => void>; +} + +declare namespace browser.notifications { + /* notifications types */ + enum TemplateType { + basic = "basic", + image = "image", + list = "list", + progress = "progress" + } + + enum PermissionLevel { + granted = "granted", + denied = "denied" + } + + interface NotificationItem { + title: string; + message: string; + } + + interface CreateNotificationOptions { + type: TemplateType; + iconUrl?: string; + appIconMaskUrl?: string; + title: string; + message: string; + contextMessage?: string; + priority?: number; + eventTime?: number; + buttons?: Array<{ + title: string; + iconUrl?: string; + }>; + imageUrl?: string; + items?: NotificationItem[]; + progress?: number; + isClickable?: boolean; + } + + interface UpdateNotificationOptions { + type?: TemplateType; + iconUrl?: string; + appIconMaskUrl?: string; + title?: string; + message?: string; + contextMessage?: string; + priority?: number; + eventTime?: number; + buttons?: Array<{ + title: string; + iconUrl?: string; + }>; + imageUrl?: string; + items?: NotificationItem[]; + progress?: number; + isClickable?: boolean; + } + + /* notifications functions */ + function create(options: CreateNotificationOptions): Promise; + function create(notificationId: string, options: CreateNotificationOptions): Promise; + + function update(notificationId: string, options: UpdateNotificationOptions): Promise; + + function clear(notificationId: string): Promise; + + function getAll(): Promise; + + function getPermissionLevel(): Promise; + + /* notifications events */ + const onClosed: EventListener<(notificationId: string, byUser: boolean) => void>; + + const onClicked: EventListener<(notificationId: string) => void>; + + const onButtonClicked: EventListener<(notificationId: string, buttonIndex: number) => void>; + + const onPermissionLevelChanged: EventListener<(level: PermissionLevel) => void>; + + const onShowSettings: EventListener<() => void>; + + const onShown: EventListener<(notificationId: string) => void>; +} + +declare namespace browser.permissions { + /* permissions types */ + interface Permissions { + permissions?: manifest.OptionalPermission[]; + origins?: manifest.MatchPattern[]; + } + + interface AnyPermissions { + permissions?: manifest.Permission[]; + origins?: manifest.MatchPatternInternal[]; + } + + /* permissions functions */ + function getAll(): Promise; + + function contains(permissions: AnyPermissions): Promise; + + function request(permissions: Permissions): Promise; + + function remove(permissions: Permissions): Promise; + + /* permissions events */ + const onAdded: EventListener<(permissions: Permissions) => void>; + + const onRemoved: EventListener<(permissions: Permissions) => void>; +} + +declare namespace browser.privacy { +} + +declare namespace browser.privacy.network { + /* privacy.network types */ + enum IPHandlingPolicy { + default = "default", + default_public_and_private_interfaces = "default_public_and_private_interfaces", + default_public_interface_only = "default_public_interface_only", + disable_non_proxied_udp = "disable_non_proxied_udp" + } + + /* privacy.network properties */ + const networkPredictionEnabled: types.Setting; + + const peerConnectionEnabled: types.Setting; + + const webRTCIPHandlingPolicy: types.Setting; +} + +declare namespace browser.privacy.services { + /* privacy.services properties */ + const passwordSavingEnabled: types.Setting; +} + +declare namespace browser.privacy.websites { + /* privacy.websites types */ + enum TrackingProtectionModeOption { + always = "always", + never = "never", + private_browsing = "private_browsing" + } + + /* privacy.websites properties */ + const thirdPartyCookiesAllowed: types.Setting; + + const hyperlinkAuditingEnabled: types.Setting; + + const referrersEnabled: types.Setting; + + const resistFingerprinting: types.Setting; + + const firstPartyIsolate: types.Setting; + + const protectedContentEnabled: types.Setting; + + const trackingProtectionMode: types.Setting; +} + +declare namespace browser.proxy { + /* proxy functions */ + function register(url: string): void; + + function unregister(): void; + + function registerProxyScript(url: string): void; + + /* proxy events */ + const onProxyError: EventListener<(error: object) => void>; +} + +declare namespace browser.runtime { + /* runtime types */ + interface Port { + name: string; + disconnect: () => void; + onDisconnect: events.Event; + onMessage: events.Event; + postMessage: () => void; + sender?: MessageSender; + } + + interface MessageSender { + tab?: tabs.Tab; + frameId?: number; + id?: string; + url?: string; + tlsChannelId?: string; + } + + enum PlatformOs { + mac = "mac", + win = "win", + android = "android", + cros = "cros", + linux = "linux", + openbsd = "openbsd" + } + + enum PlatformArch { + arm = "arm", + x8632 = "x86-32", + x8664 = "x86-64" + } + + interface PlatformInfo { + os: PlatformOs; + arch: PlatformArch; + nacl_arch: PlatformNaclArch; + } + + interface BrowserInfo { + name: string; + vendor: string; + version: string; + buildID: string; + } + + enum RequestUpdateCheckStatus { + throttled = "throttled", + no_update = "no_update", + update_available = "update_available" + } + + enum OnInstalledReason { + install = "install", + update = "update", + browser_update = "browser_update" + } + + enum OnRestartRequiredReason { + app_update = "app_update", + os_update = "os_update", + periodic = "periodic" + } + + type PlatformNaclArch = any; + + /* runtime properties */ + const lastError: { + message?: string; + } | undefined; + + const id: string; + + /* runtime functions */ + function getBackgroundPage(): Promise; + + function openOptionsPage(): Promise; + + function getManifest(): object; + + function getURL(path: string): string; + + function setUninstallURL(url: string): Promise; + + function reload(): void; + + function requestUpdateCheck(): Promise; + + function restart(): void; + + function connect(connectInfo?: { + name?: string; + includeTlsChannelId?: boolean; + }): Port; + function connect(extensionId: string, connectInfo?: { + name?: string; + includeTlsChannelId?: boolean; + }): Port; + + function connectNative(application: string): Port; + + function sendMessage(message: any, options?: { + includeTlsChannelId?: boolean; + toProxyScript?: boolean; + }, responseCallback?: (response: any) => void): void; + function sendMessage(extensionId: string, message: any, options: { + includeTlsChannelId?: boolean; + toProxyScript?: boolean; + }, responseCallback?: (response: any) => void): void; + + function sendNativeMessage(application: string, message: any, responseCallback?: (response: any) => void): void; + + function getBrowserInfo(): Promise; + + function getPlatformInfo(): Promise; + + function getPackageDirectoryEntry(): Promise; + + /* runtime events */ + const onStartup: EventListener<() => void>; + + const onInstalled: EventListener<(details: { + reason: OnInstalledReason; + previousVersion?: string; + temporary: boolean; + id?: string; + }) => void>; + + const onSuspend: EventListener<() => void>; + + const onSuspendCanceled: EventListener<() => void>; + + const onUpdateAvailable: EventListener<(details: { + version: string; + }) => void>; + + const onBrowserUpdateAvailable: EventListener<() => void>; + + const onConnect: EventListener<(port: Port) => void>; + + const onConnectExternal: EventListener<(port: Port) => void>; + + const onMessage: EventListener<(message: any, sender: MessageSender, sendResponse: () => void) => boolean> + | EventListener<(sender: MessageSender, sendResponse: () => void) => boolean>; + + const onMessageExternal: EventListener<(message: any, sender: MessageSender, sendResponse: () => void) => boolean> + | EventListener<(sender: MessageSender, sendResponse: () => void) => boolean>; + + const onRestartRequired: EventListener<(reason: OnRestartRequiredReason) => void>; +} + +declare namespace browser.storage { + /* storage types */ + interface StorageChange { + oldValue?: any; + newValue?: any; + } + + class StorageArea { + get(keys?: string | string[] | object): Promise; + + getBytesInUse(keys?: string | string[]): Promise; + + set(items: any): Promise; + + remove(keys: string | string[]): Promise; + + clear(): Promise; + } + + /* storage properties */ + const sync: StorageArea; + + const local: StorageArea; + + const managed: StorageArea; + + /* storage events */ + const onChanged: EventListener<(changes: StorageChange, areaName: string) => void>; +} + +declare namespace browser.theme { + /* theme types */ + interface ThemeUpdateInfo { + theme: object; + windowId?: number; + } + + /* theme functions */ + function getCurrent(windowId?: number): void; + + function update(details: manifest.ThemeType): void; + function update(windowId: number, details: manifest.ThemeType): void; + + function reset(windowId?: number): void; + + /* theme events */ + const onUpdated: EventListener<(updateInfo: ThemeUpdateInfo) => void>; +} + +declare namespace browser.topSites { + /* topSites types */ + interface MostVisitedURL { + url: string; + title?: string; + } + + /* topSites functions */ + function get(options?: { + providers?: string[]; + }): Promise; +} + +declare namespace browser.types { + /* types types */ + enum SettingScope { + regular = "regular", + regular_only = "regular_only", + incognito_persistent = "incognito_persistent", + incognito_session_only = "incognito_session_only" + } + + enum LevelOfControl { + not_controllable = "not_controllable", + controlled_by_other_extensions = "controlled_by_other_extensions", + controllable_by_this_extension = "controllable_by_this_extension", + controlled_by_this_extension = "controlled_by_this_extension" + } + + class Setting { + get(details: { + incognito?: boolean; + }): Promise<{ + value: any; + levelOfControl: LevelOfControl; + incognitoSpecific?: boolean; + }>; + + set(details: { + value: any; + scope?: SettingScope; + }): Promise; + + clear(details: { + scope?: SettingScope; + }): Promise; + + onChange: EventListener<(details: { + value: any; + levelOfControl: LevelOfControl; + incognitoSpecific?: boolean; + }) => void>; + } +} + +declare namespace browser.webNavigation { + /* webNavigation types */ + enum TransitionType { + link = "link", + typed = "typed", + auto_bookmark = "auto_bookmark", + auto_subframe = "auto_subframe", + manual_subframe = "manual_subframe", + generated = "generated", + start_page = "start_page", + form_submit = "form_submit", + reload = "reload", + keyword = "keyword", + keyword_generated = "keyword_generated" + } + + enum TransitionQualifier { + client_redirect = "client_redirect", + server_redirect = "server_redirect", + forward_back = "forward_back", + from_address_bar = "from_address_bar" + } + + interface EventUrlFilters { + url: events.UrlFilter[]; + } + + /* webNavigation functions */ + function getFrame(details: { + tabId: number; + processId?: number; + frameId: number; + }): Promise<{ + errorOccurred?: boolean; + url: string; + tabId: number; + frameId: number; + parentFrameId: number; + }>; + + function getAllFrames(details: { + tabId: number; + }): Promise>; + + /* webNavigation events */ + const onBeforeNavigate: EventListener<(details: { + tabId: number; + url: string; + processId: number; + frameId: number; + parentFrameId: number; + timeStamp: number; + }) => void>; + + const onCommitted: EventListener<(details: { + tabId: number; + url: string; + processId: number; + frameId: number; + transitionType: TransitionType; + transitionQualifiers: TransitionQualifier[]; + timeStamp: number; + }) => void>; + + const onDOMContentLoaded: EventListener<(details: { + tabId: number; + url: string; + processId: number; + frameId: number; + timeStamp: number; + }) => void>; + + const onCompleted: EventListener<(details: { + tabId: number; + url: string; + processId: number; + frameId: number; + timeStamp: number; + }) => void>; + + const onErrorOccurred: EventListener<(details: { + tabId: number; + url: string; + processId: number; + frameId: number; + error: string; + timeStamp: number; + }) => void>; + + const onCreatedNavigationTarget: EventListener<(details: { + sourceTabId: number; + sourceProcessId: number; + sourceFrameId: number; + url: string; + tabId: number; + timeStamp: number; + }) => void>; + + const onReferenceFragmentUpdated: EventListener<(details: { + tabId: number; + url: string; + processId: number; + frameId: number; + transitionType: TransitionType; + transitionQualifiers: TransitionQualifier[]; + timeStamp: number; + }) => void>; + + const onTabReplaced: EventListener<(details: { + replacedTabId: number; + tabId: number; + timeStamp: number; + }) => void>; + + const onHistoryStateUpdated: EventListener<(details: { + tabId: number; + url: string; + processId: number; + frameId: number; + transitionType: TransitionType; + transitionQualifiers: TransitionQualifier[]; + timeStamp: number; + }) => void>; +} + +declare namespace browser.webRequest { + /* webRequest types */ + enum ResourceType { + main_frame = "main_frame", + sub_frame = "sub_frame", + stylesheet = "stylesheet", + script = "script", + image = "image", + object = "object", + object_subrequest = "object_subrequest", + xmlhttprequest = "xmlhttprequest", + xbl = "xbl", + xslt = "xslt", + ping = "ping", + beacon = "beacon", + xml_dtd = "xml_dtd", + font = "font", + media = "media", + websocket = "websocket", + csp_report = "csp_report", + imageset = "imageset", + web_manifest = "web_manifest", + other = "other" + } + + enum OnBeforeRequestOptions { + blocking = "blocking", + requestBody = "requestBody" + } + + enum OnBeforeSendHeadersOptions { + requestHeaders = "requestHeaders", + blocking = "blocking" + } + + enum OnSendHeadersOptions { + requestHeaders = "requestHeaders" + } + + enum OnHeadersReceivedOptions { + blocking = "blocking", + responseHeaders = "responseHeaders" + } + + enum OnAuthRequiredOptions { + responseHeaders = "responseHeaders", + blocking = "blocking", + asyncBlocking = "asyncBlocking" + } + + enum OnResponseStartedOptions { + responseHeaders = "responseHeaders" + } + + enum OnBeforeRedirectOptions { + responseHeaders = "responseHeaders" + } + + enum OnCompletedOptions { + responseHeaders = "responseHeaders" + } + + interface RequestFilter { + urls: string[]; + types?: ResourceType[]; + tabId?: number; + windowId?: number; + } + + type HttpHeaders = Array<{ + name: string; + value?: string; + binaryValue?: number[]; + }>; + + interface BlockingResponse { + cancel?: boolean; + redirectUrl?: string; + requestHeaders?: HttpHeaders; + responseHeaders?: HttpHeaders; + authCredentials?: { + username: string; + password: string; + }; + } + + interface UploadData { + bytes?: any; + file?: string; + } + + /* webRequest properties */ + const MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES: number; + + /* webRequest functions */ + function handlerBehaviorChanged(): Promise; + + function filterResponseData(requestId: string): object/*StreamFilter*/; + + /* webRequest events */ + const onBeforeRequest: EventListener<(details: { + requestId: string; + url: string; + method: string; + frameId: number; + parentFrameId: number; + originUrl?: string; + documentUrl?: string; + requestBody?: { + error?: string; + formData?: object; + raw?: UploadData[]; + }; + tabId: number; + type: ResourceType; + timeStamp: number; + }) => BlockingResponse>; + + const onBeforeSendHeaders: EventListener<(details: { + requestId: string; + url: string; + method: string; + frameId: number; + parentFrameId: number; + originUrl?: string; + documentUrl?: string; + tabId: number; + type: ResourceType; + timeStamp: number; + requestHeaders?: HttpHeaders; + }) => BlockingResponse>; + + const onSendHeaders: EventListener<(details: { + requestId: string; + url: string; + method: string; + frameId: number; + parentFrameId: number; + originUrl?: string; + documentUrl?: string; + tabId: number; + type: ResourceType; + timeStamp: number; + requestHeaders?: HttpHeaders; + }) => void>; + + const onHeadersReceived: EventListener<(details: { + requestId: string; + url: string; + method: string; + frameId: number; + parentFrameId: number; + originUrl?: string; + documentUrl?: string; + tabId: number; + type: ResourceType; + timeStamp: number; + statusLine: string; + responseHeaders?: HttpHeaders; + statusCode: number; + }) => BlockingResponse>; + + const onAuthRequired: EventListener<(details: { + requestId: string; + url: string; + method: string; + frameId: number; + parentFrameId: number; + originUrl?: string; + documentUrl?: string; + tabId: number; + type: ResourceType; + timeStamp: number; + scheme: string; + realm?: string; + challenger: { + host: string; + port: number; + }; + isProxy: boolean; + responseHeaders?: HttpHeaders; + statusLine: string; + statusCode: number; + }) => BlockingResponse>; + + const onResponseStarted: EventListener<(details: { + requestId: string; + url: string; + method: string; + frameId: number; + parentFrameId: number; + originUrl?: string; + documentUrl?: string; + tabId: number; + type: ResourceType; + timeStamp: number; + ip?: string; + fromCache: boolean; + statusCode: number; + responseHeaders?: HttpHeaders; + statusLine: string; + }) => void>; + + const onBeforeRedirect: EventListener<(details: { + requestId: string; + url: string; + method: string; + frameId: number; + parentFrameId: number; + originUrl?: string; + documentUrl?: string; + tabId: number; + type: ResourceType; + timeStamp: number; + ip?: string; + fromCache: boolean; + statusCode: number; + redirectUrl: string; + responseHeaders?: HttpHeaders; + statusLine: string; + }) => void>; + + const onCompleted: EventListener<(details: { + requestId: string; + url: string; + method: string; + frameId: number; + parentFrameId: number; + originUrl?: string; + documentUrl?: string; + tabId: number; + type: ResourceType; + timeStamp: number; + ip?: string; + fromCache: boolean; + statusCode: number; + responseHeaders?: HttpHeaders; + statusLine: string; + }) => void>; + + const onErrorOccurred: EventListener<(details: { + requestId: string; + url: string; + method: string; + frameId: number; + parentFrameId: number; + originUrl?: string; + documentUrl?: string; + tabId: number; + type: ResourceType; + timeStamp: number; + ip?: string; + fromCache: boolean; + error: string; + }) => void>; +} + +declare namespace browser.bookmarks { + /* bookmarks types */ + enum BookmarkTreeNodeUnmodifiable { + managed = "managed" + } + + enum BookmarkTreeNodeType { + bookmark = "bookmark", + folder = "folder", + separator = "separator" + } + + interface BookmarkTreeNode { + id: string; + parentId?: string; + index?: number; + url?: string; + title: string; + dateAdded?: number; + dateGroupModified?: number; + unmodifiable?: BookmarkTreeNodeUnmodifiable; + type?: BookmarkTreeNodeType; + children?: BookmarkTreeNode[]; + } + + interface CreateDetails { + parentId?: string; + index?: number; + title?: string; + url?: string; + type?: BookmarkTreeNodeType; + } + + /* bookmarks functions */ + function get(idOrIdList: string | string[]): Promise; + + function getChildren(id: string): Promise; + + function getRecent(numberOfItems: number): Promise; + + function getTree(): Promise; + + function getSubTree(id: string): Promise; + + function search(query: string | { + query?: string; + url?: string; + title?: string; + }): Promise; + + function create(bookmark: CreateDetails): Promise; + + function move(id: string, destination: { + parentId?: string; + index?: number; + }): Promise; + + function update(id: string, changes: { + title?: string; + url?: string; + }): Promise; + + function remove(id: string): Promise; + + function removeTree(id: string): Promise; + + function import_(): Promise; + + function export_(): Promise; + + /* bookmarks events */ + const onCreated: EventListener<(id: string, bookmark: BookmarkTreeNode) => void>; + + const onRemoved: EventListener<(id: string, removeInfo: { + parentId: string; + index: number; + node: BookmarkTreeNode; + }) => void>; + + const onChanged: EventListener<(id: string, changeInfo: { + title: string; + url?: string; + }) => void>; + + const onMoved: EventListener<(id: string, moveInfo: { + parentId: string; + index: number; + oldParentId: string; + oldIndex: number; + }) => void>; + + const onChildrenReordered: EventListener<(id: string, reorderInfo: { + childIds: string[]; + }) => void>; + + const onImportBegan: EventListener<() => void>; + + const onImportEnded: EventListener<() => void>; +} + +declare namespace browser.browserAction { + /* browserAction types */ + type ColorArray = [number, number, number, number]; + + type ImageDataType = object/*ImageData*/; + + /* browserAction functions */ + function setTitle(details: { + title: string; + tabId?: number; + }): Promise; + + function getTitle(details: { + tabId?: number; + }): Promise; + + function setIcon(details: { + imageData?: ImageDataType | { + [key: number]: ImageDataType; + }; + path?: string | { + [key: number]: string; + }; + tabId?: number; + }): Promise; + + function setPopup(details: { + tabId?: number; + popup: string; + }): Promise; + + function getPopup(details: { + tabId?: number; + }): Promise; + + function setBadgeText(details: { + text: string; + tabId?: number; + }): Promise; + + function getBadgeText(details: { + tabId?: number; + }): Promise; + + function setBadgeBackgroundColor(details: { + color: string | ColorArray; + tabId?: number; + }): Promise; + + function getBadgeBackgroundColor(details: { + tabId?: number; + }): Promise; + + function enable(tabId?: number): Promise; + + function disable(tabId?: number): Promise; + + function openPopup(): void; + + /* browserAction events */ + const onClicked: EventListener<(tab: tabs.Tab) => void>; +} + +declare namespace browser.browsingData { + /* browsingData types */ + interface RemovalOptions { + since?: extensionTypes.Date; + hostnames?: string[]; + originTypes?: { + unprotectedWeb?: boolean; + protectedWeb?: boolean; + extension?: boolean; + }; + } + + interface DataTypeSet { + cache?: boolean; + cookies?: boolean; + downloads?: boolean; + formData?: boolean; + history?: boolean; + indexedDB?: boolean; + localStorage?: boolean; + serverBoundCertificates?: boolean; + passwords?: boolean; + pluginData?: boolean; + serviceWorkers?: boolean; + } + + /* browsingData functions */ + function settings(): Promise<{ + options: RemovalOptions; + dataToRemove: DataTypeSet; + dataRemovalPermitted: DataTypeSet; + }>; + + function remove(options: RemovalOptions, dataToRemove: DataTypeSet): Promise; + + function removeAppcache(options: RemovalOptions): Promise; + + function removeCache(options: RemovalOptions): Promise; + + function removeCookies(options: RemovalOptions): Promise; + + function removeDownloads(options: RemovalOptions): Promise; + + function removeFileSystems(options: RemovalOptions): Promise; + + function removeFormData(options: RemovalOptions): Promise; + + function removeHistory(options: RemovalOptions): Promise; + + function removeIndexedDB(options: RemovalOptions): Promise; + + function removeLocalStorage(options: RemovalOptions): Promise; + + function removePluginData(options: RemovalOptions): Promise; + + function removePasswords(options: RemovalOptions): Promise; + + function removeWebSQL(options: RemovalOptions): Promise; +} + +declare namespace browser.commands { + /* commands types */ + interface Command { + name?: string; + description?: string; + shortcut?: string; + } + + /* commands functions */ + function getAll(): Promise; + + /* commands events */ + const onCommand: EventListener<(command: string) => void>; +} + +declare namespace browser.devtools { +} + +declare namespace browser.devtools.inspectedWindow { + /* devtools.inspectedWindow types */ + class Resource { + url: string; + + getContent(): Promise; + + setContent(content: string, commit: boolean): Promise; + } + + /* devtools.inspectedWindow properties */ + const tabId: number; + + /* devtools.inspectedWindow functions */ + function eval(expression: string, options?: { + frameURL?: string; + useContentScriptContext?: boolean; + contextSecurityOrigin?: string; + }): Promise; + + function reload(reloadOptions?: { + ignoreCache?: boolean; + userAgent?: string; + injectedScript?: string; + preprocessorScript?: string; + }): void; + + function getResources(): Promise; + + /* devtools.inspectedWindow events */ + const onResourceAdded: EventListener<(resource: Resource) => void>; + + const onResourceContentCommitted: EventListener<(resource: Resource, content: string) => void>; +} + +declare namespace browser.devtools.network { + /* devtools.network types */ + class Request { + getContent(): Promise; + } + + /* devtools.network functions */ + function getHAR(): Promise; + + /* devtools.network events */ + const onRequestFinished: EventListener<(request: Request) => void>; + + const onNavigated: EventListener<(url: string) => void>; +} + +declare namespace browser.devtools.panels { + /* devtools.panels types */ + class ElementsPanel { + createSidebarPane(title: string): Promise; + + onSelectionChanged: EventListener<() => void>; + } + + class SourcesPanel { + createSidebarPane(title: string): void; + + onSelectionChanged: EventListener<() => void>; + } + + class ExtensionPanel { + createStatusBarButton(iconPath: string, tooltipText: string, disabled: boolean): Button; + + onSearch: EventListener<(action: string, queryString?: string) => void>; + onShown: EventListener<(window: object/*global*/) => void>; + onHidden: EventListener<() => void>; + } + + class ExtensionSidebarPane { + setHeight(height: string): void; + + setExpression(expression: string, rootTitle?: string): Promise; + + setObject(jsonObject: string, rootTitle?: string): Promise; + + setPage(path: string): void; + + onShown: EventListener<(window: object/*global*/) => void>; + onHidden: EventListener<() => void>; + } + + class Button { + update(tooltipText?: string, disabled?: boolean): void; + update(disabled?: boolean): void; + update(iconPath: string, tooltipText: string, disabled?: boolean): void; + + onClicked: EventListener<() => void>; + } + + /* devtools.panels properties */ + const elements: ElementsPanel; + + const sources: SourcesPanel; + + const themeName: string; + + /* devtools.panels functions */ + function create(title: string, iconPath: string, pagePath: string): Promise; + + function setOpenResourceHandler(): Promise; + + function openResource(url: string, lineNumber: number): Promise; + + /* devtools.panels events */ + const onThemeChanged: EventListener<(themeName: string) => void>; +} + +declare namespace browser.find { + /* find functions */ + function find(queryphrase: string, params?: { + tabId?: number; + caseSensitive?: boolean; + entireWord?: boolean; + includeRectData?: boolean; + includeRangeData?: boolean; + }): void; + + function highlightResults(params?: { + rangeIndex?: number; + tabId?: number; + noScroll?: boolean; + }): void; + + function removeHighlighting(tabId?: number): void; +} + +declare namespace browser.geckoProfiler { + /* geckoProfiler types */ + enum ProfilerFeature { + java = "java", + js = "js", + leaf = "leaf", + mainthreadio = "mainthreadio", + memory = "memory", + privacy = "privacy", + restyle = "restyle", + stackwalk = "stackwalk", + tasktracer = "tasktracer", + threads = "threads" + } + + /* geckoProfiler functions */ + function start(settings: { + bufferSize: number; + interval: number; + features: ProfilerFeature[]; + threads?: string[]; + }): void; + + function stop(): void; + + function pause(): void; + + function resume(): void; + + function getProfile(): void; + + function getProfileAsArrayBuffer(): void; + + function getSymbols(debugName: string, breakpadId: string): void; + + /* geckoProfiler events */ + const onRunning: EventListener<(isRunning: boolean) => void>; +} + +declare namespace browser.history { + /* history types */ + enum TransitionType { + link = "link", + typed = "typed", + auto_bookmark = "auto_bookmark", + auto_subframe = "auto_subframe", + manual_subframe = "manual_subframe", + generated = "generated", + auto_toplevel = "auto_toplevel", + form_submit = "form_submit", + reload = "reload", + keyword = "keyword", + keyword_generated = "keyword_generated" + } + + interface HistoryItem { + id: string; + url?: string; + title?: string; + lastVisitTime?: number; + visitCount?: number; + typedCount?: number; + } + + interface VisitItem { + id: string; + visitId: string; + visitTime?: number; + referringVisitId: string; + transition: TransitionType; + } + + /* history functions */ + function search(query: { + text: string; + startTime?: extensionTypes.Date; + endTime?: extensionTypes.Date; + maxResults?: number; + }): Promise; + + function getVisits(details: { + url: string; + }): Promise; + + function addUrl(details: { + url: string; + title?: string; + transition?: TransitionType; + visitTime?: extensionTypes.Date; + }): Promise; + + function deleteUrl(details: { + url: string; + }): Promise; + + function deleteRange(range: { + startTime: extensionTypes.Date; + endTime: extensionTypes.Date; + }): Promise; + + function deleteAll(): Promise; + + /* history events */ + const onVisited: EventListener<(result: HistoryItem) => void>; + + const onVisitRemoved: EventListener<(removed: { + allHistory: boolean; + urls: string[]; + }) => void>; + + const onTitleChanged: EventListener<(changed: { + url: string; + title: string; + }) => void>; +} + +declare namespace browser.contextMenus { + /* contextMenus types */ + enum ContextType { + all = "all", + page = "page", + frame = "frame", + selection = "selection", + link = "link", + editable = "editable", + password = "password", + image = "image", + video = "video", + audio = "audio", + launcher = "launcher", + browser_action = "browser_action", + page_action = "page_action", + tab = "tab" + } +} + +declare namespace browser.menus { + /* menus types */ + enum ContextType { + all = "all", + page = "page", + frame = "frame", + selection = "selection", + link = "link", + editable = "editable", + password = "password", + image = "image", + video = "video", + audio = "audio", + launcher = "launcher", + browser_action = "browser_action", + page_action = "page_action", + tab = "tab", + tools_menu = "tools_menu" + } + + enum ItemType { + normal = "normal", + checkbox = "checkbox", + radio = "radio", + separator = "separator" + } + + interface OnClickData { + menuItemId: number | string; + parentMenuItemId?: number | string; + mediaType?: string; + linkText?: string; + linkUrl?: string; + srcUrl?: string; + pageUrl?: string; + frameUrl?: string; + selectionText?: string; + editable: boolean; + wasChecked?: boolean; + checked?: boolean; + modifiers: OnClickDataModifiersEnum[]; + } + + enum OnClickDataModifiersEnum { + Shift = "Shift", + Alt = "Alt", + Command = "Command", + Ctrl = "Ctrl", + MacCtrl = "MacCtrl" + } + + /* menus properties */ + const ACTION_MENU_TOP_LEVEL_LIMIT: number; + + /* menus functions */ + function create(createProperties: { + type?: ItemType; + id?: string; + icons?: { + [key: number]: string; + }; + title?: string; + checked?: boolean; + contexts?: ContextType[]; + onclick?: (info: menusInternal.OnClickData, tab: tabs.Tab) => void; + parentId?: number | string; + documentUrlPatterns?: string[]; + targetUrlPatterns?: string[]; + enabled?: boolean; + command?: string; + }): number | string; + + function update(id: number | string, updateProperties: { + type?: ItemType; + title?: string; + checked?: boolean; + contexts?: ContextType[]; + onclick?: (info: menusInternal.OnClickData, tab: tabs.Tab) => void; + parentId?: number | string; + documentUrlPatterns?: string[]; + targetUrlPatterns?: string[]; + enabled?: boolean; + }): Promise; + + function remove(menuItemId: number | string): Promise; + + function removeAll(): Promise; + + /* menus events */ + const onClicked: EventListener<(info: OnClickData, tab?: tabs.Tab) => void>; +} + +declare namespace browser.menusInternal { + /* menusInternal types */ + interface OnClickData { + menuItemId: number | string; + parentMenuItemId?: number | string; + mediaType?: string; + linkUrl?: string; + srcUrl?: string; + pageUrl?: string; + frameUrl?: string; + selectionText?: string; + editable: boolean; + wasChecked?: boolean; + checked?: boolean; + } +} + +declare namespace browser.omnibox { + /* omnibox types */ + enum DescriptionStyleType { + url = "url", + match = "match", + dim = "dim" + } + + enum OnInputEnteredDisposition { + currentTab = "currentTab", + newForegroundTab = "newForegroundTab", + newBackgroundTab = "newBackgroundTab" + } + + interface SuggestResult { + content: string; + description: string; + descriptionStyles?: Array<{ + offset: number; + type: DescriptionStyleType; + length?: number; + }>; + descriptionStylesRaw?: Array<{ + offset: number; + type: number; + }>; + } + + interface DefaultSuggestResult { + description: string; + descriptionStyles?: Array<{ + offset: number; + type: DescriptionStyleType; + length?: number; + }>; + descriptionStylesRaw?: Array<{ + offset: number; + type: number; + }>; + } + + /* omnibox functions */ + function setDefaultSuggestion(suggestion: DefaultSuggestResult): void; + + /* omnibox events */ + const onInputStarted: EventListener<() => void>; + + const onInputChanged: EventListener<(text: string, suggest: (suggestResults: SuggestResult[]) => void) => void>; + + const onInputEntered: EventListener<(text: string, disposition: OnInputEnteredDisposition) => void>; + + const onInputCancelled: EventListener<() => void>; +} + +declare namespace browser.pageAction { + /* pageAction types */ + type ImageDataType = object/*ImageData*/; + + /* pageAction functions */ + function show(tabId: number): Promise; + + function hide(tabId: number): Promise; + + function setTitle(details: { + tabId: number; + title: string; + }): void; + + function getTitle(details: { + tabId: number; + }): Promise; + + function setIcon(details: { + tabId: number; + imageData?: ImageDataType | { + [key: number]: ImageDataType; + }; + path?: string | { + [key: number]: string; + }; + }): Promise; + + function setPopup(details: { + tabId: number; + popup: string; + }): void; + + function getPopup(details: { + tabId: number; + }): Promise; + + function openPopup(): void; + + /* pageAction events */ + const onClicked: EventListener<(tab: tabs.Tab) => void>; +} + +declare namespace browser.pkcs11 { + /* pkcs11 functions */ + function isModuleInstalled(name: string): void; + + function installModule(name: string, flags?: number): void; + + function uninstallModule(name: string): void; + + function getModuleSlots(name: string): void; +} + +declare namespace browser.sessions { + /* sessions types */ + interface Filter { + maxResults?: number; + } + + interface Session { + lastModified: number; + tab?: tabs.Tab; + window?: windows.Window; + } + + interface Device { + info: string; + deviceName: string; + sessions: Session[]; + } + + /* sessions properties */ + const MAX_SESSION_RESULTS: number; + + /* sessions functions */ + function forgetClosedTab(windowId: number, sessionId: string): void; + + function forgetClosedWindow(sessionId: string): void; + + function getRecentlyClosed(filter?: Filter): Promise; + + function getDevices(filter?: Filter): Promise; + + function restore(sessionId?: string): Promise; + + function setTabValue(tabId: number, key: string, value: any): void; + + function getTabValue(tabId: number, key: string): void; + + function removeTabValue(tabId: number, key: string): void; + + function setWindowValue(windowId: number, key: string, value: any): void; + + function getWindowValue(windowId: number, key: string): void; + + function removeWindowValue(windowId: number, key: string): void; + + /* sessions events */ + const onChanged: EventListener<() => void>; +} + +declare namespace browser.sidebarAction { + /* sidebarAction types */ + type ImageDataType = object/*ImageData*/; + + /* sidebarAction functions */ + function setTitle(details: { + title: string; + tabId?: number; + }): void; + + function getTitle(details: { + tabId?: number; + }): void; + + function setIcon(details: { + imageData?: ImageDataType | { + [key: number]: ImageDataType; + }; + path?: string | string; + tabId?: number; + }): void; + + function setPanel(details: { + tabId?: number; + panel: string; + }): void; + + function getPanel(details: { + tabId?: number; + }): void; + + function open(): void; + + function close(): void; +} + +declare namespace browser.tabs { + /* tabs types */ + enum MutedInfoReason { + user = "user", + capture = "capture", + extension = "extension" + } + + interface MutedInfo { + muted: boolean; + reason?: MutedInfoReason; + extensionId?: string; + } + + interface Tab { + id?: number; + index: number; + windowId?: number; + openerTabId?: number; + selected: boolean; + highlighted: boolean; + active: boolean; + pinned: boolean; + lastAccessed?: number; + audible?: boolean; + mutedInfo?: MutedInfo; + url?: string; + title?: string; + favIconUrl?: string; + status?: string; + discarded?: boolean; + incognito: boolean; + width?: number; + height?: number; + sessionId?: string; + cookieStoreId?: string; + isArticle?: boolean; + isInReaderMode?: boolean; + } + + enum ZoomSettingsMode { + automatic = "automatic", + manual = "manual", + disabled = "disabled" + } + + enum ZoomSettingsScope { + perorigin = "per-origin", + pertab = "per-tab" + } + + interface ZoomSettings { + mode?: ZoomSettingsMode; + scope?: ZoomSettingsScope; + defaultZoomFactor?: number; + } + + interface PageSettings { + orientation?: number; + scaling?: number; + shrinkToFit?: boolean; + showBackgroundColors?: boolean; + showBackgroundImages?: boolean; + paperSizeUnit?: number; + paperWidth?: number; + paperHeight?: number; + headerLeft?: string; + headerCenter?: string; + headerRight?: string; + footerLeft?: string; + footerCenter?: string; + footerRight?: string; + marginLeft?: number; + marginRight?: number; + marginTop?: number; + marginBottom?: number; + } + + enum TabStatus { + loading = "loading", + complete = "complete" + } + + enum WindowType { + normal = "normal", + popup = "popup", + panel = "panel", + app = "app", + devtools = "devtools" + } + + /* tabs properties */ + const TAB_ID_NONE: number; + + /* tabs functions */ + function get(tabId: number): Promise; + + function getCurrent(): Promise; + + function connect(tabId: number, connectInfo?: { + name?: string; + frameId?: number; + }): runtime.Port; + + function sendRequest(tabId: number, request: any, responseCallback?: (response: any) => void): void; + + function sendMessage(tabId: number, message: any, options: { + frameId?: number; + }, responseCallback?: (response: any) => void): void; + + function getSelected(windowId?: number): Promise; + + function getAllInWindow(windowId?: number): Promise; + + function create(createProperties: { + windowId?: number; + index?: number; + url?: string; + active?: boolean; + selected?: boolean; + pinned?: boolean; + openerTabId?: number; + cookieStoreId?: string; + openInReaderMode?: boolean; + }): Promise; + + function duplicate(tabId: number): Promise; + + function query(queryInfo: { + active?: boolean; + pinned?: boolean; + audible?: boolean; + muted?: boolean; + highlighted?: boolean; + currentWindow?: boolean; + lastFocusedWindow?: boolean; + status?: TabStatus; + discarded?: boolean; + title?: string; + url?: string | string[]; + windowId?: number; + windowType?: WindowType; + index?: number; + cookieStoreId?: string; + openerTabId?: number; + }): Promise; + + function highlight(highlightInfo: { + windowId?: number; + tabs: number[] | number; + }): Promise; + + function update(updateProperties: { + url?: string; + active?: boolean; + highlighted?: boolean; + selected?: boolean; + pinned?: boolean; + muted?: boolean; + openerTabId?: number; + loadReplace?: boolean; + }): Promise; + function update(tabId: number, updateProperties: { + url?: string; + active?: boolean; + highlighted?: boolean; + selected?: boolean; + pinned?: boolean; + muted?: boolean; + openerTabId?: number; + loadReplace?: boolean; + }): Promise; + + function move(tabIds: number | number[], moveProperties: { + windowId?: number; + index: number; + }): Promise; + + function reload(reloadProperties?: { + bypassCache?: boolean; + }): Promise; + function reload(tabId: number, reloadProperties?: { + bypassCache?: boolean; + }): Promise; + + function remove(tabIds: number | number[]): Promise; + + function discard(tabIds: number | number[]): void; + + function detectLanguage(tabId?: number): Promise; + + function toggleReaderMode(tabId?: number): void; + + function captureVisibleTab(options?: extensionTypes.ImageDetails): Promise; + function captureVisibleTab(windowId: number, options?: extensionTypes.ImageDetails): Promise; + + function executeScript(details: extensionTypes.InjectDetails): Promise; + function executeScript(tabId: number, details: extensionTypes.InjectDetails): Promise; + + function insertCSS(details: extensionTypes.InjectDetails): Promise; + function insertCSS(tabId: number, details: extensionTypes.InjectDetails): Promise; + + function removeCSS(details: extensionTypes.InjectDetails): Promise; + function removeCSS(tabId: number, details: extensionTypes.InjectDetails): Promise; + + function setZoom(zoomFactor: number): Promise; + function setZoom(tabId: number, zoomFactor: number): Promise; + + function getZoom(tabId?: number): Promise; + + function setZoomSettings(zoomSettings: ZoomSettings): Promise; + function setZoomSettings(tabId: number, zoomSettings: ZoomSettings): Promise; + + function getZoomSettings(tabId?: number): Promise; + + function print(): void; + + function printPreview(): Promise; + + function saveAsPDF(pageSettings: PageSettings): Promise; + + /* tabs events */ + const onCreated: EventListener<(tab: Tab) => void>; + + const onUpdated: EventListener<(tabId: number, changeInfo: { + status: string; + discarded?: boolean; + url?: string; + pinned?: boolean; + audible?: boolean; + mutedInfo?: MutedInfo; + favIconUrl?: string; + }, tab: Tab) => void>; + + const onMoved: EventListener<(tabId: number, moveInfo: { + windowId: number; + fromIndex: number; + toIndex: number; + }) => void>; + + const onSelectionChanged: EventListener<(tabId: number, selectInfo: { + windowId: number; + }) => void>; + + const onActiveChanged: EventListener<(tabId: number, selectInfo: { + windowId: number; + }) => void>; + + const onActivated: EventListener<(activeInfo: { + tabId: number; + windowId: number; + }) => void>; + + const onHighlightChanged: EventListener<(selectInfo: { + windowId: number; + tabIds: number[]; + }) => void>; + + const onHighlighted: EventListener<(highlightInfo: { + windowId: number; + tabIds: number[]; + }) => void>; + + const onDetached: EventListener<(tabId: number, detachInfo: { + oldWindowId: number; + oldPosition: number; + }) => void>; + + const onAttached: EventListener<(tabId: number, attachInfo: { + newWindowId: number; + newPosition: number; + }) => void>; + + const onRemoved: EventListener<(tabId: number, removeInfo: { + windowId: number; + isWindowClosing: boolean; + }) => void>; + + const onReplaced: EventListener<(addedTabId: number, removedTabId: number) => void>; + + const onZoomChange: EventListener<(ZoomChangeInfo: { + tabId: number; + oldZoomFactor: number; + newZoomFactor: number; + zoomSettings: ZoomSettings; + }) => void>; +} + +declare namespace browser.windows { + /* windows types */ + enum WindowType { + normal = "normal", + popup = "popup", + panel = "panel", + app = "app", + devtools = "devtools" + } + + enum WindowState { + normal = "normal", + minimized = "minimized", + maximized = "maximized", + fullscreen = "fullscreen", + docked = "docked" + } + + interface Window { + id?: number; + focused: boolean; + top?: number; + left?: number; + width?: number; + height?: number; + tabs?: tabs.Tab[]; + incognito: boolean; + type?: WindowType; + state?: WindowState; + alwaysOnTop: boolean; + sessionId?: string; + title?: string; + } + + enum CreateType { + normal = "normal", + popup = "popup", + panel = "panel", + detached_panel = "detached_panel" + } + + /* windows properties */ + const WINDOW_ID_NONE: number; + + const WINDOW_ID_CURRENT: number; + + /* windows functions */ + function get(windowId: number, getInfo?: { + populate?: boolean; + windowTypes?: WindowType[]; + }): Promise; + + function getCurrent(getInfo?: { + populate?: boolean; + windowTypes?: WindowType[]; + }): Promise; + + function getLastFocused(getInfo?: { + populate?: boolean; + windowTypes?: WindowType[]; + }): Promise; + + function getAll(getInfo?: { + populate?: boolean; + windowTypes?: WindowType[]; + }): Promise; + + function create(createData?: { + url?: string | string[]; + tabId?: number; + left?: number; + top?: number; + width?: number; + height?: number; + focused?: boolean; + incognito?: boolean; + type?: CreateType; + state?: WindowState; + allowScriptsToClose?: boolean; + titlePreface?: string; + }): Promise; + + function update(windowId: number, updateInfo: { + left?: number; + top?: number; + width?: number; + height?: number; + focused?: boolean; + drawAttention?: boolean; + state?: WindowState; + titlePreface?: string; + }): Promise; + + function remove(windowId: number): Promise; + + /* windows events */ + const onCreated: EventListener<(window: Window) => void>; + + const onRemoved: EventListener<(windowId: number) => void>; + + const onFocusChanged: EventListener<(windowId: number) => void>; +} diff --git a/types/firefox-webext-browser/tsconfig.json b/types/firefox-webext-browser/tsconfig.json new file mode 100644 index 0000000000..316317e305 --- /dev/null +++ b/types/firefox-webext-browser/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "firefox-webext-browser-tests.ts" + ] +} diff --git a/types/firefox-webext-browser/tslint.json b/types/firefox-webext-browser/tslint.json new file mode 100644 index 0000000000..c94feb08d9 --- /dev/null +++ b/types/firefox-webext-browser/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-mergeable-namespace": false, + "unified-signatures": false, + "no-unnecessary-qualifier": false + } +} From c4df40988192332549420d7d700179873cec5ab4 Mon Sep 17 00:00:00 2001 From: Rodrigo Saboya Date: Sun, 26 Nov 2017 17:21:45 -0200 Subject: [PATCH 069/322] Updating definitions for Nes>=7.0.0. --- types/nes/client.d.ts | 17 ++-- types/nes/index.d.ts | 19 ++-- types/nes/test/broadcast-client.ts | 4 +- types/nes/test/broadcast-server.ts | 5 +- types/nes/test/nes-tests.ts | 99 +++++++++---------- types/nes/test/route-authentication-client.ts | 14 +-- types/nes/test/route-authentication-server.ts | 20 ++-- types/nes/test/route-invocation-client.ts | 14 +-- types/nes/test/route-invocation-server.ts | 9 +- types/nes/test/socket.ts | 10 +- types/nes/test/subscription-filter-client.ts | 12 +-- types/nes/test/subscription-filter-server.ts | 21 ++-- types/nes/test/subscriptions-client.ts | 12 +-- types/nes/test/subscriptions-server.ts | 11 +-- 14 files changed, 120 insertions(+), 147 deletions(-) diff --git a/types/nes/client.d.ts b/types/nes/client.d.ts index 8314894683..5d348b267e 100644 --- a/types/nes/client.d.ts +++ b/types/nes/client.d.ts @@ -1,6 +1,7 @@ -// Type definitions for nes 6.4.2 +// Type definitions for nes 7.0.0 // Project: https://github.com/hapijs/nes // Definitions by: Ivo Stratev +// Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class Client { @@ -9,14 +10,14 @@ declare class Client { onConnect: () => void; onDisconnect: () => void; onUpdate: (message: any) => void; - connect(options: Client.ClientConnectOptions, callback: (err?: any) => void): void; - connect(callback: (err?: any) => void): void; - disconnect(): void; + connect(options: Client.ClientConnectOptions): Promise; + connect(): Promise; + disconnect(): Promise; id: any; // can be `null | number` but also the "socket" value from websocket message data. - request(options: string | Client.ClientRequestOptions, callback: (err: any, payload: any, statusCode?: number, headers?: Object) => void): void; - message(message: any, callback: (err: any, message: any) => void): void; - subscribe(path: string, handler: Client.Handler, callback: (err?: any) => void): void; - unsubscribe(path: string, handler: Client.Handler, callback: (err?: any) => void): void; + request(options: string | Client.ClientRequestOptions): Promise; + message(message: any): Promise; + subscribe(path: string, handler: Client.Handler): Promise; + unsubscribe(path: string, handler: Client.Handler): Promise; subscriptions(): string[]; overrideReconnectionAuth(auth: any): void; } diff --git a/types/nes/index.d.ts b/types/nes/index.d.ts index a6ed90a7b7..c4d26ecda0 100644 --- a/types/nes/index.d.ts +++ b/types/nes/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for nes 6.2.1 +// Type definitions for nes 7.0.0 // Project: https://github.com/hapijs/nes // Definitions by: Ivo Stratev +// Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -62,12 +63,12 @@ declare module nes { index?: boolean; } - export type ServerOnSubscribeWithParams = (socket: Socket, path: string, params: any, next: (err?: any) => void) => void; - export type ServerOnSubscribeWithoutParams = (socket: Socket, path: string, next: (err?: any) => void) => void; + export type ServerOnSubscribeWithParams = (socket: Socket, path: string, params: any) => Promise; + export type ServerOnSubscribeWithoutParams = (socket: Socket, path: string) => Promise; export type ServerOnSubscribe = ServerOnSubscribeWithParams | ServerOnSubscribeWithoutParams; - export type ServerOnUnSubscribeWithParams = (socket: Socket, path: string, params: any, next: () => void) => void; - export type ServerOnUnSubscribeWithoutParams = (socket: Socket, path: string, next: () => void) => void; + export type ServerOnUnSubscribeWithParams = (socket: Socket, path: string, params: any) => void; + export type ServerOnUnSubscribeWithoutParams = (socket: Socket, path: string) => void; export type ServerOnUnSubscribe = ServerOnUnSubscribeWithParams | ServerOnUnSubscribeWithoutParams; interface ServerSubscriptionOptions { @@ -91,10 +92,10 @@ declare module nes { id: string; app: Object; auth: nes.SocketAuthObject; - disconnect(callback?: () => void): void; - send(message: any, callback?: (err?: any) => void): void; - publish(path: string, message: any, callback?: (err?: any) => void): void; - revoke(path: string, message: any, callback?: (err?: any) => void): void; + disconnect(): Promise; + send(message: any): Promise; + publish(path: string, message: any): Promise; + revoke(path: string, message: any): Promise; } /** diff --git a/types/nes/test/broadcast-client.ts b/types/nes/test/broadcast-client.ts index 4c94b8c575..5563a202d3 100644 --- a/types/nes/test/broadcast-client.ts +++ b/types/nes/test/broadcast-client.ts @@ -3,7 +3,7 @@ import Nes = require('nes'); var client = new Nes.Client('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { client.onUpdate = function (update) { @@ -16,7 +16,7 @@ client.connect(function (err) { import NesClient = require('nes/client'); var client = new NesClient('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { client.onUpdate = function (update) { diff --git a/types/nes/test/broadcast-server.ts b/types/nes/test/broadcast-server.ts index dcfcb3400e..6ef8f7aafa 100644 --- a/types/nes/test/broadcast-server.ts +++ b/types/nes/test/broadcast-server.ts @@ -4,11 +4,10 @@ import Hapi = require('hapi'); import Nes = require('nes'); var server = new Hapi.Server(); -server.connection(); -server.register(Nes, function (err) { +server.register(Nes).then(() => { - server.start(function (err) { + return server.start().then(() => { server.broadcast('welcome!'); }); diff --git a/types/nes/test/nes-tests.ts b/types/nes/test/nes-tests.ts index 90afe68f3e..85cff1e208 100644 --- a/types/nes/test/nes-tests.ts +++ b/types/nes/test/nes-tests.ts @@ -2,66 +2,55 @@ import Hapi = require('hapi'); import Nes = require('nes'); var server: Hapi.Server = new Hapi.Server(); -server.connection({port: 8080}); -server.register(Nes, (regErr) => { - if(regErr) { - console.log('register err'); - console.log(regErr); - } else { - // No longer need to cast to Nes.Server as Hapi.Server has been modified directly. - // let wsServer: Nes.Server = server as Nes.Server; - let wsServer: Hapi.Server = server; - wsServer.subscription('/item/{id}'); - wsServer.route( { - method: 'GET', - path: '/test', - config: { - handler: (request, reply) => { - reply({test: 'passes ' + request.socket.id}); - } +server.register(Nes).then(() => { + // No longer need to cast to Nes.Server as Hapi.Server has been modified directly. + // let wsServer: Nes.Server = server as Nes.Server; + let wsServer: Hapi.Server = server; + wsServer.subscription('/item/{id}'); + wsServer.route( { + method: 'GET', + path: '/test', + config: { + handler: (request, h) => { + return {test: 'passes ' + request.socket.id}; } - }); - wsServer.start((err: any) => { - if(err) { - console.log('start err'); - console.log(err); - } else { - setTimeout(() => { - wsServer.publish('/item/5', { id: 5, status: 'complete' }); - wsServer.publish('/item/6', { id: 6, status: 'initial' }); - }, 100); - } - }); - } + } + }); + wsServer.start().then(() => { + setTimeout(() => { + wsServer.publish('/item/5', { id: 5, status: 'complete' }); + wsServer.publish('/item/6', { id: 6, status: 'initial' }); + }, 100); + }).catch((err) => { + console.log('start err'); + console.log(err); + }); +}).catch((regErr: any) => { + console.log('register err'); + console.log(regErr); }); let options: Nes.ClientConnectOptions = {delay: 3}; -let wsClient: Nes.Client = new Nes.Client('ws://localhost:8080', options); -wsClient.connect((err: any) => { - if(err) { - console.log('start err'); - console.log(err); - } else { - wsClient.subscribe('/item/5', (update) => { - wsClient.request('/test', (reqErr, payload, statusCode) => { - if(reqErr) { - console.log('request err'); - console.log(reqErr); - } else { - console.log(update); - console.log(payload); - if(payload.test === 'passes') { - process.exit(0); - } - } - }) - }, (subErr) => { - if(subErr) { - console.log('subscribe err'); - console.log(subErr); +let wsClient: Nes.Client = new Nes.Client('ws://localhost', options); +wsClient.connect().then(() => { + wsClient.subscribe('/item/5', (update) => { + wsClient.request('/test').then(({ payload, statusCode }) => { + console.log(update); + console.log(payload); + if(payload.test === 'passes') { + process.exit(0); } - }); - } + }).catch((reqErr: any) => { + console.log('request err'); + console.log(reqErr); + }) + }).catch((subErr: any) => { + console.log('subscribe err'); + console.log(subErr); + }); +}).catch((err: any) => { + console.log('start err'); + console.log(err); }); diff --git a/types/nes/test/route-authentication-client.ts b/types/nes/test/route-authentication-client.ts index fe57eb8d56..f1eb8b9659 100644 --- a/types/nes/test/route-authentication-client.ts +++ b/types/nes/test/route-authentication-client.ts @@ -3,12 +3,9 @@ import Nes = require('nes'); var client = new Nes.Client('ws://localhost'); -client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }, function (err) { +client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }).then(() => { - client.request('hello', function (err, payload) { // Can also request '/h' - - // payload -> 'Hello John Doe' - }); + client.request('hello'); }); // Added in addition to nes doc example code @@ -16,10 +13,7 @@ client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } import NesClient = require('nes/client'); var client = new NesClient('ws://localhost'); -client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }, function (err) { +client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }).then(() => { - client.request('hello', function (err, payload) { // Can also request '/h' - - // payload -> 'Hello John Doe' - }); + return client.request('hello'); }); diff --git a/types/nes/test/route-authentication-server.ts b/types/nes/test/route-authentication-server.ts index 5b4634d77d..2080f04ef4 100644 --- a/types/nes/test/route-authentication-server.ts +++ b/types/nes/test/route-authentication-server.ts @@ -8,7 +8,7 @@ import Nes = require('nes'); var server = new Hapi.Server(); server.connection(); -server.register([Basic, Nes], function (err) { +server.register([Basic, Nes]).then(() => { // Set up HTTP Basic authentication @@ -28,20 +28,20 @@ server.register([Basic, Nes], function (err) { } }; - var validate: Basic.ValidateFunc = function (request, username, password, callback) { + var validate: Basic.Validate = async (request, username, password, h) => { var user = users[username]; if (!user) { - return callback(null, false); + return { credentials: null, isValid: false }; } - Bcrypt.compare(password, user.password, function (err, isValid) { + let isValid = await Bcrypt.compare(password, user.password) - callback(err, isValid, { id: user.id, name: user.name }); - }); + return { isValid, credentials: { id: user.id, name: user.name } }; }; - server.auth.strategy('simple', 'basic', 'required', { validateFunc: validate }); + server.auth.strategy('simple', 'basic', { validateFunc: validate }); + server.auth.default('simple'); // Configure route with authentication @@ -50,12 +50,12 @@ server.register([Basic, Nes], function (err) { path: '/h', config: { id: 'hello', - handler: function (request, reply) { + handler: function (request, h) { - return reply('Hello ' + request.auth.credentials.name); + return 'Hello ' + request.auth.credentials.name; } } }); - server.start(function (err) { /* ... */ }); + return server.start(); }); diff --git a/types/nes/test/route-invocation-client.ts b/types/nes/test/route-invocation-client.ts index 7b144e3a9c..34c40fe151 100644 --- a/types/nes/test/route-invocation-client.ts +++ b/types/nes/test/route-invocation-client.ts @@ -3,12 +3,9 @@ import Nes = require('nes'); var client = new Nes.Client('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { - client.request('hello', function (err, payload) { // Can also request '/h' - - // payload -> 'world!' - }); + return client.request('hello'); }); // Added in addition to nes doc example code @@ -16,10 +13,7 @@ client.connect(function (err) { import NesClient = require('nes/client'); var client = new NesClient('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { - client.request('hello', function (err, payload) { // Can also request '/h' - - // payload -> 'world!' - }); + return client.request('hello'); }); diff --git a/types/nes/test/route-invocation-server.ts b/types/nes/test/route-invocation-server.ts index c32780baa9..d6893495c9 100644 --- a/types/nes/test/route-invocation-server.ts +++ b/types/nes/test/route-invocation-server.ts @@ -4,21 +4,20 @@ import Hapi = require('hapi'); import Nes = require('nes'); var server = new Hapi.Server(); -server.connection(); -server.register(Nes, function (err) { +server.register(Nes).then(() => { server.route({ method: 'GET', path: '/h', config: { id: 'hello', - handler: function (request, reply) { + handler: (request, h) => { - return reply('world!'); + return 'world!'; } } }); - server.start(function (err) { /* ... */ }); + return server.start(); }); diff --git a/types/nes/test/socket.ts b/types/nes/test/socket.ts index 7f7617d462..029dbb1d2f 100644 --- a/types/nes/test/socket.ts +++ b/types/nes/test/socket.ts @@ -4,13 +4,11 @@ import Nes = require('nes'); const socket: Nes.Socket = undefined; -const cb = () => { }; -socket.disconnect(cb); +socket.disconnect(); const s: string = socket.id; const o: Object = socket.app; const auth: Nes.SocketAuthObject = socket.auth; -const cb2 = (err?: any) => { }; -socket.send('message', (err?: any) => { }); -socket.publish('path', 'message', cb2); -socket.revoke('path', 'message', cb2); +socket.send('message'); +socket.publish('path', 'message'); +socket.revoke('path', 'message'); diff --git a/types/nes/test/subscription-filter-client.ts b/types/nes/test/subscription-filter-client.ts index 3f8d3ffb8b..05253539a4 100644 --- a/types/nes/test/subscription-filter-client.ts +++ b/types/nes/test/subscription-filter-client.ts @@ -6,15 +6,15 @@ var client = new Nes.Client('ws://localhost'); // Authenticate as 'john' -client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }, function (err) { +client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }).then(() => { - var handler: Nes.Handler = function (err, update) { + var handler: Nes.Handler = (update) => { // First publish is not received (filtered due to updater key) // update -> { id: 6, status: 'initial', updater: 'steve' } }; - client.subscribe('/items', handler, function (err) { }); + return client.subscribe('/items', handler); }); // Added in addition to nes doc example code @@ -25,13 +25,13 @@ var client = new NesClient('ws://localhost'); // Authenticate as 'john' -client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }, function (err) { +client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }).then(() => { - var handler: NesClient.Handler = function (err, update) { + var handler: NesClient.Handler = (update) => { // First publish is not received (filtered due to updater key) // update -> { id: 6, status: 'initial', updater: 'steve' } }; - client.subscribe('/items', handler, function (err) { }); + return client.subscribe('/items', handler); }); diff --git a/types/nes/test/subscription-filter-server.ts b/types/nes/test/subscription-filter-server.ts index be2dda8d7f..7a63abf151 100644 --- a/types/nes/test/subscription-filter-server.ts +++ b/types/nes/test/subscription-filter-server.ts @@ -6,9 +6,8 @@ import Bcrypt = require('bcrypt'); import Nes = require('nes'); var server = new Hapi.Server(); -server.connection(); -server.register([Basic, Nes], function (err) { +server.register([Basic, Nes]).then(() => { // Set up HTTP Basic authentication @@ -28,31 +27,31 @@ server.register([Basic, Nes], function (err) { } }; - var validate: Basic.ValidateFunc = function (request, username, password, callback) { + var validate: Basic.Validate = async (request, username, password, h) => { var user = users[username]; if (!user) { - return callback(null, false); + return { credentials: null, isValid: false }; } - Bcrypt.compare(password, user.password, function (err, isValid) { + let isValid = await Bcrypt.compare(password, user.password) - callback(err, isValid, { id: user.id, name: user.name, username: user.username }); - }); + return { isValid, credentials: { id: user.id, name: user.name, username: user.username } }; }; - server.auth.strategy('simple', 'basic', 'required', { validateFunc: validate }); + server.auth.strategy('simple', 'basic', { validate }); + server.auth.default('simple') // Set up subscription server.subscription('/items', { - filter: function (path, message, options, next) { + filter: (path, message, options) => { - return next(message.updater !== options.credentials.username); + return message.updater !== options.credentials.username; } }); - server.start(function (err) { + server.start().then(() => { server.publish('/items', { id: 5, status: 'complete', updater: 'john' }); server.publish('/items', { id: 6, status: 'initial', updater: 'steve' }); diff --git a/types/nes/test/subscriptions-client.ts b/types/nes/test/subscriptions-client.ts index a9ac55fc6d..9f6150f90c 100644 --- a/types/nes/test/subscriptions-client.ts +++ b/types/nes/test/subscriptions-client.ts @@ -3,15 +3,15 @@ import Nes = require('nes'); var client = new Nes.Client('ws://localhost'); -client.connect(function (err) { + client.connect().then(() => {; - var handler: Nes.Handler = function (update, flags) { + var handler: Nes.Handler = (update, flags) => { // update -> { id: 5, status: 'complete' } // Second publish is not received (doesn't match) }; - client.subscribe('/item/5', handler, function (err) { }); + return client.subscribe('/item/5', handler); }); // Added in addition to nes doc example code @@ -19,13 +19,13 @@ client.connect(function (err) { import NesClient = require('nes/client'); var client = new NesClient('ws://localhost'); -client.connect(function (err) { +client.connect().then(() => { - var handler: NesClient.Handler = function (update, flags) { + var handler: NesClient.Handler = (update, flags) => { // update -> { id: 5, status: 'complete' } // Second publish is not received (doesn't match) }; - client.subscribe('/item/5', handler, function (err) { }); + return client.subscribe('/item/5', handler); }); diff --git a/types/nes/test/subscriptions-server.ts b/types/nes/test/subscriptions-server.ts index 23212f21ea..1280f2afd1 100644 --- a/types/nes/test/subscriptions-server.ts +++ b/types/nes/test/subscriptions-server.ts @@ -4,15 +4,14 @@ import Hapi = require('hapi'); import Nes = require('nes'); var server = new Hapi.Server(); -server.connection(); -server.register(Nes, function (err) { +server.register(Nes).then(() =>{; server.subscription('/item/{id}'); - server.start(function (err) { + return server.start().then(() => { - server.publish('/item/5', { id: 5, status: 'complete' }); - server.publish('/item/6', { id: 6, status: 'initial' }); + server.publish('/item/5', {id: 5, status: 'complete'}); + server.publish('/item/6', {id: 6, status: 'initial'}); }); -}); +}) From e8e3c6a23bdff84aa488a3e0d1ca30a45267c137 Mon Sep 17 00:00:00 2001 From: Rodrigo Saboya Date: Sun, 26 Nov 2017 22:25:04 -0200 Subject: [PATCH 070/322] Updating type definitions for hapi-auth-basic >= 5.0.0. --- types/hapi-auth-basic/hapi-auth-basic-tests.ts | 15 ++++++++------- types/hapi-auth-basic/index.d.ts | 16 +++++++++++----- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/types/hapi-auth-basic/hapi-auth-basic-tests.ts b/types/hapi-auth-basic/hapi-auth-basic-tests.ts index 7f78fe9f65..1a7192af6f 100644 --- a/types/hapi-auth-basic/hapi-auth-basic-tests.ts +++ b/types/hapi-auth-basic/hapi-auth-basic-tests.ts @@ -22,21 +22,22 @@ const users: {[index: string]: User} = { } }; -const validate: Basic.ValidateFunc = function (request, username, password, callback) { +const validate: Basic.Validate = async (request, username, password, h) => { const user = users[username]; if (!user) { - return callback(null, false); + return { isValid: false, credentials: null }; } - Bcrypt.compare(password, user.password, (err, isValid) => { + let isValid = await Bcrypt.compare(password, user.password) - callback(err, isValid, { id: user.id, name: user.name }); - }); + return { isValid, credentials: { id: user.id, name: user.name } }; }; -server.register(Basic, (err) => { +server.register(Basic).then(() => { + + server.auth.strategy('simple', 'basic', { validate }); + server.auth.default('simple'); - server.auth.strategy('simple', 'basic', { validateFunc: validate }); server.route({ method: 'GET', path: '/', config: { auth: 'simple' } }); }); diff --git a/types/hapi-auth-basic/index.d.ts b/types/hapi-auth-basic/index.d.ts index 54d463c2b3..ddf05c348a 100644 --- a/types/hapi-auth-basic/index.d.ts +++ b/types/hapi-auth-basic/index.d.ts @@ -1,18 +1,24 @@ -// Type definitions for hapi 4.2 +// Type definitions for hapi-bauth-basic 5.0.0 // Project: https://github.com/hapijs/hapi-auth-basic // Definitions by: AJP +// Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 import * as Hapi from 'hapi'; declare namespace Basic { - interface ValidateFuncCallback { - (err: Error | null, isValid: boolean, userCredentials?: any): void; + interface ValidateCustomResponse { + response: any, } - interface ValidateFunc { - (request: Hapi.Request, username: string, password: string, callback: ValidateFuncCallback): void; + interface ValidateResponse { + isValid: boolean, + credentials?: any, + } + + interface Validate { + (request: Hapi.Request, username: string, password: string, h: object): Promise; } } From b0a69006ffae6cebe827913432d9b6ac9f5c691c Mon Sep 17 00:00:00 2001 From: Rico Kahler Date: Sun, 26 Nov 2017 20:14:20 -0500 Subject: [PATCH 071/322] Change `SketchDocument.currentPage` to a getter --- types/react-sketchapp/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-sketchapp/index.d.ts b/types/react-sketchapp/index.d.ts index f340e19232..ee7ad6de8d 100644 --- a/types/react-sketchapp/index.d.ts +++ b/types/react-sketchapp/index.d.ts @@ -31,7 +31,7 @@ export interface SketchDocument { documentData: () => SketchDocumentData; pages: () => SketchPage[]; addBlankPage: () => SketchPage; - currentPage: SketchPage; + currentPage: () => SketchPage; } export interface SketchContext { document: SketchDocument; } From a59ba0346c29f218506830163f250870ae84a1a9 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Sun, 26 Nov 2017 22:25:40 -0300 Subject: [PATCH 072/322] export http2 constants in standard way --- types/node/index.d.ts | 420 +++++++++++++++++++++--------------------- 1 file changed, 210 insertions(+), 210 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 0052b8256e..9707cafa78 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6704,216 +6704,216 @@ declare module "http2" { // Public API - export const constants: { - NGHTTP2_SESSION_SERVER: number; - NGHTTP2_SESSION_CLIENT: number; - NGHTTP2_STREAM_STATE_IDLE: number; - NGHTTP2_STREAM_STATE_OPEN: number; - NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; - NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; - NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; - NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; - NGHTTP2_STREAM_STATE_CLOSED: number; - NGHTTP2_NO_ERROR: number; - NGHTTP2_PROTOCOL_ERROR: number; - NGHTTP2_INTERNAL_ERROR: number; - NGHTTP2_FLOW_CONTROL_ERROR: number; - NGHTTP2_SETTINGS_TIMEOUT: number; - NGHTTP2_STREAM_CLOSED: number; - NGHTTP2_FRAME_SIZE_ERROR: number; - NGHTTP2_REFUSED_STREAM: number; - NGHTTP2_CANCEL: number; - NGHTTP2_COMPRESSION_ERROR: number; - NGHTTP2_CONNECT_ERROR: number; - NGHTTP2_ENHANCE_YOUR_CALM: number; - NGHTTP2_INADEQUATE_SECURITY: number; - NGHTTP2_HTTP_1_1_REQUIRED: number; - NGHTTP2_ERR_FRAME_SIZE_ERROR: number; - NGHTTP2_FLAG_NONE: number; - NGHTTP2_FLAG_END_STREAM: number; - NGHTTP2_FLAG_END_HEADERS: number; - NGHTTP2_FLAG_ACK: number; - NGHTTP2_FLAG_PADDED: number; - NGHTTP2_FLAG_PRIORITY: number; - DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; - DEFAULT_SETTINGS_ENABLE_PUSH: number; - DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; - DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; - MAX_MAX_FRAME_SIZE: number; - MIN_MAX_FRAME_SIZE: number; - MAX_INITIAL_WINDOW_SIZE: number; - NGHTTP2_DEFAULT_WEIGHT: number; - NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; - NGHTTP2_SETTINGS_ENABLE_PUSH: number; - NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; - NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; - NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; - NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; - PADDING_STRATEGY_NONE: number; - PADDING_STRATEGY_MAX: number; - PADDING_STRATEGY_CALLBACK: number; - HTTP2_HEADER_STATUS: string; - HTTP2_HEADER_METHOD: string; - HTTP2_HEADER_AUTHORITY: string; - HTTP2_HEADER_SCHEME: string; - HTTP2_HEADER_PATH: string; - HTTP2_HEADER_ACCEPT_CHARSET: string; - HTTP2_HEADER_ACCEPT_ENCODING: string; - HTTP2_HEADER_ACCEPT_LANGUAGE: string; - HTTP2_HEADER_ACCEPT_RANGES: string; - HTTP2_HEADER_ACCEPT: string; - HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; - HTTP2_HEADER_AGE: string; - HTTP2_HEADER_ALLOW: string; - HTTP2_HEADER_AUTHORIZATION: string; - HTTP2_HEADER_CACHE_CONTROL: string; - HTTP2_HEADER_CONNECTION: string; - HTTP2_HEADER_CONTENT_DISPOSITION: string; - HTTP2_HEADER_CONTENT_ENCODING: string; - HTTP2_HEADER_CONTENT_LANGUAGE: string; - HTTP2_HEADER_CONTENT_LENGTH: string; - HTTP2_HEADER_CONTENT_LOCATION: string; - HTTP2_HEADER_CONTENT_MD5: string; - HTTP2_HEADER_CONTENT_RANGE: string; - HTTP2_HEADER_CONTENT_TYPE: string; - HTTP2_HEADER_COOKIE: string; - HTTP2_HEADER_DATE: string; - HTTP2_HEADER_ETAG: string; - HTTP2_HEADER_EXPECT: string; - HTTP2_HEADER_EXPIRES: string; - HTTP2_HEADER_FROM: string; - HTTP2_HEADER_HOST: string; - HTTP2_HEADER_IF_MATCH: string; - HTTP2_HEADER_IF_MODIFIED_SINCE: string; - HTTP2_HEADER_IF_NONE_MATCH: string; - HTTP2_HEADER_IF_RANGE: string; - HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; - HTTP2_HEADER_LAST_MODIFIED: string; - HTTP2_HEADER_LINK: string; - HTTP2_HEADER_LOCATION: string; - HTTP2_HEADER_MAX_FORWARDS: string; - HTTP2_HEADER_PREFER: string; - HTTP2_HEADER_PROXY_AUTHENTICATE: string; - HTTP2_HEADER_PROXY_AUTHORIZATION: string; - HTTP2_HEADER_RANGE: string; - HTTP2_HEADER_REFERER: string; - HTTP2_HEADER_REFRESH: string; - HTTP2_HEADER_RETRY_AFTER: string; - HTTP2_HEADER_SERVER: string; - HTTP2_HEADER_SET_COOKIE: string; - HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; - HTTP2_HEADER_TRANSFER_ENCODING: string; - HTTP2_HEADER_TE: string; - HTTP2_HEADER_UPGRADE: string; - HTTP2_HEADER_USER_AGENT: string; - HTTP2_HEADER_VARY: string; - HTTP2_HEADER_VIA: string; - HTTP2_HEADER_WWW_AUTHENTICATE: string; - HTTP2_HEADER_HTTP2_SETTINGS: string; - HTTP2_HEADER_KEEP_ALIVE: string; - HTTP2_HEADER_PROXY_CONNECTION: string; - HTTP2_METHOD_ACL: string; - HTTP2_METHOD_BASELINE_CONTROL: string; - HTTP2_METHOD_BIND: string; - HTTP2_METHOD_CHECKIN: string; - HTTP2_METHOD_CHECKOUT: string; - HTTP2_METHOD_CONNECT: string; - HTTP2_METHOD_COPY: string; - HTTP2_METHOD_DELETE: string; - HTTP2_METHOD_GET: string; - HTTP2_METHOD_HEAD: string; - HTTP2_METHOD_LABEL: string; - HTTP2_METHOD_LINK: string; - HTTP2_METHOD_LOCK: string; - HTTP2_METHOD_MERGE: string; - HTTP2_METHOD_MKACTIVITY: string; - HTTP2_METHOD_MKCALENDAR: string; - HTTP2_METHOD_MKCOL: string; - HTTP2_METHOD_MKREDIRECTREF: string; - HTTP2_METHOD_MKWORKSPACE: string; - HTTP2_METHOD_MOVE: string; - HTTP2_METHOD_OPTIONS: string; - HTTP2_METHOD_ORDERPATCH: string; - HTTP2_METHOD_PATCH: string; - HTTP2_METHOD_POST: string; - HTTP2_METHOD_PRI: string; - HTTP2_METHOD_PROPFIND: string; - HTTP2_METHOD_PROPPATCH: string; - HTTP2_METHOD_PUT: string; - HTTP2_METHOD_REBIND: string; - HTTP2_METHOD_REPORT: string; - HTTP2_METHOD_SEARCH: string; - HTTP2_METHOD_TRACE: string; - HTTP2_METHOD_UNBIND: string; - HTTP2_METHOD_UNCHECKOUT: string; - HTTP2_METHOD_UNLINK: string; - HTTP2_METHOD_UNLOCK: string; - HTTP2_METHOD_UPDATE: string; - HTTP2_METHOD_UPDATEREDIRECTREF: string; - HTTP2_METHOD_VERSION_CONTROL: string; - HTTP_STATUS_CONTINUE: number; - HTTP_STATUS_SWITCHING_PROTOCOLS: number; - HTTP_STATUS_PROCESSING: number; - HTTP_STATUS_OK: number; - HTTP_STATUS_CREATED: number; - HTTP_STATUS_ACCEPTED: number; - HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; - HTTP_STATUS_NO_CONTENT: number; - HTTP_STATUS_RESET_CONTENT: number; - HTTP_STATUS_PARTIAL_CONTENT: number; - HTTP_STATUS_MULTI_STATUS: number; - HTTP_STATUS_ALREADY_REPORTED: number; - HTTP_STATUS_IM_USED: number; - HTTP_STATUS_MULTIPLE_CHOICES: number; - HTTP_STATUS_MOVED_PERMANENTLY: number; - HTTP_STATUS_FOUND: number; - HTTP_STATUS_SEE_OTHER: number; - HTTP_STATUS_NOT_MODIFIED: number; - HTTP_STATUS_USE_PROXY: number; - HTTP_STATUS_TEMPORARY_REDIRECT: number; - HTTP_STATUS_PERMANENT_REDIRECT: number; - HTTP_STATUS_BAD_REQUEST: number; - HTTP_STATUS_UNAUTHORIZED: number; - HTTP_STATUS_PAYMENT_REQUIRED: number; - HTTP_STATUS_FORBIDDEN: number; - HTTP_STATUS_NOT_FOUND: number; - HTTP_STATUS_METHOD_NOT_ALLOWED: number; - HTTP_STATUS_NOT_ACCEPTABLE: number; - HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; - HTTP_STATUS_REQUEST_TIMEOUT: number; - HTTP_STATUS_CONFLICT: number; - HTTP_STATUS_GONE: number; - HTTP_STATUS_LENGTH_REQUIRED: number; - HTTP_STATUS_PRECONDITION_FAILED: number; - HTTP_STATUS_PAYLOAD_TOO_LARGE: number; - HTTP_STATUS_URI_TOO_LONG: number; - HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; - HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; - HTTP_STATUS_EXPECTATION_FAILED: number; - HTTP_STATUS_TEAPOT: number; - HTTP_STATUS_MISDIRECTED_REQUEST: number; - HTTP_STATUS_UNPROCESSABLE_ENTITY: number; - HTTP_STATUS_LOCKED: number; - HTTP_STATUS_FAILED_DEPENDENCY: number; - HTTP_STATUS_UNORDERED_COLLECTION: number; - HTTP_STATUS_UPGRADE_REQUIRED: number; - HTTP_STATUS_PRECONDITION_REQUIRED: number; - HTTP_STATUS_TOO_MANY_REQUESTS: number; - HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; - HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; - HTTP_STATUS_INTERNAL_SERVER_ERROR: number; - HTTP_STATUS_NOT_IMPLEMENTED: number; - HTTP_STATUS_BAD_GATEWAY: number; - HTTP_STATUS_SERVICE_UNAVAILABLE: number; - HTTP_STATUS_GATEWAY_TIMEOUT: number; - HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; - HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; - HTTP_STATUS_INSUFFICIENT_STORAGE: number; - HTTP_STATUS_LOOP_DETECTED: number; - HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; - HTTP_STATUS_NOT_EXTENDED: number; - HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; - }; + export namespace constants { + export const NGHTTP2_SESSION_SERVER: number; + export const NGHTTP2_SESSION_CLIENT: number; + export const NGHTTP2_STREAM_STATE_IDLE: number; + export const NGHTTP2_STREAM_STATE_OPEN: number; + export const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; + export const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; + export const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; + export const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; + export const NGHTTP2_STREAM_STATE_CLOSED: number; + export const NGHTTP2_NO_ERROR: number; + export const NGHTTP2_PROTOCOL_ERROR: number; + export const NGHTTP2_INTERNAL_ERROR: number; + export const NGHTTP2_FLOW_CONTROL_ERROR: number; + export const NGHTTP2_SETTINGS_TIMEOUT: number; + export const NGHTTP2_STREAM_CLOSED: number; + export const NGHTTP2_FRAME_SIZE_ERROR: number; + export const NGHTTP2_REFUSED_STREAM: number; + export const NGHTTP2_CANCEL: number; + export const NGHTTP2_COMPRESSION_ERROR: number; + export const NGHTTP2_CONNECT_ERROR: number; + export const NGHTTP2_ENHANCE_YOUR_CALM: number; + export const NGHTTP2_INADEQUATE_SECURITY: number; + export const NGHTTP2_HTTP_1_1_REQUIRED: number; + export const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; + export const NGHTTP2_FLAG_NONE: number; + export const NGHTTP2_FLAG_END_STREAM: number; + export const NGHTTP2_FLAG_END_HEADERS: number; + export const NGHTTP2_FLAG_ACK: number; + export const NGHTTP2_FLAG_PADDED: number; + export const NGHTTP2_FLAG_PRIORITY: number; + export const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; + export const DEFAULT_SETTINGS_ENABLE_PUSH: number; + export const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; + export const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; + export const MAX_MAX_FRAME_SIZE: number; + export const MIN_MAX_FRAME_SIZE: number; + export const MAX_INITIAL_WINDOW_SIZE: number; + export const NGHTTP2_DEFAULT_WEIGHT: number; + export const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; + export const NGHTTP2_SETTINGS_ENABLE_PUSH: number; + export const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; + export const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; + export const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; + export const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; + export const PADDING_STRATEGY_NONE: number; + export const PADDING_STRATEGY_MAX: number; + export const PADDING_STRATEGY_CALLBACK: number; + export const HTTP2_HEADER_STATUS: string; + export const HTTP2_HEADER_METHOD: string; + export const HTTP2_HEADER_AUTHORITY: string; + export const HTTP2_HEADER_SCHEME: string; + export const HTTP2_HEADER_PATH: string; + export const HTTP2_HEADER_ACCEPT_CHARSET: string; + export const HTTP2_HEADER_ACCEPT_ENCODING: string; + export const HTTP2_HEADER_ACCEPT_LANGUAGE: string; + export const HTTP2_HEADER_ACCEPT_RANGES: string; + export const HTTP2_HEADER_ACCEPT: string; + export const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; + export const HTTP2_HEADER_AGE: string; + export const HTTP2_HEADER_ALLOW: string; + export const HTTP2_HEADER_AUTHORIZATION: string; + export const HTTP2_HEADER_CACHE_CONTROL: string; + export const HTTP2_HEADER_CONNECTION: string; + export const HTTP2_HEADER_CONTENT_DISPOSITION: string; + export const HTTP2_HEADER_CONTENT_ENCODING: string; + export const HTTP2_HEADER_CONTENT_LANGUAGE: string; + export const HTTP2_HEADER_CONTENT_LENGTH: string; + export const HTTP2_HEADER_CONTENT_LOCATION: string; + export const HTTP2_HEADER_CONTENT_MD5: string; + export const HTTP2_HEADER_CONTENT_RANGE: string; + export const HTTP2_HEADER_CONTENT_TYPE: string; + export const HTTP2_HEADER_COOKIE: string; + export const HTTP2_HEADER_DATE: string; + export const HTTP2_HEADER_ETAG: string; + export const HTTP2_HEADER_EXPECT: string; + export const HTTP2_HEADER_EXPIRES: string; + export const HTTP2_HEADER_FROM: string; + export const HTTP2_HEADER_HOST: string; + export const HTTP2_HEADER_IF_MATCH: string; + export const HTTP2_HEADER_IF_MODIFIED_SINCE: string; + export const HTTP2_HEADER_IF_NONE_MATCH: string; + export const HTTP2_HEADER_IF_RANGE: string; + export const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; + export const HTTP2_HEADER_LAST_MODIFIED: string; + export const HTTP2_HEADER_LINK: string; + export const HTTP2_HEADER_LOCATION: string; + export const HTTP2_HEADER_MAX_FORWARDS: string; + export const HTTP2_HEADER_PREFER: string; + export const HTTP2_HEADER_PROXY_AUTHENTICATE: string; + export const HTTP2_HEADER_PROXY_AUTHORIZATION: string; + export const HTTP2_HEADER_RANGE: string; + export const HTTP2_HEADER_REFERER: string; + export const HTTP2_HEADER_REFRESH: string; + export const HTTP2_HEADER_RETRY_AFTER: string; + export const HTTP2_HEADER_SERVER: string; + export const HTTP2_HEADER_SET_COOKIE: string; + export const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; + export const HTTP2_HEADER_TRANSFER_ENCODING: string; + export const HTTP2_HEADER_TE: string; + export const HTTP2_HEADER_UPGRADE: string; + export const HTTP2_HEADER_USER_AGENT: string; + export const HTTP2_HEADER_VARY: string; + export const HTTP2_HEADER_VIA: string; + export const HTTP2_HEADER_WWW_AUTHENTICATE: string; + export const HTTP2_HEADER_HTTP2_SETTINGS: string; + export const HTTP2_HEADER_KEEP_ALIVE: string; + export const HTTP2_HEADER_PROXY_CONNECTION: string; + export const HTTP2_METHOD_ACL: string; + export const HTTP2_METHOD_BASELINE_CONTROL: string; + export const HTTP2_METHOD_BIND: string; + export const HTTP2_METHOD_CHECKIN: string; + export const HTTP2_METHOD_CHECKOUT: string; + export const HTTP2_METHOD_CONNECT: string; + export const HTTP2_METHOD_COPY: string; + export const HTTP2_METHOD_DELETE: string; + export const HTTP2_METHOD_GET: string; + export const HTTP2_METHOD_HEAD: string; + export const HTTP2_METHOD_LABEL: string; + export const HTTP2_METHOD_LINK: string; + export const HTTP2_METHOD_LOCK: string; + export const HTTP2_METHOD_MERGE: string; + export const HTTP2_METHOD_MKACTIVITY: string; + export const HTTP2_METHOD_MKCALENDAR: string; + export const HTTP2_METHOD_MKCOL: string; + export const HTTP2_METHOD_MKREDIRECTREF: string; + export const HTTP2_METHOD_MKWORKSPACE: string; + export const HTTP2_METHOD_MOVE: string; + export const HTTP2_METHOD_OPTIONS: string; + export const HTTP2_METHOD_ORDERPATCH: string; + export const HTTP2_METHOD_PATCH: string; + export const HTTP2_METHOD_POST: string; + export const HTTP2_METHOD_PRI: string; + export const HTTP2_METHOD_PROPFIND: string; + export const HTTP2_METHOD_PROPPATCH: string; + export const HTTP2_METHOD_PUT: string; + export const HTTP2_METHOD_REBIND: string; + export const HTTP2_METHOD_REPORT: string; + export const HTTP2_METHOD_SEARCH: string; + export const HTTP2_METHOD_TRACE: string; + export const HTTP2_METHOD_UNBIND: string; + export const HTTP2_METHOD_UNCHECKOUT: string; + export const HTTP2_METHOD_UNLINK: string; + export const HTTP2_METHOD_UNLOCK: string; + export const HTTP2_METHOD_UPDATE: string; + export const HTTP2_METHOD_UPDATEREDIRECTREF: string; + export const HTTP2_METHOD_VERSION_CONTROL: string; + export const HTTP_STATUS_CONTINUE: number; + export const HTTP_STATUS_SWITCHING_PROTOCOLS: number; + export const HTTP_STATUS_PROCESSING: number; + export const HTTP_STATUS_OK: number; + export const HTTP_STATUS_CREATED: number; + export const HTTP_STATUS_ACCEPTED: number; + export const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; + export const HTTP_STATUS_NO_CONTENT: number; + export const HTTP_STATUS_RESET_CONTENT: number; + export const HTTP_STATUS_PARTIAL_CONTENT: number; + export const HTTP_STATUS_MULTI_STATUS: number; + export const HTTP_STATUS_ALREADY_REPORTED: number; + export const HTTP_STATUS_IM_USED: number; + export const HTTP_STATUS_MULTIPLE_CHOICES: number; + export const HTTP_STATUS_MOVED_PERMANENTLY: number; + export const HTTP_STATUS_FOUND: number; + export const HTTP_STATUS_SEE_OTHER: number; + export const HTTP_STATUS_NOT_MODIFIED: number; + export const HTTP_STATUS_USE_PROXY: number; + export const HTTP_STATUS_TEMPORARY_REDIRECT: number; + export const HTTP_STATUS_PERMANENT_REDIRECT: number; + export const HTTP_STATUS_BAD_REQUEST: number; + export const HTTP_STATUS_UNAUTHORIZED: number; + export const HTTP_STATUS_PAYMENT_REQUIRED: number; + export const HTTP_STATUS_FORBIDDEN: number; + export const HTTP_STATUS_NOT_FOUND: number; + export const HTTP_STATUS_METHOD_NOT_ALLOWED: number; + export const HTTP_STATUS_NOT_ACCEPTABLE: number; + export const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; + export const HTTP_STATUS_REQUEST_TIMEOUT: number; + export const HTTP_STATUS_CONFLICT: number; + export const HTTP_STATUS_GONE: number; + export const HTTP_STATUS_LENGTH_REQUIRED: number; + export const HTTP_STATUS_PRECONDITION_FAILED: number; + export const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; + export const HTTP_STATUS_URI_TOO_LONG: number; + export const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; + export const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; + export const HTTP_STATUS_EXPECTATION_FAILED: number; + export const HTTP_STATUS_TEAPOT: number; + export const HTTP_STATUS_MISDIRECTED_REQUEST: number; + export const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; + export const HTTP_STATUS_LOCKED: number; + export const HTTP_STATUS_FAILED_DEPENDENCY: number; + export const HTTP_STATUS_UNORDERED_COLLECTION: number; + export const HTTP_STATUS_UPGRADE_REQUIRED: number; + export const HTTP_STATUS_PRECONDITION_REQUIRED: number; + export const HTTP_STATUS_TOO_MANY_REQUESTS: number; + export const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; + export const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; + export const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; + export const HTTP_STATUS_NOT_IMPLEMENTED: number; + export const HTTP_STATUS_BAD_GATEWAY: number; + export const HTTP_STATUS_SERVICE_UNAVAILABLE: number; + export const HTTP_STATUS_GATEWAY_TIMEOUT: number; + export const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; + export const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; + export const HTTP_STATUS_INSUFFICIENT_STORAGE: number; + export const HTTP_STATUS_LOOP_DETECTED: number; + export const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; + export const HTTP_STATUS_NOT_EXTENDED: number; + export const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; + } export function getDefaultSettings(): Settings; export function getPackedSettings(settings: Settings): Settings; From 21390eeb9a0eebdf1cfb4ad7473af3a267b006ad Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 27 Nov 2017 11:15:52 +0900 Subject: [PATCH 073/322] data is not absolutely necessary. https://github.com/mde/ejs/blob/v2.5.7/test/ejs.js#L58 --- types/ejs/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index 9d1294e681..c395e54533 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -54,7 +54,7 @@ export function renderFile(path: string, data: Data, opts: Options, cb: Rende */ export function clearCache(): void; -export type TemplateFunction = (data: Data) => any; +export type TemplateFunction = (data?: Data) => string; export interface Options { /** Compiled functions are cached, requires `filename` */ cache?: boolean; From f29db221d658d323b9989638dacb12d8bab32592 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 27 Nov 2017 11:16:29 +0900 Subject: [PATCH 074/322] Add tests --- types/ejs/ejs-tests.ts | 47 +++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/types/ejs/ejs-tests.ts b/types/ejs/ejs-tests.ts index 89b0479529..a7b7b66944 100644 --- a/types/ejs/ejs-tests.ts +++ b/types/ejs/ejs-tests.ts @@ -1,15 +1,17 @@ +/// + import ejs = require("ejs"); +import { readFileSync as read } from 'fs'; import LRU = require("lru-cache"); -import { TemplateFunction } from "ejs"; +import { TemplateFunction, Options } from "ejs"; const fileName = 'test.ejs'; const people = ['geddy', 'neil', 'alex']; const data = { people }; const template = '<%= people.join(", "); %>'; -const options = {delimiter: '$'}; +const options = { filename: fileName }; let result: string; -let cacheResult: string; -let ejsFunction: ejs.TemplateFunction; +let ejsFunction: TemplateFunction; const SimpleCallback = (err: any, html?: string) => { if (err) { @@ -22,17 +24,38 @@ result = ejs.render(template); result = ejs.render(template, data); result = ejs.render(template, data, options); -cacheResult = ejs.renderFile(fileName, SimpleCallback); -cacheResult = ejs.renderFile(fileName, data, SimpleCallback); -cacheResult = ejs.renderFile(fileName, data, options, SimpleCallback); +result = ejs.renderFile(fileName, SimpleCallback); +result = ejs.renderFile(fileName, data, SimpleCallback); +result = ejs.renderFile(fileName, data, options, SimpleCallback); +ejsFunction = ejs.compile(''); +ejsFunction = ejs.compile(read(fileName, "utf8")); ejsFunction = ejs.compile(template); -ejsFunction({}); -ejsFunction(data); -ejs.compile(template, options); +ejsFunction = ejs.compile(template, options); +ejsFunction = ejs.compile(template, { cache: true, filename: fileName }); +ejsFunction = ejs.compile(template, { cache: true, filename: fileName, root: "./" }); +ejsFunction = ejs.compile(template, { context: { foo: 'FOO' } }); +ejsFunction = ejs.compile(template, { compileDebug: false }); +ejsFunction = ejs.compile(template, { client: true }); +ejsFunction = ejs.compile('<$= people.join(", "); $>', { delimiter: '$' }); +ejsFunction = ejs.compile('<%= locals.people.join(", "); %>', { _with: false }); +ejsFunction = ejs.compile('<%= locals.people.join(", "); %>', { strict: true }); +ejsFunction = ejs.compile('<%= it.people.join(", "); %>', { _with: false, localsName: "it" }); +ejsFunction = ejs.compile(template, { rmWhitespace: true }); +const customEscape = (str: string) => !str ? '' : str.toUpperCase(); +ejsFunction = ejs.compile(template, { escape: customEscape }); -ejs.fileLoader = (str: string) => str; +result = ejsFunction(); +result = ejsFunction({}); +result = ejsFunction(data); +/** @see https://github.com/mde/ejs/tree/v2.5.7#custom-fileloader */ +ejs.fileLoader = (path: string) => ""; + +/** @see https://github.com/mde/ejs/tree/v2.5.7#caching */ ejs.clearCache(); - ejs.cache = LRU(100); + +/** @see https://github.com/mde/ejs/tree/v2.5.7#custom-delimiters */ +ejs.delimiter = "%"; +delete ejs.delimiter; From a271488804f91c4eda641f2b6b1a7a2475d7d0dd Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 27 Nov 2017 11:22:27 +0900 Subject: [PATCH 075/322] version up --- types/ejs/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index c395e54533..e785f2c6ae 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -1,8 +1,8 @@ -// Type definitions for ejs.js 2.3 +// Type definitions for ejs.js 2.5 // Project: http://ejs.co/ // Definitions by: Ben Liddicott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.4 export interface Data { [name: string]: any; From ddf0d648dfb0a93bfeaf68134b925b9dc7cc4e08 Mon Sep 17 00:00:00 2001 From: Carlos Precioso Date: Mon, 27 Nov 2017 04:00:09 +0100 Subject: [PATCH 076/322] Fix klaw types klaw.Walker is an instance of Readable --- types/klaw/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/klaw/index.d.ts b/types/klaw/index.d.ts index 8134b728c0..c787179870 100644 --- a/types/klaw/index.d.ts +++ b/types/klaw/index.d.ts @@ -30,7 +30,7 @@ declare module "klaw" { type Event = "close" | "data" | "end" | "readable" | "error" - interface Walker { + interface Walker extends Readable { on(event: Event, listener: Function): this on(event: "close", listener: () => void): this on(event: "data", listener: (item: Item) => void): this From c74475e985a15b76ed063edf5bc8fb9677be2558 Mon Sep 17 00:00:00 2001 From: Carlos Precioso Date: Mon, 27 Nov 2017 04:07:19 +0100 Subject: [PATCH 077/322] Bump version number in klaw --- types/klaw/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/klaw/index.d.ts b/types/klaw/index.d.ts index c787179870..7b4e586842 100644 --- a/types/klaw/index.d.ts +++ b/types/klaw/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for klaw v2.1.0 +// Type definitions for klaw v2.1.1 // Project: https://github.com/jprichardson/node-klaw // Definitions by: Matthew McEachen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From b4e2d2c3daf1d2ee360d0a5dd6eb88f02ce2c377 Mon Sep 17 00:00:00 2001 From: Bradley Odell Date: Mon, 27 Nov 2017 01:15:37 -0800 Subject: [PATCH 078/322] Added types for wheel --- types/wheel/index.d.ts | 25 +++++++++++++++++++++++++ types/wheel/tsconfig.json | 19 +++++++++++++++++++ types/wheel/tslint.json | 6 ++++++ types/wheel/wheel-tests.ts | 8 ++++++++ 4 files changed, 58 insertions(+) create mode 100644 types/wheel/index.d.ts create mode 100644 types/wheel/tsconfig.json create mode 100644 types/wheel/tslint.json create mode 100644 types/wheel/wheel-tests.ts diff --git a/types/wheel/index.d.ts b/types/wheel/index.d.ts new file mode 100644 index 0000000000..c3c23f361f --- /dev/null +++ b/types/wheel/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for wheel 0.0.5 +// Project: https://github.com/anvaka/wheel +// Definitions by: Bradley Odell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Adds a callback to receive mouse wheel events from the given element. + */ +export default function addWheelListener(element: GlobalEventHandlers, + callback: (event: WheelEvent) => void, + useCapture?: boolean): void; + +/** + * Adds a callback to receive mouse wheel events from the given element. + */ +export function addWheelListener(element: GlobalEventHandlers, + callback: (event: WheelEvent) => void, + useCapture?: boolean): void; + +/** + * Removes a previously added wheel listener callback. + */ +export function removeWheelListener(element: GlobalEventHandlers, + callback: (event: WheelEvent) => void, + useCapture?: boolean): void; diff --git a/types/wheel/tsconfig.json b/types/wheel/tsconfig.json new file mode 100644 index 0000000000..5c9a5c4731 --- /dev/null +++ b/types/wheel/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es5", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "wheel-tests.ts" + ] +} \ No newline at end of file diff --git a/types/wheel/tslint.json b/types/wheel/tslint.json new file mode 100644 index 0000000000..65c83fb1e3 --- /dev/null +++ b/types/wheel/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "dt-header": false + } +} diff --git a/types/wheel/wheel-tests.ts b/types/wheel/wheel-tests.ts new file mode 100644 index 0000000000..8484408549 --- /dev/null +++ b/types/wheel/wheel-tests.ts @@ -0,0 +1,8 @@ +import {addWheelListener, removeWheelListener} from "wheel"; + +const wheelListener = (event: WheelEvent) => { + event.preventDefault(); + removeWheelListener(document, wheelListener); +}; + +addWheelListener(document, wheelListener); From 482932d07ddc267a4ed5fa57f7d078160cd2f067 Mon Sep 17 00:00:00 2001 From: Bradley Odell Date: Mon, 27 Nov 2017 01:47:23 -0800 Subject: [PATCH 079/322] Fixed 2 linting issues in test file. --- types/wheel/wheel-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/wheel/wheel-tests.ts b/types/wheel/wheel-tests.ts index 8484408549..9126bcf4b7 100644 --- a/types/wheel/wheel-tests.ts +++ b/types/wheel/wheel-tests.ts @@ -1,4 +1,4 @@ -import {addWheelListener, removeWheelListener} from "wheel"; +import { addWheelListener, removeWheelListener } from "wheel"; const wheelListener = (event: WheelEvent) => { event.preventDefault(); From 32632d3d6b7cf713d84ec5f0ff4122c4902be589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Nor=C3=A9n?= Date: Mon, 27 Nov 2017 11:42:04 +0100 Subject: [PATCH 080/322] Update index.d.ts --- types/react-select/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index 7ee2bbd810..7a2601a6c1 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -358,7 +358,7 @@ export interface ReactSelectProps extends React.Props; /** * function which returns a custom way to render the options in the menu */ @@ -423,7 +423,7 @@ export interface ReactSelectProps extends React.Props; /** * optional style to apply to the component wrapper From c4db7383b82fc6e44ce71b46d695543b3a6e62df Mon Sep 17 00:00:00 2001 From: CaselIT Date: Mon, 27 Nov 2017 22:33:05 +0100 Subject: [PATCH 081/322] Updated dbref and exported from mongodb. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/21717 --- types/bson/index.d.ts | 3 +++ types/mongodb/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/bson/index.d.ts b/types/bson/index.d.ts index 2b6a636e89..5197d30d88 100644 --- a/types/bson/index.d.ts +++ b/types/bson/index.d.ts @@ -55,6 +55,9 @@ export class Code { } export class DBRef { constructor(namespace: string, oid: ObjectID, db?: string); + namespace: string; + oid: ObjectID; + db?: string; } export class Double { constructor(value: number); diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 32bc523d38..fbbc318a33 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -22,7 +22,7 @@ export function connect(uri: string, options?: MongoClientOptions): Promise; export function connect(uri: string, callback: MongoCallback): void; export function connect(uri: string, options: MongoClientOptions, callback: MongoCallback): void; -export { Binary, Double, Long, Decimal128, MaxKey, MinKey, ObjectID, ObjectId, Timestamp } from 'bson'; +export { Binary, Double, Long, Decimal128, MaxKey, MinKey, ObjectID, ObjectId, Timestamp, DBRef } from 'bson'; // Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html export class MongoClient { From 55281420175588eb879a8f9d1364289a61204ebf Mon Sep 17 00:00:00 2001 From: Bradley Odell Date: Mon, 27 Nov 2017 21:37:38 -0800 Subject: [PATCH 082/322] Fixed issues brought up by code reviewers. --- types/wheel/index.d.ts | 2 +- types/wheel/tsconfig.json | 2 +- types/wheel/tslint.json | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/types/wheel/index.d.ts b/types/wheel/index.d.ts index c3c23f361f..c7214ee604 100644 --- a/types/wheel/index.d.ts +++ b/types/wheel/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for wheel 0.0.5 +// Type definitions for wheel 0.0 // Project: https://github.com/anvaka/wheel // Definitions by: Bradley Odell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/wheel/tsconfig.json b/types/wheel/tsconfig.json index 5c9a5c4731..2857ce81c3 100644 --- a/types/wheel/tsconfig.json +++ b/types/wheel/tsconfig.json @@ -16,4 +16,4 @@ "index.d.ts", "wheel-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/wheel/tslint.json b/types/wheel/tslint.json index 65c83fb1e3..f93cf8562a 100644 --- a/types/wheel/tslint.json +++ b/types/wheel/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "dt-header": false - } + "extends": "dtslint/dt.json" } From 888c6e79aba5c1fe54123ae2b733d1ca9737e858 Mon Sep 17 00:00:00 2001 From: "Matt R. Wilson" Date: Tue, 28 Nov 2017 08:43:05 -0700 Subject: [PATCH 083/322] Fill out `initParams` of `RequestAPI`. This method has the same signature as the verb functions as the args get passed directly to `initParams` from all the verb functions. https://github.com/request/request/blob/master/index.js#L58-L5 --- types/request/index.d.ts | 8 ++++++-- types/request/request-tests.ts | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index 20ad40e64e..db05b8ebee 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -5,7 +5,8 @@ // Bart van der Schoor , // Joe Skeen , // Christopher Currens , -// Jon Stevens +// Jon Stevens , +// Matt R. Wilson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -58,11 +59,14 @@ declare namespace request { delete(uri: string, callback?: RequestCallback): TRequest; delete(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest; + initParams(uri: string, options?: TOptions, callback?: RequestCallback): TRequest; + initParams(uri: string, callback?: RequestCallback): TRequest; + initParams(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest; + forever(agentOptions: any, optionsArg: any): TRequest; jar(store?: any): CookieJar; cookie(str: string): Cookie; - initParams: any; debug: boolean; } diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index d2c308ed75..0f9d2aa29c 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -161,8 +161,6 @@ req.destroy(); // --- --- --- --- --- --- --- --- --- --- --- --- -value = request.initParams; - req = request(uri); req = request(uri, options); req = request(uri, options, callback); @@ -219,6 +217,13 @@ req = request.delete(uri, callback); req = request.delete(options); req = request.delete(options, callback); +value = request.initParams(uri); +value = request.initParams(uri, options); +value = request.initParams(uri, options, callback); +value = request.initParams(uri, callback); +value = request.initParams(options); +value = request.initParams(options, callback); + req = request.forever(value, value); jar = request.jar(); cookie = request.cookie(str); From 7f6508562138dacfd1e12478b7c2bdf69d83d67f Mon Sep 17 00:00:00 2001 From: Sterling Camden Date: Tue, 28 Nov 2017 15:46:38 -0800 Subject: [PATCH 084/322] add types for checkSession method --- types/auth0-lock/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts index 0a57d988ce..c1a393409a 100644 --- a/types/auth0-lock/index.d.ts +++ b/types/auth0-lock/index.d.ts @@ -154,6 +154,7 @@ interface Auth0LockStatic { // deprecated getProfile(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void; getUserInfo(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void; + checkSession(options: object, callback: (error: auth0.Auth0Error, authResult: AuthResult | undefined) => void): void; // https://github.com/auth0/lock#resumeauthhash-callback resumeAuth(hash: string, callback: (error: auth0.Auth0Error, authResult: AuthResult) => void): void; show(options?: Auth0LockShowOptions): void; From 9890a3710c594347c55c924842c902dd3ce9220d Mon Sep 17 00:00:00 2001 From: Sterling Camden Date: Tue, 28 Nov 2017 15:52:44 -0800 Subject: [PATCH 085/322] Update index.d.ts --- types/auth0-lock/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts index c1a393409a..8ed6b50c87 100644 --- a/types/auth0-lock/index.d.ts +++ b/types/auth0-lock/index.d.ts @@ -154,7 +154,7 @@ interface Auth0LockStatic { // deprecated getProfile(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void; getUserInfo(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void; - checkSession(options: object, callback: (error: auth0.Auth0Error, authResult: AuthResult | undefined) => void): void; + checkSession(options: any, callback: (error: auth0.Auth0Error, authResult: AuthResult | undefined) => void): void; // https://github.com/auth0/lock#resumeauthhash-callback resumeAuth(hash: string, callback: (error: auth0.Auth0Error, authResult: AuthResult) => void): void; show(options?: Auth0LockShowOptions): void; From 33366d809ac772d68a7e63239329bca71dc70d31 Mon Sep 17 00:00:00 2001 From: Masayuki Ono Date: Wed, 29 Nov 2017 17:00:17 +0900 Subject: [PATCH 086/322] Add cacheControl to FileMetadata --- types/google-cloud__storage/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index 544f2e095f..a614ea4982 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -153,6 +153,7 @@ declare namespace Storage { interface FileMetadata { contentType?: string; metadata?: CustomFileMetadata; + cacheControl?: string; } /** From c0cba20b9f2e44c8b679c88d58aa30d69d3d272c Mon Sep 17 00:00:00 2001 From: Jose Fernandez Exposito Date: Wed, 29 Nov 2017 09:25:52 +0100 Subject: [PATCH 087/322] Added variable process --- types/webpack-env/index.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index ea9db09289..99022670a9 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -187,6 +187,10 @@ declare namespace __WebpackModuleApi { autoApply?: boolean; } + interface NodeProcess { + env?: any; + } + type __Require1 = (id: string) => any; type __Require2 = (id: string) => T; type RequireLambda = __Require1 & __Require2; @@ -247,3 +251,8 @@ declare var DEBUG: boolean; interface NodeModule extends __WebpackModuleApi.Module {} declare var module: NodeModule; + +declare namespace NodeJS { + interface Process extends __WebpackModuleApi.NodeProcess {} +} +declare var process: NodeJS.Process; From ed9e0f6d14d9fb43ae5ff61dfeb213a37b510e91 Mon Sep 17 00:00:00 2001 From: Kevin Ross Date: Wed, 29 Nov 2017 09:28:28 -0600 Subject: [PATCH 088/322] Update react-autosuggest signatures, documentation, use generic type - Convert Autosuggest component to a generic - Update the renderSuggestionsContainer signature - Add readme with usage example - Document component props - Export function types for easier reuse/passing in as props --- types/react-autosuggest/README.md | 28 ++ types/react-autosuggest/index.d.ts | 245 +++++++++++++----- .../react-autosuggest-tests.tsx | 14 +- 3 files changed, 218 insertions(+), 69 deletions(-) create mode 100644 types/react-autosuggest/README.md diff --git a/types/react-autosuggest/README.md b/types/react-autosuggest/README.md new file mode 100644 index 0000000000..44ff83ecc5 --- /dev/null +++ b/types/react-autosuggest/README.md @@ -0,0 +1,28 @@ +# react-autosuggest usage notes + +The definition uses generics for stronger typing. Read the [TypeScript deep dive on JSX Generic components](https://basarat.gitbooks.io/typescript/docs/jsx/tsx.html#react-jsx-tip-generic-components) for details on consuming these type definitions. + +## Example + +```jsx +import * as Autosuggest from 'react-autosuggest' +interface Language { + name: string + year: number +} + +const LanguageAutosuggest = Autosuggest as { new (): Autosuggest } + + +``` + +Find multiple full examples in `react-autosuggest-tests.tsx` diff --git a/types/react-autosuggest/index.d.ts b/types/react-autosuggest/index.d.ts index b1f080efe5..4c4d6caaed 100644 --- a/types/react-autosuggest/index.d.ts +++ b/types/react-autosuggest/index.d.ts @@ -1,88 +1,205 @@ -// Type definitions for react-autosuggest 9.3 +// Type definitions for react-autosuggest 9.3.2 // Project: http://react-autosuggest.js.org/ // Definitions by: Nicolas Schmitt // Philip Ottesen // Robert Essig // Terry Bayne // Christopher Deutsch +// Kevin Ross // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import * as React from 'react'; +import * as React from 'react' -declare class Autosuggest extends React.Component {} +declare class Autosuggest extends React.Component> {} -export = Autosuggest; +export = Autosuggest declare namespace Autosuggest { - interface SuggestionsFetchRequest { - value: string; - reason: 'input-changed' | 'input-focused' | 'escape-pressed' | 'suggestions-revealed' | 'suggestion-selected'; - } + /** + * Utilies types based on: + * https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-307871458 + */ - interface InputValues { - value: string; - valueBeforeUpDown?: string; - } + /** @internal */ + type Diff = ({ [P in T]: P } & + { [P in U]: never } & { [x: string]: never })[T] - interface RenderSuggestionParams { - query: string; - isHighlighted: boolean; - } + /** @internal */ + type Omit = Pick> - interface SuggestionHighlightedParams { - suggestion: any; - } + export interface SuggestionsFetchRequestedParams { + value: string + reason: + | 'input-changed' + | 'input-focused' + | 'escape-pressed' + | 'suggestions-revealed' + | 'suggestion-selected' + } - interface ChangeEvent { - newValue: string; - method: 'down' | 'up' | 'escape' | 'enter' | 'click' | 'type'; - } + export interface RenderSuggestionParams { + query: string + isHighlighted: boolean + } - interface BlurEvent { - highlightedSuggestion: any; - } + export interface SuggestionHighlightedParams { + suggestion: any + } - interface InputProps extends React.InputHTMLAttributes { - value: string; - onChange(event: React.FormEvent, params?: ChangeEvent): void; - onBlur?(event: React.FormEvent, params?: BlurEvent): void; - [key: string]: any; - } + export interface ChangeEvent { + newValue: string + method: 'down' | 'up' | 'escape' | 'enter' | 'click' | 'type' + } - interface SuggestionSelectedEventData { - suggestion: TSuggestion; - suggestionValue: string; - suggestionIndex: number; - sectionIndex: number | null; - method: 'click' | 'enter'; - } + export interface BlurEvent { + highlightedSuggestion: TSuggestion + } - type ThemeKey = 'container' | 'containerOpen' | 'input' | 'inputOpen' | 'inputFocused' | 'suggestionsContainer' | - 'suggestionsContainerOpen' | 'suggestionsList' | 'suggestion' | 'suggestionFirst' | 'suggestionHighlighted' | - 'sectionContainer' | 'sectionContainerFirst' | 'sectionTitle'; + export interface InputProps + extends Omit, 'onChange' | 'onBlur'> { + onChange(event: React.FormEvent, params?: ChangeEvent): void + onBlur?(event: React.FormEvent, params?: BlurEvent): void + value: string + [key: string]: any + } - type Theme = Record | Partial>; + export interface SuggestionSelectedEventData { + suggestion: TSuggestion + suggestionValue: string + suggestionIndex: number + sectionIndex: number | null + method: 'click' | 'enter' + } - interface AutosuggestProps extends React.Props { - suggestions: any[]; - onSuggestionsFetchRequested(request: SuggestionsFetchRequest): void; - onSuggestionsClearRequested?(): void; - getSuggestionValue(suggestion: any): any; - renderSuggestion(suggestion: any, params: RenderSuggestionParams): JSX.Element; - inputProps: InputProps; - onSuggestionSelected?(event: React.FormEvent, data: SuggestionSelectedEventData): void; - onSuggestionHighlighted?(params: SuggestionHighlightedParams): void; - shouldRenderSuggestions?(value: string): boolean; - alwaysRenderSuggestions?: boolean; - highlightFirstSuggestion?: boolean; - focusInputOnSuggestionClick?: boolean; - multiSection?: boolean; - renderSectionTitle?(section: any): JSX.Element; - getSectionSuggestions?(section: any): any[]; - renderInputComponent?(inputProps: InputProps): JSX.Element; - renderSuggestionsContainer?(containerProps: any, children: any, query: string): JSX.Element; - theme?: Theme; - id?: string; - } + export type ThemeKey = + | 'container' + | 'containerOpen' + | 'input' + | 'inputOpen' + | 'inputFocused' + | 'suggestionsContainer' + | 'suggestionsContainerOpen' + | 'suggestionsList' + | 'suggestion' + | 'suggestionFirst' + | 'suggestionHighlighted' + | 'sectionContainer' + | 'sectionContainerFirst' + | 'sectionTitle' + + export type Theme = + | Record + | Partial> + + export type RenderSuggestionsContainerParams = { + containerProps: { + id: string + key: string + ref: any + style: Object + } + children: React.ReactNode + query: string + } + + // export types for functions - allowing reuse externally - e.g. as props and bound in the constructor + export type GetSectionSuggestions = (section: any) => TSuggestion[] + export type GetSuggestionValue = (suggestion: TSuggestion) => string + export type OnSuggestionHighlighted = (params: SuggestionHighlightedParams) => void + export type SuggestionsFetchRequested = (request: SuggestionsFetchRequestedParams) => void + export type OnSuggestionsClearRequested = () => void + export type OnSuggestionSelected = ( + event: React.FormEvent, + data: SuggestionSelectedEventData, + ) => void + export type RenderInputComponent = ( + inputProps: InputProps, + ) => JSX.Element + export type RenderSuggestionsContainer = (params: RenderSuggestionsContainerParams) => JSX.Element + export type RenderSectionTitle = (section: any) => JSX.Element + export type RenderSuggestion = ( + suggestion: TSuggestion, + params: RenderSuggestionParams, + ) => JSX.Element + export type ShouldRenderSuggestions = (value: string) => boolean + + export interface AutosuggestProps { + /** + * Set it to true if you'd like to render suggestions even when the input is not focused. + */ + alwaysRenderSuggestions?: boolean + /** + * Set it to false if you don't want Autosuggest to keep the input focused when suggestions are clicked/tapped. + */ + focusInputOnSuggestionClick?: boolean + /** + * Implement it to teach Autosuggest where to find the suggestions for every section. + */ + getSectionSuggestions?: GetSectionSuggestions + /** + * Implement it to teach Autosuggest what should be the input value when suggestion is clicked. + */ + getSuggestionValue: GetSuggestionValue + /** + * Set it to true if you'd like Autosuggest to automatically highlight the first suggestion. + */ + highlightFirstSuggestion?: boolean + /** + * Use it only if you have multiple Autosuggest components on a page. + */ + id?: string + /** + * Pass through arbitrary props to the input. It must contain at least value and onChange. + */ + inputProps: InputProps + /** + * Set it to true if you'd like to display suggestions in multiple sections (with optional titles). + */ + multiSection?: boolean + /** + * Will be called every time the highlighted suggestion changes. + */ + onSuggestionHighlighted?: OnSuggestionHighlighted + /** + * Will be called every time you need to recalculate suggestions. + */ + onSuggestionsFetchRequested: SuggestionsFetchRequested + /** + * Will be called every time you need to set suggestions to []. + */ + onSuggestionsClearRequested?: OnSuggestionsClearRequested + /** + * Will be called every time suggestion is selected via mouse or keyboard. + */ + onSuggestionSelected?: OnSuggestionSelected + /** + * Use it only if you need to customize the rendering of the input. + */ + renderInputComponent?: RenderInputComponent + /** + * Use it if you want to customize things inside the suggestions container beyond rendering the suggestions themselves. + */ + renderSuggestionsContainer?: RenderSuggestionsContainer + /** + * Use your imagination to define how section titles are rendered. + */ + renderSectionTitle?: RenderSectionTitle + /** + * Use your imagination to define how suggestions are rendered. + */ + renderSuggestion: RenderSuggestion + /** + * When the input is focused, Autosuggest will consult this function when to render suggestions. Use it, for example, if you want to display suggestions when input value is at least 2 characters long. + */ + shouldRenderSuggestions?: ShouldRenderSuggestions + /** + * These are the suggestions that will be displayed. Items can take an arbitrary shape. + */ + suggestions: TSuggestion[] + /** + * Use your imagination to style the Autosuggest. + */ + theme?: Theme + } } diff --git a/types/react-autosuggest/react-autosuggest-tests.tsx b/types/react-autosuggest/react-autosuggest-tests.tsx index 23841519e4..a8a6268445 100644 --- a/types/react-autosuggest/react-autosuggest-tests.tsx +++ b/types/react-autosuggest/react-autosuggest-tests.tsx @@ -15,6 +15,8 @@ function escapeRegexCharacters(str: string): string { return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); } +const LanguageAutosuggest = Autosuggest as { new (): Autosuggest } + export class ReactAutosuggestBasicTest extends React.Component { // region Fields static languages: Language[] = [ @@ -89,7 +91,7 @@ export class ReactAutosuggestBasicTest extends React.Component { sectionTitle: { color: 'blue' } }; - return { .bind(this) }; - return { return {section.title}; } - protected renderInputComponent(inputProps: Autosuggest.InputProps): JSX.Element { + protected renderInputComponent(inputProps: Autosuggest.InputProps): JSX.Element { return (
@@ -280,7 +282,7 @@ export class ReactAutosuggestMultipleTest extends React.Component { ); } - protected renderSuggestionsContainer(containerProps: any, children: any, query: string): JSX.Element { + protected renderSuggestionsContainer({containerProps, children, query}: Autosuggest.RenderSuggestionsContainerParams): JSX.Element { return (
{children} @@ -345,6 +347,8 @@ interface Person { twitter: string; } +const PersonAutosuggest = Autosuggest as { new (): Autosuggest } + export class ReactAutosuggestCustomTest extends React.Component { // region Fields static people: Person[] = [ @@ -386,7 +390,7 @@ export class ReactAutosuggestCustomTest extends React.Component { .bind(this) }; - return Date: Wed, 29 Nov 2017 09:38:47 -0600 Subject: [PATCH 089/322] lint --- types/react-autosuggest/index.d.ts | 155 +++++++++--------- .../react-autosuggest-tests.tsx | 4 +- 2 files changed, 79 insertions(+), 80 deletions(-) diff --git a/types/react-autosuggest/index.d.ts b/types/react-autosuggest/index.d.ts index 4c4d6caaed..78c11d6878 100644 --- a/types/react-autosuggest/index.d.ts +++ b/types/react-autosuggest/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-autosuggest 9.3.2 +// Type definitions for react-autosuggest 9.3 // Project: http://react-autosuggest.js.org/ // Definitions by: Nicolas Schmitt // Philip Ottesen @@ -9,11 +9,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import * as React from 'react' +import * as React from 'react'; declare class Autosuggest extends React.Component> {} -export = Autosuggest +export = Autosuggest; declare namespace Autosuggest { /** @@ -23,56 +23,56 @@ declare namespace Autosuggest { /** @internal */ type Diff = ({ [P in T]: P } & - { [P in U]: never } & { [x: string]: never })[T] + { [P in U]: never } & { [x: string]: never })[T]; /** @internal */ - type Omit = Pick> + type Omit = Pick>; - export interface SuggestionsFetchRequestedParams { - value: string + interface SuggestionsFetchRequestedParams { + value: string; reason: | 'input-changed' | 'input-focused' | 'escape-pressed' | 'suggestions-revealed' - | 'suggestion-selected' + | 'suggestion-selected'; } - export interface RenderSuggestionParams { - query: string - isHighlighted: boolean + interface RenderSuggestionParams { + query: string; + isHighlighted: boolean; } - export interface SuggestionHighlightedParams { - suggestion: any + interface SuggestionHighlightedParams { + suggestion: any; } - export interface ChangeEvent { - newValue: string - method: 'down' | 'up' | 'escape' | 'enter' | 'click' | 'type' + interface ChangeEvent { + newValue: string; + method: 'down' | 'up' | 'escape' | 'enter' | 'click' | 'type'; } - export interface BlurEvent { - highlightedSuggestion: TSuggestion + interface BlurEvent { + highlightedSuggestion: TSuggestion; } - export interface InputProps + interface InputProps extends Omit, 'onChange' | 'onBlur'> { - onChange(event: React.FormEvent, params?: ChangeEvent): void - onBlur?(event: React.FormEvent, params?: BlurEvent): void - value: string - [key: string]: any + onChange(event: React.FormEvent, params?: ChangeEvent): void; + onBlur?(event: React.FormEvent, params?: BlurEvent): void; + value: string; + [key: string]: any; } - export interface SuggestionSelectedEventData { - suggestion: TSuggestion - suggestionValue: string - suggestionIndex: number - sectionIndex: number | null - method: 'click' | 'enter' + interface SuggestionSelectedEventData { + suggestion: TSuggestion; + suggestionValue: string; + suggestionIndex: number; + sectionIndex: number | null; + method: 'click' | 'enter'; } - export type ThemeKey = + type ThemeKey = | 'container' | 'containerOpen' | 'input' @@ -86,120 +86,119 @@ declare namespace Autosuggest { | 'suggestionHighlighted' | 'sectionContainer' | 'sectionContainerFirst' - | 'sectionTitle' + | 'sectionTitle'; - export type Theme = + type Theme = | Record - | Partial> + | Partial>; - export type RenderSuggestionsContainerParams = { + interface RenderSuggestionsContainerParams { containerProps: { - id: string - key: string - ref: any - style: Object - } - children: React.ReactNode - query: string + id: string; + key: string; + ref: any; + style: any; + }; + children: React.ReactNode; + query: string; } - // export types for functions - allowing reuse externally - e.g. as props and bound in the constructor - export type GetSectionSuggestions = (section: any) => TSuggestion[] - export type GetSuggestionValue = (suggestion: TSuggestion) => string - export type OnSuggestionHighlighted = (params: SuggestionHighlightedParams) => void - export type SuggestionsFetchRequested = (request: SuggestionsFetchRequestedParams) => void - export type OnSuggestionsClearRequested = () => void - export type OnSuggestionSelected = ( + // types for functions - allowing reuse externally - e.g. as props and bound in the constructor + type GetSectionSuggestions = (section: any) => TSuggestion[]; + type GetSuggestionValue = (suggestion: TSuggestion) => string; + type OnSuggestionHighlighted = (params: SuggestionHighlightedParams) => void; + type SuggestionsFetchRequested = (request: SuggestionsFetchRequestedParams) => void; + type OnSuggestionsClearRequested = () => void; + type OnSuggestionSelected = ( event: React.FormEvent, data: SuggestionSelectedEventData, - ) => void - export type RenderInputComponent = ( - inputProps: InputProps, - ) => JSX.Element - export type RenderSuggestionsContainer = (params: RenderSuggestionsContainerParams) => JSX.Element - export type RenderSectionTitle = (section: any) => JSX.Element - export type RenderSuggestion = ( + ) => void; + type RenderInputComponent = (inputProps: InputProps) => JSX.Element; + type RenderSuggestionsContainer = (params: RenderSuggestionsContainerParams) => JSX.Element; + type RenderSectionTitle = (section: any) => JSX.Element; + type RenderSuggestion = ( suggestion: TSuggestion, params: RenderSuggestionParams, - ) => JSX.Element - export type ShouldRenderSuggestions = (value: string) => boolean + ) => JSX.Element; + type ShouldRenderSuggestions = (value: string) => boolean; - export interface AutosuggestProps { + interface AutosuggestProps { /** * Set it to true if you'd like to render suggestions even when the input is not focused. */ - alwaysRenderSuggestions?: boolean + alwaysRenderSuggestions?: boolean; /** * Set it to false if you don't want Autosuggest to keep the input focused when suggestions are clicked/tapped. */ - focusInputOnSuggestionClick?: boolean + focusInputOnSuggestionClick?: boolean; /** * Implement it to teach Autosuggest where to find the suggestions for every section. */ - getSectionSuggestions?: GetSectionSuggestions + getSectionSuggestions?: GetSectionSuggestions; /** * Implement it to teach Autosuggest what should be the input value when suggestion is clicked. */ - getSuggestionValue: GetSuggestionValue + getSuggestionValue: GetSuggestionValue; /** * Set it to true if you'd like Autosuggest to automatically highlight the first suggestion. */ - highlightFirstSuggestion?: boolean + highlightFirstSuggestion?: boolean; /** * Use it only if you have multiple Autosuggest components on a page. */ - id?: string + id?: string; /** * Pass through arbitrary props to the input. It must contain at least value and onChange. */ - inputProps: InputProps + inputProps: InputProps; /** * Set it to true if you'd like to display suggestions in multiple sections (with optional titles). */ - multiSection?: boolean + multiSection?: boolean; /** * Will be called every time the highlighted suggestion changes. */ - onSuggestionHighlighted?: OnSuggestionHighlighted + onSuggestionHighlighted?: OnSuggestionHighlighted; /** * Will be called every time you need to recalculate suggestions. */ - onSuggestionsFetchRequested: SuggestionsFetchRequested + onSuggestionsFetchRequested: SuggestionsFetchRequested; /** * Will be called every time you need to set suggestions to []. */ - onSuggestionsClearRequested?: OnSuggestionsClearRequested + onSuggestionsClearRequested?: OnSuggestionsClearRequested; /** * Will be called every time suggestion is selected via mouse or keyboard. */ - onSuggestionSelected?: OnSuggestionSelected + onSuggestionSelected?: OnSuggestionSelected; /** * Use it only if you need to customize the rendering of the input. */ - renderInputComponent?: RenderInputComponent + renderInputComponent?: RenderInputComponent; /** * Use it if you want to customize things inside the suggestions container beyond rendering the suggestions themselves. */ - renderSuggestionsContainer?: RenderSuggestionsContainer + renderSuggestionsContainer?: RenderSuggestionsContainer; /** * Use your imagination to define how section titles are rendered. */ - renderSectionTitle?: RenderSectionTitle + renderSectionTitle?: RenderSectionTitle; /** * Use your imagination to define how suggestions are rendered. */ - renderSuggestion: RenderSuggestion + renderSuggestion: RenderSuggestion; /** - * When the input is focused, Autosuggest will consult this function when to render suggestions. Use it, for example, if you want to display suggestions when input value is at least 2 characters long. + * When the input is focused, Autosuggest will consult this function when to render suggestions. + * Use it, for example, if you want to display suggestions when input value is at least 2 characters long. */ - shouldRenderSuggestions?: ShouldRenderSuggestions + shouldRenderSuggestions?: ShouldRenderSuggestions; /** * These are the suggestions that will be displayed. Items can take an arbitrary shape. */ - suggestions: TSuggestion[] + suggestions: TSuggestion[]; /** * Use your imagination to style the Autosuggest. */ - theme?: Theme + theme?: Theme; } } diff --git a/types/react-autosuggest/react-autosuggest-tests.tsx b/types/react-autosuggest/react-autosuggest-tests.tsx index a8a6268445..753af3a552 100644 --- a/types/react-autosuggest/react-autosuggest-tests.tsx +++ b/types/react-autosuggest/react-autosuggest-tests.tsx @@ -15,7 +15,7 @@ function escapeRegexCharacters(str: string): string { return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); } -const LanguageAutosuggest = Autosuggest as { new (): Autosuggest } +const LanguageAutosuggest = Autosuggest as { new (): Autosuggest }; export class ReactAutosuggestBasicTest extends React.Component { // region Fields @@ -347,7 +347,7 @@ interface Person { twitter: string; } -const PersonAutosuggest = Autosuggest as { new (): Autosuggest } +const PersonAutosuggest = Autosuggest as { new (): Autosuggest }; export class ReactAutosuggestCustomTest extends React.Component { // region Fields From 7ad519fb2d855691059a00aa4d69624305ea3fc8 Mon Sep 17 00:00:00 2001 From: swist Date: Wed, 29 Nov 2017 12:11:05 +0000 Subject: [PATCH 090/322] Adds types for moment-business-time@0.7.1 --- types/moment-business-time/index.d.ts | 41 ++++++++++++++ .../moment-business-time-tests.ts | 56 +++++++++++++++++++ types/moment-business-time/tsconfig.json | 23 ++++++++ types/moment-business-time/tslint.json | 1 + 4 files changed, 121 insertions(+) create mode 100644 types/moment-business-time/index.d.ts create mode 100644 types/moment-business-time/moment-business-time-tests.ts create mode 100644 types/moment-business-time/tsconfig.json create mode 100644 types/moment-business-time/tslint.json diff --git a/types/moment-business-time/index.d.ts b/types/moment-business-time/index.d.ts new file mode 100644 index 0000000000..dc4022f161 --- /dev/null +++ b/types/moment-business-time/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for moment-business-time 0.7 +// Project: https://github.com/lennym/moment-business-time +// Definitions by: Tomasz Nguyen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/*~ On this line, import the module which this module adds to */ +import * as moment from 'moment'; + +/*~ Here, declare the same module as the one you imported above */ +declare module 'moment' { + interface Moment { + nextWorkingDay: () => Moment; + nextWorkingTime: () => Moment; + + lastWorkingDay: () => Moment; + lastWorkingTime: () => Moment; + + addWorkingTime: (...args: Array) => Moment; + subtractWorkingTime: (...args: Array) => Moment; + + workingDiff: (moment: Moment, unit: unitOfTime.Base, fractions?: boolean) => Moment; + + isWorkingDay: () => boolean; + isWorkingTime: () => boolean; + } + + interface WorkingHoursMap { + 0: string[] | null; + 1: string[] | null; + 2: string[] | null; + 3: string[] | null; + 4: string[] | null; + 5: string[] | null; + 6: string[] | null; + } + + interface LocaleSpecification { + workinghours?: WorkingHoursMap; + holidays?: string[]; + } +} diff --git a/types/moment-business-time/moment-business-time-tests.ts b/types/moment-business-time/moment-business-time-tests.ts new file mode 100644 index 0000000000..79f25a720a --- /dev/null +++ b/types/moment-business-time/moment-business-time-tests.ts @@ -0,0 +1,56 @@ +import * as moment from 'moment'; +import 'moment-business-time'; + +moment('2015-02-28T10:00:00Z').nextWorkingDay(); +moment('2015-02-28T20:00:00Z').nextWorkingDay(); +moment('2015-02-28T10:00:00Z').nextWorkingTime(); +moment('2015-02-28T20:00:00Z').nextWorkingTime(); +moment('2015-02-28T10:00:00Z').lastWorkingDay(); +// Fri Feb 27 2015 10:00:00 GMT+0000 +moment('2015-02-28T20:00:00Z').lastWorkingDay(); +// Fri Feb 27 2015 20:00:00 GMT+0000 +moment('2015-02-27T10:00:00Z').addWorkingTime(5, 'hours'); +// Fri Feb 27 2015 15:00:00 GMT+0000 +moment('2015-02-28T10:00:00Z').addWorkingTime(5, 'hours'); +// Mon Mar 02 2015 14:00:00 GMT+0000 +moment('2015-02-27T10:00:00Z').addWorkingTime(5, 'hours', 30, 'minutes'); +// Fri Feb 27 2015 15:30:00 GMT+0000 +moment('2015-02-27T16:00:00Z').subtractWorkingTime(5, 'hours'); +// Fri Feb 27 2015 11:00:00 GMT+0000 +moment('2015-02-28T16:00:00Z').subtractWorkingTime(5, 'hours'); +// Fri Feb 27 2015 12:00:00 GMT+0000 +moment('2015-02-27T16:00:00Z').subtractWorkingTime(5, 'hours', 30, 'minutes'); +// Fri Feb 27 2015 10:30:00 GMT+0000 +moment('2015-02-27T16:30:00Z').workingDiff(moment('2015-02-26T12:00:00Z'), 'hours'); +// 12 +moment('2015-02-27T16:30:00Z').workingDiff(moment('2015-02-26T12:00:00Z'), 'hours', true); +// 12.5 +// set opening time to 09:30 and close early on Wednesdays +moment.updateLocale('en', { + workinghours: { + 0: null, + 1: ['09:30:00', '17:00:00'], + 2: ['09:30:00', '17:00:00'], + 3: ['09:30:00', '13:00:00'], + 4: ['09:30:00', '17:00:00'], + 5: ['09:30:00', '17:00:00'], + 6: null + } +}); +moment('2015-02-25T15:00:00Z').isWorkingTime(); // false +moment('2015-02-23T09:00:00Z').isWorkingTime(); // false +moment.updateLocale('en', { + holidays: [ + '2015-05-04' + ] +}); +moment('2015-05-04T09:30:00Z').isWorkingDay(); // false +moment.updateLocale('en', { + holidays: [ + '*-12-25' + ] +}); +moment('2015-12-25T16:30:00Z').isWorkingDay(); // false +moment('2016-12-25T16:30:00Z').isWorkingDay(); // false +moment('2017-12-25T16:30:00Z').isWorkingDay(); // false +moment('2018-12-25T16:30:00Z').isWorkingDay(); // false diff --git a/types/moment-business-time/tsconfig.json b/types/moment-business-time/tsconfig.json new file mode 100644 index 0000000000..c1212caa2f --- /dev/null +++ b/types/moment-business-time/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "moment-business-time-tests.ts" + ] +} diff --git a/types/moment-business-time/tslint.json b/types/moment-business-time/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/moment-business-time/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 9425d106e397826fe9442be0d7925c38e7f1b73c Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 29 Nov 2017 20:09:02 +0000 Subject: [PATCH 091/322] Types for add-zero --- types/add-zero/add-zero-tests.ts | 3 +++ types/add-zero/index.d.ts | 6 ++++++ types/add-zero/tsconfig.json | 22 ++++++++++++++++++++++ types/add-zero/tslint.json | 1 + 4 files changed, 32 insertions(+) create mode 100644 types/add-zero/add-zero-tests.ts create mode 100644 types/add-zero/index.d.ts create mode 100644 types/add-zero/tsconfig.json create mode 100644 types/add-zero/tslint.json diff --git a/types/add-zero/add-zero-tests.ts b/types/add-zero/add-zero-tests.ts new file mode 100644 index 0000000000..9f52ace86e --- /dev/null +++ b/types/add-zero/add-zero-tests.ts @@ -0,0 +1,3 @@ +import addZero from "add-zero"; + +addZero(5, 2); \ No newline at end of file diff --git a/types/add-zero/index.d.ts b/types/add-zero/index.d.ts new file mode 100644 index 0000000000..1380b84ce9 --- /dev/null +++ b/types/add-zero/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for add-zero 1.0 +// Project: https://github.com/rafaelrinaldi/add-zero#readme +// Definitions by: Giles Roadnight +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default function addZero(value: any, digits?: number): string; \ No newline at end of file diff --git a/types/add-zero/tsconfig.json b/types/add-zero/tsconfig.json new file mode 100644 index 0000000000..fe18a9a603 --- /dev/null +++ b/types/add-zero/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "add-zero-tests.ts" + ] +} diff --git a/types/add-zero/tslint.json b/types/add-zero/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/add-zero/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d83fb362f4d7beee79d666902caf5a5743fd620a Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 29 Nov 2017 20:16:27 +0000 Subject: [PATCH 092/322] Fixed linting errors --- types/add-zero/add-zero-tests.ts | 2 +- types/add-zero/index.d.ts | 2 +- types/add-zero/tsconfig.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/add-zero/add-zero-tests.ts b/types/add-zero/add-zero-tests.ts index 9f52ace86e..ac0509d26d 100644 --- a/types/add-zero/add-zero-tests.ts +++ b/types/add-zero/add-zero-tests.ts @@ -1,3 +1,3 @@ import addZero from "add-zero"; -addZero(5, 2); \ No newline at end of file +addZero(5, 2); diff --git a/types/add-zero/index.d.ts b/types/add-zero/index.d.ts index 1380b84ce9..907364a62d 100644 --- a/types/add-zero/index.d.ts +++ b/types/add-zero/index.d.ts @@ -3,4 +3,4 @@ // Definitions by: Giles Roadnight // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default function addZero(value: any, digits?: number): string; \ No newline at end of file +export default function addZero(value: string | number, digits?: number): string; diff --git a/types/add-zero/tsconfig.json b/types/add-zero/tsconfig.json index fe18a9a603..e71d235cdf 100644 --- a/types/add-zero/tsconfig.json +++ b/types/add-zero/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From e2c4cb4b3c1ea3e32ab8e6609f55deb0e5b7d0db Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 29 Nov 2017 20:22:10 +0000 Subject: [PATCH 093/322] types for parse-ms --- types/parse-ms/index.d.ts | 12 ++++++++++++ types/parse-ms/parse-ms-tests.ts | 3 +++ types/parse-ms/tsconfig.json | 23 +++++++++++++++++++++++ types/parse-ms/tslint.json | 1 + 4 files changed, 39 insertions(+) create mode 100644 types/parse-ms/index.d.ts create mode 100644 types/parse-ms/parse-ms-tests.ts create mode 100644 types/parse-ms/tsconfig.json create mode 100644 types/parse-ms/tslint.json diff --git a/types/parse-ms/index.d.ts b/types/parse-ms/index.d.ts new file mode 100644 index 0000000000..9bf9f23c87 --- /dev/null +++ b/types/parse-ms/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for parse-ms 1.0 +// Project: https://github.com/sindresorhus/parse-ms#readme +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default function parseMs(ms: number): { + days: number; + hours: number; + minutes: number; + seconds: number; + milliseconds: number; +}; diff --git a/types/parse-ms/parse-ms-tests.ts b/types/parse-ms/parse-ms-tests.ts new file mode 100644 index 0000000000..2b747ad5a8 --- /dev/null +++ b/types/parse-ms/parse-ms-tests.ts @@ -0,0 +1,3 @@ +import parseMs from "parse-ms"; + +const { days, hours, milliseconds, minutes, seconds } = parseMs(3000); diff --git a/types/parse-ms/tsconfig.json b/types/parse-ms/tsconfig.json new file mode 100644 index 0000000000..3fecf7615f --- /dev/null +++ b/types/parse-ms/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "parse-ms-tests.ts" + ] +} diff --git a/types/parse-ms/tslint.json b/types/parse-ms/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parse-ms/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From cfa037187401d9e9ed8ab4b7027fc494569ab8cf Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 29 Nov 2017 20:41:14 +0000 Subject: [PATCH 094/322] Added author name / address --- types/parse-ms/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/parse-ms/index.d.ts b/types/parse-ms/index.d.ts index 9bf9f23c87..1a8a63d4a2 100644 --- a/types/parse-ms/index.d.ts +++ b/types/parse-ms/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for parse-ms 1.0 // Project: https://github.com/sindresorhus/parse-ms#readme -// Definitions by: My Self +// Definitions by: Giles Roadnight // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export default function parseMs(ms: number): { From c61ecc215c88ab6ec4e69b49b2d4743392b6dde8 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Thu, 30 Nov 2017 00:33:28 +0200 Subject: [PATCH 095/322] Add types for react-resolver --- types/react-resolver/index.d.ts | 71 ++++++++++++++++++++++++++++++ types/react-resolver/test.tsx | 44 ++++++++++++++++++ types/react-resolver/tsconfig.json | 25 +++++++++++ types/react-resolver/tslint.json | 1 + 4 files changed, 141 insertions(+) create mode 100644 types/react-resolver/index.d.ts create mode 100644 types/react-resolver/test.tsx create mode 100644 types/react-resolver/tsconfig.json create mode 100644 types/react-resolver/tslint.json diff --git a/types/react-resolver/index.d.ts b/types/react-resolver/index.d.ts new file mode 100644 index 0000000000..9afa5d4b61 --- /dev/null +++ b/types/react-resolver/index.d.ts @@ -0,0 +1,71 @@ +// Type definitions for react-resolver 3.1 +// Project: https://github.com/ericclemmons/react-resolver +// Definitions by: forabi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { ComponentType, StatelessComponent, Factory } from 'react'; + +export type AnyComponent

= ComponentType

; + +export interface Resolver { + resolve( + factory: Factory

, + ): Promise<{ + data: D; + Resolved: StatelessComponent

; + }>; + + render

(factory: Factory

, root: Node | null): void; +} + +export const Resolver: Resolver; + +export type ResolveFn = (props: Props) => Promise; + +/** Use this for gaining access to a context as a prop without the boilerplate of setting `contextTypes`. */ +export function context( + prop: K, +): ( + component: AnyComponent, +) => StatelessComponent>; + +/** + * Use `@client(LoaderComponent)` (or `client(LoaderComponent)(YourComponent)`) + * for when you want to skip server-side rendering of part of your view and + * perform it only on the client. + */ +export function client( + loadingComponent: AnyComponent, +): ( + component: AnyComponent, +) => StatelessComponent; + +export function resolve< + OwnProps, + K extends string, + V, + MoreProps = { [x: string]: any } +>( + prop: K, + resolveFn: ResolveFn, +): ( + component: AnyComponent, +) => StatelessComponent; + +export function resolve< + OwnProps, + ResolvableProps = { [x: string]: any }, + MoreProps = { [x: string]: any } +>( + resolversMap: { + [K in keyof ResolvableProps]: ResolveFn< + OwnProps & MoreProps, + ResolvableProps[K] + > + }, +): ( + component: AnyComponent< + OwnProps & { [K in keyof ResolvableProps]?: ResolvableProps[K] } + >, +) => StatelessComponent; diff --git a/types/react-resolver/test.tsx b/types/react-resolver/test.tsx new file mode 100644 index 0000000000..4c4314c063 --- /dev/null +++ b/types/react-resolver/test.tsx @@ -0,0 +1,44 @@ +import * as React from 'react'; +import { Resolver, resolve } from 'react-resolver'; +import * as expect from 'expect'; + +interface OwnProps { + thing: number; +} + +interface ResolvedProps { + data: string; +} + +class Page extends React.Component { + render() { + return

Hello, {this.props.data}!
; + } +} + +const ResolvedPageWithSingleProp = resolve('data', async () => { + return new Promise(resolve => { + setTimeout(() => resolve('World'), 500); + }); +})(Page); + +const ResolvedPageWithPropMap = resolve({ + data: async () => { + return new Promise(resolve => { + setTimeout(() => resolve('World'), 500); + }); + }, +})(Page); + +expect().toExist(); +expect().toExist(); + +// Resolver.render(() => , document.getElementById('app')); + +Resolver.resolve(() => { + return ( + + ); +}).then(({ data, Resolved }) => { + expect(data).toBe('World'); +}); diff --git a/types/react-resolver/tsconfig.json b/types/react-resolver/tsconfig.json new file mode 100644 index 0000000000..f16bd3453a --- /dev/null +++ b/types/react-resolver/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "test.tsx" + ] +} diff --git a/types/react-resolver/tslint.json b/types/react-resolver/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-resolver/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 1308f1fb8bd5ae0334396d48862e6d7597499a29 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Thu, 30 Nov 2017 00:38:08 +0200 Subject: [PATCH 096/322] Remove unneeded type alias --- types/react-resolver/index.d.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/types/react-resolver/index.d.ts b/types/react-resolver/index.d.ts index 9afa5d4b61..742260dc7c 100644 --- a/types/react-resolver/index.d.ts +++ b/types/react-resolver/index.d.ts @@ -6,8 +6,6 @@ import { ComponentType, StatelessComponent, Factory } from 'react'; -export type AnyComponent

= ComponentType

; - export interface Resolver { resolve( factory: Factory

, @@ -27,7 +25,7 @@ export type ResolveFn = (props: Props) => Promise; export function context( prop: K, ): ( - component: AnyComponent, + component: ComponentType, ) => StatelessComponent>; /** @@ -36,9 +34,9 @@ export function context( * perform it only on the client. */ export function client( - loadingComponent: AnyComponent, + loadingComponent: ComponentType, ): ( - component: AnyComponent, + component: ComponentType, ) => StatelessComponent; export function resolve< @@ -50,7 +48,7 @@ export function resolve< prop: K, resolveFn: ResolveFn, ): ( - component: AnyComponent, + component: ComponentType, ) => StatelessComponent; export function resolve< @@ -65,7 +63,7 @@ export function resolve< > }, ): ( - component: AnyComponent< + component: ComponentType< OwnProps & { [K in keyof ResolvableProps]?: ResolvableProps[K] } >, ) => StatelessComponent; From 5d792b0f0c1b866fb3c215ec15ea8bc2437d96ad Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Thu, 30 Nov 2017 00:39:01 +0200 Subject: [PATCH 097/322] Rename test file --- types/react-resolver/{test.tsx => react-resolver-tests.tsx} | 0 types/react-resolver/tsconfig.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename types/react-resolver/{test.tsx => react-resolver-tests.tsx} (100%) diff --git a/types/react-resolver/test.tsx b/types/react-resolver/react-resolver-tests.tsx similarity index 100% rename from types/react-resolver/test.tsx rename to types/react-resolver/react-resolver-tests.tsx diff --git a/types/react-resolver/tsconfig.json b/types/react-resolver/tsconfig.json index f16bd3453a..c8d99b4c25 100644 --- a/types/react-resolver/tsconfig.json +++ b/types/react-resolver/tsconfig.json @@ -20,6 +20,6 @@ }, "files": [ "index.d.ts", - "test.tsx" + "react-resolver-tests.tsx" ] } From 6e8cb559744725b8e742c0a7cb7c07fc56a1cb06 Mon Sep 17 00:00:00 2001 From: Vladyslav Tserman Date: Wed, 29 Nov 2017 13:01:34 -0800 Subject: [PATCH 098/322] Initial commit --- types/yup/index.d.ts | 39 +++++++++++++++++++++++++++++++++++++++ types/yup/tsconfig.json | 22 ++++++++++++++++++++++ types/yup/tslint.json | 1 + types/yup/yup-tests.ts | 0 4 files changed, 62 insertions(+) create mode 100644 types/yup/index.d.ts create mode 100644 types/yup/tsconfig.json create mode 100644 types/yup/tslint.json create mode 100644 types/yup/yup-tests.ts diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts new file mode 100644 index 0000000000..b32806de45 --- /dev/null +++ b/types/yup/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for yup 0.23 +// Project: https://github.com/jquense/yup +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/*~ If this module is a UMD module that exposes a global variable 'myLib' when + *~ loaded outside a module loader environment, declare that global here. + *~ Otherwise, delete this declaration. + */ +export as namespace myLib; + +/*~ If this module has methods, declare them as functions like so. + */ +export function myMethod(a: string): string; +export function myOtherMethod(a: number): number; + +/*~ You can declare types that are available via importing the module */ +export interface someType { + name: string; + length: number; + extras?: string[]; +} + +/*~ You can declare properties of the module using const, let, or var */ +export const myField: number; + +/*~ If there are types, properties, or methods inside dotted names + *~ of the module, declare them inside a 'namespace'. + */ +export namespace subProp { + /*~ For example, given this definition, someone could write: + *~ import { subProp } from 'yourModule'; + *~ subProp.foo(); + *~ or + *~ import * as yourMod from 'yourModule'; + *~ yourMod.subProp.foo(); + */ + export function foo(): void; +} \ No newline at end of file diff --git a/types/yup/tsconfig.json b/types/yup/tsconfig.json new file mode 100644 index 0000000000..d9fa152a10 --- /dev/null +++ b/types/yup/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "yup-tests.ts" + ] +} diff --git a/types/yup/tslint.json b/types/yup/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/yup/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts new file mode 100644 index 0000000000..e69de29bb2 From 4c133d2337f1d6526f06684dc7577d8e1b70eda2 Mon Sep 17 00:00:00 2001 From: Vladyslav Tserman Date: Wed, 29 Nov 2017 13:16:03 -0800 Subject: [PATCH 099/322] Added definitions by Dominik Hardtke posted here https://github.com/jquense/yup/issues/91#issuecomment-317221800 --- types/yup/index.d.ts | 142 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 112 insertions(+), 30 deletions(-) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index b32806de45..ac7f46be4b 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -1,39 +1,121 @@ // Type definitions for yup 0.23 // Project: https://github.com/jquense/yup -// Definitions by: My Self +// Definitions by: +// Dominik Hardtke +// Vladyslav Tserman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/*~ If this module is a UMD module that exposes a global variable 'myLib' when - *~ loaded outside a module loader environment, declare that global here. - *~ Otherwise, delete this declaration. - */ -export as namespace myLib; +export as namespace yup; -/*~ If this module has methods, declare them as functions like so. - */ -export function myMethod(a: string): string; -export function myOtherMethod(a: number): number; +export function reach(schema: Schema, path: string, value?: any, context?: any): Schema; +export function addMethod(schemaType: Schema, name: string, method: () => Schema): void; +export function ref(path: string, options: { contextPrefix: string }): Ref; +export function lazy(fn: (value: any) => Schema): Lazy; +export function mixed(): Schema; +export function string(): StringSchema; +export function number(): NumberSchema; +export function boolean(): BooleanSchema; +export function date(): DateSchema; +export function array(): ArraySchema; +export function object(): ObjectSchema; -/*~ You can declare types that are available via importing the module */ -export interface someType { - name: string; - length: number; - extras?: string[]; +export interface ValidationError { + errors: string | Array; + value: any; + path: string; + inner?: Array; } -/*~ You can declare properties of the module using const, let, or var */ -export const myField: number; +interface Ref { +} + +interface Lazy { +} + +interface Schema { + clone(): Schema; + label(label: string): Schema; + meta(metadata: any): Schema; + describe(): SchemaDescription; + concat(schema: Schema): Schema; + validate(value: any, options?: ValidateOptions, callback?: () => void): Promise; + isValid(value: any, options?: any, callback?: () => void): Promise; + cast(value: any): any; + isType(value: any): boolean; + strict(isStrict: boolean): Schema; + strip(stripField: boolean): Schema; + withMutation(builder: (current: Schema) => void): void; + default(value: any): Schema; + default(): any; + nullable(isNullable: boolean): Schema; + required(message?: string): Schema; + typeError(message?: string): Schema; + oneOf(arrayOfValues: Array, message?: string): Schema; + equals(arrayOfValues: Array, message?: string): Schema; + notOneOf(arrayOfValues: Array, message?: string): Schema; + when(keys: string | Array, builder: any | ((value: any, schema: Schema) => Schema)): Schema; + test(name: string, message: string, test: Function, callbackStyleAsync?: boolean): Schema; + test(options: any): Schema; + transform(transformation: (currentValue: any, originalValue: any) => any): Schema; +} + +interface StringSchema extends Schema { + required(message?: string): StringSchema; + min(limit: number | Ref, message?: string): StringSchema; + max(limit: number | Ref, message?: string): StringSchema; + matches(regex: RegExp, message?: string): StringSchema; + email(message?: string): StringSchema; + url(message?: string): StringSchema; + ensure(): StringSchema; + trim(message?: string): StringSchema; + lowercase(message?: string): StringSchema; + uppercase(message?: string): StringSchema; +} + +interface NumberSchema extends Schema { + min(limit: number | Ref, message?: string): NumberSchema; + max(limit: number | Ref, message?: string): NumberSchema; + positive(message?: string): NumberSchema; + negative(message?: string): NumberSchema; + integer(message?: string): NumberSchema; + truncate(): NumberSchema; + round(type: "floor" | "ceil" | "trunc" | "round"): NumberSchema; +} + +interface BooleanSchema extends Schema { + +} + +interface DateSchema extends Schema { + min(limit: Date | string | Ref, message?: string): DateSchema; + max(limit: Date | string | Ref, message?: string): DateSchema; +} + +interface ArraySchema extends Schema { + of(type: Schema): ArraySchema; + required(message?: string): ArraySchema; + min(limit: number | Ref, message?: string): ArraySchema; + max(limit: number | Ref, message?: string): ArraySchema; + ensure(): ArraySchema; + compact(rejector: (value: any) => boolean): ArraySchema; +} + +interface ObjectSchema extends Schema { + shape(fields: any, noSortEdges?: Array<[string, string]>): ObjectSchema; + from(fromKey: string, toKey: string, alias: boolean): ObjectSchema; + noUnknown(onlyKnownKeys: boolean, message?: string): ObjectSchema; + camelCase(): ObjectSchema; + constantCase(): ObjectSchema; +} + +interface ValidateOptions { + +} + +interface SchemaDescription { + type: string; + label: string; + meta: object; + tests: Array; +} -/*~ If there are types, properties, or methods inside dotted names - *~ of the module, declare them inside a 'namespace'. - */ -export namespace subProp { - /*~ For example, given this definition, someone could write: - *~ import { subProp } from 'yourModule'; - *~ subProp.foo(); - *~ or - *~ import * as yourMod from 'yourModule'; - *~ yourMod.subProp.foo(); - */ - export function foo(): void; -} \ No newline at end of file From a30076b01404ab0ce6a0153674ee4ac216cb5e39 Mon Sep 17 00:00:00 2001 From: Vladyslav Tserman Date: Wed, 29 Nov 2017 13:50:36 -0800 Subject: [PATCH 100/322] Fix tslint warnings --- types/yup/index.d.ts | 47 +++++++++++++++++++---------------------- types/yup/tsconfig.json | 3 ++- types/yup/tslint.json | 8 ++++++- types/yup/yup-tests.ts | 16 ++++++++++++++ 4 files changed, 47 insertions(+), 27 deletions(-) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index ac7f46be4b..e1ad722030 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -1,9 +1,8 @@ // Type definitions for yup 0.23 // Project: https://github.com/jquense/yup -// Definitions by: -// Dominik Hardtke -// Vladyslav Tserman +// Definitions by: Dominik Hardtke , Vladyslav Tserman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export as namespace yup; @@ -20,19 +19,19 @@ export function array(): ArraySchema; export function object(): ObjectSchema; export interface ValidationError { - errors: string | Array; + errors: string | string[]; value: any; path: string; - inner?: Array; + inner?: ValidationError[]; } -interface Ref { +export interface Ref { } -interface Lazy { +export interface Lazy { } -interface Schema { +export interface Schema { clone(): Schema; label(label: string): Schema; meta(metadata: any): Schema; @@ -50,16 +49,16 @@ interface Schema { nullable(isNullable: boolean): Schema; required(message?: string): Schema; typeError(message?: string): Schema; - oneOf(arrayOfValues: Array, message?: string): Schema; - equals(arrayOfValues: Array, message?: string): Schema; - notOneOf(arrayOfValues: Array, message?: string): Schema; - when(keys: string | Array, builder: any | ((value: any, schema: Schema) => Schema)): Schema; - test(name: string, message: string, test: Function, callbackStyleAsync?: boolean): Schema; + oneOf(arrayOfValues: any[], message?: string): Schema; + equals(arrayOfValues: any[], message?: string): Schema; + notOneOf(arrayOfValues: any[], message?: string): Schema; + when(keys: string | any[], builder: any | ((value: any, schema: Schema) => Schema)): Schema; + test(name: string, message: string, test: (value: any) => boolean, callbackStyleAsync?: boolean): Schema; test(options: any): Schema; transform(transformation: (currentValue: any, originalValue: any) => any): Schema; } -interface StringSchema extends Schema { +export interface StringSchema extends Schema { required(message?: string): StringSchema; min(limit: number | Ref, message?: string): StringSchema; max(limit: number | Ref, message?: string): StringSchema; @@ -72,7 +71,8 @@ interface StringSchema extends Schema { uppercase(message?: string): StringSchema; } -interface NumberSchema extends Schema { +export interface NumberSchema extends Schema { + required(message?: string): NumberSchema; min(limit: number | Ref, message?: string): NumberSchema; max(limit: number | Ref, message?: string): NumberSchema; positive(message?: string): NumberSchema; @@ -82,16 +82,15 @@ interface NumberSchema extends Schema { round(type: "floor" | "ceil" | "trunc" | "round"): NumberSchema; } -interface BooleanSchema extends Schema { - +export interface BooleanSchema extends Schema { } -interface DateSchema extends Schema { +export interface DateSchema extends Schema { min(limit: Date | string | Ref, message?: string): DateSchema; max(limit: Date | string | Ref, message?: string): DateSchema; } -interface ArraySchema extends Schema { +export interface ArraySchema extends Schema { of(type: Schema): ArraySchema; required(message?: string): ArraySchema; min(limit: number | Ref, message?: string): ArraySchema; @@ -100,7 +99,7 @@ interface ArraySchema extends Schema { compact(rejector: (value: any) => boolean): ArraySchema; } -interface ObjectSchema extends Schema { +export interface ObjectSchema extends Schema { shape(fields: any, noSortEdges?: Array<[string, string]>): ObjectSchema; from(fromKey: string, toKey: string, alias: boolean): ObjectSchema; noUnknown(onlyKnownKeys: boolean, message?: string): ObjectSchema; @@ -108,14 +107,12 @@ interface ObjectSchema extends Schema { constantCase(): ObjectSchema; } -interface ValidateOptions { - +export interface ValidateOptions { } -interface SchemaDescription { +export interface SchemaDescription { type: string; label: string; meta: object; - tests: Array; + tests: string[]; } - diff --git a/types/yup/tsconfig.json b/types/yup/tsconfig.json index d9fa152a10..7a38726edd 100644 --- a/types/yup/tsconfig.json +++ b/types/yup/tsconfig.json @@ -13,7 +13,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true }, "files": [ "index.d.ts", diff --git a/types/yup/tslint.json b/types/yup/tslint.json index 3db14f85ea..0fde820a9e 100644 --- a/types/yup/tslint.json +++ b/types/yup/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false, + "no-any-union": false + } +} diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index e69de29bb2..218ed793fc 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -0,0 +1,16 @@ +import * as yup from 'yup'; + +const schema = yup.object().shape({ + name: yup.string().required(), + age: yup.number().required().positive().integer(), + email: yup.string().email(), + website: yup.string().url(), + createdOn: yup.date().default(() => new Date()) +}); + +// check validity +schema.isValid({ + name: 'jimmy', + age: 24 +}) +.then(valid => valid /* => true */); From 074627c1f96e81881714ad4d5f6ea2fbb8cf0547 Mon Sep 17 00:00:00 2001 From: Vladyslav Tserman Date: Wed, 29 Nov 2017 15:22:02 -0800 Subject: [PATCH 101/322] Refactored to allow creating new Types --- types/yup/index.d.ts | 104 +++++++++++++++++++++++++++++++++++++---- types/yup/yup-tests.ts | 33 ++++++++++--- 2 files changed, 120 insertions(+), 17 deletions(-) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index e1ad722030..de1d8d2f07 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -10,13 +10,15 @@ export function reach(schema: Schema, path: string, value?: any, context?: any): export function addMethod(schemaType: Schema, name: string, method: () => Schema): void; export function ref(path: string, options: { contextPrefix: string }): Ref; export function lazy(fn: (value: any) => Schema): Lazy; -export function mixed(): Schema; -export function string(): StringSchema; -export function number(): NumberSchema; -export function boolean(): BooleanSchema; -export function date(): DateSchema; -export function array(): ArraySchema; -export function object(): ObjectSchema; + +export const mixed: SchemaConstructor; +export const string: StringSchemaConstructor; +export const number: NumberSchemaConstructor; +export const boolean: BooleanSchemaConstructor; +export const bool: BooleanSchemaConstructor; +export const date: DateSchemaConstructor; +export const array: ArraySchemaConstructor; +export const object: ObjectSchemaConstructor; export interface ValidationError { errors: string | string[]; @@ -31,6 +33,11 @@ export interface Ref { export interface Lazy { } +export interface SchemaConstructor { + (): Schema; + new(options?: any): Schema; +} + export interface Schema { clone(): Schema; label(label: string): Schema; @@ -38,7 +45,8 @@ export interface Schema { describe(): SchemaDescription; concat(schema: Schema): Schema; validate(value: any, options?: ValidateOptions, callback?: () => void): Promise; - isValid(value: any, options?: any, callback?: () => void): Promise; + isValid(value: any, options?: any, callback?: () => void): Promise; + isValidSync(value: any, options?: any): boolean; cast(value: any): any; isType(value: any): boolean; strict(isStrict: boolean): Schema; @@ -50,14 +58,18 @@ export interface Schema { required(message?: string): Schema; typeError(message?: string): Schema; oneOf(arrayOfValues: any[], message?: string): Schema; - equals(arrayOfValues: any[], message?: string): Schema; notOneOf(arrayOfValues: any[], message?: string): Schema; when(keys: string | any[], builder: any | ((value: any, schema: Schema) => Schema)): Schema; test(name: string, message: string, test: (value: any) => boolean, callbackStyleAsync?: boolean): Schema; - test(options: any): Schema; + test(options: TestOptions): Schema; transform(transformation: (currentValue: any, originalValue: any) => any): Schema; } +export interface StringSchemaConstructor { + (): StringSchema; + new(): StringSchema; +} + export interface StringSchema extends Schema { required(message?: string): StringSchema; min(limit: number | Ref, message?: string): StringSchema; @@ -71,6 +83,11 @@ export interface StringSchema extends Schema { uppercase(message?: string): StringSchema; } +export interface NumberSchemaConstructor { + (): NumberSchema; + new(): NumberSchema; +} + export interface NumberSchema extends Schema { required(message?: string): NumberSchema; min(limit: number | Ref, message?: string): NumberSchema; @@ -82,14 +99,29 @@ export interface NumberSchema extends Schema { round(type: "floor" | "ceil" | "trunc" | "round"): NumberSchema; } +export interface BooleanSchemaConstructor { + (): BooleanSchema; + new(): BooleanSchema; +} + export interface BooleanSchema extends Schema { } +export interface DateSchemaConstructor { + (): DateSchema; + new(): DateSchema; +} + export interface DateSchema extends Schema { min(limit: Date | string | Ref, message?: string): DateSchema; max(limit: Date | string | Ref, message?: string): DateSchema; } +export interface ArraySchemaConstructor { + (): ArraySchema; + new(): ArraySchema; +} + export interface ArraySchema extends Schema { of(type: Schema): ArraySchema; required(message?: string): ArraySchema; @@ -99,6 +131,11 @@ export interface ArraySchema extends Schema { compact(rejector: (value: any) => boolean): ArraySchema; } +export interface ObjectSchemaConstructor { + (): ObjectSchema; + new(): ObjectSchema; +} + export interface ObjectSchema extends Schema { shape(fields: any, noSortEdges?: Array<[string, string]>): ObjectSchema; from(fromKey: string, toKey: string, alias: boolean): ObjectSchema; @@ -108,6 +145,53 @@ export interface ObjectSchema extends Schema { } export interface ValidateOptions { + /** + * Only validate the input, and skip and coercion or transformation. Default - false + */ + strict?: boolean; + /** + * Teturn from validation methods on the first error rather than after all validations run. Default - true + */ + abortEarly?: boolean; + /** + * Remove unspecified keys from objects. Default - false + */ + stripUnknown?: boolean; + /** + * When false validations will not descend into nested schema (relevant for objects or arrays). Default - true + */ + recursive?: boolean; + /** + * Any context needed for validating schema conditions (see: when()) + */ + context?: object; +} + +export interface TestOptions { + /** + * Unique name identifying the test + */ + name?: string; + + /** + * Test function, determines schema validity + */ + test: (value: any) => boolean; + + /** + * The validation error message + */ + message?: string; + + /** + * Values passed to message for interpolation + */ + params?: object; + + /** + * Mark the test as exclusive, meaning only one of the same can be active at once + */ + exclusive?: boolean; } export interface SchemaDescription { diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index 218ed793fc..35d530dbb5 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -1,16 +1,35 @@ import * as yup from 'yup'; const schema = yup.object().shape({ - name: yup.string().required(), - age: yup.number().required().positive().integer(), - email: yup.string().email(), - website: yup.string().url(), - createdOn: yup.date().default(() => new Date()) + name: yup.string().required(), + age: yup.number().required().positive().integer(), + email: yup.string().email(), + website: yup.string().url(), + createdOn: yup.date().default(() => new Date()) }); // check validity schema.isValid({ - name: 'jimmy', - age: 24 + name: 'jimmy', + age: 24 }) .then(valid => valid /* => true */); + +class CustomDateSchema extends yup.date { + isWednesday(message?: string): CustomDateSchema { + return this.test({ + name: 'Wednesday', + // tslint:disable-next-line:no-invalid-template-strings + message: message || '${path} must be Wednesday', + test: value => true /* Check that day is Wednesday */, + }) as CustomDateSchema; + } +} +const date = () => new CustomDateSchema(); + +yup.object().shape({ + startDate: date().isWednesday().required() +}); +const valid = schema.isValidSync({ + startDate: '2017-11-29', +}); From cfd43ded948be39f27dba73ded05813fb8c23945 Mon Sep 17 00:00:00 2001 From: Vladyslav Tserman Date: Wed, 29 Nov 2017 16:07:55 -0800 Subject: [PATCH 102/322] Add missing properties, refactor `Schema.when` --- types/yup/index.d.ts | 7 ++++--- types/yup/tslint.json | 4 ++-- types/yup/yup-tests.ts | 11 +++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index de1d8d2f07..e7a8e29cde 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -4,8 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export as namespace yup; - export function reach(schema: Schema, path: string, value?: any, context?: any): Schema; export function addMethod(schemaType: Schema, name: string, method: () => Schema): void; export function ref(path: string, options: { contextPrefix: string }): Ref; @@ -42,9 +40,11 @@ export interface Schema { clone(): Schema; label(label: string): Schema; meta(metadata: any): Schema; + meta(): any; describe(): SchemaDescription; concat(schema: Schema): Schema; validate(value: any, options?: ValidateOptions, callback?: () => void): Promise; + validateSync(value: any, options?: ValidateOptions): any; isValid(value: any, options?: any, callback?: () => void): Promise; isValidSync(value: any, options?: any): boolean; cast(value: any): any; @@ -59,7 +59,7 @@ export interface Schema { typeError(message?: string): Schema; oneOf(arrayOfValues: any[], message?: string): Schema; notOneOf(arrayOfValues: any[], message?: string): Schema; - when(keys: string | any[], builder: any | ((value: any, schema: Schema) => Schema)): Schema; + when(keys: string | any[], builder: ((value: any, schema: Schema) => Schema) | object): Schema; test(name: string, message: string, test: (value: any) => boolean, callbackStyleAsync?: boolean): Schema; test(options: TestOptions): Schema; transform(transformation: (currentValue: any, originalValue: any) => any): Schema; @@ -140,6 +140,7 @@ export interface ObjectSchema extends Schema { shape(fields: any, noSortEdges?: Array<[string, string]>): ObjectSchema; from(fromKey: string, toKey: string, alias: boolean): ObjectSchema; noUnknown(onlyKnownKeys: boolean, message?: string): ObjectSchema; + transformKeys(callback: (key: any) => any): void camelCase(): ObjectSchema; constantCase(): ObjectSchema; } diff --git a/types/yup/tslint.json b/types/yup/tslint.json index 0fde820a9e..10c5efd5aa 100644 --- a/types/yup/tslint.json +++ b/types/yup/tslint.json @@ -1,7 +1,7 @@ -{ +{ "extends": "dtslint/dt.json", "rules": { "no-empty-interface": false, - "no-any-union": false + "no-any-union": true } } diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index 35d530dbb5..bba33755b1 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -33,3 +33,14 @@ yup.object().shape({ const valid = schema.isValidSync({ startDate: '2017-11-29', }); + +// test when +yup.object().shape({ + checkWednesday: yup.bool().required(), + name: yup.string().required(), + startDate: date() + .required() + .when(['checkWednesday', 'name'], (checkWednesday: boolean, name: string, schema: CustomDateSchema) => { + return checkWednesday ? schema.isWednesday() : schema; + }) +}); From 24ea87eba2b97630c5f1e80022405c8df4a2f1d2 Mon Sep 17 00:00:00 2001 From: Vladyslav Tserman Date: Wed, 29 Nov 2017 17:43:06 -0800 Subject: [PATCH 103/322] Add Generics, as well as some fixes --- types/yup/index.d.ts | 124 ++++++++++++--------- types/yup/yup-tests.ts | 245 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 291 insertions(+), 78 deletions(-) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index e7a8e29cde..a7f9f4a8d3 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -5,11 +5,12 @@ // TypeScript Version: 2.2 export function reach(schema: Schema, path: string, value?: any, context?: any): Schema; -export function addMethod(schemaType: Schema, name: string, method: () => Schema): void; -export function ref(path: string, options: { contextPrefix: string }): Ref; +export function addMethod(schemaType: Schema, name: string, method: (this: Schema) => Schema): void; +export function ref(path: string, options?: { contextPrefix: string }): Ref; export function lazy(fn: (value: any) => Schema): Lazy; +export function ValidationError(errors: string | string[], value: any, path: string, type?: any): ValidationError; -export const mixed: SchemaConstructor; +export const mixed: MixedSchemaConstructor; export const string: StringSchemaConstructor; export const number: NumberSchemaConstructor; export const boolean: BooleanSchemaConstructor; @@ -18,51 +19,40 @@ export const date: DateSchemaConstructor; export const array: ArraySchemaConstructor; export const object: ObjectSchemaConstructor; -export interface ValidationError { - errors: string | string[]; - value: any; - path: string; - inner?: ValidationError[]; -} - -export interface Ref { -} - -export interface Lazy { -} - -export interface SchemaConstructor { - (): Schema; - new(options?: any): Schema; -} - export interface Schema { - clone(): Schema; - label(label: string): Schema; - meta(metadata: any): Schema; + clone(): this; + label(label: string): this; + meta(metadata: any): this; meta(): any; describe(): SchemaDescription; - concat(schema: Schema): Schema; - validate(value: any, options?: ValidateOptions, callback?: () => void): Promise; - validateSync(value: any, options?: ValidateOptions): any; - isValid(value: any, options?: any, callback?: () => void): Promise; + concat(schema: this): this; + validate(value: U, options?: ValidateOptions): Promise; + validateSync(value: U, options?: ValidateOptions): ValidationError|U; + isValid(value: any, options?: any): Promise; isValidSync(value: any, options?: any): boolean; - cast(value: any): any; + cast(value: any, options?: any): any; isType(value: any): boolean; - strict(isStrict: boolean): Schema; - strip(stripField: boolean): Schema; - withMutation(builder: (current: Schema) => void): void; - default(value: any): Schema; - default(): any; - nullable(isNullable: boolean): Schema; - required(message?: string): Schema; - typeError(message?: string): Schema; - oneOf(arrayOfValues: any[], message?: string): Schema; - notOneOf(arrayOfValues: any[], message?: string): Schema; - when(keys: string | any[], builder: ((value: any, schema: Schema) => Schema) | object): Schema; - test(name: string, message: string, test: (value: any) => boolean, callbackStyleAsync?: boolean): Schema; - test(options: TestOptions): Schema; - transform(transformation: (currentValue: any, originalValue: any) => any): Schema; + strict(isStrict: boolean): this; + strip(strip: boolean): this; + withMutation(fn: (current: this) => void): void; + default(value?: any): this; + nullable(isNullable: boolean): this; + required(message?: string): this; + typeError(message?: string): this; + oneOf(arrayOfValues: any[], message?: string): this; + notOneOf(arrayOfValues: any[], message?: string): this; + when(keys: string | any[], builder: WhenOptions): this; + test(name: string, message: string, test: (value?: any) => boolean, callbackStyleAsync?: boolean): this; + test(options: TestOptions): this; + transform(fn: TransformFunction): this; +} + +export interface MixedSchemaConstructor { + (): MixedSchema; + new(options?: { type?: string, [key: string]: any }): MixedSchema; +} + +export interface MixedSchema extends Schema { } export interface StringSchemaConstructor { @@ -71,7 +61,6 @@ export interface StringSchemaConstructor { } export interface StringSchema extends Schema { - required(message?: string): StringSchema; min(limit: number | Ref, message?: string): StringSchema; max(limit: number | Ref, message?: string): StringSchema; matches(regex: RegExp, message?: string): StringSchema; @@ -89,7 +78,6 @@ export interface NumberSchemaConstructor { } export interface NumberSchema extends Schema { - required(message?: string): NumberSchema; min(limit: number | Ref, message?: string): NumberSchema; max(limit: number | Ref, message?: string): NumberSchema; positive(message?: string): NumberSchema; @@ -124,7 +112,6 @@ export interface ArraySchemaConstructor { export interface ArraySchema extends Schema { of(type: Schema): ArraySchema; - required(message?: string): ArraySchema; min(limit: number | Ref, message?: string): ArraySchema; max(limit: number | Ref, message?: string): ArraySchema; ensure(): ArraySchema; @@ -132,19 +119,32 @@ export interface ArraySchema extends Schema { } export interface ObjectSchemaConstructor { - (): ObjectSchema; + (fields?: any): ObjectSchema; new(): ObjectSchema; } export interface ObjectSchema extends Schema { shape(fields: any, noSortEdges?: Array<[string, string]>): ObjectSchema; - from(fromKey: string, toKey: string, alias: boolean): ObjectSchema; + from(fromKey: string, toKey: string, alias?: boolean): ObjectSchema; noUnknown(onlyKnownKeys: boolean, message?: string): ObjectSchema; - transformKeys(callback: (key: any) => any): void + transformKeys(callback: (key: any) => any): void; camelCase(): ObjectSchema; constantCase(): ObjectSchema; } +export type TransformFunction = ((this: T, value: any, originalValue: any) => any); + +export interface WhenOptionsBuilder { + (value: any, schema: T): T; + (v1: any, v2: any, schema: T): T; + (v1: any, v2: any, v3: any, schema: T): T; + (v1: any, v2: any, v3: any, v4: any, schema: T): T; +} + +export type WhenOptions = WhenOptionsBuilder +| { is: boolean | ((value: any) => boolean), then: any, otherwise: any } +| object; + export interface ValidateOptions { /** * Only validate the input, and skip and coercion or transformation. Default - false @@ -201,3 +201,29 @@ export interface SchemaDescription { meta: object; tests: string[]; } + +export interface ValidationError { + name: string; + value: any; + /** + * A string, indicating where there error was thrown. path is empty at the root level. + */ + path: string; + type: any; + /** + * array of error messages + */ + errors: string | string[]; + + /** + * In the case of aggregate errors, inner is an array of ValidationErrors throw earlier in the validation chain. + */ + inner?: ValidationError[]; +} + +export interface Ref { + [key: string]: any; +} + +export interface Lazy extends Schema { +} diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index bba33755b1..a22d96f594 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -1,46 +1,233 @@ import * as yup from 'yup'; +// tslint:disable-next-line:no-duplicate-imports +import { reach, date, Schema, ObjectSchema, ValidationError, MixedSchema, SchemaDescription, TestOptions, ValidateOptions } from 'yup'; -const schema = yup.object().shape({ - name: yup.string().required(), - age: yup.number().required().positive().integer(), - email: yup.string().email(), - website: yup.string().url(), - createdOn: yup.date().default(() => new Date()) +// reach function +let schema = yup.object().shape({ + nested: yup.object().shape({ + arr: yup.array().of( + yup.object().shape({ num: yup.number().max(4) }) + ) + }) + }); +reach(schema, 'nested.arr.num'); +reach(schema, 'nested.arr[].num'); + +// addMethod function +yup.addMethod(yup.date(), 'format', function(this: Schema) { + return this.clone(); }); -// check validity -schema.isValid({ - name: 'jimmy', - age: 24 -}) -.then(valid => valid /* => true */); +// ref function +schema = yup.object().shape({ + baz: yup.ref('foo.bar'), + foo: yup.object().shape({ + bar: yup.string() + }), + x: yup.ref('$x') +}); -class CustomDateSchema extends yup.date { - isWednesday(message?: string): CustomDateSchema { - return this.test({ +schema.cast({ foo: { bar: 'boom' } }, { context: { x: 5 } }); + +// lazy function +const node: ObjectSchema = yup.object().shape({ + id: yup.number(), + child: yup.lazy(() => + node.default(undefined) + ) +}); +const renderable = yup.lazy(value => { + switch (typeof value) { + case 'number': + return yup.number(); + case 'string': + return yup.string(); + default: + return yup.mixed(); + } +}); +const renderables = yup.array().of(renderable); + +// ValidationError +let error: ValidationError = yup.ValidationError('error', 'value', 'path'); +error = yup.ValidationError(['error', 'error2'], true, 'path'); +error = yup.ValidationError(['error', 'error2'], 5, 'path'); + +// mixed +let mixed: MixedSchema = yup.mixed(); +mixed.clone(); +mixed.label('label'); +mixed.meta({ meta: 'value' }); +mixed.describe().label; +mixed.describe().meta; +mixed.describe().tests; +mixed.describe().type; +mixed.concat(yup.string()); +mixed.validate({}); +mixed.validate({ hello: 'world' }, { strict: true }).then(value => value); +mixed.isValid(undefined, (valid: true) => true); +mixed.isValid({ hello: 'world' }).then(valid => valid); +mixed.cast({}); +mixed.isType('hello'); +mixed.strict(true); +mixed.strip(true); +mixed.withMutation(schema => {}); +mixed.default({ number: 5}); +mixed.default(() => ({ number: 5})); +mixed.default(); +mixed.nullable(true); +mixed.required(); +mixed.typeError('type error'); +mixed.oneOf(['hello', 'world'], 'message'); +mixed.notOneOf(['hello', 'world'], 'message'); +mixed.when('isBig', { + is: value => true, + then: yup.number().min(5), + otherwise: yup.number().min(0) +}); +mixed.when('isBig', { + is: true, + then: yup.number().min(5), + otherwise: yup.number().min(0) +}).when('$other', (value: any, schema: MixedSchema) => value === 4 ? schema.required() : schema); +// tslint:disable-next-line:no-invalid-template-strings +mixed.test('is-jimmy', '${path} is not Jimmy', value => value === 'jimmy'); +mixed.test({ + name: 'lessThan5', + exclusive: true, + // tslint:disable-next-line:no-invalid-template-strings + message: '${path} must be less than 5 characters', + test: value => value == null || value.length <= 5 +}); + +yup.string().transform(function(this, value: any, originalvalue: any) { + return this.isType(value) && value !== null ? value.toUpperCase() : value; +}); + +// Extending Schema Types +class ExtendsMixed extends yup.mixed {} +mixed = new ExtendsMixed(); + +class ExtendsMixed2 extends yup.mixed { + constructor() { + super({ type: 'CustomType' }); + } +} +mixed = new ExtendsMixed2(); + +/** + * Creating new Types + */ +class DateSchema extends yup.date { + isWednesday(message?: string): DateSchema { + return this.clone().test({ name: 'Wednesday', // tslint:disable-next-line:no-invalid-template-strings message: message || '${path} must be Wednesday', test: value => true /* Check that day is Wednesday */, - }) as CustomDateSchema; + }); } } -const date = () => new CustomDateSchema(); - yup.object().shape({ - startDate: date().isWednesday().required() -}); -const valid = schema.isValidSync({ + startDate: new DateSchema().isWednesday().required() +}).isValidSync({ startDate: '2017-11-29', }); -// test when -yup.object().shape({ - checkWednesday: yup.bool().required(), +// String schema +const strSchema = yup.string(); +strSchema.isValid('hello'); // => true +strSchema.required(); +strSchema.min(5, 'message'); +strSchema.max(5, 'message'); +strSchema.matches(/(hi|bye)/); +strSchema.email(); +strSchema.url(); +strSchema.ensure(); +strSchema.trim(); +strSchema.lowercase(); +strSchema.uppercase(); + +// Number schema +const numSchema = yup.number(); +numSchema.isValid(10); // => true +numSchema.min(5, 'message'); +numSchema.max(5, 'message'); +numSchema.positive(); +numSchema.negative(); +numSchema.integer(); +numSchema.truncate(); +numSchema.round('floor'); +numSchema.validate(5, { strict: true }).then(value => value).catch(err => err); + +// Boolean Schema +const boolSchema = yup.boolean(); +boolSchema.isValid(true); // => true + +// Date Schema +const dateSchema = yup.date(); +dateSchema.isValid(new Date()); // => true +dateSchema.min(new Date()); +dateSchema.min('2017-11-12'); +dateSchema.min(new Date(), 'message'); +dateSchema.min('2017-11-12', 'message'); +dateSchema.max(new Date()); +dateSchema.max('2017-11-12'); +dateSchema.max(new Date(), 'message'); +dateSchema.max('2017-11-12', 'message'); + +// Array Schema +const arrSchema = yup.array().of(yup.number().min(2)); +arrSchema.isValid([2, 3]); // => true +arrSchema.isValid([1, -24]); // => false +arrSchema.required(); +arrSchema.ensure(); +arrSchema.compact(value => value === null); + +// Object Schema +const objSchema = yup.object().shape({ name: yup.string().required(), - startDate: date() - .required() - .when(['checkWednesday', 'name'], (checkWednesday: boolean, name: string, schema: CustomDateSchema) => { - return checkWednesday ? schema.isWednesday() : schema; - }) + age: yup.number().required().positive().integer(), + email: yup.string().email(), + website: yup.string().url(), }); +yup.object().shape({ + num: yup.number() +}); +// or +yup.object({ + num: yup.number() +}); + +objSchema.from('prop', 'myProp'); +objSchema.from('prop', 'myProp', true); +objSchema.noUnknown(true); +objSchema.noUnknown(true, 'message'); +objSchema.transformKeys(key => key.toUpperCase()); +objSchema.camelCase(); +objSchema.constantCase(); + +const description: SchemaDescription = { + type: 'type', + label: 'label', + meta: { key: 'value' }, + tests: ['test1', 'test2'] +}; + +const testOptions: TestOptions = { + name: 'name', + test: value => true, + message: 'validation error message', + params: { param1: 'value'}, + exclusive: true +}; + +const validateOptions: ValidateOptions = { + strict: true, + abortEarly: true, + stripUnknown: true, + recursive: true, + context: { + key: 'value' + } +}; From 07e0e424475d884fee719d19fa5237ca3c70ae0b Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Thu, 30 Nov 2017 10:52:40 +0200 Subject: [PATCH 104/322] Add type definitions for shrink-ray --- types/shrink-ray/index.d.ts | 54 ++++++++++++++++++++++++++++ types/shrink-ray/shrink-ray-tests.ts | 6 ++++ types/shrink-ray/tsconfig.json | 22 ++++++++++++ types/shrink-ray/tslint.json | 1 + 4 files changed, 83 insertions(+) create mode 100644 types/shrink-ray/index.d.ts create mode 100644 types/shrink-ray/shrink-ray-tests.ts create mode 100644 types/shrink-ray/tsconfig.json create mode 100644 types/shrink-ray/tslint.json diff --git a/types/shrink-ray/index.d.ts b/types/shrink-ray/index.d.ts new file mode 100644 index 0000000000..a237c298fa --- /dev/null +++ b/types/shrink-ray/index.d.ts @@ -0,0 +1,54 @@ +// Type definitions for shrink-ray 0.1 +// Project: https://github.com/aickin/shrink-ray +// Definitions by: forabi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { RequestHandler, Request, Response } from 'express'; +import * as zlib from 'zlib'; +type FilterFunction = (req: Request, res: Response) => boolean; + +type Options = Partial<{ + cacheSize: number; + threshold: number; + zlib: Partial<{ + /** default: zlib.constants.Z_NO_FLUSH */ + flush?: number; + + /** default: zlib.constants.Z_FINISH */ + finishFlush?: number; + + /** default: 16*1024 */ + chunkSize?: number; + windowBits?: number; + + /** compression only */ + strategy?: number; + + /** deflate/inflate only, empty dictionary by default */ + dictionary?: any; + + /** compression only */ + level: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; + + /** compression only */ + memLevel: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; + }>; + brotli: { + lgblock: number; + lgwin: number; + mode: 0 | 1 | 2; + quality: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11; + }; + filter: FilterFunction; + cache(req: Request, res: Response): boolean; +}>; + +interface CreateMiddleware { + (options?: Options): RequestHandler; + filter: FilterFunction; +} + +declare const createMiddleware: CreateMiddleware; + +export = createMiddleware; diff --git a/types/shrink-ray/shrink-ray-tests.ts b/types/shrink-ray/shrink-ray-tests.ts new file mode 100644 index 0000000000..e221806b88 --- /dev/null +++ b/types/shrink-ray/shrink-ray-tests.ts @@ -0,0 +1,6 @@ +import * as express from 'express'; +import * as shrinkRay from 'shrink-ray'; + +const app = express(); + +app.use(shrinkRay()); diff --git a/types/shrink-ray/tsconfig.json b/types/shrink-ray/tsconfig.json new file mode 100644 index 0000000000..e90ce49102 --- /dev/null +++ b/types/shrink-ray/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "shrink-ray-tests.ts" + ] +} diff --git a/types/shrink-ray/tslint.json b/types/shrink-ray/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/shrink-ray/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 24ea09d1a531b3aacadf537120f16f1b3c3f3f73 Mon Sep 17 00:00:00 2001 From: Gregor Yushinov Date: Thu, 30 Nov 2017 10:34:56 +0100 Subject: [PATCH 105/322] Fixed connection options --- types/mongoose/index.d.ts | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index f86dea4f8a..7eb768f3c8 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -366,11 +366,11 @@ declare module "mongoose" { auth?: any; /** Use ssl connection (needs to have a mongod server with ssl support) (default: true) */ ssl?: boolean; - /** Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. */ - sslValidate?: object; - /** Reconnect on error (default: true) */ - poolSize?: number; /** Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) */ + sslValidate?: object; + /** Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. */ + poolSize?: number; + /** Reconnect on error (default: true) */ autoReconnect?: boolean; /** TCP KeepAlive on the socket with a X ms delay before start (default: 0). */ keepAlive?: number; @@ -380,10 +380,13 @@ declare module "mongoose" { socketTimeoutMS?: number; /** If the database authentication is dependent on another databaseName. */ authSource?: string; - /** Attempt to reconnect #times (default: 30) */ - retries?: number; + /** If you're connected to a single server or mongos proxy (as opposed to a replica set), + * the MongoDB driver will try to reconnect every reconnectInterval milliseconds for reconnectTries + * times, and give up afterward. When the driver gives up, the mongoose connection emits a + * reconnectFailed event. (default: 30) */ + reconnectTries?: number; /** Will wait # milliseconds between retries (default: 1000) */ - reconnectWait?: number; + reconnectInterval?: number; /** The name of the replicaset to connect to. */ replicaSet?: string; /** The current value of the parameter native_parser */ @@ -400,6 +403,14 @@ declare module "mongoose" { readPreference?: string; /** An object representing read preference tags, see: http://mongodb.github.io/node-mongodb-native/2.1/api/ReadPreference.html */ readPreferencetags?: object; + /** Triggers the server instance to call ismaster (default: true). */ + monitoring?: boolean; + /** The interval of calling ismaster when monitoring is enabled (default: 10000). */ + haInterval?: number; + /** Enable the wrapping of the callback in the current domain, disabled by default to avoid perf hit (default: false). */ + domainsEnabled?: boolean; + /** How long driver keeps waiting for servers to come back up (default: Number.MAX_VALUE) */ + bufferMaxEntries?: number; // TODO safe?: any; From 6f1245f8f19c795278962dc6c1b477bad9e27476 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Thu, 30 Nov 2017 12:03:44 +0200 Subject: [PATCH 106/322] Set "strictFunctionTypes": true --- types/shrink-ray/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/shrink-ray/tsconfig.json b/types/shrink-ray/tsconfig.json index e90ce49102..84b143dd64 100644 --- a/types/shrink-ray/tsconfig.json +++ b/types/shrink-ray/tsconfig.json @@ -6,6 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, + "strictFunctionTypes": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ From d7ca842aebb51baece1b60c6cf754b835f107d32 Mon Sep 17 00:00:00 2001 From: Jacob Bom Date: Thu, 30 Nov 2017 11:21:19 +0100 Subject: [PATCH 107/322] Fix some smaller things - Rename generated enums not present in schemas so that they have an underscore first in hopes of it being seen as private (and therefore not available to code) - Fix browser.bookmarks.import/export as per PR comments --- types/firefox-webext-browser/index.d.ts | 65 +++++++++++++------------ 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/types/firefox-webext-browser/index.d.ts b/types/firefox-webext-browser/index.d.ts index 2063abc93e..8a2d34b0be 100644 --- a/types/firefox-webext-browser/index.d.ts +++ b/types/firefox-webext-browser/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Jacob Bom // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 +// Generated using script at github.com/bomjacob/definitelytyped-firefox-webext-browser interface EventListener any> { addListener: (callback: T) => void; @@ -44,13 +45,13 @@ declare namespace browser.alarms { declare namespace browser.manifest { /* manifest types */ - type OptionalPermission = OptionalPermissionEnum; + type OptionalPermission = _OptionalPermission; - type Permission = string | OptionalPermission | PermissionEnum; + type Permission = string | OptionalPermission | _Permission; interface ProtocolHandler { name: string; - protocol: string | ProtocolHandlerProtocolEnum; + protocol: string | _ProtocolHandlerProtocol; uriTemplate: ExtensionURL | HttpURL; } @@ -75,7 +76,7 @@ declare namespace browser.manifest { icons?: { [key: number]: string; }; - incognito?: WebExtensionManifestIncognitoEnum; + incognito?: _WebExtensionManifestIncognito; background?: { page: ExtensionURL; persistent?: PersistentBackgroundProperty; @@ -105,7 +106,7 @@ declare namespace browser.manifest { theme_icons?: ThemeIcons[]; default_popup?: string; browser_style?: boolean; - default_area?: WebExtensionManifestBrowserActionDefaultAreaEnum; + default_area?: _WebExtensionManifestBrowserActionDefaultArea; }; chrome_settings_overrides?: { homepage?: string; @@ -219,9 +220,9 @@ declare namespace browser.manifest { strict_max_version?: string; } - type MatchPattern = string | string | MatchPatternEnum; + type MatchPattern = string | string | _MatchPattern; - type MatchPatternInternal = string | string | MatchPatternInternalEnum; + type MatchPatternInternal = string | string | _MatchPatternInternal; interface ContentScript { matches: MatchPattern[]; @@ -253,13 +254,13 @@ declare namespace browser.manifest { name: string; description: string; path: string; - type: NativeManifestTypeEnum; + type: _NativeManifestType; allowed_extensions: ExtensionID[]; } | { name: ExtensionID; description: string; data: any; - type: NativeManifestTypeEnum; + type: _NativeManifestType; }; interface ThemeType { @@ -365,14 +366,14 @@ declare namespace browser.manifest { timezones?: ExtensionURL; }; properties?: { - additional_backgrounds_alignment?: ThemeTypeAdditionalBackgroundsAlignmentEnum[]; - additional_backgrounds_tiling?: ThemeTypeAdditionalBackgroundsTilingEnum[]; + additional_backgrounds_alignment?: _ThemeTypeAdditionalBackgroundsAlignment[]; + additional_backgrounds_tiling?: _ThemeTypeAdditionalBackgroundsTiling[]; }; } type KeyName = string | string | string; - enum OptionalPermissionEnum { + enum _OptionalPermission { browserSettings = "browserSettings", cookies = "cookies", clipboardRead = "clipboardRead", @@ -391,7 +392,7 @@ declare namespace browser.manifest { tabs = "tabs" } - enum PermissionEnum { + enum _Permission { contextualIdentities = "contextualIdentities", downloads = "downloads", downloadsopen = "downloads.open", @@ -414,7 +415,7 @@ declare namespace browser.manifest { sessions = "sessions" } - enum ProtocolHandlerProtocolEnum { + enum _ProtocolHandlerProtocol { bitcoin = "bitcoin", geo = "geo", gopher = "gopher", @@ -437,35 +438,35 @@ declare namespace browser.manifest { xmpp = "xmpp" } - enum WebExtensionManifestIncognitoEnum { + enum _WebExtensionManifestIncognito { spanning = "spanning" } - enum WebExtensionManifestBrowserActionDefaultAreaEnum { + enum _WebExtensionManifestBrowserActionDefaultArea { navbar = "navbar", menupanel = "menupanel", tabstrip = "tabstrip", personaltoolbar = "personaltoolbar" } - enum MatchPatternEnum { + enum _MatchPattern { all_urls = "" } - enum MatchPatternInternalEnum { + enum _MatchPatternInternal { all_urls = "" } - enum NativeManifestTypeEnum { + enum _NativeManifestType { pkcs11 = "pkcs11", stdio = "stdio" } - enum NativeManifestTypeEnum { + enum _NativeManifestType { storage = "storage" } - enum ThemeTypeAdditionalBackgroundsAlignmentEnum { + enum _ThemeTypeAdditionalBackgroundsAlignment { bottom = "bottom", center = "center", left = "left", @@ -482,7 +483,7 @@ declare namespace browser.manifest { righttop = "right top" } - enum ThemeTypeAdditionalBackgroundsTilingEnum { + enum _ThemeTypeAdditionalBackgroundsTiling { norepeat = "no-repeat", repeat = "repeat", repeatx = "repeat-x", @@ -515,13 +516,13 @@ declare namespace browser.browserSettings { declare namespace browser.clipboard { type ArrayBuffer = any; - enum SetImageDataEnum { + enum _SetImageData { jpeg = "jpeg", png = "png" } /* clipboard functions */ - function setImageData(imageData: ArrayBuffer, imageType: SetImageDataEnum): void; + function setImageData(imageData: ArrayBuffer, imageType: _SetImageData): void; } declare namespace browser.contextualIdentities { @@ -768,7 +769,7 @@ declare namespace browser.downloads { exists?: boolean; } - enum DownloadMethodEnum { + enum _DownloadMethod { GET = "GET", POST = "POST" } @@ -780,7 +781,7 @@ declare namespace browser.downloads { incognito?: boolean; conflictAction?: FilenameConflictAction; saveAs?: boolean; - method?: DownloadMethodEnum; + method?: _DownloadMethod; headers?: Array<{ name: string; value: string; @@ -1956,6 +1957,10 @@ declare namespace browser.bookmarks { type?: BookmarkTreeNodeType; } + export {_import as import}; + + export {_export as export}; + /* bookmarks functions */ function get(idOrIdList: string | string[]): Promise; @@ -1989,9 +1994,9 @@ declare namespace browser.bookmarks { function removeTree(id: string): Promise; - function import_(): Promise; + function _import(): Promise; - function export_(): Promise; + function _export(): Promise; /* bookmarks events */ const onCreated: EventListener<(id: string, bookmark: BookmarkTreeNode) => void>; @@ -2470,10 +2475,10 @@ declare namespace browser.menus { editable: boolean; wasChecked?: boolean; checked?: boolean; - modifiers: OnClickDataModifiersEnum[]; + modifiers: _OnClickDataModifiers[]; } - enum OnClickDataModifiersEnum { + enum _OnClickDataModifiers { Shift = "Shift", Alt = "Alt", Command = "Command", From d9142c2d737c332ce10f1adc628f505a05d81f5f Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Thu, 30 Nov 2017 12:43:55 +0200 Subject: [PATCH 108/322] Prettify --- types/react-resolver/index.d.ts | 48 +++++++++---------- types/react-resolver/react-resolver-tests.tsx | 28 +++++------ 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/types/react-resolver/index.d.ts b/types/react-resolver/index.d.ts index 742260dc7c..b3d123ccca 100644 --- a/types/react-resolver/index.d.ts +++ b/types/react-resolver/index.d.ts @@ -7,14 +7,14 @@ import { ComponentType, StatelessComponent, Factory } from 'react'; export interface Resolver { - resolve( + resolve( factory: Factory

, - ): Promise<{ + ): Promise<{ data: D; Resolved: StatelessComponent

; - }>; + }>; - render

(factory: Factory

, root: Node | null): void; + render

(factory: Factory

, root: Node | null): void; } export const Resolver: Resolver; @@ -23,9 +23,9 @@ export type ResolveFn = (props: Props) => Promise; /** Use this for gaining access to a context as a prop without the boilerplate of setting `contextTypes`. */ export function context( - prop: K, + prop: K, ): ( - component: ComponentType, + component: ComponentType, ) => StatelessComponent>; /** @@ -34,36 +34,36 @@ export function context( * perform it only on the client. */ export function client( - loadingComponent: ComponentType, + loadingComponent: ComponentType, ): ( - component: ComponentType, + component: ComponentType, ) => StatelessComponent; export function resolve< - OwnProps, - K extends string, - V, - MoreProps = { [x: string]: any } + OwnProps, + K extends string, + V, + MoreProps = { [x: string]: any } >( - prop: K, - resolveFn: ResolveFn, + prop: K, + resolveFn: ResolveFn, ): ( - component: ComponentType, + component: ComponentType, ) => StatelessComponent; export function resolve< - OwnProps, - ResolvableProps = { [x: string]: any }, - MoreProps = { [x: string]: any } + OwnProps, + ResolvableProps = { [x: string]: any }, + MoreProps = { [x: string]: any } >( - resolversMap: { + resolversMap: { [K in keyof ResolvableProps]: ResolveFn< - OwnProps & MoreProps, - ResolvableProps[K] + OwnProps & MoreProps, + ResolvableProps[K] > - }, + }, ): ( - component: ComponentType< + component: ComponentType< OwnProps & { [K in keyof ResolvableProps]?: ResolvableProps[K] } - >, + >, ) => StatelessComponent; diff --git a/types/react-resolver/react-resolver-tests.tsx b/types/react-resolver/react-resolver-tests.tsx index 4c4314c063..1f19e4ff6d 100644 --- a/types/react-resolver/react-resolver-tests.tsx +++ b/types/react-resolver/react-resolver-tests.tsx @@ -11,23 +11,23 @@ interface ResolvedProps { } class Page extends React.Component { - render() { - return

Hello, {this.props.data}!
; - } + render() { + return
Hello, {this.props.data}!
; + } } const ResolvedPageWithSingleProp = resolve('data', async () => { - return new Promise(resolve => { - setTimeout(() => resolve('World'), 500); - }); + return new Promise(resolve => { + setTimeout(() => resolve('World'), 500); + }); })(Page); const ResolvedPageWithPropMap = resolve({ - data: async () => { - return new Promise(resolve => { - setTimeout(() => resolve('World'), 500); - }); - }, + data: async () => { + return new Promise(resolve => { + setTimeout(() => resolve('World'), 500); + }); + }, })(Page); expect().toExist(); @@ -36,9 +36,7 @@ expect().toExist(); // Resolver.render(() => , document.getElementById('app')); Resolver.resolve(() => { - return ( - - ); + return ; }).then(({ data, Resolved }) => { - expect(data).toBe('World'); + expect(data).toBe('World'); }); From 90d95fc43296f9a7fce902102b8a604b29e18ce4 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Thu, 30 Nov 2017 15:31:48 +0200 Subject: [PATCH 109/322] Try fix CI with strictFunctionTypes: false --- types/react-resolver/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-resolver/tsconfig.json b/types/react-resolver/tsconfig.json index c8d99b4c25..94a604e352 100644 --- a/types/react-resolver/tsconfig.json +++ b/types/react-resolver/tsconfig.json @@ -8,7 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, + "strictFunctionTypes": false, "baseUrl": "../", "typeRoots": [ "../" From a7491924a9a6782b9859671f712ce0539dc64921 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Thu, 30 Nov 2017 15:54:34 +0200 Subject: [PATCH 110/322] Try fix again --- types/react-resolver/index.d.ts | 10 +++++----- types/react-resolver/react-resolver-tests.tsx | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/types/react-resolver/index.d.ts b/types/react-resolver/index.d.ts index b3d123ccca..8afa3285a0 100644 --- a/types/react-resolver/index.d.ts +++ b/types/react-resolver/index.d.ts @@ -7,14 +7,14 @@ import { ComponentType, StatelessComponent, Factory } from 'react'; export interface Resolver { - resolve( + resolve

( factory: Factory

, ): Promise<{ - data: D; + data: any; Resolved: StatelessComponent

; }>; - render

(factory: Factory

, root: Node | null): void; + render(factory: Factory, root: Node | null): void; } export const Resolver: Resolver; @@ -22,11 +22,11 @@ export const Resolver: Resolver; export type ResolveFn = (props: Props) => Promise; /** Use this for gaining access to a context as a prop without the boilerplate of setting `contextTypes`. */ -export function context( +export function context( prop: K, ): ( component: ComponentType, -) => StatelessComponent>; +) => StatelessComponent>; /** * Use `@client(LoaderComponent)` (or `client(LoaderComponent)(YourComponent)`) diff --git a/types/react-resolver/react-resolver-tests.tsx b/types/react-resolver/react-resolver-tests.tsx index 1f19e4ff6d..ce41e6db4c 100644 --- a/types/react-resolver/react-resolver-tests.tsx +++ b/types/react-resolver/react-resolver-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Resolver, resolve } from 'react-resolver'; +import { Resolver, resolve, context } from 'react-resolver'; import * as expect from 'expect'; interface OwnProps { @@ -30,6 +30,8 @@ const ResolvedPageWithPropMap = resolve({ }, })(Page); +const PageWithContext = context('history')(Page); + expect().toExist(); expect().toExist(); From 57d94953c2602f63d2a413b23aee571a3ab7c411 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Thu, 30 Nov 2017 15:59:45 +0200 Subject: [PATCH 111/322] Fix again --- types/react-resolver/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-resolver/index.d.ts b/types/react-resolver/index.d.ts index 8afa3285a0..2b27d26d6a 100644 --- a/types/react-resolver/index.d.ts +++ b/types/react-resolver/index.d.ts @@ -22,11 +22,11 @@ export const Resolver: Resolver; export type ResolveFn = (props: Props) => Promise; /** Use this for gaining access to a context as a prop without the boilerplate of setting `contextTypes`. */ -export function context( +export function context( prop: K, ): ( component: ComponentType, -) => StatelessComponent>; +) => StatelessComponent>; /** * Use `@client(LoaderComponent)` (or `client(LoaderComponent)(YourComponent)`) From 5593cde710e9e5c599880c5f8987e70cd4703b43 Mon Sep 17 00:00:00 2001 From: 43081j <43081j@localhost> Date: Thu, 30 Nov 2017 14:40:55 +0000 Subject: [PATCH 112/322] add fake server options --- types/sinon/index.d.ts | 23 ++++++++++++----------- types/sinon/sinon-tests.ts | 10 ++++++++++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index 4c8f22a6f4..bc657ef79b 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Sinon 4.0 +// Type definitions for Sinon 4.1 // Project: http://sinonjs.org/ // Definitions by: William Sears // Jonathan Little @@ -11,10 +11,8 @@ // sinon uses DOM dependencies which are absent in browser-less environment like node.js // to avoid compiler errors this monkey patch is used // see more details in https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11351 -// tslint:disable no-empty-interface -interface Event { } -interface Document { } -// tslint:enable no-empty-interface +interface Event { } // tslint:disable-line no-empty-interface +interface Document { } // tslint:disable-line no-empty-interface declare namespace Sinon { interface SinonSpyCallApi { @@ -293,14 +291,10 @@ declare namespace Sinon { FakeXMLHttpRequest: SinonFakeXMLHttpRequest; } - interface SinonFakeServer { + interface SinonFakeServer extends SinonFakeServerOptions { // Properties - autoRespond: boolean; - autoRespondAfter: number; - fakeHTTPMethods: boolean; getHTTPMethod(request: SinonFakeXMLHttpRequest): string; requests: SinonFakeXMLHttpRequest[]; - respondImmediately: boolean; // Methods respondWith(body: string): void; @@ -322,8 +316,15 @@ declare namespace Sinon { restore(): void; } + interface SinonFakeServerOptions { + autoRespond?: boolean; + autoRespondAfter?: number; + fakeHTTPMethods?: boolean; + respondImmediately?: boolean; + } + interface SinonFakeServerStatic { - create(): SinonFakeServer; + create(options?: SinonFakeServerOptions): SinonFakeServer; } interface SinonStatic { diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index 33ac93f595..1fafb259ee 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -230,6 +230,15 @@ function testSpy() { sinon.spy().calledImmediatelyBefore(otherSpy); } +function testFakeServer() { + sinon.fakeServer.create({ + autoRespond: true, + autoRespondAfter: 3, + fakeHTTPMethods: true, + respondImmediately: false + }); +} + testOne(); testTwo(); testThree(); @@ -249,6 +258,7 @@ testGetterStub(); testSetterStub(); testValueStub(); testThrowsStub(); +testFakeServer(); const clock = sinon.useFakeTimers(); clock.setSystemTime(1000); From b0486477ad5ba9895f28f565c0d5238046df8b2c Mon Sep 17 00:00:00 2001 From: Rich Tagger Date: Thu, 30 Nov 2017 12:48:36 -0800 Subject: [PATCH 113/322] Update CharacterMetadata.applyEntity and Modifier.applyEntity null is how removal is indicated --- types/draft-js/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index 3eaa05aa30..ccc0fcf49e 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -797,7 +797,7 @@ declare namespace Draft { class CharacterMetadata { static applyStyle(record: CharacterMetadata, style: string): CharacterMetadata; static removeStyle(record: CharacterMetadata, style: string): CharacterMetadata; - static applyEntity(record: CharacterMetadata, entityKey: string): CharacterMetadata; + static applyEntity(record: CharacterMetadata, entityKey: string | null): CharacterMetadata; static applyEntity(record: CharacterMetadata): CharacterMetadata; /** * Use this function instead of the `CharacterMetadata` constructor. @@ -894,7 +894,7 @@ declare namespace Draft { static setBlockData(contentState: ContentState, selectionState: SelectionState, blockData: Immutable.Map): ContentState; static mergeBlockData(contentState: ContentState, selectionState: SelectionState, blockData: Immutable.Map): ContentState; - static applyEntity(contentState: ContentState, selectionState: SelectionState, entityKey: string): ContentState; + static applyEntity(contentState: ContentState, selectionState: SelectionState, entityKey: string | null): ContentState; } class RichTextEditorUtil { From c55bd19de2162ed180d827788f6c3aee55292258 Mon Sep 17 00:00:00 2001 From: Brenton Simpson Date: Wed, 29 Nov 2017 16:24:37 -0800 Subject: [PATCH 114/322] Renamed jss to dvtng-jss Fixes #19974 The type definitions in `@types/jss` don't match the `jss` package on npm, which has nearly 400k monthly downloads. I'm not sure where to put the definitions currently squatting at `jss`, as it [doesn't appear that](https://www.npmjs.com/~dvtng) @dvtng has published them. --- types/{jss/jss-tests.ts => dvtng-jss/dvtng-jss-tests.ts} | 0 types/{jss => dvtng-jss}/index.d.ts | 0 types/{jss => dvtng-jss}/tsconfig.json | 4 ++-- types/{jss => dvtng-jss}/tslint.json | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename types/{jss/jss-tests.ts => dvtng-jss/dvtng-jss-tests.ts} (100%) rename types/{jss => dvtng-jss}/index.d.ts (100%) rename types/{jss => dvtng-jss}/tsconfig.json (93%) rename types/{jss => dvtng-jss}/tslint.json (100%) diff --git a/types/jss/jss-tests.ts b/types/dvtng-jss/dvtng-jss-tests.ts similarity index 100% rename from types/jss/jss-tests.ts rename to types/dvtng-jss/dvtng-jss-tests.ts diff --git a/types/jss/index.d.ts b/types/dvtng-jss/index.d.ts similarity index 100% rename from types/jss/index.d.ts rename to types/dvtng-jss/index.d.ts diff --git a/types/jss/tsconfig.json b/types/dvtng-jss/tsconfig.json similarity index 93% rename from types/jss/tsconfig.json rename to types/dvtng-jss/tsconfig.json index d22eb9d75e..3d47f98d9f 100644 --- a/types/jss/tsconfig.json +++ b/types/dvtng-jss/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "jss-tests.ts" + "dvtng-jss-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jss/tslint.json b/types/dvtng-jss/tslint.json similarity index 100% rename from types/jss/tslint.json rename to types/dvtng-jss/tslint.json From 57a67f6f8f57e47aa1f6f07bfb3d39118bec83d8 Mon Sep 17 00:00:00 2001 From: Austin Turner Date: Sat, 25 Nov 2017 21:22:33 -0700 Subject: [PATCH 115/322] Added typings for sticky-cluster --- types/sticky-cluster/index.d.ts | 25 ++++++++++++++ types/sticky-cluster/sticky-cluster-tests.ts | 34 ++++++++++++++++++++ types/sticky-cluster/tsconfig.json | 23 +++++++++++++ types/sticky-cluster/tslint.json | 1 + 4 files changed, 83 insertions(+) create mode 100644 types/sticky-cluster/index.d.ts create mode 100644 types/sticky-cluster/sticky-cluster-tests.ts create mode 100644 types/sticky-cluster/tsconfig.json create mode 100644 types/sticky-cluster/tslint.json diff --git a/types/sticky-cluster/index.d.ts b/types/sticky-cluster/index.d.ts new file mode 100644 index 0000000000..7d51cad34f --- /dev/null +++ b/types/sticky-cluster/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for sticky-cluster 0.3 +// Project: https://github.com/uqee/sticky-cluster +// Definitions by: Austin Turner +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// +import * as http from 'http'; + +declare namespace stickyCluster { + type InitializeFn = (callback: Callback) => void; + type Callback = (server: http.Server) => void; + interface Options { + concurrency?: number; + port?: number; + debug?: boolean; + prefix?: string; + env?: (index: number) => { stickycluster_worker_index: number }; + hardShutdownDelay?: number; + errorHandler?: (err: any) => void; + } +} + +declare function stickyCluster(callback: stickyCluster.InitializeFn, options?: stickyCluster.Options): void; +export = stickyCluster; diff --git a/types/sticky-cluster/sticky-cluster-tests.ts b/types/sticky-cluster/sticky-cluster-tests.ts new file mode 100644 index 0000000000..e730275d78 --- /dev/null +++ b/types/sticky-cluster/sticky-cluster-tests.ts @@ -0,0 +1,34 @@ +import stickyCluster = require('sticky-cluster'); +import * as express from 'express'; +import * as http from 'http'; + +/** test with all params */ +stickyCluster( + (callback) => { + const app = express(); + const server = http.createServer(app); + + // don't do server.listen(), just pass the server instance into the callback + callback(server); + }, + { + prefix: 'sticky-cluster:', + concurrency: 10, + port: 3000, + debug: true, + hardShutdownDelay: 60 * 1000, + env: (index) => ({ stickycluster_worker_index: index }), + errorHandler: (err) => { console.log(err); process.exit(1); } + } +); + +/** test with no params */ +stickyCluster( + (callback) => { + const app = express(); + const server = http.createServer(app); + + // don't do server.listen(), just pass the server instance into the callback + callback(server); + } +); diff --git a/types/sticky-cluster/tsconfig.json b/types/sticky-cluster/tsconfig.json new file mode 100644 index 0000000000..dcfc338f93 --- /dev/null +++ b/types/sticky-cluster/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sticky-cluster-tests.ts" + ] +} diff --git a/types/sticky-cluster/tslint.json b/types/sticky-cluster/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sticky-cluster/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bc46f5f87e0f74a0e6b0029b88e107e3a52c5b5c Mon Sep 17 00:00:00 2001 From: Vladyslav Tserman Date: Fri, 1 Dec 2017 01:45:25 -0800 Subject: [PATCH 116/322] For new packages, tslint conf should only "extends": "dtslint/dt.json" --- types/yup/index.d.ts | 3 +++ types/yup/tslint.json | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index a7f9f4a8d3..403c1cac37 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -52,6 +52,7 @@ export interface MixedSchemaConstructor { new(options?: { type?: string, [key: string]: any }): MixedSchema; } +// tslint:disable-next-line:no-empty-interface export interface MixedSchema extends Schema { } @@ -92,6 +93,7 @@ export interface BooleanSchemaConstructor { new(): BooleanSchema; } +// tslint:disable-next-line:no-empty-interface export interface BooleanSchema extends Schema { } @@ -225,5 +227,6 @@ export interface Ref { [key: string]: any; } +// tslint:disable-next-line:no-empty-interface export interface Lazy extends Schema { } diff --git a/types/yup/tslint.json b/types/yup/tslint.json index 10c5efd5aa..f93cf8562a 100644 --- a/types/yup/tslint.json +++ b/types/yup/tslint.json @@ -1,7 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-empty-interface": false, - "no-any-union": true - } + "extends": "dtslint/dt.json" } From d4efe01e5c6d48c8a6c13e271d44dc589961aa8e Mon Sep 17 00:00:00 2001 From: Nam Nguyen Thanh Date: Fri, 1 Dec 2017 16:46:01 +0700 Subject: [PATCH 117/322] Introduce new param for changeView --- types/fullcalendar/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fullcalendar/index.d.ts b/types/fullcalendar/index.d.ts index 196de10898..4b0f600c6a 100644 --- a/types/fullcalendar/index.d.ts +++ b/types/fullcalendar/index.d.ts @@ -995,7 +995,7 @@ declare global { /** * Immediately switches to a different view. */ - fullCalendar(method: 'changeView', viewName: string): void; + fullCalendar(method: 'changeView', viewName: string, dateOrRange: moment.Moment | Date | string | TimeRange): void; /** * Moves the calendar one step back (either by a month, week, or day). From daaa8688f3a125835f192b2e0a5fb5d05e3403ca Mon Sep 17 00:00:00 2001 From: daphnes Date: Fri, 1 Dec 2017 13:13:29 +0100 Subject: [PATCH 118/322] [ElasticSearch] skipped missing in Shards & sort values for each document returned are also returned as part of the response --- types/elasticsearch/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index 8acc7e4097..1552652edd 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -131,6 +131,7 @@ declare module Elasticsearch { total: number; successful: number; failed: number; + skipped: number; } /** @@ -632,6 +633,7 @@ declare module Elasticsearch { fields?: any; highlight?: any; inner_hits?: any; + sort?: string[]; }[]; }; aggregations?: any; From 6ee4d7b6bcb93647dacab7c6471877a839d946f1 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Fri, 1 Dec 2017 16:08:04 +0200 Subject: [PATCH 119/322] Add types for fuzzyset.js This is basically a copy of `fuzzyset` types, but `fuzzyset.js` is a different npm package. --- types/fuzzyset.js/fuzzyset.js-tests.ts | 10 ++++++++++ types/fuzzyset.js/index.d.ts | 22 ++++++++++++++++++++++ types/fuzzyset.js/tsconfig.json | 22 ++++++++++++++++++++++ types/fuzzyset.js/tslint.json | 1 + 4 files changed, 55 insertions(+) create mode 100644 types/fuzzyset.js/fuzzyset.js-tests.ts create mode 100644 types/fuzzyset.js/index.d.ts create mode 100644 types/fuzzyset.js/tsconfig.json create mode 100644 types/fuzzyset.js/tslint.json diff --git a/types/fuzzyset.js/fuzzyset.js-tests.ts b/types/fuzzyset.js/fuzzyset.js-tests.ts new file mode 100644 index 0000000000..97a0d45008 --- /dev/null +++ b/types/fuzzyset.js/fuzzyset.js-tests.ts @@ -0,0 +1,10 @@ +import FuzzySet = require('fuzzyset.js'); + +const fuzzyset: FuzzySet = FuzzySet(['coucou', 'foo', 'bar', 'toto']); +const results = fuzzyset.get('foo'); + +fuzzyset.length(); + +fuzzyset.isEmpty(); + +fuzzyset.values(); diff --git a/types/fuzzyset.js/index.d.ts b/types/fuzzyset.js/index.d.ts new file mode 100644 index 0000000000..df344f18d7 --- /dev/null +++ b/types/fuzzyset.js/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for fuzzyset.js 0.0 +// Project: https://github.com/Glench/fuzzyset.js +// Definitions by: Louis Grignon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface FuzzySet { + get(candidate: string): Array<[number, string]>; + add(value: string): boolean; + length(): number; + isEmpty(): boolean; + values(): string[]; +} + +declare function FuzzySet( + source: string[], + useLevenshtein?: boolean, + gramSizeLower?: number, + gramSizeUpper?: number, +): FuzzySet; + +export = FuzzySet; +export as namespace FuzzySet; diff --git a/types/fuzzyset.js/tsconfig.json b/types/fuzzyset.js/tsconfig.json new file mode 100644 index 0000000000..285a64eaf7 --- /dev/null +++ b/types/fuzzyset.js/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "fuzzyset.js-tests.ts" + ] +} diff --git a/types/fuzzyset.js/tslint.json b/types/fuzzyset.js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/fuzzyset.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 09bbf1cec87650424506d959504d262070b88a09 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Fri, 1 Dec 2017 16:21:09 +0200 Subject: [PATCH 120/322] Add "strictFunctionTypes": true --- types/fuzzyset.js/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/fuzzyset.js/tsconfig.json b/types/fuzzyset.js/tsconfig.json index 285a64eaf7..a1eeb06b97 100644 --- a/types/fuzzyset.js/tsconfig.json +++ b/types/fuzzyset.js/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 2c3a4232beece64ed9947db3ab34d127fdcc7865 Mon Sep 17 00:00:00 2001 From: Kevin Ross Date: Fri, 1 Dec 2017 12:31:15 -0600 Subject: [PATCH 121/322] Add and additional basic test for backward compatibility --- types/react-autosuggest/index.d.ts | 2 +- .../react-autosuggest-tests.tsx | 126 +++++++++++++++++- 2 files changed, 126 insertions(+), 2 deletions(-) diff --git a/types/react-autosuggest/index.d.ts b/types/react-autosuggest/index.d.ts index 78c11d6878..c7f46200d1 100644 --- a/types/react-autosuggest/index.d.ts +++ b/types/react-autosuggest/index.d.ts @@ -11,7 +11,7 @@ import * as React from 'react'; -declare class Autosuggest extends React.Component> {} +declare class Autosuggest extends React.Component> {} export = Autosuggest; diff --git a/types/react-autosuggest/react-autosuggest-tests.tsx b/types/react-autosuggest/react-autosuggest-tests.tsx index 753af3a552..3747e8457b 100644 --- a/types/react-autosuggest/react-autosuggest-tests.tsx +++ b/types/react-autosuggest/react-autosuggest-tests.tsx @@ -15,9 +15,133 @@ function escapeRegexCharacters(str: string): string { return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); } +export class ReactAutosuggestBasicTest extends React.Component { + // region Fields + static languages: Language[] = [ + { + name: 'C', + year: 1972 + }, { + name: 'C#', + year: 2000 + }, { + name: 'C++', + year: 1983 + }, { + name: 'Clojure', + year: 2007 + }, { + name: 'Elm', + year: 2012 + }, { + name: 'Go', + year: 2009 + }, { + name: 'Haskell', + year: 1990 + }, { + name: 'Java', + year: 1995 + }, { + name: 'Javascript', + year: 1995 + }, { + name: 'Perl', + year: 1987 + }, { + name: 'PHP', + year: 1995 + }, { + name: 'Python', + year: 1991 + }, { + name: 'Ruby', + year: 1995 + }, { + name: 'Scala', + year: 2003 + } + ]; + // endregion region Constructor + constructor(props: any) { + super(props); + + this.state = { + value: '', + suggestions: this.getSuggestions('') + }; + } + // endregion region Rendering methods + render(): JSX.Element { + const {value, suggestions} = this.state; + const inputProps = { + placeholder: `Type 'c'`, + value, + onChange: this + .onChange + .bind(this) + }; + + const theme = { + input: 'themed-input-class', + container: 'themed-container-class', + suggestionFocused: 'active', + sectionTitle: { color: 'blue' } + }; + + return ; + } + + protected onSuggestionsSelected(event: React.FormEvent, data: Autosuggest.SuggestionSelectedEventData): void { + alert(`Selected language is ${data.suggestion.name} (${data.suggestion.year}).`); + } + + protected renderSuggestion(suggestion: Language, params: Autosuggest.RenderSuggestionParams): JSX.Element { + const className = params.isHighlighted ? "highlighted" : undefined; + return {suggestion.name}; + } + // endregion region Event handlers + protected onChange(event: React.FormEvent, {newValue, method}: any): void { + this.setState({value: newValue}); + } + + protected onSuggestionsFetchRequested({value}: any): void { + this.setState({ + suggestions: this.getSuggestions(value) + }); + } + // endregion region Helper methods + protected getSuggestions(value: string): Language[] { + const escapedValue = escapeRegexCharacters(value.trim()); + + if (escapedValue === '') { + return []; + } + + const regex = new RegExp('^' + escapedValue, 'i'); + + return ReactAutosuggestBasicTest + .languages + .filter(language => regex.test(language.name)); + } + + protected getSuggestionValue(suggestion: Language): string { return suggestion.name; } + // endregion +} + const LanguageAutosuggest = Autosuggest as { new (): Autosuggest }; -export class ReactAutosuggestBasicTest extends React.Component { +export class ReactAutosuggestTypedTest extends React.Component { // region Fields static languages: Language[] = [ { From 990f8c840593666d7bb418487e4fb8fa10e55fde Mon Sep 17 00:00:00 2001 From: Brenton Simpson Date: Wed, 29 Nov 2017 17:36:38 -0800 Subject: [PATCH 122/322] Added types for jss These are rudimentary type definitions for `jss`. I optimized for utility over thoroughness - they can probably be improved. Closes https://github.com/cssinjs/jss/issues/362 (and might close https://github.com/cssinjs/jss/issues/361) --- types/jss/index.d.ts | 127 ++++++++++++++++++++++++++++++++++++++++ types/jss/jss-tests.ts | 62 ++++++++++++++++++++ types/jss/tsconfig.json | 24 ++++++++ types/jss/tslint.json | 1 + 4 files changed, 214 insertions(+) create mode 100644 types/jss/index.d.ts create mode 100644 types/jss/jss-tests.ts create mode 100644 types/jss/tsconfig.json create mode 100644 types/jss/tslint.json diff --git a/types/jss/index.d.ts b/types/jss/index.d.ts new file mode 100644 index 0000000000..d0136216ed --- /dev/null +++ b/types/jss/index.d.ts @@ -0,0 +1,127 @@ +// Type definitions for jss 9.3 +// Project: https://github.com/cssinjs/jss#readme +// Definitions by: Brenton Simpson +// Oleg Slobodskoi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export interface Rule { + className: string; + selector: string; + applyTo(element: HTMLElement): void; + prop(key: string): string; + prop(key: string, value: any): this; + toJSON(): string; +} +export interface StyleSheet { + // Gives auto-completion on the rules declared in `createStyleSheet` without + // causing errors for rules added dynamically after creation. + classes: { + [K in keyof T]: string; + } & { [key: string]: string }; + options: any; + linked: boolean; + attached: boolean; + /** + * Attach renderable to the render tree. + */ + attach(): this; + /** + * Remove renderable from render tree. + */ + detach(): this; + /** + * Add a rule to the current stylesheet. + * Will insert a rule also after the stylesheet has been rendered first time. + */ + addRule(style: Style, options?: Partial): Rule; + addRule(name: string, style: Style, options?: Partial): Rule; + /** + * Create and add rules. + * Will render also after Style Sheet was rendered the first time. + */ + addRules(styles: { [key: string]: Style }, options?: Partial): Rule[]; + /** + * Get a rule by name. + */ + getRule(name: string): Rule; + /** + * Delete a rule by name. + * Returns `true`: if rule has been deleted from the DOM. + */ + deleteRule(name: string): boolean; + /** + * Get index of a rule. + */ + indexOf(rule: Rule): number; + /** + * Update the function values with a new data. + */ + update(data?: {}): this; + update(name: string, data: {}): this; + /** + * Convert rules to a CSS string. + */ + toString(options?: { indent?: number }): string; +} +export type GenerateClassName = (rule: Rule, sheet?: StyleSheet) => string; +export interface Style { + [key: string]: any; +} +export interface JSSPlugin { + [key: string]: () => Partial<{ + onCreateRule(name: string, style: Style, options: RuleOptions): Rule, + onProcessRule(rule: Rule, sheet: StyleSheet): void, + onProcessStyle(style: Style, rule: Rule, sheet: StyleSheet): Style, + onProcessSheet(sheet: StyleSheet): void, + onChangeValue(value: any, prop: string, rule: Rule): any, + onUpdate(data: {}, rule: Rule, sheet: StyleSheet): void, + }>; +} +export interface JSSOptions { + createGenerateClassName(): GenerateClassName; + plugins: ReadonlyArray; + virtual: boolean; + insertionPoint: string | HTMLElement; +} +export interface RuleFactoryOptions { + selector: string; + classes: { [key: string]: string }; + sheet: StyleSheet; + index: number; + jss: JSS; + generateClassName: GenerateClassName; +} +export interface RuleOptions { + index: number; + className: string; +} +declare class JSS { + constructor(options?: Partial); + createStyleSheet( + styles: T, + options?: Partial<{ + media: string, + meta: string, + link: boolean, + element: HTMLStyleElement, + index: number, + generateClassName: GenerateClassName, + classNamePrefix: string, + }>, + ): StyleSheet; + removeStyleSheet(sheet: StyleSheet): this; + setup(options?: Partial): this; + use(plugin: JSSPlugin): this; + createRule(style: Style, options?: Partial): Rule; + createRule(name: string, style: Style, options?: Partial): Rule; +} +/** + * Creates a new instance of JSS. + */ +export function create(options?: Partial): JSS; +declare const sharedInstance: JSS; +/** + * A global JSS instance. + */ +export default sharedInstance; diff --git a/types/jss/jss-tests.ts b/types/jss/jss-tests.ts new file mode 100644 index 0000000000..0cf3f51350 --- /dev/null +++ b/types/jss/jss-tests.ts @@ -0,0 +1,62 @@ +// API docs at http://cssinjs.org/js-api + +import { + create as createJSS, + default as sharedInstance +} from 'jss'; + +const jss = createJSS().setup({}); + +const styleSheet = jss.createStyleSheet( + { + ruleWithMockObservable: { + subscribe() {} + }, + container: { + display: 'flex', + width: 100, + opacity: .5, + }, + }, + { + link: true, + } +).attach(); + +styleSheet.classes.container; // $ExpectType string +styleSheet.classes.ruleWithMockObservable; // $ExpectType string + +const rule = styleSheet.addRule('dynamicRule', { color: 'indigo' }); +rule.prop('border-radius', 5).prop('color'); // $ExpectType string +styleSheet.classes.dynamicRule; // $ExpectType string + +styleSheet.deleteRule('dynamicRule'); + +// test that `addRule` supports the shorthand signature +const dynamicRule = styleSheet.addRule({ color: 'red' }); + +const div = document.createElement('div'); +dynamicRule.applyTo(div); + +const containerRule = styleSheet.getRule('container'); +const containerJSON = containerRule.toJSON(); +const css = styleSheet.toString(); + +styleSheet.addRules({ + rule1: { + fontFamily: 'Roboto', + color: '#FFFFFF', + }, + rule2: { + fontFamily: 'Inconsolata', + fontSize: 17, + }, +}); + +styleSheet.detach(); + +sharedInstance.createStyleSheet({ + container: { + background: '#000099', + } +}); diff --git a/types/jss/tsconfig.json b/types/jss/tsconfig.json new file mode 100644 index 0000000000..f34791192c --- /dev/null +++ b/types/jss/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jss-tests.ts" + ] +} diff --git a/types/jss/tslint.json b/types/jss/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jss/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bd0c4e78c4fa6bbe06621bb49a3dc4abe7a18b59 Mon Sep 17 00:00:00 2001 From: Brenton Simpson Date: Fri, 1 Dec 2017 11:29:26 -0800 Subject: [PATCH 123/322] Added borderRadius to CSSProperties Fixes https://github.com/smyte/jsxstyle/issues/92 --- types/react/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index e41299fdb5..265441ba75 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -1045,6 +1045,11 @@ declare namespace React { */ borderLeftWidth?: CSSWideKeyword | any; + /** + * Shorthand property that sets the rounding of all four corners. + */ + borderRadius?: CSSWideKeyword | any; + /** * Shorthand property that defines the border-width, border-style and border-color of an element's right border * in a single declaration. Note that you can use the corresponding longhand properties to set specific From fdf53c6dbd141d0bfc199ccc325c8d14894e389e Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Sat, 2 Dec 2017 01:23:21 +0200 Subject: [PATCH 124/322] Improve definition of .get --- types/fuzzyset.js/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/fuzzyset.js/index.d.ts b/types/fuzzyset.js/index.d.ts index df344f18d7..2b125be4c7 100644 --- a/types/fuzzyset.js/index.d.ts +++ b/types/fuzzyset.js/index.d.ts @@ -4,7 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface FuzzySet { - get(candidate: string): Array<[number, string]>; + get(candidate: string, defaultValue?: string, minScore?: number): Array<[number, string]> | undefined; + get(candidate: string, minScore?: number): Array<[number, string]> | undefined; add(value: string): boolean; length(): number; isEmpty(): boolean; From e0682297ccd10006fd55d72c7978ea05b52b01be Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Sat, 2 Dec 2017 01:24:18 +0200 Subject: [PATCH 125/322] Fix --- types/fuzzyset.js/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/fuzzyset.js/index.d.ts b/types/fuzzyset.js/index.d.ts index 2b125be4c7..2ddb86ba87 100644 --- a/types/fuzzyset.js/index.d.ts +++ b/types/fuzzyset.js/index.d.ts @@ -5,7 +5,6 @@ interface FuzzySet { get(candidate: string, defaultValue?: string, minScore?: number): Array<[number, string]> | undefined; - get(candidate: string, minScore?: number): Array<[number, string]> | undefined; add(value: string): boolean; length(): number; isEmpty(): boolean; From 09b1e56450ff1bababd01d65b5fbd90611ac0243 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Sat, 2 Dec 2017 01:25:33 +0200 Subject: [PATCH 126/322] Fix again --- types/fuzzyset.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fuzzyset.js/index.d.ts b/types/fuzzyset.js/index.d.ts index 2ddb86ba87..32b03f4379 100644 --- a/types/fuzzyset.js/index.d.ts +++ b/types/fuzzyset.js/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface FuzzySet { - get(candidate: string, defaultValue?: string, minScore?: number): Array<[number, string]> | undefined; + get(candidate: string, defaultValue: T | undefined, minScore?: number): Array<[number, string]> | T | null; add(value: string): boolean; length(): number; isEmpty(): boolean; From 38fc62bbcfa796a3f2079ec00e81c31e253f427a Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Sat, 2 Dec 2017 01:25:54 +0200 Subject: [PATCH 127/322] Fix again --- types/fuzzyset.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fuzzyset.js/index.d.ts b/types/fuzzyset.js/index.d.ts index 32b03f4379..66984d28eb 100644 --- a/types/fuzzyset.js/index.d.ts +++ b/types/fuzzyset.js/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface FuzzySet { - get(candidate: string, defaultValue: T | undefined, minScore?: number): Array<[number, string]> | T | null; + get(candidate: string, defaultValue?: T | undefined, minScore?: number): Array<[number, string]> | T | null; add(value: string): boolean; length(): number; isEmpty(): boolean; From e5511020a462a77459a34cbe8661c6d5dd1cbf3c Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Sat, 2 Dec 2017 01:30:20 +0200 Subject: [PATCH 128/322] Add default type parameter --- types/fuzzyset.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fuzzyset.js/index.d.ts b/types/fuzzyset.js/index.d.ts index 66984d28eb..55b7207957 100644 --- a/types/fuzzyset.js/index.d.ts +++ b/types/fuzzyset.js/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface FuzzySet { - get(candidate: string, defaultValue?: T | undefined, minScore?: number): Array<[number, string]> | T | null; + get(candidate: string, defaultValue?: T | undefined, minScore?: number): Array<[number, string]> | T | null; add(value: string): boolean; length(): number; isEmpty(): boolean; From 1ce7e77601387101862388a6b99a1c2f85edc66b Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Sat, 2 Dec 2017 01:34:36 +0200 Subject: [PATCH 129/322] Require TS 2.3 --- types/fuzzyset.js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/fuzzyset.js/index.d.ts b/types/fuzzyset.js/index.d.ts index 55b7207957..31764839b5 100644 --- a/types/fuzzyset.js/index.d.ts +++ b/types/fuzzyset.js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Glench/fuzzyset.js // Definitions by: Louis Grignon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 interface FuzzySet { get(candidate: string, defaultValue?: T | undefined, minScore?: number): Array<[number, string]> | T | null; From 8b14224d0eaeed888b0fa01c0a2c3ec088906924 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Sat, 2 Dec 2017 01:35:00 +0200 Subject: [PATCH 130/322] Fix linting issue --- types/fuzzyset.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fuzzyset.js/index.d.ts b/types/fuzzyset.js/index.d.ts index 31764839b5..04914683bc 100644 --- a/types/fuzzyset.js/index.d.ts +++ b/types/fuzzyset.js/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.3 interface FuzzySet { - get(candidate: string, defaultValue?: T | undefined, minScore?: number): Array<[number, string]> | T | null; + get(candidate: string, defaultValue?: T, minScore?: number): Array<[number, string]> | T | null; add(value: string): boolean; length(): number; isEmpty(): boolean; From 2e1e77c2f7fd4ec3a69c4e98531b04184f2c9534 Mon Sep 17 00:00:00 2001 From: Clark Stevenson Date: Fri, 1 Dec 2017 23:50:45 +0000 Subject: [PATCH 131/322] pixi.js v4.6.2 minor update --- types/pixi.js/index.d.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/types/pixi.js/index.d.ts b/types/pixi.js/index.d.ts index 48b9583c0b..1875746d6e 100644 --- a/types/pixi.js/index.d.ts +++ b/types/pixi.js/index.d.ts @@ -834,7 +834,7 @@ declare namespace PIXI { protected _lastObjectRendered: DisplayObject; resize(screenWidth: number, screenHeight: number): void; - generateTexture(displayObject: DisplayObject, scaleMode?: number, resolution?: number): RenderTexture; + generateTexture(displayObject: DisplayObject, scaleMode?: number, resolution?: number, region?: Rectangle): RenderTexture; render(...args: any[]): void; destroy(removeView?: boolean): void; } @@ -948,7 +948,6 @@ declare namespace PIXI { extract: extract.WebGLExtract; protected drawModes: any; protected _activeShader: Shader; - protected _activeVao: glCore.VertexArrayObject; _activeRenderTarget: RenderTarget; protected _initContext(): void; @@ -1032,7 +1031,7 @@ declare namespace PIXI { update(): void; run(): void; - unload(): void; + unload(displayObject: DisplayObject): void; } abstract class ObjectRenderer extends WebGLManager { constructor(renderer: WebGLRenderer); @@ -2124,7 +2123,7 @@ declare namespace PIXI { protected _tempPoint: Point; resolution: number; hitTest(globalPoint: Point, root?: Container): DisplayObject; - protected setTargetElement(element: HTMLCanvasElement, resolution?: number): void; + setTargetElement(element: HTMLCanvasElement, resolution?: number): void; protected addEvents(): void; protected removeEvents(): void; update(deltaTime?: number): void; @@ -2661,7 +2660,7 @@ declare namespace PIXI { ////////////////////////////////////////////////////////////////////////////// /////////////////////////////pixi-gl-core///////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// - // pixi-gl-core 1.1.2 https://github.com/pixijs/pixi-gl-core + // pixi-gl-core 1.1.4 https://github.com/pixijs/pixi-gl-core // sharedArrayBuffer as a type is not available yet. // need to fully define what an `Attrib` is. namespace glCore { @@ -2813,13 +2812,13 @@ declare namespace PIXI { indexBuffer: GLBuffer; dirty: boolean; - bind(): VertexArrayObject; - unbind(): VertexArrayObject; - activate(): VertexArrayObject; - addAttribute(buffer: GLBuffer, attribute: Attrib, type: number, normalized: boolean, stride: number, start: number): VertexArrayObject; - addIndex(buffer: GLBuffer, options?: any): VertexArrayObject; - clear(): VertexArrayObject; - draw(type: number, size: number, start: number): VertexArrayObject; + bind(): this; + unbind(): this; + activate(): this; + addAttribute(buffer: GLBuffer, attribute: Attrib, type?: number, normalized?: boolean, stride?: number, start?: number): this; + addIndex(buffer: GLBuffer, options?: any): this; + clear(): this; + draw(type: number, size: number, start: number): this; destroy(): void; } } From 8ca44be1a4414cb302afc6a24080be246ccb9019 Mon Sep 17 00:00:00 2001 From: Brenton Simpson Date: Fri, 1 Dec 2017 11:33:36 -0800 Subject: [PATCH 132/322] Fixed borderRadius types React's `borderRadius` [can only be](https://github.com/facebook/react/blob/master/packages/react-dom/src/shared/dangerousStyleValue.js) a `string` or a `number`, so the type should reflect that. See also #20743 --- types/react/index.d.ts | 10 +++++----- types/react/test/cssProperties.tsx | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 265441ba75..9780afc546 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -962,12 +962,12 @@ declare namespace React { /** * Defines the shape of the border of the bottom-left corner. */ - borderBottomLeftRadius?: CSSWideKeyword | any; + borderBottomLeftRadius?: CSSWideKeyword | CSSLength; /** * Defines the shape of the border of the bottom-right corner. */ - borderBottomRightRadius?: CSSWideKeyword | any; + borderBottomRightRadius?: CSSWideKeyword | CSSLength; /** * Sets the line style of the bottom border of a box. @@ -1048,7 +1048,7 @@ declare namespace React { /** * Shorthand property that sets the rounding of all four corners. */ - borderRadius?: CSSWideKeyword | any; + borderRadius?: CSSWideKeyword | CSSLength; /** * Shorthand property that defines the border-width, border-style and border-color of an element's right border @@ -1110,12 +1110,12 @@ declare namespace React { /** * Sets the rounding of the top-left corner of the element. */ - borderTopLeftRadius?: CSSWideKeyword | any; + borderTopLeftRadius?: CSSWideKeyword | CSSLength; /** * Sets the rounding of the top-right corner of the element. */ - borderTopRightRadius?: CSSWideKeyword | any; + borderTopRightRadius?: CSSWideKeyword | CSSLength; /** * Sets the style of an element's top border. To set all four borders, use the shorthand property, border-style. diff --git a/types/react/test/cssProperties.tsx b/types/react/test/cssProperties.tsx index 7447d1eb52..4ef8ab792a 100644 --- a/types/react/test/cssProperties.tsx +++ b/types/react/test/cssProperties.tsx @@ -3,6 +3,9 @@ import * as React from 'react'; const initialStyle: React.CSSProperties = { fontWeight: 'initial' }; const initialStyleTest =

; +const borderRadiusStyle: React.CSSProperties = { borderRadius: 5, borderTopRightRadius: '20%' }; +const borderRadiusStyleTest =
; + const backgroundAttachmentStyle: React.CSSProperties = { backgroundAttachment: 'fixed' }; const backgroundAttachmentStyleTest =
; From cfc910c1d0456543279a6783e41325612f6d09a0 Mon Sep 17 00:00:00 2001 From: Brenton Simpson Date: Fri, 1 Dec 2017 13:26:11 -0800 Subject: [PATCH 133/322] Replaced tslint-disable with tsline-disable-line These aren't lines this PR otherwise touches, but it won't build without them. --- types/react/index.d.ts | 9 +++++---- types/react/test/index.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 9780afc546..2f0c8a17bb 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -281,10 +281,10 @@ declare namespace React { constructor(props: P, context?: any); // Disabling unified-signatures to have separate overloads. It's easier to understand this way. - // tslint:disable:unified-signatures + // tslint:disable-next-line:unified-signatures setState(f: (prevState: Readonly, props: P) => Pick, callback?: () => any): void; + // tslint:disable-next-line:unified-signatures setState(state: Pick, callback?: () => any): void; - // tslint:enable:unified-signatures forceUpdate(callBack?: () => any): void; render(): ReactNode; @@ -3524,7 +3524,7 @@ declare namespace React { declare global { namespace JSX { - // tslint:disable:no-empty-interface + // tslint:disable-next-line:no-empty-interface interface Element extends React.ReactElement { } interface ElementClass extends React.Component { render(): React.ReactNode; @@ -3532,9 +3532,10 @@ declare global { interface ElementAttributesProperty { props: {}; } interface ElementChildrenAttribute { children: {}; } + // tslint:disable-next-line:no-empty-interface interface IntrinsicAttributes extends React.Attributes { } + // tslint:disable-next-line:no-empty-interface interface IntrinsicClassAttributes extends React.ClassAttributes { } - // tslint:enable:no-empty-interface interface IntrinsicElements { // HTML diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 3c49215c8a..d13b7eea3f 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -255,7 +255,7 @@ myComponent.reset(); // Refs // -------------------------------------------------------------------------- -// tslint:disable:no-empty-interface +// tslint:disable-next-line:no-empty-interface interface RCProps { } class RefComponent extends React.Component { From 1cf0e6dec47f7b2ad1d21cd9f3dd25de88761120 Mon Sep 17 00:00:00 2001 From: William Lohan Date: Fri, 1 Dec 2017 16:39:52 -0800 Subject: [PATCH 134/322] add less2sass --- types/less2sass/index.d.ts | 20 ++++++++++++++++++++ types/less2sass/less2sass-tests.ts | 4 ++++ types/less2sass/tsconfig.json | 23 +++++++++++++++++++++++ types/less2sass/tslint.json | 1 + 4 files changed, 48 insertions(+) create mode 100644 types/less2sass/index.d.ts create mode 100644 types/less2sass/less2sass-tests.ts create mode 100644 types/less2sass/tsconfig.json create mode 100644 types/less2sass/tslint.json diff --git a/types/less2sass/index.d.ts b/types/less2sass/index.d.ts new file mode 100644 index 0000000000..af2746177a --- /dev/null +++ b/types/less2sass/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for less2sass 1.0 +// Project: http://erickryski.com +// Definitions by: William Lohan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Less2Sass { + convert(file: string): string; + private convertColourHelpers(): Less2Sass; + private convertExtend(): Less2Sass; + private convertFileExtensions(): Less2Sass; + private convertFunctionUnit(): Less2Sass; + private convertInterpolatedVariables(): Less2Sass; + private convertMixins(): Less2Sass; + private convertTildaStrings(): Less2Sass; + private convertVariables(): Less2Sass; + private includeMixins(): Less2Sass; +} + +declare const less2sass: Less2Sass; +export = less2sass; diff --git a/types/less2sass/less2sass-tests.ts b/types/less2sass/less2sass-tests.ts new file mode 100644 index 0000000000..578b731887 --- /dev/null +++ b/types/less2sass/less2sass-tests.ts @@ -0,0 +1,4 @@ +import * as less2sass from 'less2sass'; + +let scss: string; +scss = less2sass.convert('@myColor: #f938ab; .myClass { color: @myColor; }'); diff --git a/types/less2sass/tsconfig.json b/types/less2sass/tsconfig.json new file mode 100644 index 0000000000..e70848dca8 --- /dev/null +++ b/types/less2sass/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "less2sass-tests.ts" + ] +} diff --git a/types/less2sass/tslint.json b/types/less2sass/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/less2sass/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From df277f8016e77f7c82db5da636a6700102023e38 Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Fri, 1 Dec 2017 16:47:50 +0000 Subject: [PATCH 135/322] add redis-error types --- types/redis-errors/index.d.ts | 33 ++++++++++++++++++++++++ types/redis-errors/redis-errors-tests.ts | 27 +++++++++++++++++++ types/redis-errors/tsconfig.json | 23 +++++++++++++++++ types/redis-errors/tslint.json | 1 + 4 files changed, 84 insertions(+) create mode 100644 types/redis-errors/index.d.ts create mode 100644 types/redis-errors/redis-errors-tests.ts create mode 100644 types/redis-errors/tsconfig.json create mode 100644 types/redis-errors/tslint.json diff --git a/types/redis-errors/index.d.ts b/types/redis-errors/index.d.ts new file mode 100644 index 0000000000..663a367d9a --- /dev/null +++ b/types/redis-errors/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for redis-errors 1.2 +// Project: https://github.com/NodeRedis/redis-errors#readme +// Definitions by: James Garbutt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export class RedisError extends Error { +} + +export class ParserError extends RedisError { + buffer: string; + offset: number; + + constructor(message: string, buffer: string, offset: number); +} + +export class ReplyError extends RedisError { + command?: string; + args?: any[]; + code?: string; + + constructor(message: string); +} + +export class AbortError extends RedisError { + command?: string; + args?: any[]; +} + +export class InterruptError extends RedisError { + command?: string; + args?: any[]; + origin: Error; +} diff --git a/types/redis-errors/redis-errors-tests.ts b/types/redis-errors/redis-errors-tests.ts new file mode 100644 index 0000000000..f9d464e5b5 --- /dev/null +++ b/types/redis-errors/redis-errors-tests.ts @@ -0,0 +1,27 @@ +import { + RedisError, + ReplyError, + ParserError, + AbortError, + InterruptError +} from 'redis-errors'; + +const err = new RedisError('some error'); + +const reply = new ReplyError('some error'); +const replyArgs: any[] | undefined = reply.args; +const replyCommand: string | undefined = reply.command; +const replyCode: string | undefined = reply.code; + +const parser = new ParserError('some error', 'a buffer', 4); +const parserBuffer: string = parser.buffer; +const parserOffset: number = parser.offset; + +const abort = new AbortError('some error'); +const abortArgs: any[] | undefined = abort.args; +const abortCommand: string | undefined = abort.command; + +const interrupt = new InterruptError('some error'); +const interruptArgs: any[] | undefined = interrupt.args; +const interruptCommand: string | undefined = interrupt.command; +const interruptOrigin: Error | undefined = interrupt.origin; diff --git a/types/redis-errors/tsconfig.json b/types/redis-errors/tsconfig.json new file mode 100644 index 0000000000..cc922f5c1a --- /dev/null +++ b/types/redis-errors/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "redis-errors-tests.ts" + ] +} diff --git a/types/redis-errors/tslint.json b/types/redis-errors/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/redis-errors/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 72cde9ebb7ed371a6baf7af5db83961ec9144742 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Sat, 2 Dec 2017 17:55:36 +0100 Subject: [PATCH 136/322] add typings for coinbase --- types/coinbase/coinbase-tests.ts | 108 +++ types/coinbase/index.d.ts | 1333 ++++++++++++++++++++++++++++++ types/coinbase/tsconfig.json | 23 + types/coinbase/tslint.json | 1 + 4 files changed, 1465 insertions(+) create mode 100644 types/coinbase/coinbase-tests.ts create mode 100644 types/coinbase/index.d.ts create mode 100644 types/coinbase/tsconfig.json create mode 100644 types/coinbase/tslint.json diff --git a/types/coinbase/coinbase-tests.ts b/types/coinbase/coinbase-tests.ts new file mode 100644 index 0000000000..793833355e --- /dev/null +++ b/types/coinbase/coinbase-tests.ts @@ -0,0 +1,108 @@ +import * as coinbase from "coinbase"; + +const client = new coinbase.Client({ apiKey: "key", apiSecret: "secret", version: "2017-10-22" }); + +client.getAccounts({}, (error: Error, result: coinbase.Account[]): void => undefined); + +client.getAccount("abcdef", (error: Error, account: coinbase.Account): void => { + account.buy({ amount: "1", commit: false, currency: "BTC", payment_method: "abcdef" }, (error: Error, buy: coinbase.Buy): void => { + buy.commit((error: Error, buy: coinbase.Buy): void => undefined); + }); + + account.createAddress({ name: "foo" }, (error: Error, address: coinbase.Address): void => { + address.getTransactions({}, (error: Error, transactions: coinbase.Transaction[]): void => undefined); + }); + + account.delete((error: Error): void => undefined); + + account.deposit({ amount: "1", commit: false, currency: "USD", payment_method: "abcdef" }, (error: Error, deposit: coinbase.Deposit): void => { + deposit.commit((error: Error, deposit: coinbase.Deposit): void => undefined); + }); + + account.getAddress("abcdef", (error: Error, address: coinbase.Address): void => undefined); + + account.getAddresses((error: Error, address: coinbase.Address[]): void => undefined); + + account.getBuy("abcdef", (error: Error, buy: coinbase.Buy): void => undefined); + + account.getBuys((error: Error, buy: coinbase.Buy[]): void => undefined); + + account.getDeposit("abcdef", (error: Error, deposit: coinbase.Deposit): void => undefined); + + account.getDeposits((error: Error, deposit: coinbase.Deposit[]): void => undefined); + + account.getSell("abcdef", (error: Error, deposit: coinbase.Sell): void => undefined); + + account.getSells((error: Error, deposit: coinbase.Sell[]): void => undefined); + + account.getTransaction("abcdef", (error: Error, deposit: coinbase.Transaction): void => undefined); + + account.getTransactions((error: Error, deposit: coinbase.Transaction[]): void => undefined); + + account.getWithdrawal("abcdef", (error: Error, deposit: coinbase.Withdrawal): void => undefined); + + account.getWithdrawals((error: Error, deposit: coinbase.Withdrawal[]): void => undefined); + + account.requestMoney( + { amount: "1", currency: "EUR", description: "foo", to: "bar", type: "request" }, + (error: Error, result: coinbase.Transaction) => undefined + ); + account.requestMoney({ amount: "1", currency: "EUR", to: "bar", type: "request" }, (error: Error, tx: coinbase.Transaction) => { + tx.cancel((error: Error, tx: coinbase.Transaction): void => undefined); + tx.complete((error: Error, tx: coinbase.Transaction): void => undefined); + tx.resend((error: Error, tx: coinbase.Transaction): void => undefined); + }); + + account.sell( + { agree_btc_amount_varies: true, amount: "1", commit: true, currency: "BTC", payment_method: "abcdef", quote: true}, + (error: Error, sell: coinbase.Sell): void => { + sell.commit((error: Error, sell: coinbase.Sell): void => undefined); + } + ); + account.sell( + { currency: "BTC", payment_method: "abcdef", total: "3"}, + (error: Error, sell: coinbase.Sell): void => { + sell.commit((error: Error, sell: coinbase.Sell): void => undefined); + } + ); + + account.sendMoney( + { amount: "1", currency: "EUR", description: "foo", fee: "2", idem: "bar", to: "baz", type: "send" }, + (error: Error, result: coinbase.Transaction) => undefined + ); + + account.setPrimary((error: Error, result: coinbase.Account): void => undefined); + + account.transferMoney( + { amount: "1", currency: "USD", description: "foo", to: "bar", type: "transfer" }, + (error: Error, tx: coinbase.Transaction): void => undefined + ); + + account.update({ name: "foo" }, (error: Error, result: coinbase.Account): void => undefined); + + account.withdraw({ amount: "1", commit: false, currency: "ETH", payment_method: "abcdef"}, (error: Error, result: coinbase.Withdrawal): void => { + result.commit((error: Error, result: coinbase.Withdrawal): void => undefined); + }); +}); + +client.getBuyPrice({ currencyPair: "USD-BTC" }, (error: Error, result: coinbase.MoneyHash): void => undefined); + +client.getCurrencies((error: Error, result: coinbase.Currency[]): void => undefined); + +client.getExchangeRates({currency: "ETC"}, (error: Error, result: coinbase.ExchangeRate): void => undefined); + +client.getPaymentMethod("foo", (error: Error, result: coinbase.PaymentMethod): void => undefined); + +client.getPaymentMethods((error: Error, result: coinbase.PaymentMethod[]): void => undefined); + +client.getSellPrice({ currencyPair: "USD-BTC" }, (error: Error, result: coinbase.MoneyHash): void => undefined); + +client.getSpotPrice({ currencyPair: "USD-BTC" }, (error: Error, result: coinbase.MoneyHash): void => undefined); +client.getSpotPrice({ currencyPair: "USD-BTC", date: "2017-22-01" }, (error: Error, result: coinbase.MoneyHash): void => undefined); + +client.getTime((error: Error, result: coinbase.Time): void => undefined); + +client.getUser("abcdef", (error: Error, user: coinbase.User): void => { + user.showAuth((error: Error, auth: coinbase.Auth): void => undefined); + user.update({ name: "foo", time_zone: "bar", native_currency: "USD" }, (error: Error, user: coinbase.User): void => undefined); +}); diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts new file mode 100644 index 0000000000..ae1e041203 --- /dev/null +++ b/types/coinbase/index.d.ts @@ -0,0 +1,1333 @@ +// Type definitions for coinbase 2.0 +// Project: https://github.com/coinbase/coinbase-node +// Definitions by: Rogier Schouten +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface ClientConstructOpts { + /** + * API key (obtain this from the coinbase website) + */ + apiKey?: string; + /** + * API key secret (obtain this from the coinbase website) + */ + apiSecret?: string; + /** + * OAuth2 access token + */ + accessToken?: string; + /** + * API version in 'yyyy-mm-dd' format, see https://developers.coinbase.com/api/v2#changelog + */ + version?: string; +} + +export interface CreateAccountOpts { + /** + * Account name + */ + name?: string; +} + +export interface GetExchangeRateOpts { + /** + * Base currency, default USD + */ + currency?: string; +} + +export interface GetBuyPriceOpts { + /** + * Currency pair, e.g. 'BTC-USD' + */ + currencyPair: string; +} + +export interface GetSellPriceOpts { + /** + * Currency pair, e.g. 'BTC-USD' + */ + currencyPair: string; +} + +export interface GetSpotPriceOpts { + /** + * Currency pair, e.g. 'BTC-USD' + */ + currencyPair: string; + /** + * Specify date for historic spot price in format YYYY-MM-DD (UTC) + */ + date?: string; +} + +export interface UpdateAccountOpts { + /** + * Account name + */ + name?: string; +} + +export interface CreateAddressOpts { + /** + * Address label + */ + name?: string; +} + +export interface SendMoneyOpts { + /** + * Type send is required when sending money + */ + type: "send"; + /** + * A bitcoin address, litecoin address, ethereum address, or an email of the recipient + */ + to: string; + /** + * Amount to be sent + */ + amount: string; + /** + * Currency for the amount (see Client#getCurrencies() for available strings) + */ + currency: string; + /** + * Notes to be included in the email that the recipient receives + */ + description?: string; + /** + * Don’t send notification emails for small amounts (e.g. tips) + */ + skip_notifications?: boolean; + /** + * Transaction fee in BTC/ETH/LTC if you would like to pay it. Fees can be added as a string, such as 0.0005 + */ + fee?: string; + /** + * *Recommended* A token to ensure idempotence. If a previous transaction with the same idem parameter already exists for this sender, + * that previous transaction will be returned and a new one will not be created. Max length 100 characters + */ + idem?: string; + /** + * Whether this send is to another financial institution or exchange. Required if this send is to an address and is valued at over USD$3000. + */ + to_financial_institution?: boolean; + /** + * The website of the financial institution or exchange. Required if to_financial_institution is true. + */ + financial_institution_website?: string; +} + +export interface TransferMoneyOpts { + /** + * Type transfer is required when transferring bitcoin or ethereum between accounts + */ + type: "transfer"; + /** + * ID of the receiving account + */ + to: string; + /** + * Amount to be transferred + */ + amount: string; + /** + * Currency for the amount (see Client#getCurrencies() for available strings) + */ + currency: string; + /** + * Notes to be included in the transfer + */ + description?: string; +} + +export interface RequestMoneyOpts { + /** + * Type request is required when sending money + */ + type: "request"; + /** + * An email of the recipient + */ + to: string; + /** + * Amount to be transferred + */ + amount: string; + /** + * Currency for the amount (see Client#getCurrencies() for available strings) + */ + currency: string; + /** + * Notes to be included in the email that the recipient receives + */ + description?: string; +} + +export interface UpdateUserOpts { + /** + * User’s name + */ + name?: string; + /** + * Time zone + */ + time_zone?: string; + /** + * Local currency used to display amounts converted from BTC + */ + native_currency?: string; +} + +export interface BuyOpts { + /** + * Buy amount without fees (alternative to total) + */ + amount?: string; + /** + * Buy amount with fees (alternative to amount) + */ + total?: string; + /** + * Currency for the amount (see Client#getCurrencies() for available strings) + */ + currency: string; + /** + * The ID of the payment method that should be used for the buy. (todo get payment methods) + */ + payment_method?: string; + /** + * Whether or not you would still like to buy if you have to wait for your money to arrive to lock in a price + */ + agree_btc_amount_varies?: boolean; + /** + * If set to false, this buy will not be immediately completed. Use the commit call to complete it. Default value: true + */ + commit?: boolean; + /** + * If set to true, response will return an unsave buy for detailed price quote. Default value: false + */ + quote?: boolean; +} + +export interface SellOpts { + /** + * Sell amount without fees (alternative to total) + */ + amount?: string; + /** + * Sell amount with fees (alternative to amount) + */ + total?: string; + /** + * Currency for the amount (see Client#getCurrencies() for available strings) + */ + currency: string; + /** + * The ID of the payment method that should be used for the sell. + */ + payment_method?: string; + /** + * Whether or not you would still like to sell if you have to wait for your money to arrive to lock in a price + */ + agree_btc_amount_varies?: boolean; + /** + * If set to false, this sell will not be immediately completed. Use the commit call to complete it. Default value: true + */ + commit?: boolean; + /** + * If set to true, response will return an unsave sell for detailed price quote. Default value: false + */ + quote?: boolean; +} + +export interface DepositOpts { + /** + * Deposit amount + */ + amount: string; + /** + * Currency for the amount (see Client#getCurrencies() for available strings) + */ + currency: string; + /** + * The ID of the payment method that should be used for the buy. (todo get payment methods) + */ + payment_method?: string; + /** + * If set to false, this deposit will not be immediately completed. Use the commit call to complete it. Default value: true + */ + commit?: boolean; +} + +export interface WithdrawOpts { + /** + * Withdrawal amount + */ + amount: string; + /** + * Currency for the amount (see Client#getCurrencies() for available strings) + */ + currency: string; + /** + * The ID of the payment method that should be used for the buy. (todo get payment methods) + */ + payment_method?: string; + /** + * If set to false, this withdrawal will not be immediately completed. Use the commit call to complete it. Default value: true + */ + commit?: boolean; +} + +/** + * Combination of an amount and a currency + */ +export interface MoneyHash { + /** + * Amount as floating-point in a string + */ + amount: string; + /** + * Currency e.g. "BTC" (see Client#getCurrencies() for available strings) + */ + currency: string; +} + +export type ResourceType = "account" | "transaction" | "address" | "user" | "buy" | "sell" | "deposit" | "withdrawal" | "payment_method"; + +/** + * Base interface for all resources + */ +export interface Resource { + /** + * Resource type + */ + resource: ResourceType; +} + +export class User implements Resource { + /** + * Resource type, constant "user" + */ + resource: "user"; + + /** + * Resource ID + */ + id: string; + + /** + * ISO timestamp (sometimes needs additional permissions) + */ + created_at?: string; + + /** + * ISO timestamp (sometimes needs additional permissions) + */ + updated_at?: string; + + /** + * REST endpoint + */ + resource_path: string; + + /** + * User’s name + */ + name?: string; + + /** + * + */ + username?: string; + + /** + * Location for user’s profile + */ + profile_location?: string; + + /** + * Bio for user’s profile + */ + profile_bio?: string; + + /** + * profile location if user has one + */ + profile_url?: string; + + /** + * User’s avatar url + */ + avatar_url: string; + + /** + * Time zone (needs wallet:user:read permission) + */ + time_zone?: string; + + /** + * Native currency (needs wallet:user:read permission) + */ + native_currency?: string; + + /** + * (needs wallet:user:read permission) + */ + bitcoin_unit?: string; + + /** + * (needs wallet:user:read permission) + */ + country?: Country; + + /** + * Email address (needs wallet:user:email permission) + */ + email?: string; + + /** + * Get current user’s authorization information including granted scopes and send limits when using OAuth2 authentication + * No permission required + */ + showAuth(cb: (error: Error, result: Auth) => void): void; + + /** + * Change user properties + * Scope: wallet:user:update + */ + update(opts: UpdateUserOpts, cb: (error: Error, result: User) => void): void; +} + +export interface Auth { + /** + * Authentication method e.g. "oauth" + */ + method: string; + /** + * Permissions for this user e.g. "wallet:user:read" + */ + scopes: string[]; + + oauth_meta?: any; +} + +export interface Country { + /** + * 2-letter country code + */ + code: string; + /** + * Country name + */ + name: string; +} + +/** + * Bitcoin, Litecoin or Ethereum address + */ +export class Address implements Resource { + /** + * Type of resource, constant string "address" + */ + resource: "address"; + + /** + * Bitcoin, Litecoin or Ethereum address + */ + address: string; + + /** + * User defined label for the address + */ + name?: string; + + /** + * List transactions that have been sent to a specific address. + * Scope: wallet:transactions:read + */ + getTransactions(opts: {}, cb: (error: Error, result: Transaction[]) => void): void; +} + +export type AccountType = "wallet" | "fiat" | "multisig" | "vault" | "multisig_vault"; + +/** + * Account resource represents all of a user’s accounts, including bitcoin, litecoin and ethereum wallets, fiat currency accounts, + * and vaults. This is represented in the type field. It’s important to note that new types can be added over time so you want to + * make sure this won’t break your implementation. + * User can only have one primary account and it’s type can only be wallet. + */ +export class Account implements Resource { + /** + * Type of resource, constant string "account" + */ + resource: "account"; + + /** + * Resource ID + */ + id: string; + + /** + * ISO timestamp (sometimes needs additional permissions) + */ + created_at?: string; + + /** + * ISO timestamp (sometimes needs additional permissions) + */ + updated_at?: string; + + /** + * REST endpoint + */ + resource_path: string; + + /** + * User or system defined name + */ + name: string; + + /** + * Primary account + */ + primary: boolean; + + /** + * Account’s type + */ + type: AccountType; + + /** + * Account’s currency (see Client#getCurrencies() for available strings) + */ + currency: string; + + /** + * Balance + */ + balance: MoneyHash; + + /** + * Promote an account as primary account. + * Scope: wallet:accounts:update + */ + setPrimary(cb: (error: Error, result: Account) => void): void; + + /** + * Modifies user’s account. + * Scope: wallet:accounts:update + */ + update(opts: UpdateAccountOpts, cb: (error: Error, result: Account) => void): void; + + /** + * Removes user’s account. In order to remove an account it can’t be: + * - Primary account + * - Account with non-zero balance + * - Fiat account + * - Vault with a pending withdrawal + * Scope: wallet:accounts:delete + */ + delete(cb: (error: Error) => void): void; + + /** + * Lists addresses for an account. Important: Addresses should be considered one time use only. Create new addresses. + * Scope: wallet:addresses:read + */ + getAddresses(cb: (error: Error, result: Address[]) => void): void; + + /** + * Show an individual address for an account. A regular bitcoin, litecoin or ethereum address can be used in place of `id` but the + * address has to be associated to the correct account. Important: Addresses should be considered one time use only. Create new addresses. + * Scope: wallet:addresses:read + * @param id resource id or a regular bitcoin, litecoin or ethereum address + */ + getAddress(id: string, cb: (error: Error, result: Address) => void): void; + + /** + * Creates a new address for an account. As all the arguments are optinal, it’s possible just to do a empty POST which will create a new + * address. This is handy if you need to create new receive addresses for an account on-demand. + * Addresses can be created for all account types. With fiat accounts, funds will be received with Instant Exchange + * Scope: wallet:addresses:create + * @param opts can be null, optional address name + */ + createAddress(opts: CreateAddressOpts | null, cb: (error: Error, result: Address) => void): void; + + /** + * Lists account’s transactions. + * Scope: wallet:transactions:read + */ + getTransactions(cb: (error: Error, result: Transaction[]) => void): void; + + /** + * Show an individual transaction for an account + * Scope: wallet:transactions:read + * @param id resource id + */ + getTransaction(id: string, cb: (error: Error, result: Transaction) => void): void; + + /** + * Send funds to a bitcoin address, litecoin address, ethereum address, or email address. No transaction fees are required for off + * blockchain bitcoin transactions. + * + * It’s recommended to always supply a unique `idem` field for each transaction. This prevents you from sending the same transaction + * twice if there has been an unexpected network outage or other issue. + * + * When used with OAuth2 authentication, this endpoint requires two factor authentication unless used with + * wallet:transactions:send:bypass-2fa scope. + * + * If the user is able to buy bitcoin, they can send funds from their fiat account using instant exchange feature. + * Buy fees will be included in the created transaction and the recipient will receive the user defined amount. + * To create a multisig transaction, visit Multisig documentation. + * + * Scope: wallet:transactions:send, wallet:transactions:send:bypass-2fa + */ + sendMoney(opts: SendMoneyOpts, cb: (error: Error, result: Transaction) => void): void; + + /** + * Transfer bitcoin, litecoin or ethereum between two of a user’s accounts. Following transfers are allowed: + * - wallet to wallet + * - wallet to vault + * Scope: wallet:transactions:transfer + */ + transferMoney(opts: TransferMoneyOpts, cb: (error: Error, result: Transaction) => void): void; + + /** + * Requests money from an email address. + * Scope: wallet:transactions:request + */ + requestMoney(opts: RequestMoneyOpts, cb: (error: Error, result: Transaction) => void): void; + + /** + * Lists buys for an account. + * Scope: wallet:buys:read + */ + getBuys(cb: (error: Error, result: Buy[]) => void): void; + + /** + * Show an individual buy. + * Scope: wallet:buys:read + * @param id resource id + */ + getBuy(id: string, cb: (error: Error, result: Buy) => void): void; + + /** + * Buys a user-defined amount of bitcoin, litecoin or ethereum. + * There are two ways to define buy amounts–you can use either the amount or the total parameter: + * - When supplying amount, you’ll get the amount of bitcoin, litecoin or ethereum defined. With amount it’s recommended to use BTC or + * ETH as the currency value, but you can always specify a fiat currency and and the amount will be converted to BTC or ETH respectively. + * - When supplying total, your payment method will be debited the total amount and you’ll get the amount in BTC or ETH after fees have + * been reduced from the total. With total it’s recommended to use the currency of the payment method as the currency parameter, + * but you can always specify a different currency and it will be converted. + * Given the price of digital currency depends on the time of the call and on the amount of purchase, it’s recommended to use the + * commit: false parameter to create an uncommitted buy to show the confirmation for the user or get the final quote, and commit that + * with a separate request. + * If you need to query the buy price without locking in the buy, you can use quote: true option. This returns an unsaved buy and + * unlike commit: false, this buy can’t be completed. This option is useful when you need to show the detailed buy price quote + * for the user when they are filling a form or similar situation. + * Scope: wallet:buys:create + * @param opts indicates what to buy + * @param cb receives transaction that you can use to commit the buy + */ + buy(opts: BuyOpts, cb: (error: Error, result: Buy) => void): void; + + /** + * Lists sells for an account. + * Scope: wallet:sells:read + */ + getSells(cb: (error: Error, result: Sell[]) => void): void; + + /** + * Show an individual sell. + * Scope: wallet:sells:read + * @param id resource id + */ + getSell(id: string, cb: (error: Error, result: Sell) => void): void; + + /** + * Sells a user-defined amount of bitcoin, litecoin or ethereum. + * + * There are two ways to define sell amounts–you can use either the amount or the total parameter: + * - When supplying amount, you’ll get the amount of bitcoin, litecoin or ethereum defined. With amount it’s recommended to use BTC or + * ETH as the currency value, but you can always specify a fiat currency and the amount will be converted to BTC or ETH respectively. + * - When supplying total, your payment method will be credited the total amount and you’ll get the amount in BTC or ETH after fees + * have been reduced from the subtotal. With total it’s recommended to use the currency of the payment method as the currency parameter, + * but you can always specify a different currency and it will be converted. + * + * Given the price of digital currency depends on the time of the call and amount of the sell, it’s recommended to use the commit: false + * parameter to create an uncommitted sell to get a quote and then to commit that with a separate request. + * + * If you need to query the sell price without locking in the sell, you can use quote: true option. This returns an unsaved sell and + * unlike commit: false, this sell can’t be completed. This option is useful when you need to show the detailed sell price quote for + * the user when they are filling a form or similar situation. + * Scope: wallet:sells:create + */ + sell(opts: SellOpts, cb: (error: Error, result: Sell) => void): void; + + /** + * Lists deposits for an account. + * Scope: wallet:deposits:read + */ + getDeposits(cb: (error: Error, result: Deposit[]) => void): void; + + /** + * Show an individual deposit. + * Scope: wallet:deposits:read + * @param id resource id + */ + getDeposit(id: string, cb: (error: Error, result: Deposit) => void): void; + + /** + * Deposits user-defined amount of funds to a fiat account. + * Scope: wallet:deposits:create + */ + deposit(opts: DepositOpts, cb: (error: Error, result: Deposit) => void): void; + + /** + * Lists withdrawals for an account. + * Scope: wallet:withdrawals:read + */ + getWithdrawals(cb: (error: Error, result: Withdrawal[]) => void): void; + + /** + * Show an individual withdrawal. + * Scope: wallet:withdrawals:read + * @param id resource id + */ + getWithdrawal(id: string, cb: (error: Error, result: Withdrawal) => void): void; + + /** + * Withdraws user-defined amount of funds from a fiat account. + * Scope: wallet:withdrawals:create + */ + withdraw(opts: WithdrawOpts, cb: (error: Error, result: Withdrawal) => void): void; +} + +/** + * Reference to any resource + */ +export interface ResourceRef { + id: string; + resource: ResourceType; + resource_path: string; +} + +export type TransactionType = "send" | "request" | "transfer" | "buy" | "sell" | "fiat_deposit" | "fiat_withdrawal" | "exchange_deposit" + | "exchange_withdrawal" | "vault_withdrawal"; + +export type TransactionStatus = "pending" | "completed" | "failed" | "expired" | "canceled" | "waiting_for_signature" | "waiting_for_clearing"; + +export class Transaction implements Resource { + /** + * Constant "transaction" + */ + resource: "transaction"; + + /** + * Transaction type + */ + type: TransactionType; + + /** + * Transaction status + */ + status: TransactionStatus; + + /** + * Amount in bitcoin, litecoin or ethereum + */ + amount: MoneyHash; + + /** + * Amount in user's native currency + */ + native_amount: MoneyHash; + + /** + * Account associated with the transaction + */ + account: Account; + + /** + * User defined description + */ + description: string; + + /** + * Indicator if the transaction was instant exchanged (received into a bitcoin address for a fiat account) + */ + instant_exchange: boolean; + + /** + * Detailed information about the transaction + */ + details: any; + + /** + * Information about bitcoin, litecoin or ethereum network including network transaction hash if transaction was on-blockchain. + * Only available for certain types of transactions + */ + network?: any; + + /** + * The receiving party of a debit transaction. Usually another resource but can also be another type like email. + * Only available for certain types of transactions + */ + to?: ResourceRef | string; + + /** + * The originating party of a credit transaction. Usually another resource but can also be another type like bitcoin network. + * Only available for certain types of transactions + */ + from?: ResourceRef | string; + + /** + * Associated bitcoin, litecoin or ethereum address for received payment + */ + address?: Address; + + /** + * Associated OAuth2 application + */ + application?: any; + + /** + * Lets the recipient of a money request complete the request by sending money to the user who requested the money. + * This can only be completed by the user to whom the request was made, not the user who sent the request. + * Scope: wallet:transactions:request + */ + complete(cb: (error: Error, result: Transaction) => void): void; + + /** + * Lets the user resend a money request. This will notify recipient with a new email. + * Scope: wallet:transactions:request + */ + resend(cb: (error: Error, result: Transaction) => void): void; + + /** + * Lets a user cancel a money request. Money requests can be canceled by the sender or the recipient. + * Scope: wallet:transactions:request + */ + cancel(cb: (error: Error, result: Transaction) => void): void; +} + +export type BuyStatus = "created" | "completed" | "canceled"; + +/** + * Buy resource + */ +export class Buy implements Resource { + /** + * Constant "buy" + */ + resource: "buy"; + + /** + * Status + */ + status: BuyStatus; + + /** + * Associated payment method (e.g. a bank, fiat account) + */ + payment_method: ResourceRef; + + /** + * Associated transaction (e.g. a bank, fiat account) + */ + transaction: ResourceRef; + + /** + * Amount in bitcoin, litecoin or ethereum + */ + amount: MoneyHash; + + /** + * Fiat amount with fees + */ + total: MoneyHash; + + /** + * Fiat amount without fees + */ + subtotal: MoneyHash; + + /** + * Fee associated to this buy + */ + fee: MoneyHash; + + /** + * Has this buy been committed? + */ + committed: boolean; + + /** + * Was this buy executed instantly? + */ + instant: boolean; + + /** + * When a buy isn’t executed instantly, it will receive a payout date for the time it will be executed. ISO timestamp + */ + payout_at?: string; + + /** + * Completes a buy that is created in commit: false state. + * If the exchange rate has changed since the buy was created, this call will fail with the error “The exchange rate updated while you + * were waiting. The new total is shown below”. The buy’s total will also be updated. You can repeat the `commit` call to accept the new + * values and start the buy at the new rates. + * Scope: wallet:buys:create + */ + commit(cb: (error: Error, transaction: Buy) => void): void; +} + +export type SellStatus = "created" | "completed" | "canceled"; + +/** + * Sell resource + */ +export class Sell implements Resource { + /** + * Constant "sell" + */ + resource: "sell"; + + /** + * Status of the sell. Currently available values: created, completed, canceled + */ + status: BuyStatus; + + /** + * Associated payment method (e.g. a bank, fiat account) + */ + payment_method: ResourceRef; + + /** + * Associated transaction (e.g. a bank, fiat account) + */ + transaction: ResourceRef; + + /** + * Amount in bitcoin, litecoin or ethereum + */ + amount: MoneyHash; + + /** + * Fiat amount with fees + */ + total: MoneyHash; + + /** + * Fiat amount without fees + */ + subtotal: MoneyHash; + + /** + * Fee associated to this sell + */ + fee: MoneyHash; + + /** + * Has this sell been committed? + */ + committed: boolean; + + /** + * Was this sell executed instantly? + */ + instant: boolean; + + /** + * When a sell isn’t executed instantly, it will receive a payout date for the time it will be executed. ISO timestamp + */ + payout_at?: string; + + /** + * Completes a sell that is created in commit: false state. + * If the exchange rate has changed since the sell was created, this call will fail with the error “The exchange rate updated while you + * were waiting. The new total is shown below”. The buy’s total will also be updated. You can repeat the `commit` call to accept the new + * values and start the buy at the new rates. + * Scope: wallet:sells:create + */ + commit(cb: (error: Error, transaction: Sell) => void): void; +} + +export type DepositStatus = "created" | "completed" | "canceled"; + +/** + * Deposit resource represents a deposit of funds using a payment method (e.g. a bank). Each committed deposit also has an associated transaction. + * Deposits can be started with commit: false which is useful when displaying the confirmation for a deposit. + * These deposits will never complete and receive an associated transaction unless they are committed separately. + */ +export class Deposit implements Resource { + resource: "deposit"; + + /** + * Resource ID + */ + id: string; + + /** + * ISO timestamp (sometimes needs additional permissions) + */ + created_at?: string; + + /** + * ISO timestamp (sometimes needs additional permissions) + */ + updated_at?: string; + + /** + * REST endpoint + */ + resource_path: string; + + /** + * Status of the deposit. Currently available values: created, completed, canceled + */ + status: DepositStatus; + + /** + * Associated payment method (e.g. a bank) + */ + payment_method: ResourceRef; + + /** + * Associated transaction (e.g. a bank, fiat account) + */ + transaction: ResourceRef; + + /** + * Amount + */ + amount: MoneyHash; + + /** + * Amount without fees + */ + subtotal: MoneyHash; + + /** + * Fee associated to this deposit + */ + fee: MoneyHash; + + /** + * Has this deposit been committed? + */ + committed: boolean; + + /** + * When a deposit isn’t executed instantly, it will receive a payout date for the time it will be executed. ISO timestamp + */ + payout_at?: string; + + /** + * Completes a deposit that is created in commit: false state. + * Scope: wallet:deposits:create + */ + commit(cb: (error: Error, result: Deposit) => void): void; +} + +export type WithdrawalStatus = "created" | "completed" | "canceled"; + +/** + * Withdrawal resource represents a withdrawal of funds using a payment method (e.g. a bank). Each committed withdrawal also has a associated + * transaction. + * Withdrawal can be started with commit: false which is useful when displaying the confirmation for a withdrawal. These withdrawals will + * never complete and receive an associated transaction unless they are committed separately. + */ +export class Withdrawal implements Resource { + resource: "deposit"; + + /** + * Resource ID + */ + id: string; + + /** + * ISO timestamp (sometimes needs additional permissions) + */ + created_at?: string; + + /** + * ISO timestamp (sometimes needs additional permissions) + */ + updated_at?: string; + + /** + * REST endpoint + */ + resource_path: string; + + /** + * Status of the deposit. Currently available values: created, completed, canceled + */ + status: WithdrawalStatus; + + /** + * Associated payment method (e.g. a bank) + */ + payment_method: ResourceRef; + + /** + * Associated transaction (e.g. a bank, fiat account) + */ + transaction: ResourceRef; + + /** + * Amount + */ + amount: MoneyHash; + + /** + * Amount without fees + */ + subtotal: MoneyHash; + + /** + * Fee associated to this withdrawal + */ + fee: MoneyHash; + + /** + * Has this withdrawal been committed? + */ + committed: boolean; + + /** + * When a withdrawal isn’t executed instantly, it will receive a payout date for the time it will be executed. ISO timestamp + */ + payout_at?: string; + + /** + * Completes a withdrawal that is created in commit: false state. + * Scope: wallet:withdrawals:create + */ + commit(cb: (error: Error, result: Withdrawal) => void): void; +} + +export type PaymentMethodType = "ach_bank_account" | "sepa_bank_account" | "ideal_bank_account" | "fiat_account" | "bank_wire" + | "credit_card" | "secure3d_card" | "eft_bank_account" | "interac"; + +/** + * Payment method resource represents the different kinds of payment methods that can be used when buying and selling bitcoin, litecoin or + * ethereum. + * As fiat accounts can be used for buying and selling, they have an associated payment method. This type of a payment method will also have + * a fiat_account reference to the actual account. + * + * Currently available type values: + * - ach_bank_account - Regular US bank account + * - sepa_bank_account - European SEPA bank account + * - ideal_bank_account - iDeal bank account (Europe) + * - fiat_account - Fiat nominated Coinbase account + * - bank_wire - Bank wire (US only) + * - credit_card - Credit card (can’t be used for buying/selling) + * - secure3d_card - Secure3D verified payment card + * - eft_bank_account - Canadian EFT bank account + * - interac - Interac Online for Canadian bank accounts + */ +export interface PaymentMethod extends Resource { + /** + * Resource type, constant "payment_method" + */ + resource: "payment_method"; + + /** + * Payment method type + */ + type: PaymentMethodType; + + /** + * Method name + */ + name: string; + + /** + * Payment method’s native currency (see Client#getCurrencies() for available strings) + */ + currency: string; + + /** + * Is primary buying method? + */ + primary_buy: boolean; + + /** + * Is primary selling method? + */ + primary_sell: boolean; + + /** + * Is buying allowed with this method? + */ + allow_buy: boolean; + + /** + * Is selling allowed with this method? + */ + allow_sell: boolean; + + /** + * Does this method allow for instant buys? + */ + instant_buy: boolean; + + /** + * Does this method allow for instant sells? + */ + instant_sell: boolean; + + /** + * If the user has obtained optional wallet:payment-methods:limits permission, an additional field, limits, will be embedded into payment + * method data. It will contain information about buy, instant buy, sell and deposit limits (there’s no limits for withdrawals at this time). + * As each one of these can have several limits you should always look for the lowest remaining value when performing the relevant action. + */ + limits?: PaymentMethodLimits; +} + +/** + * This contains information about buy, instant buy, sell and deposit limits (there’s no limits for withdrawals at this time). + * As each one of these can have several limits you should always look for the lowest remaining value when performing the relevant action. + */ +export interface PaymentMethodLimits { + buy: PaymentMethodLimit[]; + instant_buy: PaymentMethodLimit[]; + sell: PaymentMethodLimit[]; + deposit: PaymentMethodLimit[]; +} + +export interface PaymentMethodLimit { + period_in_days: number; + total: MoneyHash; + remaining: MoneyHash; +} + +/** + * Information about one supported currency. Currency codes will conform to the ISO 4217 standard where possible. + * Currencies which have or had no representation in ISO 4217 may use a custom code (e.g. BTC). + */ +export interface Currency { + /** + * Abbreviation e.g. "USD" or "BTC" + */ + id: string; + /** + * Full name e.g. "United Arab Emirates Dirham" + */ + name: string; + /** + * Floating-point number in a string + */ + min_size: string; +} + +export interface ExchangeRate { + /** + * Base currency + */ + currency: string; + /** + * Rates as floating points in strings; indexed by currency id + */ + rates: { [index: string]: string }; +} + +export interface Time { + iso: string; + epoch: number; +} + +export class Client { + constructor(opts: ClientConstructOpts); + + /** + * Get any user’s information with their ID. + * Scopes: none + * @param id resource id + */ + getUser(id: string, cb: (error: Error, result: User) => void): void; + + /** + * Get the current user. To get user’s email or private information, use permissions wallet:user:email and wallet:user:read. If current + * request has a wallet:transactions:send scope, then the response will contain a boolean sends_disabled field that indicates + * if the user’s send functionality has been disabled. + */ + getCurrentUser(cb: (error: Error, result: User) => void): void; + + /** + * Returns all accounts for the current user + * Scope: wallet:accounts:read + */ + getAccounts(opts: {}, cb: (error: Error, result: Account[]) => void): void; + + /** + * Get one account by its Resource ID + * Scope: wallet:accounts:read + * @param id resource ID or "primary" + */ + getAccount(id: string, cb: (error: Error, result: Account) => void): void; + + /** + * Creates a new account for user. + * Scopes: wallet:accounts:create + */ + createAccount(opts: CreateAccountOpts, cb: (error: Error, result: Account) => void): void; + + /** + * Lists current user’s payment methods + * Scope: wallet:payment-methods:read + */ + getPaymentMethods(cb: (error: Error, result: PaymentMethod[]) => void): void; + + /** + * Show current user’s payment method. + * Scope: wallet:payment-methods:read + */ + getPaymentMethod(id: string, cb: (error: Error, result: PaymentMethod) => void): void; + + /** + * List known currencies. Currency codes will conform to the ISO 4217 standard where possible. Currencies which have or had no + * representation in ISO 4217 may use a custom code (e.g. BTC). + * Scope: none + */ + getCurrencies(cb: (error: Error, result: Currency[]) => void): void; + + /** + * Get current exchange rates. Default base currency is USD but it can be defined as any supported currency. + * Returned rates will define the exchange rate for one unit of the base currency. + * Scope: none + */ + getExchangeRates(opts: GetExchangeRateOpts, cb: (error: Error, result: ExchangeRate) => void): void; + + /** + * Get the total price to buy one bitcoin or ether. Note that exchange rates fluctuates so the price is only correct for seconds at the time. + * This buy price includes standard Coinbase fee (1%) but excludes any other fees including bank fees. + * If you need more accurate price estimate for a specific payment method or amount, @see Account#buy() and `quote: true` option. + * Scope: none + */ + getBuyPrice(opts: GetBuyPriceOpts, cb: (error: Error, result: MoneyHash) => void): void; + + /** + * Get the total price to sell one bitcoin or ether. Note that exchange rates fluctuates so the price is only correct for seconds at the time. + * This sell price includes standard Coinbase fee (1%) but excludes any other fees including bank fees. If you need more accurate price + * estimate for a specific payment method or amount, see sell bitcoin endpoint and quote: true option. + * Scope: none + */ + getSellPrice(opts: GetSellPriceOpts, cb: (error: Error, result: MoneyHash) => void): void; + + /** + * Get the current market price for bitcoin. This is usually somewhere in between the buy and sell price. + * Note that exchange rates fluctuates so the price is only correct for seconds at the time. + * You can also get historic prices with date parameter. + * Scope: none + */ + getSpotPrice(opts: GetSpotPriceOpts, cb: (error: Error, result: MoneyHash) => void): void; + + /** + * Get the API server time. + */ + getTime(cb: (error: Error, result: Time) => void): void; +} diff --git a/types/coinbase/tsconfig.json b/types/coinbase/tsconfig.json new file mode 100644 index 0000000000..6f8b261d27 --- /dev/null +++ b/types/coinbase/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "coinbase-tests.ts" + ] +} diff --git a/types/coinbase/tslint.json b/types/coinbase/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/coinbase/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a10336e48d6f156fb227c82230355e62292ae7f7 Mon Sep 17 00:00:00 2001 From: Ignacio Bona Piedrabuena Date: Mon, 20 Nov 2017 14:44:58 -0800 Subject: [PATCH 137/322] Adding mount options --- types/ember/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index adef4e70c2..40246fc310 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -2097,7 +2097,10 @@ declare module 'ember' { options?: { path?: string; resetNamespace?: boolean }, callback?: (this: RouterDSL) => void ): void; - mount(name: string): void; + mount( + name: string, + options?: { as?: string, path?: string; resetNamespace?: boolean, engineInfo?: any } + ): void } class Service extends Object {} /** From a946202e81f5f3e420a8fcc1144a37b9ece64093 Mon Sep 17 00:00:00 2001 From: Ignacio Bona Piedrabuena Date: Mon, 20 Nov 2017 15:50:16 -0800 Subject: [PATCH 138/322] Fixing route mount and adding tests --- types/ember/index.d.ts | 9 +++++++-- types/ember/test/router.ts | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 40246fc310..3bc62259de 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -2099,8 +2099,13 @@ declare module 'ember' { ): void; mount( name: string, - options?: { as?: string, path?: string; resetNamespace?: boolean, engineInfo?: any } - ): void + options?: { + as?: string, + path?: string, + resetNamespace?: boolean, + engineInfo?: any + } + ): void; } class Service extends Object {} /** diff --git a/types/ember/test/router.ts b/types/ember/test/router.ts index a4aa89af1a..9ec79ce281 100755 --- a/types/ember/test/router.ts +++ b/types/ember/test/router.ts @@ -20,4 +20,5 @@ AppRouter.map(function() { }); this.route('not-found', { path: '/*path' }); this.mount('my-engine'); + this.mount('my-engine', { as: 'some-other-engine', path: '/some-other-engine'}); }); From a794e8ac591a38486c8db3e0e136f507f1c1e201 Mon Sep 17 00:00:00 2001 From: Derek Wickern Date: Sat, 2 Dec 2017 09:17:02 -0800 Subject: [PATCH 139/322] new typings for ember-qunit, ember-mocha, ember-test-helpers --- types/ember-mocha/ember-mocha-tests.ts | 187 ++++++++++++++++++ types/ember-mocha/index.d.ts | 95 +++++++++ types/ember-mocha/tsconfig.json | 21 ++ types/ember-mocha/tslint.json | 18 ++ types/ember-qunit/ember-qunit-tests.ts | 107 ++++++++++ types/ember-qunit/index.d.ts | 124 ++++++++++++ types/ember-qunit/tsconfig.json | 21 ++ types/ember-qunit/tslint.json | 9 + .../ember-test-helpers-tests.ts | 25 +++ types/ember-test-helpers/index.d.ts | 95 +++++++++ types/ember-test-helpers/tsconfig.json | 22 +++ 11 files changed, 724 insertions(+) create mode 100644 types/ember-mocha/ember-mocha-tests.ts create mode 100644 types/ember-mocha/index.d.ts create mode 100644 types/ember-mocha/tsconfig.json create mode 100644 types/ember-mocha/tslint.json create mode 100644 types/ember-qunit/ember-qunit-tests.ts create mode 100644 types/ember-qunit/index.d.ts create mode 100644 types/ember-qunit/tsconfig.json create mode 100644 types/ember-qunit/tslint.json create mode 100644 types/ember-test-helpers/ember-test-helpers-tests.ts create mode 100644 types/ember-test-helpers/index.d.ts create mode 100644 types/ember-test-helpers/tsconfig.json diff --git a/types/ember-mocha/ember-mocha-tests.ts b/types/ember-mocha/ember-mocha-tests.ts new file mode 100644 index 0000000000..a4c055c91b --- /dev/null +++ b/types/ember-mocha/ember-mocha-tests.ts @@ -0,0 +1,187 @@ +import { + describeComponent, describeModel, describeModule, + setResolver, setupAcceptanceTest, setupComponentTest, + setupModelTest, setupTest +} from 'ember-mocha'; +import { describe, it, beforeEach, afterEach, before, after } from 'mocha'; +import chai = require('chai'); +import Ember from "ember"; +import hbs from 'htmlbars-inline-precompile'; + +describeModule('name', function() { + beforeEach(function() { + }); + + it('test', function() { + }); +}); + +describeModule('name', 'description', function() { + it('test', function() { + }); +}); + +describeModule( + 'name', + 'description', + { + needs: ['service:notifications'] + }, + function() { + } +); + +describeModule('component:x-foo', 'TestModule callbacks', { + needs: [], + + beforeSetup() { + }, + setup() { + }, + teardown() { + }, + afterTeardown() { + } +}, function() { +}); + +describeComponent('x-foo', { + integration: true +}, function() { +}); + +describeComponent('x-foo', { + unit: true, + needs: ['helper:pluralize-string'] +}, function() { +}); + +describeComponent.skip( + 'block-slot', + 'Integration: BlockSlotComponent', + { + integration: true + }, + function() { + } +); + +describeModel('user', { + needs: ['model:child'] +}, function() { +}); + +describeModule('component:x-foo', 'TestModule callbacks', function() { + before(function() { + class I18n extends Ember.Object {} + + this.skip(); + this.timeout(1000); + this.registry.register('helper:i18n', I18n); + this.registry.register('helper:i18n', I18n, { singleton: true }); + this.register('service:i18n', {}); + this.inject.service('i18n'); + this.inject.service('i18n', { as: 'i18n' }); + this.factory('object:user').create(); + }); + + after(function() { + }); + + beforeEach(function() { + }); + + afterEach(function() { + }); +}); + +describe('setupTest', function() { + setupTest(); + + setupTest('service:ajax'); + + setupTest('service:ajax', { + unit: true + }); + + setupTest('controller:sidebar', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] + }); + + setupComponentTest('gravatar-image', { + // specify the other units that are required for this test + // needs: ['component:foo', 'helper:bar'] + }); + + setupModelTest('contact', { + // Specify the other units that are required for this test. + needs: [] + }); + + const Application = Ember.Application.extend(); + + setupAcceptanceTest({ Application }); + + it('test', function() { + }); +}); + +// if you don't have a custom resolver, do it like this: +setResolver(Ember.DefaultResolver.create()); + +it('renders', function() { + // setup the outer context + this.set('value', 'cat'); + this.on('action', function(result) { + chai.expect(result).to.equal('bar', 'The correct result was returned'); + chai.expect(this.get('value')).to.equal('cat'); + }); + + // render the component + this.render(hbs` + {{ x-foo value=value action="result" }} + `); + this.render('{{ x-foo value=value action="result" }}'); + this.render([ + '{{ x-foo value=value action="result" }}' + ]); + + chai.expect(this.$('div>.value').text()).to.equal('cat', 'The component shows the correct value'); + + this.$('button').click(); +}); + +it('renders', function() { + // creates the component instance + const subject = this.subject(); + + const subject2 = this.subject({ + item: 42 + }); + + const { inputFormat } = this.setProperties({ + inputFormat: 'M/D/YY', + outputFormat: 'MMMM D, YYYY', + date: '5/3/10' + }); + + const { inputFormat: if2, outputFormat } = this.getProperties('inputFormat', 'outputFormat'); + + const inputFormat2 = this.get('inputFormat'); + + // render the component on the page + this.render(); + chai.expect(this.$('.foo').text()).to.equal('bar'); +}); + +it('can calculate the result', function(assert) { + const subject = this.subject(); + + subject.set('value', 'foo'); + chai.assert.equal(subject.get('result'), 'bar'); +}); + +it.skip('disabled test'); + +it.skip('disabled test', function() { }); diff --git a/types/ember-mocha/index.d.ts b/types/ember-mocha/index.d.ts new file mode 100644 index 0000000000..d114b6620d --- /dev/null +++ b/types/ember-mocha/index.d.ts @@ -0,0 +1,95 @@ +// Type definitions for ember-mocha 0.12 +// Project: https://github.com/emberjs/ember-mocha#readme +// Definitions by: Derek Wickern +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import { TestContext, ModuleCallbacks } from "ember-test-helpers"; +import Ember from 'ember'; +import { it as mochaIt, ISuiteCallbackContext } from 'mocha'; + +// these globals are re-exported as named exports by ember-mocha +type mochaBefore = typeof before; +type mochaAfter = typeof after; +type mochaBeforeEach = typeof beforeEach; +type mochaAfterEach = typeof afterEach; +type mochaSetup = typeof setup; +type mochaTeardown = typeof teardown; +type mochaSuiteSetup = typeof suiteSetup; +type mochaSuiteTeardown = typeof suiteTeardown; + +declare module 'ember-mocha' { + interface ContextDefinitionFunction { + (name: string, description: string, callbacks: ModuleCallbacks, tests: (this: ISuiteCallbackContext) => void): void; + (name: string, description: string, tests: (this: ISuiteCallbackContext) => void): void; + (name: string, callbacks: ModuleCallbacks, tests: (this: ISuiteCallbackContext) => void): void; + (name: string, tests: (this: ISuiteCallbackContext) => void): void; + } + + interface ContextDefinition extends ContextDefinitionFunction { + only: ContextDefinitionFunction; + skip: ContextDefinitionFunction; + } + + interface SetupTest { + (name?: string, callbacks?: ModuleCallbacks): void; + (callbacks: ModuleCallbacks): void; + } + + /** + * + * @param {string} fullName The full name of the unit, ie controller:application, route:index. + * @param {string} description The description of the module + * @param {ModuleCallbacks} callbacks + * @deprecated Use setupTest instead + */ + export const describeModule: ContextDefinition; + + /** + * + * @param {string} fullName the short name of the component that you'd use in a template, ie x-foo, ic-tabs, etc. + * @param {string} description The description of the module + * @param {ModuleCallbacks} callbacks + * @deprecated Use setupComponentTest instead + */ + export const describeComponent: ContextDefinition; + + /** + * + * @param {string} fullName the short name of the model you'd use in store operations ie user, assignmentGroup, etc. + * @param {string} description The description of the module + * @param {ModuleCallbacks} callbacks + * @deprecated Use setupModelTest instead + */ + export const describeModel: ContextDefinition; + + export const setupTest: SetupTest; + export const setupAcceptanceTest: SetupTest; + export const setupComponentTest: SetupTest; + export const setupModelTest: SetupTest; + + export const it: typeof mochaIt; + + /** + * Sets a Resolver globally which will be used to look up objects from each test's container. + */ + export function setResolver(resolver: Ember.Resolver): void; +} + +declare module 'mocha' { + // augment test callback context + interface ITestCallbackContext extends TestContext {} + interface IHookCallbackContext extends TestContext {} + + // re-export mocha globals as named exports + export const describe: Mocha.IContextDefinition; + export const it: Mocha.ITestDefinition; + export const setup: mochaSetup; + export const teardown: mochaTeardown; + export const suiteSetup: mochaSuiteSetup; + export const suiteTeardown: mochaSuiteTeardown; + export const before: mochaBefore; + export const after: mochaAfter; + export const beforeEach: mochaBeforeEach; + export const afterEach: mochaAfterEach; +} diff --git a/types/ember-mocha/tsconfig.json b/types/ember-mocha/tsconfig.json new file mode 100644 index 0000000000..e9fdedfe7f --- /dev/null +++ b/types/ember-mocha/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ember-mocha-tests.ts" + ] +} diff --git a/types/ember-mocha/tslint.json b/types/ember-mocha/tslint.json new file mode 100644 index 0000000000..aed9a80a73 --- /dev/null +++ b/types/ember-mocha/tslint.json @@ -0,0 +1,18 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "only-arrow-functions": false, + "strict-export-declare-modifiers": false, + "no-duplicate-imports": false, + "unified-signatures": false, + "no-declare-current-package": false, + + // ERROR: An interface declaring no members is equivalent to its supertype. + // -- Not true when augmenting an interface + "no-empty-interface": false, + + // ERROR: interface name must not have an "I" prefix + // -- Augmenting @types/mocha which uses "I" prefix + "interface-name": false + } +} diff --git a/types/ember-qunit/ember-qunit-tests.ts b/types/ember-qunit/ember-qunit-tests.ts new file mode 100644 index 0000000000..de22ab3d94 --- /dev/null +++ b/types/ember-qunit/ember-qunit-tests.ts @@ -0,0 +1,107 @@ +import Ember from 'ember'; +import hbs from 'htmlbars-inline-precompile'; +import { test, skip, moduleFor, moduleForModel, moduleForComponent, setResolver } from 'ember-qunit'; + +moduleForComponent('x-foo', { + integration: true +}); + +moduleForComponent('x-foo', { + unit: true, + needs: ['helper:pluralize-string'] +}); + +moduleForModel('user', { + needs: ['model:child'] +}); + +moduleFor('controller:home'); + +moduleFor('component:x-foo', 'Some description'); + +moduleFor('component:x-foo', 'TestModule callbacks', { + beforeSetup() { + }, + + beforeEach(assert) { + this.registry.register('helper:i18n', {}); + this.register('service:i18n', {}); + this.inject.service('i18n'); + this.inject.service('i18n', { as: 'i18n' }); + this.factory('object:user').create(); + assert.ok(true); + }, + + afterEach(assert) { + assert.ok(true); + }, + + afterTeardown(assert) { + assert.ok(true); + } +}); + +// if you don't have a custom resolver, do it like this: +setResolver(Ember.DefaultResolver.create()); + +test('it renders', function(assert) { + assert.expect(2); + + // setup the outer context + this.set('value', 'cat'); + this.on('action', function(result) { + assert.equal(result, 'bar', 'The correct result was returned'); + assert.equal(this.get('value'), 'cat'); + }); + + // render the component + this.render(hbs` + {{ x-foo value=value action="result" }} + `); + this.render('{{ x-foo value=value action="result" }}'); + this.render([ + '{{ x-foo value=value action="result" }}' + ]); + + assert.equal(this.$('div>.value').text(), 'cat', 'The component shows the correct value'); + + this.$('button').click(); +}); + +test('it renders', function(assert) { + assert.expect(1); + + // creates the component instance + const subject = this.subject(); + + const subject2 = this.subject({ + item: 42 + }); + + const { inputFormat } = this.setProperties({ + inputFormat: 'M/D/YY', + outputFormat: 'MMMM D, YYYY', + date: '5/3/10' + }); + + const { inputFormat: if2, outputFormat } = this.getProperties('inputFormat', 'outputFormat'); + + const inputFormat2 = this.get('inputFormat'); + + // render the component on the page + this.render(); + assert.equal(this.$('.foo').text(), 'bar'); +}); + +test('It can calculate the result', function(assert) { + assert.expect(1); + + const subject = this.subject(); + + subject.set('value', 'foo'); + assert.equal(subject.get('result'), 'bar'); +}); + +skip('disabled test'); + +skip('disabled test', function(assert) { }); diff --git a/types/ember-qunit/index.d.ts b/types/ember-qunit/index.d.ts new file mode 100644 index 0000000000..ef75eeeb26 --- /dev/null +++ b/types/ember-qunit/index.d.ts @@ -0,0 +1,124 @@ +// Type definitions for ember-qunit 2.2 +// Project: https://github.com/emberjs/ember-qunit#readme +// Definitions by: Derek Wickern +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +declare module 'ember-qunit' { + import Ember from 'ember'; + import { ModuleCallbacks } from "ember-test-helpers"; + + interface QUnitModuleCallbacks extends ModuleCallbacks, Hooks { + beforeSetup?(assert: Assert): void; + setup?(assert: Assert): void; + teardown?(assert: Assert): void; + afterTeardown?(assert: Assert): void; + } + + /** + * + * @param {string} fullName The full name of the unit, ie controller:application, route:index. + * @param {string} description The description of the module + * @param {ModuleCallbacks} callbacks + */ + export function moduleFor(fullName: string, description: string, callbacks?: QUnitModuleCallbacks): void; + export function moduleFor(fullName: string, callbacks?: QUnitModuleCallbacks): void; + + /** + * + * @param {string} fullName the short name of the component that you'd use in a template, ie x-foo, ic-tabs, etc. + * @param {string} description The description of the module + * @param {ModuleCallbacks} callbacks + */ + export function moduleForComponent(fullName: string, description: string, callbacks?: QUnitModuleCallbacks): void; + export function moduleForComponent(fullName: string, callbacks?: QUnitModuleCallbacks): void; + + /** + * + * @param {string} fullName the short name of the model you'd use in store operations ie user, assignmentGroup, etc. + * @param {string} description The description of the module + * @param {ModuleCallbacks} callbacks + */ + export function moduleForModel(fullName: string, description: string, callbacks?: QUnitModuleCallbacks): void; + export function moduleForModel(fullName: string, callbacks?: QUnitModuleCallbacks): void; + + /** + * Sets a Resolver globally which will be used to look up objects from each test's container. + */ + export function setResolver(resolver: Ember.Resolver): void; + + export class QUnitAdapter extends Ember.Test.Adapter {} + + export { module, test, skip, only, todo } from 'qunit'; +} + +declare module 'qunit' { + import { TestContext } from "ember-test-helpers"; + + export const module: typeof QUnit.module; + + /** + * Add a test to run. + * + * Add a test to run using `QUnit.test()`. + * + * The `assert` argument to the callback contains all of QUnit's assertion + * methods. Use this argument to call your test assertions. + * + * `QUnit.test()` can automatically handle the asynchronous resolution of a + * Promise on your behalf if you return a thenable Promise as the result of + * your callback function. + * + * @param {string} name Title of unit being tested + * @param callback Function to close over assertions + */ + export function test(name: string, callback: (this: TestContext, assert: Assert) => void): void; + + /** + * Adds a test to exclusively run, preventing all other tests from running. + * + * Use this method to focus your test suite on a specific test. QUnit.only + * will cause any other tests in your suite to be ignored. + * + * Note, that if more than one QUnit.only is present only the first instance + * will run. + * + * This is an alternative to filtering tests to run in the HTML reporter. It + * is especially useful when you use a console reporter or in a codebase + * with a large set of long running tests. + * + * @param {string} name Title of unit being tested + * @param callback Function to close over assertions + */ + export function only(name: string, callback: (this: TestContext, assert: Assert) => void): void; + + /** + * Use this method to test a unit of code which is still under development (in a “todo” state). + * The test will pass as long as one failing assertion is present. + * + * If all assertions pass, then the test will fail signaling that `QUnit.todo` should + * be replaced by `QUnit.test`. + * + * @param {string} name Title of unit being tested + * @param callback Function to close over assertions + */ + export function todo(name: string, callback: (this: TestContext, assert: Assert) => void): void; + + /** + * Adds a test like object to be skipped. + * + * Use this method to replace QUnit.test() instead of commenting out entire + * tests. + * + * This test's prototype will be listed on the suite as a skipped test, + * ignoring the callback argument and the respective global and module's + * hooks. + * + * @param {string} Title of unit being tested + */ + export const skip: typeof QUnit.skip; + + export default QUnit; +} diff --git a/types/ember-qunit/tsconfig.json b/types/ember-qunit/tsconfig.json new file mode 100644 index 0000000000..845f5b1023 --- /dev/null +++ b/types/ember-qunit/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ember-qunit-tests.ts" + ] +} diff --git a/types/ember-qunit/tslint.json b/types/ember-qunit/tslint.json new file mode 100644 index 0000000000..5070b08af9 --- /dev/null +++ b/types/ember-qunit/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "only-arrow-functions": false, + "strict-export-declare-modifiers": false, + "no-duplicate-imports": false, + "no-declare-current-package": false + } +} diff --git a/types/ember-test-helpers/ember-test-helpers-tests.ts b/types/ember-test-helpers/ember-test-helpers-tests.ts new file mode 100644 index 0000000000..fe9876803f --- /dev/null +++ b/types/ember-test-helpers/ember-test-helpers-tests.ts @@ -0,0 +1,25 @@ +/// +import { ModuleCallbacks, TestModule } from "ember-test-helpers"; +import wait from 'ember-test-helpers/wait'; +import hasEmberVersion from 'ember-test-helpers/has-ember-version'; + +function moduleFor(name: string, description: string, callbacks: ModuleCallbacks) { + let module = new TestModule(name, description, callbacks); + + QUnit.module(module.name, { + beforeEach() { + module.setup(); + }, + afterEach() { + module.teardown(); + } + }); +} + +async function testWait() { + await wait(); +} + +if (hasEmberVersion(2, 10)) { + // ... +} diff --git a/types/ember-test-helpers/index.d.ts b/types/ember-test-helpers/index.d.ts new file mode 100644 index 0000000000..26591d7d23 --- /dev/null +++ b/types/ember-test-helpers/index.d.ts @@ -0,0 +1,95 @@ +// Type definitions for ember-test-helpers 0.6 +// Project: https://github.com/emberjs/ember-test-helpers#readme +// Definitions by: Derek Wickern +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +declare module 'ember-test-helpers' { + import Ember from 'ember'; + import DS from 'ember-data'; + import { TemplateFactory } from 'htmlbars-inline-precompile'; + import RSVP from "rsvp"; + + interface ModuleCallbacks { + integration?: boolean; + unit?: boolean; + needs?: string[]; + + beforeSetup?(assert?: any): void; + setup?(assert?: any): void; + teardown?(assert?: any): void; + afterTeardown?(assert?: any): void; + + [key: string]: any; + } + + interface TestContext { + get(key: string): any; + getProperties(...keys: K[]): Pick; + set(key: string, value: V): V; + setProperties

(hash: P): P; + on(actionName: string, handler: (this: TestContext, ...args: any[]) => any): void; + send(actionName: string): void; + $: JQueryStatic; + subject(options?: {}): any; + render(template?: string | string[] | TemplateFactory): void; + clearRender(): void; + registry: Ember.Registry; + container: Ember.Container; + dispatcher: Ember.EventDispatcher; + application: Ember.Application; + store: DS.Store; + register(fullName: string, factory: any): void; + factory(fullName: string): any; + inject: { + controller(name: string, options?: { as: string }): any; + service(name: string, options?: { as: string }): any; + }; + } + + class TestModule { + constructor(name: string, callbacks?: ModuleCallbacks); + constructor(name: string, description?: string, callbacks?: ModuleCallbacks); + + name: string; + subjectName: string; + description: string; + isIntegration: boolean; + callbacks: ModuleCallbacks; + context: TestContext; + resolver: Ember.Resolver; + + setup(assert?: any): RSVP.Promise; + teardown(assert?: any): RSVP.Promise; + getContext(): TestContext; + setContext(context: TestContext): void; + } + + class TestModuleForAcceptance extends TestModule {} + class TestModuleForIntegration extends TestModule {} + class TestModuleForComponent extends TestModule {} + class TestModuleForModel extends TestModule {} + + function getContext(): TestContext | undefined; + function setContext(context: TestContext): void; + function unsetContext(): void; + function setResolver(resolver: Ember.Resolver): void; +} + +declare module 'ember-test-helpers/wait' { + import RSVP from "rsvp"; + + interface WaitOptions { + waitForTimers?: boolean; + waitForAJAX?: boolean; + waitForWaiters?: boolean; + } + + export default function wait(options?: WaitOptions): RSVP.Promise; +} + +declare module 'ember-test-helpers/has-ember-version' { + export default function hasEmberVersion(major: number, minor: number): boolean; +} diff --git a/types/ember-test-helpers/tsconfig.json b/types/ember-test-helpers/tsconfig.json new file mode 100644 index 0000000000..dc9c583d1c --- /dev/null +++ b/types/ember-test-helpers/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ember-test-helpers-tests.ts" + ] +} From 09b8dc2546a2669d50198d063b41a8fcec9e29df Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Sat, 2 Dec 2017 18:47:31 +0000 Subject: [PATCH 140/322] add some quill types --- types/quill/index.d.ts | 6 ++++++ types/quill/package.json | 6 ++++++ types/quill/quill-tests.ts | 6 ++++++ 3 files changed, 18 insertions(+) create mode 100644 types/quill/package.json diff --git a/types/quill/index.d.ts b/types/quill/index.d.ts index 6325913519..7cad5330a2 100644 --- a/types/quill/index.d.ts +++ b/types/quill/index.d.ts @@ -2,8 +2,11 @@ // Project: https://github.com/quilljs/quill/ // Definitions by: Sumit // Guillaume +// James Garbutt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import { Blot } from 'parchment/src/blot/abstract/blot'; + /** * A stricter type definition would be: * @@ -56,7 +59,9 @@ export interface QuillOptionsStatic { } export interface BoundsStatic { + bottom: number; left: number; + right: number; top: number; height: number; width: number; @@ -136,6 +141,7 @@ export class Quill implements EventEmitter { */ root: HTMLDivElement; clipboard: ClipboardStatic; + scroll: Blot; constructor(container: string | Element, options?: QuillOptionsStatic); deleteText(index: number, length: number, source?: Sources): DeltaStatic; disable(): void; diff --git a/types/quill/package.json b/types/quill/package.json new file mode 100644 index 0000000000..85d0ed05d1 --- /dev/null +++ b/types/quill/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "parchment": "^1.1.2" + } +} diff --git a/types/quill/quill-tests.ts b/types/quill/quill-tests.ts index 142c821ffa..f907092ed1 100644 --- a/types/quill/quill-tests.ts +++ b/types/quill/quill-tests.ts @@ -1,4 +1,5 @@ import { Quill, Delta, DeltaStatic, RangeStatic, StringMap } from 'quill'; +import { Blot } from 'parchment/src/blot/abstract/blot'; function test_quill() { const quillEditor = new Quill('#editor', { @@ -10,6 +11,11 @@ function test_quill() { }); } +function test_scroll() { + const quillEditor = new Quill('#editor'); + const blot: Blot = quillEditor.scroll; +} + function test_deleteText() { const quillEditor = new Quill('#editor'); quillEditor.deleteText(0, 10); From 116d67d8f594369bfb7f839d9f42b7be24c5e930 Mon Sep 17 00:00:00 2001 From: Derek Wickern Date: Sat, 2 Dec 2017 10:26:32 -0800 Subject: [PATCH 141/322] fix tslint errors --- types/ember-mocha/index.d.ts | 24 +++-------------- types/ember-qunit/index.d.ts | 26 +++++++------------ .../ember-test-helpers-tests.ts | 2 +- types/ember-test-helpers/tslint.json | 8 ++++++ 4 files changed, 22 insertions(+), 38 deletions(-) create mode 100644 types/ember-test-helpers/tslint.json diff --git a/types/ember-mocha/index.d.ts b/types/ember-mocha/index.d.ts index d114b6620d..6a16c54fde 100644 --- a/types/ember-mocha/index.d.ts +++ b/types/ember-mocha/index.d.ts @@ -36,31 +36,13 @@ declare module 'ember-mocha' { (callbacks: ModuleCallbacks): void; } - /** - * - * @param {string} fullName The full name of the unit, ie controller:application, route:index. - * @param {string} description The description of the module - * @param {ModuleCallbacks} callbacks - * @deprecated Use setupTest instead - */ + /** @deprecated Use setupTest instead */ export const describeModule: ContextDefinition; - /** - * - * @param {string} fullName the short name of the component that you'd use in a template, ie x-foo, ic-tabs, etc. - * @param {string} description The description of the module - * @param {ModuleCallbacks} callbacks - * @deprecated Use setupComponentTest instead - */ + /** @deprecated Use setupComponentTest instead */ export const describeComponent: ContextDefinition; - /** - * - * @param {string} fullName the short name of the model you'd use in store operations ie user, assignmentGroup, etc. - * @param {string} description The description of the module - * @param {ModuleCallbacks} callbacks - * @deprecated Use setupModelTest instead - */ + /** @deprecated Use setupModelTest instead */ export const describeModel: ContextDefinition; export const setupTest: SetupTest; diff --git a/types/ember-qunit/index.d.ts b/types/ember-qunit/index.d.ts index ef75eeeb26..0edc5c837f 100644 --- a/types/ember-qunit/index.d.ts +++ b/types/ember-qunit/index.d.ts @@ -18,28 +18,22 @@ declare module 'ember-qunit' { } /** - * - * @param {string} fullName The full name of the unit, ie controller:application, route:index. - * @param {string} description The description of the module - * @param {ModuleCallbacks} callbacks + * @param fullName The full name of the unit, ie controller:application, route:index. + * @param description The description of the module */ export function moduleFor(fullName: string, description: string, callbacks?: QUnitModuleCallbacks): void; export function moduleFor(fullName: string, callbacks?: QUnitModuleCallbacks): void; /** - * - * @param {string} fullName the short name of the component that you'd use in a template, ie x-foo, ic-tabs, etc. - * @param {string} description The description of the module - * @param {ModuleCallbacks} callbacks + * @param fullName the short name of the component that you'd use in a template, ie x-foo, ic-tabs, etc. + * @param description The description of the module */ export function moduleForComponent(fullName: string, description: string, callbacks?: QUnitModuleCallbacks): void; export function moduleForComponent(fullName: string, callbacks?: QUnitModuleCallbacks): void; /** - * - * @param {string} fullName the short name of the model you'd use in store operations ie user, assignmentGroup, etc. - * @param {string} description The description of the module - * @param {ModuleCallbacks} callbacks + * @param fullName the short name of the model you'd use in store operations ie user, assignmentGroup, etc. + * @param description The description of the module */ export function moduleForModel(fullName: string, description: string, callbacks?: QUnitModuleCallbacks): void; export function moduleForModel(fullName: string, callbacks?: QUnitModuleCallbacks): void; @@ -71,7 +65,7 @@ declare module 'qunit' { * Promise on your behalf if you return a thenable Promise as the result of * your callback function. * - * @param {string} name Title of unit being tested + * @param name Title of unit being tested * @param callback Function to close over assertions */ export function test(name: string, callback: (this: TestContext, assert: Assert) => void): void; @@ -89,7 +83,7 @@ declare module 'qunit' { * is especially useful when you use a console reporter or in a codebase * with a large set of long running tests. * - * @param {string} name Title of unit being tested + * @param name Title of unit being tested * @param callback Function to close over assertions */ export function only(name: string, callback: (this: TestContext, assert: Assert) => void): void; @@ -101,7 +95,7 @@ declare module 'qunit' { * If all assertions pass, then the test will fail signaling that `QUnit.todo` should * be replaced by `QUnit.test`. * - * @param {string} name Title of unit being tested + * @param name Title of unit being tested * @param callback Function to close over assertions */ export function todo(name: string, callback: (this: TestContext, assert: Assert) => void): void; @@ -116,7 +110,7 @@ declare module 'qunit' { * ignoring the callback argument and the respective global and module's * hooks. * - * @param {string} Title of unit being tested + * @param Title of unit being tested */ export const skip: typeof QUnit.skip; diff --git a/types/ember-test-helpers/ember-test-helpers-tests.ts b/types/ember-test-helpers/ember-test-helpers-tests.ts index fe9876803f..f21d554cfa 100644 --- a/types/ember-test-helpers/ember-test-helpers-tests.ts +++ b/types/ember-test-helpers/ember-test-helpers-tests.ts @@ -4,7 +4,7 @@ import wait from 'ember-test-helpers/wait'; import hasEmberVersion from 'ember-test-helpers/has-ember-version'; function moduleFor(name: string, description: string, callbacks: ModuleCallbacks) { - let module = new TestModule(name, description, callbacks); + const module = new TestModule(name, description, callbacks); QUnit.module(module.name, { beforeEach() { diff --git a/types/ember-test-helpers/tslint.json b/types/ember-test-helpers/tslint.json new file mode 100644 index 0000000000..659431c9ea --- /dev/null +++ b/types/ember-test-helpers/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "strict-export-declare-modifiers": false, + "no-duplicate-imports": false, + "no-declare-current-package": false + } +} From 106825d2fe24adea60d3c0f8738c5d5844dd40e9 Mon Sep 17 00:00:00 2001 From: William Lohan Date: Sat, 2 Dec 2017 16:39:26 -0800 Subject: [PATCH 142/322] update project url --- types/less2sass/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/less2sass/index.d.ts b/types/less2sass/index.d.ts index af2746177a..eb1e5801bd 100644 --- a/types/less2sass/index.d.ts +++ b/types/less2sass/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for less2sass 1.0 -// Project: http://erickryski.com +// Project: https://github.com/ekryski/less2sass // Definitions by: William Lohan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From e1ce6b42093d56b5a9bd1b7d81f019a4a09bdb79 Mon Sep 17 00:00:00 2001 From: int0h Date: Sun, 3 Dec 2017 04:16:06 +0300 Subject: [PATCH 143/322] Type definitions for weak 1.0.1 --- types/weak/index.d.ts | 68 ++++++++++++++++++++++++++++++++++++++++ types/weak/tsconfig.json | 22 +++++++++++++ types/weak/tslint.json | 1 + types/weak/weak-tests.ts | 9 ++++++ 4 files changed, 100 insertions(+) create mode 100644 types/weak/index.d.ts create mode 100644 types/weak/tsconfig.json create mode 100644 types/weak/tslint.json create mode 100644 types/weak/weak-tests.ts diff --git a/types/weak/index.d.ts b/types/weak/index.d.ts new file mode 100644 index 0000000000..554e7474d8 --- /dev/null +++ b/types/weak/index.d.ts @@ -0,0 +1,68 @@ +// Type definitions for weak 1.0.1 +// Project: https://github.com/TooTallNate/node-weak +// Definitions by: William Kapp +/// + +interface WeakRef {} + +/** + * Makes weak references to JavaScript Objects + * @param object can be a regular Object, an Array, a Function, a RegExp, or any of the primitive types or constructor function created with new + * @param callback a callback function to be invoked before the object is garbage collected + */ +declare function weak(object: T, callback?: () => void): WeakRef; + +declare namespace weak { + + /** + * Returns the actual reference to the Object that this weak reference was created with. If this is called with a dead reference, undefined is returned. + * @param ref + */ + export function get(ref: WeakRef): T | undefined; + + /** + * Checks to see if ref is a dead reference. Returns true if the original Object has already been GC'd, false otherwise + * @param ref + */ + export function isDead(ref: WeakRef): boolean; + + /** + * Checks to see if ref is "near death". This will be true exactly during the weak reference callback function, and false any other time. + * @param ref + */ + export function isNearDeath(ref: WeakRef): boolean; + + /** + * Checks to see if obj is "weak reference" instance. Returns true if the passed in object is a "weak reference", false otherwise. + * @param obj + */ + export function isWeakRef(obj: Object | WeakRef): boolean; + + /** + * Adds callback to the Array of callback functions that will be invoked before the Object gets garbage collected. The callbacks get executed in the order that they are added. + * @param ref + * @param callback + */ + export function addCallback(ref: WeakRef, callback: () => void): NodeJS.EventEmitter; + + /** + * Removes callback from the Array of callback functions that will be invoked before the Object gets garbage collected. + * @param ref + * @param callback + */ + export function removeCallback(ref: WeakRef, callback: () => void): NodeJS.EventEmitter; + + /** + * Empties the Array of callback functions that will be invoked before the Object gets garbage collected. + * @param ref + */ + export function removeCallbacks(ref: WeakRef): NodeJS.EventEmitter; + + /** + * Returns an Array that ref iterates through to invoke the GC callbacks. This utilizes node's EventEmitter#listeners() function and therefore returns a copy in node 0.10 and newer. + * @param ref + */ + export function callbacks(ref: WeakRef): (() => void)[]; +} + +export = weak; diff --git a/types/weak/tsconfig.json b/types/weak/tsconfig.json new file mode 100644 index 0000000000..a0bb7dd534 --- /dev/null +++ b/types/weak/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../", + "../node" + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "weak-tests.ts" + ] +} diff --git a/types/weak/tslint.json b/types/weak/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/weak/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/weak/weak-tests.ts b/types/weak/weak-tests.ts new file mode 100644 index 0000000000..01a4b2adfc --- /dev/null +++ b/types/weak/weak-tests.ts @@ -0,0 +1,9 @@ +import weak = require('weak'); + +const obj = {a: 123}; + +const weakReference = weak(obj, () => { + // collected +}); + +const sameType = weak.get(weakReference); From 09018134f8a51d8ebc63ce8c83da844834624356 Mon Sep 17 00:00:00 2001 From: int0h Date: Sun, 3 Dec 2017 04:36:47 +0300 Subject: [PATCH 144/322] weak lint fixes --- types/weak/index.d.ts | 46 +++++++++++++++++++++------------------- types/weak/tsconfig.json | 5 +++-- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/types/weak/index.d.ts b/types/weak/index.d.ts index 554e7474d8..5620540fae 100644 --- a/types/weak/index.d.ts +++ b/types/weak/index.d.ts @@ -1,68 +1,70 @@ -// Type definitions for weak 1.0.1 +// Type definitions for weak 1.0 // Project: https://github.com/TooTallNate/node-weak // Definitions by: William Kapp +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + /// -interface WeakRef {} +declare class WeakRef {} /** * Makes weak references to JavaScript Objects * @param object can be a regular Object, an Array, a Function, a RegExp, or any of the primitive types or constructor function created with new * @param callback a callback function to be invoked before the object is garbage collected */ -declare function weak(object: T, callback?: () => void): WeakRef; +declare function weak(object: T, callback?: () => void): WeakRef; declare namespace weak { - /** * Returns the actual reference to the Object that this weak reference was created with. If this is called with a dead reference, undefined is returned. - * @param ref + * @param ref weak reference object */ - export function get(ref: WeakRef): T | undefined; + function get(ref: WeakRef): T | undefined; /** * Checks to see if ref is a dead reference. Returns true if the original Object has already been GC'd, false otherwise - * @param ref + * @param ref weak reference object */ - export function isDead(ref: WeakRef): boolean; + function isDead(ref: WeakRef): boolean; /** * Checks to see if ref is "near death". This will be true exactly during the weak reference callback function, and false any other time. - * @param ref + * @param ref weak reference object */ - export function isNearDeath(ref: WeakRef): boolean; + function isNearDeath(ref: WeakRef): boolean; /** * Checks to see if obj is "weak reference" instance. Returns true if the passed in object is a "weak reference", false otherwise. - * @param obj + * @param obj object to check */ - export function isWeakRef(obj: Object | WeakRef): boolean; + function isWeakRef(obj: object | WeakRef): boolean; /** * Adds callback to the Array of callback functions that will be invoked before the Object gets garbage collected. The callbacks get executed in the order that they are added. - * @param ref - * @param callback + * @param ref weak reference object + * @param callback function to be called */ - export function addCallback(ref: WeakRef, callback: () => void): NodeJS.EventEmitter; + function addCallback(ref: WeakRef, callback: () => void): NodeJS.EventEmitter; /** * Removes callback from the Array of callback functions that will be invoked before the Object gets garbage collected. - * @param ref - * @param callback + * @param ref weak reference object + * @param callback function to be called */ - export function removeCallback(ref: WeakRef, callback: () => void): NodeJS.EventEmitter; + function removeCallback(ref: WeakRef, callback: () => void): NodeJS.EventEmitter; /** * Empties the Array of callback functions that will be invoked before the Object gets garbage collected. - * @param ref + * @param ref weak reference object */ - export function removeCallbacks(ref: WeakRef): NodeJS.EventEmitter; + function removeCallbacks(ref: WeakRef): NodeJS.EventEmitter; /** * Returns an Array that ref iterates through to invoke the GC callbacks. This utilizes node's EventEmitter#listeners() function and therefore returns a copy in node 0.10 and newer. - * @param ref + * @param ref weak reference object */ - export function callbacks(ref: WeakRef): (() => void)[]; + function callbacks(ref: WeakRef): Array<(() => void)>; } export = weak; diff --git a/types/weak/tsconfig.json b/types/weak/tsconfig.json index a0bb7dd534..33d1a4cdf3 100644 --- a/types/weak/tsconfig.json +++ b/types/weak/tsconfig.json @@ -7,11 +7,12 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ - "../", - "../node" + "../" ], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, From c0828a80fd5a246fcc606394928d22a1e84ee1af Mon Sep 17 00:00:00 2001 From: William Lohan Date: Sat, 2 Dec 2017 21:38:58 -0800 Subject: [PATCH 145/322] remove private methods --- types/less2sass/index.d.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/types/less2sass/index.d.ts b/types/less2sass/index.d.ts index eb1e5801bd..25848117f2 100644 --- a/types/less2sass/index.d.ts +++ b/types/less2sass/index.d.ts @@ -5,15 +5,6 @@ declare class Less2Sass { convert(file: string): string; - private convertColourHelpers(): Less2Sass; - private convertExtend(): Less2Sass; - private convertFileExtensions(): Less2Sass; - private convertFunctionUnit(): Less2Sass; - private convertInterpolatedVariables(): Less2Sass; - private convertMixins(): Less2Sass; - private convertTildaStrings(): Less2Sass; - private convertVariables(): Less2Sass; - private includeMixins(): Less2Sass; } declare const less2sass: Less2Sass; From dc914efc0d94e88011b7dfc554ad75c4bff1220a Mon Sep 17 00:00:00 2001 From: int0h Date: Sun, 3 Dec 2017 13:42:25 +0300 Subject: [PATCH 146/322] type guards --- types/weak/index.d.ts | 6 +++--- types/weak/weak-tests.ts | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/types/weak/index.d.ts b/types/weak/index.d.ts index 5620540fae..456a578539 100644 --- a/types/weak/index.d.ts +++ b/types/weak/index.d.ts @@ -26,19 +26,19 @@ declare namespace weak { * Checks to see if ref is a dead reference. Returns true if the original Object has already been GC'd, false otherwise * @param ref weak reference object */ - function isDead(ref: WeakRef): boolean; + function isDead(ref: WeakRef): ref is WeakRef; /** * Checks to see if ref is "near death". This will be true exactly during the weak reference callback function, and false any other time. * @param ref weak reference object */ - function isNearDeath(ref: WeakRef): boolean; + function isNearDeath(ref: WeakRef): ref is WeakRef; /** * Checks to see if obj is "weak reference" instance. Returns true if the passed in object is a "weak reference", false otherwise. * @param obj object to check */ - function isWeakRef(obj: object | WeakRef): boolean; + function isWeakRef(obj: any): obj is WeakRef; /** * Adds callback to the Array of callback functions that will be invoked before the Object gets garbage collected. The callbacks get executed in the order that they are added. diff --git a/types/weak/weak-tests.ts b/types/weak/weak-tests.ts index 01a4b2adfc..a77180823e 100644 --- a/types/weak/weak-tests.ts +++ b/types/weak/weak-tests.ts @@ -7,3 +7,20 @@ const weakReference = weak(obj, () => { }); const sameType = weak.get(weakReference); + +function foo(a: {a: number}) {} + +if (sameType) { + foo(sameType); +} + +const anyVar = null as any; + +if (weak.isWeakRef(anyVar)) { + const a = anyVar; // WeakRef +} + +if (weak.isDead(weakReference)) { + const a = weakReference; // WeakRef + const value = weak.get(weakReference); // undefined only possible +} From 519d07927946ed7026cebe9a0cc90e58c5ee6b47 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Sun, 3 Dec 2017 11:53:58 +0100 Subject: [PATCH 147/322] Fixed autor link typo @mcortesi --- types/mongodb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index fbbc318a33..0c7b90edfd 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -5,7 +5,7 @@ // Gady Piazza // Jason Dreyzehner // Gaurav Lahoti -// Mariano Cortesi +// Mariano Cortesi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From f3d99a176675b6a0ca8bd20f583ff272d56df644 Mon Sep 17 00:00:00 2001 From: Dmin Date: Sun, 3 Dec 2017 23:40:58 +0900 Subject: [PATCH 148/322] fix(algolia): geo-search parameters type --- types/algoliasearch/algoliasearch-tests.ts | 6 +++--- types/algoliasearch/index.d.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 1786b07af7..0814b0fc03 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -121,12 +121,12 @@ let _algoliaQueryParameters: AlgoliaQueryParameters = { disableTypoToleranceOnAttributes: '', aroundLatLng: '', aroundLatLngViaIP: '', - aroundRadius: '', + aroundRadius: 0, aroundPrecision: 0, minimumAroundRadius: 0, - insideBoundingBox: '', + insideBoundingBox: [[0]], queryType: '', - insidePolygon: '', + insidePolygon: [[0]], removeWordsIfNoResults: '', advancedSyntax: false, optionalWords: [''], diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index f068fc4e22..1a4b8f141a 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1770,7 +1770,7 @@ Interface describing options available for gettings the logs * You can specify aroundRadius=all if you want to compute the geo distance without filtering in a geo area * https://github.com/algolia/algoliasearch-client-js#aroundradius */ - aroundRadius?: any; + aroundRadius?: number | 'all'; /** * Control the precision of a geo search * default: null @@ -1788,7 +1788,7 @@ Interface describing options available for gettings the logs * default: null * https://github.com/algolia/algoliasearch-client-js#insideboundingbox */ - insideBoundingBox?: string; + insideBoundingBox?: number[][]; /** * Selects how the query words are interpreted * default: 'prefixLast' @@ -1803,7 +1803,7 @@ Interface describing options available for gettings the logs * defauly: '' * https://github.com/algolia/algoliasearch-client-js#insidepolygon */ - insidePolygon?: string; + insidePolygon?: number[][]; /** * This option is used to select a strategy in order to avoid having an empty result page * default: 'none' From 27a03d60d880614c982b937ced2fed57fe32a9a0 Mon Sep 17 00:00:00 2001 From: Jacob Bom Date: Sun, 3 Dec 2017 19:07:05 +0100 Subject: [PATCH 149/322] Changes per @rpl review See commit history at https://github.com/bomjacob/definitelytyped-firefox-webext-browser/compare/71548e2450bd9fe9b6433284bff4a268bf8c00e5...b7e3c091d1392159e04011877c5197af92d8e3a2 for full list of changes. --- .../firefox-webext-browser-tests.ts | 12 +- types/firefox-webext-browser/index.d.ts | 532 +++++++++--------- types/firefox-webext-browser/tsconfig.json | 3 +- 3 files changed, 288 insertions(+), 259 deletions(-) diff --git a/types/firefox-webext-browser/firefox-webext-browser-tests.ts b/types/firefox-webext-browser/firefox-webext-browser-tests.ts index 879b8af0bb..01d9cf9f3d 100644 --- a/types/firefox-webext-browser/firefox-webext-browser-tests.ts +++ b/types/firefox-webext-browser/firefox-webext-browser-tests.ts @@ -1,2 +1,10 @@ -// No tests yet -true; +browser.nonexistentNS; // $ExpectError +browser.nonexistentNS.unknownMethod(); // $ExpectError + +// Test that out overwritten things at least worked +browser.runtime.getManifest(); // $ExpectType WebExtensionManifest +browser.test; // $ExpectError +browser.manifest; // $ExpectError +browser._manifest; // $ExpectType typeof _manifest +browser._manifest.WebExtensionLangpackManifest; // $ExpectError +browser._manifest.NativeManifest; // $ExpectError diff --git a/types/firefox-webext-browser/index.d.ts b/types/firefox-webext-browser/index.d.ts index 8a2d34b0be..326346be82 100644 --- a/types/firefox-webext-browser/index.d.ts +++ b/types/firefox-webext-browser/index.d.ts @@ -5,12 +5,16 @@ // TypeScript Version: 2.4 // Generated using script at github.com/bomjacob/definitelytyped-firefox-webext-browser -interface EventListener any> { +interface WebExtEventListener any> { addListener: (callback: T) => void; removeListener: (listener: T) => void; hasListener: (listener: T) => boolean; } +interface Window { + browser: typeof browser; +} + declare namespace browser.alarms { /* alarms types */ interface Alarm { @@ -40,11 +44,11 @@ declare namespace browser.alarms { function clearAll(): Promise; /* alarms events */ - const onAlarm: EventListener<(name: Alarm) => void>; + const onAlarm: WebExtEventListener<(name: Alarm) => void>; } -declare namespace browser.manifest { - /* manifest types */ +declare namespace browser._manifest { + /* _manifest types */ type OptionalPermission = _OptionalPermission; type Permission = string | OptionalPermission | _Permission; @@ -162,39 +166,6 @@ declare namespace browser.manifest { }; } - interface WebExtensionLangpackManifest { - manifest_version: number; - applications?: { - gecko?: FirefoxSpecificProperties; - }; - browser_specific_settings?: { - gecko?: FirefoxSpecificProperties; - }; - name: string; - short_name?: string; - description?: string; - author?: string; - version: string; - homepage_url?: string; - langpack_id: string; - languages: { - [key: string]: { - chrome_resources: { - [key: string]: ExtensionURL | { - [key: string]: ExtensionURL; - }; - }; - version: string; - }; - }; - sources?: { - [key: string]: { - base_path: ExtensionURL; - paths?: string[]; - }; - }; - } - interface ThemeIcons { light: ExtensionURL; dark: ExtensionURL; @@ -211,7 +182,7 @@ declare namespace browser.manifest { type ImageDataOrExtensionURL = string; - type ExtensionID = string | string; + type ExtensionID = string; interface FirefoxSpecificProperties { id?: ExtensionID; @@ -220,9 +191,9 @@ declare namespace browser.manifest { strict_max_version?: string; } - type MatchPattern = string | string | _MatchPattern; + type MatchPattern = string | _MatchPattern; - type MatchPatternInternal = string | string | _MatchPatternInternal; + type MatchPatternInternal = string | _MatchPatternInternal; interface ContentScript { matches: MatchPattern[]; @@ -250,19 +221,6 @@ declare namespace browser.manifest { type PersistentBackgroundProperty = boolean; - type NativeManifest = { - name: string; - description: string; - path: string; - type: _NativeManifestType; - allowed_extensions: ExtensionID[]; - } | { - name: ExtensionID; - description: string; - data: any; - type: _NativeManifestType; - }; - interface ThemeType { images?: { additional_backgrounds?: ImageDataOrExtensionURL[]; @@ -371,7 +329,7 @@ declare namespace browser.manifest { }; } - type KeyName = string | string | string; + type KeyName = string; enum _OptionalPermission { browserSettings = "browserSettings", @@ -457,15 +415,6 @@ declare namespace browser.manifest { all_urls = "" } - enum _NativeManifestType { - pkcs11 = "pkcs11", - stdio = "stdio" - } - - enum _NativeManifestType { - storage = "storage" - } - enum _ThemeTypeAdditionalBackgroundsAlignment { bottom = "bottom", center = "center", @@ -558,15 +507,15 @@ declare namespace browser.contextualIdentities { function remove(cookieStoreId: string): void; /* contextualIdentities events */ - const onUpdated: EventListener<(changeInfo: { + const onUpdated: WebExtEventListener<(changeInfo: { contextualIdentity: ContextualIdentity; }) => void>; - const onCreated: EventListener<(changeInfo: { + const onCreated: WebExtEventListener<(changeInfo: { contextualIdentity: ContextualIdentity; }) => void>; - const onRemoved: EventListener<(changeInfo: { + const onRemoved: WebExtEventListener<(changeInfo: { contextualIdentity: ContextualIdentity; }) => void>; } @@ -642,7 +591,7 @@ declare namespace browser.cookies { function getAllCookieStores(): Promise; /* cookies events */ - const onChanged: EventListener<(changeInfo: { + const onChanged: WebExtEventListener<(changeInfo: { removed: boolean; cookie: Cookie; cause: OnChangedCause; @@ -811,18 +760,18 @@ declare namespace browser.downloads { function removeFile(downloadId: number): Promise; - function acceptDanger(downloadId: number): void; + const acceptDanger: ((downloadId: number) => void) | undefined; - function drag(downloadId: number): void; + const drag: ((downloadId: number) => void) | undefined; - function setShelfEnabled(enabled: boolean): void; + const setShelfEnabled: ((enabled: boolean) => void) | undefined; /* downloads events */ - const onCreated: EventListener<(downloadItem: DownloadItem) => void>; + const onCreated: WebExtEventListener<(downloadItem: DownloadItem) => void>; - const onErased: EventListener<(downloadId: number) => void>; + const onErased: WebExtEventListener<(downloadId: number) => void>; - const onChanged: EventListener<(downloadDelta: { + const onChanged: WebExtEventListener<(downloadDelta: { id: number; url?: StringDelta; filename?: StringDelta; @@ -859,11 +808,11 @@ declare namespace browser.events { hasListeners(): boolean; - addRules(eventName: string, webViewInstanceId: number, rules: Rule[]): void; + addRules?(eventName: string, webViewInstanceId: number, rules: Rule[]): void; - getRules(eventName: string, webViewInstanceId: number, ruleIdentifiers?: string[]): void; + getRules?(eventName: string, webViewInstanceId: number, ruleIdentifiers?: string[]): void; - removeRules(eventName: string, webViewInstanceId: number, ruleIdentifiers?: string[]): void; + removeRules?(eventName: string, webViewInstanceId: number, ruleIdentifiers?: string[]): void; } interface UrlFilter { @@ -912,22 +861,22 @@ declare namespace browser.extension { type?: ViewType; windowId?: number; tabId?: number; - }): object/*Window*/[]; + }): Window[]; - function getBackgroundPage(): object/*Window*/; + function getBackgroundPage(): Window; function isAllowedIncognitoAccess(): Promise; function isAllowedFileSchemeAccess(): Promise; - function setUpdateUrlData(data: string): void; + const setUpdateUrlData: ((data: string) => void) | undefined; /* extension events */ - const onRequest: EventListener<(request: any, sender: runtime.MessageSender, sendResponse: () => void) => void> - | EventListener<(sender: runtime.MessageSender, sendResponse: () => void) => void>; + const onRequest: WebExtEventListener<(request: any, sender: runtime.MessageSender, sendResponse: () => void) => void> + | WebExtEventListener<(sender: runtime.MessageSender, sendResponse: () => void) => void> | undefined; - const onRequestExternal: EventListener<(request: any, sender: runtime.MessageSender, sendResponse: () => void) => void> - | EventListener<(sender: runtime.MessageSender, sendResponse: () => void) => void>; + const onRequestExternal: WebExtEventListener<(request: any, sender: runtime.MessageSender, sendResponse: () => void) => void> + | WebExtEventListener<(sender: runtime.MessageSender, sendResponse: () => void) => void> | undefined; } declare namespace browser.extensionTypes { @@ -993,25 +942,25 @@ declare namespace browser.identity { } /* identity functions */ - function getAccounts(): Promise; + const getAccounts: (() => Promise) | undefined; - function getAuthToken(details?: { + const getAuthToken: ((details?: { interactive?: boolean; account?: AccountInfo; scopes?: string[]; - }): Promise; + }) => Promise) | undefined; - function getProfileUserInfo(): Promise<{ + const getProfileUserInfo: (() => Promise<{ email: string; id: string; - }>; + }>) | undefined; - function removeCachedAuthToken(details: { + const removeCachedAuthToken: ((details: { token: string; - }): Promise<{ + }) => Promise<{ email: string; id: string; - }>; + }>) | undefined; function launchWebAuthFlow(details: { url: string; @@ -1021,7 +970,7 @@ declare namespace browser.identity { function getRedirectURL(path?: string): string; /* identity events */ - const onSignInChanged: EventListener<(account: AccountInfo, signedIn: boolean) => void>; + const onSignInChanged: WebExtEventListener<(account: AccountInfo, signedIn: boolean) => void> | undefined; } declare namespace browser.idle { @@ -1037,7 +986,7 @@ declare namespace browser.idle { function setDetectionInterval(intervalInSeconds: number): void; /* idle events */ - const onStateChanged: EventListener<(newState: IdleState) => void>; + const onStateChanged: WebExtEventListener<(newState: IdleState) => void>; } declare namespace browser.management { @@ -1087,7 +1036,7 @@ declare namespace browser.management { /* management functions */ function getAll(): Promise; - function get(id: manifest.ExtensionID): Promise; + function get(id: _manifest.ExtensionID): Promise; function getSelf(): Promise; @@ -1099,13 +1048,13 @@ declare namespace browser.management { function setEnabled(id: string, enabled: boolean): Promise; /* management events */ - const onDisabled: EventListener<(info: ExtensionInfo) => void>; + const onDisabled: WebExtEventListener<(info: ExtensionInfo) => void>; - const onEnabled: EventListener<(info: ExtensionInfo) => void>; + const onEnabled: WebExtEventListener<(info: ExtensionInfo) => void>; - const onInstalled: EventListener<(info: ExtensionInfo) => void>; + const onInstalled: WebExtEventListener<(info: ExtensionInfo) => void>; - const onUninstalled: EventListener<(info: ExtensionInfo) => void>; + const onUninstalled: WebExtEventListener<(info: ExtensionInfo) => void>; } declare namespace browser.notifications { @@ -1169,38 +1118,38 @@ declare namespace browser.notifications { function create(options: CreateNotificationOptions): Promise; function create(notificationId: string, options: CreateNotificationOptions): Promise; - function update(notificationId: string, options: UpdateNotificationOptions): Promise; + const update: ((notificationId: string, options: UpdateNotificationOptions) => Promise) | undefined; function clear(notificationId: string): Promise; function getAll(): Promise; - function getPermissionLevel(): Promise; + const getPermissionLevel: (() => Promise) | undefined; /* notifications events */ - const onClosed: EventListener<(notificationId: string, byUser: boolean) => void>; + const onClosed: WebExtEventListener<(notificationId: string, byUser: boolean) => void>; - const onClicked: EventListener<(notificationId: string) => void>; + const onClicked: WebExtEventListener<(notificationId: string) => void>; - const onButtonClicked: EventListener<(notificationId: string, buttonIndex: number) => void>; + const onButtonClicked: WebExtEventListener<(notificationId: string, buttonIndex: number) => void>; - const onPermissionLevelChanged: EventListener<(level: PermissionLevel) => void>; + const onPermissionLevelChanged: WebExtEventListener<(level: PermissionLevel) => void> | undefined; - const onShowSettings: EventListener<() => void>; + const onShowSettings: WebExtEventListener<() => void> | undefined; - const onShown: EventListener<(notificationId: string) => void>; + const onShown: WebExtEventListener<(notificationId: string) => void>; } declare namespace browser.permissions { /* permissions types */ interface Permissions { - permissions?: manifest.OptionalPermission[]; - origins?: manifest.MatchPattern[]; + permissions?: _manifest.OptionalPermission[]; + origins?: _manifest.MatchPattern[]; } interface AnyPermissions { - permissions?: manifest.Permission[]; - origins?: manifest.MatchPatternInternal[]; + permissions?: _manifest.Permission[]; + origins?: _manifest.MatchPatternInternal[]; } /* permissions functions */ @@ -1213,9 +1162,9 @@ declare namespace browser.permissions { function remove(permissions: Permissions): Promise; /* permissions events */ - const onAdded: EventListener<(permissions: Permissions) => void>; + const onAdded: WebExtEventListener<(permissions: Permissions) => void> | undefined; - const onRemoved: EventListener<(permissions: Permissions) => void>; + const onRemoved: WebExtEventListener<(permissions: Permissions) => void> | undefined; } declare namespace browser.privacy { @@ -1252,7 +1201,7 @@ declare namespace browser.privacy.websites { } /* privacy.websites properties */ - const thirdPartyCookiesAllowed: types.Setting; + const thirdPartyCookiesAllowed: types.Setting | undefined; const hyperlinkAuditingEnabled: types.Setting; @@ -1262,7 +1211,7 @@ declare namespace browser.privacy.websites { const firstPartyIsolate: types.Setting; - const protectedContentEnabled: types.Setting; + const protectedContentEnabled: types.Setting | undefined; const trackingProtectionMode: types.Setting; } @@ -1276,7 +1225,7 @@ declare namespace browser.proxy { function registerProxyScript(url: string): void; /* proxy events */ - const onProxyError: EventListener<(error: object) => void>; + const onProxyError: WebExtEventListener<(error: object) => void>; } declare namespace browser.runtime { @@ -1316,7 +1265,7 @@ declare namespace browser.runtime { interface PlatformInfo { os: PlatformOs; arch: PlatformArch; - nacl_arch: PlatformNaclArch; + nacl_arch?: PlatformNaclArch; } interface BrowserInfo { @@ -1354,11 +1303,11 @@ declare namespace browser.runtime { const id: string; /* runtime functions */ - function getBackgroundPage(): Promise; + function getBackgroundPage(): Promise; function openOptionsPage(): Promise; - function getManifest(): object; + function getManifest(): _manifest.WebExtensionManifest; function getURL(path: string): string; @@ -1366,9 +1315,9 @@ declare namespace browser.runtime { function reload(): void; - function requestUpdateCheck(): Promise; + const requestUpdateCheck: (() => Promise) | undefined; - function restart(): void; + const restart: (() => void) | undefined; function connect(connectInfo?: { name?: string; @@ -1396,39 +1345,39 @@ declare namespace browser.runtime { function getPlatformInfo(): Promise; - function getPackageDirectoryEntry(): Promise; + const getPackageDirectoryEntry: (() => Promise) | undefined; /* runtime events */ - const onStartup: EventListener<() => void>; + const onStartup: WebExtEventListener<() => void>; - const onInstalled: EventListener<(details: { + const onInstalled: WebExtEventListener<(details: { reason: OnInstalledReason; previousVersion?: string; temporary: boolean; id?: string; }) => void>; - const onSuspend: EventListener<() => void>; + const onSuspend: WebExtEventListener<() => void> | undefined; - const onSuspendCanceled: EventListener<() => void>; + const onSuspendCanceled: WebExtEventListener<() => void> | undefined; - const onUpdateAvailable: EventListener<(details: { + const onUpdateAvailable: WebExtEventListener<(details: { version: string; }) => void>; - const onBrowserUpdateAvailable: EventListener<() => void>; + const onBrowserUpdateAvailable: WebExtEventListener<() => void> | undefined; - const onConnect: EventListener<(port: Port) => void>; + const onConnect: WebExtEventListener<(port: Port) => void>; - const onConnectExternal: EventListener<(port: Port) => void>; + const onConnectExternal: WebExtEventListener<(port: Port) => void>; - const onMessage: EventListener<(message: any, sender: MessageSender, sendResponse: () => void) => boolean> - | EventListener<(sender: MessageSender, sendResponse: () => void) => boolean>; + const onMessage: WebExtEventListener<(message: any, sender: MessageSender, sendResponse: () => void) => boolean> + | WebExtEventListener<(sender: MessageSender, sendResponse: () => void) => boolean>; - const onMessageExternal: EventListener<(message: any, sender: MessageSender, sendResponse: () => void) => boolean> - | EventListener<(sender: MessageSender, sendResponse: () => void) => boolean>; + const onMessageExternal: WebExtEventListener<(message: any, sender: MessageSender, sendResponse: () => void) => boolean> + | WebExtEventListener<(sender: MessageSender, sendResponse: () => void) => boolean>; - const onRestartRequired: EventListener<(reason: OnRestartRequiredReason) => void>; + const onRestartRequired: WebExtEventListener<(reason: OnRestartRequiredReason) => void> | undefined; } declare namespace browser.storage { @@ -1441,7 +1390,7 @@ declare namespace browser.storage { class StorageArea { get(keys?: string | string[] | object): Promise; - getBytesInUse(keys?: string | string[]): Promise; + getBytesInUse?(keys?: string | string[]): Promise; set(items: any): Promise; @@ -1458,7 +1407,7 @@ declare namespace browser.storage { const managed: StorageArea; /* storage events */ - const onChanged: EventListener<(changes: StorageChange, areaName: string) => void>; + const onChanged: WebExtEventListener<(changes: StorageChange, areaName: string) => void>; } declare namespace browser.theme { @@ -1471,13 +1420,13 @@ declare namespace browser.theme { /* theme functions */ function getCurrent(windowId?: number): void; - function update(details: manifest.ThemeType): void; - function update(windowId: number, details: manifest.ThemeType): void; + function update(details: _manifest.ThemeType): void; + function update(windowId: number, details: _manifest.ThemeType): void; function reset(windowId?: number): void; /* theme events */ - const onUpdated: EventListener<(updateInfo: ThemeUpdateInfo) => void>; + const onUpdated: WebExtEventListener<(updateInfo: ThemeUpdateInfo) => void>; } declare namespace browser.topSites { @@ -1527,7 +1476,7 @@ declare namespace browser.types { scope?: SettingScope; }): Promise; - onChange: EventListener<(details: { + onChange: WebExtEventListener<(details: { value: any; levelOfControl: LevelOfControl; incognitoSpecific?: boolean; @@ -1579,7 +1528,7 @@ declare namespace browser.webNavigation { tabId: number; }): Promise>; /* webNavigation events */ - const onBeforeNavigate: EventListener<(details: { + const onBeforeNavigate: WebExtEventListener<(details: { tabId: number; url: string; - processId: number; + processId?: number; frameId: number; parentFrameId: number; timeStamp: number; }) => void>; - const onCommitted: EventListener<(details: { + const onCommitted: WebExtEventListener<(details: { tabId: number; url: string; - processId: number; + processId?: number; frameId: number; - transitionType: TransitionType; - transitionQualifiers: TransitionQualifier[]; + transitionType?: TransitionType; + transitionQualifiers?: TransitionQualifier[]; timeStamp: number; }) => void>; - const onDOMContentLoaded: EventListener<(details: { + const onDOMContentLoaded: WebExtEventListener<(details: { tabId: number; url: string; - processId: number; + processId?: number; frameId: number; timeStamp: number; }) => void>; - const onCompleted: EventListener<(details: { + const onCompleted: WebExtEventListener<(details: { tabId: number; url: string; - processId: number; + processId?: number; frameId: number; timeStamp: number; }) => void>; - const onErrorOccurred: EventListener<(details: { + const onErrorOccurred: WebExtEventListener<(details: { tabId: number; url: string; - processId: number; + processId?: number; frameId: number; - error: string; + error?: string; timeStamp: number; }) => void>; - const onCreatedNavigationTarget: EventListener<(details: { + const onCreatedNavigationTarget: WebExtEventListener<(details: { sourceTabId: number; sourceProcessId: number; sourceFrameId: number; @@ -1640,29 +1589,29 @@ declare namespace browser.webNavigation { timeStamp: number; }) => void>; - const onReferenceFragmentUpdated: EventListener<(details: { + const onReferenceFragmentUpdated: WebExtEventListener<(details: { tabId: number; url: string; - processId: number; + processId?: number; frameId: number; - transitionType: TransitionType; - transitionQualifiers: TransitionQualifier[]; + transitionType?: TransitionType; + transitionQualifiers?: TransitionQualifier[]; timeStamp: number; }) => void>; - const onTabReplaced: EventListener<(details: { + const onTabReplaced: WebExtEventListener<(details: { replacedTabId: number; tabId: number; timeStamp: number; }) => void>; - const onHistoryStateUpdated: EventListener<(details: { + const onHistoryStateUpdated: WebExtEventListener<(details: { tabId: number; url: string; - processId: number; + processId?: number; frameId: number; - transitionType: TransitionType; - transitionQualifiers: TransitionQualifier[]; + transitionType?: TransitionType; + transitionQualifiers?: TransitionQualifier[]; timeStamp: number; }) => void>; } @@ -1767,7 +1716,7 @@ declare namespace browser.webRequest { function filterResponseData(requestId: string): object/*StreamFilter*/; /* webRequest events */ - const onBeforeRequest: EventListener<(details: { + const onBeforeRequest: WebExtEventListener<(details: { requestId: string; url: string; method: string; @@ -1785,7 +1734,7 @@ declare namespace browser.webRequest { timeStamp: number; }) => BlockingResponse>; - const onBeforeSendHeaders: EventListener<(details: { + const onBeforeSendHeaders: WebExtEventListener<(details: { requestId: string; url: string; method: string; @@ -1799,7 +1748,7 @@ declare namespace browser.webRequest { requestHeaders?: HttpHeaders; }) => BlockingResponse>; - const onSendHeaders: EventListener<(details: { + const onSendHeaders: WebExtEventListener<(details: { requestId: string; url: string; method: string; @@ -1813,7 +1762,7 @@ declare namespace browser.webRequest { requestHeaders?: HttpHeaders; }) => void>; - const onHeadersReceived: EventListener<(details: { + const onHeadersReceived: WebExtEventListener<(details: { requestId: string; url: string; method: string; @@ -1829,7 +1778,7 @@ declare namespace browser.webRequest { statusCode: number; }) => BlockingResponse>; - const onAuthRequired: EventListener<(details: { + const onAuthRequired: WebExtEventListener<(details: { requestId: string; url: string; method: string; @@ -1852,7 +1801,7 @@ declare namespace browser.webRequest { statusCode: number; }) => BlockingResponse>; - const onResponseStarted: EventListener<(details: { + const onResponseStarted: WebExtEventListener<(details: { requestId: string; url: string; method: string; @@ -1870,7 +1819,7 @@ declare namespace browser.webRequest { statusLine: string; }) => void>; - const onBeforeRedirect: EventListener<(details: { + const onBeforeRedirect: WebExtEventListener<(details: { requestId: string; url: string; method: string; @@ -1889,7 +1838,7 @@ declare namespace browser.webRequest { statusLine: string; }) => void>; - const onCompleted: EventListener<(details: { + const onCompleted: WebExtEventListener<(details: { requestId: string; url: string; method: string; @@ -1907,7 +1856,7 @@ declare namespace browser.webRequest { statusLine: string; }) => void>; - const onErrorOccurred: EventListener<(details: { + const onErrorOccurred: WebExtEventListener<(details: { requestId: string; url: string; method: string; @@ -1994,38 +1943,38 @@ declare namespace browser.bookmarks { function removeTree(id: string): Promise; - function _import(): Promise; + const _import: (() => Promise) | undefined; - function _export(): Promise; + const _export: (() => Promise) | undefined; /* bookmarks events */ - const onCreated: EventListener<(id: string, bookmark: BookmarkTreeNode) => void>; + const onCreated: WebExtEventListener<(id: string, bookmark: BookmarkTreeNode) => void>; - const onRemoved: EventListener<(id: string, removeInfo: { + const onRemoved: WebExtEventListener<(id: string, removeInfo: { parentId: string; index: number; node: BookmarkTreeNode; }) => void>; - const onChanged: EventListener<(id: string, changeInfo: { + const onChanged: WebExtEventListener<(id: string, changeInfo: { title: string; url?: string; }) => void>; - const onMoved: EventListener<(id: string, moveInfo: { + const onMoved: WebExtEventListener<(id: string, moveInfo: { parentId: string; index: number; oldParentId: string; oldIndex: number; }) => void>; - const onChildrenReordered: EventListener<(id: string, reorderInfo: { + const onChildrenReordered: WebExtEventListener<(id: string, reorderInfo: { childIds: string[]; - }) => void>; + }) => void> | undefined; - const onImportBegan: EventListener<() => void>; + const onImportBegan: WebExtEventListener<() => void> | undefined; - const onImportEnded: EventListener<() => void>; + const onImportEnded: WebExtEventListener<() => void> | undefined; } declare namespace browser.browserAction { @@ -2088,7 +2037,7 @@ declare namespace browser.browserAction { function openPopup(): void; /* browserAction events */ - const onClicked: EventListener<(tab: tabs.Tab) => void>; + const onClicked: WebExtEventListener<(tab: tabs.Tab) => void>; } declare namespace browser.browsingData { @@ -2126,7 +2075,7 @@ declare namespace browser.browsingData { function remove(options: RemovalOptions, dataToRemove: DataTypeSet): Promise; - function removeAppcache(options: RemovalOptions): Promise; + const removeAppcache: ((options: RemovalOptions) => Promise) | undefined; function removeCache(options: RemovalOptions): Promise; @@ -2134,13 +2083,13 @@ declare namespace browser.browsingData { function removeDownloads(options: RemovalOptions): Promise; - function removeFileSystems(options: RemovalOptions): Promise; + const removeFileSystems: ((options: RemovalOptions) => Promise) | undefined; function removeFormData(options: RemovalOptions): Promise; function removeHistory(options: RemovalOptions): Promise; - function removeIndexedDB(options: RemovalOptions): Promise; + const removeIndexedDB: ((options: RemovalOptions) => Promise) | undefined; function removeLocalStorage(options: RemovalOptions): Promise; @@ -2148,7 +2097,7 @@ declare namespace browser.browsingData { function removePasswords(options: RemovalOptions): Promise; - function removeWebSQL(options: RemovalOptions): Promise; + const removeWebSQL: ((options: RemovalOptions) => Promise) | undefined; } declare namespace browser.commands { @@ -2163,7 +2112,7 @@ declare namespace browser.commands { function getAll(): Promise; /* commands events */ - const onCommand: EventListener<(command: string) => void>; + const onCommand: WebExtEventListener<(command: string) => void>; } declare namespace browser.devtools { @@ -2174,9 +2123,9 @@ declare namespace browser.devtools.inspectedWindow { class Resource { url: string; - getContent(): Promise; + getContent?(): Promise; - setContent(content: string, commit: boolean): Promise; + setContent?(content: string, commit: boolean): Promise; } /* devtools.inspectedWindow properties */ @@ -2196,12 +2145,12 @@ declare namespace browser.devtools.inspectedWindow { preprocessorScript?: string; }): void; - function getResources(): Promise; + const getResources: (() => Promise) | undefined; /* devtools.inspectedWindow events */ - const onResourceAdded: EventListener<(resource: Resource) => void>; + const onResourceAdded: WebExtEventListener<(resource: Resource) => void> | undefined; - const onResourceContentCommitted: EventListener<(resource: Resource, content: string) => void>; + const onResourceContentCommitted: WebExtEventListener<(resource: Resource, content: string) => void> | undefined; } declare namespace browser.devtools.network { @@ -2211,12 +2160,12 @@ declare namespace browser.devtools.network { } /* devtools.network functions */ - function getHAR(): Promise; + const getHAR: (() => Promise) | undefined; /* devtools.network events */ - const onRequestFinished: EventListener<(request: Request) => void>; + const onRequestFinished: WebExtEventListener<(request: Request) => void> | undefined; - const onNavigated: EventListener<(url: string) => void>; + const onNavigated: WebExtEventListener<(url: string) => void>; } declare namespace browser.devtools.panels { @@ -2224,42 +2173,42 @@ declare namespace browser.devtools.panels { class ElementsPanel { createSidebarPane(title: string): Promise; - onSelectionChanged: EventListener<() => void>; + onSelectionChanged: WebExtEventListener<() => void>; } class SourcesPanel { - createSidebarPane(title: string): void; + createSidebarPane?(title: string): void; - onSelectionChanged: EventListener<() => void>; + onSelectionChanged: WebExtEventListener<() => void>; } class ExtensionPanel { - createStatusBarButton(iconPath: string, tooltipText: string, disabled: boolean): Button; + createStatusBarButton?(iconPath: string, tooltipText: string, disabled: boolean): Button; - onSearch: EventListener<(action: string, queryString?: string) => void>; - onShown: EventListener<(window: object/*global*/) => void>; - onHidden: EventListener<() => void>; + onSearch: WebExtEventListener<(action: string, queryString?: string) => void>; + onShown: WebExtEventListener<(window: object/*global*/) => void>; + onHidden: WebExtEventListener<() => void>; } class ExtensionSidebarPane { - setHeight(height: string): void; + setHeight?(height: string): void; setExpression(expression: string, rootTitle?: string): Promise; setObject(jsonObject: string, rootTitle?: string): Promise; - setPage(path: string): void; + setPage?(path: string): void; - onShown: EventListener<(window: object/*global*/) => void>; - onHidden: EventListener<() => void>; + onShown: WebExtEventListener<(window: object/*global*/) => void>; + onHidden: WebExtEventListener<() => void>; } class Button { - update(tooltipText?: string, disabled?: boolean): void; - update(disabled?: boolean): void; - update(iconPath: string, tooltipText: string, disabled?: boolean): void; + update?(tooltipText?: string, disabled?: boolean): void; + update?(disabled?: boolean): void; + update?(iconPath: string, tooltipText: string, disabled?: boolean): void; - onClicked: EventListener<() => void>; + onClicked: WebExtEventListener<() => void>; } /* devtools.panels properties */ @@ -2272,12 +2221,12 @@ declare namespace browser.devtools.panels { /* devtools.panels functions */ function create(title: string, iconPath: string, pagePath: string): Promise; - function setOpenResourceHandler(): Promise; + const setOpenResourceHandler: (() => Promise) | undefined; - function openResource(url: string, lineNumber: number): Promise; + const openResource: ((url: string, lineNumber: number) => Promise) | undefined; /* devtools.panels events */ - const onThemeChanged: EventListener<(themeName: string) => void>; + const onThemeChanged: WebExtEventListener<(themeName: string) => void>; } declare namespace browser.find { @@ -2335,7 +2284,7 @@ declare namespace browser.geckoProfiler { function getSymbols(debugName: string, breakpadId: string): void; /* geckoProfiler events */ - const onRunning: EventListener<(isRunning: boolean) => void>; + const onRunning: WebExtEventListener<(isRunning: boolean) => void>; } declare namespace browser.history { @@ -2402,14 +2351,14 @@ declare namespace browser.history { function deleteAll(): Promise; /* history events */ - const onVisited: EventListener<(result: HistoryItem) => void>; + const onVisited: WebExtEventListener<(result: HistoryItem) => void>; - const onVisitRemoved: EventListener<(removed: { + const onVisitRemoved: WebExtEventListener<(removed: { allHistory: boolean; urls: string[]; }) => void>; - const onTitleChanged: EventListener<(changed: { + const onTitleChanged: WebExtEventListener<(changed: { url: string; title: string; }) => void>; @@ -2433,6 +2382,77 @@ declare namespace browser.contextMenus { page_action = "page_action", tab = "tab" } + + enum ItemType { + normal = "normal", + checkbox = "checkbox", + radio = "radio", + separator = "separator" + } + + interface OnClickData { + menuItemId: number | string; + parentMenuItemId?: number | string; + mediaType?: string; + linkText?: string; + linkUrl?: string; + srcUrl?: string; + pageUrl?: string; + frameUrl?: string; + selectionText?: string; + editable: boolean; + wasChecked?: boolean; + checked?: boolean; + modifiers: _OnClickDataModifiers[]; + } + + enum _OnClickDataModifiers { + Shift = "Shift", + Alt = "Alt", + Command = "Command", + Ctrl = "Ctrl", + MacCtrl = "MacCtrl" + } + + /* contextMenus properties */ + const ACTION_MENU_TOP_LEVEL_LIMIT: number; + + /* contextMenus functions */ + function create(createProperties: { + type?: ItemType; + id?: string; + icons?: { + [key: number]: string; + }; + title?: string; + checked?: boolean; + contexts?: ContextType[]; + onclick?: (info: menusInternal.OnClickData, tab: tabs.Tab) => void; + parentId?: number | string; + documentUrlPatterns?: string[]; + targetUrlPatterns?: string[]; + enabled?: boolean; + command?: string; + }): number | string; + + function update(id: number | string, updateProperties: { + type?: ItemType; + title?: string; + checked?: boolean; + contexts?: ContextType[]; + onclick?: (info: menusInternal.OnClickData, tab: tabs.Tab) => void; + parentId?: number | string; + documentUrlPatterns?: string[]; + targetUrlPatterns?: string[]; + enabled?: boolean; + }): Promise; + + function remove(menuItemId: number | string): Promise; + + function removeAll(): Promise; + + /* contextMenus events */ + const onClicked: WebExtEventListener<(info: OnClickData, tab?: tabs.Tab) => void>; } declare namespace browser.menus { @@ -2524,7 +2544,7 @@ declare namespace browser.menus { function removeAll(): Promise; /* menus events */ - const onClicked: EventListener<(info: OnClickData, tab?: tabs.Tab) => void>; + const onClicked: WebExtEventListener<(info: OnClickData, tab?: tabs.Tab) => void>; } declare namespace browser.menusInternal { @@ -2589,13 +2609,13 @@ declare namespace browser.omnibox { function setDefaultSuggestion(suggestion: DefaultSuggestResult): void; /* omnibox events */ - const onInputStarted: EventListener<() => void>; + const onInputStarted: WebExtEventListener<() => void>; - const onInputChanged: EventListener<(text: string, suggest: (suggestResults: SuggestResult[]) => void) => void>; + const onInputChanged: WebExtEventListener<(text: string, suggest: (suggestResults: SuggestResult[]) => void) => void>; - const onInputEntered: EventListener<(text: string, disposition: OnInputEnteredDisposition) => void>; + const onInputEntered: WebExtEventListener<(text: string, disposition: OnInputEnteredDisposition) => void>; - const onInputCancelled: EventListener<() => void>; + const onInputCancelled: WebExtEventListener<() => void>; } declare namespace browser.pageAction { @@ -2638,7 +2658,7 @@ declare namespace browser.pageAction { function openPopup(): void; /* pageAction events */ - const onClicked: EventListener<(tab: tabs.Tab) => void>; + const onClicked: WebExtEventListener<(tab: tabs.Tab) => void>; } declare namespace browser.pkcs11 { @@ -2680,7 +2700,7 @@ declare namespace browser.sessions { function getRecentlyClosed(filter?: Filter): Promise; - function getDevices(filter?: Filter): Promise; + const getDevices: ((filter?: Filter) => Promise) | undefined; function restore(sessionId?: string): Promise; @@ -2697,7 +2717,7 @@ declare namespace browser.sessions { function removeWindowValue(windowId: number, key: string): void; /* sessions events */ - const onChanged: EventListener<() => void>; + const onChanged: WebExtEventListener<() => void>; } declare namespace browser.sidebarAction { @@ -2718,7 +2738,7 @@ declare namespace browser.sidebarAction { imageData?: ImageDataType | { [key: number]: ImageDataType; }; - path?: string | string; + path?: string; tabId?: number; }): void; @@ -2755,7 +2775,7 @@ declare namespace browser.tabs { index: number; windowId?: number; openerTabId?: number; - selected: boolean; + selected?: boolean; highlighted: boolean; active: boolean; pinned: boolean; @@ -2840,15 +2860,15 @@ declare namespace browser.tabs { frameId?: number; }): runtime.Port; - function sendRequest(tabId: number, request: any, responseCallback?: (response: any) => void): void; + const sendRequest: ((tabId: number, request: any, responseCallback?: (response: any) => void) => void) | undefined; function sendMessage(tabId: number, message: any, options: { frameId?: number; }, responseCallback?: (response: any) => void): void; - function getSelected(windowId?: number): Promise; + const getSelected: ((windowId?: number) => Promise) | undefined; - function getAllInWindow(windowId?: number): Promise; + const getAllInWindow: ((windowId?: number) => Promise) | undefined; function create(createProperties: { windowId?: number; @@ -2883,10 +2903,10 @@ declare namespace browser.tabs { openerTabId?: number; }): Promise; - function highlight(highlightInfo: { + const highlight: ((highlightInfo: { windowId?: number; tabs: number[] | number; - }): Promise; + }) => Promise) | undefined; function update(updateProperties: { url?: string; @@ -2958,9 +2978,9 @@ declare namespace browser.tabs { function saveAsPDF(pageSettings: PageSettings): Promise; /* tabs events */ - const onCreated: EventListener<(tab: Tab) => void>; + const onCreated: WebExtEventListener<(tab: Tab) => void>; - const onUpdated: EventListener<(tabId: number, changeInfo: { + const onUpdated: WebExtEventListener<(tabId: number, changeInfo: { status: string; discarded?: boolean; url?: string; @@ -2970,53 +2990,53 @@ declare namespace browser.tabs { favIconUrl?: string; }, tab: Tab) => void>; - const onMoved: EventListener<(tabId: number, moveInfo: { + const onMoved: WebExtEventListener<(tabId: number, moveInfo: { windowId: number; fromIndex: number; toIndex: number; }) => void>; - const onSelectionChanged: EventListener<(tabId: number, selectInfo: { + const onSelectionChanged: WebExtEventListener<(tabId: number, selectInfo: { windowId: number; - }) => void>; + }) => void> | undefined; - const onActiveChanged: EventListener<(tabId: number, selectInfo: { + const onActiveChanged: WebExtEventListener<(tabId: number, selectInfo: { windowId: number; - }) => void>; + }) => void> | undefined; - const onActivated: EventListener<(activeInfo: { + const onActivated: WebExtEventListener<(activeInfo: { tabId: number; windowId: number; }) => void>; - const onHighlightChanged: EventListener<(selectInfo: { + const onHighlightChanged: WebExtEventListener<(selectInfo: { + windowId: number; + tabIds: number[]; + }) => void> | undefined; + + const onHighlighted: WebExtEventListener<(highlightInfo: { windowId: number; tabIds: number[]; }) => void>; - const onHighlighted: EventListener<(highlightInfo: { - windowId: number; - tabIds: number[]; - }) => void>; - - const onDetached: EventListener<(tabId: number, detachInfo: { + const onDetached: WebExtEventListener<(tabId: number, detachInfo: { oldWindowId: number; oldPosition: number; }) => void>; - const onAttached: EventListener<(tabId: number, attachInfo: { + const onAttached: WebExtEventListener<(tabId: number, attachInfo: { newWindowId: number; newPosition: number; }) => void>; - const onRemoved: EventListener<(tabId: number, removeInfo: { + const onRemoved: WebExtEventListener<(tabId: number, removeInfo: { windowId: number; isWindowClosing: boolean; }) => void>; - const onReplaced: EventListener<(addedTabId: number, removedTabId: number) => void>; + const onReplaced: WebExtEventListener<(addedTabId: number, removedTabId: number) => void>; - const onZoomChange: EventListener<(ZoomChangeInfo: { + const onZoomChange: WebExtEventListener<(ZoomChangeInfo: { tabId: number; oldZoomFactor: number; newZoomFactor: number; @@ -3120,9 +3140,9 @@ declare namespace browser.windows { function remove(windowId: number): Promise; /* windows events */ - const onCreated: EventListener<(window: Window) => void>; + const onCreated: WebExtEventListener<(window: Window) => void>; - const onRemoved: EventListener<(windowId: number) => void>; + const onRemoved: WebExtEventListener<(windowId: number) => void>; - const onFocusChanged: EventListener<(windowId: number) => void>; + const onFocusChanged: WebExtEventListener<(windowId: number) => void>; } diff --git a/types/firefox-webext-browser/tsconfig.json b/types/firefox-webext-browser/tsconfig.json index 316317e305..202f6824d1 100644 --- a/types/firefox-webext-browser/tsconfig.json +++ b/types/firefox-webext-browser/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From 172856509e41b2eb132de4b9bc2186d59df3d3e0 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Sun, 3 Dec 2017 23:18:03 +0100 Subject: [PATCH 150/322] fix FieldListObject Definitions rework Bookmark / Field / Dim / Meas.. ListObjects Signed-off-by: Konrad Mattheis --- types/qlik-engineapi/index.d.ts | 49 +++++++++++++++++---------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/types/qlik-engineapi/index.d.ts b/types/qlik-engineapi/index.d.ts index 7347b17bf0..4be38f9bc0 100644 --- a/types/qlik-engineapi/index.d.ts +++ b/types/qlik-engineapi/index.d.ts @@ -9108,8 +9108,7 @@ declare namespace EngineAPI { /** * SelectionListObject width extend GenericObject */ - interface ISelectionListObject extends IGenericObject { - getLayout(): Promise; + interface ISelectionListObject extends IGenericObjectPrototype { } interface IApp { @@ -9171,8 +9170,7 @@ declare namespace EngineAPI { /** * BookmarkListObject width extend GenericObject */ - interface IBookmarkListObject extends IGenericObject { - getLayout(): Promise; + interface IBookmarkListObject extends IGenericObjectPrototype { } interface IApp { @@ -9234,8 +9232,7 @@ declare namespace EngineAPI { /** * IMeassureListObject */ - interface IMeassureListObject extends IGenericObject { - getLayout(): Promise; + interface IMeassureListObject extends IGenericObjectPrototype { } interface IApp { @@ -9302,8 +9299,7 @@ declare namespace EngineAPI { qData: any; } - interface IDimensionListObject extends IGenericObject { - getLayout(): Promise; + interface IDimensionListObject extends IGenericObjectPrototype { } interface IApp { @@ -9380,15 +9376,15 @@ declare namespace EngineAPI { /** * VariableListObject... */ - interface IVariableListObject { + interface IVariableList { qItems: INxVariableListItem[]; } /** * GenericVariableLayout width extend GenericObjectLayout */ - interface IGenericVariableLayout extends IGenericObjectLayout { - qVariableListObject: IVariableListObject; + interface IGenericVariableListLayout extends IGenericBaseLayout { + qVariableListObject: IVariableList; } /** @@ -9426,8 +9422,7 @@ declare namespace EngineAPI { /** * VariableListObject width extend GenericObject */ - interface IVariableListObject extends IGenericObject { - getLayout(): Promise; + interface IVariableListObject extends IGenericObjectPrototype { } interface IApp { @@ -9442,23 +9437,13 @@ declare namespace EngineAPI { /** * FieldListObject... */ - interface IFieldListObject { + interface IFieldList { /** * NxFieldDescription[] */ qItems: INxFieldDescription[]; } - /** - * GenericFieldLayout width extend GenericObjectLayout - */ - interface IGenericFieldLayout extends IGenericObjectLayout { - /** - * FieldListObject... - */ - qFieldListObject: IFieldListObject; - } - /** * GenericFieldListProperties width extend GenericProperties */ @@ -9673,6 +9658,22 @@ declare namespace EngineAPI { qShowImplicit?: boolean; } + /** + * GenericFieldLayout width extend GenericObjectLayout + */ + interface IGenericFieldLayout extends IGenericBaseLayout { + /** + * FieldListObject... + */ + qFieldListObject: IFieldList; + } + + /** + * FieldListObject width extend GenericObject + */ + interface IFieldListObject extends IGenericObjectPrototype { + } + interface IApp { createObject(qProp: IGenericFieldListProperties): Promise; createSessionObject(qProp: IGenericFieldListProperties): Promise; From cd3935c6727d24a76680d0a263fcf982ec56d750 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 4 Dec 2017 10:58:29 +0900 Subject: [PATCH 151/322] Delete unnecessary rule invalidation setting --- types/chokidar/tslint.json | 73 +------------------------------------- 1 file changed, 1 insertion(+), 72 deletions(-) diff --git a/types/chokidar/tslint.json b/types/chokidar/tslint.json index a41bf5d19a..705b12b2c0 100644 --- a/types/chokidar/tslint.json +++ b/types/chokidar/tslint.json @@ -1,79 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "no-trailing-whitespace": false } } From f1be10968fc8eb06d31e339f5c95a758b7b2afee Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 4 Dec 2017 11:00:51 +0900 Subject: [PATCH 152/322] cleanup lint errors: no-padding, no-trailing-whitespace --- types/chokidar/index.d.ts | 5 +---- types/chokidar/tslint.json | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/types/chokidar/index.d.ts b/types/chokidar/index.d.ts index 229ffb556f..89104d6eb4 100644 --- a/types/chokidar/index.d.ts +++ b/types/chokidar/index.d.ts @@ -19,7 +19,6 @@ export interface WatchedPaths { } export class FSWatcher extends EventEmitter implements fs.FSWatcher { - /** * Constructs a new FSWatcher instance with optional WatchOptions parameter. */ @@ -52,7 +51,6 @@ export class FSWatcher extends EventEmitter implements fs.FSWatcher { } export interface WatchOptions { - /** * Indicates whether the process should continue to run as long as files are being watched. If * set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`, @@ -86,7 +84,7 @@ export interface WatchOptions { * be relative to this. */ cwd?: string; - + /** * If set to true then the strings passed to .watch() and .add() are treated as literal path * names, even if they look like globs. Default: false. @@ -155,7 +153,6 @@ export interface WatchOptions { } export interface AwaitWriteFinishOptions { - /** * Amount of time in milliseconds for a file size to remain constant before emitting its event. */ diff --git a/types/chokidar/tslint.json b/types/chokidar/tslint.json index 705b12b2c0..65c83fb1e3 100644 --- a/types/chokidar/tslint.json +++ b/types/chokidar/tslint.json @@ -1,8 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "dt-header": false, - "no-padding": false, - "no-trailing-whitespace": false + "dt-header": false } } From 672a8926e1c3afb8f26c985a2692617e392fdcd9 Mon Sep 17 00:00:00 2001 From: segayuu Date: Mon, 4 Dec 2017 11:01:50 +0900 Subject: [PATCH 153/322] cleanup lint error: dt-header --- types/chokidar/index.d.ts | 2 +- types/chokidar/tslint.json | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/types/chokidar/index.d.ts b/types/chokidar/index.d.ts index 89104d6eb4..396ad10e0a 100644 --- a/types/chokidar/index.d.ts +++ b/types/chokidar/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for chokidar 1.7.1 +// Type definitions for chokidar 1.7 // Project: https://github.com/paulmillr/chokidar // Definitions by: Stefan Steinhart // Felix Becker diff --git a/types/chokidar/tslint.json b/types/chokidar/tslint.json index 65c83fb1e3..3db14f85ea 100644 --- a/types/chokidar/tslint.json +++ b/types/chokidar/tslint.json @@ -1,6 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "dt-header": false - } -} +{ "extends": "dtslint/dt.json" } From b53f9eac8effb22d82379dbdfe517291fd155c02 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Thanh Date: Mon, 4 Dec 2017 09:04:41 +0700 Subject: [PATCH 154/322] Change dataOrRange to optional param --- types/fullcalendar/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fullcalendar/index.d.ts b/types/fullcalendar/index.d.ts index 4b0f600c6a..3d5ff28f12 100644 --- a/types/fullcalendar/index.d.ts +++ b/types/fullcalendar/index.d.ts @@ -995,7 +995,7 @@ declare global { /** * Immediately switches to a different view. */ - fullCalendar(method: 'changeView', viewName: string, dateOrRange: moment.Moment | Date | string | TimeRange): void; + fullCalendar(method: 'changeView', viewName: string, dateOrRange?: moment.Moment | Date | string | TimeRange): void; /** * Moves the calendar one step back (either by a month, week, or day). From 3628b8552d87631d708a75a156560a899d04b03a Mon Sep 17 00:00:00 2001 From: Polina Date: Mon, 4 Dec 2017 12:34:12 +0700 Subject: [PATCH 155/322] Update index.d.ts of Draft.js typings ContentState.CreateFromBlockArray() should have its second parameter as optional --- types/draft-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index 3eaa05aa30..8a9924f596 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -746,7 +746,7 @@ declare namespace Draft { } class ContentState extends Record { - static createFromBlockArray(blocks: Array, entityMap: any): ContentState; + static createFromBlockArray(blocks: Array, entityMap?: any): ContentState; static createFromText(text: string, delimiter?: string): ContentState; createEntity(type: DraftEntityType, mutability: DraftEntityMutability, data?: Object): ContentState; From 96a344dd423111c9db0fe028cf57cb6a2ec9855b Mon Sep 17 00:00:00 2001 From: Li Yin Date: Mon, 4 Dec 2017 14:00:55 +0800 Subject: [PATCH 156/322] min, max can be string '-inf', '+inf', or '(number', as described in https://redis.io/commands/zrangebyscore --- types/ioredis/index.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index ec1dbe3512..a0f1c06dcb 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -195,8 +195,8 @@ declare namespace IORedis { zrem(key: string, member: string, ...members: any[]): any; - zremrangebyscore(key: string, min: number, max: number, callback: (err: Error, res: any) => void): void; - zremrangebyscore(key: string, min: number, max: number): Promise; + zremrangebyscore(key: string, min: number | string, max: number | string, callback: (err: Error, res: any) => void): void; + zremrangebyscore(key: string, min: number | string, max: number | string): Promise; zremrangebyrank(key: string, start: number, stop: number, callback: (err: Error, res: any) => void): void; zremrangebyrank(key: string, start: number, stop: number): Promise; @@ -213,12 +213,12 @@ declare namespace IORedis { zrevrange(key: string, start: number, stop: number, withScores: "WITHSCORES", callback: (err: Error, res: any) => void): void; zrevrange(key: string, start: number, stop: number, withScores?: "WITHSCORES"): Promise; - zrangebyscore(key: string, min: number, max: number, ...args: string[]): any; + zrangebyscore(key: string, min: number | string, max: number | string, ...args: string[]): any; - zrevrangebyscore(key: string, max: number, min: number, ...args: string[]): any; + zrevrangebyscore(key: string, max: number | string, min: number | string, ...args: string[]): any; - zcount(key: string, min: number, max: number, callback: (err: Error, res: number) => void): void; - zcount(key: string, min: number, max: number): Promise; + zcount(key: string, min: number | string, max: number | string, callback: (err: Error, res: number) => void): void; + zcount(key: string, min: number | string, max: number | string): Promise; zcard(key: string, callback: (err: Error, res: number) => void): void; zcard(key: string): Promise; @@ -554,7 +554,7 @@ declare namespace IORedis { zrem(key: string, member: string, ...members: any[]): Pipeline; - zremrangebyscore(key: string, min: number, max: number, callback?: (err: Error, res: any) => void): Pipeline; + zremrangebyscore(key: string, min: number | string, max: number | string, callback?: (err: Error, res: any) => void): Pipeline; zremrangebyrank(key: string, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; @@ -568,11 +568,11 @@ declare namespace IORedis { zrevrange(key: string, start: number, stop: number, callback?: (err: Error, res: any) => void): Pipeline; zrevrange(key: string, start: number, stop: number, withScores: "WITHSCORES", callback?: (err: Error, res: any) => void): Pipeline; - zrangebyscore(key: string, min: number, max: number, ...args: string[]): Pipeline; + zrangebyscore(key: string, min: number | string, max: number | string, ...args: string[]): Pipeline; - zrevrangebyscore(key: string, max: number, min: number, ...args: string[]): Pipeline; + zrevrangebyscore(key: string, max: number | string, min: number | string, ...args: string[]): Pipeline; - zcount(key: string, min: number, max: number, callback?: (err: Error, res: number) => void): Pipeline; + zcount(key: string, min: number | string, max: number | string, callback?: (err: Error, res: number) => void): Pipeline; zcard(key: string, callback?: (err: Error, res: number) => void): Pipeline; From dccfda5de44ad0f78a9794457226ace333a0b64e Mon Sep 17 00:00:00 2001 From: Ari Aviran Date: Mon, 4 Dec 2017 12:02:43 +0200 Subject: [PATCH 157/322] [node] Add Buffer.alloc methods to node v4 Add `Buffer.alloc`, `Buffer.allocUnsafe` and `Buffer.allocUnsafeSlow` class methods that were backported to node v4 (starting with v4.5). In addition add tests to all node versions for these class methods and fix tslint configuration to pass the tests --- types/node/index.d.ts | 2 +- types/node/node-tests.ts | 14 ++++++++++++++ types/node/tslint.json | 3 ++- types/node/v4/index.d.ts | 25 ++++++++++++++++++++++++- types/node/v4/node-tests.ts | 15 +++++++++++++++ types/node/v4/tslint.json | 1 + types/node/v6/node-tests.ts | 14 ++++++++++++++ types/node/v6/tslint.json | 1 + types/node/v7/node-tests.ts | 14 ++++++++++++++ types/node/v7/tslint.json | 1 + 10 files changed, 87 insertions(+), 3 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 61fd375e6f..c90e7b7116 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -104,8 +104,8 @@ declare namespace setImmediate { declare function clearImmediate(immediateId: any): void; // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. -/* tslint:disable:callable-types */ interface NodeRequireFunction { + /* tslint:disable-next-line:callable-types */ (id: string): any; } diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index d85a2574db..1413b88629 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -405,6 +405,20 @@ function bufferTests() { const buf1: Buffer = Buffer.from('this is a tést'); const buf2: Buffer = Buffer.from('7468697320697320612074c3a97374', 'hex'); } + // Class Method: Buffer.alloc(size[, fill[, encoding]]) + { + const buf1: Buffer = Buffer.alloc(5); + const buf2: Buffer = Buffer.alloc(5, 'a'); + const buf3: Buffer = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); + } + // Class Method: Buffer.allocUnsafe(size) + { + const buf: Buffer = Buffer.allocUnsafe(5); + } + // Class Method: Buffer.allocUnsafeSlow(size) + { + const buf: Buffer = Buffer.allocUnsafeSlow(10); + } // Class Method byteLenght { diff --git a/types/node/tslint.json b/types/node/tslint.json index 45064d266f..a153c4f63f 100644 --- a/types/node/tslint.json +++ b/types/node/tslint.json @@ -21,6 +21,7 @@ "prefer-const": false, "prefer-method-signature": false, "strict-export-declare-modifiers": false, - "unified-signatures": false + "unified-signatures": false, + "void-return": false } } diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 797bc455b8..5658d4e05e 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Node.js 4.2 +// Type definitions for Node.js 4.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -214,6 +214,29 @@ declare var Buffer: { * The same as buf1.compare(buf2). */ compare(buf1: Buffer, buf2: Buffer): number; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @param fill if specified, buffer will be initialized by calling buf.fill(fill). + * If parameter is omitted, buffer will be filled with zeros. + * @param encoding encoding used for call to buf.fill while initalizing + */ + alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; + /** + * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + allocUnsafe(size: number): Buffer; + /** + * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + allocUnsafeSlow(size: number): Buffer; }; /************************************************ diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index 8f005da455..0c5d378d9e 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -268,6 +268,21 @@ function bufferTests() { const buf1: Buffer = Buffer.from('this is a tést'); const buf2: Buffer = Buffer.from('7468697320697320612074c3a97374', 'hex'); } + // Class Method: Buffer.alloc(size[, fill[, encoding]]) + { + const buf1: Buffer = Buffer.alloc(5); + const buf2: Buffer = Buffer.alloc(5, 'a'); + const buf3: Buffer = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); + + } + // Class Method: Buffer.allocUnsafe(size) + { + const buf: Buffer = Buffer.allocUnsafe(5); + } + // Class Method: Buffer.allocUnsafeSlow(size) + { + const buf: Buffer = Buffer.allocUnsafeSlow(10); + } // Test that TS 1.6 works with the 'as Buffer' annotation // on isBuffer. diff --git a/types/node/v4/tslint.json b/types/node/v4/tslint.json index 518f58df03..542ee38c59 100644 --- a/types/node/v4/tslint.json +++ b/types/node/v4/tslint.json @@ -40,6 +40,7 @@ "strict-export-declare-modifiers": false, "typedef-whitespace": false, "unified-signatures": false, + "void-return": false, "whitespace": false } } diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index 1a6b87db05..c7521d3d82 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -330,6 +330,20 @@ function bufferTests() { const buf1: Buffer = Buffer.from('this is a tést'); const buf2: Buffer = Buffer.from('7468697320697320612074c3a97374', 'hex'); } + // Class Method: Buffer.alloc(size[, fill[, encoding]]) + { + const buf1: Buffer = Buffer.alloc(5); + const buf2: Buffer = Buffer.alloc(5, 'a'); + const buf3: Buffer = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); + } + // Class Method: Buffer.allocUnsafe(size) + { + const buf: Buffer = Buffer.allocUnsafe(5); + } + // Class Method: Buffer.allocUnsafeSlow(size) + { + const buf: Buffer = Buffer.allocUnsafeSlow(10); + } // Test that TS 1.6 works with the 'as Buffer' annotation // on isBuffer. diff --git a/types/node/v6/tslint.json b/types/node/v6/tslint.json index 518f58df03..542ee38c59 100644 --- a/types/node/v6/tslint.json +++ b/types/node/v6/tslint.json @@ -40,6 +40,7 @@ "strict-export-declare-modifiers": false, "typedef-whitespace": false, "unified-signatures": false, + "void-return": false, "whitespace": false } } diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index 9bbf6a9300..2c33f9019d 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -319,6 +319,20 @@ function bufferTests() { buf = Buffer.from(arr.buffer, 1); buf = Buffer.from(arr.buffer, 0, 1); } + // Class Method: Buffer.alloc(size[, fill[, encoding]]) + { + const buf1: Buffer = Buffer.alloc(5); + const buf2: Buffer = Buffer.alloc(5, 'a'); + const buf3: Buffer = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); + } + // Class Method: Buffer.allocUnsafe(size) + { + const buf: Buffer = Buffer.allocUnsafe(5); + } + // Class Method: Buffer.allocUnsafeSlow(size) + { + const buf: Buffer = Buffer.allocUnsafeSlow(10); + } // Class Method: Buffer.from(buffer) { diff --git a/types/node/v7/tslint.json b/types/node/v7/tslint.json index 518f58df03..542ee38c59 100644 --- a/types/node/v7/tslint.json +++ b/types/node/v7/tslint.json @@ -40,6 +40,7 @@ "strict-export-declare-modifiers": false, "typedef-whitespace": false, "unified-signatures": false, + "void-return": false, "whitespace": false } } From 886c0a0b655a549864a3374a6fcd57f0c55ac13f Mon Sep 17 00:00:00 2001 From: daphnes Date: Mon, 4 Dec 2017 12:26:48 +0100 Subject: [PATCH 158/322] Remove tabbing --- types/elasticsearch/index.d.ts | 48 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index 8ab269768d..dbf836c6ae 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -620,30 +620,30 @@ export interface SearchParams extends GenericParams { type?: NameList; } - export interface SearchResponse { - took: number; - timed_out: boolean; - _scroll_id?: string; - _shards: ShardsResponse; - hits: { - total: number; - max_score: number; - hits: Array<{ - _index: string; - _type: string; - _id: string; - _score: number; - _source: T; - _version?: number; - _explanation?: Explanation; - fields?: any; - highlight?: any; - inner_hits?: any; - sort?: string[]; - }>; - }; - aggregations?: any; - } +export interface SearchResponse { + took: number; + timed_out: boolean; + _scroll_id?: string; + _shards: ShardsResponse; + hits: { + total: number; + max_score: number; + hits: Array<{ + _index: string; + _type: string; + _id: string; + _score: number; + _source: T; + _version?: number; + _explanation?: Explanation; + fields?: any; + highlight?: any; + inner_hits?: any; + sort?: string[]; + }>; + }; + aggregations?: any; +} export interface SearchShardsParams extends GenericParams { preference?: string; From 42d48d23d88a0505000b232d2f17929dac07a158 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Mon, 4 Dec 2017 12:50:33 +0100 Subject: [PATCH 159/322] update to version 2.67.2 Signed-off-by: Konrad Mattheis --- types/qlik-engineapi/index.d.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/types/qlik-engineapi/index.d.ts b/types/qlik-engineapi/index.d.ts index 4be38f9bc0..0f11f39ae2 100644 --- a/types/qlik-engineapi/index.d.ts +++ b/types/qlik-engineapi/index.d.ts @@ -1,5 +1,5 @@ -// Type definitions for qlik-engineapi 12.34 -// Project: http://help.qlik.com/en-US/sense-developer/September2017/Subsystems/EngineAPI/Content/introducing-engine-API.htm +// Type definitions for qlik-engineapi 12.67 +// Project: http://help.qlik.com/en-US/sense-developer/November2017/Subsystems/EngineAPI/Content/introducing-engine-API.htm // Definitions by: Konrad Mattheis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -2984,6 +2984,13 @@ declare namespace EngineAPI { */ getFieldDescription(qFieldName: string): Promise; + /** + * Fetches the Expression behind a Field that is declared with DECLARE FIELD DEFINITIO + * @param qReadableName: name of a Field that is declared with DECLARE FIELD DEFINITION + * @returns qname wich contains the expression + */ + getFieldOnTheFlyByName(qReadableName: string): Promise<{qName: string}>; + /** * Retrieves the description of a field. * @param qFieldName - Name of the field. >> This parameter is mandatory. @@ -7150,6 +7157,21 @@ declare namespace EngineAPI { */ getBaseBNFHash(qBnfType: BnfType): Promise<{ qBnfHash: string }>; + /** + * Gets the current Backus-Naur Form (BNF) grammar of the Qlik engine scripting language, + * as well as a string hash calculated from that grammar. The BNF rules define the syntax + * for the script statements and the script or chart functions. If the hash changes between + * subsequent calls to this method, this indicates that the BNF has changed. + * + * In the Qlik engine grammars, a token is a string of one or more characters that is significant as a group. + * For example, a token could be a function name, a number, a letter, a parenthesis, and so on. + * @param qBnfType The type of grammar to return: + * S: returns the script statements and the script functions. + * E: returns the chart functions. + * @returns qBnfDefs and qBnfHash + */ + getBaseBNFString(qBnfType: BnfType): Promise<{qBnfDefs: IBNFDef, qBnfHash: string}>; + /** * Get a Config Object * @returns A Promise qConfig From d251c643c3e8c37dc4554751caf0238b69db5102 Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Fri, 1 Dec 2017 12:52:38 -0800 Subject: [PATCH 160/322] Fix lint error: 'tslint:disable' is forbidden --- types/node/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 61fd375e6f..789e91997f 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -104,8 +104,8 @@ declare namespace setImmediate { declare function clearImmediate(immediateId: any): void; // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. -/* tslint:disable:callable-types */ interface NodeRequireFunction { +/* tslint:disable-next-line:callable-types */ (id: string): any; } From 8a3c0175f1955388e818cdab98de8c80cd70a5e3 Mon Sep 17 00:00:00 2001 From: Beeno Tung Date: Tue, 5 Dec 2017 00:22:50 +0800 Subject: [PATCH 161/322] Update index.d.ts added 'buffer' as Encoding type --- types/node-rsa/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node-rsa/index.d.ts b/types/node-rsa/index.d.ts index faafdf7d24..63d569378d 100644 --- a/types/node-rsa/index.d.ts +++ b/types/node-rsa/index.d.ts @@ -122,7 +122,7 @@ declare namespace NodeRSA { type Encoding = | 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'latin1' - | 'base64' | 'hex' | 'binary'; + | 'base64' | 'hex' | 'binary' | 'buffer'; interface KeyComponents { n: Buffer; From ec54184e1bf53c8d3344fe1e3c2ccbe1033b1bd5 Mon Sep 17 00:00:00 2001 From: Kevin Ross Date: Mon, 4 Dec 2017 10:39:31 -0600 Subject: [PATCH 162/322] JSX.Element -> React.ReactNode --- types/react-autosuggest/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-autosuggest/index.d.ts b/types/react-autosuggest/index.d.ts index c7f46200d1..444753bd54 100644 --- a/types/react-autosuggest/index.d.ts +++ b/types/react-autosuggest/index.d.ts @@ -113,13 +113,13 @@ declare namespace Autosuggest { event: React.FormEvent, data: SuggestionSelectedEventData, ) => void; - type RenderInputComponent = (inputProps: InputProps) => JSX.Element; - type RenderSuggestionsContainer = (params: RenderSuggestionsContainerParams) => JSX.Element; - type RenderSectionTitle = (section: any) => JSX.Element; + type RenderInputComponent = (inputProps: InputProps) => React.ReactNode; + type RenderSuggestionsContainer = (params: RenderSuggestionsContainerParams) => React.ReactNode; + type RenderSectionTitle = (section: any) => React.ReactNode; type RenderSuggestion = ( suggestion: TSuggestion, params: RenderSuggestionParams, - ) => JSX.Element; + ) => React.ReactNode; type ShouldRenderSuggestions = (value: string) => boolean; interface AutosuggestProps { From 06313d255bb108839fe9691a2ebe7f8043bb303d Mon Sep 17 00:00:00 2001 From: "Charles-P. Clermont" Date: Mon, 4 Dec 2017 12:13:45 -0500 Subject: [PATCH 163/322] Improve indexBy type inference --- types/ramda/index.d.ts | 4 ++-- types/ramda/ramda-tests.ts | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 9d1683fbbc..de4a05b28f 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -740,8 +740,8 @@ declare namespace R { * Given a function that generates a key, turns a list of objects into an object indexing the objects * by the given key. */ - indexBy(fn: (a: T) => string, list: T[]): U; - indexBy(fn: (a: T) => string): (list: T[]) => U; + indexBy(fn: (a: T) => string, list: T[]): { [key: string]: T }; + indexBy(fn: (a: T) => string): (list: T[]) => { [key: string]: T }; /** * Returns the position of the first occurrence of an item in an array diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 426bb63471..8e91b12ef2 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -678,10 +678,19 @@ interface Obj { }; (() => { - const list = [{id: "xyz", title: "A"}, {id: "abc", title: "B"}]; - const a1 = R.indexBy(R.prop("id"), list); - const a2 = R.indexBy(R.prop("id"))(list); + interface Book { + id: string; + title: string; + } + const list: Book[] = [{id: "xyz", title: "A"}, {id: "abc", title: "B"}]; + const a1 = R.indexBy(R.prop("id"), list); + const a2 = R.indexBy(R.prop("id"))(list); const a3 = R.indexBy<{ id: string }>(R.prop("id"))(list); + + const titlesIndexedByTitles: { [k: string]: string } = R.pipe( + R.map((x: Book) => x.title), + R.indexBy(x => x), + )(list); }); () => { From d105bd4c8d8a489690bad0099d1b95d1104379b5 Mon Sep 17 00:00:00 2001 From: John Gozde Date: Mon, 4 Dec 2017 10:27:42 -0700 Subject: [PATCH 164/322] Use ComponentType for React.Fragment --- types/react/index.d.ts | 16 ++++++---------- types/react/test/index.ts | 6 +++--- types/react/test/tsx.tsx | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index e41299fdb5..f9b199cbd5 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -265,7 +265,7 @@ declare namespace React { function isValidElement

(object: {} | null | undefined): object is ReactElement

; const Children: ReactChildren; - const Fragment: symbol | number; + const Fragment: ComponentType; const version: string; // @@ -281,10 +281,8 @@ declare namespace React { constructor(props: P, context?: any); // Disabling unified-signatures to have separate overloads. It's easier to understand this way. - // tslint:disable:unified-signatures - setState(f: (prevState: Readonly, props: P) => Pick, callback?: () => any): void; - setState(state: Pick, callback?: () => any): void; - // tslint:enable:unified-signatures + setState(f: (prevState: Readonly, props: P) => Pick, callback?: () => any): void; // tslint:disable-line:unified-signatures + setState(state: Pick, callback?: () => any): void; // tslint:disable-line:unified-signatures forceUpdate(callBack?: () => any): void; render(): ReactNode; @@ -3519,17 +3517,15 @@ declare namespace React { declare global { namespace JSX { - // tslint:disable:no-empty-interface - interface Element extends React.ReactElement { } + interface Element extends React.ReactElement { } // tslint:disable-line:no-empty-interface interface ElementClass extends React.Component { render(): React.ReactNode; } interface ElementAttributesProperty { props: {}; } interface ElementChildrenAttribute { children: {}; } - interface IntrinsicAttributes extends React.Attributes { } - interface IntrinsicClassAttributes extends React.ClassAttributes { } - // tslint:enable:no-empty-interface + interface IntrinsicAttributes extends React.Attributes { } // tslint:disable-line:no-empty-interface + interface IntrinsicClassAttributes extends React.ClassAttributes { } // tslint:disable-line:no-empty-interface interface IntrinsicElements { // HTML diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 3c49215c8a..e8aabfa35c 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -164,7 +164,7 @@ const statelessElement: React.SFCElement = React.createElement(Stateles const domElement: React.DOMElement, HTMLDivElement> = React.createElement("div"); const htmlElement = React.createElement("input", { type: "text" }); const svgElement = React.createElement("svg", { accentHeight: 12 }); -const fragmentElement: React.ReactElement = React.createElement(React.Fragment, undefined, [React.createElement("div"), React.createElement("div")]); +const fragmentElement: React.ReactElement<{}> = React.createElement(React.Fragment, {}, [React.createElement("div"), React.createElement("div")]); const customProps: React.HTMLProps = props; const customDomElement = "my-element"; @@ -229,7 +229,7 @@ const notValid: boolean = React.isValidElement(props); // false const isValid = React.isValidElement(element); // true let domNode: Element = ReactDOM.findDOMNode(component); domNode = ReactDOM.findDOMNode(domNode); -const fragmentType: symbol | number = React.Fragment; +const fragmentType: React.ComponentType = React.Fragment; // // React Elements @@ -255,7 +255,7 @@ myComponent.reset(); // Refs // -------------------------------------------------------------------------- -// tslint:disable:no-empty-interface +// tslint:disable-next-line:no-empty-interface interface RCProps { } class RefComponent extends React.Component { diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index dd91b5a0bd..6322f8f234 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -63,3 +63,17 @@ const StatelessComponentWithoutProps: React.SFC = (props) => { return

; }; ; + +// Fragments +
+ + + Child 1 + Child 2 + + + Child 3 + Child 4 + + +
; From e04481995185d21b09f4c4570c3dc27dff58ccc0 Mon Sep 17 00:00:00 2001 From: Kelvin Jin Date: Fri, 1 Dec 2017 15:03:59 -0800 Subject: [PATCH 165/322] [shimmer] Add shimmer type definitions --- types/shimmer/index.d.ts | 35 ++++++++++++++++++++++++++++++++++ types/shimmer/shimmer-tests.ts | 23 ++++++++++++++++++++++ types/shimmer/tsconfig.json | 23 ++++++++++++++++++++++ types/shimmer/tslint.json | 1 + 4 files changed, 82 insertions(+) create mode 100644 types/shimmer/index.d.ts create mode 100644 types/shimmer/shimmer-tests.ts create mode 100644 types/shimmer/tsconfig.json create mode 100644 types/shimmer/tslint.json diff --git a/types/shimmer/index.d.ts b/types/shimmer/index.d.ts new file mode 100644 index 0000000000..fd62f8074c --- /dev/null +++ b/types/shimmer/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for Shimmer 1.x +// Project: https://github.com/othiym23/shimmer +// Definitions by: Kelvin Jin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +declare global { + interface Function { + __wrapped?: boolean; + } +} + +declare const shimmer: { + (options: { logger?(msg: string): void }): void; + wrap any>( + nodule: object, + name: string, + wrapper: (original: T) => T + ): void; + massWrap any>( + nodules: object[], + names: string[], + wrapper: (original: T) => T + ): void; + unwrap( + nodule: object, + name: string + ): void; + massUnwrap( + nodules: object[], + names: string[] + ): void; +}; + +export = shimmer; diff --git a/types/shimmer/shimmer-tests.ts b/types/shimmer/shimmer-tests.ts new file mode 100644 index 0000000000..c7b51debe2 --- /dev/null +++ b/types/shimmer/shimmer-tests.ts @@ -0,0 +1,23 @@ +import * as shimmer from 'shimmer'; + +const isWrapped: boolean = [].forEach.__wrapped || false; + +shimmer.wrap(Array.prototype, 'forEach', (forEach) => { + return (...args: any[]) => { + forEach(...args); + }; +}); + +shimmer.unwrap(Array.prototype, 'forEach'); + +shimmer.massWrap([Map.prototype, Set.prototype], ['clear', 'forEach'], (fn) => { + return (...args: any[]) => { + const result = fn(...args); + if (result) { + throw new Error(); + } + return result; + }; +}); + +shimmer.massUnwrap([Map.prototype, Set.prototype], ['clear', 'forEach']); diff --git a/types/shimmer/tsconfig.json b/types/shimmer/tsconfig.json new file mode 100644 index 0000000000..3883d26b91 --- /dev/null +++ b/types/shimmer/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "shimmer-tests.ts" + ] +} \ No newline at end of file diff --git a/types/shimmer/tslint.json b/types/shimmer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/shimmer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5afa32483e299cc02ebb706fca6cddf79134ec1b Mon Sep 17 00:00:00 2001 From: John Gozde Date: Mon, 4 Dec 2017 11:33:33 -0700 Subject: [PATCH 166/322] Prefer disable-next-line --- types/react/index.d.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index f9b199cbd5..a2ea9bdc6c 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -281,8 +281,10 @@ declare namespace React { constructor(props: P, context?: any); // Disabling unified-signatures to have separate overloads. It's easier to understand this way. - setState(f: (prevState: Readonly, props: P) => Pick, callback?: () => any): void; // tslint:disable-line:unified-signatures - setState(state: Pick, callback?: () => any): void; // tslint:disable-line:unified-signatures + // tslint:disable-next-line:unified-signatures + setState(f: (prevState: Readonly, props: P) => Pick, callback?: () => any): void; + // tslint:disable-next-line:unified-signatures + setState(state: Pick, callback?: () => any): void; forceUpdate(callBack?: () => any): void; render(): ReactNode; @@ -3517,15 +3519,18 @@ declare namespace React { declare global { namespace JSX { - interface Element extends React.ReactElement { } // tslint:disable-line:no-empty-interface + // tslint:disable-next-line:no-empty-interface + interface Element extends React.ReactElement { } interface ElementClass extends React.Component { render(): React.ReactNode; } interface ElementAttributesProperty { props: {}; } interface ElementChildrenAttribute { children: {}; } - interface IntrinsicAttributes extends React.Attributes { } // tslint:disable-line:no-empty-interface - interface IntrinsicClassAttributes extends React.ClassAttributes { } // tslint:disable-line:no-empty-interface + // tslint:disable-next-line:no-empty-interface + interface IntrinsicAttributes extends React.Attributes { } + // tslint:disable-next-line:no-empty-interface + interface IntrinsicClassAttributes extends React.ClassAttributes { } interface IntrinsicElements { // HTML From ad0e1920d28a38643a97231881b3359d93cf0efc Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 4 Dec 2017 10:44:00 -0800 Subject: [PATCH 167/322] Re-added exports and "chai" module to chai types (#21924) * Re-added exports and "chai" module to chai types Fixes issues with downstream typings and projects that relied on the chai module. * Re-disabled packaging tslint rules --- types/chai/index.d.ts | 26 +++++++++++++------------- types/chai/tslint.json | 5 ++++- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 984e4103d1..8c19f1f54a 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -26,20 +26,20 @@ declare namespace Chai { version: string; } - interface ExpectStatic extends AssertionStatic { + export interface ExpectStatic extends AssertionStatic { fail(actual?: any, expected?: any, message?: string, operator?: Operator): void; } - interface AssertStatic extends Assert { + export interface AssertStatic extends Assert { } - interface AssertionStatic { + export interface AssertionStatic { (target: any, message?: string): Assertion; } - type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!=="; + export type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!=="; - type OperatorComparable = boolean | null | number | string | undefined | Date; + export type OperatorComparable = boolean | null | number | string | undefined | Date; interface ShouldAssertion { equal(value1: any, value2: any, message?: string): void; @@ -256,7 +256,7 @@ declare namespace Chai { (object: Object, property: string, message?: string): Assertion; } - interface Assert { + export interface Assert { /** * @param expression Expression to test for truthiness. * @param message Message to display on error. @@ -1587,7 +1587,7 @@ declare namespace Chai { doesNotHaveAllDeepKeys(object: T, keys: Array | { [key: string]: any }, message?: string): void; } - interface Config { + export interface Config { /** * Default: false */ @@ -1604,7 +1604,7 @@ declare namespace Chai { truncateThreshold: number; } - class AssertionError { + export class AssertionError { constructor(message: string, _props?: any, ssf?: Function); name: string; message: string; @@ -1615,10 +1615,10 @@ declare namespace Chai { declare const chai: Chai.ChaiStatic; -export = chai; +declare module "chai" { + export = chai; +} -declare global { - interface Object { - should: Chai.Assertion; - } +interface Object { + should: Chai.Assertion; } diff --git a/types/chai/tslint.json b/types/chai/tslint.json index 1a0ebe45c6..f99183c97d 100644 --- a/types/chai/tslint.json +++ b/types/chai/tslint.json @@ -4,8 +4,11 @@ "ban-types": false, "callable-types": false, "new-parens": false, + "no-declare-current-package": false, "no-empty-interface": false, "no-redundant-jsdoc-2": false, - "no-unnecessary-generics": false + "no-single-declare-module": false, + "no-unnecessary-generics": false, + "strict-export-declare-modifiers": false } } From 13a6e92a7fdd432276059ab301304bd73dfb6ab6 Mon Sep 17 00:00:00 2001 From: John Gozde Date: Mon, 4 Dec 2017 11:49:38 -0700 Subject: [PATCH 168/322] Revert 'type' changes --- types/react/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index a2ea9bdc6c..4c0aa8c0a3 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -88,7 +88,7 @@ declare namespace React { } interface ReactElement

{ - type: string | symbol | number | ComponentClass

| SFC

; + type: string | ComponentClass

| SFC

; props: P; key: Key | null; } @@ -222,7 +222,7 @@ declare namespace React { props?: ClassAttributes & P, ...children: ReactNode[]): CElement; function createElement

( - type: SFC

| ComponentClass

| string | symbol | number, + type: SFC

| ComponentClass

| string, props?: Attributes & P, ...children: ReactNode[]): ReactElement

; From 809dbe9864a9952d2dc5633905d31e10822e370e Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Fri, 1 Dec 2017 15:41:30 +0000 Subject: [PATCH 169/322] add redis add_command function --- types/redis/index.d.ts | 6 +++++- types/redis/redis-tests.ts | 12 ++++++++---- types/redis/tsconfig.json | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/types/redis/index.d.ts b/types/redis/index.d.ts index 5f7e1d1e10..00029fe2d3 100644 --- a/types/redis/index.d.ts +++ b/types/redis/index.d.ts @@ -5,6 +5,7 @@ // TANAKA Koichi // Stuart Schechter // Junyoung Choi +// James Garbutt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/types/npm-redis @@ -43,7 +44,7 @@ export interface ClientOpts { password?: string; db?: string | number; family?: string; - rename_commands?: { [command: string]: string }; + rename_commands?: { [command: string]: string } | null; tls?: any; prefix?: string; retry_strategy?: RetryStrategy; @@ -1202,6 +1203,9 @@ export interface RedisClient extends Commands, EventEmitter { send_command(command: string, cb?: Callback): boolean; send_command(command: string, args?: any[], cb?: Callback): boolean; + addCommand(command: string): void; + add_command(command: string): void; + /** * Mark the start of a transaction block. */ diff --git a/types/redis/redis-tests.ts b/types/redis/redis-tests.ts index 25bafc0627..4c38b9046e 100644 --- a/types/redis/redis-tests.ts +++ b/types/redis/redis-tests.ts @@ -6,10 +6,10 @@ const num = 0; const str = 'any string'; const err: Error = new Error(); const args: any[] = []; -const resCallback: (err: Error, res: any) => void = () => null; -const numCallback: (err: Error, res: number) => void = () => null; -const strCallback: (err: Error, res: string) => void = () => null; -const messageHandler: (channel: string, message: any) => void = () => null; +const resCallback: (err: Error | null, res: any) => void = () => {}; +const numCallback: (err: Error | null, res: number) => void = () => {}; +const strCallback: (err: Error | null, res: string) => void = () => {}; +const messageHandler: (channel: string, message: any) => void = () => {}; // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- @@ -117,3 +117,7 @@ client.cork(); client.set("abc", "fff", strCallback); client.get("abc", resCallback); client.uncork(); + +// Add command +client.add_command('my command'); +client.addCommand('my other command'); diff --git a/types/redis/tsconfig.json b/types/redis/tsconfig.json index e79b038103..b99c599145 100644 --- a/types/redis/tsconfig.json +++ b/types/redis/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -20,4 +20,4 @@ "index.d.ts", "redis-tests.ts" ] -} \ No newline at end of file +} From a385b18cd63d91f395f54c5c301f74241a884b11 Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Fri, 1 Dec 2017 13:02:40 -0800 Subject: [PATCH 170/322] Export nodejs native tls.checkServerIdentity function --- types/node/index.d.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 789e91997f..1d79e782d2 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -15,6 +15,7 @@ // Alvis HT Tang // Oliver Joseph Ash // Sebastian Silbermann +// Hannes Magnusson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /************************************************ @@ -4881,7 +4882,7 @@ declare module "tls" { servername?: string; path?: string; ALPNProtocols?: Array; - checkServerIdentity?: (servername: string, cert: string | Buffer | Array) => any; + checkServerIdentity?: typeof checkServerIdentity; secureProtocol?: string; secureContext?: Object; session?: Buffer; @@ -4984,6 +4985,14 @@ declare module "tls" { context: any; } + /* + * Verifies the certificate `cert` is issued to host `host`. + * @host The hostname to verify the certificate against + * @cert PeerCertificate representing the peer's certificate + * + * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined. + */ + export function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined; export function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; export function connect(options: ConnectionOptions, secureConnectionListener?: () => void): TLSSocket; export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; From 89a722bd8f1d70bfcffab63e923a7b5b80c8dd89 Mon Sep 17 00:00:00 2001 From: FaithForHumans Date: Mon, 4 Dec 2017 13:56:48 -0600 Subject: [PATCH 171/322] Getting rid of named component exports. Restoring UncontrolledProps in Alert, ButtonDropdown, Dropdown, NavDropdown, and Tooltip. --- types/reactstrap/index.d.ts | 150 +++++++++--------- types/reactstrap/lib/Alert.d.ts | 7 +- types/reactstrap/lib/Badge.d.ts | 2 +- types/reactstrap/lib/Breadcrumb.d.ts | 2 +- types/reactstrap/lib/BreadcrumbItem.d.ts | 2 +- types/reactstrap/lib/Button.d.ts | 2 +- types/reactstrap/lib/ButtonDropdown.d.ts | 16 +- types/reactstrap/lib/ButtonGroup.d.ts | 2 +- types/reactstrap/lib/ButtonToolbar.d.ts | 2 +- types/reactstrap/lib/Card.d.ts | 2 +- types/reactstrap/lib/CardBlock.d.ts | 2 +- types/reactstrap/lib/CardBody.d.ts | 2 +- types/reactstrap/lib/CardColumns.d.ts | 2 +- types/reactstrap/lib/CardDeck.d.ts | 2 +- types/reactstrap/lib/CardFooter.d.ts | 2 +- types/reactstrap/lib/CardGroup.d.ts | 2 +- types/reactstrap/lib/CardHeader.d.ts | 2 +- types/reactstrap/lib/CardImg.d.ts | 2 +- types/reactstrap/lib/CardImgOverlay.d.ts | 2 +- types/reactstrap/lib/CardLink.d.ts | 2 +- types/reactstrap/lib/CardSubtitle.d.ts | 2 +- types/reactstrap/lib/CardText.d.ts | 2 +- types/reactstrap/lib/CardTitle.d.ts | 2 +- types/reactstrap/lib/Col.d.ts | 2 +- types/reactstrap/lib/Collapse.d.ts | 2 +- types/reactstrap/lib/Container.d.ts | 2 +- types/reactstrap/lib/Dropdown.d.ts | 12 +- types/reactstrap/lib/DropdownItem.d.ts | 2 +- types/reactstrap/lib/DropdownMenu.d.ts | 2 +- types/reactstrap/lib/DropdownToggle.d.ts | 2 +- types/reactstrap/lib/Fade.d.ts | 2 +- types/reactstrap/lib/Form.d.ts | 2 +- types/reactstrap/lib/FormFeedback.d.ts | 2 +- types/reactstrap/lib/FormGroup.d.ts | 2 +- types/reactstrap/lib/FormText.d.ts | 2 +- types/reactstrap/lib/Input.d.ts | 6 +- types/reactstrap/lib/InputGroup.d.ts | 2 +- types/reactstrap/lib/InputGroupAddon.d.ts | 2 +- types/reactstrap/lib/InputGroupButton.d.ts | 2 +- types/reactstrap/lib/Jumbotron.d.ts | 2 +- types/reactstrap/lib/Label.d.ts | 2 +- types/reactstrap/lib/ListGroup.d.ts | 2 +- types/reactstrap/lib/ListGroupItem.d.ts | 2 +- .../reactstrap/lib/ListGroupItemHeading.d.ts | 2 +- types/reactstrap/lib/ListGroupItemText.d.ts | 2 +- types/reactstrap/lib/Media.d.ts | 2 +- types/reactstrap/lib/Modal.d.ts | 2 +- types/reactstrap/lib/ModalBody.d.ts | 2 +- types/reactstrap/lib/ModalFooter.d.ts | 2 +- types/reactstrap/lib/ModalHeader.d.ts | 2 +- types/reactstrap/lib/Nav.d.ts | 2 +- types/reactstrap/lib/NavDropdown.d.ts | 16 +- types/reactstrap/lib/NavItem.d.ts | 2 +- types/reactstrap/lib/NavLink.d.ts | 2 +- types/reactstrap/lib/Navbar.d.ts | 2 +- types/reactstrap/lib/NavbarBrand.d.ts | 2 +- types/reactstrap/lib/NavbarToggler.d.ts | 2 +- types/reactstrap/lib/Pagination.d.ts | 2 +- types/reactstrap/lib/PaginationItem.d.ts | 2 +- types/reactstrap/lib/PaginationLink.d.ts | 2 +- types/reactstrap/lib/Popover.d.ts | 2 +- types/reactstrap/lib/PopoverBody.d.ts | 2 +- types/reactstrap/lib/PopoverHeader.d.ts | 2 +- types/reactstrap/lib/Progress.d.ts | 2 +- types/reactstrap/lib/Row.d.ts | 2 +- types/reactstrap/lib/TabContent.d.ts | 2 +- types/reactstrap/lib/TabPane.d.ts | 2 +- types/reactstrap/lib/Table.d.ts | 2 +- types/reactstrap/lib/Tag.d.ts | 2 +- types/reactstrap/lib/TetherContent.d.ts | 2 +- types/reactstrap/lib/Tooltip.d.ts | 7 +- 71 files changed, 182 insertions(+), 160 deletions(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index ae06cdd7cf..fb0242be63 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -12,78 +12,78 @@ export interface CSSModule { [className: string]: string; } -export { Alert, AlertProps } from './lib/Alert'; -export { Badge, BadgeProps } from './lib/Badge'; -export { Breadcrumb, BreadcrumbProps } from './lib/Breadcrumb'; -export { BreadcrumbItem, BreadcrumbItemProps } from './lib/BreadcrumbItem'; -export { Button, ButtonProps } from './lib/Button'; -export { ButtonDropdown, ButtonDropdownProps } from './lib/ButtonDropdown'; -export { ButtonGroup, ButtonGroupProps } from './lib/ButtonGroup'; -export { ButtonToolbar, ButtonToolbarProps } from './lib/ButtonToolbar'; -export { Card, CardProps } from './lib/Card'; -export { CardBody, CardBodyProps } from './lib/CardBody'; -export { CardBlock, CardBlockProps } from './lib/CardBlock'; -export { CardColumns, CardColumnsProps } from './lib/CardColumns'; -export { CardDeck, CardDeckProps } from './lib/CardDeck'; -export { CardFooter, CardFooterProps } from './lib/CardFooter'; -export { CardGroup, CardGroupProps } from './lib/CardGroup'; -export { CardHeader, CardHeaderProps } from './lib/CardHeader'; -export { CardImg, CardImgProps } from './lib/CardImg'; -export { CardImgOverlay, CardImgOverlayProps } from './lib/CardImgOverlay'; -export { CardLink, CardLinkProps } from './lib/CardLink'; -export { CardSubtitle, CardSubtitleProps } from './lib/CardSubtitle'; -export { CardText, CardTextProps } from './lib/CardText'; -export { CardTitle, CardTitleProps } from './lib/CardTitle'; -export { Col, ColProps } from './lib/Col'; -export { Collapse, CollapseProps } from './lib/Collapse'; -export { Container, ContainerProps } from './lib/Container'; -export { Dropdown, DropdownProps } from './lib/Dropdown'; -export { DropdownItem, DropdownItemProps } from './lib/DropdownItem'; -export { DropdownMenu, DropdownMenuProps } from './lib/DropdownMenu'; -export { DropdownToggle, DropdownToggleProps } from './lib/DropdownToggle'; -export { Fade, FadeProps } from './lib/Fade'; -export { Form, FormProps } from './lib/Form'; -export { FormFeedback, FormFeedbackProps } from './lib/FormFeedback'; -export { FormGroup, FormGroupProps } from './lib/FormGroup'; -export { FormText, FormTextProps } from './lib/FormText'; -export { Input, InputProps } from './lib/Input'; -export { InputGroup, InputGroupProps } from './lib/InputGroup'; -export { InputGroupAddon, InputGroupAddonProps } from './lib/InputGroupAddon'; -export { InputGroupButton, InputGroupButtonProps } from './lib/InputGroupButton'; -export { Jumbotron, JumbotronProps } from './lib/Jumbotron'; -export { Label, LabelProps } from './lib/Label'; -export { ListGroup, ListGroupProps } from './lib/ListGroup'; -export { ListGroupItem, ListGroupItemProps } from './lib/ListGroupItem'; -export { ListGroupItemHeading, ListGroupItemHeadingProps } from './lib/ListGroupItemHeading'; -export { ListGroupItemText, ListGroupItemTextProps } from './lib/ListGroupItemText'; -export { Media, MediaProps } from './lib/Media'; -export { Modal, ModalProps } from './lib/Modal'; -export { ModalBody, ModalBodyProps } from './lib/ModalBody'; -export { ModalFooter, ModalFooterProps } from './lib/ModalFooter'; -export { ModalHeader, ModalHeaderProps } from './lib/ModalHeader'; -export { Nav, NavProps } from './lib/Nav'; -export { Navbar, NavbarProps } from './lib/Navbar'; -export { NavbarBrand, NavbarBrandProps } from './lib/NavbarBrand'; -export { NavbarToggler, NavbarTogglerProps } from './lib/NavbarToggler'; -export { NavDropdown, NavDropdownProps } from './lib/NavDropdown'; -export { NavItem, NavItemProps } from './lib/NavItem'; -export { NavLink, NavLinkProps } from './lib/NavLink'; -export { Pagination, PaginationProps } from './lib/Pagination'; -export { PaginationItem, PaginationItemProps } from './lib/PaginationItem'; -export { PaginationLink, PaginationLinkProps } from './lib/PaginationLink'; -export { Popover, PopoverProps } from './lib/Popover'; -export { PopoverBody, PopoverBodyProps } from './lib/PopoverBody'; -export { PopoverHeader, PopoverHeaderProps } from './lib/PopoverHeader'; -export { Progress, ProgressProps } from './lib/Progress'; -export { Row, RowProps } from './lib/Row'; -export { TabContent, TabContentProps } from './lib/TabContent'; -export { Table, TableProps } from './lib/Table'; -export { TabPane, TabPaneProps } from './lib/TabPane'; -export { Tag, TagProps } from './lib/Tag'; -export { TetherContent, TetherContentProps } from './lib/TetherContent'; -export { Tooltip, TooltipProps } from './lib/Tooltip'; -export { UncontrolledAlert, UncontrolledAlertProps } from './lib/Uncontrolled'; -export { UncontrolledButtonDropdown, UncontrolledButtonDropdownProps } from './lib/Uncontrolled'; -export { UncontrolledDropdown, UncontrolledDropdownProps } from './lib/Uncontrolled'; -export { UncontrolledNavDropdown, UncontrolledNavDropdownProps } from './lib/Uncontrolled'; -export { UncontrolledTooltip, UncontrolledTooltipProps } from './lib/Uncontrolled'; +export { default as Alert, AlertProps } from './lib/Alert'; +export { default as Badge, BadgeProps } from './lib/Badge'; +export { default as Breadcrumb, BreadcrumbProps } from './lib/Breadcrumb'; +export { default as BreadcrumbItem, BreadcrumbItemProps } from './lib/BreadcrumbItem'; +export { default as Button, ButtonProps } from './lib/Button'; +export { default as ButtonDropdown, ButtonDropdownProps } from './lib/ButtonDropdown'; +export { default as ButtonGroup, ButtonGroupProps } from './lib/ButtonGroup'; +export { default as ButtonToolbar, ButtonToolbarProps } from './lib/ButtonToolbar'; +export { default as Card, CardProps } from './lib/Card'; +export { default as CardBody, CardBodyProps } from './lib/CardBody'; +export { default as CardBlock, CardBlockProps } from './lib/CardBlock'; +export { default as CardColumns, CardColumnsProps } from './lib/CardColumns'; +export { default as CardDeck, CardDeckProps } from './lib/CardDeck'; +export { default as CardFooter, CardFooterProps } from './lib/CardFooter'; +export { default as CardGroup, CardGroupProps } from './lib/CardGroup'; +export { default as CardHeader, CardHeaderProps } from './lib/CardHeader'; +export { default as CardImg, CardImgProps } from './lib/CardImg'; +export { default as CardImgOverlay, CardImgOverlayProps } from './lib/CardImgOverlay'; +export { default as CardLink, CardLinkProps } from './lib/CardLink'; +export { default as CardSubtitle, CardSubtitleProps } from './lib/CardSubtitle'; +export { default as CardText, CardTextProps } from './lib/CardText'; +export { default as CardTitle, CardTitleProps } from './lib/CardTitle'; +export { default as Col, ColProps } from './lib/Col'; +export { default as Collapse, CollapseProps } from './lib/Collapse'; +export { default as Container, ContainerProps } from './lib/Container'; +export { default as Dropdown, DropdownProps } from './lib/Dropdown'; +export { default as DropdownItem, DropdownItemProps } from './lib/DropdownItem'; +export { default as DropdownMenu, DropdownMenuProps } from './lib/DropdownMenu'; +export { default as DropdownToggle, DropdownToggleProps } from './lib/DropdownToggle'; +export { default as Fade, FadeProps } from './lib/Fade'; +export { default as Form, FormProps } from './lib/Form'; +export { default as FormFeedback, FormFeedbackProps } from './lib/FormFeedback'; +export { default as FormGroup, FormGroupProps } from './lib/FormGroup'; +export { default as FormText, FormTextProps } from './lib/FormText'; +export { default as Input, InputProps } from './lib/Input'; +export { default as InputGroup, InputGroupProps } from './lib/InputGroup'; +export { default as InputGroupAddon, InputGroupAddonProps } from './lib/InputGroupAddon'; +export { default as InputGroupButton, InputGroupButtonProps } from './lib/InputGroupButton'; +export { default as Jumbotron, JumbotronProps } from './lib/Jumbotron'; +export { default as Label, LabelProps } from './lib/Label'; +export { default as ListGroup, ListGroupProps } from './lib/ListGroup'; +export { default as ListGroupItem, ListGroupItemProps } from './lib/ListGroupItem'; +export { default as ListGroupItemHeading, ListGroupItemHeadingProps } from './lib/ListGroupItemHeading'; +export { default as ListGroupItemText, ListGroupItemTextProps } from './lib/ListGroupItemText'; +export { default as Media, MediaProps } from './lib/Media'; +export { default as Modal, ModalProps } from './lib/Modal'; +export { default as ModalBody, ModalBodyProps } from './lib/ModalBody'; +export { default as ModalFooter, ModalFooterProps } from './lib/ModalFooter'; +export { default as ModalHeader, ModalHeaderProps } from './lib/ModalHeader'; +export { default as Nav, NavProps } from './lib/Nav'; +export { default as Navbar, NavbarProps } from './lib/Navbar'; +export { default as NavbarBrand, NavbarBrandProps } from './lib/NavbarBrand'; +export { default as NavbarToggler, NavbarTogglerProps } from './lib/NavbarToggler'; +export { default as NavDropdown, NavDropdownProps } from './lib/NavDropdown'; +export { default as NavItem, NavItemProps } from './lib/NavItem'; +export { default as NavLink, NavLinkProps } from './lib/NavLink'; +export { default as Pagination, PaginationProps } from './lib/Pagination'; +export { default as PaginationItem, PaginationItemProps } from './lib/PaginationItem'; +export { default as PaginationLink, PaginationLinkProps } from './lib/PaginationLink'; +export { default as Popover, PopoverProps } from './lib/Popover'; +export { default as PopoverBody, PopoverBodyProps } from './lib/PopoverBody'; +export { default as PopoverHeader, PopoverHeaderProps } from './lib/PopoverHeader'; +export { default as Progress, ProgressProps } from './lib/Progress'; +export { default as Row, RowProps } from './lib/Row'; +export { default as TabContent, TabContentProps } from './lib/TabContent'; +export { default as Table, TableProps } from './lib/Table'; +export { default as TabPane, TabPaneProps } from './lib/TabPane'; +export { default as Tag, TagProps } from './lib/Tag'; +export { default as TetherContent, TetherContentProps } from './lib/TetherContent'; +export { default as Tooltip, TooltipProps } from './lib/Tooltip'; +export { UncontrolledAlert, UncontrolledAlertProps } from './lib/Uncontrolled'; +export { UncontrolledButtonDropdown, UncontrolledButtonDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledDropdown, UncontrolledDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledNavDropdown, UncontrolledNavDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledTooltip, UncontrolledTooltipProps } from './lib/Uncontrolled'; diff --git a/types/reactstrap/lib/Alert.d.ts b/types/reactstrap/lib/Alert.d.ts index 6ce7c0fe0e..c52ff2c35b 100644 --- a/types/reactstrap/lib/Alert.d.ts +++ b/types/reactstrap/lib/Alert.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface UncontrolledAlertProps { +export interface UncontrolledProps { className?: string; cssModule?: CSSModule; color?: string; @@ -9,11 +9,14 @@ export interface UncontrolledAlertProps { transitionEnterTimeout?: number; transitionLeaveTimeout?: number; } +export interface UncontrolledAlertProps extends UncontrolledProps { + /* intentionally blank */ +} export interface AlertProps extends UncontrolledAlertProps { isOpen?: boolean; toggle?: () => void; } -export const Alert: React.StatelessComponent; +declare const Alert: React.StatelessComponent; export default Alert; diff --git a/types/reactstrap/lib/Badge.d.ts b/types/reactstrap/lib/Badge.d.ts index 328e3abf36..b58faeed8c 100644 --- a/types/reactstrap/lib/Badge.d.ts +++ b/types/reactstrap/lib/Badge.d.ts @@ -8,5 +8,5 @@ export interface BadgeProps { cssModule?: CSSModule; } -export const Badge: React.StatelessComponent; +declare const Badge: React.StatelessComponent; export default Badge; diff --git a/types/reactstrap/lib/Breadcrumb.d.ts b/types/reactstrap/lib/Breadcrumb.d.ts index 62ccf477a9..4b5e2b85da 100644 --- a/types/reactstrap/lib/Breadcrumb.d.ts +++ b/types/reactstrap/lib/Breadcrumb.d.ts @@ -6,5 +6,5 @@ export interface BreadcrumbProps { cssModule?: CSSModule; } -export const Breadcrumb: React.StatelessComponent; +declare const Breadcrumb: React.StatelessComponent; export default Breadcrumb; diff --git a/types/reactstrap/lib/BreadcrumbItem.d.ts b/types/reactstrap/lib/BreadcrumbItem.d.ts index 81d18f0f76..4cb8d77c75 100644 --- a/types/reactstrap/lib/BreadcrumbItem.d.ts +++ b/types/reactstrap/lib/BreadcrumbItem.d.ts @@ -10,5 +10,5 @@ export interface BreadcrumbItemProps { [others: string]: any; } -export const BreadcrumbItem: React.StatelessComponent; +declare const BreadcrumbItem: React.StatelessComponent; export default BreadcrumbItem; diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index f4a8b4e4cd..50f69b1fb1 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -17,5 +17,5 @@ export interface ButtonProps extends React.HTMLProps { cssModule?: CSSModule; } -export const Button: React.StatelessComponent; +declare const Button: React.StatelessComponent; export default Button; diff --git a/types/reactstrap/lib/ButtonDropdown.d.ts b/types/reactstrap/lib/ButtonDropdown.d.ts index 284818f88f..fd09d6da8f 100644 --- a/types/reactstrap/lib/ButtonDropdown.d.ts +++ b/types/reactstrap/lib/ButtonDropdown.d.ts @@ -1,9 +1,15 @@ import { UncontrolledDropdownProps, DropdownProps } from './Dropdown'; -// tslint:disable-next-line -export interface UncontrolledButtonDropdownProps extends UncontrolledDropdownProps { } -// tslint:disable-next-line -export interface ButtonDropdownProps extends DropdownProps { } +export interface UncontrolledProps extends UncontrolledDropdownProps { + /* intentionally blank */ +} +export interface UncontrolledButtonDropdownProps extends UncontrolledProps { + /* intentionally blank */ +} -export const ButtonDropdown: React.StatelessComponent; +export interface ButtonDropdownProps extends DropdownProps { + /* intentionally blank */ +} + +declare const ButtonDropdown: React.StatelessComponent; export default ButtonDropdown; diff --git a/types/reactstrap/lib/ButtonGroup.d.ts b/types/reactstrap/lib/ButtonGroup.d.ts index cf51a29326..29bbaac38b 100644 --- a/types/reactstrap/lib/ButtonGroup.d.ts +++ b/types/reactstrap/lib/ButtonGroup.d.ts @@ -10,5 +10,5 @@ export interface ButtonGroupProps { vertical?: boolean; } -export const ButtonGroup: React.StatelessComponent; +declare const ButtonGroup: React.StatelessComponent; export default ButtonGroup; diff --git a/types/reactstrap/lib/ButtonToolbar.d.ts b/types/reactstrap/lib/ButtonToolbar.d.ts index e57b84337a..1c782c5745 100644 --- a/types/reactstrap/lib/ButtonToolbar.d.ts +++ b/types/reactstrap/lib/ButtonToolbar.d.ts @@ -8,5 +8,5 @@ export interface ButtonToolbarProps { role?: string; } -export const ButtonToolbar: React.StatelessComponent; +declare const ButtonToolbar: React.StatelessComponent; export default ButtonToolbar; diff --git a/types/reactstrap/lib/Card.d.ts b/types/reactstrap/lib/Card.d.ts index 8398d3b631..97aafdc3e3 100644 --- a/types/reactstrap/lib/Card.d.ts +++ b/types/reactstrap/lib/Card.d.ts @@ -11,5 +11,5 @@ export interface CardProps { style?: React.CSSProperties; } -export const Card: React.StatelessComponent; +declare const Card: React.StatelessComponent; export default Card; diff --git a/types/reactstrap/lib/CardBlock.d.ts b/types/reactstrap/lib/CardBlock.d.ts index a4eae1cf6e..9830e15e6a 100644 --- a/types/reactstrap/lib/CardBlock.d.ts +++ b/types/reactstrap/lib/CardBlock.d.ts @@ -6,5 +6,5 @@ export interface CardBlockProps { cssModule?: CSSModule; } -export const CardBlock: React.StatelessComponent; +declare const CardBlock: React.StatelessComponent; export default CardBlock; diff --git a/types/reactstrap/lib/CardBody.d.ts b/types/reactstrap/lib/CardBody.d.ts index 9ff4ba1f7e..433a6a6ac0 100644 --- a/types/reactstrap/lib/CardBody.d.ts +++ b/types/reactstrap/lib/CardBody.d.ts @@ -6,5 +6,5 @@ export interface CardBodyProps { cssModule?: CSSModule; } -export const CardBody: React.StatelessComponent; +declare const CardBody: React.StatelessComponent; export default CardBody; diff --git a/types/reactstrap/lib/CardColumns.d.ts b/types/reactstrap/lib/CardColumns.d.ts index 4853240671..92eb2019ec 100644 --- a/types/reactstrap/lib/CardColumns.d.ts +++ b/types/reactstrap/lib/CardColumns.d.ts @@ -6,5 +6,5 @@ export interface CardColumnsProps { cssModule?: CSSModule; } -export const CardColumns: React.StatelessComponent; +declare const CardColumns: React.StatelessComponent; export default CardColumns; diff --git a/types/reactstrap/lib/CardDeck.d.ts b/types/reactstrap/lib/CardDeck.d.ts index 963d617383..c14324df37 100644 --- a/types/reactstrap/lib/CardDeck.d.ts +++ b/types/reactstrap/lib/CardDeck.d.ts @@ -6,5 +6,5 @@ export interface CardDeckProps { cssModule?: CSSModule; } -export const CardDeck: React.StatelessComponent; +declare const CardDeck: React.StatelessComponent; export default CardDeck; diff --git a/types/reactstrap/lib/CardFooter.d.ts b/types/reactstrap/lib/CardFooter.d.ts index 415406a14c..6dba776a38 100644 --- a/types/reactstrap/lib/CardFooter.d.ts +++ b/types/reactstrap/lib/CardFooter.d.ts @@ -6,5 +6,5 @@ export interface CardFooterProps { cssModule?: CSSModule; } -export const CardFooter: React.StatelessComponent; +declare const CardFooter: React.StatelessComponent; export default CardFooter; diff --git a/types/reactstrap/lib/CardGroup.d.ts b/types/reactstrap/lib/CardGroup.d.ts index be69f617e7..695747eef4 100644 --- a/types/reactstrap/lib/CardGroup.d.ts +++ b/types/reactstrap/lib/CardGroup.d.ts @@ -6,5 +6,5 @@ export interface CardGroupProps { cssModule?: CSSModule; } -export const CardGroup: React.StatelessComponent; +declare const CardGroup: React.StatelessComponent; export default CardGroup; diff --git a/types/reactstrap/lib/CardHeader.d.ts b/types/reactstrap/lib/CardHeader.d.ts index e9a468e2e4..306ff445e3 100644 --- a/types/reactstrap/lib/CardHeader.d.ts +++ b/types/reactstrap/lib/CardHeader.d.ts @@ -6,5 +6,5 @@ export interface CardHeaderProps { cssModule?: CSSModule; } -export const CardHeader: React.StatelessComponent; +declare const CardHeader: React.StatelessComponent; export default CardHeader; diff --git a/types/reactstrap/lib/CardImg.d.ts b/types/reactstrap/lib/CardImg.d.ts index 76bd9a18f2..e65cba66e2 100644 --- a/types/reactstrap/lib/CardImg.d.ts +++ b/types/reactstrap/lib/CardImg.d.ts @@ -12,5 +12,5 @@ export interface CardImgProps { alt?: string; } -export const CardImg: React.StatelessComponent; +declare const CardImg: React.StatelessComponent; export default CardImg; diff --git a/types/reactstrap/lib/CardImgOverlay.d.ts b/types/reactstrap/lib/CardImgOverlay.d.ts index 0511d38e8b..d31e96d76f 100644 --- a/types/reactstrap/lib/CardImgOverlay.d.ts +++ b/types/reactstrap/lib/CardImgOverlay.d.ts @@ -6,5 +6,5 @@ export interface CardImgOverlayProps { cssModule?: CSSModule; } -export const CardImgOverlay: React.StatelessComponent; +declare const CardImgOverlay: React.StatelessComponent; export default CardImgOverlay; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 68ef38fa62..22c9d614b3 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -8,5 +8,5 @@ export interface CardLinkProps { href?: string; } -export const CardLink: React.StatelessComponent; +declare const CardLink: React.StatelessComponent; export default CardLink; diff --git a/types/reactstrap/lib/CardSubtitle.d.ts b/types/reactstrap/lib/CardSubtitle.d.ts index 5c2cbe574f..915c69c93f 100644 --- a/types/reactstrap/lib/CardSubtitle.d.ts +++ b/types/reactstrap/lib/CardSubtitle.d.ts @@ -6,5 +6,5 @@ export interface CardSubtitleProps { cssModule?: CSSModule; } -export const CardSubtitle: React.StatelessComponent; +declare const CardSubtitle: React.StatelessComponent; export default CardSubtitle; diff --git a/types/reactstrap/lib/CardText.d.ts b/types/reactstrap/lib/CardText.d.ts index 1b411717f5..3782e962be 100644 --- a/types/reactstrap/lib/CardText.d.ts +++ b/types/reactstrap/lib/CardText.d.ts @@ -6,5 +6,5 @@ export interface CardTextProps { cssModule?: CSSModule; } -export const CardText: React.StatelessComponent; +declare const CardText: React.StatelessComponent; export default CardText; diff --git a/types/reactstrap/lib/CardTitle.d.ts b/types/reactstrap/lib/CardTitle.d.ts index 483a47adb7..f551d860ab 100644 --- a/types/reactstrap/lib/CardTitle.d.ts +++ b/types/reactstrap/lib/CardTitle.d.ts @@ -6,5 +6,5 @@ export interface CardTitleProps { cssModule?: CSSModule; } -export const CardTitle: React.StatelessComponent; +declare const CardTitle: React.StatelessComponent; export default CardTitle; diff --git a/types/reactstrap/lib/Col.d.ts b/types/reactstrap/lib/Col.d.ts index c1bc6a0cd9..b0aa8f98c1 100644 --- a/types/reactstrap/lib/Col.d.ts +++ b/types/reactstrap/lib/Col.d.ts @@ -20,5 +20,5 @@ export interface ColProps extends React.HTMLProps { widths?: string[]; } -export const Col: React.StatelessComponent; +declare const Col: React.StatelessComponent; export default Col; diff --git a/types/reactstrap/lib/Collapse.d.ts b/types/reactstrap/lib/Collapse.d.ts index d926fd677d..d2c6bc0c70 100644 --- a/types/reactstrap/lib/Collapse.d.ts +++ b/types/reactstrap/lib/Collapse.d.ts @@ -14,5 +14,5 @@ export interface CollapseProps extends React.HTMLProps { onClosed?: () => void; } -export const Collapse: React.StatelessComponent; +declare const Collapse: React.StatelessComponent; export default Collapse; diff --git a/types/reactstrap/lib/Container.d.ts b/types/reactstrap/lib/Container.d.ts index 63906b7bf3..4721cf68c1 100644 --- a/types/reactstrap/lib/Container.d.ts +++ b/types/reactstrap/lib/Container.d.ts @@ -7,5 +7,5 @@ export interface ContainerProps { cssModule?: CSSModule; } -export const Container: React.StatelessComponent; +declare const Container: React.StatelessComponent; export default Container; diff --git a/types/reactstrap/lib/Dropdown.d.ts b/types/reactstrap/lib/Dropdown.d.ts index 93a0ee1ce5..38bfe65b63 100644 --- a/types/reactstrap/lib/Dropdown.d.ts +++ b/types/reactstrap/lib/Dropdown.d.ts @@ -2,14 +2,17 @@ import { CSSModule } from '../index'; -export interface UncontrolledDropdownProps { +export interface UncontrolledProps { isOpen?: boolean; toggle?: () => void; className?: string; cssModule?: CSSModule; } +export interface UncontrolledDropdownProps extends UncontrolledProps { + /* intentionally blank */ +} -export interface DropdownProps extends UncontrolledDropdownProps { +export interface Props extends UncontrolledProps { disabled?: boolean; dropup?: boolean; group?: boolean; @@ -17,6 +20,9 @@ export interface DropdownProps extends UncontrolledDropdownProps { tag?: React.ReactType; tether?: boolean | Tether.ITetherOptions; } +export interface DropdownProps extends Props { + /* intentionally blank */ +} -export const Dropdown: React.StatelessComponent; +declare const Dropdown: React.StatelessComponent; export default Dropdown; diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index 194d89bf0b..963f1e3865 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -12,5 +12,5 @@ export interface DropdownItemProps { toggle?: boolean; } -export const DropdownItem: React.StatelessComponent; +declare const DropdownItem: React.StatelessComponent; export default DropdownItem; diff --git a/types/reactstrap/lib/DropdownMenu.d.ts b/types/reactstrap/lib/DropdownMenu.d.ts index 1bbf642a09..04ca074b41 100644 --- a/types/reactstrap/lib/DropdownMenu.d.ts +++ b/types/reactstrap/lib/DropdownMenu.d.ts @@ -7,5 +7,5 @@ export interface DropdownMenuProps { cssModule?: CSSModule; } -export const DropdownMenu: React.StatelessComponent; +declare const DropdownMenu: React.StatelessComponent; export default DropdownMenu; diff --git a/types/reactstrap/lib/DropdownToggle.d.ts b/types/reactstrap/lib/DropdownToggle.d.ts index 8f395b998d..51028815d4 100644 --- a/types/reactstrap/lib/DropdownToggle.d.ts +++ b/types/reactstrap/lib/DropdownToggle.d.ts @@ -15,5 +15,5 @@ export interface DropdownToggleProps { size?: string; } -export const DropdownToggle: React.StatelessComponent; +declare const DropdownToggle: React.StatelessComponent; export default DropdownToggle; diff --git a/types/reactstrap/lib/Fade.d.ts b/types/reactstrap/lib/Fade.d.ts index ab77d7fb61..6f86b33846 100644 --- a/types/reactstrap/lib/Fade.d.ts +++ b/types/reactstrap/lib/Fade.d.ts @@ -16,5 +16,5 @@ export interface FadeProps { onEnter?: () => void; } -export const Fade: React.StatelessComponent; +declare const Fade: React.StatelessComponent; export default Fade; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index 507b617a12..997f4c4e5c 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -8,5 +8,5 @@ export interface FormProps extends React.HTMLProps { cssModule?: CSSModule; } -export const Form: React.StatelessComponent; +declare const Form: React.StatelessComponent; export default Form; diff --git a/types/reactstrap/lib/FormFeedback.d.ts b/types/reactstrap/lib/FormFeedback.d.ts index e9479bc53d..20e9b27745 100644 --- a/types/reactstrap/lib/FormFeedback.d.ts +++ b/types/reactstrap/lib/FormFeedback.d.ts @@ -6,5 +6,5 @@ export interface FormFeedbackProps { cssModule?: CSSModule; } -export const FormFeedback: React.StatelessComponent; +declare const FormFeedback: React.StatelessComponent; export default FormFeedback; diff --git a/types/reactstrap/lib/FormGroup.d.ts b/types/reactstrap/lib/FormGroup.d.ts index c3e4d384db..5827f2c17b 100644 --- a/types/reactstrap/lib/FormGroup.d.ts +++ b/types/reactstrap/lib/FormGroup.d.ts @@ -10,5 +10,5 @@ export interface FormGroupProps extends React.HTMLProps { cssModule?: CSSModule; } -export const FormGroup: React.StatelessComponent; +declare const FormGroup: React.StatelessComponent; export default FormGroup; diff --git a/types/reactstrap/lib/FormText.d.ts b/types/reactstrap/lib/FormText.d.ts index ca4e1858fe..a749d6fc30 100644 --- a/types/reactstrap/lib/FormText.d.ts +++ b/types/reactstrap/lib/FormText.d.ts @@ -8,5 +8,5 @@ export interface FormTextProps { cssModule?: CSSModule; } -export const FormText: React.StatelessComponent; +declare const FormText: React.StatelessComponent; export default FormText; diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index cc7377ca1f..f5c5ac1d02 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -40,13 +40,11 @@ export interface InputProps extends Intermediate { valid?: boolean; tag?: React.ReactType; innerRef?: string | ((instance: HTMLInputElement) => any); - static?: boolean; + plaintext?: boolean; addon?: boolean; className?: string; cssModule?: CSSModule; - // We don't have the property 'static' here because 'static' is a reserved keyword in TypeScript - // Maybe reactstrap will support an 'isStatic' alias in the future } -export const Input: React.StatelessComponent; +declare const Input: React.StatelessComponent; export default Input; diff --git a/types/reactstrap/lib/InputGroup.d.ts b/types/reactstrap/lib/InputGroup.d.ts index 9a6ac719bb..22f3ba027c 100644 --- a/types/reactstrap/lib/InputGroup.d.ts +++ b/types/reactstrap/lib/InputGroup.d.ts @@ -7,5 +7,5 @@ export interface InputGroupProps { cssModule?: CSSModule; } -export const InputGroup: React.StatelessComponent; +declare const InputGroup: React.StatelessComponent; export default InputGroup; diff --git a/types/reactstrap/lib/InputGroupAddon.d.ts b/types/reactstrap/lib/InputGroupAddon.d.ts index 63ac88c455..31f5af505d 100644 --- a/types/reactstrap/lib/InputGroupAddon.d.ts +++ b/types/reactstrap/lib/InputGroupAddon.d.ts @@ -6,5 +6,5 @@ export interface InputGroupAddonProps { cssModule?: CSSModule; } -export const InputGroupAddon: React.StatelessComponent; +declare const InputGroupAddon: React.StatelessComponent; export default InputGroupAddon; diff --git a/types/reactstrap/lib/InputGroupButton.d.ts b/types/reactstrap/lib/InputGroupButton.d.ts index f51c61b3d1..0d77701932 100644 --- a/types/reactstrap/lib/InputGroupButton.d.ts +++ b/types/reactstrap/lib/InputGroupButton.d.ts @@ -9,5 +9,5 @@ export interface InputGroupButtonProps { color?: string; } -export const InputGroupButton: React.StatelessComponent; +declare const InputGroupButton: React.StatelessComponent; export default InputGroupButton; diff --git a/types/reactstrap/lib/Jumbotron.d.ts b/types/reactstrap/lib/Jumbotron.d.ts index 885bbe5f8f..6cb94c04c1 100644 --- a/types/reactstrap/lib/Jumbotron.d.ts +++ b/types/reactstrap/lib/Jumbotron.d.ts @@ -7,5 +7,5 @@ export interface JumbotronProps { cssModule?: CSSModule; } -export const Jumbotron: React.StatelessComponent; +declare const Jumbotron: React.StatelessComponent; export default Jumbotron; diff --git a/types/reactstrap/lib/Label.d.ts b/types/reactstrap/lib/Label.d.ts index 26728059e0..ae73e100f4 100644 --- a/types/reactstrap/lib/Label.d.ts +++ b/types/reactstrap/lib/Label.d.ts @@ -22,5 +22,5 @@ export interface LabelProps extends Intermediate { xl?: ColumnProps; } -export const Label: React.StatelessComponent; +declare const Label: React.StatelessComponent; export default Label; diff --git a/types/reactstrap/lib/ListGroup.d.ts b/types/reactstrap/lib/ListGroup.d.ts index aec7fa4045..a2a088935b 100644 --- a/types/reactstrap/lib/ListGroup.d.ts +++ b/types/reactstrap/lib/ListGroup.d.ts @@ -7,5 +7,5 @@ export interface ListGroupProps { cssModule?: CSSModule; } -export const ListGroup: React.StatelessComponent; +declare const ListGroup: React.StatelessComponent; export default ListGroup; diff --git a/types/reactstrap/lib/ListGroupItem.d.ts b/types/reactstrap/lib/ListGroupItem.d.ts index 5b610f87e2..d2cb1a9e67 100644 --- a/types/reactstrap/lib/ListGroupItem.d.ts +++ b/types/reactstrap/lib/ListGroupItem.d.ts @@ -13,5 +13,5 @@ export interface ListGroupItemProps { onClick?: React.MouseEventHandler; } -export const ListGroupItem: React.StatelessComponent; +declare const ListGroupItem: React.StatelessComponent; export default ListGroupItem; diff --git a/types/reactstrap/lib/ListGroupItemHeading.d.ts b/types/reactstrap/lib/ListGroupItemHeading.d.ts index 3e8d83a0dc..0f5bdfb457 100644 --- a/types/reactstrap/lib/ListGroupItemHeading.d.ts +++ b/types/reactstrap/lib/ListGroupItemHeading.d.ts @@ -6,5 +6,5 @@ export interface ListGroupItemHeadingProps { cssModule?: CSSModule; } -export const ListGroupItemHeading: React.StatelessComponent; +declare const ListGroupItemHeading: React.StatelessComponent; export default ListGroupItemHeading; diff --git a/types/reactstrap/lib/ListGroupItemText.d.ts b/types/reactstrap/lib/ListGroupItemText.d.ts index ad83a45831..7010eb1289 100644 --- a/types/reactstrap/lib/ListGroupItemText.d.ts +++ b/types/reactstrap/lib/ListGroupItemText.d.ts @@ -6,5 +6,5 @@ export interface ListGroupItemTextProps { cssModule?: CSSModule; } -export const ListGroupItemText: React.StatelessComponent; +declare const ListGroupItemText: React.StatelessComponent; export default ListGroupItemText; diff --git a/types/reactstrap/lib/Media.d.ts b/types/reactstrap/lib/Media.d.ts index 17b65f25f0..daf4fadcc8 100644 --- a/types/reactstrap/lib/Media.d.ts +++ b/types/reactstrap/lib/Media.d.ts @@ -17,5 +17,5 @@ export interface MediaProps { alt?: string; } -export const Media: React.StatelessComponent; +declare const Media: React.StatelessComponent; export default Media; diff --git a/types/reactstrap/lib/Modal.d.ts b/types/reactstrap/lib/Modal.d.ts index 77122f64b4..5fc1ffc734 100644 --- a/types/reactstrap/lib/Modal.d.ts +++ b/types/reactstrap/lib/Modal.d.ts @@ -19,5 +19,5 @@ export interface ModalProps { fade?: boolean; } -export const Modal: React.StatelessComponent; +declare const Modal: React.StatelessComponent; export default Modal; diff --git a/types/reactstrap/lib/ModalBody.d.ts b/types/reactstrap/lib/ModalBody.d.ts index a2693cbf28..1467b5883a 100644 --- a/types/reactstrap/lib/ModalBody.d.ts +++ b/types/reactstrap/lib/ModalBody.d.ts @@ -6,5 +6,5 @@ export interface ModalBodyProps { cssModule?: CSSModule; } -export const ModalBody: React.StatelessComponent; +declare const ModalBody: React.StatelessComponent; export default ModalBody; diff --git a/types/reactstrap/lib/ModalFooter.d.ts b/types/reactstrap/lib/ModalFooter.d.ts index 0241dcde84..ae511eb7cc 100644 --- a/types/reactstrap/lib/ModalFooter.d.ts +++ b/types/reactstrap/lib/ModalFooter.d.ts @@ -6,5 +6,5 @@ export interface ModalFooterProps { cssModule?: CSSModule; } -export const ModalFooter: React.StatelessComponent; +declare const ModalFooter: React.StatelessComponent; export default ModalFooter; diff --git a/types/reactstrap/lib/ModalHeader.d.ts b/types/reactstrap/lib/ModalHeader.d.ts index a235d73183..47632f59e3 100644 --- a/types/reactstrap/lib/ModalHeader.d.ts +++ b/types/reactstrap/lib/ModalHeader.d.ts @@ -8,5 +8,5 @@ export interface ModalHeaderProps { toggle?: () => void; } -export const ModalHeader: React.StatelessComponent; +declare const ModalHeader: React.StatelessComponent; export default ModalHeader; diff --git a/types/reactstrap/lib/Nav.d.ts b/types/reactstrap/lib/Nav.d.ts index 23bf1e58c5..c29c9a6460 100644 --- a/types/reactstrap/lib/Nav.d.ts +++ b/types/reactstrap/lib/Nav.d.ts @@ -13,5 +13,5 @@ export interface NavProps extends React.HTMLProps { vertical?: boolean; } -export const Nav: React.StatelessComponent; +declare const Nav: React.StatelessComponent; export default Nav; diff --git a/types/reactstrap/lib/NavDropdown.d.ts b/types/reactstrap/lib/NavDropdown.d.ts index 22e408489b..e40e60601c 100644 --- a/types/reactstrap/lib/NavDropdown.d.ts +++ b/types/reactstrap/lib/NavDropdown.d.ts @@ -1,9 +1,15 @@ import { UncontrolledDropdownProps, DropdownProps } from './Dropdown'; -// tslint:disable-next-line -export interface UncontrolledNavDropdownProps extends UncontrolledDropdownProps { } -// tslint:disable-next-line -export interface NavDropdownProps extends DropdownProps { } +export interface UncontrolledProps extends UncontrolledDropdownProps { + /* intentionally blank */ +} +export interface UncontrolledNavDropdownProps extends UncontrolledProps { + /* intentionally blank */ +} -export const NavDropdown: React.StatelessComponent; +export interface NavDropdownProps extends DropdownProps { + /* intentionally blank */ +} + +declare const NavDropdown: React.StatelessComponent; export default NavDropdown; diff --git a/types/reactstrap/lib/NavItem.d.ts b/types/reactstrap/lib/NavItem.d.ts index cb32a4fad1..0769347298 100644 --- a/types/reactstrap/lib/NavItem.d.ts +++ b/types/reactstrap/lib/NavItem.d.ts @@ -6,5 +6,5 @@ export interface NavItemProps { cssModule?: CSSModule; } -export const NavItem: React.StatelessComponent; +declare const NavItem: React.StatelessComponent; export default NavItem; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 7fa907c453..53640c65e1 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -11,5 +11,5 @@ export interface NavLinkProps extends React.HTMLProps { href?: string; } -export const NavLink: React.StatelessComponent; +declare const NavLink: React.StatelessComponent; export default NavLink; diff --git a/types/reactstrap/lib/Navbar.d.ts b/types/reactstrap/lib/Navbar.d.ts index fd52feeae8..ed3f28a02c 100644 --- a/types/reactstrap/lib/Navbar.d.ts +++ b/types/reactstrap/lib/Navbar.d.ts @@ -16,5 +16,5 @@ export interface NavbarProps { expand?: boolean | string; } -export const Navbar: React.StatelessComponent; +declare const Navbar: React.StatelessComponent; export default Navbar; diff --git a/types/reactstrap/lib/NavbarBrand.d.ts b/types/reactstrap/lib/NavbarBrand.d.ts index 8e3328ab81..83ac8367b5 100644 --- a/types/reactstrap/lib/NavbarBrand.d.ts +++ b/types/reactstrap/lib/NavbarBrand.d.ts @@ -6,5 +6,5 @@ export interface NavbarBrandProps extends React.HTMLProps { cssModule?: CSSModule; } -export const NavbarBrand: React.StatelessComponent; +declare const NavbarBrand: React.StatelessComponent; export default NavbarBrand; diff --git a/types/reactstrap/lib/NavbarToggler.d.ts b/types/reactstrap/lib/NavbarToggler.d.ts index 1855e2c41c..1eea9880a5 100644 --- a/types/reactstrap/lib/NavbarToggler.d.ts +++ b/types/reactstrap/lib/NavbarToggler.d.ts @@ -9,5 +9,5 @@ export interface NavbarTogglerProps extends React.HTMLProps { left?: boolean; } -export const NavbarToggler: React.StatelessComponent; +declare const NavbarToggler: React.StatelessComponent; export default NavbarToggler; diff --git a/types/reactstrap/lib/Pagination.d.ts b/types/reactstrap/lib/Pagination.d.ts index dd1a0c9d51..7657d90206 100644 --- a/types/reactstrap/lib/Pagination.d.ts +++ b/types/reactstrap/lib/Pagination.d.ts @@ -6,5 +6,5 @@ export interface PaginationProps { size?: string; } -export const Pagination: React.StatelessComponent; +declare const Pagination: React.StatelessComponent; export default Pagination; diff --git a/types/reactstrap/lib/PaginationItem.d.ts b/types/reactstrap/lib/PaginationItem.d.ts index 1e8efa8712..c2eadfab97 100644 --- a/types/reactstrap/lib/PaginationItem.d.ts +++ b/types/reactstrap/lib/PaginationItem.d.ts @@ -8,5 +8,5 @@ export interface PaginationItemProps { tag?: React.ReactType; } -export const PaginationItem: React.StatelessComponent; +declare const PaginationItem: React.StatelessComponent; export default PaginationItem; diff --git a/types/reactstrap/lib/PaginationLink.d.ts b/types/reactstrap/lib/PaginationLink.d.ts index c57bee37ac..52fbc6353a 100644 --- a/types/reactstrap/lib/PaginationLink.d.ts +++ b/types/reactstrap/lib/PaginationLink.d.ts @@ -9,5 +9,5 @@ export interface PaginationLinkProps extends React.HTMLProps tag?: React.ReactType; } -export const PaginationLink: React.StatelessComponent; +declare const PaginationLink: React.StatelessComponent; export default PaginationLink; diff --git a/types/reactstrap/lib/Popover.d.ts b/types/reactstrap/lib/Popover.d.ts index e9e757572e..dcded7ab68 100644 --- a/types/reactstrap/lib/Popover.d.ts +++ b/types/reactstrap/lib/Popover.d.ts @@ -30,5 +30,5 @@ export interface PopoverProps { toggle?: () => void; } -export const Popover: React.StatelessComponent; +declare const Popover: React.StatelessComponent; export default Popover; diff --git a/types/reactstrap/lib/PopoverBody.d.ts b/types/reactstrap/lib/PopoverBody.d.ts index de2d61f5e2..93512cacb1 100644 --- a/types/reactstrap/lib/PopoverBody.d.ts +++ b/types/reactstrap/lib/PopoverBody.d.ts @@ -6,5 +6,5 @@ export interface PopoverBodyProps { cssModule?: CSSModule; } -export const PopoverBody: React.StatelessComponent; +declare const PopoverBody: React.StatelessComponent; export default PopoverBody; diff --git a/types/reactstrap/lib/PopoverHeader.d.ts b/types/reactstrap/lib/PopoverHeader.d.ts index 7f38988391..2ad69c636c 100644 --- a/types/reactstrap/lib/PopoverHeader.d.ts +++ b/types/reactstrap/lib/PopoverHeader.d.ts @@ -6,5 +6,5 @@ export interface PopoverHeaderProps { cssModule?: CSSModule; } -export const PopoverHeader: React.StatelessComponent; +declare const PopoverHeader: React.StatelessComponent; export default PopoverHeader; diff --git a/types/reactstrap/lib/Progress.d.ts b/types/reactstrap/lib/Progress.d.ts index 9ab522746c..89e9df4be9 100644 --- a/types/reactstrap/lib/Progress.d.ts +++ b/types/reactstrap/lib/Progress.d.ts @@ -14,5 +14,5 @@ export interface ProgressProps { barClassName?: string; } -export const Progress: React.StatelessComponent; +declare const Progress: React.StatelessComponent; export default Progress; diff --git a/types/reactstrap/lib/Row.d.ts b/types/reactstrap/lib/Row.d.ts index 30d202e919..e5553ff81f 100644 --- a/types/reactstrap/lib/Row.d.ts +++ b/types/reactstrap/lib/Row.d.ts @@ -7,5 +7,5 @@ export interface RowProps extends React.HTMLProps< HTMLElement> { noGutters?: boolean; } -export const Row: React.StatelessComponent; +declare const Row: React.StatelessComponent; export default Row; diff --git a/types/reactstrap/lib/TabContent.d.ts b/types/reactstrap/lib/TabContent.d.ts index 1aced21b02..2581ea7a93 100644 --- a/types/reactstrap/lib/TabContent.d.ts +++ b/types/reactstrap/lib/TabContent.d.ts @@ -7,5 +7,5 @@ export interface TabContentProps { cssModule?: CSSModule; } -export const TabContent: React.StatelessComponent; +declare const TabContent: React.StatelessComponent; export default TabContent; diff --git a/types/reactstrap/lib/TabPane.d.ts b/types/reactstrap/lib/TabPane.d.ts index 1d588e7304..a39398d59b 100644 --- a/types/reactstrap/lib/TabPane.d.ts +++ b/types/reactstrap/lib/TabPane.d.ts @@ -7,5 +7,5 @@ export interface TabPaneProps { tabId?: number | string; } -export const TabPane: React.StatelessComponent; +declare const TabPane: React.StatelessComponent; export default TabPane; diff --git a/types/reactstrap/lib/Table.d.ts b/types/reactstrap/lib/Table.d.ts index b49c6a5920..c2d31d71e2 100644 --- a/types/reactstrap/lib/Table.d.ts +++ b/types/reactstrap/lib/Table.d.ts @@ -14,5 +14,5 @@ export interface TableProps { responsiveTag?: React.ReactType; } -export const Table: React.StatelessComponent; +declare const Table: React.StatelessComponent; export default Table; diff --git a/types/reactstrap/lib/Tag.d.ts b/types/reactstrap/lib/Tag.d.ts index 0f2ed5bd07..153ff61177 100644 --- a/types/reactstrap/lib/Tag.d.ts +++ b/types/reactstrap/lib/Tag.d.ts @@ -8,5 +8,5 @@ export interface TagProps { cssModule?: CSSModule; } -export const Tag: React.StatelessComponent; +declare const Tag: React.StatelessComponent; export default Tag; diff --git a/types/reactstrap/lib/TetherContent.d.ts b/types/reactstrap/lib/TetherContent.d.ts index 7dd32ae381..54f0190090 100644 --- a/types/reactstrap/lib/TetherContent.d.ts +++ b/types/reactstrap/lib/TetherContent.d.ts @@ -14,5 +14,5 @@ export interface TetherContentProps { style?: React.CSSProperties; } -export const TetherContent: React.StatelessComponent; +declare const TetherContent: React.StatelessComponent; export default TetherContent; diff --git a/types/reactstrap/lib/Tooltip.d.ts b/types/reactstrap/lib/Tooltip.d.ts index 21a99707e8..a6183668bf 100644 --- a/types/reactstrap/lib/Tooltip.d.ts +++ b/types/reactstrap/lib/Tooltip.d.ts @@ -20,7 +20,7 @@ type Placement | 'left middle' | 'left bottom'; -export interface UncontrolledTooltipProps { +export interface UncontrolledProps { placement?: Placement; target: string; disabled?: boolean; @@ -31,11 +31,14 @@ export interface UncontrolledTooltipProps { autohide?: boolean; delay?: number | { show: number, hide: number }; } +export interface UncontrolledTooltipProps extends UncontrolledProps { + /* intentionally blank */ +} export interface TooltipProps extends UncontrolledTooltipProps { toggle?: () => void; isOpen?: boolean; } -export const Tooltip: React.StatelessComponent; +declare const Tooltip: React.StatelessComponent; export default Tooltip; From 335df032c70764c34be382c89e830d42b908ff20 Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Mon, 4 Dec 2017 17:05:43 -0400 Subject: [PATCH 172/322] Remove react-native-elements --- notNeededPackages.json | 6 + types/react-native-elements/README.md | 26 - types/react-native-elements/index.d.ts | 2265 ----------------- .../react-native-elements-tests.tsx | 975 ------- types/react-native-elements/tsconfig.json | 25 - types/react-native-elements/tslint.json | 1 - 6 files changed, 6 insertions(+), 3292 deletions(-) delete mode 100644 types/react-native-elements/README.md delete mode 100644 types/react-native-elements/index.d.ts delete mode 100644 types/react-native-elements/react-native-elements-tests.tsx delete mode 100644 types/react-native-elements/tsconfig.json delete mode 100644 types/react-native-elements/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 0e5f946e07..2414ebea00 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -570,6 +570,12 @@ "sourceRepoURL": "https://github.com/gpbl/react-day-picker", "asOfVersion": "5.3.0" }, + { + "libraryName": "react-native-elements", + "typingsPackageName": "react-native-elements", + "sourceRepoURL": "https://github.com/react-native-training/react-native-elements", + "asOfVersion": "0.18" + }, { "libraryName": "realm", "typingsPackageName": "realm", diff --git a/types/react-native-elements/README.md b/types/react-native-elements/README.md deleted file mode 100644 index 9e3975ecdf..0000000000 --- a/types/react-native-elements/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# [React Native Elements](https://github.com/react-native-training/react-native-elements) - -### Component Checklist - -- [x] Buttons -- [x] Badge -- [x] Social Icons / Social Icon Buttons -- [x] Icons -- [x] Side Menu -- [x] Form Elements -- [x] SearchBar -- [x] ButtonGroup -- [x] CheckBoxes -- [x] List Element -- [x] Tab Bar Component -- [x] HTML style headings -- [x] Card component -- [x] Pricing Component -- [x] Grid Component -- [x] Slider Component -- [x] Tile Component -- [x] Avatar Component -- [x] Rating Component -- [x] SwipeDeck Component -- [x] Header Component -- [x] Divider diff --git a/types/react-native-elements/index.d.ts b/types/react-native-elements/index.d.ts deleted file mode 100644 index 821e9b65e7..0000000000 --- a/types/react-native-elements/index.d.ts +++ /dev/null @@ -1,2265 +0,0 @@ -// Type definitions for react-native-elements 0.16 -// Project: https://github.com/react-native-training/react-native-elements#readme -// Definitions by: Kyle Roach -// Ifiok Jr. -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -import * as React from 'react'; -import { - ViewStyle, - TextStyle, - Image, - ImageStyle, - ImageURISource, - TouchableWithoutFeedbackProps, - TouchableHighlightProperties, - TouchableOpacityProperties, - ViewProperties, - TextInputProperties, - TextInput, - StatusBarProperties, - KeyboardType, - KeyboardTypeIOS, - StyleProp, - GestureResponderEvent, - Animated, - TransformsStyle -} from 'react-native'; -import TabNavigator from 'react-native-tab-navigator'; - -/** - * Supports auto complete for most used types as well as any other string type. - */ -export type IconType = - | 'material' - | 'material-community' - | 'simple-line-icon' - | 'zocial' - | 'font-awesome' - | 'octicon' - | 'ionicon' - | 'foundation' - | 'evilicon' - | 'entypo' - | string; - -export interface IconObject { - name?: string; - color?: string; - size?: number; - type?: IconType; - style?: StyleProp; -} - -export interface AvatarIcon extends IconObject { - iconStyle?: StyleProp; -} - -export interface TextProps { - /** - * font size 40 - */ - h1?: boolean; - - /** - * font size 34 - */ - h2?: boolean; - - /** - * font size 28 - */ - h3?: boolean; - - /** - * font size 22 - */ - h4?: boolean; - - /** - * font family name - */ - fontFamily?: string; - - /** - * Additional styling for Text - */ - style?: StyleProp; -} - -/** - * HTML Style Headings - * - * @see https://react-native-training.github.io/react-native-elements/API/HTML_style_headings/ - */ -export class Text extends React.Component {} - -export interface AvatarProps { - /** - * Component for enclosing element (eg: TouchableHighlight, View, etc) - * - * @default TouchableOpacity - */ - component?: React.ComponentClass; - - /** - * Width for the Avatar - * - * @default 34 - */ - width?: number; - - /** - * Height for the Avatar - * - * @default 34 - */ - height?: number; - - /** - * Callback function when pressing component - */ - onPress?(): void; - - /** - * Callback function when long pressing component - */ - onLongPress?(): void; - - /** - * Styling for outer container - */ - containerStyle?: StyleProp; - - /** - * Image source - */ - source?: ImageURISource; - - /** - * Style for avatar image - */ - avatarStyle?: ImageStyle; - - /** - * Determines the shape of avatar - * - * @default false - */ - rounded?: boolean; - - /** - * Renders title in the avatar - */ - title?: string; - - /** - * Style for the title - */ - titleStyle?: StyleProp; - - /** - * Style for the view outside image or icon - */ - overlayContainerStyle?: StyleProp; - - /** - * Opacity when pressed - * - * @default 0.2 - */ - activeOpacity?: number; - - /** - * Icon for the avatar - */ - icon?: AvatarIcon; - - /** - * extra styling for icon component - */ - iconStyle?: StyleProp; - - /** - * Small sized icon - */ - small?: boolean; - - /** - * Medium sized icon - */ - medium?: boolean; - - /** - * Large sized icon - */ - large?: boolean; - - /** - * Extra-large sized icon - */ - xlarge?: boolean; -} - -/** - * Avatar Component - * - * @see https://react-native-training.github.io/react-native-elements/API/avatar/ - */ -export class Avatar extends React.Component {} - -export interface ButtonIcon extends IconObject { - buttonStyle?: StyleProp; -} - -export interface ButtonProps extends TouchableWithoutFeedbackProps { - /** - * Specify other component such as TouchableOpacity or other - * - * @default TouchableHighlight (iOS), TouchableNativeFeedback (android) - */ - component?: React.ComponentClass; - - /** - * Additional styling for button component - * - * @default null - */ - buttonStyle?: StyleProp; - - /** - * Button title - */ - title: string; - - /** - * Makes button large - * - * @default false - */ - large?: boolean; - - /** - * Specify different font family - * - * @default System font (iOS), Sans Serif (android) - */ - fontFamily?: string; - - /** - * Specify font weight for title - * - * @default null - */ - fontWeight?: string; - - /** - * Icon configuration for icon on right side of title - */ - iconRight?: ButtonIcon; - - /** - * onPress method - */ - onPress(): void; - - /** - * onLongPress method - */ - onLongPress?(): void; - - /** - * Icon configuration - */ - icon?: ButtonIcon; - - /** - * Specify other icon component instead of default. The component will have all values from the icon prop - * - * @default MaterialIcon - * @see https://github.com/oblador/react-native-vector-icons#icon-component - */ - iconComponent?: JSX.Element; - - /** - * Background color of button - * - * @default #397af8 - */ - backgroundColor?: string; - - /** - * Adds border radius to button - * (Note: if you set this, don't forget to also set borderRadius to containerViewStyle prop, otherwise unexpected behaviour might occur) - * - * @default 0 - */ - borderRadius?: number; - - /** - * Font color - * - * @default #fff - */ - color?: string; - - /** - * Text styling - * - * @default null - */ - textStyle?: StyleProp; - - /** - * Font size - * - * @default 18 - */ - fontSize?: number; - - /** - * Underlay color for button press - * - * @default transparent - */ - underlayColor?: string; - - /** - * Flag to add raised button styling - * - * @default false - */ - raised?: boolean; - - /** - * Indicates button is disabled - * - * @default false - */ - disabled?: boolean; - - /** - * Disabled button styling - * - * @default null - */ - disabledStyle?: StyleProp; - - /** - * Styling for Component container - * - * @default null - */ - containerViewStyle?: StyleProp; - - /** - * Styling for loading spinner - * - * @default null - */ - activityIndicatorStyle?: StyleProp; - - /** - * Display a loading spinner - * - * @default false - */ - loading?: boolean; - - /** - * Display the spinner to the right - * - * @default false - */ - loadingRight?: boolean; -} - -/** - * Button component - * - * @see https://react-native-training.github.io/react-native-elements/API/buttons/ - */ -export class Button extends React.Component {} - -export interface BadgeProps { - /** - * Text value to be displayed by badge - * - * @default null - */ - value?: string | number; - - /** - * Style for the outer badge component - */ - containerStyle?: StyleProp; - - /** - * Style for the outer-most badge component - */ - wrapperStyle?: StyleProp; - - /** - * Style for the text in the badge - */ - textStyle?: StyleProp; - - /** - * Override the default badge contents, mutually exclusive with 'value' property - */ - children?: JSX.Element; - - /** - * Custom component to replace the badge outer component - * - * @default View (if onPress then TouchableOpacity) - */ - component?: React.ComponentClass; - - /** - * Function called when pressed on the badge - */ - onPress?(): void; -} - -/** - * Badge component - * - * @see https://react-native-training.github.io/react-native-elements/API/badge/ - */ -export class Badge extends React.Component {} - -export interface CardProps { - /** - * Flex direction (row or column) - * - * @default 'column' - */ - flexDirection?: 'column' | 'row'; - - /** - * Outer container style - */ - containerStyle?: StyleProp; - - /** - * Inner container style - */ - wrapperStyle?: StyleProp; - - /** - * Card title - */ - title?: string; - - /** - * Additional title styling (if title provided) - */ - titleStyle?: StyleProp; - - /** - * Title rendered over the image - * (only works if image prop is present) - */ - featuredTitle?: string; - - /** - * Styling for featured title - */ - featuredTitleStyle?: StyleProp; - - /** - * Subtitle rendered over the image - * (only works if image prop is present) - */ - featuredSubtitle?: string; - - /** - * Styling for featured subtitle - */ - featuredSubtitleStyle?: StyleProp; - - /** - * Additional divider styling - * (if title provided) - */ - dividerStyle?: StyleProp; - - /** - * Specify different font family - * - * @default System font bold (iOS), Sans Serif Bold (android) - */ - fontFamily?: string; - - /** - * Specify image styling if image is provided - */ - imageStyle?: ImageStyle; - - /** - * Specify styling for view surrounding image - */ - imageWrapperStyle?: StyleProp; - - /** - * Add an image as the heading with the image prop - */ - image?: ImageURISource; -} - -/** - * Card component - * - * @see https://react-native-training.github.io/react-native-elements/API/card/ - */ -export class Card extends React.Component {} - -/** - * Set the buttons within a Group. - */ -export interface ElementObject { - element: JSX.Element | React.ReactType; -} - -/** - * Set the border styles for a component. - */ -export interface InnerBorderStyleProperty { - color?: string; - width?: number; -} - -export interface ButtonGroupProps { - /** - * Current selected index of array of buttons - */ - selectedIndex: number; - - /** - * Method to update Button Group Index - */ - onPress(selectedIndex: number): void; - - /** - * Array of buttons for component, if returning a component, must be an object with { element: componentName } - */ - buttons: string[] | ElementObject[]; - - /** - * Choose other button component such as TouchableOpacity - * - * @default TouchableHighlight - */ - component?: React.ComponentClass; - - /** - * Specify styling for main button container - */ - containerStyle?: StyleProp; - - /** - * inherited styling specify styling for button - */ - buttonStyle?: StyleProp; - - /** - * Specify color for selected state of button - * - * @default 'white' - */ - selectedBackgroundColor?: string; - - /** - * Specify specific styling for text - */ - textStyle?: StyleProp; - - /** - * Specify specific styling for text in the selected state - */ - selectedTextStyle?: StyleProp; - - /** - * inherited styling object { width, color } update the styling of the interior border of the list of buttons - */ - innerBorderStyle?: InnerBorderStyleProperty; - - /** - * Specify underlayColor for TouchableHighlight - * - * @default 'white' - */ - underlayColor?: string; - - /** - * Disables the currently selected button if true - * - * @default false - */ - disableSelected?: boolean; - - /** - * Determines what the opacity of the wrapped view should be when touch is active. - */ - activeOpacity?: number; - - /** - * Border radius for the container - */ - containerBorderRadius?: number; - - /** - * Styling for the final border edge - */ - lastBorderStyle?: StyleProp; - - /** - * - * Called immediately after the underlay is hidden - */ - onHideUnderlay?(): void; - - /** - * Called immediately after the underlay is shown - */ - onShowUnderlay?(): void; - - /** - * Animate the touchable to a new opacity. - */ - setOpacityTo?(value: number): void; -} - -export class ButtonGroup extends React.Component {} - -export interface CheckBoxProps { - /** - * Icon family, can be one of the following - * (required only if specifying an icon that is not from font-awesome) - */ - iconType?: IconType; - - /** - * Specify React Native component for main button - */ - component?: React.ComponentClass; - - /** - * Flag for checking the icon - * - * @default false - */ - checked: boolean; - - /** - * Moves icon to right of text. - * - * @default false - */ - iconRight?: boolean; - - /** - * Aligns checkbox to right - * - * @default false - */ - right?: boolean; - - /** - * Aligns checkbox to center - * - * @default false - */ - center?: boolean; - - /** - * Title of checkbox - */ - title?: string | JSX.Element; - - /** - * Style of main container - */ - containerStyle?: StyleProp; - - /** - * style of text - */ - textStyle?: StyleProp; - - /** - * onLongPress function for checkbox - */ - onLongPress?(): void; - - /** - * onLongPress function for checkbox - */ - onLongIconPress?(): void; - - /** - * onPress function for container - */ - onPress?(): void; - - /** - * onPress function for checkbox - */ - onIconPress?(): void; - - /** - * Default checked icon (Font Awesome Icon) - * - * @default 'check-square-o' - */ - checkedIcon?: string; - - /** - * Default checked icon (Font Awesome Icon) - * - * @default 'square-o' - */ - uncheckedIcon?: string; - - /** - * Default checked color - * - * @default 'green' - */ - checkedColor?: string; - - /** - * Default unchecked color - * @default '#bfbfbf' - */ - uncheckedColor?: string; - - /** - * Specify a custom checked message - */ - checkedTitle?: string; - - /** - * Specify different font family - * @default 'System font bold (iOS)' - * @default 'Sans Serif Bold (android)' - */ - fontFamily?: string; -} -export class CheckBox extends React.Component {} - -export interface DividerProps { - /** - * Style the divider - * - * @default {height: 1, backgroundColor: #e1e8ee} - */ - style?: StyleProp; -} - -export class Divider extends React.Component {} - -export interface FormValidationMessageProps extends ViewProperties { - /** - * Style of the container - */ - containerStyle?: StyleProp; - - /** - * Style of the text within the label message - */ - labelStyle?: StyleProp; - - /** - * Font family for the message - */ - fontFamily?: string; -} -export class FormValidationMessage extends React.Component< - FormValidationMessageProps, - any -> {} - -export interface FormInputProps extends TextInputProperties { - /** - * TextInput container styling - */ - containerStyle?: StyleProp; - - /** - * TextInput styling - */ - inputStyle?: StyleProp; - - /** - * @deprecated - * Get ref of TextInput - */ - textInputRef?(ref: TextInput): void; - - /** - * @deprecated - * Get ref of TextInput container - */ - containerRef?(ref: any): void; - - /** - * Shake the TextInput if not a falsy value and different from the previous value - */ - shake?: any; -} - -export class FormInput extends React.Component { - /** - * Holds reference to the stored input. - */ - input: TextInput; - - /** - * Shake the TextInput - * - * eg `this.formInputRef.shake()` - */ - shake(): void; - - /** - * Call focus on the TextInput - */ - focus(): void; - - /** - * Call blur on the TextInput - */ - blur(): void; - - /** - * Call clear on the TextInput - */ - clearText(): void; -} - -export interface FormLabelProps extends ViewProperties { - /** - * Additional label container style - */ - containerStyle?: StyleProp; - - /** - * Additional label styling - */ - labelStyle?: StyleProp; - - /** - * Specify different font family - * - * @default System font bold (iOS), Sans Serif Bold (android) - */ - fontFamily?: string; -} - -export class FormLabel extends React.Component {} - -export interface GridProps extends ViewProperties { - /** - * Outer grid styling - */ - containerStyle?: StyleProp; - - /** - * Opacity on pressing - * - */ - activeOpacity?: number; - - /** - * onPress method - */ - onPress?(): void; - - children: React.ReactNode; -} - -/** - * @deprecated - * Warning: Grid has been deprecated and will be removed in a future version of React Native Elements - * - * @see https://react-native-training.github.io/react-native-elements/API/grid - */ -export class Grid extends React.Component {} - -export interface SubGridProps extends ViewProperties { - /** - * Size for column or row - */ - size?: number; - - /** - * Opacity on pressing - * - * @default 1 - */ - activeOpacity?: number; - - /** - * Styling for the outer column or row - */ - containerStyle?: StyleProp; - - /** - * onPress method - */ - onPress?(): void; -} - -/** - * @deprecated - * Warning: Row has been deprecated and will be removed in a future version of React Native Elements - * @see https://react-native-training.github.io/react-native-elements/API/grid/#row - */ -export class Row extends React.Component {} - -/** - * @deprecated - * Warning: Col has been deprecated and will be removed in a future version of React Native Elements - * - * @see https://react-native-training.github.io/react-native-elements/API/grid/#column - * - */ -export class Col extends React.Component {} - -export interface HeaderIcon extends IconObject { - icon?: string; -} - -/** - * Defines the types that can be used in a header sub component - */ -export type HeaderSubComponent = JSX.Element | TextProps | HeaderIcon; - -export interface HeaderProps extends ViewProperties { - /** - * Accepts all props for StatusBar - */ - statusBarProps?: StatusBarProperties; - - /** - * Configuration object for default component (icon: string, ...props for React Native Elements Icon) or a valid React Element define your left component here - */ - leftComponent?: HeaderSubComponent; - - /** - * Configuration object for default component (text: string, ...props for React Native Text component) valid React Element define your center component here - */ - centerComponent?: HeaderSubComponent; - - /** - * Configuration object for default component (icon: string, ...props for React Native Elements Icon component) or a valid React Element define your right component here - */ - rightComponent?: HeaderSubComponent; - - /** - * Sets backgroundColor of the parent component - */ - backgroundColor?: string; - - /** - * Styling for outer container - */ - outerContainerStyles?: StyleProp; - - /** - * Styling for inner container - */ - innerContainerStyles?: StyleProp; -} - -/** - * Header component - * @see https://react-native-training.github.io/react-native-elements/API/header/ - */ -export class Header extends React.Component {} - -export interface IconProps { - /** - * Name of icon - */ - name: string; - - /** - * Type (defaults to material, options are material-community, zocial, font-awesome, octicon, ionicon, foundation, evilicon, simple-line-icon, or entypo) - * @default 'material' - */ - type?: IconType; - - /** - * Size of icon - * @default 26 - */ - size?: number; - - /** - * Color of icon - * - * @default 'black' - */ - color?: string; - - /** - * Additional styling to icon - */ - iconStyle?: StyleProp; - - /** - * View if no onPress method is defined, TouchableHighlight if onPress method is defined React Native component update React Native Component - */ - component?: React.ComponentClass; - - /** - * onPress method for button - */ - onPress?(): void; - - /** - * onLongPress method for button - */ - onLongPress?(): void; - - /** - * UnderlayColor for press event - */ - underlayColor?: string; - - /** - * Reverses color scheme - * - * @default false - */ - reverse?: boolean; - - /** - * Adds box shadow to button - * - * @default false - */ - raised?: boolean; - - /** - * Add styling to container holding icon - */ - containerStyle?: StyleProp; - - /** - * Specify reverse icon color - * - * @default 'white' - */ - reverseColor?: string; -} - -/** - * Icon component - * @see https://react-native-training.github.io/react-native-elements/API/icons/ - */ -export class Icon extends React.Component {} - -export interface ListProps extends ViewProperties { - /** - * Style the list container - * @default '{marginTop: 20, borderTopWidth: 1, borderBottomWidth: 1, borderBottomColor: #cbd2d9}' - */ - containerStyle?: StyleProp; -} - -/** - * List component - * @see https://react-native-training.github.io/react-native-elements/API/lists/ - */ -export class List extends React.Component {} - -export interface ListItemProps { - /** - * Left avatar. This is the React Native Image source prop. Avatar can be used in parallel to leftIcon if needed. - */ - avatar?: string | ImageURISource; - - /** - * Avatar styling. This is the React Native Image style prop - */ - avatarStyle?: ImageStyle; - - /** - * Avatar outer container styling - */ - avatarContainerStyle?: StyleProp; - - /** - * Avatar overlay container styling - */ - avatarOverlayContainerStyle?: StyleProp; - - /** - * Set chevron color - * - * @default '#bdc6cf' - */ - chevronColor?: string; - - /** - * View or TouchableHighlight if onPress method is added as prop - * Replace element with custom element - */ - component?: React.ComponentClass; - - /** - * Additional main container styling - */ - containerStyle?: StyleProp; - - /** - * Additional wrapper styling - */ - wrapperStyle?: StyleProp; - - /** - * Define underlay color for TouchableHighlight - * - * @default 'white' - */ - underlayColor?: string; - - /** - * Specify different font family - * - * @default 'HelevticaNeue' (iOS) - * @default 'Sans Serif' (android) - */ - fontFamily?: string; - - /** - * Set if you do not want a chevron - * - * @default false - */ - hideChevron?: boolean; - - /** - * onPress method for link - */ - onPress?(): void; - - /** - * onLongPress method for link - */ - onLongPress?(): void; - - /** - * Make left avatar round - * - * @default false - */ - roundAvatar?: boolean; - - /** - * Main title for list item, can be text or custom view - */ - title?: string; - - /** - * Number of lines for title - * - * @default 1 - */ - titleNumberOfLines?: number; - - /** - * Additional title styling - */ - titleStyle?: StyleProp; - - /** - * Provide styling for title container - */ - titleContainerStyle?: StyleProp; - - /** - * Subtitle text or custom view - */ - subtitle?: string | JSX.Element; - - /** - * Number of lines for Subtitle - * - * @default 1 - */ - subtitleNumberOfLines?: number; - - /** - * Provide styling for subtitle container - */ - subtitleContainerStyle?: StyleProp; - - /** - * Additional subtitle styling - */ - subtitleStyle?: StyleProp; - - /** - * Provide a rightTitle to have a title show up on the right side of the button - */ - rightTitle?: string; - - /** - * Number of lines for Right Title - * - * @default 1 - */ - rightTitleNumberOfLines?: number; - - /** - * Style the outer container of the rightTitle text - * - * @default "{flex: 1, alignItems: 'flex-end', justifyContent: 'center'}"" - */ - rightTitleContainerStyle?: StyleProp; - - /** - * Style the text of the rightTitle text - * - * @default "{marginRight: 5, color: '#bdc6cf'}" - */ - rightTitleStyle?: StyleProp; - - /** - * Add a label with your own styling by providing a label={} prop to ListItem - */ - label?: JSX.Element; - - /** - * Icon configuration for left icon, either a name from the icon library (like material) or a React Native element like Image. - * leftIcon can be used in parallel to avatar if needed. - * {name, color, style, type} - * (type defaults to material icons) OR React Native element - */ - leftIcon?: IconObject | JSX.Element; - - /** - * Attaches an onPress on left Icon - */ - leftIconOnPress?(): void; - - /** - * Attaches an onLongPress on left Icon - */ - leftIconOnLongPress?(): void; - - /** - * Underlay color for left Icon - * - * @default 'white' - */ - leftIconUnderlayColor?: string; - - /** - * {name: 'chevron-right'} object {name, color, style, type} (type defaults to material icons) OR - * React Native element icon configuration for right icon, either a name from the icon library (like material) or a React Native element like Image. - * Shows up unless hideChevron is set - */ - rightIcon?: IconObject | JSX.Element; - - /** - * Attaches an onPress on right Icon - */ - onPressRightIcon?(): void; - - /** - * Add a switch to the right side of your component - * - * @default false - */ - switchButton?: boolean; - - /** - * Add a callback function when the switch is toggled - */ - onSwitch?(value: boolean): void; - - /** - * If true the user won't be able to toggle the switch. Default value is false. - * @default false - */ - switchDisabled?: boolean; - - /** - * Background color when the switch is turned on. - */ - switchOnTintColor?: string; - - /** - * Color of the foreground switch grip. - */ - switchThumbTintColor?: string; - - /** - * Border color on iOS and background color on Android when the switch is turned off. - */ - switchTintColor?: string; - - /** - * The value of the switch. If true the switch will be turned on. Default value is false. - * - * @default false - */ - switched?: boolean; - - /** - * Whether to have the right title area be an input text component. - * - * @default false - */ - textInput?: boolean; - - /** - * Can tell TextInput to automatically capitalize certain characters. - */ - textInputAutoCapitalize?: boolean; - - /** - * Can tell TextInput to automatically capitalize certain characters. - */ - textInputAutoCorrect?: boolean; - - /** - * If true, focuses the input on componentDidMount. The default value is false. - */ - textInputAutoFocus?: boolean; - - /** - * If false, text is not editable. The default value is true. - */ - textInputEditable?: boolean; - - /** - * Can be one of the following: - * 'default', 'email-address', 'numeric', 'phone-pad', 'ascii-capable', 'numbers-and-punctuation', 'url', 'number-pad', 'name-phone-pad', 'decimal-pad', 'twitter', 'web-search' - */ - textInputKeyboardType?: KeyboardType | KeyboardTypeIOS; - - /** - * Limits the maximum number of characters that can be entered. - */ - textInputMaxLength?: number; - - /** - * If true, the text input can be multiple lines. The default value is false. - */ - textInputMultiline?: boolean; - - /** - * Callback that is called when the text input's text changes. Changed text is passed as an argument to the callback handler. - */ - textInputOnChangeText?(text: string): void; - - /** - * Callback that is called when the text input is focused. - */ - textInputOnFocus?(): void; - - /** - * Manually set value of the input - */ - textInputValue?: string; - - /** - * If true, obscures the text entered so that sensitive text like passwords stay secure. - */ - textInputSecure?: boolean; - - /** - * Style for the input text - */ - textInputStyle?: StyleProp; - - /** - * Style for the container surrounding the input text - */ - textInputContainerStyle?: StyleProp; - - /** - * Placeholder for the text input - */ - textInputPlaceholder?: string; - - /** - * Callback that is called when the text input is blurred. - */ - textInputOnBlur?(): void; - - /** - * If true, all text will automatically be selected on focus. - */ - textInputSelectTextOnFocus?: boolean; - - /** - * Determines how the return key should look. For more info see the React Native docs - */ - textInputReturnKeyType?: string; - - /** - * Add a badge to the ListItem by using this prop - * - */ - badge?: BadgeProps | ElementObject; -} - -/** - * ListItem component - * @see https://react-native-training.github.io/react-native-elements/API/lists/ - */ -export class ListItem extends React.Component {} - -export interface ButtonInformation { - title: string; - icon: string; - buttonStyle?: StyleProp; -} - -export interface PricingCardProps { - /** - * Title - */ - title?: string; - - /** - * Price - */ - price: string; - - /** - * Color scheme for button & title - */ - color: string; - - /** - * Pricing information - */ - info?: string[]; - - /** - * {title, icon, buttonStyle} - * Button information - */ - button: ButtonInformation; - - /** - * Function to be run when button is pressed - */ - onButtonPress?(): void; - - /** - * Outer component styling - */ - containerStyle?: StyleProp; - - /** - * Inner wrapper component styling - */ - wrapperStyle?: StyleProp; - - /** - * Specify title font family - * - * System font (font weight 800) (iOS) - * Sans Serif Black (android) - */ - titleFont?: string; - - /** - * Specify pricing font family - * - * System font (font weight 700) (iOS) - * Sans Serif Bold (android) - */ - pricingFont?: string; - - /** - * Specify pricing information font family - * - * System font bold (iOS) - * Sans Serif Bold (android) - */ - infoFont?: string; - - /** - * Specify button font family - * - * System font (iOS) - * Sans Serif (android) - */ - buttonFont?: string; -} - -/** - * PricingCard component - * @see https://react-native-training.github.io/react-native-elements/API/pricing/ - */ -export class PricingCard extends React.Component {} - -export interface RatingProps { - /** - * Callback method when the user finishes rating. Gives you the final rating value as a whole number - */ - onFinishRating(rating: number): void; - - /** - * Choose one of the built-in types: star, rocket, bell, heart or use type custom to render a custom image - */ - type?: 'star' | 'rocket' | 'bell' | 'heart' | 'custom'; - - /** - * Pass in a custom image source; use this along with type='custom' prop above - */ - ratingImage?: ImageURISource | string | number; - - /** - * Pass in a custom fill-color for the rating icon; use this along with type='custom' prop above - * - * @default '#f1c40f' - */ - ratingColor?: string; - - /** - * Pass in a custom background-fill-color for the rating icon; use this along with type='custom' prop above - * - * @default 'white' - */ - ratingBackgroundColor?: string; - - /** - * Number of rating images to display - * - * @default 5 - */ - ratingCount?: number; - - /** - * The size of each rating image - * - * @default 50 - */ - imageSize?: number; - - /** - * Displays the Built-in Rating UI to show the rating value in real-time - */ - showRating?: boolean; - - /** - * Whether the rating can be modiefied by the user - * - * @default false - */ - readonly?: boolean; - - /** - * The initial rating to render - * - * @default ratingCount/2 - */ - startingValue?: number; - - /** - * The number of decimal places for the rating value; must be between 0 and 20 - * - * @default undefined - */ - fractions?: number; - - /** - * Exposes style prop to add additonal styling to the container view - */ - style?: StyleProp; -} - -/** - * Rating component - * @see https://react-native-training.github.io/react-native-elements/API/rating/ - */ -export class Rating extends React.Component {} - -export interface SearchBarProps extends TextInputProperties { - /** - * TextInput container styling - */ - containerStyle?: StyleProp; - - /** - * TextInput styling - */ - inputStyle?: StyleProp; - - /** - * @deprecated - * Get ref of TextInput - */ - textInputRef?(ref: TextInput): void; - - /** - * @deprecated - * Get ref of TextInput container - */ - containerRef?(ref: any): void; - - /** - * Specify color, styling, or another Material Icon Name - */ - icon?: IconObject; - - /** - * Remove icon from textinput - * - * @default false - */ - noIcon?: boolean; - - /** - * @default false change theme to light theme - */ - lightTheme?: boolean; - - /** - * Change TextInput styling to rounded corners - * - * @default false - */ - round?: boolean; - - /** - * Specify other than the default transparent underline color - * - * @default 'transparent' - */ - underlineColorAndroid?: string; - - /** - * Specify color, styling of the loading ActivityIndicator effect - * - * @default "{ color: '#86939e' }" - */ - loadingIcon?: IconObject; - - /** - * Show the loading ActivityIndicator effect - * - * @default false - */ - showLoadingIcon?: boolean; - - /** - * Set the placeholder text - * - * @default '' - */ - placeholder?: string; - - /** - * Set the color of the placeholder text - * - * @default '#86939e' - */ - placeholderTextColor?: string; - - /** - * Method to fire when text is changed - */ - onChangeText?(text: string): void; - - /** - * Specify color, styling, or another Material Icon Name - * (Note: pressing on this icon clears text inside the searchbar) - * - * @default "{ color: '#86939e', name: 'search' }" - */ - clearIcon?: IconObject; -} - -/** - * SearchBar component - * @see https://react-native-training.github.io/react-native-elements/API/searchbar/ - */ -export class SearchBar extends React.Component { - /** - * Holds reference to the stored input. - */ - input: TextInput; - - /** - * Call focus on the TextInput - */ - focus(): void; - - /** - * Call blur on the TextInput - */ - blur(): void; - - /** - * Call clear on the TextInput - */ - clearText(): void; -} - -export interface SideMenuProps { - /** - * Menu component - */ - menu: JSX.Element; - - /** - * Props driven control over menu open state - * - * @default false - */ - isOpen?: boolean; - - /** - * Content view left margin if menu is opened - * - * @default ⅔ of device screen width - */ - openMenuOffset?: number; - - /** - * Content view left margin if menu is hidden - */ - hiddenMenuOffset?: number; - - /** - * Edge distance on content view to open side menu - * - * @default 60 - */ - edgeHitWidth?: number; - - /** - * X axis tolerance - */ - toleranceX?: number; - - /** - * Y axis tolerance - */ - toleranceY?: number; - - /** - * Disable whether the menu can be opened with gestures or not - * - * @default false - */ - disableGestures?: boolean; - - /** - * Function that accepts event as an argument and specify if side-menu should react on the touch or not. - * Check https://facebook.github.io/react-native/docs/gesture-responder-system.html for more details - */ - onStartShouldSetResponderCapture?(event: GestureResponderEvent): boolean; - - /** - * Callback on menu open/close. Is passed isOpen as an argument. - */ - onChange?(isOpen: boolean): void; - - /** - * Callback on menu move. Is passed left as an argument - */ - onMove?(left: number): void; - - /** - * Either 'left' or 'right'. - * - * @default 'left' - */ - menuPosition?: string; - - /** - * Function that accept 2 arguments (prop, value) and return an object: - * - animation you should use at the place you specify parameter to animate - * - newOffset you should use to specify the final value of prop - */ - animationFunction?( - animation: Animated.Value, - newOffset: number - ): Animated.CompositeAnimation; - - /** - * Function that accept 1 argument (value) and return an object - * - leftOffset you should use at the place you need current value of animated parameter (left offset of content view) - */ - animationStyle?(leftOffset: number): StyleProp; - - /** - * When true, content view will bounce back to openMenuOffset when dragged further - * - * @default true - */ - bounceBackOnOverdraw?: boolean; -} - -/** - * @deprecated - * Warning: SideMenu has been deprecated and will be removed in a future version of React Native Elements. For a complete navigation solution that includes SideMenu(Drawer) as well as many other - * features, be sure to check out react-navigation (https://reactnavigation.org) and it's DrawerNavigator. - * - * SideMenu component - * @see https://react-native-training.github.io/react-native-elements/API/side_menu/ - */ -export class SideMenu extends React.Component {} - -export interface SliderProps { - /** - * Initial value of the slider - * - * @default 0 - */ - value?: number; - - /** - * If true the user won't be able to move the slider - * - * @default false - */ - disabled?: boolean; - - /** - * Initial minimum value of the slider - * - * @default 0 - */ - minimumValue?: number; - - /** - * Initial maximum value of the slider - * - * @default 1 - */ - maximumValue?: number; - - /** - * Step value of the slider. The value should be between 0 and maximumValue - minimumValue) - * - * @default 0 - */ - step?: number; - - /** - * The color used for the track to the left of the button - * - * @default '#3f3f3f' - */ - minimumTrackTintColor?: string; - - /** - * The color used for the track to the right of the button - * - * @default '#b3b3b3' - */ - maximumTrackTintColor?: string; - - /** - * The color used for the thumb - * - * @default '#343434' - */ - thumbTintColor?: string; - - /** - * The size of the touch area that allows moving the thumb. The touch area has the same center as the visible thumb. - * This allows to have a visually small thumb while still allowing the user to move it easily. - * - * @default "{width: 40, height: 40}" - */ - thumbTouchSize?: { - width?: number; - height?: number; - }; - - /** - * Callback continuously called while the user is dragging the slider - */ - onValueChange?(value: number): void; - - /** - * Callback called when the user starts changing the value (e.g. when the slider is pressed) - */ - onSlidingStart?(value: number): void; - - /** - * Callback called when the user finishes changing the value (e.g. when the slider is released) - */ - onSlidingComplete?(value: number): void; - - /** - * The style applied to the slider container - */ - style?: StyleProp; - - /** - * The style applied to the track - */ - trackStyle?: StyleProp; - - /** - * The style applied to the thumb - */ - thumbStyle?: StyleProp; - - /** - * Set this to true to visually see the thumb touch rect in green. - * - * @default false - */ - debugTouchArea?: boolean; - - /** - * Set to true if you want to use the default 'spring' animation - * - * @default false - */ - animateTransitions?: boolean; - - /** - * Set to 'spring' or 'timing' to use one of those two types of animations with the default animation properties. - * - * @default 'timing' - */ - animationType?: 'spring' | 'timing'; - - /** - * Used to configure the animation parameters. These are the same parameters in the Animated library. - * - * @default undefined - */ - animationConfig?: - | Animated.TimingAnimationConfig - | Animated.SpringAnimationConfig; -} - -/** - * Slider component - * @see https://react-native-training.github.io/react-native-elements/API/slider/ - */ -export class Slider extends React.Component {} - -export type SocialMediaType = - | 'facebook' - | 'twitter' - | 'google-plus-official' - | 'pinterest' - | 'linkedin' - | 'youtube' - | 'vimeo' - | 'tumblr' - | 'instagram' - | 'quora' - | 'foursquare' - | 'wordpress' - | 'stumbleupon' - | 'github' - | 'github-alt' - | 'twitch' - | 'medium' - | 'soundcloud' - | 'gitlab' - | 'angellist' - | 'codepen'; - -export interface SocialIconProps { - /** - * Title if made into a button - */ - title?: string; - - /** - * Social media type - */ - type: SocialMediaType; - - /** - * Adds a drop shadow, set to false to remove - * - * @default true - */ - raised?: boolean; - - /** - * Creates button - * - * @default false - */ - button?: boolean; - - /** - * onPress method - */ - onPress?(): void; - - /** - * @default none function onLongPress method - */ - onLongPress?(): void; - - /** - * Reverses icon color scheme, setting background to white and icon to primary color - * - * @default false - */ - light?: boolean; - - /** - * Extra styling for icon component - */ - iconStyle?: StyleProp; - - /** - * Button styling - */ - style?: StyleProp; - - /** - * Icon color - */ - iconColor?: string; - - /** - * Icon size - * - * @default 24 - */ - iconSize?: number; - - /** - * Component Type of button - * - * @default TouchableHighlight - */ - component?: React.ComponentClass; - - /** - * Specify different font family - * - * @default System font bold (iOS), Sans Serif Black (android) - */ - fontFamily?: string; - - /** - * Specify font weight of title if set as a button with a title - * - * @default bold (ios), black(android) - */ - fontWeight?: string; - - /** - * Specify text styling - */ - fontStyle?: StyleProp; - - /** - * Disable button - * - * @default false - */ - disabled?: boolean; - - /** - * Shows loading indicator - * - * @default false - */ - loading?: boolean; -} - -/** - * SocialIcon component - * @see https://react-native-training.github.io/react-native-elements/API/social_icons/ - */ -export class SocialIcon extends React.Component {} - -export interface SwipeDeckProps { - /** - * An array of data object which contains each card details. - */ - data: ReadonlyArray; - - /** - * A function that takes a card as a prop and renders it with custom UI - */ - renderCard(card: D): JSX.Element; - - /** - * A function that renders custom UI when no more cards are present - */ - renderNoMoreCards?(): JSX.Element; - - /** - * function function A callback function that takes a card as a prop and take the approriate action when the user swipes the card right - */ - onSwipeRight?(card: D): void; - - /** - * function function A callback function that takes a card as a prop and take the approriate action when the user swipes the card left - */ - onSwipeLeft?(card: D): void; -} - -/** - * SwipeDeck component - * @see https://react-native-training.github.io/react-native-elements/API/swipedeck/ - */ -export class SwipeDeck extends React.Component< - SwipeDeckProps, - any -> {} - -/** - * @deprecated - * Warning: Tabs has been deprecated and will be removed in a future version of React Native Elements. - * For a complete navigation solution that includes Tabs as well as many other features, be sure to check out react-navigation (https://reactnavigation.org) and it's TabRouter. - */ -export class Tabs extends TabNavigator {} - -/** - * @deprecated - * Warning: Tab has been deprecated and will be removed in a future version of React Native Elements. - * For a complete navigation solution that includes Tabs as well as many other features, be sure to check out react-navigation (https://reactnavigation.org) and it's TabRouter. - */ -export class Tab extends TabNavigator.Item {} - -export interface TileProps { - /** - * Icon Component Props - */ - icon?: IconObject; - - /** - * Styling for the outer icon container - */ - iconContainerStyle?: StyleProp; - - /** - * Text inside the tile - */ - title?: string; - - /** - * Styling for the title - */ - titleStyle?: StyleProp; - - /** - * Text inside the tile when tile is featured - */ - caption?: string; - - /** - * Styling for the caption - */ - captionStyle?: StyleProp; - - /** - * Changes the look of the tile - */ - featured?: boolean; - - /** - * @default none object (style) Styling for the outer tile container - */ - containerStyle?: StyleProp; - - /** - * Source for the image - */ - imageSrc: ImageURISource | string | number; - - /** - * Styling for the image - */ - imageContainerStyle?: StyleProp; - - /** - * @default none function (event) Function to call when tile is pressed - */ - onPress?(): void; - - /** - * Number passed to control opacity on press - * - * @default 0.2 - */ - activeOpacity?: number; - - /** - * Styling for bottom container when not featured tile - */ - contentContainerStyle?: StyleProp; - - /** - * Width for the tile - * - * @default Device Width - */ - width?: number; - - /** - * Height for the tile - * - * @default Device Width * 0.8 - */ - height?: number; -} - -/** - * Tile component - * @see https://react-native-training.github.io/react-native-elements/API/tile/ - */ -export class Tile extends React.Component {} - -/** - * Colors - */ - -export interface Colors { - readonly primary: string; - readonly primary1: string; - readonly primary2: string; - readonly secondary: string; - readonly secondary2: string; - readonly secondary3: string; - readonly grey0: string; - readonly grey1: string; - readonly grey2: string; - readonly grey3: string; - readonly grey4: string; - readonly grey5: string; - readonly dkGreyBg: string; - readonly greyOutline: string; - readonly searchBg: string; - readonly disabled: string; - readonly white: string; - readonly error: string; - readonly [key: string]: string; -} - -export const colors: Colors; - -/* Utility Functions */ - -/** - * TODO make the Icon Type an export of the react-native-vector-icons type definitions. - */ -export function getIconType(type: IconType): any; - -/** - * Method to normalize size of fonts across devices - */ -export function normalize(size: number): number; diff --git a/types/react-native-elements/react-native-elements-tests.tsx b/types/react-native-elements/react-native-elements-tests.tsx deleted file mode 100644 index 29155829b2..0000000000 --- a/types/react-native-elements/react-native-elements-tests.tsx +++ /dev/null @@ -1,975 +0,0 @@ -import * as React from 'react'; -import { - ListView, - View, - StyleSheet, - TouchableNativeFeedback, - Image, - TextInput, - Animated, - Dimensions -} from 'react-native'; -import { - Button, - Text, - Badge, - Avatar, - Card, - ButtonGroup, - CheckBox, - Divider, - FormInput, - FormValidationMessage, - FormLabel, - Header, - Icon, - List, - ListItem, - PricingCard, - Rating, - SearchBar, - SideMenu, - Slider, - SocialIcon, - SwipeDeck, - Tabs, - Tab, - Tile, - colors, - getIconType, - normalize -} from 'react-native-elements'; - -const { width, height } = Dimensions.get('window'); - -class TextTest extends React.Component { - render() { - return ( - - Heading 1 - Heading 2 - Heading 3 - Heading 4 - - ); - } -} - -class AvatarTest extends React.Component { - render() { - return ( - - - Avatars - console.log('Works!')} - activeOpacity={0.7} - /> - console.log('Works!')} - activeOpacity={0.7} - /> - console.log('Works!')} - activeOpacity={0.7} - /> - console.log('Works!')} - activeOpacity={0.7} - /> - - - - Avatar with initials - console.log('Works!')} - activeOpacity={0.7} - /> - console.log('Works!')} - activeOpacity={0.7} - /> - console.log('Works!')} - activeOpacity={0.7} - /> - console.log('Works!')} - activeOpacity={0.7} - /> - - - - Avatar with icons - console.log('Works!')} - activeOpacity={0.7} - containerStyle={{ - flex: 2, - marginLeft: 20, - marginTop: 115 - }} - /> - console.log('Works!')} - activeOpacity={0.7} - containerStyle={{ flex: 3, marginTop: 100 }} - /> - console.log('Works!')} - activeOpacity={0.7} - containerStyle={{ flex: 4, marginTop: 75 }} - /> - console.log('Works!')} - activeOpacity={0.7} - containerStyle={{ flex: 5, marginRight: 60 }} - /> - - - ); - } -} - -const AvatarStyles = StyleSheet.create({ - title: { - fontSize: 30, - marginBottom: 10 - } -}); - -class BadgeTest extends React.Component { - render() { - return ( - - - - - User 1 - - - console.log('pressed')} value="5" /> - - - - ); - } -} - -class ButtonTest extends React.Component { - handleButtonPress() { - console.log('I got pressed'); - } - - render() { - return ( - -