From a57f667049a912095a0d11490ee6bcb5a5ed97af Mon Sep 17 00:00:00 2001 From: James Lawrence Date: Tue, 8 Jan 2019 23:18:16 +0000 Subject: [PATCH 001/266] Allow dynamic CSS values based on component props --- types/react-jss/lib/injectSheet.d.ts | 50 +++++++++++++++++----------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/types/react-jss/lib/injectSheet.d.ts b/types/react-jss/lib/injectSheet.d.ts index fd66af5c38..be3bee933b 100644 --- a/types/react-jss/lib/injectSheet.d.ts +++ b/types/react-jss/lib/injectSheet.d.ts @@ -53,26 +53,35 @@ export type PropsOf = C extends new (props: infer P) => React.Component */ export type PropInjector = < C extends React.ComponentType, InjectedProps>> ->( + >( component: C ) => React.ComponentType< Omit>, keyof InjectedProps> & - AdditionalProps ->; + AdditionalProps + >; -export interface CSSProperties extends CSS.Properties { +type cssNumberOrString = CSS.Properties + +// Allow functions that take the properties of the component and return a CSS value +export type CssRule = { + [K in keyof cssNumberOrString]: + | (cssNumberOrString[K]) + | ((props: Props) => cssNumberOrString[K]) +}[keyof CSS.Properties] + +export interface CSSProperties { // Allow pseudo selectors and media queries [k: string]: - | CSS.Properties[keyof CSS.Properties] - | CSSProperties; + | CssRule + | CSSProperties; } -export type Styles = Record< +export type Styles = Record< ClassKey, - CSSProperties ->; -export type StyleCreator = ( + CSSProperties + >; +export type StyleCreator = ( theme: T -) => Styles; +) => Styles; export interface Theming { channel: string; @@ -89,15 +98,16 @@ export interface InjectOptions extends CreateStyleSheetOptions { export type ClassNameMap = Record; export type WithSheet< S extends string | Styles | StyleCreator, - GivenTheme = undefined -> = { + GivenTheme = undefined, + Props = {} + > = { classes: ClassNameMap< S extends string ? S - : S extends StyleCreator - ? C - : S extends Styles ? C : never - >; + : S extends StyleCreator + ? C + : S extends Styles ? C : never + >; } & WithTheme ? T : GivenTheme>; export interface WithTheme { @@ -110,7 +120,7 @@ export interface StyledComponentProps { innerRef?: React.Ref | React.RefObject; } -export default function injectSheet( - stylesOrCreator: Styles | StyleCreator, +export default function injectSheet( + stylesOrCreator: Styles | StyleCreator, options?: InjectOptions -): PropInjector, StyledComponentProps>; +): PropInjector, StyledComponentProps>; From 6f2624fb38349499664984ca14893f72f9c4e461 Mon Sep 17 00:00:00 2001 From: James Lawrence Date: Tue, 8 Jan 2019 23:31:16 +0000 Subject: [PATCH 002/266] Add attribution, fix linter errors --- types/react-jss/index.d.ts | 1 + types/react-jss/lib/injectSheet.d.ts | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/types/react-jss/index.d.ts b/types/react-jss/index.d.ts index 7656897a08..c2ee0a008a 100644 --- a/types/react-jss/index.d.ts +++ b/types/react-jss/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-jss 8.6 // Project: https://github.com/cssinjs/react-jss#readme // Definitions by: Sebastian Silbermann +// James Lawrence // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { createGenerateClassName, JSS, SheetsRegistry } from "jss"; diff --git a/types/react-jss/lib/injectSheet.d.ts b/types/react-jss/lib/injectSheet.d.ts index be3bee933b..5aa3b0925b 100644 --- a/types/react-jss/lib/injectSheet.d.ts +++ b/types/react-jss/lib/injectSheet.d.ts @@ -60,14 +60,12 @@ export type PropInjector = < AdditionalProps >; -type cssNumberOrString = CSS.Properties - // Allow functions that take the properties of the component and return a CSS value export type CssRule = { - [K in keyof cssNumberOrString]: - | (cssNumberOrString[K]) - | ((props: Props) => cssNumberOrString[K]) -}[keyof CSS.Properties] + [K in keyof CSS.Properties]: + | (CSS.Properties[K]) + | ((props: Props) => CSS.Properties[K]) +}[keyof CSS.Properties]; export interface CSSProperties { // Allow pseudo selectors and media queries From 6eb77511162839e409a5dbaeff533006b655a312 Mon Sep 17 00:00:00 2001 From: James Lawrence Date: Thu, 10 Jan 2019 01:05:38 +0000 Subject: [PATCH 003/266] Rename to DynamicCSSRule --- types/react-jss/lib/injectSheet.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react-jss/lib/injectSheet.d.ts b/types/react-jss/lib/injectSheet.d.ts index 5aa3b0925b..ef6bdb3dbb 100644 --- a/types/react-jss/lib/injectSheet.d.ts +++ b/types/react-jss/lib/injectSheet.d.ts @@ -61,16 +61,16 @@ export type PropInjector = < >; // Allow functions that take the properties of the component and return a CSS value -export type CssRule = { +export type DynamicCSSRule = { [K in keyof CSS.Properties]: - | (CSS.Properties[K]) + | CSS.Properties[K] | ((props: Props) => CSS.Properties[K]) }[keyof CSS.Properties]; export interface CSSProperties { // Allow pseudo selectors and media queries [k: string]: - | CssRule + | DynamicCSSRule | CSSProperties; } export type Styles = Record< From 3180fea53f4827c599e89369d613b33d4e167048 Mon Sep 17 00:00:00 2001 From: James Lawrence Date: Thu, 10 Jan 2019 01:06:44 +0000 Subject: [PATCH 004/266] Update tests - had to disable strict function checking, if anyone knows how to make it work with this, please do! --- types/react-jss/react-jss-tests.tsx | 59 ++++++++++++++++------------- types/react-jss/tsconfig.json | 2 +- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/types/react-jss/react-jss-tests.tsx b/types/react-jss/react-jss-tests.tsx index 803170bb99..6e86bed492 100644 --- a/types/react-jss/react-jss-tests.tsx +++ b/types/react-jss/react-jss-tests.tsx @@ -17,42 +17,44 @@ interface MyTheme { /** * helper function to counter typescripts type widening */ -function createStyles(styles: Styles): Styles { +function createStyles(styles: Styles): Styles { return styles; } -const styles = (theme: MyTheme) => - createStyles({ - myButton: { - color: theme.color.primary, - margin: 1, - "& span": { - fontWeight: "revert" - } - }, - myLabel: { - fontStyle: "italic" - } - }); -interface ButtonProps extends WithSheet { +interface ButtonProps { label: string; + active?: boolean; } -const Button: React.SFC = ({ classes, children }) => { +const styles = (theme: MyTheme) => createStyles({ + myButton: { + color: (props: ButtonProps) => props.active ? 'red': theme.color.primary, + margin: 1, + "& span": { + fontWeight: "revert" + } + }, + myLabel: { + fontStyle: "italic" + } +}); +const Button: React.SFC> = ({active, classes, children}) => { return ( - + <> + + ); }; const ManuallyStyles = () => { return ( + ); +} + +function Ellipsis(props: PaginationComponentProps) { + return ; +} + +function FirstPageLink(props: PaginationComponentProps) { + return ; +} + +function PreviousPageLink(props: PaginationComponentProps) { + return ; +} + +function NextPageLink(props: PaginationComponentProps) { + return ; +} + +function LastPageLink(props: PaginationComponentProps) { + return ; +} + +function Wrapper(props: { children: React.ReactChildren }) { + return
{props.children}
; +} + +const itemTypeToComponent: ItemTypeToComponent = { + PAGE: Page, + ELLIPSIS: Ellipsis, + FIRST_PAGE_LINK: FirstPageLink, + PREVIOUS_PAGE_LINK: PreviousPageLink, + NEXT_PAGE_LINK: NextPageLink, + LAST_PAGE_LINK: LastPageLink +}; + +const UltimatePagination = createUltimatePagination({ itemTypeToComponent, WrapperComponent: Wrapper }); // $ExpectType React.ComponentType + +; diff --git a/types/react-ultimate-pagination/tsconfig.json b/types/react-ultimate-pagination/tsconfig.json new file mode 100644 index 0000000000..b16cb5d3d0 --- /dev/null +++ b/types/react-ultimate-pagination/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-ultimate-pagination-tests.tsx" + ] +} diff --git a/types/react-ultimate-pagination/tslint.json b/types/react-ultimate-pagination/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-ultimate-pagination/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2b104c6fe8d6822d5adbf1bcdfc49e0e0e7421a6 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sat, 26 Jan 2019 21:05:33 +0100 Subject: [PATCH 083/266] improve(buble): prefer use "SourceMap" type from official package, instead of manually defining it --- types/buble/index.d.ts | 8 ++++---- types/buble/package.json | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 types/buble/package.json diff --git a/types/buble/index.d.ts b/types/buble/index.d.ts index c222d08e87..af2a7e26ee 100644 --- a/types/buble/index.d.ts +++ b/types/buble/index.d.ts @@ -2,6 +2,9 @@ // Project: https://github.com/Rich-Harris/buble#README // Definitions by: Kocal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { SourceMap } from "magic-string"; export interface TransformOptions { // source: https://github.com/Rich-Harris/buble/blob/master/src/support.js @@ -56,10 +59,7 @@ export interface TransformOptions { export interface TransformOutput { code: string; - map: { - toString(): string; - toUrl(): string; - }; + map: SourceMap; } export function transform(content: string, options?: TransformOptions): TransformOutput; diff --git a/types/buble/package.json b/types/buble/package.json new file mode 100644 index 0000000000..d2f8119c0a --- /dev/null +++ b/types/buble/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "magic-string": "^0.25.0" + } +} From 09e60dac8834e571d58f90bc5832c909dd356a3b Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sat, 26 Jan 2019 21:20:18 +0100 Subject: [PATCH 084/266] fix(buble): "toUrl()" is a method, not a property --- types/buble/buble-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/buble/buble-tests.ts b/types/buble/buble-tests.ts index e786ee6854..cebb373415 100644 --- a/types/buble/buble-tests.ts +++ b/types/buble/buble-tests.ts @@ -8,7 +8,7 @@ const input = 'const answer = () => 42;'; console.log(output.code); console.log(output.map.toString()); - console.log(output.map.toUrl); + console.log(output.map.toUrl()); })(); // Transform for Chrome & Firefox From 18de647d22cf0c498173e5b650883659653e3622 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sat, 26 Jan 2019 21:31:52 +0100 Subject: [PATCH 085/266] chore: setup type --- types/rollup-plugin-node-builtins/index.d.ts | 5 ++++ .../rollup-plugin-node-builtins-tests.ts | 0 .../rollup-plugin-node-builtins/tsconfig.json | 23 +++++++++++++++++++ types/rollup-plugin-node-builtins/tslint.json | 1 + 4 files changed, 29 insertions(+) create mode 100644 types/rollup-plugin-node-builtins/index.d.ts create mode 100644 types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts create mode 100644 types/rollup-plugin-node-builtins/tsconfig.json create mode 100644 types/rollup-plugin-node-builtins/tslint.json diff --git a/types/rollup-plugin-node-builtins/index.d.ts b/types/rollup-plugin-node-builtins/index.d.ts new file mode 100644 index 0000000000..70f8b3c873 --- /dev/null +++ b/types/rollup-plugin-node-builtins/index.d.ts @@ -0,0 +1,5 @@ +// Type definitions for rollup-plugin-node-builtins 2.1 +// Project: https://github.com/calvinmetcalf/rollup-plugin-node-builtins#readme +// Definitions by: Kocal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + diff --git a/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts b/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/rollup-plugin-node-builtins/tsconfig.json b/types/rollup-plugin-node-builtins/tsconfig.json new file mode 100644 index 0000000000..c0a6e1e787 --- /dev/null +++ b/types/rollup-plugin-node-builtins/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", + "rollup-plugin-node-builtins-tests.ts" + ] +} diff --git a/types/rollup-plugin-node-builtins/tslint.json b/types/rollup-plugin-node-builtins/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rollup-plugin-node-builtins/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6d9de2a5d985e2dd8c7fa94505ab3ee7875e1f51 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Sat, 26 Jan 2019 21:40:46 +0100 Subject: [PATCH 086/266] Add info about native balance --- types/coinbase/index.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index 6057f58142..6731ff3a79 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -536,6 +536,21 @@ export class Account implements Resource { */ balance: MoneyHash; + /** + * Allow deposits + */ + allow_deposits: boolean; + + /** + * Allow withdrawls + */ + allow_withdrawals: boolean; + + /** + * Account worth in native balance. + */ + native_balance: MoneyHash; + /** * Promote an account as primary account. * Scope: wallet:accounts:update From 4962cb4cfdda1122a9efcda11f1ad87927f38561 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Sat, 26 Jan 2019 21:44:46 +0100 Subject: [PATCH 087/266] v2.0.8 --- types/coinbase/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index 6731ff3a79..1ef91bbcbb 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for coinbase 2.0 +// Type definitions for coinbase 2.0.8 // Project: https://github.com/coinbase/coinbase-node // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 7e7b62dfcc7f8a19a7c610f85b3e25ba46ccf5f9 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Sat, 26 Jan 2019 21:51:10 +0100 Subject: [PATCH 088/266] Update index.d.ts --- types/coinbase/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index 1ef91bbcbb..6731ff3a79 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for coinbase 2.0.8 +// Type definitions for coinbase 2.0 // Project: https://github.com/coinbase/coinbase-node // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 96a7b9f451d5b02cc525d53aad46d1ae28dd2a45 Mon Sep 17 00:00:00 2001 From: Ben Date: Sat, 26 Jan 2019 16:08:45 -0500 Subject: [PATCH 089/266] add ITEM_TYPES and misc --- types/react-ultimate-pagination/index.d.ts | 27 ++++++++---- .../react-ultimate-pagination-tests.tsx | 44 ++++++++++++++++++- types/react-ultimate-pagination/tsconfig.json | 1 + 3 files changed, 61 insertions(+), 11 deletions(-) diff --git a/types/react-ultimate-pagination/index.d.ts b/types/react-ultimate-pagination/index.d.ts index 8e2c917d75..cb7b83e4c0 100644 --- a/types/react-ultimate-pagination/index.d.ts +++ b/types/react-ultimate-pagination/index.d.ts @@ -27,36 +27,45 @@ export interface PaginationComponentProps { onClick: () => void; } +export enum ITEM_TYPES { + PAGE = "PAGE", + ELLIPSIS = "ELLIPSIS", + FIRST_PAGE_LINK = "FIRST_PAGE_LINK", + PREVIOUS_PAGE_LINK = "PREVIOUS_PAGE_LINK", + NEXT_PAGE_LINK = "NEXT_PAGE_LINK", + LAST_PAGE_LINK = "LAST_PAGE_LINK", +} + export interface ItemTypeToComponent { /** * A link to a page */ - PAGE: React.ComponentType, + PAGE: React.ComponentType; /** * An item that represents groups of pages that currently are not visible in paginator (can be used to navigate to the page in the group that is the nearest to the current page) */ - ELLIPSIS: React.ComponentType, + ELLIPSIS: React.ComponentType; /** * A link to the first page */ - FIRST_PAGE_LINK: React.ComponentType, + FIRST_PAGE_LINK: React.ComponentType; /** * A link to the previous page */ - PREVIOUS_PAGE_LINK: React.ComponentType, + PREVIOUS_PAGE_LINK: React.ComponentType; /** * A link to the next page */ - NEXT_PAGE_LINK: React.ComponentType, + NEXT_PAGE_LINK: React.ComponentType; /** * A link to the last page */ - LAST_PAGE_LINK: React.ComponentType, + LAST_PAGE_LINK: React.ComponentType; } export interface CreateUltimatePaginationOptions { @@ -66,9 +75,9 @@ export interface CreateUltimatePaginationOptions { itemTypeToComponent: ItemTypeToComponent; /** - * A React.js component that will be used as a wrapper for pagination items + * A React.js component that will be used as a wrapper for pagination items */ - WrapperComponent: string|React.ComponentType; + WrapperComponent?: string|React.ComponentType; } export interface UltimatePaginationProps { @@ -108,7 +117,7 @@ export interface UltimatePaginationProps { hideFirstAndLastPageLinks?: boolean; /** - * Callback that will be called with new page when it should be changed by user interaction + * Callback that will be called with new page when it should be changed by user interaction */ onChange?: (newPage: number) => void; diff --git a/types/react-ultimate-pagination/react-ultimate-pagination-tests.tsx b/types/react-ultimate-pagination/react-ultimate-pagination-tests.tsx index 8116f5e42b..8cebdcbf52 100644 --- a/types/react-ultimate-pagination/react-ultimate-pagination-tests.tsx +++ b/types/react-ultimate-pagination/react-ultimate-pagination-tests.tsx @@ -2,7 +2,8 @@ import * as React from "react"; import { PaginationComponentProps, createUltimatePagination, - ItemTypeToComponent + ItemTypeToComponent, + ITEM_TYPES } from "react-ultimate-pagination"; function Page(props: PaginationComponentProps) { @@ -15,6 +16,12 @@ function Page(props: PaginationComponentProps) { ); } +function PageWithExtraProps(props: PaginationComponentProps & { color: "red" }) { + return ( + + ); +} + function Ellipsis(props: PaginationComponentProps) { return ; } @@ -39,6 +46,7 @@ function Wrapper(props: { children: React.ReactChildren }) { return
{props.children}
; } +// ItemTypeToComponent using strings const itemTypeToComponent: ItemTypeToComponent = { PAGE: Page, ELLIPSIS: Ellipsis, @@ -48,6 +56,38 @@ const itemTypeToComponent: ItemTypeToComponent = { LAST_PAGE_LINK: LastPageLink }; -const UltimatePagination = createUltimatePagination({ itemTypeToComponent, WrapperComponent: Wrapper }); // $ExpectType React.ComponentType +// ItemTypeToComponent using enum +const itemTypeToComponent2: ItemTypeToComponent = { + [ITEM_TYPES.PAGE]: Page, + [ITEM_TYPES.ELLIPSIS]: Ellipsis, + [ITEM_TYPES.FIRST_PAGE_LINK]: FirstPageLink, + [ITEM_TYPES.PREVIOUS_PAGE_LINK]: PreviousPageLink, + [ITEM_TYPES.NEXT_PAGE_LINK]: NextPageLink, + [ITEM_TYPES.LAST_PAGE_LINK]: LastPageLink +}; +// ItemTypeToComponent using Page with extra props +const itemTypeToComponent3: Partial = { + [ITEM_TYPES.PAGE]: PageWithExtraProps, +}; + +const UltimatePagination = createUltimatePagination({ itemTypeToComponent, WrapperComponent: Wrapper }); // $ExpectType ComponentType + +// With required props ; + +// With all props + {}} + siblingPagesRange={99} +/>; + +// With unspported prop +; // $ExpectError diff --git a/types/react-ultimate-pagination/tsconfig.json b/types/react-ultimate-pagination/tsconfig.json index b16cb5d3d0..748045849b 100644 --- a/types/react-ultimate-pagination/tsconfig.json +++ b/types/react-ultimate-pagination/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": false, "baseUrl": "../", "typeRoots": [ "../" From ccd3077c6074b216713f69c7d61a56f5aa7cd99f Mon Sep 17 00:00:00 2001 From: Ben Date: Sat, 26 Jan 2019 16:16:17 -0500 Subject: [PATCH 090/266] allow any props --- types/react-ultimate-pagination/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-ultimate-pagination/index.d.ts b/types/react-ultimate-pagination/index.d.ts index cb7b83e4c0..2f7c26c210 100644 --- a/types/react-ultimate-pagination/index.d.ts +++ b/types/react-ultimate-pagination/index.d.ts @@ -77,7 +77,7 @@ export interface CreateUltimatePaginationOptions { /** * A React.js component that will be used as a wrapper for pagination items */ - WrapperComponent?: string|React.ComponentType; + WrapperComponent?: string|React.ComponentType; } export interface UltimatePaginationProps { From 324fab550d52313b7862f8d1ffc68974cbfc7b56 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Sat, 26 Jan 2019 22:38:58 +0100 Subject: [PATCH 091/266] Update index.d.ts --- types/coinbase/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index 6731ff3a79..27768610a2 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -547,7 +547,7 @@ export class Account implements Resource { allow_withdrawals: boolean; /** - * Account worth in native balance. + * Account worth in fiat. */ native_balance: MoneyHash; @@ -914,6 +914,11 @@ export class Buy implements Resource { * 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; + + /** + * Transaction worth in fiat. + */ + native_balance: MoneyHash; /** * Completes a buy that is created in commit: false state. From 64100c212e1bf27066caea74ac636af66942dd48 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Sat, 26 Jan 2019 22:45:47 +0100 Subject: [PATCH 092/266] Update index.d.ts --- types/coinbase/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index 27768610a2..e30a049b15 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -914,7 +914,7 @@ export class Buy implements Resource { * 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; - + /** * Transaction worth in fiat. */ From 5f07f4ebc9a5f2e135e19359efd83d7b44255fa0 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Sat, 26 Jan 2019 22:52:17 +0100 Subject: [PATCH 093/266] Update index.d.ts --- types/coinbase/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index e30a049b15..e92fcef8e7 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -645,7 +645,7 @@ export class Account implements Resource { * Lists buys for an account. * Scope: wallet:buys:read */ - getBuys(cb: (error: Error, result: Buy[]) => void): void; + getBuys(opts: null, cb: (error: Error, result: Buy[]) => void): void; /** * Show an individual buy. From fd90d5b6138bc7617260b1af9ed8ec3dbbf28d7b Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sat, 26 Jan 2019 21:39:56 +0100 Subject: [PATCH 094/266] feat: add type for "rollup-plugin-node-builtins" --- types/rollup-plugin-node-builtins/index.d.ts | 11 +++++++++++ types/rollup-plugin-node-builtins/package.json | 6 ++++++ .../rollup-plugin-node-builtins-tests.ts | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 types/rollup-plugin-node-builtins/package.json diff --git a/types/rollup-plugin-node-builtins/index.d.ts b/types/rollup-plugin-node-builtins/index.d.ts index 70f8b3c873..e8506a94ff 100644 --- a/types/rollup-plugin-node-builtins/index.d.ts +++ b/types/rollup-plugin-node-builtins/index.d.ts @@ -2,4 +2,15 @@ // Project: https://github.com/calvinmetcalf/rollup-plugin-node-builtins#readme // Definitions by: Kocal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +/// + +import { Plugin } from 'rollup'; + +export interface Options { + crypto?: boolean; + fs?: boolean; +} + +export default function builtins(options?: Options): Plugin; diff --git a/types/rollup-plugin-node-builtins/package.json b/types/rollup-plugin-node-builtins/package.json new file mode 100644 index 0000000000..ee69ca3cd2 --- /dev/null +++ b/types/rollup-plugin-node-builtins/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "rollup": "^0.63.4" + } +} diff --git a/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts b/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts index e69de29bb2..53e488cd00 100644 --- a/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts +++ b/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts @@ -0,0 +1,16 @@ +import builtins from 'rollup-plugin-node-builtins'; + +// No options (default) +(() => { + // $ExpectType Plugin + builtins(); +})(); + +// With `crypto` and `fs` enabled +(() => { + // $ExpectType Plugin + builtins({ + crypto: true, + fs: true, + }); +})(); From 3f944ca274d0eb2404905e1de7d4ba76535074e1 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 08:48:50 +0100 Subject: [PATCH 095/266] chore: setup type --- types/rollup-plugin-node-globals/index.d.ts | 4 ++++ .../rollup-plugin-node-globals-tests.ts | 0 .../rollup-plugin-node-globals/tsconfig.json | 23 +++++++++++++++++++ types/rollup-plugin-node-globals/tslint.json | 1 + 4 files changed, 28 insertions(+) create mode 100644 types/rollup-plugin-node-globals/index.d.ts create mode 100644 types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts create mode 100644 types/rollup-plugin-node-globals/tsconfig.json create mode 100644 types/rollup-plugin-node-globals/tslint.json diff --git a/types/rollup-plugin-node-globals/index.d.ts b/types/rollup-plugin-node-globals/index.d.ts new file mode 100644 index 0000000000..08b8b52926 --- /dev/null +++ b/types/rollup-plugin-node-globals/index.d.ts @@ -0,0 +1,4 @@ +// Type definitions for rollup-plugin-node-globals 1.4 +// Project: https://github.com/calvinmetcalf/rollup-plugin-node-globals#readme +// Definitions by: Kocal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts b/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/rollup-plugin-node-globals/tsconfig.json b/types/rollup-plugin-node-globals/tsconfig.json new file mode 100644 index 0000000000..29e93758c9 --- /dev/null +++ b/types/rollup-plugin-node-globals/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", + "rollup-plugin-node-globals-tests.ts" + ] +} diff --git a/types/rollup-plugin-node-globals/tslint.json b/types/rollup-plugin-node-globals/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rollup-plugin-node-globals/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 69863b59ba6fd60ee321582d883677d468b4d74e Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 09:23:25 +0100 Subject: [PATCH 096/266] feat: add type for "rollup-plugin-node-globals" --- types/rollup-plugin-node-globals/index.d.ts | 24 +++++++++++ types/rollup-plugin-node-globals/package.json | 6 +++ .../rollup-plugin-node-globals-tests.ts | 43 +++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 types/rollup-plugin-node-globals/package.json diff --git a/types/rollup-plugin-node-globals/index.d.ts b/types/rollup-plugin-node-globals/index.d.ts index 08b8b52926..97284aaabd 100644 --- a/types/rollup-plugin-node-globals/index.d.ts +++ b/types/rollup-plugin-node-globals/index.d.ts @@ -2,3 +2,27 @@ // Project: https://github.com/calvinmetcalf/rollup-plugin-node-globals#readme // Definitions by: Kocal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import { Plugin } from 'rollup'; + +export interface Options { + // Every files will be parsed by default, but you can specify which files to include or exclude + include?: Array | string | RegExp | null; + exclude?: Array | string | RegExp | null; + + // Enable sourcemaps support + sourceMap ?: boolean; + + // Plugin's options + process?: boolean; + global?: boolean; + buffer?: boolean; + dirname?: boolean; + filename?: boolean; + baseDir?: string; +} + +export default function globals(options?: Options): Plugin; diff --git a/types/rollup-plugin-node-globals/package.json b/types/rollup-plugin-node-globals/package.json new file mode 100644 index 0000000000..ee69ca3cd2 --- /dev/null +++ b/types/rollup-plugin-node-globals/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "rollup": "^0.63.4" + } +} diff --git a/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts b/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts index e69de29bb2..93d10a2730 100644 --- a/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts +++ b/types/rollup-plugin-node-globals/rollup-plugin-node-globals-tests.ts @@ -0,0 +1,43 @@ +import globals from 'rollup-plugin-node-globals'; + +// No options (default) +(() => { + // $ExpectType Plugin + globals(); +})(); + +// With every options +(() => { + // $ExpectType Plugin + globals({ + process: false, + global: false, + buffer: false, + dirname: false, + filename: false, + baseDir: '/', + }); +})(); + +// Filter files +(() => { + // $ExpectType Plugin + globals({ + include: '*.js', + exclude: '*.js', + }); + + // $ExpectType Plugin + globals({ + include: /.js$/, + exclude: ['foo.js', 'bar.js'], + }); +})(); + +// Sourcemaps +(() => { + // $ExpectType Plugin + globals({ + sourceMap: false, + }); +})(); From ef068528b46455cfb2c28c164e2db7b913e3b8d8 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 10:09:58 +0100 Subject: [PATCH 097/266] feat: add typings for defaults-deep --- types/defaults-deep/defaults-deep-tests.ts | 7 +++++++ types/defaults-deep/index.d.ts | 10 ++++++++++ types/defaults-deep/tsconfig.json | 23 ++++++++++++++++++++++ types/defaults-deep/tslint.json | 1 + 4 files changed, 41 insertions(+) create mode 100644 types/defaults-deep/defaults-deep-tests.ts create mode 100644 types/defaults-deep/index.d.ts create mode 100644 types/defaults-deep/tsconfig.json create mode 100644 types/defaults-deep/tslint.json diff --git a/types/defaults-deep/defaults-deep-tests.ts b/types/defaults-deep/defaults-deep-tests.ts new file mode 100644 index 0000000000..826bbb4d0f --- /dev/null +++ b/types/defaults-deep/defaults-deep-tests.ts @@ -0,0 +1,7 @@ +import defaults from 'defaults-deep'; + +defaults(); +defaults({a: 'foo'}); +defaults({a: 'foo'}, {a: 'bar'}); +defaults({a: 'foo'}, {a: 'bar'}, {a: 'foobar'}); +defaults({a: {b: 'foo'}}, {a: {b: 'bar'}}); diff --git a/types/defaults-deep/index.d.ts b/types/defaults-deep/index.d.ts new file mode 100644 index 0000000000..cc96e2bcad --- /dev/null +++ b/types/defaults-deep/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for defaults-deep 0.2 +// Project: https://github.com/jonschlinkert/defaults-deep +// Definitions by: Kocal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Obj { + [k: string]: any; +} + +export default function defaultDeep(obj?: Obj, ...objs: Obj[]): Obj; diff --git a/types/defaults-deep/tsconfig.json b/types/defaults-deep/tsconfig.json new file mode 100644 index 0000000000..9b7c12bf2b --- /dev/null +++ b/types/defaults-deep/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", + "defaults-deep-tests.ts" + ] +} diff --git a/types/defaults-deep/tslint.json b/types/defaults-deep/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/defaults-deep/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6aa5a8d5f3d81b8bfa9fa0adb3995590eadf8c53 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 10:24:45 +0100 Subject: [PATCH 098/266] fix: shut down "strict-export-declare-modifiers" rule --- types/defaults-deep/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/defaults-deep/index.d.ts b/types/defaults-deep/index.d.ts index cc96e2bcad..74543fc677 100644 --- a/types/defaults-deep/index.d.ts +++ b/types/defaults-deep/index.d.ts @@ -8,3 +8,6 @@ interface Obj { } export default function defaultDeep(obj?: Obj, ...objs: Obj[]): Obj; + +// strict-export-declare-modifiers +export {}; From 5b4074d724687ec45fde17a7df405cc1c9c54bd2 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 11:59:55 +0100 Subject: [PATCH 099/266] chore: use my name --- types/defaults-deep/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/defaults-deep/index.d.ts b/types/defaults-deep/index.d.ts index 74543fc677..b7583dd92e 100644 --- a/types/defaults-deep/index.d.ts +++ b/types/defaults-deep/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for defaults-deep 0.2 // Project: https://github.com/jonschlinkert/defaults-deep -// Definitions by: Kocal +// Definitions by: Hugo Alliaume // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface Obj { From ce8bddf8b0cb96a2d070b9816a4edf6e696c938d Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 12:00:26 +0100 Subject: [PATCH 100/266] chore: use my name --- types/rollup-plugin-node-builtins/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rollup-plugin-node-builtins/index.d.ts b/types/rollup-plugin-node-builtins/index.d.ts index e8506a94ff..e839485ac9 100644 --- a/types/rollup-plugin-node-builtins/index.d.ts +++ b/types/rollup-plugin-node-builtins/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for rollup-plugin-node-builtins 2.1 // Project: https://github.com/calvinmetcalf/rollup-plugin-node-builtins#readme -// Definitions by: Kocal +// Definitions by: Hugo Alliaume // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From a3ce51ce058fe7d35f7e507af91184bc7e09c0ce Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 12:00:53 +0100 Subject: [PATCH 101/266] chore: use my name --- types/rollup-plugin-node-globals/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rollup-plugin-node-globals/index.d.ts b/types/rollup-plugin-node-globals/index.d.ts index 97284aaabd..2cf29ae912 100644 --- a/types/rollup-plugin-node-globals/index.d.ts +++ b/types/rollup-plugin-node-globals/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for rollup-plugin-node-globals 1.4 // Project: https://github.com/calvinmetcalf/rollup-plugin-node-globals#readme -// Definitions by: Kocal +// Definitions by: Hugo Alliaume // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 54ff498709b81ecac06d6842057ae3512939e8f7 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 27 Jan 2019 12:01:38 +0100 Subject: [PATCH 102/266] chore: use my name --- types/buble/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/buble/index.d.ts b/types/buble/index.d.ts index af2a7e26ee..db3cb0a7b7 100644 --- a/types/buble/index.d.ts +++ b/types/buble/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for buble 0.19 // Project: https://github.com/Rich-Harris/buble#README -// Definitions by: Kocal +// Definitions by: Hugo Alliaume // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 From 966470e9e5f06e80625a2fa6d89ec1663aed7efd Mon Sep 17 00:00:00 2001 From: Denis Cappellin Date: Sun, 27 Jan 2019 12:10:10 +0100 Subject: [PATCH 103/266] Add missing definition for writeLong --- types/bytebuffer/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/bytebuffer/index.d.ts b/types/bytebuffer/index.d.ts index bafed6edf8..eaa1a509d5 100644 --- a/types/bytebuffer/index.d.ts +++ b/types/bytebuffer/index.d.ts @@ -127,7 +127,7 @@ declare class ByteBuffer * Calculates the number of UTF8 characters of a string.JavaScript itself uses UTF- 16, so that a string's length property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF. */ static calculateUTF8Chars( str: string ): number; - + /** * Calculates the number of UTF8 bytes of a string. This is an alias of ByteBuffer#calculateUTF8Bytes. */ @@ -574,6 +574,11 @@ declare class ByteBuffer */ writeInt8( value: number, offset?: number ): ByteBuffer; + /** + * Write a 64bit signed integer. This is an alias of ByteBuffer#writeInt64. + */ + writeLong( value: number | Long, offset?: number ): ByteBuffer; + /** * Writes a 16bit signed integer. This is an alias of ByteBuffer#writeInt16. */ From 5a05abfba06b5a64de3b0de770f28aa02c793cd4 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 27 Jan 2019 17:47:55 +0000 Subject: [PATCH 104/266] Export RepositoryInitOptions --- types/nodegit/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index d1afcd6ea4..704ff9b037 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -79,7 +79,7 @@ export { Refspec } from './ref-spec'; export { Reference } from './reference'; export { RemoteCallbacks } from './remote-callbacks'; export { Remote } from './remote'; -export { Repository } from './repository'; +export { Repository, RepositoryInitOptions } from './repository'; export { Reset } from './reset'; export { Revparse } from './rev-parse'; export { Revwalk } from './rev-walk'; From 7f27ae1f9169cdf2225fb89466d44cbaa1f6cf88 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 27 Jan 2019 17:49:49 +0000 Subject: [PATCH 105/266] Version bump --- types/nodegit/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 704ff9b037..680aec7174 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for nodegit 0.22 +// Type definitions for nodegit 0.24 // Project: https://github.com/nodegit/nodegit // Definitions by: Dolan Miu , Tobias Nießen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From f55a8706f0309b3add7e8ce3f8505ce953c53de7 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Sun, 27 Jan 2019 19:52:15 +0100 Subject: [PATCH 106/266] Update index.d.ts --- types/coinbase/index.d.ts | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index e92fcef8e7..5f9f8682f0 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -898,7 +898,7 @@ export class Buy implements Resource { /** * Fee associated to this buy */ - fee: MoneyHash; + fees: Fee[]; /** * Has this buy been committed? @@ -915,10 +915,13 @@ export class Buy implements Resource { */ payout_at?: string; - /** - * Transaction worth in fiat. - */ - native_balance: MoneyHash; + unit_price: UnitPrice; + + hold_business_days: number; + + is_first_buy: boolean; + + requires_completion_step: boolean; /** * Completes a buy that is created in commit: false state. @@ -930,6 +933,17 @@ export class Buy implements Resource { commit(cb: (error: Error, transaction: Buy) => void): void; } +export interface Fee { + amount: string; + type: string; +} + +export interface UnitPrice { + amount: string; + currency: string; + scale: number; +} + export type SellStatus = "created" | "completed" | "canceled"; /** From f8ce3b3f9fc26484f43dbf85a311788ed7a7f364 Mon Sep 17 00:00:00 2001 From: Ryan Sonshine Date: Sun, 27 Jan 2019 14:11:52 -0500 Subject: [PATCH 107/266] Added type definitions for dlv --- types/dlv/dlv-tests.ts | 44 +++++++++++++++++++++++++++++++++++++++++ types/dlv/index.d.ts | 22 +++++++++++++++++++++ types/dlv/tsconfig.json | 23 +++++++++++++++++++++ types/dlv/tslint.json | 3 +++ 4 files changed, 92 insertions(+) create mode 100644 types/dlv/dlv-tests.ts create mode 100644 types/dlv/index.d.ts create mode 100644 types/dlv/tsconfig.json create mode 100644 types/dlv/tslint.json diff --git a/types/dlv/dlv-tests.ts b/types/dlv/dlv-tests.ts new file mode 100644 index 0000000000..abe4b259c3 --- /dev/null +++ b/types/dlv/dlv-tests.ts @@ -0,0 +1,44 @@ +import dlv from 'dlv'; + +const obj = { + undef: undefined, + zero: 0, + one: 1, + n: null, + f: false, + a: { + two: 2, + b: { + three: 3, + c: { + four: 4 + } + } + } +}; + +// Test without defaults +dlv(obj, ''); +dlv(obj, 'one'); +dlv(obj, 'one.two'); +dlv(obj, 'a'); +dlv(obj, 'a.two'); +dlv(obj, 'a.b'); +dlv(obj, 'a.b.three'); +dlv(obj, 'a.b.c'); +dlv(obj, 'a.b.c.four'); +dlv(obj, 'n'); +dlv(obj, 'n.badkey'); +dlv(obj, 'f'); +dlv(obj, 'f.badkey'); + +// Test defaults +dlv(obj, '', 'foo'); +dlv(obj, 'undef', 'foo'); +dlv(obj, 'n', null); +dlv(obj, 'n.badkey', 'foo'); +dlv(obj, 'zero', 0); +dlv(obj, 'a.badkey', 'foo'); +dlv(obj, 'a.badkey.anotherbadkey', 'foo'); +dlv(obj, 'f', false); +dlv(obj, 'f.badkey', 'foo'); diff --git a/types/dlv/index.d.ts b/types/dlv/index.d.ts new file mode 100644 index 0000000000..ef84668e7d --- /dev/null +++ b/types/dlv/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for dlv 1.1.2 +// Project: https://github.com/developit/dlv +// Definitions by: Ryan Sonshine +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 +declare module 'dlv' { + /** + * Safely get a dot-notated path within a nested object, with ability to + * return a default if the full key path does not exist or the value is + * undefined + * + * @param {object} object Object to look up the key on + * @param {(string | string[])} key Key in dot notation to lookup. Can also be an array key. + * @param {T} [defaultValue] Default value to return if the full key path does not exist on the object + * @returns {(any | T))} Value if found in path, the default if not found, undefined if no default provided + */ + export default function dlv( + object : object, + key : string | string[], + defaultValue?: T, + ): any | T; +} diff --git a/types/dlv/tsconfig.json b/types/dlv/tsconfig.json new file mode 100644 index 0000000000..ab250de319 --- /dev/null +++ b/types/dlv/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", + "dlv-tests.ts" + ] +} diff --git a/types/dlv/tslint.json b/types/dlv/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/dlv/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 5afbc6c1d6d3b897f666a937bbad0a5459de328a Mon Sep 17 00:00:00 2001 From: Ryan Sonshine Date: Sun, 27 Jan 2019 14:22:52 -0500 Subject: [PATCH 108/266] Fixes union type for dlv return type --- types/dlv/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/dlv/index.d.ts b/types/dlv/index.d.ts index ef84668e7d..845710e524 100644 --- a/types/dlv/index.d.ts +++ b/types/dlv/index.d.ts @@ -11,12 +11,12 @@ declare module 'dlv' { * * @param {object} object Object to look up the key on * @param {(string | string[])} key Key in dot notation to lookup. Can also be an array key. - * @param {T} [defaultValue] Default value to return if the full key path does not exist on the object - * @returns {(any | T))} Value if found in path, the default if not found, undefined if no default provided + * @param {any} [defaultValue] Default value to return if the full key path does not exist on the object + * @returns {any} Value if found in path, the default if not found, undefined if no default provided */ - export default function dlv( + export default function dlv( object : object, key : string | string[], - defaultValue?: T, - ): any | T; + defaultValue?: any, + ): any; } From 3b7700e7531121e45645d1bce9b19cba2af7eddb Mon Sep 17 00:00:00 2001 From: Ryan Sonshine Date: Sun, 27 Jan 2019 14:33:54 -0500 Subject: [PATCH 109/266] Uses dts-gen to set up module structure --- types/dlv/index.d.ts | 34 ++++++++++++++-------------------- types/dlv/tsconfig.json | 1 - types/dlv/tslint.json | 4 +--- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/types/dlv/index.d.ts b/types/dlv/index.d.ts index 845710e524..b8f2608fe9 100644 --- a/types/dlv/index.d.ts +++ b/types/dlv/index.d.ts @@ -1,22 +1,16 @@ -// Type definitions for dlv 1.1.2 -// Project: https://github.com/developit/dlv +// Type definitions for dlv 1.1 +// Project: https://github.com/developit/dlv#readme // Definitions by: Ryan Sonshine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 -declare module 'dlv' { - /** - * Safely get a dot-notated path within a nested object, with ability to - * return a default if the full key path does not exist or the value is - * undefined - * - * @param {object} object Object to look up the key on - * @param {(string | string[])} key Key in dot notation to lookup. Can also be an array key. - * @param {any} [defaultValue] Default value to return if the full key path does not exist on the object - * @returns {any} Value if found in path, the default if not found, undefined if no default provided - */ - export default function dlv( - object : object, - key : string | string[], - defaultValue?: any, - ): any; -} + +/** + * Safely get a dot-notated path within a nested object, with ability to + * return a default if the full key path does not exist or the value is + * undefined + * + * @param {object} object Object to look up the key on + * @param {(string | string[])} key Key in dot notation to lookup. Can also be an array key. + * @param {any} [defaultValue] Default value to return if the full key path does not exist on the object + * @returns {any} Value if found in path, the default if not found, undefined if no default provided +*/ +export default function dlv(object: object, key: string | string[], defaultValue?: any): any; diff --git a/types/dlv/tsconfig.json b/types/dlv/tsconfig.json index ab250de319..34d76ae224 100644 --- a/types/dlv/tsconfig.json +++ b/types/dlv/tsconfig.json @@ -7,7 +7,6 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/dlv/tslint.json b/types/dlv/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/dlv/tslint.json +++ b/types/dlv/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } From 36a2c05baab019858e42444c26eb37d402b58de7 Mon Sep 17 00:00:00 2001 From: Ryan Sonshine Date: Sun, 27 Jan 2019 14:40:51 -0500 Subject: [PATCH 110/266] Adds strictFunctionTypes to tsconfig --- types/dlv/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/dlv/tsconfig.json b/types/dlv/tsconfig.json index 34d76ae224..222ce070e7 100644 --- a/types/dlv/tsconfig.json +++ b/types/dlv/tsconfig.json @@ -13,7 +13,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true }, "files": [ "index.d.ts", From 6025289427c09bc854ceebd6a83dbf9eca474a61 Mon Sep 17 00:00:00 2001 From: Ryan Sonshine Date: Sun, 27 Jan 2019 14:44:42 -0500 Subject: [PATCH 111/266] Adds typescript version to type definition file --- types/dlv/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/dlv/index.d.ts b/types/dlv/index.d.ts index b8f2608fe9..3d86aa91b5 100644 --- a/types/dlv/index.d.ts +++ b/types/dlv/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/developit/dlv#readme // Definitions by: Ryan Sonshine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /** * Safely get a dot-notated path within a nested object, with ability to From 73f13bed814d26fdd051a945022959ef81fb8b04 Mon Sep 17 00:00:00 2001 From: Ryan Sonshine Date: Sun, 27 Jan 2019 14:54:17 -0500 Subject: [PATCH 112/266] Removes docstring from dlv type definition --- types/dlv/index.d.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/types/dlv/index.d.ts b/types/dlv/index.d.ts index 3d86aa91b5..5813ec0595 100644 --- a/types/dlv/index.d.ts +++ b/types/dlv/index.d.ts @@ -8,10 +8,5 @@ * Safely get a dot-notated path within a nested object, with ability to * return a default if the full key path does not exist or the value is * undefined - * - * @param {object} object Object to look up the key on - * @param {(string | string[])} key Key in dot notation to lookup. Can also be an array key. - * @param {any} [defaultValue] Default value to return if the full key path does not exist on the object - * @returns {any} Value if found in path, the default if not found, undefined if no default provided -*/ + */ export default function dlv(object: object, key: string | string[], defaultValue?: any): any; From a8a2b4f1c11351c5cc7ff48cc13d709f64e838ec Mon Sep 17 00:00:00 2001 From: Dave Cardwell Date: Sun, 27 Jan 2019 17:32:20 -0500 Subject: [PATCH 113/266] [script-ext-html-webpack-plugin] Add initial types --- .../script-ext-html-webpack-plugin/index.d.ts | 79 ++++++++++++ .../script-ext-html-webpack-plugin-tests.ts | 112 ++++++++++++++++++ .../tsconfig.json | 16 +++ .../tslint.json | 1 + 4 files changed, 208 insertions(+) create mode 100644 types/script-ext-html-webpack-plugin/index.d.ts create mode 100644 types/script-ext-html-webpack-plugin/script-ext-html-webpack-plugin-tests.ts create mode 100644 types/script-ext-html-webpack-plugin/tsconfig.json create mode 100644 types/script-ext-html-webpack-plugin/tslint.json diff --git a/types/script-ext-html-webpack-plugin/index.d.ts b/types/script-ext-html-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..636ac550e5 --- /dev/null +++ b/types/script-ext-html-webpack-plugin/index.d.ts @@ -0,0 +1,79 @@ +// Type definitions for script-ext-html-webpack-plugin 2.1 +// Project: https://github.com/numical/script-ext-html-webpack-plugin +// Definitions by: Dave Cardwell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Plugin } from "webpack"; + +export = ScriptExtHtmlWebpackPlugin; + +declare class ScriptExtHtmlWebpackPlugin extends Plugin { + constructor(options?: ScriptExtHtmlWebpackPlugin.Options); +} + +type ScriptMatchingPatternBase = + | string + | RegExp + | ReadonlyArray; + +interface ScriptMatchingPatternHash { + test: ScriptMatchingPatternBase; +} + +type ScriptMatchingPattern = + | ScriptMatchingPatternBase + | ScriptMatchingPatternHash; + +type ScriptMatchingPatternPre = + | ScriptMatchingPatternBase + | ScriptMatchingPatternHash & { + chunks?: "initial" | "async" | "all"; + }; + +interface Custom { + test: ScriptMatchingPattern; + attribute: string; + value?: string; +} + +declare namespace ScriptExtHtmlWebpackPlugin { + interface Options { + /** + * scripts that should be inlined in the html (default: `[]`) + */ + inline?: ScriptMatchingPattern; + /** + * script names that should have no attribute (default: `[]`) + */ + sync?: ScriptMatchingPattern; + /** + * script names that should have an async attribute (default: `[]`) + */ + async?: ScriptMatchingPattern; + /** + * script names that should have a defer attribute (default: `[]`) + */ + defer?: ScriptMatchingPattern; + /** + * the default attribute to set - 'sync' actually results in no attribute (default: 'sync') + */ + defaultAttribute?: "sync" | "async" | "defer"; + /** + * script names that should have a type="module" attribute (default: `[]`) + */ + module?: ScriptMatchingPattern; + /** + * scripts that should have accompanying preload resource hints (default: `[]`) + */ + preload?: ScriptMatchingPatternPre; + /** + * scripts that should have accompanying prefetch resource hints (default: `[]`) + */ + prefetch?: ScriptMatchingPatternPre; + /** + * scripts that should have a custom attribute(s) added, the attribute(s), and the value(s) + */ + custom?: Custom | Custom[]; + } +} diff --git a/types/script-ext-html-webpack-plugin/script-ext-html-webpack-plugin-tests.ts b/types/script-ext-html-webpack-plugin/script-ext-html-webpack-plugin-tests.ts new file mode 100644 index 0000000000..84c42b2ae9 --- /dev/null +++ b/types/script-ext-html-webpack-plugin/script-ext-html-webpack-plugin-tests.ts @@ -0,0 +1,112 @@ +import ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin"); + +new ScriptExtHtmlWebpackPlugin(); +new ScriptExtHtmlWebpackPlugin({}); + +new ScriptExtHtmlWebpackPlugin({ + inline: "string", + sync: "string", + async: "string", + defer: "string", + module: "string", + preload: "string", + prefetch: "string" +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: ["array"], + sync: ["array"], + async: ["array"], + defer: ["array"], + module: ["array"], + preload: ["array"], + prefetch: ["array"] +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: /regexp/, + sync: /regexp/, + async: /regexp/, + defer: /regexp/, + module: /regexp/, + preload: /regexp/, + prefetch: /regexp/ +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: { test: "string" }, + sync: { test: "string" }, + async: { test: "string" }, + defer: { test: "string" }, + module: { test: "string" }, + preload: { test: "string" }, + prefetch: { test: "string" } +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: { test: ["array"] }, + sync: { test: ["array"] }, + async: { test: ["array"] }, + defer: { test: ["array"] }, + module: { test: ["array"] }, + preload: { test: ["array"] }, + prefetch: { test: ["array"] } +}); + +new ScriptExtHtmlWebpackPlugin({ + inline: { test: /regexp/ }, + sync: { test: /regexp/ }, + async: { test: /regexp/ }, + defer: { test: /regexp/ }, + module: { test: /regexp/ }, + preload: { test: /regexp/ }, + prefetch: { test: /regexp/ } +}); + +new ScriptExtHtmlWebpackPlugin({ + preload: { test: "string", chunks: "initial" }, + prefetch: { test: "string", chunks: "initial" } +}); + +new ScriptExtHtmlWebpackPlugin({ + preload: { test: "string", chunks: "async" }, + prefetch: { test: "string", chunks: "async" } +}); + +new ScriptExtHtmlWebpackPlugin({ + preload: { test: "string", chunks: "all" }, + prefetch: { test: "string", chunks: "all" } +}); + +new ScriptExtHtmlWebpackPlugin({ defaultAttribute: "sync" }); +new ScriptExtHtmlWebpackPlugin({ defaultAttribute: "async" }); +new ScriptExtHtmlWebpackPlugin({ defaultAttribute: "defer" }); + +new ScriptExtHtmlWebpackPlugin({ + custom: { + test: "string", + attribute: "string" + } +}); + +new ScriptExtHtmlWebpackPlugin({ + custom: { + test: ["array"], + attribute: "string", + value: "string" + } +}); + +new ScriptExtHtmlWebpackPlugin({ + custom: [ + { + test: /regexp/, + attribute: "string" + }, + { + test: "string", + attribute: "string", + value: "string" + } + ] +}); diff --git a/types/script-ext-html-webpack-plugin/tsconfig.json b/types/script-ext-html-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..32c8e618e3 --- /dev/null +++ b/types/script-ext-html-webpack-plugin/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "script-ext-html-webpack-plugin-tests.ts"] +} diff --git a/types/script-ext-html-webpack-plugin/tslint.json b/types/script-ext-html-webpack-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/script-ext-html-webpack-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e8f50e4c45ac23b9a80ba2b0eb2a526ff70b0116 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sun, 27 Jan 2019 23:52:41 +0100 Subject: [PATCH 114/266] [http-cache-semantics] Add types --- .../http-cache-semantics-tests.ts | 19 ++ types/http-cache-semantics/index.d.ts | 170 ++++++++++++++++++ types/http-cache-semantics/tsconfig.json | 23 +++ types/http-cache-semantics/tslint.json | 1 + 4 files changed, 213 insertions(+) create mode 100644 types/http-cache-semantics/http-cache-semantics-tests.ts create mode 100644 types/http-cache-semantics/index.d.ts create mode 100644 types/http-cache-semantics/tsconfig.json create mode 100644 types/http-cache-semantics/tslint.json diff --git a/types/http-cache-semantics/http-cache-semantics-tests.ts b/types/http-cache-semantics/http-cache-semantics-tests.ts new file mode 100644 index 0000000000..73de43b370 --- /dev/null +++ b/types/http-cache-semantics/http-cache-semantics-tests.ts @@ -0,0 +1,19 @@ +const req = { url: 'https://foo.bar', method: 'GET', headers: { foo: 'bar' } }; +const res = { status: 200, headers: { foo: 'bar' } }; + +import CachePolicy = require('http-cache-semantics'); + +const policy = new CachePolicy(req, res); +new CachePolicy(req, res, { shared: true }); +new CachePolicy(req, res, { cacheHeuristic: 0.1 }); +new CachePolicy(req, res, { immutableMinTimeToLive: 24 * 3600 * 1000 }); +new CachePolicy(req, res, { ignoreCargoCult: false }); +new CachePolicy(req, res, { trustServerDate: true }); + +policy.storable(); // $ExpectType boolean +policy.satisfiesWithoutRevalidation(req); // $ExpectType boolean +policy.responseHeaders(); // $ExpectType Headers +policy.timeToLive(); // $ExpectType number +CachePolicy.fromObject(policy.toObject()); // $ExpectType CachePolicy +policy.revalidationHeaders(req); // $ExpectType Headers +policy.revalidatedPolicy(req, res); // $ExpectType RevalidationPolicy diff --git a/types/http-cache-semantics/index.d.ts b/types/http-cache-semantics/index.d.ts new file mode 100644 index 0000000000..40545f3e0a --- /dev/null +++ b/types/http-cache-semantics/index.d.ts @@ -0,0 +1,170 @@ +// Type definitions for http-cache-semantics 4.0 +// Project: https://github.com/kornelski/http-cache-semantics#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = CachePolicy; + +declare class CachePolicy { + constructor(req: CachePolicy.Request, res: CachePolicy.Response, options?: CachePolicy.Options); + + /** + * Returns `true` if the response can be stored in a cache. + * If it's `false` then you MUST NOT store either the request or the response. + */ + storable(): boolean; + + /** + * This is the most important method. Use this method to check whether the cached response is still fresh + * in the context of the new request. + * + * If it returns `true`, then the given `request` matches the original response this cache policy has been + * created with, and the response can be reused without contacting the server. Note that the old response + * can't be returned without being updated, see `responseHeaders()`. + * + * If it returns `false`, then the response may not be matching at all (e.g. it's for a different URL or method), + * or may require to be refreshed first (see `revalidationHeaders()`). + */ + satisfiesWithoutRevalidation(newRequest: CachePolicy.Request): boolean; + + /** + * Returns updated, filtered set of response headers to return to clients receiving the cached response. + * This function is necessary, because proxies MUST always remove hop-by-hop headers (such as `TE` and `Connection`) + * and update response's `Age` to avoid doubling cache time. + * + * @example + * cachedResponse.headers = cachePolicy.responseHeaders(cachedResponse); + */ + responseHeaders(): CachePolicy.Headers; + + /** + * Returns approximate time in milliseconds until the response becomes stale (i.e. not fresh). + * + * After that time (when `timeToLive() <= 0`) the response might not be usable without revalidation. However, + * there are exceptions, e.g. a client can explicitly allow stale responses, so always check with + * `satisfiesWithoutRevalidation()`. + */ + timeToLive(): number; + + /** + * Chances are you'll want to store the `CachePolicy` object along with the cached response. + * `obj = policy.toObject()` gives a plain JSON-serializable object. + */ + toObject(): CachePolicy.CachePolicyObject; + + /** + * `policy = CachePolicy.fromObject(obj)` creates an instance from object created by `toObject()`. + */ + static fromObject(obj: CachePolicy.CachePolicyObject): CachePolicy; + + /** + * Returns updated, filtered set of request headers to send to the origin server to check if the cached + * response can be reused. These headers allow the origin server to return status 304 indicating the + * response is still fresh. All headers unrelated to caching are passed through as-is. + * + * Use this method when updating cache from the origin server. + * + * @example + * updateRequest.headers = cachePolicy.revalidationHeaders(updateRequest); + */ + revalidationHeaders(newRequest: CachePolicy.Request): CachePolicy.Headers; + + /** + * Use this method to update the cache after receiving a new response from the origin server. + */ + revalidatedPolicy( + revalidationRequest: CachePolicy.Request, + revalidationResponse: CachePolicy.Response + ): CachePolicy.RevalidationPolicy; +} + +declare namespace CachePolicy { + interface Request { + url?: string; + method?: string; + headers: Headers; + } + + interface Response { + status?: number; + headers: Headers; + } + + interface Options { + /** + * If `true`, then the response is evaluated from a perspective of a shared cache (i.e. `private` is not + * cacheable and `s-maxage` is respected). If `false`, then the response is evaluated from a perspective + * of a single-user cache (i.e. `private` is cacheable and `s-maxage` is ignored). + * `true` is recommended for HTTP clients. + * @default true + */ + shared?: boolean; + /** + * A fraction of response's age that is used as a fallback cache duration. The default is 0.1 (10%), + * e.g. if a file hasn't been modified for 100 days, it'll be cached for 100*0.1 = 10 days. + * @default 0.1 + */ + cacheHeuristic?: number; + /** + * A number of milliseconds to assume as the default time to cache responses with `Cache-Control: immutable`. + * Note that [per RFC](https://httpwg.org/specs/rfc8246.html#the-immutable-cache-control-extension) + * these can become stale, so `max-age` still overrides the default. + * @default 24*3600*1000 (24h) + */ + immutableMinTimeToLive?: number; + /** + * If `true`, common anti-cache directives will be completely ignored if the non-standard `pre-check` + * and `post-check` directives are present. These two useless directives are most commonly found + * in bad StackOverflow answers and PHP's "session limiter" defaults. + * @default false + */ + ignoreCargoCult?: boolean; + /** + * If `false`, then server's `Date` header won't be used as the base for `max-age`. This is against the RFC, + * but it's useful if you want to cache responses with very short `max-age`, but your local clock + * is not exactly in sync with the server's. + * @default true + */ + trustServerDate?: boolean; + } + + interface CachePolicyObject { + v: number; + t: number; + sh: boolean; + ch: number; + imm: number; + st: number; + resh: Headers; + rescc: { [key: string]: string }; + m: string; + u?: string; + h?: string; + a: boolean; + reqh: Headers | null; + reqcc: { [key: string]: string }; + } + + interface Headers { + [header: string]: string | string[] | undefined; + } + + interface RevalidationPolicy { + /** + * A new `CachePolicy` with HTTP headers updated from `revalidationResponse`. You can always replace + * the old cached `CachePolicy` with the new one. + */ + policy: CachePolicy; + /** + * Boolean indicating whether the response body has changed. + * + * - If `false`, then a valid 304 Not Modified response has been received, and you can reuse the old + * cached response body. + * - If `true`, you should use new response's body (if present), or make another request to the origin + * server without any conditional headers (i.e. don't use `revalidationHeaders()` this time) to get + * the new resource. + */ + modified: boolean; + matches: boolean; + } +} diff --git a/types/http-cache-semantics/tsconfig.json b/types/http-cache-semantics/tsconfig.json new file mode 100644 index 0000000000..9940b3d2e6 --- /dev/null +++ b/types/http-cache-semantics/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", + "http-cache-semantics-tests.ts" + ] +} diff --git a/types/http-cache-semantics/tslint.json b/types/http-cache-semantics/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/http-cache-semantics/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 589adf1b66463c8ad7163160417da7e0334259ee Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Mon, 28 Jan 2019 00:49:53 +0100 Subject: [PATCH 115/266] [responselike] Add types --- types/responselike/index.d.ts | 34 ++++++++++++++++++++++++ types/responselike/responselike-tests.ts | 10 +++++++ types/responselike/tsconfig.json | 23 ++++++++++++++++ types/responselike/tslint.json | 1 + 4 files changed, 68 insertions(+) create mode 100644 types/responselike/index.d.ts create mode 100644 types/responselike/responselike-tests.ts create mode 100644 types/responselike/tsconfig.json create mode 100644 types/responselike/tslint.json diff --git a/types/responselike/index.d.ts b/types/responselike/index.d.ts new file mode 100644 index 0000000000..7152388232 --- /dev/null +++ b/types/responselike/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for responselike 1.0 +// Project: https://github.com/lukechilds/responselike#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { IncomingMessage } from 'http'; +import { Stream } from 'stream'; + +export = ResponseLike; + +/** + * Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage). + */ +declare class ResponseLike extends Stream.Readable { + statusCode: number; + headers: { [header: string]: string | string[] | undefined }; + body: Buffer; + url: string; + + /** + * @param statusCode HTTP response status code. + * @param headers HTTP headers object. Keys will be automatically lowercased. + * @param body A Buffer containing the response body. The Buffer contents will be streamable but is also exposed directly as `response.body`. + * @param url Request URL string. + */ + constructor( + statusCode: number, + headers: { [header: string]: string | string[] | undefined }, + body: Buffer, + url: string + ); +} diff --git a/types/responselike/responselike-tests.ts b/types/responselike/responselike-tests.ts new file mode 100644 index 0000000000..95c5e4f701 --- /dev/null +++ b/types/responselike/responselike-tests.ts @@ -0,0 +1,10 @@ +import Response = require('responselike'); + +const response = new Response(200, { foo: 'bar' }, Buffer.from('Hi!'), 'https://example.com'); + +response.statusCode; // $ExpectType number +response.headers; // $ExpectType { [header: string]: string | string[] | undefined; } +response.body; // $ExpectType Buffer +response.url; // $ExpectType string + +response.pipe(process.stdout); diff --git a/types/responselike/tsconfig.json b/types/responselike/tsconfig.json new file mode 100644 index 0000000000..2c0a9e392b --- /dev/null +++ b/types/responselike/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", + "responselike-tests.ts" + ] +} diff --git a/types/responselike/tslint.json b/types/responselike/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/responselike/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 8b1cfe7a876b328c028ea375662a5d0e6c327d5f Mon Sep 17 00:00:00 2001 From: Wu Haotian Date: Mon, 28 Jan 2019 14:10:42 +0800 Subject: [PATCH 116/266] Add definitions for user-event --- types/user-event/index.d.ts | 20 ++++++++++++++++++++ types/user-event/tsconfig.json | 16 ++++++++++++++++ types/user-event/tslint.json | 1 + types/user-event/user-event-tests.ts | 11 +++++++++++ 4 files changed, 48 insertions(+) create mode 100644 types/user-event/index.d.ts create mode 100644 types/user-event/tsconfig.json create mode 100644 types/user-event/tslint.json create mode 100644 types/user-event/user-event-tests.ts diff --git a/types/user-event/index.d.ts b/types/user-event/index.d.ts new file mode 100644 index 0000000000..4c4bebb1f8 --- /dev/null +++ b/types/user-event/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for user-event 1.4 +// Project: https://github.com/Gpx/user-event#readme +// Definitions by: Wu Haotian +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface UserOpts { + allAtOnce?: boolean; + delay?: number; +} +declare const userEvent: { + click: (element: Element | Window) => void; + dblClick: (element: Element | Window) => void; + type: ( + element: Element | Window, + text: string, + userOpts?: UserOpts + ) => Promise; +}; + +export default userEvent; diff --git a/types/user-event/tsconfig.json b/types/user-event/tsconfig.json new file mode 100644 index 0000000000..38348b184c --- /dev/null +++ b/types/user-event/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["dom", "es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "user-event-tests.ts"] +} diff --git a/types/user-event/tslint.json b/types/user-event/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/user-event/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/user-event/user-event-tests.ts b/types/user-event/user-event-tests.ts new file mode 100644 index 0000000000..0ecf6eb439 --- /dev/null +++ b/types/user-event/user-event-tests.ts @@ -0,0 +1,11 @@ +import userEvent, { UserOpts } from "user-event"; + +userEvent.click(document.body); // $ExpectType void +userEvent.dblClick(window); // $ExpectType void +userEvent.type(document.body, "s"); // $ExpectType Promise +userEvent.type(document.body, "s", {}); // $ExpectType Promise +userEvent.type(document.body, "s", { delay: 5000 }); // $ExpectType Promise +userEvent.type(document.body, "s", { allAtOnce: true }); // $ExpectType Promise +userEvent.type(document.body, "s", { delay: 1000, allAtOnce: false }); // $ExpectType Promise + +const u: UserOpts = { delay: 20 }; From 1eabe68093f538e2d6b4b7501430ef012f884207 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Mon, 28 Jan 2019 08:39:02 +0100 Subject: [PATCH 117/266] Fix tests --- types/coinbase/coinbase-tests.ts | 2 +- types/coinbase/index.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/coinbase/coinbase-tests.ts b/types/coinbase/coinbase-tests.ts index fb804ac566..e7d53012d7 100644 --- a/types/coinbase/coinbase-tests.ts +++ b/types/coinbase/coinbase-tests.ts @@ -25,7 +25,7 @@ client.getAccount("abcdef", (error: Error, account: coinbase.Account): void => { account.getBuy("abcdef", (error: Error, buy: coinbase.Buy): void => undefined); - account.getBuys((error: Error, buy: coinbase.Buy[]): void => undefined); + account.getBuys(null, (error: Error, buy: coinbase.Buy[]): void => undefined); account.getDeposit("abcdef", (error: Error, deposit: coinbase.Deposit): void => undefined); diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index 5f9f8682f0..4580179195 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -918,9 +918,9 @@ export class Buy implements Resource { unit_price: UnitPrice; hold_business_days: number; - + is_first_buy: boolean; - + requires_completion_step: boolean; /** From 1d3927ce95423736a880f8390a7bb5e4be17524f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Mon, 28 Jan 2019 10:24:35 +0000 Subject: [PATCH 118/266] add `ReaderFragment` type to `relay-runtime` --- types/relay-runtime/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 27ae20706c..6589acfd6d 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -23,6 +23,7 @@ export type RelayMutationRequest = any; export type RelayQueryRequest = any; export type ConcreteFragmentDefinition = object; export type ConcreteOperationDefinition = object; +export type ReaderFragment = object; /** * FIXME: RelayContainer used to be typed with ReactClass, but From 9c52db4e04dba26365933c5a0833f092b36229a8 Mon Sep 17 00:00:00 2001 From: Kyle Uehlein Date: Mon, 28 Jan 2019 11:35:10 -0500 Subject: [PATCH 119/266] [@types/node] add definition for child_process.execFile options --- 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 c63b6c892b..417782b2f3 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -32,6 +32,7 @@ // Zane Hannan AU // Jeremie Rodriguez // Samuel Ainsworth +// Kyle Uehlein // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -2886,6 +2887,7 @@ declare module "child_process" { gid?: number; windowsHide?: boolean; windowsVerbatimArguments?: boolean; + shell?: boolean | string; } interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { encoding: BufferEncoding; From d3dc58f92271d04961b9bf8e97a20e87af2ffc7f Mon Sep 17 00:00:00 2001 From: taozhi8833998 Date: Tue, 29 Jan 2019 01:11:52 +0800 Subject: [PATCH 120/266] Added type definitions for node-sql-parser --- types/node-sql-parser/index.d.ts | 97 +++++++++++++++++++ .../node-sql-parser/node-sql-parser-tests.ts | 19 ++++ types/node-sql-parser/tsconfig.json | 25 +++++ types/node-sql-parser/tslint.json | 1 + 4 files changed, 142 insertions(+) create mode 100644 types/node-sql-parser/index.d.ts create mode 100644 types/node-sql-parser/node-sql-parser-tests.ts create mode 100644 types/node-sql-parser/tsconfig.json create mode 100644 types/node-sql-parser/tslint.json diff --git a/types/node-sql-parser/index.d.ts b/types/node-sql-parser/index.d.ts new file mode 100644 index 0000000000..c711212c63 --- /dev/null +++ b/types/node-sql-parser/index.d.ts @@ -0,0 +1,97 @@ +// Type definitions for node-sql-parser 1.0 +// Project: https://github.com/taozhi8833998/node-sql-parser#readme +// Definitions by: taozhi8833998 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +export interface With { + name: string; + stmt: any[]; + columns?: any[]; +} +export type WhilteListCheckMode = 'table' | 'column'; +export interface TableColumnAst { + tableList: string[]; + columnsList: string[]; + ast: AST[] | AST; +} +export interface From { + db: string | null; + table: string; + as: string | null; +} +export interface Dual { + type: 'dual'; +} +export interface Limit { + type: string; + value: number; +} +export interface OrderBy { + type: 'ASC' | 'DESC'; + expr: any; +} +export interface ColumnRef { + type: 'column_ref'; + table: string | null; + column: string; +} +export interface SetList { + column: string; + value: any; + table: string | null; +} +export interface InsertReplaceValue { + type: 'expr_list'; + value: any[]; +} +export interface Select { + with: With | null; + type: 'select'; + options: any[] | null; + distinct: 'DISTINCT' | null; + columns: any[] | '*'; + from: Array | null; + where: any; + groupby: ColumnRef[] | null; + having: any[] | null; + orderby: OrderBy[] | null; + limit: Limit[] | null; +} +export interface Insert_Replace { + type: 'replace' | 'insert'; + db: string | null; + table: string; + columns: string[] | null; + values: InsertReplaceValue[]; +} +export interface Update { + type: 'udpate'; + db: string | null; + table: string; + set: SetList[]; + where: any; +} +export interface Delete { + type: 'delete'; + tables: any; + from: Array; + where: any; +} +export type AST = Select | Insert_Replace | Update | Delete; + +export class Parser { + constructor(); + + parse(sql: string): TableColumnAst; + + astify(sql: string): AST[] | AST; + + sqlify(ast: AST[] | AST): string; + + whiteListCheck(sql: string, whiteList: string[], type?: WhilteListCheckMode): Error | undefined; + + tableList(sql: string): string[]; + + columnList(sql: string): string[]; +} diff --git a/types/node-sql-parser/node-sql-parser-tests.ts b/types/node-sql-parser/node-sql-parser-tests.ts new file mode 100644 index 0000000000..050c69a855 --- /dev/null +++ b/types/node-sql-parser/node-sql-parser-tests.ts @@ -0,0 +1,19 @@ +import { Parser } from 'node-sql-parser'; + +const parser = new Parser(); +const sql = 'select id from tableA'; + +// $ExpectType Select | Insert_Replace | Update | Delete | AST[] +const selectAst = parser.astify(sql); + +// $ExpectType string +parser.sqlify(selectAst); + +// $ExpectType string[] +parser.tableList(sql); + +// $ExpectType string[] +parser.columnList(sql); + +// $ExpectType Error | undefined +parser.whiteListCheck(sql, ['select::null::tableA'], 'table'); diff --git a/types/node-sql-parser/tsconfig.json b/types/node-sql-parser/tsconfig.json new file mode 100644 index 0000000000..c7f24afb95 --- /dev/null +++ b/types/node-sql-parser/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-sql-parser-tests.ts" + ] +} diff --git a/types/node-sql-parser/tslint.json b/types/node-sql-parser/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/node-sql-parser/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 06261e9c3998e4080dadb903882e6415bf44e295 Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Mon, 28 Jan 2019 19:23:11 +0100 Subject: [PATCH 121/266] Added typings for Next-seo --- types/next-seo/index.d.ts | 85 ++++++++++++++++++++++++++++++++ types/next-seo/next-seo-tests.ts | 48 ++++++++++++++++++ types/next-seo/tsconfig.json | 25 ++++++++++ types/next-seo/tslint.json | 1 + 4 files changed, 159 insertions(+) create mode 100644 types/next-seo/index.d.ts create mode 100644 types/next-seo/next-seo-tests.ts create mode 100644 types/next-seo/tsconfig.json create mode 100644 types/next-seo/tslint.json diff --git a/types/next-seo/index.d.ts b/types/next-seo/index.d.ts new file mode 100644 index 0000000000..a3542c9fe9 --- /dev/null +++ b/types/next-seo/index.d.ts @@ -0,0 +1,85 @@ +// Type definitions for next-seo 1.10 +// Project: https://github.com/garmeeh/next-seo#readme +// Definitions by: Thomas Kosiewski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Component } from "react"; + +declare module "next-seo" { + interface INextSeoProps { + config: IConfig; + } + + interface IConfig { + title?: string; + titleTemplate?: string; + description?: string; + canonical?: string; + + dangerouslySetAllPagesToNoIndex?: boolean; + noindex?: boolean; + + twitter?: ITwitter; + facebook?: IFacebook; + openGraph?: IOpenGraph; + } + + interface ITwitter { + cardType?: string; + site?: string; + handle?: string; + } + + interface IFacebook { + appId?: number; + } + + interface IOpenGraph { + url?: string; + type?: string; + title?: string; + description?: string; + images?: ReadonlyArray; + defaultImageHeight?: number; + defaultImageWidth?: number; + locale?: string; + site_name?: string; + + profile?: IOpenGraphProfile; + book?: IOpenGraphBook; + article?: IOpenGraphArticle; + } + + interface IOpenGraphImages { + url?: string, + width?: number, + height?: number, + alt?: string, + } + + interface IOpenGraphProfile { + firstName?: string; + lastName?: string; + username?: string; + gender?: string; + } + + interface IOpenGraphBook { + authors?: ReadonlyArray; + isbn?: string; + releaseDate?: string; + tags?: ReadonlyArray; + } + + interface IOpenGraphArticle { + publishedTime?: string; + modifiedTime?: string; + expirationTime?: string; + + authors?: ReadonlyArray; + section?: string; + tags?: ReadonlyArray; + } + + export default class NextSeo extends Component { } +} diff --git a/types/next-seo/next-seo-tests.ts b/types/next-seo/next-seo-tests.ts new file mode 100644 index 0000000000..3c2da4b032 --- /dev/null +++ b/types/next-seo/next-seo-tests.ts @@ -0,0 +1,48 @@ +import NextSeo from 'next-seo'; + +new NextSeo({ + config: { + canonical: "", + dangerouslySetAllPagesToNoIndex: false, + description: "", + facebook: { + appId: 0, + }, + noindex: false, + openGraph: { + book: { + authors: [""], + isbn: "", + releaseDate: "", + tags: [""], + }, + defaultImageHeight: 0, + defaultImageWidth: 0, + description: "", + images: [{ + alt: "", + height: 0, + url: "", + width: 0, + }], + locale: "", + profile: { + firstName: "", + gender: "", + lastName: "", + username: "", + }, + site_name: "", + title: "", + type: "", + url: "", + }, + title: "", + titleTemplate: "", + twitter: { + cardType: "", + handle: "", + site: "", + }, + }, +}); diff --git a/types/next-seo/tsconfig.json b/types/next-seo/tsconfig.json new file mode 100644 index 0000000000..faea26b9bc --- /dev/null +++ b/types/next-seo/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "target": "es6", + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "next-seo-tests.ts" + ] +} diff --git a/types/next-seo/tslint.json b/types/next-seo/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/next-seo/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ac4b9e6cdd80c9bcda463b8024ae501cf5732cdd Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Mon, 28 Jan 2019 19:44:37 +0100 Subject: [PATCH 122/266] Next-seo: Test fixes --- types/next-seo/index.d.ts | 153 +++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 77 deletions(-) diff --git a/types/next-seo/index.d.ts b/types/next-seo/index.d.ts index a3542c9fe9..8d7c487393 100644 --- a/types/next-seo/index.d.ts +++ b/types/next-seo/index.d.ts @@ -2,84 +2,83 @@ // Project: https://github.com/garmeeh/next-seo#readme // Definitions by: Thomas Kosiewski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 import { Component } from "react"; -declare module "next-seo" { - interface INextSeoProps { - config: IConfig; - } - - interface IConfig { - title?: string; - titleTemplate?: string; - description?: string; - canonical?: string; - - dangerouslySetAllPagesToNoIndex?: boolean; - noindex?: boolean; - - twitter?: ITwitter; - facebook?: IFacebook; - openGraph?: IOpenGraph; - } - - interface ITwitter { - cardType?: string; - site?: string; - handle?: string; - } - - interface IFacebook { - appId?: number; - } - - interface IOpenGraph { - url?: string; - type?: string; - title?: string; - description?: string; - images?: ReadonlyArray; - defaultImageHeight?: number; - defaultImageWidth?: number; - locale?: string; - site_name?: string; - - profile?: IOpenGraphProfile; - book?: IOpenGraphBook; - article?: IOpenGraphArticle; - } - - interface IOpenGraphImages { - url?: string, - width?: number, - height?: number, - alt?: string, - } - - interface IOpenGraphProfile { - firstName?: string; - lastName?: string; - username?: string; - gender?: string; - } - - interface IOpenGraphBook { - authors?: ReadonlyArray; - isbn?: string; - releaseDate?: string; - tags?: ReadonlyArray; - } - - interface IOpenGraphArticle { - publishedTime?: string; - modifiedTime?: string; - expirationTime?: string; - - authors?: ReadonlyArray; - section?: string; - tags?: ReadonlyArray; - } - - export default class NextSeo extends Component { } +export interface NextSeoProps { + config: Config; } + +export interface Config { + title?: string; + titleTemplate?: string; + description?: string; + canonical?: string; + + dangerouslySetAllPagesToNoIndex?: boolean; + noindex?: boolean; + + twitter?: Twitter; + facebook?: Facebook; + openGraph?: OpenGraph; +} + +export interface Twitter { + cardType?: string; + site?: string; + handle?: string; +} + +export interface Facebook { + appId?: number; +} + +export interface OpenGraph { + url?: string; + type?: string; + title?: string; + description?: string; + images?: ReadonlyArray; + defaultImageHeight?: number; + defaultImageWidth?: number; + locale?: string; + site_name?: string; + + profile?: OpenGraphProfile; + book?: OpenGraphBook; + article?: OpenGraphArticle; +} + +export interface OpenGraphImages { + url?: string; + width?: number; + height?: number; + alt?: string; +} + +export interface OpenGraphProfile { + firstName?: string; + lastName?: string; + username?: string; + gender?: string; +} + +export interface OpenGraphBook { + authors?: ReadonlyArray; + isbn?: string; + releaseDate?: string; + tags?: ReadonlyArray; +} + +export interface OpenGraphArticle { + publishedTime?: string; + modifiedTime?: string; + expirationTime?: string; + + authors?: ReadonlyArray; + section?: string; + tags?: ReadonlyArray; +} + +export default class NextSeo extends Component { } From 0059907e00c0293e534cfe57dfd10d48679f4204 Mon Sep 17 00:00:00 2001 From: James Lawrence Date: Mon, 28 Jan 2019 18:53:34 +0000 Subject: [PATCH 123/266] Disable no-unnecessary-generics test --- types/react-jss/react-jss-tests.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-jss/react-jss-tests.tsx b/types/react-jss/react-jss-tests.tsx index 4895aa9682..0ba2ee3d8b 100644 --- a/types/react-jss/react-jss-tests.tsx +++ b/types/react-jss/react-jss-tests.tsx @@ -17,6 +17,7 @@ interface MyTheme { /** * helper function to counter typescripts type widening */ +// tslint:disable-next-line:no-unnecessary-generics function createStyles(styles: Styles): Styles { return styles as Styles; } From 16d81a789790cc86345629712444eb26623d4196 Mon Sep 17 00:00:00 2001 From: Andrew MacLeay Date: Mon, 28 Jan 2019 14:32:27 -0500 Subject: [PATCH 124/266] Allow withInfo to be used as top-level story decorator This allows the syntax [suggested by the README](https://github.com/storybooks/storybook/blob/dc38ae87bb1ef80ccd48b1695009e36632cbe5ee/addons/info/README.md#basic-usage) --- types/storybook__addon-info/index.d.ts | 6 +++++- types/storybook__addon-info/storybook__addon-info-tests.tsx | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/storybook__addon-info/index.d.ts b/types/storybook__addon-info/index.d.ts index 111f7dc54d..a6c463f5d9 100644 --- a/types/storybook__addon-info/index.d.ts +++ b/types/storybook__addon-info/index.d.ts @@ -6,7 +6,7 @@ // TypeScript Version: 2.8 import * as React from 'react'; -import { RenderFunction } from '@storybook/react'; +import { RenderFunction, StoryDecorator } from '@storybook/react'; export interface WrapStoryProps { storyFn?: RenderFunction; @@ -29,6 +29,10 @@ export interface Options { maxPropStringLength?: number; } +// TODO: it would be better to use type inference for the parameters +// type DecoratorParams = StoryDecorator extends (...a: infer A) => any ? A: never; +export function withInfo(story: RenderFunction, context: { kind: string, story: string }): ReturnType; +// Legacy, but supported export function withInfo(textOrOptions?: string | Options): (storyFn: RenderFunction) => (context?: object) => React.ReactElement; export function setDefaults(newDefaults: Options): Options; diff --git a/types/storybook__addon-info/storybook__addon-info-tests.tsx b/types/storybook__addon-info/storybook__addon-info-tests.tsx index 46fd799314..505780bf7e 100644 --- a/types/storybook__addon-info/storybook__addon-info-tests.tsx +++ b/types/storybook__addon-info/storybook__addon-info-tests.tsx @@ -1,11 +1,13 @@ /// import * as React from 'react'; -import { storiesOf } from '@storybook/react'; +import { addDecorator, storiesOf } from '@storybook/react'; import { setDefaults, withInfo } from '@storybook/addon-info'; const { Component } = React; +addDecorator(withInfo); + setDefaults({ inline: false, propTables: false From 157516ea3499d503e7f201729da2e5d7eb61a1c7 Mon Sep 17 00:00:00 2001 From: "Matt R. Wilson" Date: Mon, 28 Jan 2019 12:32:49 -0700 Subject: [PATCH 125/266] [@types/opossum] Add new CircuitBreaker.shutdown(). https://github.com/nodeshift/opossum/pull/250 --- types/opossum/index.d.ts | 4 +++- types/opossum/opossum-tests.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/opossum/index.d.ts b/types/opossum/index.d.ts index b17a1dd0be..612615ad86 100644 --- a/types/opossum/index.d.ts +++ b/types/opossum/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for opossum 1.9 +// Type definitions for opossum 1.10 // Project: https://github.com/nodeshift/opossum // Definitions by: Quinn Langille // Willy Zhang @@ -23,6 +23,7 @@ export class CircuitBreaker extends EventEmitter { readonly closed: boolean; readonly opened: boolean; readonly halfOpen: boolean; + readonly isShutdown: boolean; readonly status: Status; readonly stats: Stats; readonly hystrixStats: HystrixStats; @@ -40,6 +41,7 @@ export class CircuitBreaker extends EventEmitter { func: (...args: any[]) => Promise, interval?: number ): void; + shutdown(): void; } export enum Event { diff --git a/types/opossum/opossum-tests.ts b/types/opossum/opossum-tests.ts index ebbf0bea47..69d64497f0 100644 --- a/types/opossum/opossum-tests.ts +++ b/types/opossum/opossum-tests.ts @@ -39,6 +39,7 @@ breaker.closed; // $ExpectType boolean breaker.opened; // $ExpectType boolean breaker.halfOpen; // $ExpectType boolean breaker.warmUp; // $ExpectType boolean +breaker.isShutdown; // $ExpectType boolean breaker.volumeThreshold; // $ExpectType number breaker.status.stats.latencyMean; // $ExpectType number breaker.stats.latencyTimes; // $ExpectType number[] @@ -49,6 +50,7 @@ breaker.open(); // $ExpectType void breaker.close(); // $ExpectType void breaker.disable(); // $ExpectType void breaker.enable(); // $ExpectType void +breaker.shutdown(); // $ExpectType void // The following are examples are from the libs README and official documentation // https://nodeshift.github.io/opossum/index.html. From 78928ae025f2b796abbd4042c0c70ee15b072080 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Mon, 28 Jan 2019 11:49:26 -0800 Subject: [PATCH 126/266] [office-js] Outlook preview updates --- types/office-js/index.d.ts | 283 +++++++++++++++++++++++++++++++++++++ 1 file changed, 283 insertions(+) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index f0fee147ba..ea804993a1 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -7713,6 +7713,31 @@ declare namespace Office { */ Appointment = "appointment" } + /** + * Specifies an appointment's location type. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
+ * + * @beta + */ + enum LocationType { + /** + * A custom location. + */ + Custom = "custom", + /** + * A conference room or similar resource. + */ + ConferenceRoom = "conferenceRoom" + } /** * Specifies the month. * @@ -9367,6 +9392,173 @@ declare namespace Office { */ emailAddress: string; } + /** + * Represents the set of locations on an appointment. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
+ * + * @beta + */ + interface EnhancedLocation { + /** + * Adds to the set of locations associated with the appointment. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * In addition to this signature, this method also has the following signatures: + * + * `addAsync(locationIds: LocationIdentifier[], callback?: (result: Office.AsyncResult) => void): void;` + * + * @param locationIds The locations to be added to the current list of locations. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + addAsync(locationIds: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + /** + * Adds to the set of locations associated with the appointment. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * @param locationIds The locations to be added to the current list of locations. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + addAsync(locationIds: LocationIdentifier[], callback?: (result: Office.AsyncResult) => void): void; + /** + * Gets the set of locations associated with the appointment. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * In addition to this signature, this method also has the following signatures: + * + * `getAsync(callback?: (result: Office.AsyncResult) => void): void;` + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + /** + * Gets the set of locations associated with the appointment. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + getAsync(callback?: (result: Office.AsyncResult) => void): void; + /** + * Removes the set of locations associated with the appointment. + * + * Any included conference rooms (i.e., in the `LocationDetails` object, the `type` is **ConferenceRoom** and there is an email address) + * should be removed from the locations and the resources lists. + * + * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIds. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * In addition to this signature, this method also has the following signatures: + * + * `removeAsync(locationIds: LocationIdentifier[], callback?: (result: Office.AsyncResult) => void): void;` + * + * @param locationIds The locations to be removed from the current list of locations. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeAsync(locationIds: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + /** + * Removes the set of locations associated with the appointment. + * + * Any included conference rooms (i.e., in the `LocationDetails` object, the `type` is **ConferenceRoom** and there is an email address) + * should be removed from the locations and the resources lists. + * + * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIds. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * @param locationIds The locations to be removed from the current list of locations. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + removeAsync(locationIds: LocationIdentifier[], callback?: (result: Office.AsyncResult) => void): void; + } /** * Represents a collection of entities found in an email message or appointment. Read mode only. * @@ -9632,6 +9824,54 @@ declare namespace Office { setAsync(headers: Object, callback?: (result: Office.AsyncResult) => void): void; } + /** + * Represents a location. Read only. + * + * [Api set: Mailbox Preview] + * + * @beta + */ + export interface LocationDetails { + /** + * The location's id. + */ + locationId: LocationIdentifier; + /** + * The location's display name. + */ + displayName: string; + /** + * The email address associated with the location. + */ + emailAddress: string; + /** + * Additional properties for the location. + */ + properties: any; + } + + /** + * Represents the id of a location. + * + * [Api set: Mailbox Preview] + * + * @beta + */ + interface LocationIdentifier { + /** + * The location's unique id. + * + * For **ConferenceRoom** type, it's the room's email address. + * + * For **Custom** type, it's the displayName. + */ + id: string; + /** + * The location's type. + */ + type: MailboxEnums.LocationType; + } + /** * Represents the appointment organizer, even if an alias or a delegate was used to create the appointment. * This object provides a method to get the organizer value of an appointment in an Outlook add-in. @@ -9733,6 +9973,28 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer */ end: Time; + /** + * Gets or sets the locations of the appointment. The `enhancedLocations` property returns an {@link EnhancedLocation} object that + * provides methods to get, remove, or add locations on an item. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
+ * + * @beta + */ + enhancedLocations: EnhancedLocation; /** * Gets the type of item that an instance represents. * @@ -10820,6 +11082,27 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee */ end: Date; + /** + * Gets a set of LocationDetails objects that represents the locations of the appointment. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
+ * + * @beta + */ + enhancedLocations: LocationDetails[]; /** * Gets the Exchange Web Services item class of the selected item. * From 05763bae96de831c29ba3e052703630fe9454bb4 Mon Sep 17 00:00:00 2001 From: Krzysztof Grzybek Date: Mon, 28 Jan 2019 21:01:19 +0100 Subject: [PATCH 127/266] add text clipper --- types/text-clipper/index.d.ts | 15 +++++++++++++++ types/text-clipper/text-clipper-tests.ts | 5 +++++ types/text-clipper/tsconfig.json | 23 +++++++++++++++++++++++ types/text-clipper/tslint.json | 1 + 4 files changed, 44 insertions(+) create mode 100644 types/text-clipper/index.d.ts create mode 100644 types/text-clipper/text-clipper-tests.ts create mode 100644 types/text-clipper/tsconfig.json create mode 100644 types/text-clipper/tslint.json diff --git a/types/text-clipper/index.d.ts b/types/text-clipper/index.d.ts new file mode 100644 index 0000000000..1f86ac405b --- /dev/null +++ b/types/text-clipper/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for text-clipper 1.2 +// Project: https://github.com/arendjr/text-clipper +// Definitions by: Krzysztof Grzybek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Options { + breakWords?: boolean; + html?: boolean; + imageWeight?: number; + indicator?: string; + maxLines?: number; +} + +declare function clip(string: string, maxLength: number, options?: Options): string; +export = clip; diff --git a/types/text-clipper/text-clipper-tests.ts b/types/text-clipper/text-clipper-tests.ts new file mode 100644 index 0000000000..f4ca7e6f19 --- /dev/null +++ b/types/text-clipper/text-clipper-tests.ts @@ -0,0 +1,5 @@ +import clip = require('text-clipper'); + +clip('text', 123); // $ExpectType string +clip('text', 123, { breakWords: true, html: false }); // $ExpectType string +clip('text', 123, { imageWeight: 123, indicator: 'something', maxLines: 321 }); // $ExpectType string diff --git a/types/text-clipper/tsconfig.json b/types/text-clipper/tsconfig.json new file mode 100644 index 0000000000..caf06929bb --- /dev/null +++ b/types/text-clipper/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", + "text-clipper-tests.ts" + ] +} diff --git a/types/text-clipper/tslint.json b/types/text-clipper/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/text-clipper/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 140d0dc3e477b99a4bd1e1b6452560bfd702f35f Mon Sep 17 00:00:00 2001 From: Andrew MacLeay Date: Mon, 28 Jan 2019 15:24:13 -0500 Subject: [PATCH 128/266] @storybook/addon-notes: support global decorator Support the global decorator usage supplied in [the README](https://github.com/storybooks/storybook/blob/9f30442098e5350f5ba4872887cf9d1a03146e74/addons/ondevice-notes/README.md#getting-started) --- types/storybook__addon-notes/index.d.ts | 4 ++++ .../storybook__addon-notes/storybook__addon-notes-tests.tsx | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/storybook__addon-notes/index.d.ts b/types/storybook__addon-notes/index.d.ts index b669ce0a9c..096da8fa34 100644 --- a/types/storybook__addon-notes/index.d.ts +++ b/types/storybook__addon-notes/index.d.ts @@ -17,5 +17,9 @@ export type WithNotesOptions = string | { markdownOptions?: MarkedOptions; }; +// It would be preferable to infer the argument types, but that requires TS v 3.1 +// export function withNotes(...args: StoryDecorator extends (...a: infer A) => any ? A : never): ReturnType; +export function withNotes(story: RenderFunction, context: { kind: string, story: string }): ReturnType; +// Less-preferred but still supported: export function withNotes(options?: WithNotesOptions): StoryDecorator; export function withMarkdownNotes(markdown: string, options?: MarkedOptions): StoryDecorator; diff --git a/types/storybook__addon-notes/storybook__addon-notes-tests.tsx b/types/storybook__addon-notes/storybook__addon-notes-tests.tsx index ebf24ce227..edfe0daf14 100644 --- a/types/storybook__addon-notes/storybook__addon-notes-tests.tsx +++ b/types/storybook__addon-notes/storybook__addon-notes-tests.tsx @@ -1,8 +1,11 @@ import * as React from 'react'; -import { storiesOf } from '@storybook/react'; +import { addDecorator, storiesOf } from '@storybook/react'; import { withNotes, withMarkdownNotes, } from '@storybook/addon-notes'; +// New, preferred global registration: +addDecorator(withNotes); + const SIMPLE_MARKDOWN = ` ## Markdown for component From 739ed3b1cf86fda9b015b5dda5966fa9cdf70341 Mon Sep 17 00:00:00 2001 From: Andrew Kaiser Date: Mon, 28 Jan 2019 15:27:24 -0500 Subject: [PATCH 129/266] add variable arg function type inference, tests (#32390) --- types/better-sqlite3/better-sqlite3-tests.ts | 9 ++++++++ types/better-sqlite3/index.d.ts | 23 +++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/types/better-sqlite3/better-sqlite3-tests.ts b/types/better-sqlite3/better-sqlite3-tests.ts index dddd69bea8..f5a6c0e070 100644 --- a/types/better-sqlite3/better-sqlite3-tests.ts +++ b/types/better-sqlite3/better-sqlite3-tests.ts @@ -69,3 +69,12 @@ trans.default('name'); trans.deferred('name'); trans.immediate('name'); trans.exclusive('name'); + +const transTyped = db.transaction((param: number) => stmt.all(param)); +transTyped(1); +trans.default(1); +trans.deferred(1); +trans.immediate(1); +trans.exclusive(1); +// $ExpectError +transTyped('name'); diff --git a/types/better-sqlite3/index.d.ts b/types/better-sqlite3/index.d.ts index 2c027ff6e6..32a71d96af 100644 --- a/types/better-sqlite3/index.d.ts +++ b/types/better-sqlite3/index.d.ts @@ -4,10 +4,17 @@ // Mathew Rumsey // Santiago Aguilar // Alessandro Vergani +// Andrew Kaiser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 import Integer = require("integer"); +type VariableArgFunction = (...params: any[]) => any; +type ArgumentTypes = F extends (...args: infer A) => any + ? A + : never; + declare namespace BetterSqlite3 { interface Statement { database: Database; @@ -34,12 +41,12 @@ declare namespace BetterSqlite3 { type: string | null; } - interface Transaction { - (...params: any[]): any; - default(...params: any[]): any; - deferred(...params: any[]): any; - immediate(...params: any[]): any; - exclusive(...params: any[]): any; + interface Transaction { + (...params: ArgumentTypes): any; + default(...params: ArgumentTypes): any; + deferred(...params: ArgumentTypes): any; + immediate(...params: ArgumentTypes): any; + exclusive(...params: ArgumentTypes): any; } interface Database { @@ -50,7 +57,7 @@ declare namespace BetterSqlite3 { inTransaction: boolean; prepare(source: string): Statement; - transaction(fn: (...params: any[]) => any): Transaction; + transaction(fn: F): Transaction; exec(source: string): this; pragma(source: string, options?: Database.PragmaOptions): any; checkpoint(databaseName?: string): this; @@ -113,7 +120,7 @@ declare namespace Database { type SqliteError = typeof SqliteError; type Statement = BetterSqlite3.Statement; type ColumnDefinition = BetterSqlite3.ColumnDefinition; - type Transaction = BetterSqlite3.Transaction; + type Transaction = BetterSqlite3.Transaction; type Database = BetterSqlite3.Database; } From 680362adbb5070cba84edf2f8f8e4b8f32a50902 Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Mon, 28 Jan 2019 12:29:45 -0800 Subject: [PATCH 130/266] Allow simple form of valid test case in ruletester (#32559) --- types/eslint/eslint-tests.ts | 8 ++++++++ types/eslint/index.d.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/eslint/eslint-tests.ts b/types/eslint/eslint-tests.ts index ed211d220e..6d175716b3 100644 --- a/types/eslint/eslint-tests.ts +++ b/types/eslint/eslint-tests.ts @@ -539,4 +539,12 @@ ruleTester.run('my-rule', rule, { ] }); +ruleTester.run('simple-valid-test', rule, { + valid: [ + 'foo', + 'bar', + { code: 'foo', options: [{ allowFoo: true }] }, + ] +}); + //#endregion diff --git a/types/eslint/index.d.ts b/types/eslint/index.d.ts index 01f39ee83e..f1a585046c 100644 --- a/types/eslint/index.d.ts +++ b/types/eslint/index.d.ts @@ -540,7 +540,7 @@ export class RuleTester { name: string, rule: Rule.RuleModule, tests: { - valid?: RuleTester.ValidTestCase[]; + valid?: Array; invalid?: RuleTester.InvalidTestCase[]; }, ): void; From 2148b16febe5ff94f031de6c2ec1a616cc9b44de Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 28 Jan 2019 20:31:34 +0000 Subject: [PATCH 131/266] + detailed sql errors (#32513) --- types/mssql/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/mssql/index.d.ts b/types/mssql/index.d.ts index 891186f7ee..085ab122c1 100644 --- a/types/mssql/index.d.ts +++ b/types/mssql/index.d.ts @@ -288,6 +288,12 @@ export declare class RequestError implements Error { public name: string; public message: string; public code: string; + public number?: number; + public state?: number; + public class?: number; + public lineNumber?: number; + public serverName?: string; + public procName?: string; } export declare class Transaction extends events.EventEmitter { From 6a792386c1727436b70d9328d7e5a92155de6ca8 Mon Sep 17 00:00:00 2001 From: Dan Rumney Date: Mon, 28 Jan 2019 14:40:10 -0600 Subject: [PATCH 132/266] Add definition for `default()` method signature (#32532) * Add definition for `default()` method signature Per the documentation (https://github.com/jquense/yup#mixeddefault-any) a call to `default` with no value should return an instance of the type that the schema describes, rather than the schema itself. * Update index.d.ts Make `value` no longer optional in the `default` definition --- types/yup/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index ffba765581..9f3cb687a2 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -8,6 +8,7 @@ // Vincent Pizzo // Robert Bullen // Yusuke Sato +// Dan Rumney // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -66,7 +67,8 @@ export interface Schema { strict(isStrict: boolean): this; strip(strip: boolean): this; withMutation(fn: (current: this) => void): void; - default(value?: any): this; + default(value: any): this; + default(): T; nullable(isNullable: boolean): this; required(message?: TestOptionsMessage): this; notRequired(): this; From 480b0531a3283f79839876cc7cac4e2467c467d2 Mon Sep 17 00:00:00 2001 From: Declan Date: Mon, 28 Jan 2019 20:48:38 +0000 Subject: [PATCH 133/266] [@types/aws-lambda] Add Amazon Lex events (#32502) * [aws-lambda] Add types for Amazon Lex events * fix: Fixed Typo in `AWSLambda.LexDialogActionClose.fulfillmentState` * fix: removed a blank line --- types/aws-lambda/aws-lambda-tests.ts | 110 +++++++++++++++++++++++++++ types/aws-lambda/index.d.ts | 97 +++++++++++++++++++++++ 2 files changed, 207 insertions(+) diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 92f0a6999b..ba6ebdc5ac 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -1056,3 +1056,113 @@ const firehoseEventHandler: AWSLambda.FirehoseTransformationHandler = ( ] }); }; + +declare let lexEvent: AWSLambda.LexEvent; +lexEvent = { + currentIntent: { + name: 'intent-name', + slots: { + slot1: null, + slot2: 'value2', + }, + slotDetails: { + slot1: { + resolutions: [ + { value: 'value1' }, + ], + originalValue: 'originalValue', + } + }, + confirmationStatus: 'None', + }, + bot: { + name: 'bot name', + alias: 'bot alias', + version: 'bot version', + }, + userId: 'User ID specified in the POST request to Amazon Lex.', + inputTranscript: 'Text used to process the request', + invocationSource: 'FulfillmentCodeHook', + outputDialogMode: 'Text', + messageVersion: '1.0', + sessionAttributes: { + key1: 'value1', + key2: 'value2', + }, + requestAttributes: { + key1: 'value1', + key2: 'value2', + } +}; + +declare let lexResult: AWSLambda.LexResult; +declare let lexDialogAction: AWSLambda.LexDialogAction; +declare let lexDialogActionBase: AWSLambda.LexDialogActionBase; +declare let lexDialogActionClose: AWSLambda.LexDialogActionClose; +declare let lexDialogActionConfirmIntent: AWSLambda.LexDialogActionConfirmIntent; +declare let lexDialogActionDelegate: AWSLambda.LexDialogActionDelegate; +declare let lexDialogActionElicitIntent: AWSLambda.LexDialogActionElicitIntent; +declare let lexDialogActionElicitSlot: AWSLambda.LexDialogActionElicitSlot; +declare let lexGenericAttachment: AWSLambda.LexGenericAttachment; + +lexResult = { + sessionAttributes: { + attrib1: 'Value One', + }, + dialogAction: { + type: 'Close', + fulfillmentState: 'Failed', + }, +}; + +str = lexGenericAttachment.title; +str = lexGenericAttachment.subTitle; +str = lexGenericAttachment.imageUrl; +str = lexGenericAttachment.attachmentLinkUrl; +str = lexGenericAttachment.buttons[0].text; +str = lexGenericAttachment.buttons[0].value; + +lexDialogAction.type === 'Close'; +lexDialogAction.type === 'ConfirmIntent'; +lexDialogAction.type === 'Delegate'; +lexDialogAction.type === 'ElicitIntent'; +lexDialogAction.type === 'ElicitSlot'; + +lexDialogActionBase.message!.contentType === 'CustomPayload'; +lexDialogActionBase.message!.contentType === 'PlainText'; +lexDialogActionBase.message!.contentType === 'SSML'; +str = lexDialogActionBase.message!.content; +num = lexDialogActionBase.responseCard!.version; +lexDialogActionBase.responseCard!.contentType === 'application/vnd.amazonaws.card.generic'; +// $ExpectType LexGenericAttachment +lexDialogActionBase.responseCard!.genericAttachments[0]; + +lexDialogActionClose.type === 'Close'; +lexDialogActionClose.fulfillmentState === 'Failed'; +lexDialogActionClose.fulfillmentState === 'Fulfilled'; + +lexDialogActionConfirmIntent.type === 'ConfirmIntent'; +str = lexDialogActionConfirmIntent.intentName; +strOrNull = lexDialogActionConfirmIntent.slots['example']; + +lexDialogActionDelegate.type === 'Delegate'; +strOrNull = lexDialogActionDelegate.slots['example']; + +lexDialogActionElicitIntent.type === 'ElicitIntent'; +lexDialogActionElicitSlot.type === 'ElicitSlot'; +strOrNull = lexDialogActionElicitSlot.slots['example']; +str = lexDialogActionElicitSlot.slotToElicit; +str = lexDialogActionElicitSlot.intentName; + +const lexEventHandler: AWSLambda.LexHandler = async ( + event: AWSLambda.LexEvent, + context: AWSLambda.Context, +) => { + // $ExpectType LexEvent + event; + + // $ExpectType Context + context; + str = context.functionName; + return lexResult; +}; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 4cafe3d2da..52314529bc 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -876,6 +876,100 @@ export interface SQSMessageAttributes { [name: string]: SQSMessageAttribute; } +// Lex +// https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html#supported-event-source-lex +export interface LexEvent { + currentIntent: { + name: string; + slots: { [name: string]: string | null }; + slotDetails: LexSlotDetails; + confirmationStatus: 'None' | 'Confirmed' | 'Denied'; + }; + bot: { + name: string; + alias: string; + version: string; + }; + userId: string; + inputTranscript: string; + invocationSource: 'DialogCodeHook' | 'FulfillmentCodeHook'; + outputDialogMode: 'Text' | 'Voice'; + messageVersion: '1.0'; + sessionAttributes: { [key: string]: string }; + requestAttributes: { [key: string]: string } | null; +} + +export interface LexSlotResolution { + value: string; +} + +export interface LexSlotDetails { + [name: string]: { + // The following line only works in TypeScript Version: 3.0, The array should have at least 1 and no more than 5 items + // resolutions: [LexSlotResolution, LexSlotResolution?, LexSlotResolution?, LexSlotResolution?, LexSlotResolution?]; + resolutions: LexSlotResolution[] + originalValue: string; + }; +} + +export interface LexGenericAttachment { + title: string; + subTitle: string; + imageUrl: string; + attachmentLinkUrl: string; + buttons: Array<{ + text: string; + value: string; + }>; +} + +export interface LexDialogActionBase { + type: 'Close' | 'ElicitIntent' | 'ElicitSlot' | 'ConfirmIntent'; + message?: { + contentType: 'PlainText' | 'SSML' | 'CustomPayload'; + content: string; + }; + responseCard?: { + version: number; + contentType: 'application/vnd.amazonaws.card.generic'; + genericAttachments: LexGenericAttachment[]; + }; +} + +export interface LexDialogActionClose extends LexDialogActionBase { + type: 'Close'; + fulfillmentState: 'Fulfilled' | 'Failed'; +} + +export interface LexDialogActionElicitIntent extends LexDialogActionBase { + type: 'ElicitIntent'; +} + +export interface LexDialogActionElicitSlot extends LexDialogActionBase { + type: 'ElicitSlot'; + intentName: string; + slots: { [name: string]: string | null }; + slotToElicit: string; +} + +export interface LexDialogActionConfirmIntent extends LexDialogActionBase { + type: 'ConfirmIntent'; + intentName: string; + slots: { [name: string]: string | null }; +} + +export interface LexDialogActionDelegate { + type: 'Delegate'; + slots: { [name: string]: string | null }; +} + +export type LexDialogAction = LexDialogActionClose | LexDialogActionElicitIntent | LexDialogActionElicitSlot | LexDialogActionConfirmIntent | LexDialogActionDelegate; + +export interface LexResult { + sessionAttributes?: { [key: string]: string }; + dialogAction: LexDialogAction; +} + /** * AWS Lambda handler function. * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html @@ -938,6 +1032,9 @@ export type ScheduledHandler = Handler; // TODO: Alexa +export type LexHandler = Handler; +export type LexCallback = Callback; + export type APIGatewayProxyHandler = Handler; export type APIGatewayProxyCallback = Callback; export type ProxyHandler = APIGatewayProxyHandler; // Old name From e76fa57bc07c57af2f8bc305b17a4a8c482a8553 Mon Sep 17 00:00:00 2001 From: Corban Brook Date: Mon, 28 Jan 2019 15:50:45 -0500 Subject: [PATCH 134/266] Added missing userData to BufferGeometry (#32533) --- types/three/three-core.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 639fba5ba5..4866cbfd54 100755 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -867,6 +867,7 @@ export class BufferGeometry extends EventDispatcher { boundingBox: Box3; boundingSphere: Sphere; drawRange: { start: number, count: number }; + userData: {[key: string]: any}; getIndex(): BufferAttribute; setIndex( index: BufferAttribute|number[] ): void; From f42e2acfbfeda3ed3d183ad00e6b958a5bfe0574 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 28 Jan 2019 12:54:16 -0800 Subject: [PATCH 135/266] Fix jsforce definitions --- types/jsforce/api/chatter.d.ts | 6 +----- types/jsforce/api/metadata.d.ts | 6 +----- types/jsforce/jsforce-tests.ts | 6 +++--- types/jsforce/tslint.json | 1 + 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/types/jsforce/api/chatter.d.ts b/types/jsforce/api/chatter.d.ts index c712187559..4b65740f36 100644 --- a/types/jsforce/api/chatter.d.ts +++ b/types/jsforce/api/chatter.d.ts @@ -27,7 +27,7 @@ interface RequestParams { export class RequestResult { } -export class Request implements Promise { +export class Request implements PromiseLike { constructor(chatter: Chatter, params: RequestParams); batchParams(): BatchRequestParams; @@ -36,16 +36,12 @@ export class Request implements Promise { stream(): Stream; - catch(onrejected?: ((reason: any) => (PromiseLike | TResult)) | null | undefined): Promise; - then(onfulfilled?: ((value: T) => (PromiseLike | TResult1)) | null | undefined, onrejected?: ((reason: any) => (PromiseLike | TResult2)) | null | undefined): Promise; finally(onfinally?: () => void): Promise; thenCall(callback?: (err: Error, records: T) => void): Query; - - readonly [Symbol.toStringTag]: 'Promise'; } export class Resource extends Request { diff --git a/types/jsforce/api/metadata.d.ts b/types/jsforce/api/metadata.d.ts index c6aec12e7e..88dbdaa52d 100644 --- a/types/jsforce/api/metadata.d.ts +++ b/types/jsforce/api/metadata.d.ts @@ -112,21 +112,17 @@ interface DeployOptions { singlePackage?: boolean; } -export class AsyncResultLocator extends EventEmitter implements Promise { +export class AsyncResultLocator extends EventEmitter implements PromiseLike { check(callback?: Callback): Promise complete(callback?: Callback): Promise poll(interval: number, timeout: number): void; - catch(onrejected?: ((reason: any) => (PromiseLike | TResult)) | null | undefined): Promise; - then(onfulfilled?: ((value: T) => (PromiseLike | TResult1)) | null | undefined, onrejected?: ((reason: any) => (PromiseLike | TResult2)) | null | undefined): Promise; finally(onfinally?: () => void): Promise; - - readonly [Symbol.toStringTag]: "Promise"; } export class DeployResultLocator extends AsyncResultLocator {} diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts index 08ea888062..45442b91dc 100644 --- a/types/jsforce/jsforce-tests.ts +++ b/types/jsforce/jsforce-tests.ts @@ -615,7 +615,7 @@ async function testChatter(conn: sf.Connection): Promise { const feedResource: sf.Resource = chatter.resource('/feed-elements'); - const feedCreateRequest: any = await (feedResource.create({ + const feedCreateRequest: any = await feedResource.create({ body: { messageSegments: [{ type: 'Text', @@ -624,13 +624,13 @@ async function testChatter(conn: sf.Connection): Promise { }, feedElementType: 'FeedItem', subjectId: 'me' - }) as Promise); + }); console.log(`feedCreateRequest.id: ${feedCreateRequest.id}`); const itemLikesUrl = `/feed-elements/${feedCreateRequest.id}/capabilities/chatter-likes/items`; const itemsLikeResource: sf.Resource = chatter.resource(itemLikesUrl); - const itemsLikeCreateResult: sf.RequestResult = await (itemsLikeResource.create('') as Promise); + const itemsLikeCreateResult: sf.RequestResult = await itemsLikeResource.create(''); console.log(`itemsLikeCreateResult['likedItem']: ${itemsLikeCreateResult as any['likedItem']}`); } diff --git a/types/jsforce/tslint.json b/types/jsforce/tslint.json index 43829466b8..12201695b9 100644 --- a/types/jsforce/tslint.json +++ b/types/jsforce/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "array-type": false, + "await-promise": [true, "Request"], "ban-types": false, "eofline": false, "max-line-length": false, From 18d3e314ea092b6fabf6225b8a69e40e3aba8b77 Mon Sep 17 00:00:00 2001 From: Zain Afzal Date: Wed, 23 Jan 2019 15:41:39 +1100 Subject: [PATCH 136/266] Fixed Label Rendering callback in react-json-tree --- types/react-json-tree/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/react-json-tree/index.d.ts b/types/react-json-tree/index.d.ts index d0ab7cab62..600de66fb8 100644 --- a/types/react-json-tree/index.d.ts +++ b/types/react-json-tree/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-json-tree v0.6.5 +// Type definitions for react-json-tree v0.6.6 // Project: https://github.com/alexkuz/react-json-tree/ // Definitions by: Grant Nestor +// Zain Afzal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -18,7 +19,7 @@ export interface JSONTreeProps extends Props { sortObjectKeys?: Function | boolean; shouldExpandNode?: (keyPath: (string | number)[], data: [any] | {}, level: number) => boolean; getItemString?: (type: string, data: [any] | {}, itemType: string, itemString: string) => JSX.Element; - labelRenderer?: (raw: [string, string]) => JSX.Element; + labelRenderer?: (keyPath: string[], nodeType: string, expanded: boolean, expandable: boolean) => JSX.Element; valueRenderer?: (displayValue: string|number, rawValue?: string|number|boolean|null, ...keyPath: (string|number)[]) => JSX.Element; postprocessValue?: (raw: string) => JSX.Element; isCustomNode?: () => boolean; From d74ed1acba85573440e78cff4a57c8c7386cc4e0 Mon Sep 17 00:00:00 2001 From: Zain Afzal Date: Wed, 23 Jan 2019 15:48:34 +1100 Subject: [PATCH 137/266] Make paramaters after keyPath optional --- types/react-json-tree/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-json-tree/index.d.ts b/types/react-json-tree/index.d.ts index 600de66fb8..6fc37c4941 100644 --- a/types/react-json-tree/index.d.ts +++ b/types/react-json-tree/index.d.ts @@ -19,7 +19,7 @@ export interface JSONTreeProps extends Props { sortObjectKeys?: Function | boolean; shouldExpandNode?: (keyPath: (string | number)[], data: [any] | {}, level: number) => boolean; getItemString?: (type: string, data: [any] | {}, itemType: string, itemString: string) => JSX.Element; - labelRenderer?: (keyPath: string[], nodeType: string, expanded: boolean, expandable: boolean) => JSX.Element; + labelRenderer?: (keyPath: string[], nodeType?: string, expanded?: boolean, expandable?: boolean) => JSX.Element; valueRenderer?: (displayValue: string|number, rawValue?: string|number|boolean|null, ...keyPath: (string|number)[]) => JSX.Element; postprocessValue?: (raw: string) => JSX.Element; isCustomNode?: () => boolean; From 409fc7fb164367a80c75efa02c97877c9511bf22 Mon Sep 17 00:00:00 2001 From: Zain Afzal Date: Tue, 29 Jan 2019 07:54:29 +1100 Subject: [PATCH 138/266] Fixed header --- types/react-json-tree/index.d.ts | 2 +- types/react-json-tree/tslint.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/types/react-json-tree/index.d.ts b/types/react-json-tree/index.d.ts index 6fc37c4941..c57cdd3d51 100644 --- a/types/react-json-tree/index.d.ts +++ b/types/react-json-tree/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-json-tree v0.6.6 +// Type definitions for react-json-tree 0.6 // Project: https://github.com/alexkuz/react-json-tree/ // Definitions by: Grant Nestor // Zain Afzal diff --git a/types/react-json-tree/tslint.json b/types/react-json-tree/tslint.json index e3610fefae..92d14c6344 100644 --- a/types/react-json-tree/tslint.json +++ b/types/react-json-tree/tslint.json @@ -7,7 +7,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, From d9673b8dffa261050a88a47450cb91d217d84e15 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 28 Jan 2019 13:24:20 -0800 Subject: [PATCH 139/266] Fix dependency for chai-webdriverio --- types/chai-webdriverio/package.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 types/chai-webdriverio/package.json diff --git a/types/chai-webdriverio/package.json b/types/chai-webdriverio/package.json new file mode 100644 index 0000000000..cd495fe983 --- /dev/null +++ b/types/chai-webdriverio/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "@types/webdriverio": "^4.0.0" + } +} From 17e7655380cfea842802eacc8e999331b9e9f814 Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Mon, 21 Jan 2019 15:29:51 -0500 Subject: [PATCH 140/266] Added possibility to pass array to SpaceProps Remove all disabled rules in `tslint.json`. It means all rules are now active. --- types/rebass/index.d.ts | 62 +++++++++++++--------------- types/rebass/rebass-tests.tsx | 10 ++--- types/rebass/tslint.json | 78 +---------------------------------- 3 files changed, 34 insertions(+), 116 deletions(-) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index f05d136f69..0536a600ee 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Rebass 0.3.8 +// Type definitions for Rebass 3.0 // Project: https://github.com/jxnblk/rebass -// Definitions by: rhysd +// Definitions by: rhysd // ryee-dev // jamesmckenzie // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,32 +14,33 @@ export interface BaseProps extends React.ClassAttributes { } export interface SpaceProps extends BaseProps { - m?: number | string; - mt?: number | string; - mr?: number | string; - mb?: number | string; - ml?: number | string; - mx?: number | string; - my?: number | string; - p?: number | string; - pt?: number | string; - pr?: number | string; - pb?: number | string; - pl?: number | string; - px?: number | string; - py?: number | string; + m?: number | string | ReadonlyArray; + mt?: number | string | ReadonlyArray; + mr?: number | string | ReadonlyArray; + mb?: number | string | ReadonlyArray; + ml?: number | string | ReadonlyArray; + mx?: number | string | ReadonlyArray; + my?: number | string | ReadonlyArray; + p?: number | string | ReadonlyArray; + pt?: number | string | ReadonlyArray; + pr?: number | string | ReadonlyArray; + pb?: number | string | ReadonlyArray; + pl?: number | string | ReadonlyArray; + px?: number | string | ReadonlyArray; + py?: number | string | ReadonlyArray; } export interface BoxProps extends SpaceProps { className?: string; width?: number | string | ReadonlyArray; fontSize?: number | ReadonlyArray; - css?: Object; + css?: object; color?: string; bg?: string; } -type BoxClass = React.StatelessComponent; -export declare const Box: BoxClass; +// tslint:disable-next-line:strict-export-declare-modifiers +type BoxClass = React.FunctionComponent; +export const Box: BoxClass; export interface ButtonProps extends BoxProps { fontWeight?: string; @@ -48,8 +49,7 @@ export interface ButtonProps extends BoxProps { borderRadius?: number | string; variant?: string; } -type ButtonClass = React.StatelessComponent; -export declare const Button: ButtonClass; +export const Button: React.FunctionComponent; export interface CardProps extends BoxProps { border?: number | string; @@ -63,8 +63,7 @@ export interface CardProps extends BoxProps { opacity?: number; variant?: string; } -type CardClass = React.StatelessComponent; -export declare const Card: CardClass; +export const Card: React.FunctionComponent; export interface FlexProps extends BoxProps { alignItems?: string; @@ -72,8 +71,7 @@ export interface FlexProps extends BoxProps { flexDirection?: string; flexWrap?: string; } -type FlexClass = React.StatelessComponent; -export declare const Flex: FlexClass; +export const Flex: React.FunctionComponent; export interface ImageProps extends BoxProps { height?: number | string; @@ -81,14 +79,12 @@ export interface ImageProps extends BoxProps { src?: string; alt?: string; } -type ImageClass = React.StatelessComponent; -export declare const Image: ImageClass; +export const Image: React.FunctionComponent; export interface LinkProps extends BoxProps { href?: string; } -type LinkClass = React.StatelessComponent; -export declare const Link: LinkClass; +export const Link: React.FunctionComponent; export interface TextProps extends BoxProps { fontSize?: number | ReadonlyArray; @@ -99,9 +95,7 @@ export interface TextProps extends BoxProps { lineHeight?: number | string; letterSpacing?: number | string; } -type TextClass = React.StatelessComponent; -export declare const Text: TextClass; +export const Text: React.FunctionComponent; -export interface HeadingProps extends TextProps {} -type HeadingClass = React.StatelessComponent; -export declare const Heading: HeadingClass; +export type HeadingProps = TextProps; +export const Heading: React.FunctionComponent; diff --git a/types/rebass/rebass-tests.tsx b/types/rebass/rebass-tests.tsx index fb0eae1ed4..53735775ff 100644 --- a/types/rebass/rebass-tests.tsx +++ b/types/rebass/rebass-tests.tsx @@ -1,8 +1,8 @@ -import * as React from 'react' -import { Box, Flex, Text, Heading, Button, Link, Image, Card } from 'rebass' +import * as React from 'react'; +import { Box, Flex, Text, Heading, Button, Link, Image, Card } from 'rebass'; -const RebassTests = () => ( - +() => ( + Hi, I'm a heading. @@ -32,4 +32,4 @@ const RebassTests = () => ( -) +); diff --git a/types/rebass/tslint.json b/types/rebass/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/rebass/tslint.json +++ b/types/rebass/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 c2627760b9a77adb447524da1fca719cda319987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20D=C3=BCfel?= Date: Mon, 28 Jan 2019 22:07:58 +0100 Subject: [PATCH 141/266] Add type definitions for fastify-rate-limit --- .../fastify-rate-limit-tests.ts | 22 ++++++ types/fastify-rate-limit/index.d.ts | 74 +++++++++++++++++++ types/fastify-rate-limit/package.json | 6 ++ types/fastify-rate-limit/tsconfig.json | 21 ++++++ types/fastify-rate-limit/tslint.json | 1 + 5 files changed, 124 insertions(+) create mode 100644 types/fastify-rate-limit/fastify-rate-limit-tests.ts create mode 100644 types/fastify-rate-limit/index.d.ts create mode 100644 types/fastify-rate-limit/package.json create mode 100644 types/fastify-rate-limit/tsconfig.json create mode 100644 types/fastify-rate-limit/tslint.json diff --git a/types/fastify-rate-limit/fastify-rate-limit-tests.ts b/types/fastify-rate-limit/fastify-rate-limit-tests.ts new file mode 100644 index 0000000000..ee79951f48 --- /dev/null +++ b/types/fastify-rate-limit/fastify-rate-limit-tests.ts @@ -0,0 +1,22 @@ +import fastifyRateLimit = require("fastify-rate-limit"); +import * as IORedis from 'ioredis'; +import { FastifyRequest, DefaultQuery } from "fastify"; +import { IncomingMessage } from "http"; + +fastifyRateLimit(); + +const fastifyRateLimitOptions: fastifyRateLimit.FastifyRateLimitOptions> = { + max: 3, + timeWindow: 5000, + cache: 10000, + whitelist: ['127.0.0.1'], + redis: new IORedis({ host: '127.0.0.1' }), + skipOnError: true, // default false + keyGenerator: (req) => { + return req.headers['x-real-ip'] + || req.headers['x-client-ip'] + || req.headers['x-forwarded-for'] + || req.params.test + || req.ip; + }, +}; diff --git a/types/fastify-rate-limit/index.d.ts b/types/fastify-rate-limit/index.d.ts new file mode 100644 index 0000000000..888611ad72 --- /dev/null +++ b/types/fastify-rate-limit/index.d.ts @@ -0,0 +1,74 @@ +// Type definitions for fastify-rate-limit 2.0 +// Project: https://github.com/fastify/fastify-rate-limit#readme +// Definitions by: Christian D +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Redis } from "ioredis"; +import { FastifyRequest } from "fastify"; +import { IncomingMessage } from "http"; + +declare function fastifyRateLimit(): void; + +declare namespace fastifyRateLimit { + interface FastifyRateLimitOptions> { + /** + * Is the maximum number of requests a single client can perform inside a + * timeWindow. + * + * default: 1000 + */ + max?: number; + + /** + * The duration of the time window, can be expressed in milliseconds (as a + * number) or as a string, see ms too see the supported formats + * + * default: 1000 * 60 + */ + timeWindow?: number; + + /** + * This plugin internally uses a lru cache to handle the clients, you can + * change the size of the cache with this option. + * + * default: 5000 + */ + cache?: number; + + /** + * Array of string of ips to exclude from rate limiting. + * + * default: [] + */ + whitelist?: string[]; + + /** + * By default this plugins uses an in-memory store, which is fast but if + * you application works on more than one server it is useless, since the + * data is store locally. You can pass a Redis client here and magically + * the issue is solved. To achieve the maximum speed, this plugins requires + * the use of ioredis. + * + * default: null + */ + redis?: Redis; + + /** + * If `true` it will skip errors generated by the storage (eg, redis not + * reachable). + * + * default: false + */ + skipOnError?: boolean; + + /** + * Function to generate a unique identifier for each incoming request. + * + * default: (req) => req.ip + */ + keyGenerator?: (req: T) => string; + } +} + +export = fastifyRateLimit; diff --git a/types/fastify-rate-limit/package.json b/types/fastify-rate-limit/package.json new file mode 100644 index 0000000000..e8c68ab969 --- /dev/null +++ b/types/fastify-rate-limit/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "fastify": "^1.11.2" + } +} diff --git a/types/fastify-rate-limit/tsconfig.json b/types/fastify-rate-limit/tsconfig.json new file mode 100644 index 0000000000..5dc0e91ea2 --- /dev/null +++ b/types/fastify-rate-limit/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "fastify-rate-limit-tests.ts"], + "exclude": ["node-modules"] +} diff --git a/types/fastify-rate-limit/tslint.json b/types/fastify-rate-limit/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/fastify-rate-limit/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 407d5f293810dc070c61172f75b31f8565bcafed Mon Sep 17 00:00:00 2001 From: Akshay Karthik Date: Mon, 28 Jan 2019 14:50:26 -0500 Subject: [PATCH 142/266] [moo] Add type definitions for keywords value transform --- types/moo/index.d.ts | 19 +++++++++++++++---- types/moo/moo-tests.ts | 9 +++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/types/moo/index.d.ts b/types/moo/index.d.ts index fd53f98e0a..2dd1a4b4db 100644 --- a/types/moo/index.d.ts +++ b/types/moo/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for moo 0.4 +// Type definitions for moo 0.5 // Project: https://github.com/tjvr/moo#readme // Definitions by: Nikita Litvin // Jörg Vehlow @@ -11,6 +11,15 @@ export as namespace moo; */ export const error: { error: true }; +/** + * Reserved token for indicating a fallback rule. + */ +export const fallback: { fallback: true }; + +export type TypeMapper = (x: string) => string; + +export function keywords(kws: {[k: string]: string | string[]}): TypeMapper; + export function compile(rules: Rules): Lexer; export function states(states: {[x: string]: Rules}, start?: string): Lexer; @@ -45,9 +54,11 @@ export interface Rule { */ value?: (x: string) => string; - keywords?: { - [x: string]: string | string[] - }; + /** + * Used for mapping one set of types to another. + * See https://github.com/no-context/moo#keywords for an example + */ + type?: TypeMapper; } export interface Rules { [x: string]: RegExp | string | string[] | Rule | Rule[]; diff --git a/types/moo/moo-tests.ts b/types/moo/moo-tests.ts index c82bedd219..5cb9fa6f5b 100644 --- a/types/moo/moo-tests.ts +++ b/types/moo/moo-tests.ts @@ -20,20 +20,21 @@ lexer = moo.compile({ lexer = moo.compile({ IDEN: { - match: /[a-zA-Z]+/, keywords: { + match: /[a-zA-Z]+/, + type: moo.keywords({ KW: ['while', 'if', 'else', 'moo', 'reloacows'] - } + }) }, SPACE: { match: /\s+/, lineBreaks: true } }); lexer = moo.compile({ name: { - match: /[a-zA-Z]+/, keywords: { + match: /[a-zA-Z]+/, type: moo.keywords({ 'kw-class': 'class', 'kw-def': 'def', 'kw-if': 'if', - } + }) } }); From 892d33de44507c96f13eea2ab1b6605f19771929 Mon Sep 17 00:00:00 2001 From: Sebastian Vera Date: Mon, 28 Jan 2019 23:33:22 +0100 Subject: [PATCH 143/266] Add type definitions for @mapbox/s3urls --- types/mapbox__s3urls/index.d.ts | 33 ++++++++++++++++++++ types/mapbox__s3urls/mapbox__s3urls-tests.ts | 15 +++++++++ types/mapbox__s3urls/tsconfig.json | 19 +++++++++++ types/mapbox__s3urls/tslint.json | 1 + 4 files changed, 68 insertions(+) create mode 100644 types/mapbox__s3urls/index.d.ts create mode 100644 types/mapbox__s3urls/mapbox__s3urls-tests.ts create mode 100644 types/mapbox__s3urls/tsconfig.json create mode 100644 types/mapbox__s3urls/tslint.json diff --git a/types/mapbox__s3urls/index.d.ts b/types/mapbox__s3urls/index.d.ts new file mode 100644 index 0000000000..523cb0fc07 --- /dev/null +++ b/types/mapbox__s3urls/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for mapbox__s3urls 1.5 +// Project: https://github.com/mapbox/s3urls +// Definitions by: Sebastian Vera +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// tslint:disable-next-line no-single-declare-module +declare module "@mapbox/s3urls" { + function fromUrl( + url: string + ): { Bucket: string | undefined; Key: string | undefined }; + + function toUrl( + bucket: string, + key: string + ): { + s3: string; + "bucket-in-path": string; + "bucket-in-host": string; + }; + + function convert( + url: string, + to: "s3" | "bucket-in-path" | "bucket-in-host" + ): string; + + function signed( + url: string, + expires: number, + cb: (err: Error | undefined, url: string) => void + ): void; + + function valid(url: string): boolean; +} diff --git a/types/mapbox__s3urls/mapbox__s3urls-tests.ts b/types/mapbox__s3urls/mapbox__s3urls-tests.ts new file mode 100644 index 0000000000..7a50fdcfac --- /dev/null +++ b/types/mapbox__s3urls/mapbox__s3urls-tests.ts @@ -0,0 +1,15 @@ +import * as s3urls from "@mapbox/s3urls"; + +s3urls.toUrl("bucket", "key"); // $ExpectType { s3: string; "bucket-in-path": string; "bucket-in-host": string; } +s3urls.toUrl("bucket", "key")["s3"]; // $ExpectType string +s3urls.toUrl("bucket", "key")["bucket-in-host"]; // $ExpectType string +s3urls.toUrl("bucket", "key")["bucket-in-path"]; // $ExpectType string + +s3urls.valid("s3://bucket/key"); // $ExpectType boolean +s3urls.valid("invalid"); // $ExpectType boolean + +s3urls.convert("s3://bucket/key", "s3"); // $ExpectType string +s3urls.convert("s3://bucket/key", "bucket-in-path"); // $ExpectType string +s3urls.convert("s3://bucket/key", "bucket-in-host"); // $ExpectType string + +s3urls.fromUrl("s3://bucket/key"); // $ExpectType object diff --git a/types/mapbox__s3urls/tsconfig.json b/types/mapbox__s3urls/tsconfig.json new file mode 100644 index 0000000000..9c3d217340 --- /dev/null +++ b/types/mapbox__s3urls/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "paths": { + "@mapbox/s3urls": ["mapbox__s3urls"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "mapbox__s3urls-tests.ts"] +} diff --git a/types/mapbox__s3urls/tslint.json b/types/mapbox__s3urls/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mapbox__s3urls/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a501301d9d940abb3c387effc2e7c19650da6542 Mon Sep 17 00:00:00 2001 From: Luuk Sommers Date: Mon, 28 Jan 2019 23:43:05 +0100 Subject: [PATCH 144/266] webpack-env: Fix missing mode argument in require.context --- types/webpack-env/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index d9047f965e..0fde1243f4 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -32,7 +32,7 @@ declare namespace __WebpackModuleApi { * This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used. */ ensure(paths: string[], callback: (require: NodeRequire) => void, errorCallback?: (error: any) => void, chunkName?: string): void; - context(path: string, deep?: boolean, filter?: RegExp): RequireContext; + context(path: string, deep?: boolean, filter?: RegExp, mode?: string): RequireContext; /** * Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. * From 28628363db3b4e6a4cd021b0e338ed2b59d16641 Mon Sep 17 00:00:00 2001 From: Ruslan Hrabovyi Date: Tue, 29 Jan 2019 00:52:25 +0200 Subject: [PATCH 145/266] [@ember/string] Use type predicate as "isHTMLSafe" result --- types/ember__string/ember__string-tests.ts | 10 +++++++++- types/ember__string/index.d.ts | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/types/ember__string/ember__string-tests.ts b/types/ember__string/ember__string-tests.ts index 1f045b849d..500c67546e 100644 --- a/types/ember__string/ember__string-tests.ts +++ b/types/ember__string/ember__string-tests.ts @@ -1,4 +1,4 @@ -import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w } from '@ember/string'; +import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w, isHTMLSafe } from '@ember/string'; import { SafeString } from 'handlebars'; dasherize(); // $ExpectError @@ -36,3 +36,11 @@ loc("_Hello %@ %@", ["John", "Smith"]); // $ExpectType string const handlebarsSafeString: SafeString = htmlSafe('lorem ipsum...'); htmlSafe('lorem ipsum...'); // $ExpectType SafeString const regularString: string = htmlSafe('lorem ipsum...'); // $ExpectError + +function isSafeTest(a: string|Handlebars.SafeString) { + if (isHTMLSafe(a)) { + a = a.toString(); + } + + camelize(a); +} diff --git a/types/ember__string/index.d.ts b/types/ember__string/index.d.ts index 8a2a46c022..66b5199bfd 100644 --- a/types/ember__string/index.d.ts +++ b/types/ember__string/index.d.ts @@ -11,8 +11,8 @@ export function capitalize(str: string): string; export function classify(str: string): string; export function dasherize(str: string): string; export function decamelize(str: string): string; -export function htmlSafe(str: string): Handlebars.SafeString; -export function isHTMLSafe(str: string): boolean; +export function htmlSafe(str: string): SafeString; +export function isHTMLSafe(str: any): str is SafeString; export function loc(template: string, args?: string[]): string; export function underscore(str: string): string; export function w(str: string): string[]; From 71bd0ba07bc8a99bd413d5c631f0daefb72014c1 Mon Sep 17 00:00:00 2001 From: Dan <32849715+ddangelo-shoprunner@users.noreply.github.com> Date: Mon, 28 Jan 2019 18:11:49 -0500 Subject: [PATCH 146/266] auth0-js - Including optional props AuthorizeOptions - acccessType; approvalPrompt (#32520) * Including optional properties AuthorizeOptions - acccessType; approvalForce auth-0.js actually forwards any param you send it (minus a specific black list). Auth0 Support and Community use these optional params, although they are not specifically called out in the Auth0 API documentation. Auth0 Support and Community even specify these are needed especially to get Google refresh_tokens (vie email Support Ticket, as well as the Community link below) https://community.auth0.com/t/cant-get-google-refresh-token-using-auth0-js/11756 * Corrected to use field approvalPrompt * fixed typo --- types/auth0-js/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index a38c928333..f2cc95105c 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -812,6 +812,8 @@ export interface AuthorizeOptions { login_hint?: string; prompt?: string; mode?: "login" | "signUp"; + acccessType?: string; + approvalPrompt?: string; } export interface CheckSessionOptions extends AuthorizeOptions { From 78feba777260833b6e8a328c7ed8888bb6580849 Mon Sep 17 00:00:00 2001 From: Borewit Date: Tue, 29 Jan 2019 00:14:15 +0100 Subject: [PATCH 147/266] Needle: export NeedleResponse (#32535) * Export NeedleResponse * simply 'NeedleResponse' type test, get rid of function --- types/needle/index.d.ts | 1 + types/needle/needle-tests.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/needle/index.d.ts b/types/needle/index.d.ts index 509e212c6e..af879cfacc 100644 --- a/types/needle/index.d.ts +++ b/types/needle/index.d.ts @@ -247,6 +247,7 @@ declare namespace needle { export type NeedleCallback = core.NeedleCallback; export type NeedleHttpVerbs = core.NeedleHttpVerbs; export type NeedleOptions = core.NeedleOptions; + export type NeedleResponse = core.NeedleResponse; export type ReadableStream = core.ReadableStream; /** diff --git a/types/needle/needle-tests.ts b/types/needle/needle-tests.ts index a216b1f686..fac7efa58c 100644 --- a/types/needle/needle-tests.ts +++ b/types/needle/needle-tests.ts @@ -73,14 +73,18 @@ function API_head() { function API_get() { // using promises + let resp: needle.NeedleResponse; + needle('get', 'google.com/search?q=syd+barrett') - .then((resp) => { + .then((_resp) => { // if no http:// is found, Needle will automagically prepend it. + resp = _resp; }); // using callback - needle.get('google.com/search?q=syd+barrett', (err, resp) => { + needle.get('google.com/search?q=syd+barrett', (err, _resp) => { // if no http:// is found, Needle will automagically prepend it. + resp = _resp; // assign response }); } From 4a91c57f19a024a9c273e5151bd482eca4fd44b4 Mon Sep 17 00:00:00 2001 From: AntoineC Date: Tue, 29 Jan 2019 00:16:51 +0100 Subject: [PATCH 148/266] Add Settings interface (#32352) Add test for settings on paper and new created PaperScope instance --- types/paper/index.d.ts | 48 +++++++++++++++++--------------------- types/paper/paper-tests.ts | 4 ++++ 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 6c1f2979fb..08a6d794ad 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -21,26 +21,7 @@ declare module paper { /** * Gives access to paper's configurable settings. */ - export var settings: { - - /** - * controls whether newly created items are automatically inserted into the scene graph, by adding them to project.activeLayer — default: true - */ - insertItems: boolean; - /** - * controls what value newly created items have their item.applyMatrix property set to (Note that not all items can set this to false) — default: true - */ - applyMatrix: boolean; - /** - * the size of the curve handles when drawing selections — default: 4 - */ - handleSize: number; - /* - * the default tolerance for hit- tests, when no value is specified — default: 0 - */ - hitTolerance: number; - - }; + export var settings: Settings; /** * The currently active project. @@ -1163,13 +1144,7 @@ declare module paper { /** * Gives access to paper's configurable settings. */ - settings: { - - applyMatrix: boolean; - handleSize: number; - hitTolerance: number; - - }; + settings: Settings; /** * The currently active project. @@ -5481,6 +5456,25 @@ declare module paper { type: 'mousedown' | 'mouseup' | 'mousedrag' | 'click' | 'doubleclick' | 'mousemove' | 'mouseenter' | 'mouseleave'; } + + export interface Settings { + /** + * controls whether newly created items are automatically inserted into the scene graph, by adding them to project.activeLayer — default: true + */ + insertItems: boolean; + /** + * controls what value newly created items have their item.applyMatrix property set to (Note that not all items can set this to false) — default: true + */ + applyMatrix: boolean; + /** + * the size of the curve handles when drawing selections — default: 4 + */ + handleSize: number; + /* + * the default tolerance for hit- tests, when no value is specified — default: 0 + */ + hitTolerance: number; + } } declare module 'paper' diff --git a/types/paper/paper-tests.ts b/types/paper/paper-tests.ts index 1d1bc32abe..280b68c0e9 100644 --- a/types/paper/paper-tests.ts +++ b/types/paper/paper-tests.ts @@ -81,6 +81,10 @@ hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsInterfaceFull) paper.view.scaling = new paper.Point(1, 1); +paper.settings.insertItems = true +const paperScope = new paper.PaperScope(); +paperScope.settings.insertItems = false; + function Examples() { function BooleanOperations(){ let text = new paper.PointText({ From 9111fc377a85d84837d51f5096802669021cc9d0 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Mon, 28 Jan 2019 23:17:53 +0000 Subject: [PATCH 149/266] [vinyl-fs] Add v0.3 and v1.0... Fix tslint rules and tests --- types/vinyl-fs/tslint.json | 5 +---- types/vinyl-fs/v0/tslint.json | 5 +---- types/vinyl-fs/v0/vinyl-fs-tests.ts | 6 +++--- types/vinyl-fs/v1/tslint.json | 5 +---- types/vinyl-fs/v1/vinyl-fs-tests.ts | 14 +++++++------- types/vinyl-fs/vinyl-fs-tests.ts | 14 +++++++------- 6 files changed, 20 insertions(+), 29 deletions(-) diff --git a/types/vinyl-fs/tslint.json b/types/vinyl-fs/tslint.json index f2821adb2b..f93cf8562a 100644 --- a/types/vinyl-fs/tslint.json +++ b/types/vinyl-fs/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-object-literal-type-assertion": false - } + "extends": "dtslint/dt.json" } diff --git a/types/vinyl-fs/v0/tslint.json b/types/vinyl-fs/v0/tslint.json index f2821adb2b..f93cf8562a 100644 --- a/types/vinyl-fs/v0/tslint.json +++ b/types/vinyl-fs/v0/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-object-literal-type-assertion": false - } + "extends": "dtslint/dt.json" } diff --git a/types/vinyl-fs/v0/vinyl-fs-tests.ts b/types/vinyl-fs/v0/vinyl-fs-tests.ts index b6aa418130..4d0316a0a0 100644 --- a/types/vinyl-fs/v0/vinyl-fs-tests.ts +++ b/types/vinyl-fs/v0/vinyl-fs-tests.ts @@ -383,7 +383,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -424,7 +424,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: contentStream, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -467,7 +467,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: null, - stat: { + stat: { isDirectory: () => true, mode: expectedMode } as fs.Stats diff --git a/types/vinyl-fs/v1/tslint.json b/types/vinyl-fs/v1/tslint.json index f2821adb2b..f93cf8562a 100644 --- a/types/vinyl-fs/v1/tslint.json +++ b/types/vinyl-fs/v1/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-object-literal-type-assertion": false - } + "extends": "dtslint/dt.json" } diff --git a/types/vinyl-fs/v1/vinyl-fs-tests.ts b/types/vinyl-fs/v1/vinyl-fs-tests.ts index aac3c4f49e..5b29b0465d 100644 --- a/types/vinyl-fs/v1/vinyl-fs-tests.ts +++ b/types/vinyl-fs/v1/vinyl-fs-tests.ts @@ -383,7 +383,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -424,7 +424,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: contentStream, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -467,7 +467,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: null, - stat: { + stat: { isDirectory: () => true, mode: expectedMode } as fs.Stats @@ -711,7 +711,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -752,7 +752,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: contentStream, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -795,7 +795,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: null, - stat: { + stat: { isDirectory: () => true, mode: expectedMode } as fs.Stats @@ -870,7 +870,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); diff --git a/types/vinyl-fs/vinyl-fs-tests.ts b/types/vinyl-fs/vinyl-fs-tests.ts index 18afe59744..2a38bcf811 100644 --- a/types/vinyl-fs/vinyl-fs-tests.ts +++ b/types/vinyl-fs/vinyl-fs-tests.ts @@ -383,7 +383,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -424,7 +424,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: contentStream, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -467,7 +467,7 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: null, - stat: { + stat: { isDirectory: () => true, mode: expectedMode } as fs.Stats @@ -711,7 +711,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -752,7 +752,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: contentStream, - stat: { + stat: { mode: expectedMode } as fs.Stats }); @@ -795,7 +795,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: null, - stat: { + stat: { isDirectory: () => true, mode: expectedMode } as fs.Stats @@ -870,7 +870,7 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode } as fs.Stats }); From 42e879f2223be2d15023d1c04d16d68d55b04726 Mon Sep 17 00:00:00 2001 From: Igor Goldvekht Date: Mon, 28 Jan 2019 18:20:14 -0500 Subject: [PATCH 150/266] [snoowrap] Fix typings for some Promise returning functions (#32505) * Fix typings for some Promise returning functions * Add semicolon --- types/snoowrap/dist/objects/LiveThread.d.ts | 4 +- types/snoowrap/dist/objects/RedditUser.d.ts | 16 +++---- types/snoowrap/dist/objects/Submission.d.ts | 5 +-- types/snoowrap/dist/objects/Subreddit.d.ts | 46 ++++++++++----------- types/snoowrap/dist/objects/WikiPage.d.ts | 4 +- types/snoowrap/snoowrap-tests.ts | 4 ++ 6 files changed, 41 insertions(+), 38 deletions(-) diff --git a/types/snoowrap/dist/objects/LiveThread.d.ts b/types/snoowrap/dist/objects/LiveThread.d.ts index ba34886fbb..594fc50247 100644 --- a/types/snoowrap/dist/objects/LiveThread.d.ts +++ b/types/snoowrap/dist/objects/LiveThread.d.ts @@ -26,8 +26,8 @@ export default class LiveThread extends RedditContent { deleteUpdate(options: { id: string; }): Promise; editSettings(options: LiveThreadSettings): Promise; getContributors(): Promise; - getDiscussions(options?: ListingOptions): Listing; - getRecentUpdates(options?: ListingOptions): Listing; + getDiscussions(options?: ListingOptions): Promise>; + getRecentUpdates(options?: ListingOptions): Promise>; inviteContributor(options: { name: string; permissions: Permissions[]}): Promise; leaveContributor(): Promise; removeContributor(options: { name: string; }): Promise; diff --git a/types/snoowrap/dist/objects/RedditUser.d.ts b/types/snoowrap/dist/objects/RedditUser.d.ts index a93cac98cd..35bc56eb9e 100644 --- a/types/snoowrap/dist/objects/RedditUser.d.ts +++ b/types/snoowrap/dist/objects/RedditUser.d.ts @@ -100,18 +100,18 @@ export default class RedditUser extends RedditContent { assignFlair(options: any): Promise; friend(options: any): Promise; - getComments(options?: any): Listing; - getDownvotedContent(options?: any): Listing; + getComments(options?: any): Promise>; + getDownvotedContent(options?: any): Promise>; getFriendInformation(): Promise; - getGildedContent(options?: any): Listing; - getHiddenContent(options?: any): Listing; + getGildedContent(options?: any): Promise>; + getHiddenContent(options?: any): Promise>; getMultireddit(name: string): MultiReddit; getMultireddits(): Promise; - getOverview(options?: any): Listing; - getSavedContent(options?: any): Listing; - getSubmissions(options?: any): Listing; + getOverview(options?: any): Promise>; + getSavedContent(options?: any): Promise>; + getSubmissions(options?: any): Promise>; getTrophies(): Promise; - getUpvotedContent(options?: any): Listing; + getUpvotedContent(options?: any): Promise>; giveGold(months: string): Promise; unfriend(): Promise; } diff --git a/types/snoowrap/dist/objects/Submission.d.ts b/types/snoowrap/dist/objects/Submission.d.ts index e2e7dc78d1..5986ac59cc 100644 --- a/types/snoowrap/dist/objects/Submission.d.ts +++ b/types/snoowrap/dist/objects/Submission.d.ts @@ -1,8 +1,7 @@ import { Sort } from '../..'; import Comment from './Comment'; import Listing, { ListingOptions } from './Listing'; -import RedditUser from './RedditUser'; -import Subreddit, { FlairTemplate } from './Subreddit'; +import { FlairTemplate } from './Subreddit'; import VoteableContent, { RichTextFlair } from './VoteableContent'; interface Media { @@ -113,7 +112,7 @@ export default class Submission extends VoteableContent { assignFlair(options: { text: string; cssClass: string; }): Promise; disableContestMode(): Promise; enableContestMode(): Promise; - getDuplicates(options?: ListingOptions): Listing; + getDuplicates(options?: ListingOptions): Promise>; getLinkFlairTemplates(): Promise; /* @deprecated */ getRelated(options?: ListingOptions): Submission; hide(): Promise; diff --git a/types/snoowrap/dist/objects/Subreddit.d.ts b/types/snoowrap/dist/objects/Subreddit.d.ts index 67623a17af..a9de52632d 100644 --- a/types/snoowrap/dist/objects/Subreddit.d.ts +++ b/types/snoowrap/dist/objects/Subreddit.d.ts @@ -1,12 +1,12 @@ -import { Sort, ModAction, SubmitSelfPostOptions, SubmitLinkOptions, BaseSearchOptions } from '../..'; +import { BaseSearchOptions, ModAction, Sort, SubmitLinkOptions, SubmitSelfPostOptions } from '../..'; import Comment from './Comment'; import Listing, { ListingOptions } from './Listing'; import PrivateMessage from './PrivateMessage'; import RedditContent from './RedditContent'; import RedditUser from './RedditUser'; import Submission from './Submission'; -import WikiPage, { WikiPageRevision } from './WikiPage'; import { RichTextFlair } from './VoteableContent'; +import WikiPage, { WikiPageRevision } from './WikiPage'; export default class Subreddit extends RedditContent { accounts_active_is_fuzzed: boolean; @@ -108,40 +108,40 @@ export default class Subreddit extends RedditContent { deleteImage(options: { imageName: string; }): Promise; deleteUserFlair(name: string): Promise; editSettings(options: SubredditSettings): Promise; - getBannedUsers(options?: ListingOptions & { name?: string }): Listing; - getContributors(options?: ListingOptions & { name?: string }): Listing; - getControversial(options?: ListingOptions & { time?: string }): Listing; - getEdited(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; - getHot(options?: ListingOptions): Listing; + getBannedUsers(options?: ListingOptions & { name?: string }): Promise>; + getContributors(options?: ListingOptions & { name?: string }): Promise>; + getControversial(options?: ListingOptions & { time?: string }): Promise>; + getEdited(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; + getHot(options?: ListingOptions): Promise>; getLinkFlairTemplates(linkId: string): Promise; - getModerationLog(opts?: ListingOptions & { mods?: string[]; type?: ModActionType}): Listing; + getModerationLog(opts?: ListingOptions & { mods?: string[]; type?: ModActionType}): Promise>; getModerators(options?: ListingOptions & { name?: string }): RedditUser[]; - getModmail(options?: ListingOptions): Listing; - getModqueue(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; - getMutedUsers(options?: ListingOptions & { name?: string }): Listing; + getModmail(options?: ListingOptions): Promise>; + getModqueue(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; + getMutedUsers(options?: ListingOptions & { name?: string }): Promise>; getMyFlair(): Promise; - getNew(options?: ListingOptions): Listing; - getNewComments(options?: ListingOptions): Listing; + getNew(options?: ListingOptions): Promise>; + getNewComments(options?: ListingOptions): Promise>; getRandomSubmission(): Promise; getRecommendedSubreddits(options?: { omit?: string[]; }): Promise; - getReports(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; - getRising(options?: ListingOptions): Listing; + getReports(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; + getRising(options?: ListingOptions): Promise>; getRules(): Promise<{ rules: Rule[]; site_rules: string[] }>; getSettings(): Promise; - getSpam(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; + getSpam(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; getSticky(options?: { num?: number }): Promise; getStylesheet(): Promise; getSubmitText(): Promise; - getTop(options?: ListingOptions & { time?: Timespan }): Listing; - getUnmoderated(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; + getTop(options?: ListingOptions & { time?: Timespan }): Promise>; + getUnmoderated(options?: ListingOptions & { only?: 'links' | 'comments' }): Promise>; getUserFlair(name: string): Promise; - getUserFlairList(options?: ListingOptions & { name?: string; }): Listing; + getUserFlairList(options?: ListingOptions & { name?: string; }): Promise>; getUserFlairTemplates(): Promise; - getWikiBannedUsers(options?: ListingOptions & { name?: string }): Listing; - getWikiContributors(options?: ListingOptions & { name?: string }): Listing; + getWikiBannedUsers(options?: ListingOptions & { name?: string }): Promise>; + getWikiContributors(options?: ListingOptions & { name?: string }): Promise>; getWikiPage(name: string): WikiPage; getWikiPages(): Promise; - getWikiRevisions(options?: ListingOptions): Listing; + getWikiRevisions(options?: ListingOptions): Promise>; hideMyFlair(): Promise; inviteModerator(options: { name: string; permissions?: ModeratorPermission[]; }): Promise; leaveContributor(): Promise; @@ -151,7 +151,7 @@ export default class Subreddit extends RedditContent { removeModerator(options: { name: string; }): Promise; removeWikiContributor(options: { name: string; }): Promise; revokeModeratorInvite(options: { name: string; }): Promise; - search(options: BaseSearchOptions): Listing; + search(options: BaseSearchOptions): Promise>; selectMyFlair(options: { flair_template_id: string; text?: string; }): Promise; setModeratorPermissions(options: { name: string; permissions: ModeratorPermission; }): Promise; setMultipleUserFlairs(flairs: Array<{ diff --git a/types/snoowrap/dist/objects/WikiPage.d.ts b/types/snoowrap/dist/objects/WikiPage.d.ts index ab9de1bdf6..88f16e2f23 100644 --- a/types/snoowrap/dist/objects/WikiPage.d.ts +++ b/types/snoowrap/dist/objects/WikiPage.d.ts @@ -13,8 +13,8 @@ export default class WikiPage extends RedditContent { addEditor(options: { name: string; }): Promise; edit(options: EditOptions): Promise; editSettings(options: Settings): Promise; - getDiscussions(options?: ListingOptions): Listing; - getRevisions(options?: ListingOptions): Listing; + getDiscussions(options?: ListingOptions): Promise>; + getRevisions(options?: ListingOptions): Promise>; getSettings(): Promise; hideRevision(options: { id: string; }): Promise; removeEditor(options: { name: string; }): Promise; diff --git a/types/snoowrap/snoowrap-tests.ts b/types/snoowrap/snoowrap-tests.ts index b83a9514f1..61aca46ffa 100644 --- a/types/snoowrap/snoowrap-tests.ts +++ b/types/snoowrap/snoowrap-tests.ts @@ -81,3 +81,7 @@ export function submissionSearch(query: string, subreddit: string): Promise> { return r.searchSubreddits({ query }); } + +export function getHotFromSubreddit(subreddit: string): Promise> { + return r.getSubreddit(subreddit).getHot({ limit: 10 }); +} From 7abf322d4eeed043575c2e9234c54ff2d693816f Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Tue, 29 Jan 2019 00:39:51 +0100 Subject: [PATCH 151/266] [vis] DataSet.get may return null + type parameter for DataSet.map (#32570) --- types/vis/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/vis/index.d.ts b/types/vis/index.d.ts index 84ff769270..187c01c9b7 100644 --- a/types/vis/index.d.ts +++ b/types/vis/index.d.ts @@ -459,7 +459,7 @@ export class DataSet { * @returns When no item is found, null is returned when a single item was requested, * and and empty Array is returned in case of multiple id's. */ - get(id: IdType, options?: DataSelectionOptions): T; + get(id: IdType, options?: DataSelectionOptions): T|null; /** * Get multiple items from the DataSet. @@ -494,7 +494,7 @@ export class DataSet { * @param [options] Optional options. * @returns The mapped items. */ - map(callback: (item: T, id: IdType) => any, options?: DataSelectionOptions): any[]; + map(callback: (item: T, id: IdType) => M, options?: DataSelectionOptions): M[]; /** * Find the item with maximum value of specified field. @@ -589,7 +589,7 @@ export interface DataSelectionOptions { /** * Order the items by a field name or custom sort function. */ - order?: string | any; + order?: string | ((a: T, b: T) => number); /** * Determine the type of output of the get function. @@ -597,7 +597,7 @@ export interface DataSelectionOptions { * The default returnType is an Array. * The Object type will return a JSON object with the ID's as keys. */ - returnType?: string; + returnType?: "Array" | "Object"; } export class DataView { From 2e803abbff20cb20cc6ba158d676304d1b3eeedd Mon Sep 17 00:00:00 2001 From: Dale Fenton Date: Mon, 28 Jan 2019 18:44:17 -0500 Subject: [PATCH 152/266] Add types for Menu.Divider and Menu.Header (#32299) * add Menu.Divider and Menu.Header to Menu class * remove csstype dependency, just grab it from React * update renderToken prop definition from v3.0 upgrade * add typings for and other exported Components, update tests * fix labelKey type to only allow for property names of an object where the value is a string * add ClearButton test --- types/react-bootstrap-typeahead/index.d.ts | 316 +++++++++++++++--- types/react-bootstrap-typeahead/package.json | 6 - .../react-bootstrap-typeahead-tests.tsx | 92 ++++- 3 files changed, 343 insertions(+), 71 deletions(-) delete mode 100644 types/react-bootstrap-typeahead/package.json diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 52f99825d5..2f1ad8b7be 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -4,37 +4,121 @@ // Rajab Shakirov // Paito Anderson // Andreas Richter +// Dale Fenton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 -// TODO: components +// TypeScript Version: 2.9 import * as React from 'react'; -import * as CSS from 'csstype'; +export type Omit = Pick>; +export type StringPropertyNames = { [K in keyof T]: T[K] extends string ? K : never }[keyof T]; -export interface TypeaheadFilterbyProps { - filterBy: string[]; - labelKey: (string | (() => void)); - multiple: boolean; - selected: any[]; - caseSensitive: boolean; - ignoreDiacritics: boolean; +/* --------------------------------------------------------------------------- + Constants and Enumerated Types +--------------------------------------------------------------------------- */ +export type TypeaheadModel = string|object; +export type TypeaheadBsSizes = 'large' | 'lg' | 'small' | 'sm'; +export type TypeaheadAlign = 'justify' | 'left' | 'right'; +// if options is an object, only let labelKey be a key of that object, whose value is a string +// or a custom label function that takes a single option and returns a string for the label +export type TypeaheadLabelKey = T extends object ? (StringPropertyNames | ((option: T) => string)) : never; +// don't allow onBlur, onChange, onFocus or onKeyDown as members of inputProps +// those props should be supplied directly to or +export interface InputProps extends Omit, 'onBlur'|'onChange'|'onFocus'|'onKeyDown'> { } + +/* --------------------------------------------------------------------------- + Typeahead Contexts +--------------------------------------------------------------------------- */ +export interface TypeaheadContext { + activeIndex?: number; + hintText?: string; + initialItem?: T; + isOnlyResult?: boolean; + onActiveItemChange?: (options: T) => void; + onAdd?: (option: T) => void; + onInitialItemChange?: (option: T) => void; + onMenuItemClick?: (option: T, e: Event) => void; + selectHintOnEnter?: boolean; +} + +export interface TypeaheadState { + activeIndex: number|null; + activeItem: T|null; + initialItem: T|null; + isFocused: boolean; + selected: T[]; + showMenu: boolean; + shownResults: number; text: string; } -export interface TypeaheadMenuProps { +export interface InputContainerPropsSingle { + 'aria-activedescendant': string; + 'aria-autocomplete': 'list' | 'both'; + 'aria-expanded': boolean | 'true' | 'false'; + 'aria-haspopup': 'listbox'; + 'aria-owns': string; + autoComplete: string; + disabled: boolean; + inputRef: React.LegacyRef; + onBlur: (e: Event) => void; + onChange: (selected: T[]) => void; + onClick: (e: Event) => void; + onFocus: (e: Event) => void; + onKeyDown: (e: Event) => void; + placeholder: string|null; + role: 'combobox'; + value: string; +} + +export interface InputContainerPropsMultiple extends Omit, 'role'> { + inputClassName: string; + labelKey: TypeaheadLabelKey; + onRemove: (e: Event) => void; + renderToken: (selectedItem: T, props: TypeaheadMenuProps, index: number) => React.ReactNode; + role: ''; + selected: T[]; +} + +export type HintedInputContextKeys = 'hintText' | 'initialItem' | 'onAdd' | 'selectHintOnEnter'; +export interface HintedInputContext extends Pick, HintedInputContextKeys> {} + +export type MenuItemContextKeys = 'activeIndex' | 'isOnlyResult' | 'onActiveItemChange' | 'onInitialItemChange' | 'onMenuItemClick'; +export interface MenuItemContext extends Pick, MenuItemContextKeys> {} + +export interface TokenContext { + active: boolean; + onBlur: (e: any) => void; + onClick: (e: any) => void; + onFocus: (e: any) => void; + onKeyDown: (e: any) => void; +} + +/* --------------------------------------------------------------------------- + Typeahead Props and Component +--------------------------------------------------------------------------- */ +export interface TypeaheadContainerProps { + activeIndex: number | null; + activeItem: T | null; + initialItem: T | null; + isFocused: boolean; + selected: T[]; + showMenu: boolean; + shownResults: number; text: string; } -export interface TypeaheadProps { - /* For localized accessibility: Should return a string indicating the number of results for screen readers. Receives the current results. */ +export interface TypeaheadProps { + /* For localized accessibility: Should return a string indicating the number of results for screen readers. + Receives the current results. */ a11yNumResults?: () => void; - /* For localized accessibility: Should return a string indicating the number of selections for screen readers. Receives the current selections. */ + /* For localized accessibility: Should return a string indicating the number of selections for screen readers. + Receives the current selections. */ a11yNumSelected?: () => void; /* Specify menu alignment. The default value is justify, which makes the menu as wide as the input and truncates long values. Specifying left or right will align the menu to that side and the width will be determined by the length of menu item values. */ - align?: 'justify' | 'left' | 'right'; + align?: TypeaheadAlign; /* Allows the creation of new selections on the fly. Any new items will be added to the list of selections, but not the list of original options unless handled as such by Typeahead's parent. @@ -49,7 +133,7 @@ export interface TypeaheadProps { bodyContainer?: boolean; /* Specify the size of the input. */ - bsSize?: 'large' | 'lg' | 'small' | 'sm'; + bsSize?: TypeaheadBsSizes; /* Whether or not filtering should be case-sensitive. */ caseSensitive?: boolean; @@ -60,6 +144,9 @@ export interface TypeaheadProps { /* The initial value displayed in the text input. */ defaultInputValue?: string; + /* Whether or not the menu is displayed upon initial render. */ + defaultOpen?: boolean; + /* Specify any pre-selected options. Use only if you want the component to be uncontrolled. */ defaultSelected?: T[]; @@ -74,7 +161,10 @@ export interface TypeaheadProps { emptyLabel?: string; /* Either an array of fields in option to search, or a custom filtering callback. */ - filterBy?: (string[] | ((option: T | string, props: TypeaheadFilterbyProps) => boolean)); + filterBy?: (string[] | ((option: T, props: AllTypeaheadOwnAndInjectedProps) => boolean)); + + /* Whether or not to automatically adjust the position of the menu when it reaches the viewport boundaries. */ + flip?: boolean; /* Highlights the menu item if there is only one result and allows selecting that item by hitting enter. Does not work with allowNew. */ @@ -84,7 +174,7 @@ export interface TypeaheadProps { ignoreDiacritics?: boolean; /* Props to be applied directly to the input. onBlur, onChange, onFocus, and onKeyDown are ignored. */ - inputProps?: object; + inputProps?: InputProps; /* Bootstrap 4 only. Adds the `is-invalid` classname to the `form-control`. */ isInvalid?: boolean; @@ -95,8 +185,9 @@ export interface TypeaheadProps { /* Bootstrap 4 only. Adds the `is-valid` classname to the `form-control`. */ isValid?: boolean; - /* Specify which option key to use for display or a render function. By default, the selector will use the label key. */ - labelKey?: string | ((option: T | string) => string); + /* Specify which option key to use for display or a render function. + By default, the selector will use the label key. */ + labelKey?: TypeaheadLabelKey; /* Maximum height of the dropdown menu. */ maxHeight?: string; @@ -105,6 +196,9 @@ export interface TypeaheadProps { so as not to render too many DOM nodes in the case of large data sets. */ maxResults?: number; + /* Id applied to the top-level menu element. Required for accessibility. */ + menuId?: string; + /* Number of input characters that must be entered before showing results. */ minLength?: number; @@ -115,28 +209,35 @@ export interface TypeaheadProps { newSelectionPrefix?: string; /* Invoked when the input is blurred. Receives an event. */ - onBlur?: (e: Event) => any; + onBlur?: (e: Event) => void; /* Invoked whenever items are added or removed. Receives an array of the selected options. */ - onChange?: (selected: T[]) => any; + onChange?: (selected: T[]) => void; /* Invoked when the input is focused. Receives an event. */ - onFocus?: (e: Event) => any; + onFocus?: (e: Event) => void; /* Invoked when the input value changes. Receives the string value of the input, as well as the original event. */ - onInputChange?: (input: string, e: Event) => any; + onInputChange?: (input: string, e: Event) => void; /* Invoked when a key is pressed. Receives an event. */ - onKeyDown?: (e: Event) => any; + onKeyDown?: (e: Event) => void; - /* Invoked when the menu is hidden. */ - onMenuHide?: (e: Event) => any; + /* DEPRECATED: Invoked when the menu is hidden. */ + onMenuHide?: () => void; - /* Invoked when the menu is shown. */ - onMenuShow?: (e: Event) => any; + /* DEPRECATED: Invoked when the menu is shown. */ + onMenuShow?: () => void; + + /* Invoked when menu visibility changes. */ + onMenuToggle?: (show: boolean) => void; /* Invoked when the pagination menu item is clicked. */ - onPaginate?: (e: Event) => any; + onPaginate?: (e: Event, numResults: number) => void; + + /* Whether or not the menu should be displayed. undefined allows the component to control visibility, + while true and false show and hide the menu, respectively. */ + open?: boolean; /* Full set of options, including any pre-selected options. */ options: T[]; @@ -151,13 +252,13 @@ export interface TypeaheadProps { placeholder?: string; /* Callback for custom menu rendering. */ - renderMenu?: (results: Array, menuProps: any) => any; + renderMenu?: (results: T[], menuProps: any) => React.ReactNode; /* Provides a hook for customized rendering of menu item contents. */ - renderMenuItemChildren?: (option: T, props: TypeaheadMenuProps, index: number) => any; + renderMenuItemChildren?: (option: T, props: TypeaheadMenuProps, index: number) => React.ReactNode; /* Provides a hook for customized rendering of tokens when multiple selections are enabled. */ - renderToken?: (selectedItem: T | string, onRemove: () => void) => any; + renderToken?: (selectedItem: T, props: TypeaheadMenuProps, index: number) => React.ReactNode; /* The selected option(s) displayed in the input. Use this prop if you want to control the component via its parent. */ selected?: T[]; @@ -166,9 +267,13 @@ export interface TypeaheadProps { selectHintOnEnter?: boolean; } -export const Typeahead: React.ClassicComponentClass>; +export type AllTypeaheadOwnAndInjectedProps = TypeaheadProps & TypeaheadContainerProps; +export class Typeahead extends React.Component> { } -export interface AsyncTypeaheadProps extends TypeaheadProps { +/* --------------------------------------------------------------------------- + AsyncTypeahead Props and Component +--------------------------------------------------------------------------- */ +export interface AsyncTypeaheadProps extends TypeaheadProps { /* Delay, in milliseconds, before performing search. */ delay?: number; @@ -179,45 +284,148 @@ export interface AsyncTypeaheadProps extends TypeaheadProps { onSearch: (query: string) => void; /* Message displayed in the menu when there is no user input. */ - promptText?: string; + promptText?: React.ReactNode; /* Message to display in the menu while the request is pending. */ - searchText?: string; + searchText?: React.ReactNode; /* Whether or not the component should cache query results. */ useCache?: boolean; } -export const AsyncTypeahead: React.ClassicComponentClass>; +export class AsyncTypeahead extends React.Component> { } -export interface HighligherProps { - key?: string; - search: string; - optionId?: any; +/* --------------------------------------------------------------------------- + TypeaheadInputSingle & TypeaheadInputMulti Props and Component +--------------------------------------------------------------------------- */ +export interface BaseTypeaheadInputProps extends React.InputHTMLAttributes<'input'> { + type: 'text'; } -export const Highlighter: React.ClassicComponentClass>; +export interface TypeaheadSingleInputWithHocProps extends + Omit>, + InputContainerPropsSingle {} -export interface MenuProps { +export interface TypeaheadMulitInputWithHocProps extends + Omit>, + HintedInputContext, + InputContainerPropsMultiple {} + +export type TypeaheadInputPropKeys = 'bsSize'|'disabled'|'inputProps'|'labelKey'|'multiple'| + 'onBlur'|'onChange'|'onFocus'|'onKeyDown'|'placeholder'|'renderToken'|'selected'; + +export type TypeaheadInputProps = Pick, TypeaheadInputPropKeys>; + +export class TypeaheadInputSingle extends React.Component> { } +export class TypeaheadInputMulti extends React.Component> { } + +/* --------------------------------------------------------------------------- + Highlighter Props and Component +--------------------------------------------------------------------------- */ +export interface HighligherProps { + children: React.ReactNode; + search: string; +} + +export class Highlighter extends React.PureComponent { } + +/* --------------------------------------------------------------------------- + ClearButton Props and Component +--------------------------------------------------------------------------- */ +export interface ClearButtonProps extends React.HTMLAttributes<'button'> { + bsSize?: TypeaheadBsSizes; + label?: string; + onClick: React.HTMLAttributes<'button'>['onClick']; // make onClick requried +} + +export const ClearButton: React.FunctionComponent; + +/* --------------------------------------------------------------------------- + Loader Props and Component +--------------------------------------------------------------------------- */ +export interface LoaderProps { + bsSize: TypeaheadBsSizes; +} + +export const Loader: React.FunctionComponent; + +/* --------------------------------------------------------------------------- + AutosizeInput Props and Component +--------------------------------------------------------------------------- */ +export interface AutosizeInputProps extends Pick, 'className' | 'style'> { + inputClassName?: string; + inputRef?: React.LegacyRef; + inputStyle?: Pick; + style: React.CSSProperties; +} + +export class AutosizeInput extends React.Component { } + +/* --------------------------------------------------------------------------- + Menu Props and Component +--------------------------------------------------------------------------- */ +export interface MenuProps { id: string; className?: string; emptyLabel?: string; - innerRef?: string; + innerRef?: React.LegacyRef; maxHeight?: string; - style?: CSS.Properties; + style?: React.CSSProperties; + text?: string; } -export const Menu: React.ClassicComponentClass>; +export type MenuHeaderProps = Omit, 'className'>; -export interface MenuItemProps { +export class Menu extends React.Component { + static Divider: React.FunctionComponent; + static Header: React.FunctionComponent; +} + +/* --------------------------------------------------------------------------- + TypeaheadMenu Props and Component +--------------------------------------------------------------------------- */ +// prop names that Typeahead provides to TypeaheadMenu +export type TypeaheadMenuPropsPick = 'labelKey' | 'newSelectionPrefix'| 'options' | 'renderMenuItemChildren'; +export interface TypeaheadMenuProps extends MenuProps, Pick, TypeaheadMenuPropsPick> {} +export class TypeaheadMenu extends React.Component> { } + +/* --------------------------------------------------------------------------- + Menu Item Props and Component +--------------------------------------------------------------------------- */ +export interface BaseMenuItemProps extends React.HTMLProps<'li'> { + active?: boolean; +} +export class BaseMenuItem extends React.Component { } + +export interface MenuItemProps extends BaseMenuItemProps { option: T; position: number; label?: string; - active?: boolean; - className?: string; - disabled?: boolean; - onClick?: (e: Event) => any; - onMouseDown?: (e: Event) => any; } -export const MenuItem: React.ClassicComponentClass>; +export class MenuItem extends React.Component> { } + +/* --------------------------------------------------------------------------- + Overlay Props and Component +--------------------------------------------------------------------------- */ +export type OverlayTypeaheadProps = Pick, 'align' | 'dropup' | 'flip' | 'onMenuHide' | 'onMenuShow' | 'onMenuToggle'>; + +export interface OverlayProps extends OverlayTypeaheadProps { + children?: React.ReactNode; + className?: string; + container: HTMLElement; + referenceElement?: HTMLElement; + show?: boolean; +} + +export class Overlay extends React.Component { } + +/* --------------------------------------------------------------------------- + Token Props and Component +--------------------------------------------------------------------------- */ +export interface TokenProps extends React.HTMLProps<'div'> { + active?: boolean; + onRemove?: () => void; // Token does not invoke onRemove with any parameters +} + +export class Token extends React.Component { } diff --git a/types/react-bootstrap-typeahead/package.json b/types/react-bootstrap-typeahead/package.json deleted file mode 100644 index e6696d08e7..0000000000 --- a/types/react-bootstrap-typeahead/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "csstype": "^2.2.0" - } -} diff --git a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx index c77052a3c6..7e2c3a29a6 100644 --- a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx +++ b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx @@ -1,25 +1,78 @@ import * as React from 'react'; -import { Typeahead, Highlighter, Menu, MenuItem } from 'react-bootstrap-typeahead'; +import { ClearButton, Typeahead, Highlighter, Menu, MenuItem, Token } from 'react-bootstrap-typeahead'; -const options = [ - { name: 'Alabama', population: 4780127, capital: 'Montgomery', region: 'South' }, - { name: 'Alaska', population: 710249, capital: 'Juneau', region: 'West' }, - { name: 'Arizona', population: 6392307, capital: 'Phoenix', region: 'West' }, - { name: 'Arkansas', population: 2915958, capital: 'Little Rock', region: 'South' }, - { name: 'California', population: 37254503, capital: 'Sacramento', region: 'West' }, - { name: 'Colorado', population: 5029324, capital: 'Denver', region: 'West' }, +interface State { + capital: string; + name: string; + population: number; + region: string; + setValue: (value: State) => void; +} +interface GroupedStates { + [key: string]: State[]; +} +type StringPropertyNames = { [K in keyof T]: T[K] extends string ? K : never }[keyof T]; +type StateKeysValid = StringPropertyNames; +const options: State[] = [ + { name: 'Alabama', population: 4780127, capital: 'Montgomery', region: 'South', setValue: () => {} }, + { name: 'Alaska', population: 710249, capital: 'Juneau', region: 'West', setValue: () => {} }, + { name: 'Arizona', population: 6392307, capital: 'Phoenix', region: 'West', setValue: () => {} }, + { name: 'Arkansas', population: 2915958, capital: 'Little Rock', region: 'South', setValue: () => {} }, + { name: 'California', population: 37254503, capital: 'Sacramento', region: 'West', setValue: () => {} }, + { name: 'Colorado', population: 5029324, capital: 'Denver', region: 'West', setValue: () => {} }, ]; +const stateNames = options.map(o => o.name); + +const groups: GroupedStates = options.reduce((accum: GroupedStates, option: State) => { + const optKey = option.name.slice(0, 1).toLowerCase(); + if (accum[optKey] !== undefined) { + accum[optKey].push(option); + } else { + accum[optKey] = [option]; + } + return accum; +}, {}); + class BasicExample extends React.Component { state = { multiple: false, }; + genCustomMenu = () => { + const menuItems = Object.keys(groups).reduce((accum, letter) => { + const header = [ + , + + {`States starting with: ${letter.toUpperCase()}`} + {}} /> + , + , + ]; + const states = groups[letter].map((state: State, index: number) => { + return ({state.name}); + }); + return [...accum, ...header, ...states]; + }, [] as JSX.Element[]); + + return menuItems; + } + render() { const { multiple } = this.state; return (
+ + (props.text.indexOf(option) !== -1)} + /> (props.text.indexOf(option) !== -1) } + filterBy={(option, props) => (props.text.indexOf(option.name) !== -1) } placeholder="Choose a state..." /> (text.indexOf(option) !== -1) } + filterBy={(option, {text}) => (text.indexOf(option.name) !== -1) } placeholder="Choose a state..." /> - + {option.name} {index} } @@ -69,6 +122,23 @@ class BasicExample extends React.Component { ))} + { + return console.log(props.text)}> + {selectedItem.name} {}} /> + ; + }} + > + {...this.genCustomMenu()} +
); } From a8f1326ba72ece5f12189e5c8006967a23c014be Mon Sep 17 00:00:00 2001 From: Kosaku Kurino Date: Tue, 29 Jan 2019 08:48:52 +0900 Subject: [PATCH 153/266] [types/recharts]Add index definitation in PieProps (#32441) * Add index definitation in PieProps I can not see the "index" parameter in the document, but it actually exists and I added it for frequent use when creating custom labels. document http://recharts.org/en-US/api/Pie * [types/recharts] add PieLabelRenderProps def PieLabelRenderProps extends PieProps * fix error add semi * update PieProps labels def ``` label?: { offsetRadius: number; } | React.ReactElement | ContentRenderer | boolean; ``` to: ``` label?: { offsetRadius: number; } | React.ReactElement | ContentRenderer | boolean; ``` * fix error ``` label?: { offsetRadius: number; } | React.ReactElement | ContentRenderer | boolean; ``` to: ``` label?: { offsetRadius: number; } | React.ReactElement | ContentRenderer | boolean; ``` * update PieLabelRenderProps properties add className * Edit PieRenderProps add name to PieLabelRenderProps. delete className from PieLabelRenderProps. * Update PieLabelRenderProps update PieLabelRenderProps' name property * add parameter to PieLabelRenderProps add parameter to PieLabelRenderProps --- types/recharts/index.d.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 426e74d6ba..fc127e9251 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -12,6 +12,7 @@ // Harry Cruse // Andrew Palugniok // Robert Stigsson +// Kosaku Kurino // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -451,12 +452,23 @@ export interface PieProps extends EventAttributes, Partial | React.ReactElement | boolean; label?: { offsetRadius: number; - } | React.ReactElement | ContentRenderer | boolean; + } | React.ReactElement | ContentRenderer | boolean; activeShape?: object | ContentRenderer | React.ReactElement; activeIndex?: number | number[]; blendStroke?: boolean; } +export interface PieLabelRenderProps extends PieProps { + name: string; + percent?: number; + stroke: string; + index?: number; + textAnchor: string; + x: number; + y: number; + [key: string]: any; +} + export class Pie extends React.Component { } // NOTE: the lib's implementation doesn't inherits the event props (it's kept in this definition due to the previous typing definition has it). From e4e56293bb654185f89b49bcae4964068487b953 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Mon, 28 Jan 2019 16:10:49 -0800 Subject: [PATCH 154/266] Updates based on eng feedback --- types/office-js/index.d.ts | 65 +++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index ea804993a1..1b3f3c447a 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -7736,7 +7736,7 @@ declare namespace Office { /** * A conference room or similar resource. */ - ConferenceRoom = "conferenceRoom" + Room = "room" } /** * Specifies the month. @@ -9429,15 +9429,15 @@ declare namespace Office { * * In addition to this signature, this method also has the following signatures: * - * `addAsync(locationIds: LocationIdentifier[], callback?: (result: Office.AsyncResult) => void): void;` + * `addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void;` * - * @param locationIds The locations to be added to the current list of locations. + * @param locationIdentifiers The locations to be added to the current list of locations. * @param options Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. + * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. */ - addAsync(locationIds: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; /** * Adds to the set of locations associated with the appointment. * @@ -9453,11 +9453,11 @@ declare namespace Office { * * * - * @param locationIds The locations to be added to the current list of locations. + * @param locationIdentifiers The locations to be added to the current list of locations. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. + * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. */ - addAsync(locationIds: LocationIdentifier[], callback?: (result: Office.AsyncResult) => void): void; + addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; /** * Gets the set of locations associated with the appointment. * @@ -9469,7 +9469,7 @@ declare namespace Office { * * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode} - * Compose + * Compose or read * * * @@ -9494,7 +9494,7 @@ declare namespace Office { * * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode} - * Compose + * Compose or read * * * @@ -9505,10 +9505,7 @@ declare namespace Office { /** * Removes the set of locations associated with the appointment. * - * Any included conference rooms (i.e., in the `LocationDetails` object, the `type` is **ConferenceRoom** and there is an email address) - * should be removed from the locations and the resources lists. - * - * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIds. + * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. * * @remarks * @@ -9524,22 +9521,19 @@ declare namespace Office { * * In addition to this signature, this method also has the following signatures: * - * `removeAsync(locationIds: LocationIdentifier[], callback?: (result: Office.AsyncResult) => void): void;` + * `removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void;` * - * @param locationIds The locations to be removed from the current list of locations. + * @param locationIdentifiers The locations to be removed from the current list of locations. * @param options Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. + * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. */ - removeAsync(locationIds: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; /** * Removes the set of locations associated with the appointment. * - * Any included conference rooms (i.e., in the `LocationDetails` object, the `type` is **ConferenceRoom** and there is an email address) - * should be removed from the locations and the resources lists. - * - * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIds. + * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. * * @remarks *
@@ -9553,11 +9547,11 @@ declare namespace Office { * *
* - * @param locationIds The locations to be removed from the current list of locations. + * @param locationIdentifiers The locations to be removed from the current list of locations. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, - * asyncResult, which is an Office.AsyncResult object. + * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. */ - removeAsync(locationIds: LocationIdentifier[], callback?: (result: Office.AsyncResult) => void): void; + removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; } /** * Represents a collection of entities found in an email message or appointment. Read mode only. @@ -9833,9 +9827,9 @@ declare namespace Office { */ export interface LocationDetails { /** - * The location's id. + * The LocationIdentifier of the location. */ - locationId: LocationIdentifier; + locationIdentifier: LocationIdentifier; /** * The location's display name. */ @@ -9844,10 +9838,6 @@ declare namespace Office { * The email address associated with the location. */ emailAddress: string; - /** - * Additional properties for the location. - */ - properties: any; } /** @@ -9861,7 +9851,7 @@ declare namespace Office { /** * The location's unique id. * - * For **ConferenceRoom** type, it's the room's email address. + * For **Room** type, it's the room's email address. * * For **Custom** type, it's the displayName. */ @@ -9974,7 +9964,7 @@ declare namespace Office { */ end: Time; /** - * Gets or sets the locations of the appointment. The `enhancedLocations` property returns an {@link EnhancedLocation} object that + * Gets or sets the locations of the appointment. The `enhancedLocation` property returns an {@link EnhancedLocation} object that * provides methods to get, remove, or add locations on an item. * * [Api set: Mailbox Preview] @@ -9994,7 +9984,7 @@ declare namespace Office { * * @beta */ - enhancedLocations: EnhancedLocation; + enhancedLocation: EnhancedLocation; /** * Gets the type of item that an instance represents. * @@ -11083,7 +11073,10 @@ declare namespace Office { */ end: Date; /** - * Gets a set of LocationDetails objects that represents the locations of the appointment. + * Gets the locations of an appointment. + * + * The enhancedLocation property returns an {@link EnhancedLocation} object that allows you to get the set of locations (each represented by + * a {@link LocationDetails} object) associated with the appointment. * * [Api set: Mailbox Preview] * @@ -11102,7 +11095,7 @@ declare namespace Office { * * @beta */ - enhancedLocations: LocationDetails[]; + enhancedLocation: EnhancedLocation; /** * Gets the Exchange Web Services item class of the selected item. * From a345bad39bc7f14bf98254b92320028141c28781 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Tue, 29 Jan 2019 09:13:40 +0900 Subject: [PATCH 155/266] [multiparty] Add types for multiparty.Form#on() methods and originalFilename renaming (#32440) * Add types for multiparty.Form#on() methods * Rename originalFileName to originalFilename --- types/multiparty/index.d.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/types/multiparty/index.d.ts b/types/multiparty/index.d.ts index ca968fefcf..1dbb3e272b 100644 --- a/types/multiparty/index.d.ts +++ b/types/multiparty/index.d.ts @@ -19,6 +19,13 @@ export declare class Form extends events.EventEmitter { * @param callback */ parse(request: http.IncomingMessage, callback?: (error: Error, fields: any, files: any) => any): void; + + on(event: "part", listener: (part: Part) => void): this; + on(event: "close", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "progress", listener: (bytesReceived: number, bytesExpected: number) => void): this; + on(event: "field", listener: (name: string, value: string) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; } export interface File { @@ -29,7 +36,7 @@ export interface File { /** * the filename that the user reports for the file */ - originalFileName: string; + originalFilename: string; /** * the absolute path of the uploaded file on disk */ @@ -44,7 +51,7 @@ export interface File { size: number; } -interface Part extends stream.Readable { +export interface Part extends stream.Readable { /** * the headers for this part. For example, you may be interested in content-type */ From ea2b36990777f7e09cce172235770c6c9793210a Mon Sep 17 00:00:00 2001 From: Patrick Chatain Date: Tue, 29 Jan 2019 01:16:21 +0100 Subject: [PATCH 156/266] [Bull] Add missing getJobCountByTypes definition (#32514) * Add getJobCountByTypes definition * Update index.d.ts * getJobCountByTypes types can also be a string --- types/bull/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index b2fb68d4d7..bbafa0301c 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -585,6 +585,11 @@ declare namespace Bull { */ getJobCounts(): Promise; + /** + * Returns a promise that resolves with the job counts for the given queue of the given types. + */ + getJobCountByTypes(types: string[] | string): Promise; + /** * Returns a promise that resolves with the quantity of completed jobs. */ From df207da292a73fe824132c9bfad06359705160c2 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Mon, 28 Jan 2019 16:26:28 -0800 Subject: [PATCH 157/266] Add changes to office-js-preview --- types/office-js-preview/index.d.ts | 276 +++++++++++++++++++++++++++++ 1 file changed, 276 insertions(+) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 75e9ed910f..e26ab7e8a0 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -7713,6 +7713,31 @@ declare namespace Office { */ Appointment = "appointment" } + /** + * Specifies an appointment's location type. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
+ * + * @beta + */ + enum LocationType { + /** + * A custom location. + */ + Custom = "custom", + /** + * A conference room or similar resource. + */ + Room = "room" + } /** * Specifies the month. * @@ -9367,6 +9392,167 @@ declare namespace Office { */ emailAddress: string; } + /** + * Represents the set of locations on an appointment. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
+ * + * @beta + */ + interface EnhancedLocation { + /** + * Adds to the set of locations associated with the appointment. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * In addition to this signature, this method also has the following signatures: + * + * `addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void;` + * + * @param locationIdentifiers The locations to be added to the current list of locations. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + */ + addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + /** + * Adds to the set of locations associated with the appointment. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * @param locationIdentifiers The locations to be added to the current list of locations. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + */ + addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; + /** + * Gets the set of locations associated with the appointment. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
+ * + * In addition to this signature, this method also has the following signatures: + * + * `getAsync(callback?: (result: Office.AsyncResult) => void): void;` + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; + /** + * Gets the set of locations associated with the appointment. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
+ * + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + */ + getAsync(callback?: (result: Office.AsyncResult) => void): void; + /** + * Removes the set of locations associated with the appointment. + * + * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * In addition to this signature, this method also has the following signatures: + * + * `removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void;` + * + * @param locationIdentifiers The locations to be removed from the current list of locations. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + */ + removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; + /** + * Removes the set of locations associated with the appointment. + * + * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. + * + * @remarks + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
+ * + * @param locationIdentifiers The locations to be removed from the current list of locations. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + */ + removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; + } /** * Represents a collection of entities found in an email message or appointment. Read mode only. * @@ -9632,6 +9818,50 @@ declare namespace Office { setAsync(headers: Object, callback?: (result: Office.AsyncResult) => void): void; } + /** + * Represents a location. Read only. + * + * [Api set: Mailbox Preview] + * + * @beta + */ + export interface LocationDetails { + /** + * The LocationIdentifier of the location. + */ + locationIdentifier: LocationIdentifier; + /** + * The location's display name. + */ + displayName: string; + /** + * The email address associated with the location. + */ + emailAddress: string; + } + + /** + * Represents the id of a location. + * + * [Api set: Mailbox Preview] + * + * @beta + */ + interface LocationIdentifier { + /** + * The location's unique id. + * + * For **Room** type, it's the room's email address. + * + * For **Custom** type, it's the displayName. + */ + id: string; + /** + * The location's type. + */ + type: MailboxEnums.LocationType; + } + /** * Represents the appointment organizer, even if an alias or a delegate was used to create the appointment. * This object provides a method to get the organizer value of an appointment in an Outlook add-in. @@ -9733,6 +9963,28 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer */ end: Time; + /** + * Gets or sets the locations of the appointment. The `enhancedLocation` property returns an {@link EnhancedLocation} object that + * provides methods to get, remove, or add locations on an item. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
+ * + * @beta + */ + enhancedLocation: EnhancedLocation; /** * Gets the type of item that an instance represents. * @@ -10820,6 +11072,30 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee */ end: Date; + /** + * Gets the locations of an appointment. + * + * The enhancedLocation property returns an {@link EnhancedLocation} object that allows you to get the set of locations (each represented by + * a {@link LocationDetails} object) associated with the appointment. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * + * + * + * + * + * + *
{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee
+ * + * @beta + */ + enhancedLocation: EnhancedLocation; /** * Gets the Exchange Web Services item class of the selected item. * From 217244347fff7da3364c7bd9c04f6454bfd44835 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Tue, 29 Jan 2019 06:35:30 +0100 Subject: [PATCH 158/266] chore(defaults-deep): use spread parameters only --- types/defaults-deep/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/defaults-deep/index.d.ts b/types/defaults-deep/index.d.ts index b7583dd92e..a814ee0f4a 100644 --- a/types/defaults-deep/index.d.ts +++ b/types/defaults-deep/index.d.ts @@ -7,7 +7,7 @@ interface Obj { [k: string]: any; } -export default function defaultDeep(obj?: Obj, ...objs: Obj[]): Obj; +export default function defaultDeep(...objs: Obj[]): Obj; // strict-export-declare-modifiers export {}; From ba703b81164c5cf89fe15d2512cee8b798732d45 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Tue, 29 Jan 2019 06:53:42 +0100 Subject: [PATCH 159/266] fix(defaults-deep): fix export --- types/defaults-deep/defaults-deep-tests.ts | 2 +- types/defaults-deep/index.d.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/types/defaults-deep/defaults-deep-tests.ts b/types/defaults-deep/defaults-deep-tests.ts index 826bbb4d0f..daabc46d7d 100644 --- a/types/defaults-deep/defaults-deep-tests.ts +++ b/types/defaults-deep/defaults-deep-tests.ts @@ -1,4 +1,4 @@ -import defaults from 'defaults-deep'; +import defaults = require('defaults-deep'); defaults(); defaults({a: 'foo'}); diff --git a/types/defaults-deep/index.d.ts b/types/defaults-deep/index.d.ts index a814ee0f4a..749257eb88 100644 --- a/types/defaults-deep/index.d.ts +++ b/types/defaults-deep/index.d.ts @@ -7,7 +7,6 @@ interface Obj { [k: string]: any; } -export default function defaultDeep(...objs: Obj[]): Obj; +declare function defaultsDeep(...objs: Obj[]): Obj; -// strict-export-declare-modifiers -export {}; +export = defaultsDeep; From c21a33e1783ee706b9bbe118c6f5dc9f2844049c Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Tue, 29 Jan 2019 12:33:18 +0530 Subject: [PATCH 160/266] Type definitions for happypack --- types/happypack/index.d.ts | 21 +++++++++++++++++++++ types/happypack/tsconfig.json | 22 ++++++++++++++++++++++ types/happypack/tslint.json | 4 ++++ 3 files changed, 47 insertions(+) create mode 100644 types/happypack/index.d.ts create mode 100644 types/happypack/tsconfig.json create mode 100644 types/happypack/tslint.json diff --git a/types/happypack/index.d.ts b/types/happypack/index.d.ts new file mode 100644 index 0000000000..c42bdc1cf7 --- /dev/null +++ b/types/happypack/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for happypack +// Project: https://github.com/amireh/happypack +// Definitions by: Akash Vishwakarma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Plugin } from 'webpack'; + +declare class HappyPack extends Plugin { + + constructor(options?: HappyPack.PluginOptions); +} + +declare namespace HappyPack { + interface PluginOptions { + id?: string; + threads?: number; + loaders?: any; + } +} + +export = HappyPack; diff --git a/types/happypack/tsconfig.json b/types/happypack/tsconfig.json new file mode 100644 index 0000000000..b65889af68 --- /dev/null +++ b/types/happypack/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + ] +} diff --git a/types/happypack/tslint.json b/types/happypack/tslint.json new file mode 100644 index 0000000000..8f312f8fa9 --- /dev/null +++ b/types/happypack/tslint.json @@ -0,0 +1,4 @@ +{ + "extends": ["tslint:recommended", "tslint-config-prettier"] +} + \ No newline at end of file From 308ec150ad5dcf3d2425e3bb7bb5477ffee1c7a8 Mon Sep 17 00:00:00 2001 From: Gerhard Stoebich <18708370+Flarna@users.noreply.github.com> Date: Tue, 15 Jan 2019 10:02:49 +0100 Subject: [PATCH 161/266] [node] add zlib.bytesWritten --- types/node/index.d.ts | 2 ++ types/node/node-tests.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 417782b2f3..ffa98c32fb 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1781,7 +1781,9 @@ declare module "zlib" { } interface Zlib { + /** @deprecated Use bytesWritten instead. */ readonly bytesRead: number; + readonly bytesWritten: number; close(callback?: () => void): void; flush(kind?: number | (() => void), callback?: () => void): void; } diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index f351ba8139..3a8622802a 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -4172,6 +4172,11 @@ import * as constants from 'constants'; const deflate = zlib.deflateSync('test'); const inflate = zlib.inflateSync(deflate.toString()); } + + { + const gzip = zlib.createGzip(); + const written: number = gzip.bytesWritten; + } } /////////////////////////////////////////////////////////// From fb63f59f6b6364cb7d7861e4b022bb2c120e69fc Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Tue, 29 Jan 2019 08:16:59 +0100 Subject: [PATCH 162/266] getSells --- types/coinbase/coinbase-tests.ts | 2 +- types/coinbase/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/coinbase/coinbase-tests.ts b/types/coinbase/coinbase-tests.ts index e7d53012d7..65ec9693bd 100644 --- a/types/coinbase/coinbase-tests.ts +++ b/types/coinbase/coinbase-tests.ts @@ -33,7 +33,7 @@ client.getAccount("abcdef", (error: Error, account: coinbase.Account): void => { account.getSell("abcdef", (error: Error, deposit: coinbase.Sell): void => undefined); - account.getSells((error: Error, deposit: coinbase.Sell[]): void => undefined); + account.getSells(null, (error: Error, deposit: coinbase.Sell[]): void => undefined); account.getTransaction("abcdef", (error: Error, deposit: coinbase.Transaction): void => undefined); diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index 4580179195..1e94f04295 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -678,7 +678,7 @@ export class Account implements Resource { * Lists sells for an account. * Scope: wallet:sells:read */ - getSells(cb: (error: Error, result: Sell[]) => void): void; + getSells(opts: null, cb: (error: Error, result: Sell[]) => void): void; /** * Show an individual sell. From f4408e85cb68e363135080a9ca8fb231e35175d4 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Tue, 29 Jan 2019 13:21:42 +0530 Subject: [PATCH 163/266] updating configuration --- types/happypack/tsconfig.json | 9 ++-- types/happypack/tslint.json | 79 ++++++++++++++++++++++++++++++++++- 2 files changed, 82 insertions(+), 6 deletions(-) diff --git a/types/happypack/tsconfig.json b/types/happypack/tsconfig.json index b65889af68..82e6284376 100644 --- a/types/happypack/tsconfig.json +++ b/types/happypack/tsconfig.json @@ -2,11 +2,12 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, + "strictNullChecks": false, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -17,6 +18,6 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts", + "index.d.ts" ] -} +} \ No newline at end of file diff --git a/types/happypack/tslint.json b/types/happypack/tslint.json index 8f312f8fa9..a41bf5d19a 100644 --- a/types/happypack/tslint.json +++ b/types/happypack/tslint.json @@ -1,4 +1,79 @@ { - "extends": ["tslint:recommended", "tslint-config-prettier"] + "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 newline at end of file From c37c0288cc72c5c611c7fd29a507f781e6a4ed73 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Tue, 29 Jan 2019 13:32:53 +0530 Subject: [PATCH 164/266] Update index.d.ts --- types/happypack/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/happypack/index.d.ts b/types/happypack/index.d.ts index c42bdc1cf7..e1f6a8947e 100644 --- a/types/happypack/index.d.ts +++ b/types/happypack/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/amireh/happypack // Definitions by: Akash Vishwakarma // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 import { Plugin } from 'webpack'; From 11a7577404c497b77781b4564dc8617a06e2803b Mon Sep 17 00:00:00 2001 From: Erik Zivkovic Date: Tue, 29 Jan 2019 11:31:17 +0100 Subject: [PATCH 165/266] Typo: Bootstrap v3 should say Bootstrap v4 --- types/react-bootstrap/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap/README.md b/types/react-bootstrap/README.md index 114130171d..ec1bfc027f 100644 --- a/types/react-bootstrap/README.md +++ b/types/react-bootstrap/README.md @@ -7,7 +7,7 @@ The reason is that react-bootstrap `v1.0.0` targets Bootstrap v4, and includes i typings. react-bootstrap prior to `v1.0.0` targets Bootstrap v3 and does not include any typings. -It does not make sense for everyone to upgrade to Bootstrap v3, therefore these typings +It does not make sense for everyone to upgrade to Bootstrap v4, therefore these typings are useful for everyone that wants to stay on Bootstrap v3 and react-bootstrap prior to `v1.0.0`. The typings for `v1.0.0` were merged in [this pull request](https://github.com/react-bootstrap/react-bootstrap/commit/2079b2292afb835d036fcceef47e8938c4a8d86a). From e891129be1adea5d0869b10accf844f3fda05f58 Mon Sep 17 00:00:00 2001 From: use-strict Date: Tue, 29 Jan 2019 11:47:44 +0100 Subject: [PATCH 166/266] Update types/webpack-env/index.d.ts Co-Authored-By: luuksommers --- types/webpack-env/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index 0fde1243f4..293f06797d 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -32,7 +32,7 @@ declare namespace __WebpackModuleApi { * This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used. */ ensure(paths: string[], callback: (require: NodeRequire) => void, errorCallback?: (error: any) => void, chunkName?: string): void; - context(path: string, deep?: boolean, filter?: RegExp, mode?: string): RequireContext; + context(path: string, deep?: boolean, filter?: RegExp, mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once"): RequireContext; /** * Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. * From 4a6613663a2c998ad226c1273aead879dbb692e4 Mon Sep 17 00:00:00 2001 From: Dan <32849715+ddangelo-shoprunner@users.noreply.github.com> Date: Tue, 29 Jan 2019 10:43:46 -0500 Subject: [PATCH 167/266] typo - AuthorizeOptions accessType --- types/auth0-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index f2cc95105c..4fcbb5df33 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -812,7 +812,7 @@ export interface AuthorizeOptions { login_hint?: string; prompt?: string; mode?: "login" | "signUp"; - acccessType?: string; + accessType?: string; approvalPrompt?: string; } From c1c961cde8057a68e9edff9665f1924f2d7496e9 Mon Sep 17 00:00:00 2001 From: Jeroen Claassens Date: Tue, 29 Jan 2019 16:55:47 +0100 Subject: [PATCH 168/266] Add type definitions for mui-datatables Signed-off-by: Jeroen Claassens --- types/mui-datatables/index.d.ts | 173 ++++++++++++++++++ types/mui-datatables/mui-datatables-tests.tsx | 83 +++++++++ types/mui-datatables/tsconfig.json | 25 +++ types/mui-datatables/tslint.json | 1 + 4 files changed, 282 insertions(+) create mode 100644 types/mui-datatables/index.d.ts create mode 100644 types/mui-datatables/mui-datatables-tests.tsx create mode 100644 types/mui-datatables/tsconfig.json create mode 100644 types/mui-datatables/tslint.json diff --git a/types/mui-datatables/index.d.ts b/types/mui-datatables/index.d.ts new file mode 100644 index 0000000000..8a65c257c1 --- /dev/null +++ b/types/mui-datatables/index.d.ts @@ -0,0 +1,173 @@ +// Type definitions for mui-datatables 2.0 +// Project: https://github.com/gregnb/mui-datatable +// Definitions by: Jeroen "Favna" Claassens +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from 'react'; + +interface MUIDataTableData { + index: number; + data: any[]; +} + +interface MUIDataTableStateRows { + data: string[]; + lookup: any; +} + +interface MUIDataTableState { + announceText: string | null; + activeColumn: string | null; + page: number; + rowsPerPage: number; + filterList: string[][]; + selectedRows: MUIDataTableStateRows; + expandedRows: MUIDataTableStateRows; + showResponsive: boolean; + searchText: string | null; + rowsPerPageOptions: number[]; +} + +interface MUIDataTableMeta { + rowIndex: number; + columnIndex: number; + columnData: MUIDataTableColumnOptions[]; + rowData: any[]; + tableData: MUIDataTableData[]; + tableState: MUIDataTableState; +} + +interface MUIDataTableCustomHeadRenderer extends MUIDataTableColumn { + index: number; +} + +interface MUIDataTableColumn { + name: string; + options?: MUIDataTableColumnOptions; +} + +interface MUIDataTableTextLabelsBody { + noMatch: string; + toolTip: string; +} + +interface MUIDataTableTextLabelsPagination { + next: string; + previous: string; + rowsPerPage: string; + displayRows: string; +} + +interface MUIDataTableTextLabelsToolbar { + search: string; + downloadCsv: string; + print: string; + viewColumns: string; + filterTable: string; +} + +interface MUIDataTableTextLabelsFilter { + all: string; + title: string; + reset: string; +} + +interface MUIDataTableTextLabelsViewColumns { + title: string; + titleAria: string; +} + +interface MUIDataTableTextLabelsSelectedRows { + text: string; + delete: string; + deleteAria: string; +} + +interface MUIDataTableTextLabels { + body: MUIDataTableTextLabelsBody; + pagination: MUIDataTableTextLabelsPagination; + toolbar: MUIDataTableTextLabelsToolbar; + filter: MUIDataTableTextLabelsFilter; + viewColumns: MUIDataTableTextLabelsViewColumns; + selectedRows: MUIDataTableTextLabelsSelectedRows; +} + +export interface MUIDataTableColumnOptions { + display?: 'true' | 'false' | 'excluded'; + filter?: boolean; + filterList?: string[]; + filterOptions?: string[]; + sort?: boolean; + sortDirection?: 'asc' | 'desc'; + download?: boolean; + hint?: string; + customHeadRender?: (columnMeta: MUIDataTableCustomHeadRenderer, updateDirection: (params: any) => any) => string; + customBodyRender?: (value: any, tableMeta: MUIDataTableMeta, updateValue: (s: any, c: any, p: any) => any) => string | React.ReactNode; + setCellProps?: (cellValue: string, rowIndex: number, columnIndex: number) => string; +} + +export interface MUIDataTableOptions { + page?: number; + count?: number; + serverSide?: boolean; + rowsSelected?: any[]; + filterType?: 'dropdown' | 'checkbox' | 'multiselect' | 'textField'; + textLabels?: MUIDataTableTextLabels; + pagination?: boolean; + selectableRows?: boolean; + IsRowSelectable?: (dataIndex: any) => boolean; + resizableColumns?: boolean; + expandableRows?: boolean; + renderExpandableRow?: (rowData: string[], rowMeta: { dataIndex: number; rowIndex: number }) => React.ReactNode; + customToolbar?: () => React.ReactNode; + customToolbarSelect?: () => React.ReactNode; + customFooter?: () => React.ReactNode; + customSort?: (data: any[], colIndex: number, order: string) => any[]; + elevation?: number; + caseSensitive?: boolean; + responsive?: 'stacked' | 'scroll'; + rowsPerPage?: number; + rowsPerPageOptions?: number[]; + rowHover?: boolean; + fixedHeader?: boolean; + sortFilterList?: boolean; + sort?: boolean; + filter?: boolean; + search?: boolean; + print?: boolean; + download?: boolean; + downloadOptions?: { filename: string; separator: string }; + viewColumns?: boolean; + onRowsSelect?: (currentRowsSelected: any[], rowsSelected: any[]) => void; + onRowsDelete?: (rowsDeleted: any[]) => void; + onRowClick?: (rowData: string[], rowMeta: { dataIndex: number; rowIndex: number }) => void; + onCellClick?: (colIndex: number, rowIndex: number) => void; + onChangePage?: (currentPage: number) => void; + onChangeRowsPerPage?: (numberOfRows: number) => void; + onSearchChange?: (searchText: string) => void; + onFilterChange?: (changedColumn: string, filterList: any[]) => void; + onColumnSortChange?: (changedColumn: string, direction: string) => void; + onColumnViewChange?: (changedColumn: string, action: string) => void; + onTableChange?: (action: string, tableState: object) => void; + setRowProps?: (row: any[], rowIndex: number) => any; +} + +export type MUIDataTableColumnDef = string | MUIDataTableColumn; + +export interface MuiDatatablesTableState { + page: number; + rowsPerPage: number; + filterList: any[]; +} + +export interface MUIDataTableProps { + title: string; + columns: MUIDataTableColumnDef[]; + data: any[]; + options?: MUIDataTableOptions; +} + +export const MUIDataTable: React.ComponentType; + +export default MUIDataTable; diff --git a/types/mui-datatables/mui-datatables-tests.tsx b/types/mui-datatables/mui-datatables-tests.tsx new file mode 100644 index 0000000000..5ad018082e --- /dev/null +++ b/types/mui-datatables/mui-datatables-tests.tsx @@ -0,0 +1,83 @@ +import MUIDataTable, { MUIDataTableColumnDef, MUIDataTableOptions } from 'mui-datatables'; +import * as React from 'react'; + +const dataSimple: string[][] = [ + ['Joe James', 'Test Corp', 'Yonkers', 'NY'], + ['John Walsh', 'Test Corp', 'Hartford', 'CT'], + ['Bob Herm', 'Test Corp', 'Tampa', 'FL'], + ['James Houston', 'Test Corp', 'Dallas', 'TX'] +]; + +const columnWithOptions: MUIDataTableColumnDef[] = [ + { + name: 'Name', + options: { + display: 'true', + filter: true, + sort: true, + sortDirection: 'asc', + download: true, + } + } +]; + +const options: MUIDataTableOptions = { + filterType: 'checkbox', + responsive: 'scroll', + selectableRows: false, + elevation: 0, + rowsPerPageOptions: [5, 10, 20, 25, 50, 100], + downloadOptions: { + filename: 'filename.csv', + separator: ',' + }, + sortFilterList: false, + textLabels: { + body: { + noMatch: 'Sorry, no matching records found', + toolTip: 'Sort', + }, + pagination: { + next: 'Next Page', + previous: 'Previous Page', + rowsPerPage: 'Rows per page:', + displayRows: 'of', + }, + toolbar: { + search: 'Search', + downloadCsv: 'Download CSV', + print: 'Print', + viewColumns: 'View Columns', + filterTable: 'Filter Table', + }, + filter: { + all: 'All', + title: 'FILTERS', + reset: 'RESET', + }, + viewColumns: { + title: 'Show Columns', + titleAria: 'Show/Hide Table Columns', + }, + selectedRows: { + text: 'rows(s) selected', + delete: 'Delete', + deleteAria: 'Delete Selected Rows', + } + } +}; + +class MuiDataTable extends React.Component { + render() { + return ( + + ); + } +} + +; diff --git a/types/mui-datatables/tsconfig.json b/types/mui-datatables/tsconfig.json new file mode 100644 index 0000000000..280efbb284 --- /dev/null +++ b/types/mui-datatables/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mui-datatables-tests.tsx" + ] +} diff --git a/types/mui-datatables/tslint.json b/types/mui-datatables/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mui-datatables/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From eb0e2a8404e869132825fe3b1661e62dd440647a Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 29 Jan 2019 08:31:18 -0800 Subject: [PATCH 169/266] Update README to make typesVersions optional --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4343577bd0..7508fbc15f 100644 --- a/README.md +++ b/README.md @@ -268,8 +268,9 @@ Then you will have to add a comment to the last line of your definition header ( #### I want to use features from TypeScript 3.1 or above. -You will need to use the `typesVersions` feature of TypeScript 3.1 and above. You can find a detailed explanation -of this feature in the [official TypeScript documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#version-selection-with-typesversions). +You can use the same `// TypeScript Version: 3.1` comment as above. +However, if your project needs to maintain types that are compatible with 3.1 and above *at the same time as* types that are compatible with 3.0 or below, you will need to use the `typesVersions` feature, which is available in TypeScript 3.1 and above. +You can find a detailed explanation of this feature in the [official TypeScript documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#version-selection-with-typesversions). Here's a short explanation to get you started: From 9db4cf5acae5ee1076b49f8442b4a013e2592b00 Mon Sep 17 00:00:00 2001 From: Florian Blischke Date: Tue, 29 Jan 2019 18:35:52 +0100 Subject: [PATCH 170/266] fixed version --- types/jquery.soap/index.d.ts | 2 +- types/jquery.soap/tslint.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/types/jquery.soap/index.d.ts b/types/jquery.soap/index.d.ts index f511d05575..9a802163e4 100644 --- a/types/jquery.soap/index.d.ts +++ b/types/jquery.soap/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jQuery.SOAP 1.7.3 +// Type definitions for jQuery.SOAP 1.7 // Project: https://github.com/doedje/jquery.soap // Definitions by: Roland Greim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/ diff --git a/types/jquery.soap/tslint.json b/types/jquery.soap/tslint.json index a41bf5d19a..a0357daa61 100644 --- a/types/jquery.soap/tslint.json +++ b/types/jquery.soap/tslint.json @@ -7,7 +7,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, From a61dfc49583ce7e1b8b3352e172cdb6bb5c92eef Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Tue, 29 Jan 2019 15:31:08 -0300 Subject: [PATCH 171/266] [trezor-connect] Fix Output types --- types/trezor-connect/index.d.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/types/trezor-connect/index.d.ts b/types/trezor-connect/index.d.ts index c9c5fb258d..282117efda 100644 --- a/types/trezor-connect/index.d.ts +++ b/types/trezor-connect/index.d.ts @@ -249,7 +249,13 @@ export interface Input { export interface RegularOutput { address: string; amount: string; - script_type: string; + script_type?: string; +} + +export interface InternalOutput { + address_n: number[]; + amount: string; + script_type?: string; } export interface SendMaxOutput { @@ -262,7 +268,7 @@ export interface OpReturnOutput { dataHex: string; } -export type Output = RegularOutput | SendMaxOutput | OpReturnOutput; +export type Output = RegularOutput | InternalOutput | SendMaxOutput | OpReturnOutput; export interface SignTransactionParams extends CommonParams { inputs: Input[]; From cc2043909f0e015830241affc9f847982ef6dc8e Mon Sep 17 00:00:00 2001 From: Daniel Rose Date: Tue, 29 Jan 2019 19:51:16 +0100 Subject: [PATCH 172/266] Add missing methods of SCServerSocket. (#32589) Also updates and fixes some properties missing in SCServer. --- types/socketcluster-server/scserver.d.ts | 8 ++- .../socketcluster-server/scserversocket.d.ts | 54 ++++++++++++++++++- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/types/socketcluster-server/scserver.d.ts b/types/socketcluster-server/scserver.d.ts index c04c4888f0..d6e808b245 100644 --- a/types/socketcluster-server/scserver.d.ts +++ b/types/socketcluster-server/scserver.d.ts @@ -3,7 +3,7 @@ import { Secret } from "jsonwebtoken"; import { ServerOptions } from "https"; import { IncomingMessage, Server } from "http"; import { SCAuthEngine } from "sc-auth"; -import { SCExchange } from "sc-broker-cluster"; +import { SCExchange, Client } from "sc-broker-cluster"; import WebSocket = require("ws"); import SCServerSocket = require("./scserversocket"); @@ -18,6 +18,7 @@ declare class SCServer extends EventEmitter { readonly MIDDLEWARE_EMIT: "emit"; options: SCServer.SCServerOptions; + brokerEngine: Client; exchange: SCExchange; clients: { @@ -58,7 +59,10 @@ declare class SCServer extends EventEmitter { removeMiddleware(type: "emit", middlewareFn: (req: SCServer.EmitRequest, next: SCServer.nextMiddlewareFunction) => void): void; setAuthEngine(authEngine: SCAuthEngine): void; + auth: SCAuthEngine; + setCodecEngine(codecEngine: SCServer.SCCodecEngine): void; + codec: SCServer.SCCodecEngine; close(cb?: (err?: Error) => void): void; @@ -348,7 +352,7 @@ declare namespace SCServer { interface SCCodecEngine { decode: (input: any) => any; - ncode: (object: any) => any; + encode: (object: any) => any; } interface VerifyHandshakeInfo { diff --git a/types/socketcluster-server/scserversocket.d.ts b/types/socketcluster-server/scserversocket.d.ts index 7b32cef72c..c4440a13f3 100644 --- a/types/socketcluster-server/scserversocket.d.ts +++ b/types/socketcluster-server/scserversocket.d.ts @@ -29,15 +29,65 @@ declare class SCServerSocket extends Emitter { constructor(id: string, server: SCServer, socket: WebSocket); + on(event: "error", listener: (error: Error) => void): this; + on(event: "message" | "raw", listener: (message: WebSocket.Data) => void): this; + on(event: "connectAbort" | "disconnect" | "close", listener: (code: number, data?: any) => void): this; + on(event: "authStateChange", listener: (stateChangeData: SCServerSocket.StateChangeData) => void): this; + on(event: "authenticate", listener: (authToken?: SCServer.AuthToken) => void): this; + on(event: "deauthenticate", listener: (oldToken?: SCServer.AuthToken) => void): this; + getState(): "connecting" | "open" | "closed"; + getBytesReceived(): number; + disconnect(code?: number, data?: any): void; + destroy(code?: number, data?: any): void; + terminate(): void; + send(data: any, options: { mask?: boolean; binary?: boolean; compress?: boolean; fin?: boolean }): void; + + decode(message: any): any; + encode(object: any): any; + + sendObjectBatch(object: any): void; + sendObjectSingle(object: any): void; + sendObject(object: any, options?: { batch?: boolean }): void; + + emit(event: string, ...args: any[]): boolean; + emit(event: string, data: any, callback?: SCServerSocket.EmitCallback, options?: SCServerSocket.EmitOptions): void; + + triggerAuthenticationEvents(oldState: "authenticated" | "unauthenticated"): void; + getAuthToken(): SCServer.AuthToken; - setAuthToken(data: SCServer.AuthToken, options?: SignOptions): void; - deauthenticate(): void; + setAuthToken(data: SCServer.AuthToken, options?: SignOptions, callback?: SCServerSocket.EmitCallback): void; + + deauthenticateSelf(): void; + deauthenticate(callback?: SCServerSocket.EmitCallback): void; + kickOut(channel?: string, message?: string, callback?: () => void): void; + subscriptions(): string[]; isSubscribed(channel?: string): boolean; } export = SCServerSocket; + +declare namespace SCServerSocket { + type EmitCallback = (err: Error, eventObject: EventObject) => void; + + interface EventObject { + event: string; + data?: any; + cid?: number; + } + + interface EmitOptions { + useCache?: boolean; + stringifiedData?: string; + } + + interface StateChangeData { + oldState: "authenticated" | "unauthenticated"; + newState: "authenticated" | "unauthenticated"; + authToken?: SCServer.AuthToken; + } +} From 22ba29d7a075d4054d135ce3eee33a27807c4dda Mon Sep 17 00:00:00 2001 From: Tobi Date: Tue, 29 Jan 2019 20:00:40 +0100 Subject: [PATCH 173/266] [koa-bouncer] fixes ValidatorError/ValidationError typo (#32481) --- types/koa-bouncer/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/koa-bouncer/index.d.ts b/types/koa-bouncer/index.d.ts index 7b881f2b5c..af3a8b6693 100644 --- a/types/koa-bouncer/index.d.ts +++ b/types/koa-bouncer/index.d.ts @@ -7,7 +7,7 @@ import { Middleware, Context } from 'koa'; declare namespace KoaBouncer { - export class ValidatorError extends Error { + export class ValidationError extends Error { name: string; message: string; bouncer: { @@ -88,4 +88,4 @@ declare module "koa" { } } -export = KoaBouncer; \ No newline at end of file +export = KoaBouncer; From b95ec122409ba19829979549c7006cfa86c86c2c Mon Sep 17 00:00:00 2001 From: Scott Humphries Date: Tue, 29 Jan 2019 13:12:14 -0600 Subject: [PATCH 174/266] Add jest test to frisby --- types/frisby/frisby-tests.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/frisby/frisby-tests.ts b/types/frisby/frisby-tests.ts index d0bb27ff20..65a7315790 100644 --- a/types/frisby/frisby-tests.ts +++ b/types/frisby/frisby-tests.ts @@ -18,4 +18,9 @@ describe('Test Suite 1', () => { .expect('status', 418) .done(done); }); + + it('should handle jest matchers', () => { + const str = 'bar'; + expect(str).toHaveLength(3); + }); }); From 00b0305f7eeaec761670a202b0d35cf3d9dba9ae Mon Sep 17 00:00:00 2001 From: Vlad Shcherbin Date: Tue, 29 Jan 2019 22:41:56 +0300 Subject: [PATCH 175/266] Add rollup-plugin-delete types --- types/rollup-plugin-delete/index.d.ts | 24 +++++++++++++++++++ types/rollup-plugin-delete/package.json | 7 ++++++ .../rollup-plugin-delete-tests.ts | 13 ++++++++++ types/rollup-plugin-delete/tsconfig.json | 23 ++++++++++++++++++ types/rollup-plugin-delete/tslint.json | 1 + 5 files changed, 68 insertions(+) create mode 100644 types/rollup-plugin-delete/index.d.ts create mode 100644 types/rollup-plugin-delete/package.json create mode 100644 types/rollup-plugin-delete/rollup-plugin-delete-tests.ts create mode 100644 types/rollup-plugin-delete/tsconfig.json create mode 100644 types/rollup-plugin-delete/tslint.json diff --git a/types/rollup-plugin-delete/index.d.ts b/types/rollup-plugin-delete/index.d.ts new file mode 100644 index 0000000000..9f9cfe020d --- /dev/null +++ b/types/rollup-plugin-delete/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for rollup-plugin-delete 0.2 +// Project: https://github.com/vladshcherbin/rollup-plugin-delete#readme +// Definitions by: Vlad Shcherbin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import del = require('del'); +import { Plugin } from 'rollup'; + +export interface Options extends del.Options { + /** + * Patterns of files and folders to be deleted. + * @default [] + */ + readonly targets: ReadonlyArray | string; + + /** + * Outputs removed files and folders to console. + * @default false + */ + readonly verbose?: boolean; +} + +export default function(options?: Options): Plugin; diff --git a/types/rollup-plugin-delete/package.json b/types/rollup-plugin-delete/package.json new file mode 100644 index 0000000000..8daa001274 --- /dev/null +++ b/types/rollup-plugin-delete/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "dependencies": { + "@types/del": "^3.0.1", + "rollup": ">=0.60.0" + } +} diff --git a/types/rollup-plugin-delete/rollup-plugin-delete-tests.ts b/types/rollup-plugin-delete/rollup-plugin-delete-tests.ts new file mode 100644 index 0000000000..eff3508e29 --- /dev/null +++ b/types/rollup-plugin-delete/rollup-plugin-delete-tests.ts @@ -0,0 +1,13 @@ +import del from 'rollup-plugin-delete'; + +del(); // $ExpectType Plugin + +del({}); // $ExpectError + +del({ targets: '/dist' }); // $ExpectType Plugin + +del({ targets: ['/dist'], verbose: true }); // $ExpectType Plugin + +del({ targets: ['/dist'], verbose: true, dryRun: true }); // $ExpectType Plugin + +del({ targets: ['/dist'], verbose: true, dryRun: true, debug: true }); // $ExpectType Plugin diff --git a/types/rollup-plugin-delete/tsconfig.json b/types/rollup-plugin-delete/tsconfig.json new file mode 100644 index 0000000000..d03999e03a --- /dev/null +++ b/types/rollup-plugin-delete/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", + "rollup-plugin-delete-tests.ts" + ] +} diff --git a/types/rollup-plugin-delete/tslint.json b/types/rollup-plugin-delete/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rollup-plugin-delete/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b9ac343d1126748daa40c57d0c797d8416bb1a71 Mon Sep 17 00:00:00 2001 From: Vlad Shcherbin Date: Tue, 29 Jan 2019 23:19:55 +0300 Subject: [PATCH 176/266] Remove @types dependency from package.json --- types/rollup-plugin-delete/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/types/rollup-plugin-delete/package.json b/types/rollup-plugin-delete/package.json index 8daa001274..272f65edde 100644 --- a/types/rollup-plugin-delete/package.json +++ b/types/rollup-plugin-delete/package.json @@ -1,7 +1,6 @@ { "private": true, "dependencies": { - "@types/del": "^3.0.1", "rollup": ">=0.60.0" } } From e126c80e8dadc1a0f0f75c5da8ce43741cccdedf Mon Sep 17 00:00:00 2001 From: maksimovicdanijel Date: Sun, 27 Jan 2019 17:29:04 +0100 Subject: [PATCH 177/266] Add types for react-howler package --- types/react-howler/index.d.ts | 49 +++++++++++++++++++++++ types/react-howler/react-howler-tests.tsx | 39 ++++++++++++++++++ types/react-howler/tsconfig.json | 17 ++++++++ types/react-howler/tslint.json | 1 + 4 files changed, 106 insertions(+) create mode 100644 types/react-howler/index.d.ts create mode 100644 types/react-howler/react-howler-tests.tsx create mode 100644 types/react-howler/tsconfig.json create mode 100644 types/react-howler/tslint.json diff --git a/types/react-howler/index.d.ts b/types/react-howler/index.d.ts new file mode 100644 index 0000000000..51722f9079 --- /dev/null +++ b/types/react-howler/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for react-howler 3.7 +// Project: https://github.com/thangngoc89/react-howler +// Definitions by: Danijel Maksimovic +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.2 + +/// +/// + +import * as React from 'react'; +import { Howl } from 'howler'; + +declare enum HOWLER_STATE { + UNLOADED = 'unloaded', + LOADING = 'loading', + LOADED = 'loaded' +} + +interface Props { + src: string | string[]; + format?: string[]; + playing?: boolean; + mute?: boolean; + loop?: boolean; + preload?: boolean; + volume?: number; + onEnd?: () => void; + onPause?: () => void; + onPlay?: (id: number) => void; + onVolume?: (id: number) => void; + onStop?: (id: number) => void; + onLoad?: () => void; + onLoadError?: (id: number) => void; + html5?: boolean; +} + +declare class ReactHowler extends React.Component { + stop(id?: number): void; + + duration(id?: number): number; + + seek(time: number): number; + + howlerState(): HOWLER_STATE; + + howler: Howl; +} + +export default ReactHowler; diff --git a/types/react-howler/react-howler-tests.tsx b/types/react-howler/react-howler-tests.tsx new file mode 100644 index 0000000000..e840da7dde --- /dev/null +++ b/types/react-howler/react-howler-tests.tsx @@ -0,0 +1,39 @@ +import * as React from 'react'; +import ReactHowler from 'react-howler'; + +export class ReactHowlerTest extends React.Component { + private readonly player = React.createRef(); + + render() { + const player = this.player.current; + + if (player) { + player.howler.duration(); + } + + return ( +
+ console.log('playing sound with id ', id)} + onLoad={() => console.log('sound loaded')} + onLoadError={id => + console.log('error loading sound with id ', id) + } + onEnd={() => console.log('sound ended')} + onPause={() => console.log('sound paused')} + onStop={id => console.log('sound with id paused', id)} + volume={0.5} + onVolume={id => console.log('volume changed', id)} + loop={true} + html5={true} + format={['mp3']} + preload={false} + ref={this.player} + /> +
+ ); + } +} diff --git a/types/react-howler/tsconfig.json b/types/react-howler/tsconfig.json new file mode 100644 index 0000000000..fe1b001df3 --- /dev/null +++ b/types/react-howler/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "jsx": "react", + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": false + }, + "files": ["index.d.ts", "react-howler-tests.tsx"] +} diff --git a/types/react-howler/tslint.json b/types/react-howler/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-howler/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bbb2666fa4e348e6ed17488b503fd841b383c9ed Mon Sep 17 00:00:00 2001 From: Jeroen Claassens Date: Tue, 29 Jan 2019 23:23:26 +0100 Subject: [PATCH 178/266] Fix export declaration Signed-off-by: Jeroen Claassens --- types/mui-datatables/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mui-datatables/index.d.ts b/types/mui-datatables/index.d.ts index 8a65c257c1..055406cc6f 100644 --- a/types/mui-datatables/index.d.ts +++ b/types/mui-datatables/index.d.ts @@ -168,6 +168,6 @@ export interface MUIDataTableProps { options?: MUIDataTableOptions; } -export const MUIDataTable: React.ComponentType; +declare const MUIDataTable: React.ComponentType; export default MUIDataTable; From ea9401ad865543ea29901d650c295203c0c9c3b8 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Wed, 30 Jan 2019 00:17:32 +0100 Subject: [PATCH 179/266] Added documentation --- types/coinbase/index.d.ts | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/types/coinbase/index.d.ts b/types/coinbase/index.d.ts index 1e94f04295..82fc32a7d3 100644 --- a/types/coinbase/index.d.ts +++ b/types/coinbase/index.d.ts @@ -915,12 +915,24 @@ export class Buy implements Resource { */ payout_at?: string; + /** + * Unit price of the base currency. + */ unit_price: UnitPrice; + /** + * Hold period for transfer. + */ hold_business_days: number; + /** + * Is it the first buy for this symbol? + */ is_first_buy: boolean; + /** + * Is there another action required to make the transfer pass? + */ requires_completion_step: boolean; /** @@ -934,13 +946,28 @@ export class Buy implements Resource { } export interface Fee { - amount: string; + /** + * Amount associated to this fee + */ + amount: MoneyHash; + /** + * Fee beneficiary ("bank", "coinbase", ...) + */ type: string; } export interface UnitPrice { + /** + * Amount as floating-point in a string + */ amount: string; + /** + * Currency e.g. "BTC" (see Client#getCurrencies() for available strings) + */ currency: string; + /** + * Type of price + */ scale: number; } From edd2f7162106ec46dd7721cf6224a24197001c8b Mon Sep 17 00:00:00 2001 From: Andrew Potter Date: Tue, 29 Jan 2019 16:28:58 -0700 Subject: [PATCH 180/266] Split options to improve signature recongition --- types/clean-css/clean-css-tests.ts | 29 +++++++++++++++++++++++ types/clean-css/index.d.ts | 38 ++++++++++++++++++++---------- 2 files changed, 55 insertions(+), 12 deletions(-) diff --git a/types/clean-css/clean-css-tests.ts b/types/clean-css/clean-css-tests.ts index 9c856d40a1..6c92a5ae88 100644 --- a/types/clean-css/clean-css-tests.ts +++ b/types/clean-css/clean-css-tests.ts @@ -81,3 +81,32 @@ new CleanCSS({ returnPromise: true, sourceMap: true }).minify(source, inputSourc console.log(error); } ); + +// test object return when passing options as object +let CleanCssOptions: CleanCSS.Options = { returnPromise: true }; +new CleanCSS(CleanCssOptions).minify(source) + .then((minified: CleanCSS.Output): void => { + console.log(minified.styles); + }).catch((error: any): void => { + console.log(error); + } +); + +CleanCssOptions = { returnPromise: false }; +new CleanCSS(CleanCssOptions).minify(source, (error: any, minified: CleanCSS.Output): void => { + console.log(minified.styles); +}); + + +// type conversion +CleanCssOptions = {}; +// in this case, the compiler will think its an OptionsOutput +// so if we want to make it a promise, we will need to cast it specifically its a promise type return +(CleanCssOptions = CleanCssOptions as CleanCSS.OptionsPromise).returnPromise = true; +new CleanCSS(CleanCssOptions).minify(source) + .then((minified: CleanCSS.Output): void => { + console.log(minified.styles); + }).catch((error: any): void => { + console.log(error); + } +); \ No newline at end of file diff --git a/types/clean-css/index.d.ts b/types/clean-css/index.d.ts index 244c585e53..f806397540 100644 --- a/types/clean-css/index.d.ts +++ b/types/clean-css/index.d.ts @@ -9,15 +9,16 @@ import { RequestOptions as HttpsRequestOptions } from "https"; import { RequestOptions as HttpRequestOptions } from "http"; declare namespace CleanCSS { + /** - * Options passed when initializing a new instance of CleanCSS + * Shared options passed when initializing a new instance of CleanCSS that returns either a promise or output */ - interface Options { + interface OptionsBase { /** * Controls compatibility mode used; defaults to ie10+ using `'*'`. * Compatibility hash exposes the following properties: `colors`, `properties`, `selectors`, and `units` */ - compatibility?: "*" | "ie9" | "ie8" | "ie7" | CompatibilityOptions; + compatibility?: "*" | "ie9" | "ie8" | "ie7" | CleanCSS.CompatibilityOptions; /** * Controls a function for handling remote requests; Defaults to the build in `loadRemoteResource` function @@ -28,7 +29,7 @@ declare namespace CleanCSS { * Controls output CSS formatting; defaults to `false`. * Format hash exposes the following properties: `breaks`, `breakWith`, `indentBy`, `indentWith`, `spaces`, and `wrapAt`. */ - format?: "beautify" | "keep-breaks" | FormatOptions | false; + format?: "beautify" | "keep-breaks" | CleanCSS.FormatOptions | false; /** * inline option whitelists which @import rules will be processed. Defaults to `'local'` @@ -56,7 +57,7 @@ declare namespace CleanCSS { * Controls optimization level used; defaults to `1`. * Level hash exposes `1`, and `2`. */ - level?: 0 | 1 | 2 | OptimizationsOptions; + level?: 0 | 1 | 2 | CleanCSS.OptimizationsOptions; /** * Controls URL rebasing; defaults to `true`; @@ -69,11 +70,6 @@ declare namespace CleanCSS { */ rebaseTo?: string; - /** - * If you prefer clean-css to return a Promise object then you need to explicitely ask for it; defaults to `false` - */ - returnPromise?: boolean; - /** * Controls whether an output source map is built; defaults to `false` */ @@ -650,12 +646,30 @@ declare namespace CleanCSS { minify(sources: Sources, sourceMap?: string): Promise; } + /** + * Options when returning a promise + */ + type OptionsPromise = OptionsBase & { returnPromise: true }; + + /** + * Options when returning an output + */ + type OptionsOutput = OptionsBase & { returnPromise?: false }; + + /** + * Discriminant union of both sets of options types. If you initialize without setting `returnPromise: true` + * and want to return a promise, you will need to cast to the correct options type so that TypeScript + * knows what the expected return type will be: + * `(options = options as CleanCSS.OptionsPromise).returnPromise = true` + */ + type Options = OptionsPromise | OptionsOutput; + /** * Constructor interface for CleanCSS */ interface Constructor { - new(options: Options & { returnPromise: true }): MinifierPromise; - new(options?: Options): MinifierOutput; + new(options: OptionsPromise): MinifierPromise; + new(options?: OptionsOutput): MinifierOutput; } } From 4a2ad498c36c150c0bf061e3495849d51ec42875 Mon Sep 17 00:00:00 2001 From: Andrew Potter Date: Tue, 29 Jan 2019 16:35:44 -0700 Subject: [PATCH 181/266] Fixed Linting Errors --- types/clean-css/clean-css-tests.ts | 4 ++-- types/clean-css/index.d.ts | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/types/clean-css/clean-css-tests.ts b/types/clean-css/clean-css-tests.ts index 6c92a5ae88..6c01ba1158 100644 --- a/types/clean-css/clean-css-tests.ts +++ b/types/clean-css/clean-css-tests.ts @@ -1,5 +1,6 @@ // Original by Tanguy Krotoff // Updated by Andrew Potter +// TypeScript Version: 2.4 import * as CleanCSS from 'clean-css'; @@ -97,7 +98,6 @@ new CleanCSS(CleanCssOptions).minify(source, (error: any, minified: CleanCSS.Out console.log(minified.styles); }); - // type conversion CleanCssOptions = {}; // in this case, the compiler will think its an OptionsOutput @@ -109,4 +109,4 @@ new CleanCSS(CleanCssOptions).minify(source) }).catch((error: any): void => { console.log(error); } -); \ No newline at end of file +); diff --git a/types/clean-css/index.d.ts b/types/clean-css/index.d.ts index f806397540..c474741ec8 100644 --- a/types/clean-css/index.d.ts +++ b/types/clean-css/index.d.ts @@ -9,7 +9,6 @@ import { RequestOptions as HttpsRequestOptions } from "https"; import { RequestOptions as HttpRequestOptions } from "http"; declare namespace CleanCSS { - /** * Shared options passed when initializing a new instance of CleanCSS that returns either a promise or output */ @@ -18,7 +17,7 @@ declare namespace CleanCSS { * Controls compatibility mode used; defaults to ie10+ using `'*'`. * Compatibility hash exposes the following properties: `colors`, `properties`, `selectors`, and `units` */ - compatibility?: "*" | "ie9" | "ie8" | "ie7" | CleanCSS.CompatibilityOptions; + compatibility?: "*" | "ie9" | "ie8" | "ie7" | CompatibilityOptions; /** * Controls a function for handling remote requests; Defaults to the build in `loadRemoteResource` function @@ -29,7 +28,7 @@ declare namespace CleanCSS { * Controls output CSS formatting; defaults to `false`. * Format hash exposes the following properties: `breaks`, `breakWith`, `indentBy`, `indentWith`, `spaces`, and `wrapAt`. */ - format?: "beautify" | "keep-breaks" | CleanCSS.FormatOptions | false; + format?: "beautify" | "keep-breaks" | FormatOptions | false; /** * inline option whitelists which @import rules will be processed. Defaults to `'local'` @@ -57,7 +56,7 @@ declare namespace CleanCSS { * Controls optimization level used; defaults to `1`. * Level hash exposes `1`, and `2`. */ - level?: 0 | 1 | 2 | CleanCSS.OptimizationsOptions; + level?: 0 | 1 | 2 | OptimizationsOptions; /** * Controls URL rebasing; defaults to `true`; From fa2c66bdb4d1ab3c5baf8392b52384b10af89af8 Mon Sep 17 00:00:00 2001 From: Andrew Potter Date: Tue, 29 Jan 2019 16:40:52 -0700 Subject: [PATCH 182/266] removed type-test as it forces ts version --- types/clean-css/clean-css-tests.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/types/clean-css/clean-css-tests.ts b/types/clean-css/clean-css-tests.ts index 6c01ba1158..98049b3ef6 100644 --- a/types/clean-css/clean-css-tests.ts +++ b/types/clean-css/clean-css-tests.ts @@ -1,6 +1,5 @@ // Original by Tanguy Krotoff // Updated by Andrew Potter -// TypeScript Version: 2.4 import * as CleanCSS from 'clean-css'; @@ -97,16 +96,3 @@ CleanCssOptions = { returnPromise: false }; new CleanCSS(CleanCssOptions).minify(source, (error: any, minified: CleanCSS.Output): void => { console.log(minified.styles); }); - -// type conversion -CleanCssOptions = {}; -// in this case, the compiler will think its an OptionsOutput -// so if we want to make it a promise, we will need to cast it specifically its a promise type return -(CleanCssOptions = CleanCssOptions as CleanCSS.OptionsPromise).returnPromise = true; -new CleanCSS(CleanCssOptions).minify(source) - .then((minified: CleanCSS.Output): void => { - console.log(minified.styles); - }).catch((error: any): void => { - console.log(error); - } -); From bc8c6cabd0ce252a9f5e45011666ff3984b94e76 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Tue, 29 Jan 2019 16:04:09 -0800 Subject: [PATCH 183/266] Add beta tags to EnhancedLocation methods --- types/office-js-preview/index.d.ts | 32 ++++++++++++++++++++++++++---- types/office-js/index.d.ts | 32 ++++++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index e26ab7e8a0..56415c63cd 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -9411,10 +9411,12 @@ declare namespace Office { * * @beta */ - interface EnhancedLocation { + export interface EnhancedLocation { /** * Adds to the set of locations associated with the appointment. * + * [Api set: Mailbox Preview] + * * @remarks * * @@ -9436,11 +9438,15 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + * + * @beta */ addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; /** * Adds to the set of locations associated with the appointment. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9456,11 +9462,15 @@ declare namespace Office { * @param locationIdentifiers The locations to be added to the current list of locations. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + * + * @beta */ addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; /** * Gets the set of locations associated with the appointment. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9481,11 +9491,15 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. + * + * @beta */ getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; /** * Gets the set of locations associated with the appointment. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9500,6 +9514,8 @@ declare namespace Office { * * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. + * + * @beta */ getAsync(callback?: (result: Office.AsyncResult) => void): void; /** @@ -9507,6 +9523,8 @@ declare namespace Office { * * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9528,6 +9546,8 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + * + * @beta */ removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; /** @@ -9535,6 +9555,8 @@ declare namespace Office { * * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9550,6 +9572,8 @@ declare namespace Office { * @param locationIdentifiers The locations to be removed from the current list of locations. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + * + * @beta */ removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; } @@ -9964,7 +9988,7 @@ declare namespace Office { */ end: Time; /** - * Gets or sets the locations of the appointment. The `enhancedLocation` property returns an {@link EnhancedLocation} object that + * Gets or sets the locations of the appointment. The `enhancedLocation` property returns an {@link Office.EnhancedLocation} object that * provides methods to get, remove, or add locations on an item. * * [Api set: Mailbox Preview] @@ -11075,8 +11099,8 @@ declare namespace Office { /** * Gets the locations of an appointment. * - * The enhancedLocation property returns an {@link EnhancedLocation} object that allows you to get the set of locations (each represented by - * a {@link LocationDetails} object) associated with the appointment. + * The enhancedLocation property returns an {@link Office.EnhancedLocation} object that allows you to get the set of locations (each represented by + * a {@link Office.LocationDetails} object) associated with the appointment. * * [Api set: Mailbox Preview] * diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 1b3f3c447a..1ff4d05df3 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -9411,10 +9411,12 @@ declare namespace Office { * * @beta */ - interface EnhancedLocation { + export interface EnhancedLocation { /** * Adds to the set of locations associated with the appointment. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9436,11 +9438,15 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + * + * @beta */ addAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; /** * Adds to the set of locations associated with the appointment. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9456,11 +9462,15 @@ declare namespace Office { * @param locationIdentifiers The locations to be added to the current list of locations. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + * + * @beta */ addAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; /** * Gets the set of locations associated with the appointment. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9481,11 +9491,15 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. + * + * @beta */ getAsync(options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; /** * Gets the set of locations associated with the appointment. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9500,6 +9514,8 @@ declare namespace Office { * * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. + * + * @beta */ getAsync(callback?: (result: Office.AsyncResult) => void): void; /** @@ -9507,6 +9523,8 @@ declare namespace Office { * * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9528,6 +9546,8 @@ declare namespace Office { * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + * + * @beta */ removeAsync(locationIdentifiers: LocationIdentifier[], options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResultStatus) => void): void; /** @@ -9535,6 +9555,8 @@ declare namespace Office { * * If there are multiple locations with the same name, all matching locations will be removed even if only one was specified in locationIdentifiers. * + * [Api set: Mailbox Preview] + * * @remarks *
* @@ -9550,6 +9572,8 @@ declare namespace Office { * @param locationIdentifiers The locations to be removed from the current list of locations. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, * asyncResult, which is an Office.AsyncResult object. Check the `status` property of asyncResult to determine if the call succeeded. + * + * @beta */ removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (result: Office.AsyncResultStatus) => void): void; } @@ -9964,7 +9988,7 @@ declare namespace Office { */ end: Time; /** - * Gets or sets the locations of the appointment. The `enhancedLocation` property returns an {@link EnhancedLocation} object that + * Gets or sets the locations of the appointment. The `enhancedLocation` property returns an {@link Office.EnhancedLocation} object that * provides methods to get, remove, or add locations on an item. * * [Api set: Mailbox Preview] @@ -11075,8 +11099,8 @@ declare namespace Office { /** * Gets the locations of an appointment. * - * The enhancedLocation property returns an {@link EnhancedLocation} object that allows you to get the set of locations (each represented by - * a {@link LocationDetails} object) associated with the appointment. + * The enhancedLocation property returns an {@link Office.EnhancedLocation} object that allows you to get the set of locations (each represented by + * a {@link Office.LocationDetails} object) associated with the appointment. * * [Api set: Mailbox Preview] * From 0b3f86bacbaffdbd015c303c42068289a41dba47 Mon Sep 17 00:00:00 2001 From: Janeene Beeforth Date: Wed, 30 Jan 2019 12:23:46 +1100 Subject: [PATCH 184/266] Abstract getters on Luzon Zone are not static. With the current definition, several items that are supposed to be public members/methods are marked static. Since these are supposed to be returning information for a particular zone, and in the luxon source they are not static members/methods, they should not be marked as static. It is not possible to create an implementation for Zone using the current definition. References: https://moment.github.io/luxon/docs/class/src/zone.js~Zone.html https://github.com/moment/luxon/blob/master/src/zone.js --- types/luxon/index.d.ts | 11 ++++++----- types/luxon/luxon-tests.ts | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index 890d0731ad..b5f1134fb5 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -5,6 +5,7 @@ // Jonathan Siebern // Matt R. Wilson // Pietro Vismara +// Janeene Beeforth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -467,11 +468,11 @@ export interface ZoneOffsetOptions { } export class Zone { - static offsetName(ts: number, options?: ZoneOffsetOptions): string; - static isValid: boolean; - static name: string; - static type: string; - static universal: boolean; + offsetName(ts: number, options?: ZoneOffsetOptions): string; + isValid: boolean; + name: string; + type: string; + universal: boolean; equals(other: Zone): boolean; offset(ts: number): number; } diff --git a/types/luxon/luxon-tests.ts b/types/luxon/luxon-tests.ts index 3cadfa5779..df5481094b 100644 --- a/types/luxon/luxon-tests.ts +++ b/types/luxon/luxon-tests.ts @@ -1,4 +1,4 @@ -import { DateTime, Duration, Interval, Info, Settings, IANAZone } from 'luxon'; +import { DateTime, Duration, Interval, Info, Settings, IANAZone, Zone, ZoneOffsetOptions } from 'luxon'; /* DateTime */ const dt = DateTime.local(2017, 5, 15, 8, 30); @@ -285,3 +285,21 @@ dur.reconfigure({ conversionAccuracy: 'longterm' }); // $ExpectType Duration start.until(end); // $ExpectType Interval i.toDuration(['years', 'months', 'days']); // $ExpectType Duration + +/* Sample Zone Implementation */ +class SampleZone extends Zone { + readonly isValid = false; + readonly name = 'Sample'; + readonly type = 'Example'; + readonly universal = true; + + offsetName(ts: number, options?: ZoneOffsetOptions) { + return 'SampleZone'; + } + equals(other: Zone) { + return other.name === this.name; + } + offset(ts: number) { + return 0; + } +} From 8456cf18125d36c7110eedf68a9b6d29505152b2 Mon Sep 17 00:00:00 2001 From: Matt Krick Date: Tue, 29 Jan 2019 17:50:45 -0800 Subject: [PATCH 185/266] fix loadMore call sig, make pageInfo nullable --- types/react-relay/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index acce5bf832..d830d22b18 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -6,6 +6,7 @@ // Nicolas Pirotte // Cameron Knight // Kaare Hoff Skovgaard +// Matt Krick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -130,15 +131,14 @@ export interface PageInfo { } export interface ConnectionData { edges?: ReadonlyArray; - pageInfo?: Partial; + pageInfo?: Partial | null; } export type RelayPaginationProp = RelayProp & { hasMore(): boolean; isLoading(): boolean; loadMore( pageSize: number, - callback: (error?: Error) => void, - options?: RefetchOptions + callback?: (error?: Error) => void ): RelayRuntimeTypes.Disposable | undefined | null; refetchConnection( totalCount: number, From 2b0639b6307d79d61083b1ec602cc59aaff2a785 Mon Sep 17 00:00:00 2001 From: Ilya Zaytsev Date: Mon, 28 Jan 2019 08:20:37 +0700 Subject: [PATCH 186/266] [set-cookie-parser] add options definition --- types/set-cookie-parser/index.d.ts | 10 ++++++++-- .../set-cookie-parser-tests.ts | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/types/set-cookie-parser/index.d.ts b/types/set-cookie-parser/index.d.ts index ea00ab4399..3da321ddb0 100644 --- a/types/set-cookie-parser/index.d.ts +++ b/types/set-cookie-parser/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for set-cookie-parser // Project: https://github.com/nfriedly/set-cookie-parser // Definitions by: Nick Paddock +// Ilya Zaytsev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -8,10 +9,10 @@ declare module "set-cookie-parser" { import http = require("http"); - function SetCookieParser(input: string | ReadonlyArray | http.IncomingMessage): SetCookieParser.Cookie[]; + function SetCookieParser(input: string | ReadonlyArray | http.IncomingMessage, options?: SetCookieParser.Options): SetCookieParser.Cookie[]; namespace SetCookieParser { - function parse(input: string | ReadonlyArray | http.IncomingMessage): Cookie[]; + function parse(input: string | ReadonlyArray | http.IncomingMessage, options?: Options): Cookie[]; function splitCookiesString(input: string | ReadonlyArray | void): string[]; @@ -25,6 +26,11 @@ declare module "set-cookie-parser" { secure?: boolean; httpOnly?: boolean; } + + type Options = { + decodeValues?: boolean; + map?: boolean; + } } export = SetCookieParser; diff --git a/types/set-cookie-parser/set-cookie-parser-tests.ts b/types/set-cookie-parser/set-cookie-parser-tests.ts index ab4e88005d..578e257f0c 100644 --- a/types/set-cookie-parser/set-cookie-parser-tests.ts +++ b/types/set-cookie-parser/set-cookie-parser-tests.ts @@ -88,3 +88,22 @@ assert.deepStrictEqual(cookiesString, [ 'foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure', 'baz=buz; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure', ]) + +// Use decodeValues=false option +var notDecodedValueCookies = setCookie.parse('user=%D0%98%D0%BB%D1%8C%D1%8F%20%D0%97%D0%B0%D0%B9%D1%86%D0%B5%D0%B2; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 3000 10:01:11 GMT; HttpOnly; Secure', { decodeValues: false }); +assert.equal(notDecodedValueCookies[0].value, '%D0%98%D0%BB%D1%8C%D1%8F%20%D0%97%D0%B0%D0%B9%D1%86%D0%B5%D0%B2'); + +var decodedValueCookies = setCookie.parse('user=%D0%98%D0%BB%D1%8C%D1%8F%20%D0%97%D0%B0%D0%B9%D1%86%D0%B5%D0%B2; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 3000 10:01:11 GMT; HttpOnly; Secure', { decodeValues: true }); +assert.equal(decodedValueCookies[0].value, 'Илья Зайцев'); + +// Use map=true option +var expectedCookiesMap = { + foo: { + name: 'foo', + value: 'bar', + maxAge: 1000, + domain: '.example.com', + } +}; +var cookiesMap = setCookie.parse('foo=bar; Max-Age=1000; Domain=.example.com;', { map: true }); +assert.deepStrictEqual(cookiesMap, expectedCookiesMap); \ No newline at end of file From fd1e25151a335a8e942f870038ae1e58b41a60cc Mon Sep 17 00:00:00 2001 From: MuTsunTsai <39870664+MuTsunTsai@users.noreply.github.com> Date: Wed, 30 Jan 2019 10:27:33 +0800 Subject: [PATCH 187/266] Add Size.set methods --- types/paper/index.d.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 08a6d794ad..409366488f 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -1109,6 +1109,37 @@ declare module paper { modulo(size: number[]): Size; modulo(size: number): Size; + /** + * Sets the size with the given width and height values. + * @param width - the width + * @param height - the height + */ + set(width: number, height: number): Size; + + /** + * Sets the size using the numbers in the given array as dimensions. + * @param array - an array of numbers + */ + set(array: number[]): Size; + + /** + * Sets the size using the properties in the given object. + * @param object - the object literal containing properies (width:10, height:10 etc) + */ + set(object: any): Size; + + /** + * Sets the size using the coordinates of the given Size object. + * @param size - the size to duplicate from + */ + set(size: Size): Size; + + /** + * Sets the size using the point.x and point.y values of the given Point object. + * @param point - the point from which to create a size + */ + set(point: Point): Size; + } export interface IFrameEvent { From 6aa2877dbcd97b84ee3bbdd25b73f7d56e840d7d Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Wed, 30 Jan 2019 11:45:52 +0530 Subject: [PATCH 188/266] Incorporating review --- types/happypack/index.d.ts | 13 +++---- types/happypack/tslint.json | 78 +------------------------------------ 2 files changed, 7 insertions(+), 84 deletions(-) diff --git a/types/happypack/index.d.ts b/types/happypack/index.d.ts index e1f6a8947e..d865761784 100644 --- a/types/happypack/index.d.ts +++ b/types/happypack/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for happypack +// Type definitions for happypack 5.0 // Project: https://github.com/amireh/happypack // Definitions by: Akash Vishwakarma // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,17 +6,16 @@ import { Plugin } from 'webpack'; -declare class HappyPack extends Plugin { - - constructor(options?: HappyPack.PluginOptions); -} +export = HappyPack; declare namespace HappyPack { interface PluginOptions { id?: string; threads?: number; - loaders?: any; + loaders: any; } } -export = HappyPack; +declare class HappyPack extends Plugin { + constructor(options: HappyPack.PluginOptions); +} diff --git a/types/happypack/tslint.json b/types/happypack/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/happypack/tslint.json +++ b/types/happypack/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 1f85e5c368f2a09ede8bd6346f960573aa230471 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Wed, 30 Jan 2019 13:09:07 +0530 Subject: [PATCH 189/266] Renaming folder name as it is same as module name i am unable to import in test --- types/happy-pack/happypack-tests.ts | 5 +++++ types/{happypack => happy-pack}/index.d.ts | 9 +++++---- types/{happypack => happy-pack}/tsconfig.json | 8 ++++---- types/{happypack => happy-pack}/tslint.json | 0 4 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 types/happy-pack/happypack-tests.ts rename types/{happypack => happy-pack}/index.d.ts (73%) rename types/{happypack => happy-pack}/tsconfig.json (78%) rename types/{happypack => happy-pack}/tslint.json (100%) diff --git a/types/happy-pack/happypack-tests.ts b/types/happy-pack/happypack-tests.ts new file mode 100644 index 0000000000..7f2c24daf5 --- /dev/null +++ b/types/happy-pack/happypack-tests.ts @@ -0,0 +1,5 @@ +import * as happyPack from 'happy-pack'; + +const ref: happyPack = new happyPack({ + loaders: ['ts-loader'] +}); diff --git a/types/happypack/index.d.ts b/types/happy-pack/index.d.ts similarity index 73% rename from types/happypack/index.d.ts rename to types/happy-pack/index.d.ts index d865761784..e6f30343da 100644 --- a/types/happypack/index.d.ts +++ b/types/happy-pack/index.d.ts @@ -6,9 +6,9 @@ import { Plugin } from 'webpack'; -export = HappyPack; +export = happypack; -declare namespace HappyPack { +declare namespace happypack { interface PluginOptions { id?: string; threads?: number; @@ -16,6 +16,7 @@ declare namespace HappyPack { } } -declare class HappyPack extends Plugin { - constructor(options: HappyPack.PluginOptions); +declare class happypack extends Plugin { + constructor(options: happypack.PluginOptions); } + diff --git a/types/happypack/tsconfig.json b/types/happy-pack/tsconfig.json similarity index 78% rename from types/happypack/tsconfig.json rename to types/happy-pack/tsconfig.json index 82e6284376..bfd5e35551 100644 --- a/types/happypack/tsconfig.json +++ b/types/happy-pack/tsconfig.json @@ -2,12 +2,11 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -18,6 +17,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "happypack-tests.ts" ] } \ No newline at end of file diff --git a/types/happypack/tslint.json b/types/happy-pack/tslint.json similarity index 100% rename from types/happypack/tslint.json rename to types/happy-pack/tslint.json From ce936f03f7725c18a90557a13858acb7bc9f9516 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Wed, 30 Jan 2019 13:10:13 +0530 Subject: [PATCH 190/266] Update happy-pack-tests.ts --- types/happy-pack/{happypack-tests.ts => happy-pack-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/happy-pack/{happypack-tests.ts => happy-pack-tests.ts} (100%) diff --git a/types/happy-pack/happypack-tests.ts b/types/happy-pack/happy-pack-tests.ts similarity index 100% rename from types/happy-pack/happypack-tests.ts rename to types/happy-pack/happy-pack-tests.ts From 4260f90627775dd8a1e7d49a01234a1d932678cf Mon Sep 17 00:00:00 2001 From: Jack Willis-Craig Date: Wed, 30 Jan 2019 17:47:27 +1000 Subject: [PATCH 191/266] fix(react-native): add missing flashScrollIndicators method to FlatList component --- types/react-native/index.d.ts | 5 +++++ types/react-native/test/index.tsx | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 2b59454222..4b06119df2 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -4111,6 +4111,11 @@ export class FlatList extends React.Component> { * by taps on items or by navigation actions. */ recordInteraction: () => void; + + /** + * Displays the scroll indicators momentarily. + */ + flashScrollIndicators: () => void; } /** diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 1fcbe153e6..801565dc8d 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -332,6 +332,14 @@ InteractionManager.runAfterInteractions(() => { }).then(() => "done"); export class FlatListTest extends React.Component, {}> { + list: FlatList | null = null; + + componentDidMount(): void { + if (this.list) { + this.list.flashScrollIndicators(); + } + } + _renderItem = (rowData: any) => { return ( @@ -345,6 +353,7 @@ export class FlatListTest extends React.Component, {}> { render() { return ( (this.list = list)} data={[1, 2, 3, 4, 5]} renderItem={this._renderItem} ItemSeparatorComponent={this._renderSeparator} From 8ae9055d647d6f0f3601fbcb1a75b3b7327d771f Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Wed, 30 Jan 2019 13:24:26 +0530 Subject: [PATCH 192/266] renaming folder unable tp import in test --- types/happy-pack/happy-pack-tests.ts | 5 ----- types/happy-packs/happy-pack-tests.ts | 5 +++++ types/{happy-pack => happy-packs}/index.d.ts | 3 +-- types/{happy-pack => happy-packs}/tsconfig.json | 2 +- types/{happy-pack => happy-packs}/tslint.json | 0 5 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 types/happy-pack/happy-pack-tests.ts create mode 100644 types/happy-packs/happy-pack-tests.ts rename types/{happy-pack => happy-packs}/index.d.ts (99%) rename types/{happy-pack => happy-packs}/tsconfig.json (93%) rename types/{happy-pack => happy-packs}/tslint.json (100%) diff --git a/types/happy-pack/happy-pack-tests.ts b/types/happy-pack/happy-pack-tests.ts deleted file mode 100644 index 7f2c24daf5..0000000000 --- a/types/happy-pack/happy-pack-tests.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as happyPack from 'happy-pack'; - -const ref: happyPack = new happyPack({ - loaders: ['ts-loader'] -}); diff --git a/types/happy-packs/happy-pack-tests.ts b/types/happy-packs/happy-pack-tests.ts new file mode 100644 index 0000000000..928221b893 --- /dev/null +++ b/types/happy-packs/happy-pack-tests.ts @@ -0,0 +1,5 @@ +import * as happyPacks from 'happy-packs'; + +const ref: happyPacks = new happyPacks({ + loaders: ['ts-loader'] +}); diff --git a/types/happy-pack/index.d.ts b/types/happy-packs/index.d.ts similarity index 99% rename from types/happy-pack/index.d.ts rename to types/happy-packs/index.d.ts index e6f30343da..3df45fdfe9 100644 --- a/types/happy-pack/index.d.ts +++ b/types/happy-packs/index.d.ts @@ -18,5 +18,4 @@ declare namespace happypack { declare class happypack extends Plugin { constructor(options: happypack.PluginOptions); -} - +} \ No newline at end of file diff --git a/types/happy-pack/tsconfig.json b/types/happy-packs/tsconfig.json similarity index 93% rename from types/happy-pack/tsconfig.json rename to types/happy-packs/tsconfig.json index bfd5e35551..d6ff7c28fc 100644 --- a/types/happy-pack/tsconfig.json +++ b/types/happy-packs/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "happypack-tests.ts" + "happy-packs-tests.ts" ] } \ No newline at end of file diff --git a/types/happy-pack/tslint.json b/types/happy-packs/tslint.json similarity index 100% rename from types/happy-pack/tslint.json rename to types/happy-packs/tslint.json From 24bda892237c73900b28aa92e65f966f54bf0d6f Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Wed, 30 Jan 2019 13:26:33 +0530 Subject: [PATCH 193/266] renaming back --- .../happy-pack-tests.ts => happy-pack/happy-packs-tests.ts} | 2 +- types/{happy-packs => happy-pack}/index.d.ts | 0 types/{happy-packs => happy-pack}/tsconfig.json | 2 +- types/{happy-packs => happy-pack}/tslint.json | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename types/{happy-packs/happy-pack-tests.ts => happy-pack/happy-packs-tests.ts} (61%) rename types/{happy-packs => happy-pack}/index.d.ts (100%) rename types/{happy-packs => happy-pack}/tsconfig.json (93%) rename types/{happy-packs => happy-pack}/tslint.json (100%) diff --git a/types/happy-packs/happy-pack-tests.ts b/types/happy-pack/happy-packs-tests.ts similarity index 61% rename from types/happy-packs/happy-pack-tests.ts rename to types/happy-pack/happy-packs-tests.ts index 928221b893..0a879c7f2e 100644 --- a/types/happy-packs/happy-pack-tests.ts +++ b/types/happy-pack/happy-packs-tests.ts @@ -1,4 +1,4 @@ -import * as happyPacks from 'happy-packs'; +import * as happyPacks from 'happy-pack'; const ref: happyPacks = new happyPacks({ loaders: ['ts-loader'] diff --git a/types/happy-packs/index.d.ts b/types/happy-pack/index.d.ts similarity index 100% rename from types/happy-packs/index.d.ts rename to types/happy-pack/index.d.ts diff --git a/types/happy-packs/tsconfig.json b/types/happy-pack/tsconfig.json similarity index 93% rename from types/happy-packs/tsconfig.json rename to types/happy-pack/tsconfig.json index d6ff7c28fc..4e7f0f6660 100644 --- a/types/happy-packs/tsconfig.json +++ b/types/happy-pack/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "happy-packs-tests.ts" + "happy-pack-tests.ts" ] } \ No newline at end of file diff --git a/types/happy-packs/tslint.json b/types/happy-pack/tslint.json similarity index 100% rename from types/happy-packs/tslint.json rename to types/happy-pack/tslint.json From f78899b07047dae4a0eaa04011533d0ad9b3c10f Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Wed, 30 Jan 2019 13:38:14 +0530 Subject: [PATCH 194/266] updating code hope this time test will run without errror --- types/happy-pack/happy-pack-tests.ts | 5 +++++ types/happy-pack/happy-packs-tests.ts | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 types/happy-pack/happy-pack-tests.ts delete mode 100644 types/happy-pack/happy-packs-tests.ts diff --git a/types/happy-pack/happy-pack-tests.ts b/types/happy-pack/happy-pack-tests.ts new file mode 100644 index 0000000000..7f2c24daf5 --- /dev/null +++ b/types/happy-pack/happy-pack-tests.ts @@ -0,0 +1,5 @@ +import * as happyPack from 'happy-pack'; + +const ref: happyPack = new happyPack({ + loaders: ['ts-loader'] +}); diff --git a/types/happy-pack/happy-packs-tests.ts b/types/happy-pack/happy-packs-tests.ts deleted file mode 100644 index 0a879c7f2e..0000000000 --- a/types/happy-pack/happy-packs-tests.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as happyPacks from 'happy-pack'; - -const ref: happyPacks = new happyPacks({ - loaders: ['ts-loader'] -}); From 82008c3d3a620155672186430b83ee4d864799e7 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Wed, 30 Jan 2019 13:41:57 +0530 Subject: [PATCH 195/266] Fixing new line err --- types/happy-pack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/happy-pack/index.d.ts b/types/happy-pack/index.d.ts index 3df45fdfe9..13c212a3f8 100644 --- a/types/happy-pack/index.d.ts +++ b/types/happy-pack/index.d.ts @@ -18,4 +18,4 @@ declare namespace happypack { declare class happypack extends Plugin { constructor(options: happypack.PluginOptions); -} \ No newline at end of file +} From d8784261371a42d939d1666ba4f950903ca1dc28 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Wed, 30 Jan 2019 13:49:37 +0530 Subject: [PATCH 196/266] Update happy-pack-tests.ts --- types/happy-pack/happy-pack-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/happy-pack/happy-pack-tests.ts b/types/happy-pack/happy-pack-tests.ts index 7f2c24daf5..b003489431 100644 --- a/types/happy-pack/happy-pack-tests.ts +++ b/types/happy-pack/happy-pack-tests.ts @@ -1,5 +1,7 @@ import * as happyPack from 'happy-pack'; const ref: happyPack = new happyPack({ + id: '1', + threads: 1, loaders: ['ts-loader'] }); From 6439a7378211547a95f0844813ad2d7cddeaf773 Mon Sep 17 00:00:00 2001 From: Simon Kostede Date: Wed, 30 Jan 2019 10:23:50 +0100 Subject: [PATCH 197/266] fix typo in types/google__maps definition of QueryAutocompleteResult --- types/google__maps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/google__maps/index.d.ts b/types/google__maps/index.d.ts index d393286dfe..f1df5d8f38 100644 --- a/types/google__maps/index.d.ts +++ b/types/google__maps/index.d.ts @@ -3107,7 +3107,7 @@ export interface QueryAutocompleteResult { * contains an `offset` value and a `length`. * These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired. */ - matched_substring: PredictionSubstring[]; + matched_substrings: PredictionSubstring[]; } /** A Radar Search request must include at least one of `keyword`, `name`, or `type`. */ From 3cb4d74e30c6ac565ac500c8252c1b4c110690b3 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 30 Jan 2019 01:59:00 -0800 Subject: [PATCH 198/266] node-forge: a Byte is a number, not a string Signed-off-by: Anders Kaseorg --- types/node-forge/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index 1d9b0cb858..6e7d5d136e 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -15,7 +15,7 @@ /// declare module "node-forge" { - type Byte = string; + type Byte = number; type Bytes = string; type Hex = string; type Base64 = string; From 91f106ba56f5d3f309281285e9855bc983fb2b2c Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 30 Jan 2019 02:06:14 -0800 Subject: [PATCH 199/266] node-forge: Asn1.value may be Bytes Signed-off-by: Anders Kaseorg --- types/node-forge/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index 6e7d5d136e..67e12c35bd 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -359,10 +359,10 @@ declare module "node-forge" { type: Type; constructed: boolean; composed: boolean; - value: Asn1[]; + value: Bytes | Asn1[]; } - function create(tagClass: Class, type: Type, constructed: boolean, value: string | Asn1[]): Asn1; + function create(tagClass: Class, type: Type, constructed: boolean, value: Bytes | Asn1[]): Asn1; function fromDer(bytes: Bytes | util.ByteBuffer, strict?: boolean): Asn1; function toDer(obj: Asn1): util.ByteBuffer; function oidToDer(oid: OID): util.ByteStringBuffer; From d90e56c86fc7e84b96cf84a5fc56b84f04ffb721 Mon Sep 17 00:00:00 2001 From: Vinay Bedre Date: Wed, 30 Jan 2019 11:10:14 +0100 Subject: [PATCH 200/266] expose isRedirect method of node-fetch in types --- types/node-fetch/index.d.ts | 9 ++++++++- types/node-fetch/node-fetch-tests.ts | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index 4b12734363..1177e8da25 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/bitinn/node-fetch // Definitions by: Torsten Werner // Niklas Lindgren +// Vinay Bedre // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -168,7 +169,13 @@ export type HeaderInit = Headers | string[]; export type BodyInit = ArrayBuffer | ArrayBufferView | NodeJS.ReadableStream | string | URLSearchParams; export type RequestInfo = string | Request; -export default function fetch( +declare function fetch( url: string | Request, init?: RequestInit ): Promise; + +declare namespace fetch { + function isRedirect(code: number): boolean; +} + +export default fetch; diff --git a/types/node-fetch/node-fetch-tests.ts b/types/node-fetch/node-fetch-tests.ts index 7561ae1b0f..f5e940d5d2 100644 --- a/types/node-fetch/node-fetch-tests.ts +++ b/types/node-fetch/node-fetch-tests.ts @@ -77,3 +77,8 @@ function test_headersRaw() { const myHeader = 'foo'; headers.raw()[myHeader]; // $ExpectType string[] } + +function test_isRedirect() { + fetch.isRedirect(301); + fetch.isRedirect(201); +} From dcaee48cf26193516c92d503eceba6c9c73bad21 Mon Sep 17 00:00:00 2001 From: Vinay Date: Wed, 30 Jan 2019 11:16:33 +0100 Subject: [PATCH 201/266] corrected indentation --- types/node-fetch/node-fetch-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/node-fetch/node-fetch-tests.ts b/types/node-fetch/node-fetch-tests.ts index f5e940d5d2..d35114f60a 100644 --- a/types/node-fetch/node-fetch-tests.ts +++ b/types/node-fetch/node-fetch-tests.ts @@ -79,6 +79,6 @@ function test_headersRaw() { } function test_isRedirect() { - fetch.isRedirect(301); - fetch.isRedirect(201); + fetch.isRedirect(301); + fetch.isRedirect(201); } From 017754a9b96beb665166693e138674cbcf488c84 Mon Sep 17 00:00:00 2001 From: Akash Vishwakarma Date: Wed, 30 Jan 2019 17:38:22 +0530 Subject: [PATCH 202/266] It will not work if i take happy-pack so changing to happypack --- .../happy-pack-tests.ts => happypack/happypack-tests.ts} | 2 +- types/{happy-pack => happypack}/index.d.ts | 0 types/{happy-pack => happypack}/tsconfig.json | 2 +- types/{happy-pack => happypack}/tslint.json | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename types/{happy-pack/happy-pack-tests.ts => happypack/happypack-tests.ts} (69%) rename types/{happy-pack => happypack}/index.d.ts (100%) rename types/{happy-pack => happypack}/tsconfig.json (93%) rename types/{happy-pack => happypack}/tslint.json (100%) diff --git a/types/happy-pack/happy-pack-tests.ts b/types/happypack/happypack-tests.ts similarity index 69% rename from types/happy-pack/happy-pack-tests.ts rename to types/happypack/happypack-tests.ts index b003489431..c0ab2d77cf 100644 --- a/types/happy-pack/happy-pack-tests.ts +++ b/types/happypack/happypack-tests.ts @@ -1,4 +1,4 @@ -import * as happyPack from 'happy-pack'; +import * as happyPack from 'happypack'; const ref: happyPack = new happyPack({ id: '1', diff --git a/types/happy-pack/index.d.ts b/types/happypack/index.d.ts similarity index 100% rename from types/happy-pack/index.d.ts rename to types/happypack/index.d.ts diff --git a/types/happy-pack/tsconfig.json b/types/happypack/tsconfig.json similarity index 93% rename from types/happy-pack/tsconfig.json rename to types/happypack/tsconfig.json index 4e7f0f6660..bfd5e35551 100644 --- a/types/happy-pack/tsconfig.json +++ b/types/happypack/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "happy-pack-tests.ts" + "happypack-tests.ts" ] } \ No newline at end of file diff --git a/types/happy-pack/tslint.json b/types/happypack/tslint.json similarity index 100% rename from types/happy-pack/tslint.json rename to types/happypack/tslint.json From 0f67387efb781ab1513067389a6283772b7e1d13 Mon Sep 17 00:00:00 2001 From: Florian Keller Date: Wed, 30 Jan 2019 15:14:10 +0100 Subject: [PATCH 203/266] Add types for npm-license-crawler --- types/npm-license-crawler/index.d.ts | 43 +++++++++++++++++++ .../npm-license-crawler-tests.ts | 15 +++++++ types/npm-license-crawler/tsconfig.json | 23 ++++++++++ types/npm-license-crawler/tslint.json | 1 + 4 files changed, 82 insertions(+) create mode 100644 types/npm-license-crawler/index.d.ts create mode 100644 types/npm-license-crawler/npm-license-crawler-tests.ts create mode 100644 types/npm-license-crawler/tsconfig.json create mode 100644 types/npm-license-crawler/tslint.json diff --git a/types/npm-license-crawler/index.d.ts b/types/npm-license-crawler/index.d.ts new file mode 100644 index 0000000000..82c486b795 --- /dev/null +++ b/types/npm-license-crawler/index.d.ts @@ -0,0 +1,43 @@ +// Type definitions for npm-license-crawler 0.1 +// Project: https://github.com/mwittig/npm-license-crawler +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export interface Licenses { + [repository: string]: { + licenses: string; + licenseUrl: string; + parents: string; + repository: string; + }; +} + +export interface CrawlerOptions { + /** export the data as comma-separated values to the given file. The path will be created if it does not exist. */ + csv?: string; + /** show only third-party licenses, i.e., only list the dependencies defined in package.json. */ + dependencies?: boolean; + /** show only development dependencies */ + development?: boolean; + /** path to a directory to be excluded (and its subdirectories) from the search. */ + exclude?: string | string[]; + /** export data as JSON to the given file. The path will be created if it does not exist. */ + json?: string; + /** omit version numbers in result (e.g. "npm-license-crawler@0.1.5" becomes "npm-license-crawler") */ + omitVersion?: boolean; + /** show only direct dependencies licenses, i.e., don't list dependencies of dependencies. */ + onlyDirectDependencies?: boolean; + /** show only production dependencies */ + production?: boolean; + /** output the relative file path for license files. */ + relativeLicensePath?: boolean; + /** path to the directory the license search should start from. If omitted the current working directory is assumed. */ + start: string | string[]; + /** show only licenses that can't be determined or have been guessed. */ + unknown?: boolean; +} + +export type Callback = (error: Error | null, licenses: Licenses) => void; + +export function dumpLicenses(args: CrawlerOptions, callback: Callback): void; diff --git a/types/npm-license-crawler/npm-license-crawler-tests.ts b/types/npm-license-crawler/npm-license-crawler-tests.ts new file mode 100644 index 0000000000..dae39fec09 --- /dev/null +++ b/types/npm-license-crawler/npm-license-crawler-tests.ts @@ -0,0 +1,15 @@ +import { CrawlerOptions, dumpLicenses } from 'npm-license-crawler'; + +const options: CrawlerOptions = { + start: ['../..'], + exclude: ['.'], + json: 'licenses.json', + unknown: true, +}; + +dumpLicenses(options, (error, res) => { + res.name.licenses; // $ExpectType string + res.name.licenseUrl; // $ExpectType string + res.name.parents; // $ExpectType string + res.name.repository; // $ExpectType string +}); diff --git a/types/npm-license-crawler/tsconfig.json b/types/npm-license-crawler/tsconfig.json new file mode 100644 index 0000000000..59df3a8697 --- /dev/null +++ b/types/npm-license-crawler/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", + "npm-license-crawler-tests.ts" + ] +} diff --git a/types/npm-license-crawler/tslint.json b/types/npm-license-crawler/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/npm-license-crawler/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c33e3eddfceea9c699c153e0b71c12aab78a1743 Mon Sep 17 00:00:00 2001 From: Matt Krick Date: Wed, 30 Jan 2019 07:50:33 -0800 Subject: [PATCH 204/266] fix loadMore call sig, make pageInfo nullable --- types/react-relay/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 24e86379bf..2d5146289f 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -139,7 +139,8 @@ export type RelayPaginationProp = RelayProp & { isLoading(): boolean; loadMore( pageSize: number, - callback?: (error?: Error) => void + callback?: ((error?: Error) => void) | null, + options?: RefetchOptions ): RelayRuntimeTypes.Disposable | undefined | null; refetchConnection( totalCount: number, From 3dcf34784e1636a30f39f39679b8d942e638e679 Mon Sep 17 00:00:00 2001 From: Andrei Mihailov Date: Wed, 30 Jan 2019 17:39:58 +0100 Subject: [PATCH 205/266] Fix projection related types --- types/react-simple-maps/index.d.ts | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/types/react-simple-maps/index.d.ts b/types/react-simple-maps/index.d.ts index e76c4e3f0d..4c63f28c69 100644 --- a/types/react-simple-maps/index.d.ts +++ b/types/react-simple-maps/index.d.ts @@ -1,10 +1,12 @@ // Type definitions for react-simple-maps 0.12 // Project: https://github.com/zcreativelabs/react-simple-maps#readme // Definitions by: Novikov Mihail +// Andrej Mihajlov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from 'react'; +import { GeoProjection } from 'd3-geo'; export type Point = [number, number]; @@ -19,17 +21,21 @@ export interface Line { }; } +export type ProjectionConfig = { + scale: number; + xOffset: number; + yOffset: number; + rotation: [number, number, number]; + precision: number; +}; + +export type ProjectionFunction = (width: number, height: number, config: ProjectionConfig) => GeoProjection; + export interface ComposableMapProps { width?: number; height?: number; - projection?: string | (() => void); - projectionConfig?: { - scale?: number; - xOffset?: number; - yOffset?: number; - rotation?: number[]; - precision?: number; - }; + projection?: string | ProjectionFunction; + projectionConfig?: Partial; style?: React.CSSProperties; defs?: SVGDefsElement; className?: string; @@ -68,7 +74,7 @@ export interface ZoomableGroupProps { export interface GeographiesProps { disableOptimization?: boolean; geography?: string | { [key: string]: any } | string[]; - children?: (geographies: object[], projection: (point: Point) => void) => void; + children?: (geographies: object[], projection: GeoProjection) => void; } export interface GeographyProps { @@ -76,7 +82,7 @@ export interface GeographyProps { precision?: number; round?: boolean; geography?: object; - projection?: (point: Point) => void; + projection?: GeoProjection; tabable?: boolean; style?: { default?: React.CSSProperties; From 99e1ab424a3528d5531ad40cfa25b422ace5b9d1 Mon Sep 17 00:00:00 2001 From: Andrej Mihajlov Date: Wed, 30 Jan 2019 18:00:33 +0100 Subject: [PATCH 206/266] Use interface instead of type --- types/react-simple-maps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-simple-maps/index.d.ts b/types/react-simple-maps/index.d.ts index 4c63f28c69..955bc48279 100644 --- a/types/react-simple-maps/index.d.ts +++ b/types/react-simple-maps/index.d.ts @@ -21,7 +21,7 @@ export interface Line { }; } -export type ProjectionConfig = { +export interface ProjectionConfig { scale: number; xOffset: number; yOffset: number; From 71065960d5bc549843b9f4514bd48982a0b0c16c Mon Sep 17 00:00:00 2001 From: Andrej Mihajlov Date: Wed, 30 Jan 2019 18:15:24 +0100 Subject: [PATCH 207/266] Remove unnecessary semicolon --- types/react-simple-maps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-simple-maps/index.d.ts b/types/react-simple-maps/index.d.ts index 955bc48279..49e392035d 100644 --- a/types/react-simple-maps/index.d.ts +++ b/types/react-simple-maps/index.d.ts @@ -27,7 +27,7 @@ export interface ProjectionConfig { yOffset: number; rotation: [number, number, number]; precision: number; -}; +} export type ProjectionFunction = (width: number, height: number, config: ProjectionConfig) => GeoProjection; From 66a5b40176945ee85e47661d4adc90cea168b681 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Wed, 30 Jan 2019 09:22:57 -0800 Subject: [PATCH 208/266] Note errors for EnhancedLocation.addAsync --- types/office-js-preview/index.d.ts | 8 ++++++++ types/office-js/index.d.ts | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 56415c63cd..0516d08034 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -9427,6 +9427,10 @@ declare namespace Office { * * * + * + * + * + * *
{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
ErrorsInvalidFormatError - The format of the specified data object is not valid.
* * In addition to this signature, this method also has the following signatures: @@ -9457,6 +9461,10 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode} * Compose * + * + * Errors + * InvalidFormatError - The format of the specified data object is not valid. + * * * * @param locationIdentifiers The locations to be added to the current list of locations. diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 1ff4d05df3..eec0893859 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -9427,6 +9427,10 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode} * Compose * + * + * Errors + * InvalidFormatError - The format of the specified data object is not valid. + * * * * In addition to this signature, this method also has the following signatures: @@ -9457,6 +9461,10 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode} * Compose * + * + * Errors + * InvalidFormatError - The format of the specified data object is not valid. + * * * * @param locationIdentifiers The locations to be added to the current list of locations. From e58ab2b3b48facaf7b4d5f42591da8030f36df24 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Wed, 30 Jan 2019 09:51:46 -0800 Subject: [PATCH 209/266] Fix typos --- types/office-js-preview/index.d.ts | 6 +++--- types/office-js/index.d.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index 0516d08034..a538a0f6c9 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -5181,7 +5181,7 @@ declare namespace Office { setTableOptionsAsync(tableOptions: any, callback?: (result: AsyncResult) => void): void; } /** - * Represents the data in a table or a {@link Office.TableBinding}. + * Represents the data in a table or an {@link Office.TableBinding}. * * @remarks * @@ -11108,7 +11108,7 @@ declare namespace Office { * Gets the locations of an appointment. * * The enhancedLocation property returns an {@link Office.EnhancedLocation} object that allows you to get the set of locations (each represented by - * a {@link Office.LocationDetails} object) associated with the appointment. + * an {@link Office.LocationDetails} object) associated with the appointment. * * [Api set: Mailbox Preview] * @@ -13389,7 +13389,7 @@ declare namespace Office { * Provides access to the Cc (carbon copy) recipients of a message. The type of object and level of access depends on the mode of the * current item. * - * The cc property returns a {@link Office.Recipients} object that provides methods to get or update the recipients on the Cc line of + * The cc property returns an {@link Office.Recipients} object that provides methods to get or update the recipients on the Cc line of * the message. * * [Api set: Mailbox 1.0] diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index eec0893859..139707e367 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -5181,7 +5181,7 @@ declare namespace Office { setTableOptionsAsync(tableOptions: any, callback?: (result: AsyncResult) => void): void; } /** - * Represents the data in a table or a {@link Office.TableBinding}. + * Represents the data in a table or an {@link Office.TableBinding}. * * @remarks *
HostsExcel, Word
@@ -11108,7 +11108,7 @@ declare namespace Office { * Gets the locations of an appointment. * * The enhancedLocation property returns an {@link Office.EnhancedLocation} object that allows you to get the set of locations (each represented by - * a {@link Office.LocationDetails} object) associated with the appointment. + * an {@link Office.LocationDetails} object) associated with the appointment. * * [Api set: Mailbox Preview] * @@ -13389,7 +13389,7 @@ declare namespace Office { * Provides access to the Cc (carbon copy) recipients of a message. The type of object and level of access depends on the mode of the * current item. * - * The cc property returns a {@link Office.Recipients} object that provides methods to get or update the recipients on the Cc line of + * The cc property returns an {@link Office.Recipients} object that provides methods to get or update the recipients on the Cc line of * the message. * * [Api set: Mailbox 1.0] From 4bdbccfedcb7ce25924a17d33805edec190aeb35 Mon Sep 17 00:00:00 2001 From: Jim Geurts Date: Wed, 30 Jan 2019 10:06:22 -0600 Subject: [PATCH 210/266] Add asn1 --- types/asn1/asn1-tests.ts | 88 +++++++++++++++++++++++++++ types/asn1/index.d.ts | 126 +++++++++++++++++++++++++++++++++++++++ types/asn1/tsconfig.json | 25 ++++++++ types/asn1/tslint.json | 3 + 4 files changed, 242 insertions(+) create mode 100644 types/asn1/asn1-tests.ts create mode 100644 types/asn1/index.d.ts create mode 100644 types/asn1/tsconfig.json create mode 100644 types/asn1/tslint.json diff --git a/types/asn1/asn1-tests.ts b/types/asn1/asn1-tests.ts new file mode 100644 index 0000000000..f37541b03e --- /dev/null +++ b/types/asn1/asn1-tests.ts @@ -0,0 +1,88 @@ +import { Ber, BerReader, BerWriter } from 'asn1'; + +let buf: Buffer = Buffer.alloc(0); +let bool = false; +let str = ''; +let num = 0; +let numOrNull: number | null = 0; +const roStrArray: ReadonlyArray = [str]; + +const reader = new BerReader(buf); +numOrNull = reader.peek(); +bool = reader.readBoolean(); +numOrNull = reader.readByte(bool); +num = reader.readEnumeration(); +num = reader.readInt(); +num = reader.readLength(); +num = reader.readLength(num); +str = reader.readOID(); +str = reader.readOID(num); +numOrNull = reader.readSequence(); +numOrNull = reader.readSequence(num); +str = reader.readString(); +str = reader.readString(num); +buf = reader.readString(num, bool); +num = reader._readTag(); +num = reader._readTag(num); + +let writer = new BerWriter(); +writer = new BerWriter({ + size: num, + growthFactor: num, +}); + +buf = writer.buffer; +buf = writer._buf; +num = writer._size; +num = writer._offset; + +writer.endSequence(); +writer.startSequence(); +writer.startSequence(num); +writer.writeBoolean(bool); +writer.writeBoolean(bool, num); +writer.writeBuffer(buf, num); +writer.writeByte(num); +writer.writeEnumeration(num); +writer.writeEnumeration(num, num); +writer.writeInt(num); +writer.writeInt(num, num); +writer.writeLength(num); +writer.writeNull(); +writer.writeOID(str, num); +writer.writeString(str); +writer.writeString(str, num); +writer.writeStringArray(roStrArray); +writer._ensure(num); + +num = Ber.BMPString; +num = Ber.BitString; +num = Ber.Boolean; +num = Ber.CharacterString; +num = Ber.Constructor; +num = Ber.Context; +num = Ber.EOC; +num = Ber.Enumeration; +num = Ber.External; +num = Ber.GeneralString; +num = Ber.GeneralizedTime; +num = Ber.GraphicString; +num = Ber.IA5String; +num = Ber.Integer; +num = Ber.Null; +num = Ber.NumericString; +num = Ber.OID; +num = Ber.ObjectDescriptor; +num = Ber.OctetString; +num = Ber.PDV; +num = Ber.PrintableString; +num = Ber.Real; +num = Ber.RelativeOID; +num = Ber.Sequence; +num = Ber.Set; +num = Ber.T61String; +num = Ber.UTCTime; +num = Ber.UniversalString; +num = Ber.Utf8String; +num = Ber.VideotexString; +num = Ber.VisibleString; diff --git a/types/asn1/index.d.ts b/types/asn1/index.d.ts new file mode 100644 index 0000000000..3f7de44af8 --- /dev/null +++ b/types/asn1/index.d.ts @@ -0,0 +1,126 @@ +// Type definitions for asn1 0.2 +// Project: https://github.com/joyent/node-asn1 +// Definitions by: Jim Geurts +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +/// + +export class BerReader { + readonly buffer: Buffer; + readonly offset: number; + readonly length: number; + readonly remain: number; + readonly _buf: Buffer; + _size: number; + _offset: number; + + constructor(data: Buffer); + + peek(): number | null; + readBoolean(): boolean; + readByte(peek: boolean): number | null; + readEnumeration(): number; + readInt(): number; + readLength(offset?: number): number; + readOID(tag?: number): string; + readSequence(tag?: number): number | null; + readString(tag?: number): string; + readString(tag: number, retbuf: boolean): Buffer; + _readTag(tag?: number): number; +} + +export class BerWriter { + readonly buffer: Buffer; + readonly _buf: Buffer; + readonly _size: number; + _offset: number; + + constructor(options?: { + size: number; + growthFactor: number; + }); + + endSequence(): void; + startSequence(tag?: number): void; + writeBoolean(b: boolean, tag?: number): void; + writeBuffer(buf: Buffer, tag: number): void; + writeByte(b: number): void; + writeEnumeration(i: number, tag?: number): void; + writeInt(i: number, tag?: number): void; + writeLength(len: number): void; + writeNull(): void; + writeOID(s: string, tag: number): void; + writeString(s: string, tag?: number): void; + writeStringArray(strings: ReadonlyArray): void; + _ensure(length: number): void; +} + +export namespace Ber { + const BMPString: number; + const BitString: number; + const Boolean: number; + const CharacterString: number; + const Constructor: number; + const Context: number; + const EOC: number; + const Enumeration: number; + const External: number; + const GeneralString: number; + const GeneralizedTime: number; + const GraphicString: number; + const IA5String: number; + const Integer: number; + const Null: number; + const NumericString: number; + const OID: number; + const ObjectDescriptor: number; + const OctetString: number; + const PDV: number; + const PrintableString: number; + const Real: number; + const RelativeOID: number; + const Sequence: number; + const Set: number; + const T61String: number; + const UTCTime: number; + const UniversalString: number; + const Utf8String: number; + const VideotexString: number; + const VisibleString: number; +} +/* +declare enum BerType { + EOC = 0, + Boolean = 1, + Integer = 2, + BitString = 3, + OctetString = 4, + Null = 5, + OID = 6, + ObjectDescriptor = 7, + External = 8, + Real = 9, // float + Enumeration = 10, + PDV = 11, + Utf8String = 12, + RelativeOID = 13, + Sequence = 16, + Set = 17, + NumericString = 18, + PrintableString = 19, + T61String = 20, + VideotexString = 21, + IA5String = 22, + UTCTime = 23, + GeneralizedTime = 24, + GraphicString = 25, + VisibleString = 26, + GeneralString = 28, + UniversalString = 29, + CharacterString = 30, + BMPString = 31, + Constructor = 32, + Context = 128, +} + +*/ diff --git a/types/asn1/tsconfig.json b/types/asn1/tsconfig.json new file mode 100644 index 0000000000..fd1bdc45d9 --- /dev/null +++ b/types/asn1/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "noUnusedParameters": true, + + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "asn1-tests.ts" + ] +} \ No newline at end of file diff --git a/types/asn1/tslint.json b/types/asn1/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/asn1/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From c0af6b92377587815c2785623278256c8d62bbf7 Mon Sep 17 00:00:00 2001 From: Jules Janssen Date: Wed, 30 Jan 2019 20:05:55 +0100 Subject: [PATCH 211/266] [chart.js] add `precision` option to `LinearTickOptions` interface See [commit](https://github.com/chartjs/Chart.js/commit/9fbac8893865fc6f7efdab7f49d480e6a730c669#diff-bd4c401aafa9aaaa38640e15e4b2ecbc) and [docs](https://www.chartjs.org/docs/latest/axes/cartesian/linear.html) --- types/chart.js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index ca28a1a9f6..8e795ed77c 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -537,6 +537,7 @@ declare namespace Chart { interface LinearTickOptions extends TickOptions { maxTicksLimit?: number; stepSize?: number; + precision?: number; suggestedMin?: number; suggestedMax?: number; } From bdfc3ebeb582990a633fb00e29d735ee61780527 Mon Sep 17 00:00:00 2001 From: Leonardo Gatica Date: Wed, 30 Jan 2019 16:35:27 -0300 Subject: [PATCH 212/266] feat(typings): add semantic-release interfaces --- types/semantic-release/index.d.ts | 46 +++++++++++++++++++ .../semantic-release-tests.ts | 17 +++++++ types/semantic-release/tsconfig.json | 24 ++++++++++ types/semantic-release/tslint.json | 1 + 4 files changed, 88 insertions(+) create mode 100644 types/semantic-release/index.d.ts create mode 100644 types/semantic-release/semantic-release-tests.ts create mode 100644 types/semantic-release/tsconfig.json create mode 100644 types/semantic-release/tslint.json diff --git a/types/semantic-release/index.d.ts b/types/semantic-release/index.d.ts new file mode 100644 index 0000000000..656461b756 --- /dev/null +++ b/types/semantic-release/index.d.ts @@ -0,0 +1,46 @@ +// Type definitions for semantic-release 15.13 +// Project: https://github.com/semantic-release/semantic-release#readme +// Definitions by: Leonardo Gatica +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * The semantic release configuration itself. + */ +export interface GlobalConfig { + /** The full prepare step configuration. */ + prepare?: any; + /** The branch on which releases should happen. */ + branch: string; + /** The Git repository URL, in any supported format. */ + repositoryUrl: string; + /** The Git tag format used by semantic-release to identify releases. */ + tagFormat: string; +} + +export interface LastRelease { + /** The version name of the release */ + version: string; + /** The Git tag of the release. */ + gitTag: string; + /** The Git checksum of the last commit of the release. */ + gitHead: string; +} + +export interface NextRelease extends LastRelease { + /** The release notes of the next release. */ + notes: string; +} + +export interface Context { + /** The semantic release configuration itself. */ + options?: GlobalConfig; + /** The previous release details. */ + lastRelease?: LastRelease; + /** The next release details. */ + nextRelease?: NextRelease; + /** The shared logger instance of semantic release. */ + logger: { + log: (message: string, ...vars: any[]) => void, + error: (message: string, ...vars: any[]) => void, + }; +} diff --git a/types/semantic-release/semantic-release-tests.ts b/types/semantic-release/semantic-release-tests.ts new file mode 100644 index 0000000000..0c954fe295 --- /dev/null +++ b/types/semantic-release/semantic-release-tests.ts @@ -0,0 +1,17 @@ +import * as lib from 'semantic-release'; + +function publish(pluginConfig: any, context: lib.Context) { + const version = context.nextRelease && context.nextRelease.version; + context.logger.log(`New version ${version}`); +} + +const context = { + nextRelease: { + version: '1.0.0', + gitTag: '1.0.0', + gitHead: 'f1eed296d2ffe184fb15f52b1c5ad778f5c87645', + notes: 'New release' + }, + logger: console +}; +publish({}, context); diff --git a/types/semantic-release/tsconfig.json b/types/semantic-release/tsconfig.json new file mode 100644 index 0000000000..d226e296ce --- /dev/null +++ b/types/semantic-release/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "semantic-release-tests.ts" + ] +} diff --git a/types/semantic-release/tslint.json b/types/semantic-release/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/semantic-release/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 9520a876d77f8b0d14a53155d01b2690c339f2f0 Mon Sep 17 00:00:00 2001 From: frontendmonster Date: Wed, 30 Jan 2019 23:22:39 +0330 Subject: [PATCH 213/266] Make MongooseDocument.invalidate value param optional --- types/mongoose/index.d.ts | 3 ++- types/mongoose/mongoose-tests.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index b7d3b5d9c6..800b37f520 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -16,6 +16,7 @@ // Dan Manastireanu // stablio // Emmanuel Gautier +// Frontend Monster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1310,7 +1311,7 @@ declare module "mongoose" { * @param kind optional kind property for the error * @returns the current ValidationError, with all currently invalidated paths */ - invalidate(path: string, errorMsg: string | NativeError, value: any, kind?: string): Error.ValidationError | boolean; + invalidate(path: string, errorMsg: string | NativeError, value?: any, kind?: string): Error.ValidationError | boolean; /** Returns true if path was directly set and modified, else false. */ isDirectModified(path: string): boolean; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 8e6a60fdc7..30b5b51a84 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -726,6 +726,7 @@ doc.execPopulate().then(function (arg) { doc.get('path', Number); doc.init(doc).init(doc, {}); doc.inspect(); +doc.invalidate('path', new Error('hi')).toString(); doc.invalidate('path', new Error('hi'), 999).toString(); doc.isDirectModified('path').valueOf(); doc.isInit('path').valueOf(); From f50be0da11152edd00fa4b16e908ccb818784998 Mon Sep 17 00:00:00 2001 From: Andres Kalle Date: Wed, 30 Jan 2019 22:51:08 +0200 Subject: [PATCH 214/266] nodegit: Fix return type of Repository#createBlobFromBuffer --- types/nodegit/nodegit-tests.ts | 2 ++ types/nodegit/repository.d.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts index 1732844d1c..a908f8a58f 100644 --- a/types/nodegit/nodegit-tests.ts +++ b/types/nodegit/nodegit-tests.ts @@ -62,3 +62,5 @@ const signature = Git.Signature.now("name", "email"); signature.name(); signature.email(); signature.when(); + +repo.createBlobFromBuffer(Buffer.from("test")).then((oid: Git.Oid) => oid.cpy()); diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts index 6066f770b2..d74b39834d 100644 --- a/types/nodegit/repository.d.ts +++ b/types/nodegit/repository.d.ts @@ -153,7 +153,7 @@ export class Repository { /** * Create a blob from a buffer */ - createBlobFromBuffer(buffer: Buffer): Oid; + createBlobFromBuffer(buffer: Buffer): Promise; treeBuilder(tree: Tree): Promise; /** * Gets the default signature for the default user and now timestamp From fc452ce40e2d3b4cf3bc7398fa4e866190cfcb82 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 30 Jan 2019 02:15:16 -0800 Subject: [PATCH 215/266] node-forge: Complete pkcs12 with toPkcs12Asn1, generateKey Signed-off-by: Anders Kaseorg --- types/node-forge/index.d.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index 67e12c35bd..bff251912a 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -495,6 +495,30 @@ declare module "node-forge" { function pkcs12FromAsn1(obj: any, strict?: boolean, password?: string): Pkcs12Pfx; function pkcs12FromAsn1(obj: any, password?: string): Pkcs12Pfx; + + function toPkcs12Asn1( + key: pki.PrivateKey, + cert: pki.Certificate | pki.Certificate[], + password: string | null, + options?: { + algorithm?: 'aes128' | 'aes192' | 'aes256' | '3des', + count?: number, + saltSize?: number, + useMac?: boolean, + localKeyId?: Hex, + friendlyName?: string, + generateLocalKeyId?: boolean, + }, + ): asn1.Asn1; + + function generateKey( + password: string | null | undefined, + salt: util.ByteBuffer, + id: Byte, + iter: number, + n: number, + md?: md.MessageDigest, + ): util.ByteBuffer; } namespace pkcs7 { From 58ef2b85bc884ec32074c5df5e225d825671c7d1 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 30 Jan 2019 02:25:52 -0800 Subject: [PATCH 216/266] node-forge: pki.createCaStore accepts an optional array of certificates Signed-off-by: Anders Kaseorg --- types/node-forge/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index bff251912a..9cdda89c92 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -69,7 +69,7 @@ declare module "node-forge" { function privateKeyFromPem(pem: PEM): PrivateKey; function certificateToPem(cert: Certificate, maxline?: number): PEM; function certificateFromPem(pem: PEM, computeHash?: boolean, strict?: boolean): Certificate; - function createCaStore(): CAStore; + function createCaStore(certs?: ReadonlyArray): CAStore; function verifyCertificateChain(caStore: CAStore, chain: Certificate[], customVerifyCallback?: (verified: boolean | string, depth: number, chain: Certificate[]) => boolean): boolean; interface oids { From 8d693d60257a5363016d69dbf95c70c9309f9b4a Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 30 Jan 2019 02:20:06 -0800 Subject: [PATCH 217/266] node-forge: Add tls Signed-off-by: Anders Kaseorg --- types/node-forge/index.d.ts | 281 ++++++++++++++++++++++++++++++++++++ 1 file changed, 281 insertions(+) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index 9cdda89c92..ad15411714 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -9,6 +9,7 @@ // Nikita Koryabkin // timhwang21 // supaiku0 +// Anders Kaseorg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -607,4 +608,284 @@ declare module "node-forge" { function create(any: any): any; } } + + namespace tls { + interface ProtocolVersion { + major: Byte; + minor: Byte; + } + + const Versions: ProtocolVersion[]; + const SupportedVersions: ProtocolVersion[]; + const Version: ProtocolVersion; + + const MaxFragment: number; + + enum ConnectionEnd { + server = 0, + client = 1, + } + + enum PRFAlgorithm { + tls_prf_sha256 = 0, + } + + enum BulkCipherAlgorithm { + rc4 = 0, + des3 = 1, + aes = 2, + } + + enum CipherType { + stream = 0, + block = 1, + aead = 2, + } + + enum MACAlgorithm { + hmac_md5 = 0, + hmac_sha1 = 1, + hmac_sha256 = 2, + hmac_sha384 = 3, + hmac_sha512 = 4, + } + + enum CompressionMethod { + none = 0, + deflate = 1, + } + + enum ContentType { + change_cipher_spec = 20, + alert = 21, + handshake = 22, + application_data = 23, + heartbeat = 24, + } + + enum HandshakeType { + hello_request = 0, + client_hello = 1, + server_hello = 2, + certificate = 11, + server_key_exchange = 12, + certificate_request = 13, + server_hello_done = 14, + certificate_verify = 15, + client_key_exchange = 16, + finished = 20, + } + + namespace Alert { + enum Level { + warning = 1, + fatal = 2, + } + + enum Description { + close_notify = 0, + unexpected_message = 10, + bad_record_mac = 20, + decryption_failed = 21, + record_overflow = 22, + decompression_failure = 30, + handshake_failure = 40, + bad_certificate = 42, + unsupported_certificate = 43, + certificate_revoked = 44, + certificate_expired = 45, + certificate_unknown = 46, + illegal_parameter = 47, + unknown_ca = 48, + access_denied = 49, + decode_error = 50, + decrypt_error = 51, + export_restriction = 60, + protocol_version = 70, + insufficient_security = 71, + internal_error = 80, + user_canceled = 90, + no_renegotiation = 100, + } + } + + enum HeartbeatMessageType { + heartbeat_request = 1, + heartbeat_response = 2, + } + + interface CipherSuite { + id: [Byte, Byte]; + name: string; + } + + const CipherSuites: { [name: string]: CipherSuite }; + + interface CertificateRequest { + certificate_types: util.ByteBuffer; + certificate_authorities: util.ByteBuffer; + } + + type ConnectionState = any; + + interface Connection { + version: ProtocolVersion; + entity: ConnectionEnd; + sessionId: Bytes | null; + caStore: pki.CAStore; + sessionCache: SessionCache | null; + cipherSuites: CipherSuite[]; + connected(conn: Connection): void; + virtualHost: string | null; + verifyClient: boolean; + verify( + conn: Connection, + verified: Verified, + depth: number, + certs: pki.Certificate[] + ): Verified; + getCertificate: + | (( + conn: Connection, + hint: CertificateRequest | string[] + ) => pki.PEM | ReadonlyArray) + | null; + getPrivateKey: + | ((conn: Connection, certificate: pki.Certificate) => pki.PEM) + | null; + getSignature: + | (( + conn: Connection, + bytes: Bytes, + callback: (conn: Connection, bytes: Bytes) => void + ) => void) + | null; + input: util.ByteBuffer; + tlsData: util.ByteBuffer; + data: util.ByteBuffer; + tlsDataReady(conn: Connection): void; + dataReady(conn: Connection): void; + heartbeatReceived: + | ((conn: Connection, payload: util.ByteBuffer) => void) + | undefined; + closed(conn: Connection): void; + error(conn: Connection, error: TLSError): void; + deflate: ((inBytes: Bytes) => Bytes) | null; + inflate: ((inBytes: Bytes) => Bytes) | null; + reset(clearFail?: boolean): void; + record: Record | null; + session: Session | null; + peerCertificate: pki.Certificate | null; + state: { pending: ConnectionState | null; current: ConnectionState }; + expect: number; + fragmented: Record | null; + records: Record[]; + open: boolean; + handshakes: number; + handshaking: boolean; + isConnected: boolean; + fail: boolean; + handshake(sessionId?: Bytes | null): void; + process(data: Bytes): number; + prepare(data: Bytes): boolean; + prepareHeartbeatRequest( + payload: Bytes | util.ByteBuffer, + payloadLength?: number + ): boolean; + close(clearFail?: boolean): Connection; + } + + interface Record { + type: ContentType; + version: ProtocolVersion; + length: number; + fragment: util.ByteBuffer; + ready?: boolean; + } + + interface Session { + version: ProtocolVersion | null; + extensions: { [_: string]: object }; + cipherSuite: CipherSuite | null; + compressionMethod: CompressionMethod | null; + serverCertificate: pki.Certificate | null; + clientCertificate: pki.Certificate | null; + md5: md.MessageDigest; + sha1: md.MessageDigest; + } + + interface SessionCache { + cache: { [key: string]: Session }; + capacity: number; + order: [Hex]; + getSession(sessionId: Bytes): Session; + setSession(sessionId: Bytes, session: Session): void; + } + + function createSessionCache( + cache?: SessionCache | { [key: string]: Session }, + capacity?: number + ): SessionCache; + + interface Alert { + level: Alert.Level; + description: Alert.Description; + } + + interface TLSError extends Error { + message: string; + send: boolean; + origin: "server" | "client"; + alert: Alert; + } + + type Verified = true | { message?: string; alert?: Alert.Description }; + + function createConnection(options: { + server?: boolean; + sessionId?: Bytes | null; + caStore?: pki.CAStore | ReadonlyArray; + sessionCache?: SessionCache | { [key: string]: Session }; + cipherSuites?: CipherSuite[]; + connected(conn: Connection): void; + virtualHost?: string; + verifyClient?: boolean; + verify?( + conn: Connection, + verified: Verified, + depth: number, + certs: pki.Certificate[] + ): Verified; + getCertificate?( + conn: Connection, + hint: CertificateRequest | string[] + ): pki.PEM | ReadonlyArray; + getPrivateKey?(conn: Connection, certificate: pki.Certificate): pki.PEM; + getSignature?( + conn: Connection, + bytes: Bytes, + callback: (conn: Connection, bytes: Bytes) => void + ): void; + tlsDataReady(conn: Connection): void; + dataReady(conn: Connection): void; + heartbeatReceived?(conn: Connection, payload: util.ByteBuffer): void; + closed(conn: Connection): void; + error(conn: Connection, error: TLSError): void; + deflate?(inBytes: Bytes): Bytes; + inflate?(inBytes: Bytes): Bytes; + }): Connection; + + function prf_tls1( + secret: string, + label: string, + seed: string, + length: number + ): util.ByteBuffer; + + function hmac_sha1( + key: string | ReadonlyArray | util.ByteBuffer, + seqNum: [number, number], + record: Record + ): Bytes; + } } From 5b070eaaa859a38994a576fddd2d22ed0c6f40fb Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 30 Jan 2019 03:17:00 -0800 Subject: [PATCH 218/266] node-forge: Add test for tls Signed-off-by: Anders Kaseorg --- types/node-forge/node-forge-tests.ts | 121 ++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 2 deletions(-) diff --git a/types/node-forge/node-forge-tests.ts b/types/node-forge/node-forge-tests.ts index 8cb1e54aea..c99f417550 100644 --- a/types/node-forge/node-forge-tests.ts +++ b/types/node-forge/node-forge-tests.ts @@ -207,7 +207,7 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin { const emptyStore = forge.pki.createCaStore(); - const certificate = forge.pki.createCertificate(); + const certificate = cert; const pem = forge.pki.certificateToPem(certificate); const caStore = forge.pki.createCaStore(); @@ -225,4 +225,121 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin { const key: string = forge.pkcs5.pbkdf2("password", "salt", 1000, 32); -} \ No newline at end of file +} + +{ + // Based on node-forge/examples/tls.js + + let success = false; + + const client = forge.tls.createConnection({ + server: false, + caStore: [cert], + sessionCache: {}, + // supported cipher suites in order of preference + cipherSuites: [ + forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA, + forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA], + virtualHost: 'server', + verify: function(c, verified, depth, certs) { + console.log( + 'TLS Client verifying certificate w/CN: \"' + + certs[0].subject.getField('CN').value + + '\", verified: ' + verified + '...'); + return verified; + }, + connected: function(c) { + console.log('Client connected...'); + + // send message to server + setTimeout(function() { + c.prepareHeartbeatRequest('heartbeat'); + c.prepare('Hello Server'); + }, 1); + }, + getCertificate: function(c, hint) { + console.log('Client getting certificate ...'); + return forge.pki.certificateToPem(cert); + }, + getPrivateKey: function(c, cert) { + return privateKeyPem; + }, + tlsDataReady: function(c) { + // send TLS data to server + server.process(c.tlsData.getBytes()); + }, + dataReady: function(c) { + var response = c.data.getBytes(); + console.log('Client received \"' + response + '\"'); + success = (response === 'Hello Client'); + c.close(); + }, + heartbeatReceived: function(c, payload) { + console.log('Client received heartbeat: ' + payload.getBytes()); + }, + closed: function(c) { + console.log('Client disconnected.'); + if(success) { + console.log('PASS'); + } else { + console.log('FAIL'); + } + }, + error: function(c, error) { + console.log('Client error: ' + error.message); + } + }); + + // create TLS server + const server = forge.tls.createConnection({ + server: true, + caStore: [cert], + sessionCache: {}, + // supported cipher suites in order of preference + cipherSuites: [ + forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA, + forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA], + connected: function(c) { + console.log('Server connected'); + c.prepareHeartbeatRequest('heartbeat'); + }, + verifyClient: true, + verify: function(c, verified, depth, certs) { + console.log( + 'Server verifying certificate w/CN: \"' + + certs[0].subject.getField('CN').value + + '\", verified: ' + verified + '...'); + return verified; + }, + getCertificate: function(c, hint) { + console.log('Server getting certificate for \"' + (hint as string[])[0] + '\"...'); + return forge.pki.certificateToPem(cert); + }, + getPrivateKey: function(c, cert) { + return privateKeyPem; + }, + tlsDataReady: function(c) { + // send TLS data to client + client.process(c.tlsData.getBytes()); + }, + dataReady: function(c) { + console.log('Server received \"' + c.data.getBytes() + '\"'); + + // send response + c.prepare('Hello Client'); + c.close(); + }, + heartbeatReceived: function(c, payload) { + console.log('Server received heartbeat: ' + payload.getBytes()); + }, + closed: function(c) { + console.log('Server disconnected.'); + }, + error: function(c, error) { + console.log('Server error: ' + error.message); + } + }); + + console.log('created TLS client and server, doing handshake...'); + client.handshake(); +} From f5b254a3d564a4363b8106c4b4ca8f1d2f917036 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Wed, 30 Jan 2019 12:56:54 -0800 Subject: [PATCH 219/266] Tweak LocationType description --- types/office-js-preview/index.d.ts | 2 +- types/office-js/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index a538a0f6c9..ea3a2d76f4 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -7714,7 +7714,7 @@ declare namespace Office { Appointment = "appointment" } /** - * Specifies an appointment's location type. + * Specifies an appointment location's type. * * [Api set: Mailbox Preview] * diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 139707e367..f2616ffbef 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -7714,7 +7714,7 @@ declare namespace Office { Appointment = "appointment" } /** - * Specifies an appointment's location type. + * Specifies an appointment location's type. * * [Api set: Mailbox Preview] * From 312d6d4dc98faa2416c99db718284d200f8f78c3 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 30 Jan 2019 16:32:08 -0500 Subject: [PATCH 220/266] added cast event --- types/jwplayer/index.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index 05d9c50aa6..f02159bc6f 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -7,6 +7,7 @@ // Benjamin Dobson // Be Birchall // Daniel Cassidy +// Drew Wyatt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -264,6 +265,13 @@ declare namespace jwplayer { reason: 'auto' | 'api' | 'initial choice'; } + interface CastParam { + available: boolean; + active: boolean; + deviceName: string; + type: 'cast'; + } + interface EventParams { adClick: AdProgressParam; adCompanions: AdCompanionsParam; @@ -277,6 +285,7 @@ declare namespace jwplayer { adPlay: AdPlayParam; adPause: AdPlayParam; adTime: AdTimeParam; + cast: CastParam; meta: MetadataParam; audioTracks: AudioTracksParam; audioTrackChanged: AudioTrackChangedParam; From 3a2022aac4f2760b536f5f8c06654300161f9a67 Mon Sep 17 00:00:00 2001 From: Drew Wyatt Date: Wed, 30 Jan 2019 16:53:55 -0500 Subject: [PATCH 221/266] indentation --- types/jwplayer/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index f02159bc6f..91f0d455cc 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -266,10 +266,10 @@ declare namespace jwplayer { } interface CastParam { - available: boolean; - active: boolean; - deviceName: string; - type: 'cast'; + available: boolean; + active: boolean; + deviceName: string; + type: 'cast'; } interface EventParams { From 9ed64f112b662ddf6b04ad484d91bef118330b8a Mon Sep 17 00:00:00 2001 From: Gola Date: Wed, 30 Jan 2019 16:05:12 -0700 Subject: [PATCH 222/266] Moved OptionsBase out of namespace to prevent accidental import Added documentation back for returnPromise --- types/clean-css/index.d.ts | 132 ++++++++++++++++++++----------------- 1 file changed, 71 insertions(+), 61 deletions(-) diff --git a/types/clean-css/index.d.ts b/types/clean-css/index.d.ts index c474741ec8..a033f708a9 100644 --- a/types/clean-css/index.d.ts +++ b/types/clean-css/index.d.ts @@ -8,78 +8,78 @@ import { RequestOptions as HttpsRequestOptions } from "https"; import { RequestOptions as HttpRequestOptions } from "http"; -declare namespace CleanCSS { +/** + * Shared options passed when initializing a new instance of CleanCSS that returns either a promise or output + */ +interface OptionsBase { /** - * Shared options passed when initializing a new instance of CleanCSS that returns either a promise or output + * Controls compatibility mode used; defaults to ie10+ using `'*'`. + * Compatibility hash exposes the following properties: `colors`, `properties`, `selectors`, and `units` */ - interface OptionsBase { - /** - * Controls compatibility mode used; defaults to ie10+ using `'*'`. - * Compatibility hash exposes the following properties: `colors`, `properties`, `selectors`, and `units` - */ - compatibility?: "*" | "ie9" | "ie8" | "ie7" | CompatibilityOptions; + compatibility?: "*" | "ie9" | "ie8" | "ie7" | CleanCSS.CompatibilityOptions; - /** - * Controls a function for handling remote requests; Defaults to the build in `loadRemoteResource` function - */ - fetch?: (uri: string, inlineRequest: HttpRequestOptions | HttpsRequestOptions, inlineTimeout: number, done: (message: string | number, body: string) => void) => void; + /** + * Controls a function for handling remote requests; Defaults to the build in `loadRemoteResource` function + */ + fetch?: (uri: string, inlineRequest: HttpRequestOptions | HttpsRequestOptions, inlineTimeout: number, done: (message: string | number, body: string) => void) => void; - /** - * Controls output CSS formatting; defaults to `false`. - * Format hash exposes the following properties: `breaks`, `breakWith`, `indentBy`, `indentWith`, `spaces`, and `wrapAt`. - */ - format?: "beautify" | "keep-breaks" | FormatOptions | false; + /** + * Controls output CSS formatting; defaults to `false`. + * Format hash exposes the following properties: `breaks`, `breakWith`, `indentBy`, `indentWith`, `spaces`, and `wrapAt`. + */ + format?: "beautify" | "keep-breaks" | CleanCSS.FormatOptions | false; - /** - * inline option whitelists which @import rules will be processed. Defaults to `'local'` - * Accepts the following values: - * 'local': enables local inlining; - * 'remote': enables remote inlining; - * 'none': disables all inlining; - * 'all': enables all inlining, same as ['local', 'remote']; - * '[uri]': enables remote inlining from the specified uri; - * '![url]': disables remote inlining from the specified uri; - */ - inline?: ReadonlyArray | false; + /** + * inline option whitelists which @import rules will be processed. Defaults to `'local'` + * Accepts the following values: + * 'local': enables local inlining; + * 'remote': enables remote inlining; + * 'none': disables all inlining; + * 'all': enables all inlining, same as ['local', 'remote']; + * '[uri]': enables remote inlining from the specified uri; + * '![url]': disables remote inlining from the specified uri; + */ + inline?: ReadonlyArray | false; - /** - * Controls extra options for inlining remote @import rules - */ - inlineRequest?: HttpRequestOptions | HttpsRequestOptions; + /** + * Controls extra options for inlining remote @import rules + */ + inlineRequest?: HttpRequestOptions | HttpsRequestOptions; - /** - * Controls number of milliseconds after which inlining a remote @import fails; defaults to `5000`; - */ - inlineTimeout?: number; + /** + * Controls number of milliseconds after which inlining a remote @import fails; defaults to `5000`; + */ + inlineTimeout?: number; - /** - * Controls optimization level used; defaults to `1`. - * Level hash exposes `1`, and `2`. - */ - level?: 0 | 1 | 2 | OptimizationsOptions; + /** + * Controls optimization level used; defaults to `1`. + * Level hash exposes `1`, and `2`. + */ + level?: 0 | 1 | 2 | CleanCSS.OptimizationsOptions; - /** - * Controls URL rebasing; defaults to `true`; - */ - rebase?: boolean; + /** + * Controls URL rebasing; defaults to `true`; + */ + rebase?: boolean; - /** - * controls a directory to which all URLs are rebased, most likely the directory under which the output file - * will live; defaults to the current directory; - */ - rebaseTo?: string; + /** + * controls a directory to which all URLs are rebased, most likely the directory under which the output file + * will live; defaults to the current directory; + */ + rebaseTo?: string; - /** - * Controls whether an output source map is built; defaults to `false` - */ - sourceMap?: boolean; + /** + * Controls whether an output source map is built; defaults to `false` + */ + sourceMap?: boolean; - /** - * Controls embedding sources inside a source map's `sourcesContent` field; defaults to `false` - */ - sourceMapInlineSources?: boolean; - } + /** + * Controls embedding sources inside a source map's `sourcesContent` field; defaults to `false` + */ + sourceMapInlineSources?: boolean; +} +declare namespace CleanCSS { /** * Output returned when calling minify functions */ @@ -648,12 +648,22 @@ declare namespace CleanCSS { /** * Options when returning a promise */ - type OptionsPromise = OptionsBase & { returnPromise: true }; + type OptionsPromise = OptionsBase & { + /** + * If you prefer clean-css to return a Promise object then you need to explicitly ask for it; defaults to `false` + */ + returnPromise: true + }; /** * Options when returning an output */ - type OptionsOutput = OptionsBase & { returnPromise?: false }; + type OptionsOutput = OptionsBase & { + /** + * If you prefer clean-css to return a Promise object then you need to explicitly ask for it; defaults to `false` + */ + returnPromise?: false + }; /** * Discriminant union of both sets of options types. If you initialize without setting `returnPromise: true` From 5239b343f6c0e3a36c3cf16e970ed9582e4aba86 Mon Sep 17 00:00:00 2001 From: Gola Date: Wed, 30 Jan 2019 16:08:02 -0700 Subject: [PATCH 223/266] Fixed linting error --- types/clean-css/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/clean-css/index.d.ts b/types/clean-css/index.d.ts index a033f708a9..9f2dfe9358 100644 --- a/types/clean-css/index.d.ts +++ b/types/clean-css/index.d.ts @@ -648,7 +648,7 @@ declare namespace CleanCSS { /** * Options when returning a promise */ - type OptionsPromise = OptionsBase & { + type OptionsPromise = OptionsBase & { /** * If you prefer clean-css to return a Promise object then you need to explicitly ask for it; defaults to `false` */ @@ -658,7 +658,7 @@ declare namespace CleanCSS { /** * Options when returning an output */ - type OptionsOutput = OptionsBase & { + type OptionsOutput = OptionsBase & { /** * If you prefer clean-css to return a Promise object then you need to explicitly ask for it; defaults to `false` */ From 371507cae9f9a0a88a9161a971c8917cf82c358a Mon Sep 17 00:00:00 2001 From: MutterPedro Date: Wed, 30 Jan 2019 21:16:40 -0200 Subject: [PATCH 224/266] added mem-cache module types definitions --- types/mem-cache/index.d.ts | 19 +++++++++++++++++++ types/mem-cache/mem-cache-tests.ts | 17 +++++++++++++++++ types/mem-cache/tsconfig.json | 24 ++++++++++++++++++++++++ types/mem-cache/tslint.json | 1 + 4 files changed, 61 insertions(+) create mode 100644 types/mem-cache/index.d.ts create mode 100644 types/mem-cache/mem-cache-tests.ts create mode 100644 types/mem-cache/tsconfig.json create mode 100644 types/mem-cache/tslint.json diff --git a/types/mem-cache/index.d.ts b/types/mem-cache/index.d.ts new file mode 100644 index 0000000000..2bf77e8c71 --- /dev/null +++ b/types/mem-cache/index.d.ts @@ -0,0 +1,19 @@ +import { EventEmitter } from 'events'; + +export interface ICacheOptions { + timeout?: number; + doesNotRenewTimeout?: boolean; + timeoutDisabled?: boolean; +} + +export default class Cache extends EventEmitter { + public keys: string[]; + public length: number; + + constructor(options?: number | ICacheOptions); + + public set(key: string, value: any, timeout?: number): void; + public get(key: string): any; + public remove(key: string): void; + public clean(): void; +} diff --git a/types/mem-cache/mem-cache-tests.ts b/types/mem-cache/mem-cache-tests.ts new file mode 100644 index 0000000000..420c72f200 --- /dev/null +++ b/types/mem-cache/mem-cache-tests.ts @@ -0,0 +1,17 @@ +import Cache from 'mem-cache'; + +const cache = new Cache(); // $ExpectType Cache +const cache2 = new Cache(100000); // $ExpectType Cache +const cache3 = new Cache({ + doesNotRenewTimeout: true, + timeout: 100000, + timeoutDisabled: false +}); // $ExpectType Cache + +cache.set('foo', 'bar'); // $ExpectType void +cache.get('foo'); // $ExpectType any +cache.remove('foo'); // $ExpectType void +cache.clean(); // $ExpectType void +cache.length; // $ExpectType number +cache.keys; // $ExpectType string[] + diff --git a/types/mem-cache/tsconfig.json b/types/mem-cache/tsconfig.json new file mode 100644 index 0000000000..9587e02f72 --- /dev/null +++ b/types/mem-cache/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mem-cache-tests.ts" + ], + "baseUrl": "types", + "typeRoots": ["types"] +} diff --git a/types/mem-cache/tslint.json b/types/mem-cache/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mem-cache/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5b1ff713aca7c870592e385feba014813fe1cad1 Mon Sep 17 00:00:00 2001 From: markdreyer Date: Wed, 30 Jan 2019 17:29:31 -0600 Subject: [PATCH 225/266] Update ParseConfig.dynamicTyping definition From documentation https://www.papaparse.com/docs#config : It also accepts an object or a function. If object it's values should be a boolean to indicate if dynamic typing should be applied for each column number (or header name if using headers). If it's a function, it should return a boolean value for each field number (or name if using headers) which will be passed as first argument. --- types/papaparse/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/papaparse/index.d.ts b/types/papaparse/index.d.ts index fc97ef210c..df09dde329 100644 --- a/types/papaparse/index.d.ts +++ b/types/papaparse/index.d.ts @@ -97,7 +97,7 @@ export interface ParseConfig { quoteChar?: string; // default: '"' header?: boolean; // default: false trimHeaders?: boolean; // default: false - dynamicTyping?: boolean; // default: false + dynamicTyping?: boolean | { [key: string]: boolean; [index: number]: boolean;} | ((field: string) => boolean); // default: false preview?: number; // default: 0 encoding?: string; // default: "" worker?: boolean; // default: false From 0b462231d669795ef8f2daecb4be5e7a09f362de Mon Sep 17 00:00:00 2001 From: markdreyer Date: Wed, 30 Jan 2019 17:33:53 -0600 Subject: [PATCH 226/266] Update type variable names to match documentation --- types/papaparse/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/papaparse/index.d.ts b/types/papaparse/index.d.ts index df09dde329..300e33b4a5 100644 --- a/types/papaparse/index.d.ts +++ b/types/papaparse/index.d.ts @@ -97,7 +97,7 @@ export interface ParseConfig { quoteChar?: string; // default: '"' header?: boolean; // default: false trimHeaders?: boolean; // default: false - dynamicTyping?: boolean | { [key: string]: boolean; [index: number]: boolean;} | ((field: string) => boolean); // default: false + dynamicTyping?: boolean | { [headerName: string]: boolean; [columnNumber: number]: boolean;} | ((field: string | number) => boolean); // default: false preview?: number; // default: 0 encoding?: string; // default: "" worker?: boolean; // default: false From 5693cd23c5cd66decd6cd0cf6fb91ba2b15042c8 Mon Sep 17 00:00:00 2001 From: MutterPedro Date: Wed, 30 Jan 2019 21:35:48 -0200 Subject: [PATCH 227/266] added mem-cache module types definitions --- types/mem-cache/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/mem-cache/index.d.ts b/types/mem-cache/index.d.ts index 2bf77e8c71..fbee520d33 100644 --- a/types/mem-cache/index.d.ts +++ b/types/mem-cache/index.d.ts @@ -1,3 +1,8 @@ +// Type definitions for mem-cache v0.0.5 +// Project: https://github.com/silviom/node-mem-cache +// Definitions by: Pedro Mutter +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + import { EventEmitter } from 'events'; export interface ICacheOptions { From b4e374267e2edb79e92199c898e656df37dddbfd Mon Sep 17 00:00:00 2001 From: MutterPedro Date: Wed, 30 Jan 2019 21:38:19 -0200 Subject: [PATCH 228/266] added mem-cache module types definitions --- types/mem-cache/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/mem-cache/tsconfig.json b/types/mem-cache/tsconfig.json index 9587e02f72..3c3a2e701a 100644 --- a/types/mem-cache/tsconfig.json +++ b/types/mem-cache/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 53b75eb119358ad3b774117298c993ec90735333 Mon Sep 17 00:00:00 2001 From: MutterPedro Date: Wed, 30 Jan 2019 21:44:01 -0200 Subject: [PATCH 229/266] fix test requirements errors --- types/mem-cache/index.d.ts | 18 +++++++++--------- types/mem-cache/mem-cache-tests.ts | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/types/mem-cache/index.d.ts b/types/mem-cache/index.d.ts index fbee520d33..e4adf69f0e 100644 --- a/types/mem-cache/index.d.ts +++ b/types/mem-cache/index.d.ts @@ -1,24 +1,24 @@ -// Type definitions for mem-cache v0.0.5 +// Type definitions for mem-cache v0.1.0 // Project: https://github.com/silviom/node-mem-cache // Definitions by: Pedro Mutter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { EventEmitter } from 'events'; -export interface ICacheOptions { +export interface CacheOptions { timeout?: number; doesNotRenewTimeout?: boolean; timeoutDisabled?: boolean; } export default class Cache extends EventEmitter { - public keys: string[]; - public length: number; + keys: string[]; + length: number; - constructor(options?: number | ICacheOptions); + constructor(options?: number | CacheOptions); - public set(key: string, value: any, timeout?: number): void; - public get(key: string): any; - public remove(key: string): void; - public clean(): void; + set(key: string, value: any, timeout?: number): void; + get(key: string): any; + remove(key: string): void; + clean(): void; } diff --git a/types/mem-cache/mem-cache-tests.ts b/types/mem-cache/mem-cache-tests.ts index 420c72f200..94232e4410 100644 --- a/types/mem-cache/mem-cache-tests.ts +++ b/types/mem-cache/mem-cache-tests.ts @@ -14,4 +14,3 @@ cache.remove('foo'); // $ExpectType void cache.clean(); // $ExpectType void cache.length; // $ExpectType number cache.keys; // $ExpectType string[] - From ccc18670b0ad0e79ad68ac0e2df914855364fb95 Mon Sep 17 00:00:00 2001 From: Rodrigo Vieira de Alencar Date: Wed, 30 Jan 2019 15:52:20 +1100 Subject: [PATCH 230/266] Update for prosemirror-model 1.7.0 --- types/prosemirror-model/index.d.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/types/prosemirror-model/index.d.ts b/types/prosemirror-model/index.d.ts index a86037d0f8..d2d9670584 100644 --- a/types/prosemirror-model/index.d.ts +++ b/types/prosemirror-model/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for prosemirror-model 1.5 +// Type definitions for prosemirror-model 1.7 // Project: https://github.com/ProseMirror/prosemirror-model // Definitions by: Bradley Ayers // David Hahn @@ -1240,6 +1240,11 @@ export interface NodeSpec { * parsing rules in your schema. */ parseDOM?: ParseRule[] | null; + /** + * Defines the default way a node of this type should be serialized + * to a string representation for debugging (e.g. in error messages). + */ + toDebugString?: ((node: ProsemirrorNode) => string) | null; } export interface MarkSpec { /** @@ -1272,6 +1277,11 @@ export interface MarkSpec { * The group or space-separated groups to which this mark belongs. */ group?: string | null; + /** + * Determines whether marks of this type can span multiple adjacent + * nodes when serialized to DOM/HTML. Defaults to true. + */ + spanning?: boolean | null; /** * Defines the default way marks of this type should be serialized * to DOM/HTML. From 7dadf2dedd8d48fca48eb870e9f0729f32afd2db Mon Sep 17 00:00:00 2001 From: MutterPedro Date: Wed, 30 Jan 2019 21:48:12 -0200 Subject: [PATCH 231/266] fix test requirements version and wrong expect type --- types/mem-cache/index.d.ts | 2 +- types/mem-cache/mem-cache-tests.ts | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/types/mem-cache/index.d.ts b/types/mem-cache/index.d.ts index e4adf69f0e..3258d6364e 100644 --- a/types/mem-cache/index.d.ts +++ b/types/mem-cache/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for mem-cache v0.1.0 +// Type definitions for mem-cache v1.0.0 // Project: https://github.com/silviom/node-mem-cache // Definitions by: Pedro Mutter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/mem-cache/mem-cache-tests.ts b/types/mem-cache/mem-cache-tests.ts index 94232e4410..2b667258d3 100644 --- a/types/mem-cache/mem-cache-tests.ts +++ b/types/mem-cache/mem-cache-tests.ts @@ -1,12 +1,6 @@ import Cache from 'mem-cache'; const cache = new Cache(); // $ExpectType Cache -const cache2 = new Cache(100000); // $ExpectType Cache -const cache3 = new Cache({ - doesNotRenewTimeout: true, - timeout: 100000, - timeoutDisabled: false -}); // $ExpectType Cache cache.set('foo', 'bar'); // $ExpectType void cache.get('foo'); // $ExpectType any From c07384eacc4acd36be2db8eb9790c932a78d2c15 Mon Sep 17 00:00:00 2001 From: MutterPedro Date: Wed, 30 Jan 2019 21:52:49 -0200 Subject: [PATCH 232/266] fix header --- types/mem-cache/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mem-cache/index.d.ts b/types/mem-cache/index.d.ts index 3258d6364e..f5e135a363 100644 --- a/types/mem-cache/index.d.ts +++ b/types/mem-cache/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for mem-cache v1.0.0 +// Type definitions for mem-cache 1.0 // Project: https://github.com/silviom/node-mem-cache // Definitions by: Pedro Mutter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From c8cdd4b998b43a1e68d64d2367308458c7b77b7d Mon Sep 17 00:00:00 2001 From: markdreyer Date: Wed, 30 Jan 2019 18:57:01 -0600 Subject: [PATCH 233/266] Add tests for ParseConfig.dynamicTyping --- types/papaparse/papaparse-tests.ts | 58 ++++++++++++++++++------------ 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/types/papaparse/papaparse-tests.ts b/types/papaparse/papaparse-tests.ts index 50929ff512..a22ea5b14d 100644 --- a/types/papaparse/papaparse-tests.ts +++ b/types/papaparse/papaparse-tests.ts @@ -2,12 +2,12 @@ import Papa = require("papaparse"); import { - ParseConfig, - UnparseConfig, - UnparseObject, - ParseError, - ParseMeta, - ParseResult + ParseConfig, + UnparseConfig, + UnparseObject, + ParseError, + ParseMeta, + ParseResult } from "papaparse"; import { Readable } from "stream"; @@ -19,14 +19,26 @@ var res = Papa.parse("3,3,3"); res.errors[0].code; Papa.parse("3,3,3", { - delimiter: ';', - comments: false, + delimiter: ';', + comments: false, trimHeaders: false, + step: function (results, p) { + p.abort(); + results.data.length; + }, + dynamicTyping: true +}); - step: function (results, p) { - p.abort(); - results.data.length; - } +Papa.parse("3,3,3", { + dynamicTyping: (field: string | number): boolean => /headerName/i.test(field.toString()) +}); + +Papa.parse("3,3,3", { + dynamicTyping: {'headerName': true} +}); + +Papa.parse("3,3,3", { + dynamicTyping: {5: true} }); var file = new File(null, null, null); @@ -35,20 +47,20 @@ Papa.parse(file, { transform: function(value, field) { }, - complete: function (a, b) { - a.meta.fields; - b.name; - } + complete: function (a, b) { + a.meta.fields; + b.name; + } }); const readable = new Readable() const rows = [ - "1,2,3", - "4,5,6" + "1,2,3", + "4,5,6" ] rows.forEach(r => { - readable.push(r); + readable.push(r); }); const papaStream: NodeJS.ReadWriteStream = Papa.parse(Papa.NODE_STREAM_INPUT); @@ -61,16 +73,16 @@ readable.pipe(papaStream); Papa.unparse([{ a: 1, b: 1, c: 1 }]); Papa.unparse([[1, 2, 3], [4, 5, 6]]); Papa.unparse({ - fields: ["3"], - data: [] + fields: ["3"], + data: [] }); Papa.unparse([{ a: 1, b: 1, c: 1 }], { quotes: false }); Papa.unparse([{ a: 1, b: 1, c: 1 }], { quotes: [false, true, true] }); Papa.unparse([[1, 2, 3], [4, 5, 6]], { delimiter: "," }); Papa.unparse({ - fields: ["3"], - data: [] + fields: ["3"], + data: [] }, { newline: "\n" }); From 6471e3065240488bb1ee6e079d64265192a10f7c Mon Sep 17 00:00:00 2001 From: Ming Date: Wed, 30 Jan 2019 17:09:14 -0800 Subject: [PATCH 234/266] mongoose: Fix ConnectionOptionsBase. - Fix type for keepAlive: should be boolean instead of number. - Add optional field keepAliveInitialDelay. - Fix numbers in comment. --- types/mongoose/index.d.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index b7d3b5d9c6..47585e20d3 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -16,6 +16,7 @@ // Dan Manastireanu // stablio // Emmanuel Gautier +// Ming Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -316,6 +317,16 @@ declare module "mongoose" { readyState: number; } + /** + * Connection optional settings. + * + * see + * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-connect + * and + * http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html + * for all available options. + * + */ interface ConnectionOptionsBase { /** database Name for Mongodb Atlas Connection */ dbName?: string; @@ -339,11 +350,13 @@ declare module "mongoose" { 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; - /** TCP Connection timeout setting (default: 0) */ + /** TCP Connection keep alive enabled (default: true) */ + keepAlive?: boolean; + /** The number of milliseconds to wait before initiating keepAlive on the TCP socket (default 30000) */ + keepAliveInitialDelay?: number; + /** TCP Connection timeout setting (default: 30000) */ connectTimeoutMS?: number; - /** TCP Socket timeout setting (default: 0) */ + /** TCP Socket timeout setting (default: 360000) */ socketTimeoutMS?: number; /** If the database authentication is dependent on another databaseName. */ authSource?: string; From 392300d5f8726c5b3a50bae8abde0c432377ce3d Mon Sep 17 00:00:00 2001 From: Derek Kniffin Date: Wed, 30 Jan 2019 16:49:53 -0500 Subject: [PATCH 235/266] Added types for axios-case-converter --- .../axios-case-converter-tests.ts | 6 +++++ types/axios-case-converter/index.d.ts | 7 ++++++ types/axios-case-converter/package.json | 6 +++++ types/axios-case-converter/tsconfig.json | 23 +++++++++++++++++++ types/axios-case-converter/tslint.json | 1 + 5 files changed, 43 insertions(+) create mode 100644 types/axios-case-converter/axios-case-converter-tests.ts create mode 100644 types/axios-case-converter/index.d.ts create mode 100644 types/axios-case-converter/package.json create mode 100644 types/axios-case-converter/tsconfig.json create mode 100644 types/axios-case-converter/tslint.json diff --git a/types/axios-case-converter/axios-case-converter-tests.ts b/types/axios-case-converter/axios-case-converter-tests.ts new file mode 100644 index 0000000000..77fa927976 --- /dev/null +++ b/types/axios-case-converter/axios-case-converter-tests.ts @@ -0,0 +1,6 @@ +import axios from "axios"; +import applyConverters from "axios-case-converter"; + +applyConverters(); // $ExpectError + +applyConverters(axios.create()); // $ExpectType AxiosInstance diff --git a/types/axios-case-converter/index.d.ts b/types/axios-case-converter/index.d.ts new file mode 100644 index 0000000000..2071ee4dbc --- /dev/null +++ b/types/axios-case-converter/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for axios-case-converter 0.3 +// Project: https://github.com/mpyw/axios-case-converter +// Definitions by: Derek Kniffin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import { AxiosInstance } from "axios"; + +export default function applyConverters(axios: AxiosInstance): AxiosInstance; diff --git a/types/axios-case-converter/package.json b/types/axios-case-converter/package.json new file mode 100644 index 0000000000..ab98e74e0b --- /dev/null +++ b/types/axios-case-converter/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "axios": "^0.16.1" + } +} diff --git a/types/axios-case-converter/tsconfig.json b/types/axios-case-converter/tsconfig.json new file mode 100644 index 0000000000..fb3102b6eb --- /dev/null +++ b/types/axios-case-converter/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", + "axios-case-converter-tests.ts" + ] +} diff --git a/types/axios-case-converter/tslint.json b/types/axios-case-converter/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/axios-case-converter/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f044c380f6be2c942201f6207c11461a946e1856 Mon Sep 17 00:00:00 2001 From: Matt Krick Date: Wed, 30 Jan 2019 18:21:34 -0800 Subject: [PATCH 236/266] add support for getRequest --- types/relay-runtime/index.d.ts | 37 +++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 6589acfd6d..a4b7106c4f 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -42,9 +42,40 @@ export type RelayContainer = any; // ~~~~~~~~~~~~~~~~~~~~~ // File: https://github.com/facebook/relay/blob/fe0e70f10bbcba1fff89911313ea69f24569464b/packages/relay-runtime/util/RelayConcreteNode.js -export type ConcreteFragment = any; -export type ConcreteRequest = any; -export type ConcreteBatchRequest = any; +export interface ConcreteFragment { + kind: string; + name: string; + type: string; + metadata: {[key: string]: any} | null; + argumentDefinitions: any[]; + selections: any[]; +} +export interface ConcreteRequest { + kind: string; + operationKind: string; + name: string; + id: string | null; + text: string | null; + metadata: {[key: string]: any}; + fragment: ConcreteFragment; + operation: any; +} +export interface ConcreteBatchRequest { + kind: string; + operationKind: string; + name: string; + metadata: {[key: string]: any}; + fragment: ConcreteFragment; + requests: Array<{ + name: string; + id: string | null; + text: string | null; + argumentDependencies: any[] | null; + operation: any; + }>; +} + +export function getRequest(taggedNode: GraphQLTaggedNode): ConcreteRequest; export type RequestNode = ConcreteRequest | ConcreteBatchRequest; From 3b59425df7db3cad1cc4c224fa8aecd193de3f09 Mon Sep 17 00:00:00 2001 From: Dalius Dobravolskas Date: Mon, 28 Jan 2019 12:00:40 +0200 Subject: [PATCH 237/266] Initial State support for reduceReducers. --- types/reduce-reducers/index.d.ts | 76 +++++++- .../reduce-reducers/reduce-reducers-tests.ts | 183 +++++++++++++++++- 2 files changed, 254 insertions(+), 5 deletions(-) diff --git a/types/reduce-reducers/index.d.ts b/types/reduce-reducers/index.d.ts index d4bde0bc8a..19499c452c 100644 --- a/types/reduce-reducers/index.d.ts +++ b/types/reduce-reducers/index.d.ts @@ -1,7 +1,81 @@ -// Type definitions for reduce-reducers 0.1 +// Type definitions for reduce-reducers 0.2 // Project: https://github.com/acdlite/reduce-reducers // Definitions by: Huy Nguyen +// Dalius Dobravolskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Reducer } from 'redux'; +export default function reduceReducer(r0: Reducer, s: S | null): Reducer; +export default function reduceReducer(r0: Reducer, r1: Reducer, s: S | null): Reducer; +export default function reduceReducer(r0: Reducer, r1: Reducer, r2: Reducer, s: S | null): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + r6: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + r6: Reducer, + r7: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + r6: Reducer, + r7: Reducer, + r8: Reducer, + s: S | null, +): Reducer; +export default function reduceReducer( + r0: Reducer, + r1: Reducer, + r2: Reducer, + r3: Reducer, + r4: Reducer, + r5: Reducer, + r6: Reducer, + r7: Reducer, + r8: Reducer, + r9: Reducer, + s: S | null, +): Reducer; export default function reduceReducer(...reducers: Array>): Reducer; diff --git a/types/reduce-reducers/reduce-reducers-tests.ts b/types/reduce-reducers/reduce-reducers-tests.ts index f542fe834a..f4fdd8fff3 100644 --- a/types/reduce-reducers/reduce-reducers-tests.ts +++ b/types/reduce-reducers/reduce-reducers-tests.ts @@ -1,13 +1,188 @@ import { - Reducer, - Action, + Reducer, + Action, } from 'redux'; import reduceReducers from 'reduce-reducers'; interface TestStore { - a: number; - b: string; + a: number; + b: string; } const firstReducer: (state: TestStore, action: Action) => TestStore = (a, b) => a; const secondReducer: (state: TestStore, action: Action) => TestStore = (a, b) => a; const finalReducer: (state: TestStore, action: Action) => TestStore = reduceReducers(firstReducer, secondReducer); +const finalReducerWithState: (state: TestStore, action: Action) => TestStore = reduceReducers(firstReducer, secondReducer, null); + +const initialState: TestStore = { + a: 1, + b: '2', +}; + +const finalReducerWithInitialState: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + initialState); + +const reducer02: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer03: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer04: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer05: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer06: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer07: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer08: (state: TestStore, action: Action) => TestStore = (a, b) => a; +const reducer09: (state: TestStore, action: Action) => TestStore = (a, b) => a; + +const finalReducerWithInitialState02: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + initialState); +const finalReducerWithInitialState02null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + null); + +const finalReducerWithInitialState03: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + initialState); +const finalReducerWithInitialState03null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + null); + +const finalReducerWithInitialState04: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + initialState); +const finalReducerWithInitialState04null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + null); + +const finalReducerWithInitialState05: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + initialState); +const finalReducerWithInitialState05null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + null); + +const finalReducerWithInitialState06: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + initialState); +const finalReducerWithInitialState06null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + null); + +const finalReducerWithInitialState07: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + initialState); +const finalReducerWithInitialState07null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + null); + +const finalReducerWithInitialState08: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + initialState); +const finalReducerWithInitialState08null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + null); + +const finalReducerWithoutInitialState09: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + reducer09); +const finalReducerWithInitialState09: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + reducer09, + initialState); +const finalReducerWithInitialState09null: (state: TestStore, action: Action) => TestStore = reduceReducers( + firstReducer, + secondReducer, + reducer02, + reducer03, + reducer04, + reducer05, + reducer06, + reducer07, + reducer08, + reducer09, + null); From 67a1afed1e485dd1e8040318fba2927ba86a7997 Mon Sep 17 00:00:00 2001 From: fraukesch Date: Thu, 31 Jan 2019 10:20:23 +0100 Subject: [PATCH 238/266] Added missing property to DroppableStateSnapshot See: https://github.com/atlassian/react-beautiful-dnd#2-snapshot-droppablestatesnapshot --- types/react-beautiful-dnd/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-beautiful-dnd/index.d.ts b/types/react-beautiful-dnd/index.d.ts index 085ad4e8b7..cb59017e52 100644 --- a/types/react-beautiful-dnd/index.d.ts +++ b/types/react-beautiful-dnd/index.d.ts @@ -53,6 +53,7 @@ export interface DroppableProvided { export interface DroppableStateSnapshot { isDraggingOver: boolean; + draggingOverWith?: DraggableId; } export interface DroppableProps { From d40ad92baf8a39a07c01ea1cb92473b51d7e6943 Mon Sep 17 00:00:00 2001 From: amirfuhaira Date: Thu, 31 Jan 2019 17:34:23 +0800 Subject: [PATCH 239/266] [cron] update types to 1.6 --- types/cron/index.d.ts | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/types/cron/index.d.ts b/types/cron/index.d.ts index b27bfdf90c..596a9536ca 100644 --- a/types/cron/index.d.ts +++ b/types/cron/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cron 1.3 +// Type definitions for cron 1.6 // Project: https://www.npmjs.com/package/cron // Definitions by: Hiroki Horiuchi // Lundarl Gholoi @@ -9,8 +9,9 @@ export declare class CronTime { * Create a new ```CronTime```. * @param source The time to fire off your job. This can be in the form of cron syntax or a JS ```Date``` object. * @param zone Timezone name. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). + * @param utcOffset UTC offset. Don't use both ```zone``` and ```utcOffset``` together or weird things may happen. */ - constructor(source: string | Date, zone?: string); + constructor(source: string | Date, zone?: string, utcOffset?: string | number); /** * Tells you when ```CronTime``` will be run. @@ -29,19 +30,19 @@ export declare interface CronJobParameters { */ cronTime: string | Date; /** - * The function to fire at the specified time. + * The function to fire at the specified time. If an ```onComplete``` callback was provided, ```onTick``` will receive it as an argument. ```onTick``` may call ```onComplete``` when it has finished its work. */ onTick: () => void; /** - * A function that will fire when the job is complete, when it is stopped. + * A function that will fire when the job is stopped with ```job.stop()```, and may also be called by ```onTick``` at the end of each run. */ onComplete?: () => void; /** - * Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your onTick function, it just gives you more control over the behavior of your jobs. + * Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your ```onTick``` function, it just gives you more control over the behavior of your jobs. */ start?: boolean; /** - * Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). + * Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen. */ timeZone?: string; /** @@ -52,6 +53,14 @@ export declare interface CronJobParameters { * This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility. */ runOnInit?: boolean; + /** + * This allows you to specify the offset of your timezone rather than using the ```timeZone``` param. Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen. + */ + utcOffset?: string | number; + /** + * If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs. + */ + unrefTimeout?: boolean; } export declare class CronJob { @@ -73,8 +82,10 @@ export declare class CronJob { * @param timeZone Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). * @param context The context within which to execute the onTick method. This defaults to the cronjob itself allowing you to call ```this.stop()```. However, if you change this you'll have access to the functions and values within your context object. * @param runOnInit This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility. + * @param utcOffset This allows you to specify the offset of your timezone rather than using the ```timeZone``` param. Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen. + * @param unrefTimeout If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs. */ - constructor(cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean); + constructor(cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean); /** * Create a new ```CronJob```. * @param options Job parameters. @@ -111,7 +122,7 @@ export declare class CronJob { } export declare var job: - ((cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean) => CronJob) + ((cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean) => CronJob) | ((options: CronJobParameters) => CronJob); export declare var time: (source: string | Date, zone?: string) => CronTime; export declare var sendAt: (cronTime: CronTime) => Date; From af0e0c5c319e6c63bbe8d39d770e2eb45672f05f Mon Sep 17 00:00:00 2001 From: Lee Henson Date: Thu, 31 Jan 2019 10:12:00 +0000 Subject: [PATCH 240/266] [http-aws-es] type awsConfig as AWS.Config instead of handcrafted subset --- types/http-aws-es/http-aws-es-tests.ts | 29 +++++++++++++------------- types/http-aws-es/index.d.ts | 11 ++-------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/types/http-aws-es/http-aws-es-tests.ts b/types/http-aws-es/http-aws-es-tests.ts index acd5248817..18ae2b666c 100644 --- a/types/http-aws-es/http-aws-es-tests.ts +++ b/types/http-aws-es/http-aws-es-tests.ts @@ -1,42 +1,43 @@ -import { EnvironmentCredentials } from "aws-sdk/lib/core"; +import * as AWS from "aws-sdk"; import { Client } from "elasticsearch"; import HttpAmazonESConnector = require("http-aws-es"); new Client({ - awsConfig: { - accessKey: "AKID", + awsConfig: new AWS.Config({ + accessKeyId: "AKID", region: "us-east-1", - secretKey: "secret", - }, + secretAccessKey: "secret", + }), connectionClass: HttpAmazonESConnector, host: "https://amazon-es-host.us-east-1.es.amazonaws.com", }); new Client({ - awsConfig: { - accessKey: "AKID", + awsConfig: new AWS.Config({ + accessKeyId: "AKID", region: "us-east-1", - secretKey: "secret", - }, + secretAccessKey: "secret", + }), connectionClass: require("http-aws-es"), host: "https://amazon-es-host.us-east-1.es.amazonaws.com", }); -const myCredentials = new EnvironmentCredentials("AWS"); +const myCredentials = new AWS.EnvironmentCredentials("AWS"); + new Client({ - awsConfig: { + awsConfig: new AWS.Config({ credentials: myCredentials, region: "us-east-1", - }, + }), connectionClass: HttpAmazonESConnector, host: "https://amazon-es-host.us-east-1.es.amazonaws.com", }); new Client({ - awsConfig: { + awsConfig: new AWS.Config({ credentials: myCredentials, region: "us-east-1", - }, + }), connectionClass: require("http-aws-es"), host: "https://amazon-es-host.us-east-1.es.amazonaws.com", }); diff --git a/types/http-aws-es/index.d.ts b/types/http-aws-es/index.d.ts index 15a803076f..2a6ca11629 100644 --- a/types/http-aws-es/index.d.ts +++ b/types/http-aws-es/index.d.ts @@ -7,18 +7,11 @@ /// import * as e from "elasticsearch"; -import { Credentials } from "aws-sdk/lib/core"; +import * as AWS from "aws-sdk"; declare module "elasticsearch" { - interface AmazonESOptions { - accessKey?: string; - credentials?: Credentials; - region: string; - secretKey?: string; - } - interface ConfigOptions { - awsConfig?: AmazonESOptions; + awsConfig?: AWS.Config; } } From 4ecff0071745b47ad1e1d23e22dd3fe27bc22bcc Mon Sep 17 00:00:00 2001 From: Ahmed Abdelmotey Date: Thu, 31 Jan 2019 12:25:31 +0200 Subject: [PATCH 241/266] Update chartist-tests.ts Added simple tests to verify types changes --- types/chartist/chartist-tests.ts | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/types/chartist/chartist-tests.ts b/types/chartist/chartist-tests.ts index cb7f884264..863fdb33be 100644 --- a/types/chartist/chartist-tests.ts +++ b/types/chartist/chartist-tests.ts @@ -485,3 +485,53 @@ new Chartist.Candle('.ct-chart', { } } }); + + +// Create a simple bar chart and line chart with two dimensional arrays +new Chartist.Bar('.ct-chart', { + labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + series: [ + [ + {value: 1}, + {value: 2}, + {value: 3}, + {value: 4}, + {value: 5}, + {value: 6}, + {value: 7} + ], + [ + {value: 7}, + {value: 6}, + {value: 5}, + {value: 4}, + {value: 3}, + {value: 2}, + {value: 1} + ] + ] +}, {}) + +new Chartist.Line('.ct-chart', { + labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + series: [ + [ + {value: 1}, + {value: 2}, + {value: 3}, + {value: 4}, + {value: 5}, + {value: 6}, + {value: 7} + ], + [ + {value: 7}, + {value: 6}, + {value: 5}, + {value: 4}, + {value: 3}, + {value: 2}, + {value: 1} + ] + ] +}, {}) From c4c2c7095ee6b6231061518c15e66a6e855b28df Mon Sep 17 00:00:00 2001 From: Ahmed Abdelmotey Date: Thu, 31 Jan 2019 12:40:11 +0200 Subject: [PATCH 242/266] Updated IChartistData type Bar charts and line charts needs to be two dimensional arrays, this was not available in the allowed types --- types/chartist/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index 9b096839cc..8d700703c9 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -93,7 +93,7 @@ declare namespace Chartist { // TODO: come in and tidy this up and make it fit better interface IChartistData { labels?: Array | Array | Array; - series: Array | Array> | Array | Array>; + series: Array | Array> | Array> | Array | Array>; } interface IChartistSeriesData { From 04f251145f4902603a748e4db5bfc89f100e2d0f Mon Sep 17 00:00:00 2001 From: Robert Ying Date: Thu, 31 Jan 2019 18:56:27 +0800 Subject: [PATCH 243/266] [expo/vector-icons] add AntDesign type --- types/expo__vector-icons/expo__vector-icons-tests.tsx | 10 +++++----- types/expo__vector-icons/index.d.ts | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/types/expo__vector-icons/expo__vector-icons-tests.tsx b/types/expo__vector-icons/expo__vector-icons-tests.tsx index 7d918c917f..33e1056957 100644 --- a/types/expo__vector-icons/expo__vector-icons-tests.tsx +++ b/types/expo__vector-icons/expo__vector-icons-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { View, Text, TabBarIOS } from 'react-native'; -import { createIconSet, MaterialIcons, FontAwesome, Ionicons } from 'expo__vector-icons'; +import { createIconSet, MaterialIcons, FontAwesome, AntDesign } from 'expo__vector-icons'; const glyphMap = { custom: 58918 @@ -48,7 +48,7 @@ class TabTest extends React.Component<{}, { selectedTab: string }> { render() { return ( - { onPress={() => this.setState({ selectedTab: 'tab1' })} > - + - { onPress={() => this.setState({ selectedTab: 'tab2' })} > - + ); } diff --git a/types/expo__vector-icons/index.d.ts b/types/expo__vector-icons/index.d.ts index 529142c0e9..ab7db3547b 100644 --- a/types/expo__vector-icons/index.d.ts +++ b/types/expo__vector-icons/index.d.ts @@ -1,13 +1,16 @@ -// Type definitions for @expo/vector-icons 6.2 +// Type definitions for @expo/vector-icons 9.0.0 // Project: https://github.com/expo/vector-icons // Definitions by: Hyeonsu Lee +// Robert Ying // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from 'react'; import { TextProps } from 'react-native'; +import { Icon } from 'react-native-vector-icons/Icon'; export { createIconSet, createIconSetFromFontello, createIconSetFromIcoMoon } from 'react-native-vector-icons'; +export { Icon as AntDesign }; export { default as Entypo } from 'react-native-vector-icons/Entypo'; export { default as EvilIcons } from 'react-native-vector-icons/EvilIcons'; export { default as Feather } from 'react-native-vector-icons/Feather'; From 60fd6dcb117d3402e4a3fb047d8260380d0f1bbb Mon Sep 17 00:00:00 2001 From: Robert Ying Date: Thu, 31 Jan 2019 19:45:05 +0800 Subject: [PATCH 244/266] [expo/vector-icons] omit patch version --- types/expo__vector-icons/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/expo__vector-icons/index.d.ts b/types/expo__vector-icons/index.d.ts index ab7db3547b..7a7ac587ec 100644 --- a/types/expo__vector-icons/index.d.ts +++ b/types/expo__vector-icons/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @expo/vector-icons 9.0.0 +// Type definitions for @expo/vector-icons 9.0 // Project: https://github.com/expo/vector-icons // Definitions by: Hyeonsu Lee // Robert Ying From 2bcbb3d221111160ef035bff8b9cec9559d3a269 Mon Sep 17 00:00:00 2001 From: Alex Brick Date: Thu, 31 Jan 2019 12:47:22 +0100 Subject: [PATCH 245/266] [content-range] Adding types for content-range module --- types/content-range/content-range-tests.ts | 23 ++++++++++++++++++++++ types/content-range/index.d.ts | 22 +++++++++++++++++++++ types/content-range/tsconfig.json | 23 ++++++++++++++++++++++ types/content-range/tslint.json | 1 + 4 files changed, 69 insertions(+) create mode 100644 types/content-range/content-range-tests.ts create mode 100644 types/content-range/index.d.ts create mode 100644 types/content-range/tsconfig.json create mode 100644 types/content-range/tslint.json diff --git a/types/content-range/content-range-tests.ts b/types/content-range/content-range-tests.ts new file mode 100644 index 0000000000..c482d6f072 --- /dev/null +++ b/types/content-range/content-range-tests.ts @@ -0,0 +1,23 @@ +import { format, parse } from 'content-range'; + +format({ + first: 10, + last: 100, + length: 100, + limit: 20, + unit: 'items', +}); + +format({ + length: null, + unit: 'bytes', +}); + +const parts = parse('items 10-29/100'); + +if (parts) { + parts.first; + parts.last; + parts.length; + parts.unit; +} diff --git a/types/content-range/index.d.ts b/types/content-range/index.d.ts new file mode 100644 index 0000000000..b8ee780541 --- /dev/null +++ b/types/content-range/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for content-range 1.1 +// Project: https://github.com/neoziro/content-range +// Definitions by: Alex Brick +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface ContentRangeFormatOptions { + first?: number; + last?: number; + length: number | null; + limit?: number; + unit: string; +} + +export interface ContentRangeParts { + first: number | null; + last: number | null; + length: number | null; + unit: string; +} + +export function format(options: ContentRangeFormatOptions): string; +export function parse(str: string): ContentRangeParts | null; diff --git a/types/content-range/tsconfig.json b/types/content-range/tsconfig.json new file mode 100644 index 0000000000..a2649416e0 --- /dev/null +++ b/types/content-range/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "content-range-tests.ts" + ] +} diff --git a/types/content-range/tslint.json b/types/content-range/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/content-range/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 03aabe8cc0414432547386bbe9eb2c5315f88e77 Mon Sep 17 00:00:00 2001 From: MutterPedro Date: Thu, 31 Jan 2019 10:35:06 -0200 Subject: [PATCH 246/266] fix required export modification --- types/mem-cache/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/mem-cache/index.d.ts b/types/mem-cache/index.d.ts index f5e135a363..df2a0db47d 100644 --- a/types/mem-cache/index.d.ts +++ b/types/mem-cache/index.d.ts @@ -5,13 +5,13 @@ import { EventEmitter } from 'events'; -export interface CacheOptions { +interface CacheOptions { timeout?: number; doesNotRenewTimeout?: boolean; timeoutDisabled?: boolean; } -export default class Cache extends EventEmitter { +declare class Cache extends EventEmitter { keys: string[]; length: number; @@ -22,3 +22,5 @@ export default class Cache extends EventEmitter { remove(key: string): void; clean(): void; } + +export = Cache; From 05bddbd67ca8bfd58b51ceba24c68a790aec04c9 Mon Sep 17 00:00:00 2001 From: MutterPedro Date: Thu, 31 Jan 2019 10:43:46 -0200 Subject: [PATCH 247/266] fix required export/import modification --- types/mem-cache/mem-cache-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mem-cache/mem-cache-tests.ts b/types/mem-cache/mem-cache-tests.ts index 2b667258d3..747ffd75c2 100644 --- a/types/mem-cache/mem-cache-tests.ts +++ b/types/mem-cache/mem-cache-tests.ts @@ -1,4 +1,4 @@ -import Cache from 'mem-cache'; +import Cache = require('mem-cache'); const cache = new Cache(); // $ExpectType Cache From ec2f9a6164c011fcf6fce0de6c7ee005b99d3b80 Mon Sep 17 00:00:00 2001 From: andrewroyburk Date: Wed, 30 Jan 2019 17:46:17 +0100 Subject: [PATCH 248/266] pickaday: correct naming of boolean method parameter on `setDate` --- types/pikaday/index.d.ts | 2 +- types/pikaday/pikaday-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/pikaday/index.d.ts b/types/pikaday/index.d.ts index 63967d3169..fae7acf93a 100644 --- a/types/pikaday/index.d.ts +++ b/types/pikaday/index.d.ts @@ -44,7 +44,7 @@ declare class Pikaday { * can optionally be passed as the second parameter to prevent triggering * of the onSelect callback, allowing the date to be set silently. */ - setDate(date: string | Date, triggerOnSelect?: boolean): void; + setDate(date: string | Date, preventOnSelect?: boolean): void; /** * Returns a Moment.js object for the selected date (Moment must be diff --git a/types/pikaday/pikaday-tests.ts b/types/pikaday/pikaday-tests.ts index 14250d0df3..984961b99d 100644 --- a/types/pikaday/pikaday-tests.ts +++ b/types/pikaday/pikaday-tests.ts @@ -30,6 +30,7 @@ new Pikaday({field: $('#datepicker')[0]}); picker.toString('YYYY-MM-DD'); picker.getDate(); picker.setDate('2015-01-01'); + picker.setDate('2015-01-01', true); picker.getMoment(); picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY')); picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY'), true); From 450ce9d6824537502c8e268705532f107172f29e Mon Sep 17 00:00:00 2001 From: andrewroyburk Date: Wed, 30 Jan 2019 17:48:20 +0100 Subject: [PATCH 249/266] pickaday: add explicit null types to match usage for clearing min/max dates --- types/pikaday/index.d.ts | 4 ++-- types/pikaday/pikaday-tests.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/pikaday/index.d.ts b/types/pikaday/index.d.ts index fae7acf93a..3adb7fc340 100644 --- a/types/pikaday/index.d.ts +++ b/types/pikaday/index.d.ts @@ -90,12 +90,12 @@ declare class Pikaday { /** * Update the minimum/earliest date that can be selected. */ - setMinDate(date: Date): void; + setMinDate(date: Date | null): void; /** * Update the maximum/latest date that can be selected. */ - setMaxDate(date: Date): void; + setMaxDate(date: Date | null): void; /** * Update the range start date. For using two Pikaday instances to diff --git a/types/pikaday/pikaday-tests.ts b/types/pikaday/pikaday-tests.ts index 984961b99d..7a532efb6f 100644 --- a/types/pikaday/pikaday-tests.ts +++ b/types/pikaday/pikaday-tests.ts @@ -42,6 +42,8 @@ new Pikaday({field: $('#datepicker')[0]}); picker.gotoYear(2015); picker.setMinDate(new Date()); picker.setMaxDate(new Date()); + picker.setMinDate(null); + picker.setMaxDate(null); picker.setStartRange(new Date()); picker.setEndRange(new Date()); picker.isVisible(); From 4bdc8452acf58d12c897fa5b77434b3afe9b28da Mon Sep 17 00:00:00 2001 From: Jessica Date: Thu, 31 Jan 2019 22:01:05 +0900 Subject: [PATCH 250/266] Update contributor credits --- types/emoji-mart/index.d.ts | 2 +- types/qhistory/index.d.ts | 2 +- types/react-loadable/index.d.ts | 2 +- types/react/index.d.ts | 2 +- types/styled-components/index.d.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/emoji-mart/index.d.ts b/types/emoji-mart/index.d.ts index a92bcb77ff..8ea741ca9f 100644 --- a/types/emoji-mart/index.d.ts +++ b/types/emoji-mart/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for emoji-mart 2.8 // Project: https://github.com/missive/emoji-mart -// Definitions by: Jessica Franco +// Definitions by: Jessica Franco // Nick Winans // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/qhistory/index.d.ts b/types/qhistory/index.d.ts index 6269c25e82..bf278de47d 100644 --- a/types/qhistory/index.d.ts +++ b/types/qhistory/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for qhistory 1.0 // Project: https://github.com/pshrmn/qhistory#readme -// Definitions by: Jessica Franco +// Definitions by: Jessica Franco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index 8661716e75..2e38f58c39 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-loadable 5.5 // Project: https://github.com/thejameskyle/react-loadable#readme -// Definitions by: Jessica Franco +// Definitions by: Jessica Franco // Oden S. // Ian Ker-Seymer // Tomek Łaziuk diff --git a/types/react/index.d.ts b/types/react/index.d.ts index d98c0e03a2..a87874b9fd 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -18,7 +18,7 @@ // Olivier Pascal // Martin Hochel // Frank Li -// Jessica Franco +// Jessica Franco // Paul Sherman // Sunil Pai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/styled-components/index.d.ts b/types/styled-components/index.d.ts index 1ab41d31e1..924699dd3a 100644 --- a/types/styled-components/index.d.ts +++ b/types/styled-components/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Igor Oleinikov // Ihor Chulinda // Adam Lavin -// Jessica Franco +// Jessica Franco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 From feed7babde6198acf1f550634c7e3f575e94ef56 Mon Sep 17 00:00:00 2001 From: AOHUA MU Date: Thu, 31 Jan 2019 22:12:42 +0800 Subject: [PATCH 251/266] remove unused types as addressed by Jessidhia --- types/redux-state-sync/index.d.ts | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/types/redux-state-sync/index.d.ts b/types/redux-state-sync/index.d.ts index 755d354707..cfb7dda234 100644 --- a/types/redux-state-sync/index.d.ts +++ b/types/redux-state-sync/index.d.ts @@ -8,11 +8,6 @@ import { Store, Reducer, Middleware, AnyAction } from "redux"; import BroadcastChannel from "broadcast-channel"; -export let lastUuid: number; -export const GET_INIT_STATE: string; -export const SEND_INIT_STATE: string; -export const RECEIVE_INIT_STATE: string; - export interface Stamp { $uuid: string; $wuid: string; @@ -33,19 +28,6 @@ export interface MessageListenerConfig { allowed: (type?: string) => boolean; } -export const defaultConfig: Config; -export const WINDOW_STATE_SYNC_ID: string; -export let isMessageListenerCreated: boolean; - -export function myMethod(a: string): string; -export function myOtherMethod(a: number): number; - -export function getIniteState(): AnyAction; -export function sendIniteState(): AnyAction; -export function receiveIniteState(store: Store): AnyAction; -export function s4(): string; -export function guid(): string; - export function generateUuidForAction(action: AnyAction): StampedAction; export function isActionAllowed(config: Config): (type?: any) => boolean; export function createMessageListener(config: MessageListenerConfig): void; From f423c53701bbc45f0e39a555a7c0e65a4ee574b6 Mon Sep 17 00:00:00 2001 From: AOHUA MU Date: Thu, 31 Jan 2019 22:14:37 +0800 Subject: [PATCH 252/266] fix type issue --- types/redux-state-sync/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/redux-state-sync/index.d.ts b/types/redux-state-sync/index.d.ts index cfb7dda234..fb7e0f84b5 100644 --- a/types/redux-state-sync/index.d.ts +++ b/types/redux-state-sync/index.d.ts @@ -29,7 +29,7 @@ export interface MessageListenerConfig { } export function generateUuidForAction(action: AnyAction): StampedAction; -export function isActionAllowed(config: Config): (type?: any) => boolean; +export function isActionAllowed(config: Config): (type: string) => boolean; export function createMessageListener(config: MessageListenerConfig): void; export function createStateSyncMiddleware(config?: Config): Middleware; export function withReduxStateSync( From b0e7a55053036d1a2e89c1d5f9e8ac1fe9131645 Mon Sep 17 00:00:00 2001 From: gretzky Date: Thu, 31 Jan 2019 10:13:59 -0500 Subject: [PATCH 253/266] [styled-system] fix breakpoints type --- types/styled-system/index.d.ts | 399 +++++++++++++++++---------------- 1 file changed, 201 insertions(+), 198 deletions(-) diff --git a/types/styled-system/index.d.ts b/types/styled-system/index.d.ts index aa94ab2aed..1207718523 100644 --- a/types/styled-system/index.d.ts +++ b/types/styled-system/index.d.ts @@ -9,42 +9,45 @@ // Adam Lavin // Joachim Schuler // Adam Misiorny +// Sara F-P // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import * as CSS from "csstype"; +import * as CSS from 'csstype' -export const defaultBreakpoints: string[]; -export function is(n: any): boolean; -export function num(n: any): boolean; -export function px(n: any): string; +export const defaultBreakpoints: string[] +export function is(n: any): boolean +export function num(n: any): boolean +export function px(n: any): string -export function get(obj: any, ...paths: Array): any; +export function get(obj: any, ...paths: Array): any -export function themeGet(keys: string, fallback?: string): any; -export function cloneFunc(fn: (...args: any[]) => any): (...args: any[]) => any; +export function themeGet(keys: string, fallback?: string): any +export function cloneFunc(fn: (...args: any[]) => any): (...args: any[]) => any -export function merge(a: any, b: any): any; +export function merge(a: any, b: any): any export function compose( ...funcs: Array<(...args: any[]) => any> -): (...args: any[]) => any; +): (...args: any[]) => any -export function createMediaQuery(n: number | string): string; +export function createMediaQuery(n: number | string): string export interface LowLevelStylefunctionArguments { - prop: string; - cssProperty?: string; - key?: string; - getter?: () => any; - transformValue?: (n: string | number) => any; - scale?: Array; + prop: string + cssProperty?: string + key?: string + getter?: () => any + transformValue?: (n: string | number) => any + scale?: Array } -export function style(args: LowLevelStylefunctionArguments): {[cssProp: string]: string}; +export function style( + args: LowLevelStylefunctionArguments +): { [cssProp: string]: string } -export type TLengthStyledSystem = string | 0 | number; -export type ResponsiveValue = T | Array | { [key: string]: T }; +export type TLengthStyledSystem = string | 0 | number +export type ResponsiveValue = T | Array | { [key: string]: T } /** * Converts shorthand margin and padding props to margin and padding CSS declarations @@ -58,71 +61,71 @@ export type ResponsiveValue = T | Array | { [key: string]: T }; export interface SpaceProps { /** Margin on top, left, bottom and right */ - m?: ResponsiveValue>; + m?: ResponsiveValue> /** Margin for the top */ - mt?: ResponsiveValue>; + mt?: ResponsiveValue> /** Margin for the right */ - mr?: ResponsiveValue>; + mr?: ResponsiveValue> /** Margin for the bottom */ - mb?: ResponsiveValue>; + mb?: ResponsiveValue> /** Margin for the left */ - ml?: ResponsiveValue>; + ml?: ResponsiveValue> /** Margin for the left and right */ - mx?: ResponsiveValue>; + mx?: ResponsiveValue> /** Margin for the top and bottom */ - my?: ResponsiveValue>; + my?: ResponsiveValue> /** Padding on top, left, bottom and right */ - p?: ResponsiveValue>; + p?: ResponsiveValue> /** Padding for the top */ - pt?: ResponsiveValue>; + pt?: ResponsiveValue> /** Padding for the right */ - pr?: ResponsiveValue>; + pr?: ResponsiveValue> /** Padding for the bottom */ - pb?: ResponsiveValue>; + pb?: ResponsiveValue> /** Padding for the left */ - pl?: ResponsiveValue>; + pl?: ResponsiveValue> /** Padding for the left and right */ - px?: ResponsiveValue>; + px?: ResponsiveValue> /** Padding for the top and bottom */ - py?: ResponsiveValue>; + py?: ResponsiveValue> } -export function space(...args: any[]): any; +export function space(...args: any[]): any export interface VariantArgs { - key?: string; + key?: string // Defaults to "variant" - prop?: string; + prop?: string } -export function variant(props: VariantArgs): (...args: any[]) => any; +export function variant(props: VariantArgs): (...args: any[]) => any -export type ObjectOrArray = T[] | { [K: string]: T }; +export type ObjectOrArray = T[] | { [K: string]: T } export interface BaseTheme { - breakpoints?: number[]; - colors?: ObjectOrArray; - fontSizes?: number[]; - space?: number[]; + breakpoints?: string[] + colors?: ObjectOrArray + fontSizes?: number[] + space?: number[] } export interface Theme extends BaseTheme { - borders?: ObjectOrArray>; - buttons?: ObjectOrArray; - colorStyles?: ObjectOrArray; - fontWeights?: ObjectOrArray; - fonts?: ObjectOrArray; - heights?: ObjectOrArray>; - letterSpacings?: ObjectOrArray>; - lineHeights?: ObjectOrArray>; - maxHeights?: ObjectOrArray>; - maxWidths?: ObjectOrArray>; - minHeights?: ObjectOrArray>; - minWidths?: ObjectOrArray>; - opacity?: ObjectOrArray; - radii?: ObjectOrArray>; - shadows?: ObjectOrArray; - textStyles?: ObjectOrArray; + borders?: ObjectOrArray> + buttons?: ObjectOrArray + colorStyles?: ObjectOrArray + fontWeights?: ObjectOrArray + fonts?: ObjectOrArray + heights?: ObjectOrArray> + letterSpacings?: ObjectOrArray> + lineHeights?: ObjectOrArray> + maxHeights?: ObjectOrArray> + maxWidths?: ObjectOrArray> + minHeights?: ObjectOrArray> + minWidths?: ObjectOrArray> + opacity?: ObjectOrArray + radii?: ObjectOrArray> + shadows?: ObjectOrArray + textStyles?: ObjectOrArray } /** @@ -139,10 +142,10 @@ export interface FontSizeProps { * - And array values are converted into responsive values. * */ - fontSize?: ResponsiveValue>; + fontSize?: ResponsiveValue> } -export function fontSize(...args: any[]): any; +export function fontSize(...args: any[]): any /** * Color @@ -158,10 +161,10 @@ export interface TextColorProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/color) */ - color?: ResponsiveValue; + color?: ResponsiveValue } -export function textColor(...args: any[]): any; +export function textColor(...args: any[]): any export interface BgColorProps { /** @@ -173,22 +176,22 @@ export interface BgColorProps { * * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/background-color) */ - bg?: ResponsiveValue>; + bg?: ResponsiveValue> } -export function bgColor(...args: any[]): any; +export function bgColor(...args: any[]): any export interface ColorProps extends TextColorProps, BgColorProps {} -export function color(...args: any[]): any; +export function color(...args: any[]): any /** * Typography */ export interface FontFamilyProps { - fontFamily?: ResponsiveValue; + fontFamily?: ResponsiveValue } -export function fontFamily(...args: any[]): any; +export function fontFamily(...args: any[]): any export interface TextAlignProps { /** @@ -196,10 +199,10 @@ export interface TextAlignProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align) */ - textAlign?: ResponsiveValue; + textAlign?: ResponsiveValue } -export function textAlign(...args: any[]): any; +export function textAlign(...args: any[]): any export interface LineHeightProps { /** @@ -210,9 +213,9 @@ export interface LineHeightProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height) */ - lineHeight?: ResponsiveValue>; + lineHeight?: ResponsiveValue> } -export function lineHeight(...args: any[]): any; +export function lineHeight(...args: any[]): any export interface FontWeightProps { /** @@ -222,10 +225,10 @@ export interface FontWeightProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight) */ - fontWeight?: ResponsiveValue; + fontWeight?: ResponsiveValue } -export function fontWeight(...args: any[]): any; +export function fontWeight(...args: any[]): any export interface FontStyleProps { /** @@ -234,9 +237,9 @@ export interface FontStyleProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style) */ - fontStyle?: ResponsiveValue; + fontStyle?: ResponsiveValue } -export function fontStyle(...args: any[]): any; +export function fontStyle(...args: any[]): any export interface LetterSpacingProps { /** @@ -244,9 +247,9 @@ export interface LetterSpacingProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/letter-spacing) */ - letterSpacing?: ResponsiveValue>; + letterSpacing?: ResponsiveValue> } -export function letterSpacing(...args: any[]): any; +export function letterSpacing(...args: any[]): any /** * Layout @@ -260,10 +263,10 @@ export interface DisplayProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/display) */ - display?: ResponsiveValue; + display?: ResponsiveValue } -export function display(...args: any[]): any; +export function display(...args: any[]): any export interface MaxWidthProps { /** @@ -272,10 +275,10 @@ export interface MaxWidthProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/max-width) */ - maxWidth?: ResponsiveValue>; + maxWidth?: ResponsiveValue> } -export function maxWidth(...args: any[]): any; +export function maxWidth(...args: any[]): any export interface MinWidthProps { /** @@ -284,10 +287,10 @@ export interface MinWidthProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width) */ - minWidth?: ResponsiveValue>; + minWidth?: ResponsiveValue> } -export function minWidth(...args: any[]): any; +export function minWidth(...args: any[]): any export interface WidthProps { /** @@ -298,10 +301,10 @@ export interface WidthProps { * - String values are passed as raw CSS values. * - And arrays are converted to responsive width styles. */ - width?: ResponsiveValue>; + width?: ResponsiveValue> } -export function width(...args: any[]): any; +export function width(...args: any[]): any export interface MaxHeightProps { /** @@ -310,10 +313,10 @@ export interface MaxHeightProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/max-height) */ - maxHeight?: ResponsiveValue>; + maxHeight?: ResponsiveValue> } -export function maxHeight(...args: any[]): any; +export function maxHeight(...args: any[]): any export interface MinHeightProps { /** @@ -322,10 +325,10 @@ export interface MinHeightProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/display) */ - minHeight?: ResponsiveValue>; + minHeight?: ResponsiveValue> } -export function minHeight(...args: any[]): any; +export function minHeight(...args: any[]): any export interface HeightProps { /** @@ -334,37 +337,37 @@ export interface HeightProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/height) */ - height?: ResponsiveValue>; + height?: ResponsiveValue> } -export function height(...args: any[]): any; +export function height(...args: any[]): any // TODO: Document, I couldn't find any info on these two properties... export interface SizeWidthProps { - size?: ResponsiveValue>; + size?: ResponsiveValue> } -export function sizeWidth(...args: any[]): any; +export function sizeWidth(...args: any[]): any export interface SizeHeightProps { - size?: ResponsiveValue>; + size?: ResponsiveValue> } -export function sizeHeight(...args: any[]): any; +export function sizeHeight(...args: any[]): any export interface SizeProps extends SizeHeightProps, SizeWidthProps {} -export function size(...args: any[]): any; +export function size(...args: any[]): any export interface RatioProps { /** * The ration is height: 0 & paddingBottom */ - ratio?: ResponsiveValue; + ratio?: ResponsiveValue } -export function ratio(...args: any[]): any; +export function ratio(...args: any[]): any export interface VerticalAlignProps { /** @@ -372,10 +375,10 @@ export interface VerticalAlignProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align) */ - verticalAlign?: ResponsiveValue>; + verticalAlign?: ResponsiveValue> } -export function verticalAlign(...args: any[]): any; +export function verticalAlign(...args: any[]): any /** * Flexbox @@ -391,10 +394,10 @@ export interface AlignItemsProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) */ - alignItems?: ResponsiveValue; + alignItems?: ResponsiveValue } -export function alignItems(...args: any[]): any; +export function alignItems(...args: any[]): any export interface AlignContentProps { /** @@ -403,10 +406,10 @@ export interface AlignContentProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content) */ - alignContent?: ResponsiveValue; + alignContent?: ResponsiveValue } -export function alignContent(...args: any[]): any; +export function alignContent(...args: any[]): any export interface JustifyItemsProps { /** @@ -415,7 +418,7 @@ export interface JustifyItemsProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items) */ - justifyItems?: ResponsiveValue; + justifyItems?: ResponsiveValue } export interface JustifyContentProps { @@ -425,10 +428,10 @@ export interface JustifyContentProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */ - justifyContent?: ResponsiveValue; + justifyContent?: ResponsiveValue } -export function justifyContent(...args: any[]): any; +export function justifyContent(...args: any[]): any export interface FlexWrapProps { /** @@ -437,20 +440,20 @@ export interface FlexWrapProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap) */ - flexWrap?: ResponsiveValue; + flexWrap?: ResponsiveValue } -export function flexWrap(...args: any[]): any; +export function flexWrap(...args: any[]): any export interface FlexBasisProps { // TODO: The FlexBasisValue currently really only exists for documentation // purposes, because flex-basis also accepts `Nem` and `Npx` strings. // Not sure there’s a way to still have the union values show up as // auto-completion results. - flexBasis?: ResponsiveValue>; + flexBasis?: ResponsiveValue> } -export function flexBasis(...args: any[]): any; +export function flexBasis(...args: any[]): any export interface FlexDirectionProps { /** @@ -459,10 +462,10 @@ export interface FlexDirectionProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction) */ - flexDirection?: ResponsiveValue; + flexDirection?: ResponsiveValue } -export function flexDirection(...args: any[]): any; +export function flexDirection(...args: any[]): any export interface FlexProps { /** @@ -471,10 +474,10 @@ export interface FlexProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/flex) */ - flex?: ResponsiveValue>; + flex?: ResponsiveValue> } -export function flex(...args: any[]): any; +export function flex(...args: any[]): any export interface JustifySelfProps { /** @@ -483,10 +486,10 @@ export interface JustifySelfProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self) */ - justifySelf?: ResponsiveValue; + justifySelf?: ResponsiveValue } -export function justifySelf(...args: any[]): any; +export function justifySelf(...args: any[]): any export interface AlignSelfProps { /** @@ -497,10 +500,10 @@ export interface AlignSelfProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/align-self) */ - alignSelf?: ResponsiveValue; + alignSelf?: ResponsiveValue } -export function alignSelf(...args: any[]): any; +export function alignSelf(...args: any[]): any export interface OrderProps { /** @@ -509,10 +512,10 @@ export interface OrderProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/order) */ - order?: ResponsiveValue; + order?: ResponsiveValue } -export function order(...args: any[]): any; +export function order(...args: any[]): any /** * Grid Layout @@ -527,10 +530,10 @@ export interface GridGapProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/gap) */ - gridGap?: ResponsiveValue>; + gridGap?: ResponsiveValue> } -export function gridGap(...args: any[]): any; +export function gridGap(...args: any[]): any export interface GridColumnGapProps { /** @@ -540,10 +543,10 @@ export interface GridColumnGapProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap) */ - gridColumnGap?: ResponsiveValue>; + gridColumnGap?: ResponsiveValue> } -export function gridColumnGap(...args: any[]): any; +export function gridColumnGap(...args: any[]): any export interface GridRowGapProps { /** @@ -553,10 +556,10 @@ export interface GridRowGapProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap) */ - gridRowGap?: ResponsiveValue>; + gridRowGap?: ResponsiveValue> } -export function gridRowGap(...args: any[]): any; +export function gridRowGap(...args: any[]): any export interface GridColumnProps { /** @@ -566,10 +569,10 @@ export interface GridColumnProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column) */ - gridColumn?: ResponsiveValue; + gridColumn?: ResponsiveValue } -export function gridColumn(...args: any[]): any; +export function gridColumn(...args: any[]): any export interface GridRowProps { /** @@ -579,10 +582,10 @@ export interface GridRowProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row) */ - gridRow?: ResponsiveValue; + gridRow?: ResponsiveValue } -export function gridRow(...args: any[]): any; +export function gridRow(...args: any[]): any export interface GridAutoFlowProps { /** @@ -591,10 +594,10 @@ export interface GridAutoFlowProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow) */ - gridAutoFlow?: ResponsiveValue; + gridAutoFlow?: ResponsiveValue } -export function gridAutoFlow(...args: any[]): any; +export function gridAutoFlow(...args: any[]): any export interface GridAutoColumnsProps { /** @@ -602,10 +605,10 @@ export interface GridAutoColumnsProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns) */ - gridAutoColumns?: ResponsiveValue>; + gridAutoColumns?: ResponsiveValue> } -export function gridAutoColumns(...args: any[]): any; +export function gridAutoColumns(...args: any[]): any export interface GridAutoRowsProps { /** @@ -613,10 +616,10 @@ export interface GridAutoRowsProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows) */ - gridAutoRows?: ResponsiveValue>; + gridAutoRows?: ResponsiveValue> } -export function gridAutoRows(...args: any[]): any; +export function gridAutoRows(...args: any[]): any export interface GridTemplatesColumnsProps { /** @@ -626,10 +629,10 @@ export interface GridTemplatesColumnsProps { */ gridTemplateColumns?: ResponsiveValue< CSS.GridTemplateColumnsProperty - >; + > } -export function gridTemplateColumns(...args: any[]): any; +export function gridTemplateColumns(...args: any[]): any export interface GridTemplatesRowsProps { /** @@ -637,10 +640,10 @@ export interface GridTemplatesRowsProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/row-template-rows) */ - gridTemplateRows?: ResponsiveValue>; + gridTemplateRows?: ResponsiveValue> } -export function gridTemplateRows(...args: any[]): any; +export function gridTemplateRows(...args: any[]): any export interface GridTemplatesAreasProps { /** @@ -648,10 +651,10 @@ export interface GridTemplatesAreasProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-areas) */ - gridTemplateAreas?: ResponsiveValue; + gridTemplateAreas?: ResponsiveValue } -export function gridTemplateAreas(...args: any[]): any; +export function gridTemplateAreas(...args: any[]): any export interface GridAreaProps { /** @@ -661,10 +664,10 @@ export interface GridAreaProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area) */ - gridArea?: ResponsiveValue; + gridArea?: ResponsiveValue } -export function gridArea(...args: any[]): any; +export function gridArea(...args: any[]): any /** * Borders @@ -677,10 +680,10 @@ export interface BorderProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border) */ - border?: ResponsiveValue>; + border?: ResponsiveValue> } -export function border(...args: any[]): any; +export function border(...args: any[]): any export interface BorderTopProps { /** @@ -689,10 +692,10 @@ export interface BorderTopProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-top) */ - borderTop?: ResponsiveValue>; + borderTop?: ResponsiveValue> } -export function borderTop(...args: any[]): any; +export function borderTop(...args: any[]): any export interface BorderRightProps { /** @@ -701,10 +704,10 @@ export interface BorderRightProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-right) */ - borderRight?: ResponsiveValue>; + borderRight?: ResponsiveValue> } -export function borderRight(...args: any[]): any; +export function borderRight(...args: any[]): any export interface BorderBottomProps { /** @@ -713,10 +716,10 @@ export interface BorderBottomProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom) */ - borderBottom?: ResponsiveValue>; + borderBottom?: ResponsiveValue> } -export function borderBottom(...args: any[]): any; +export function borderBottom(...args: any[]): any export interface BorderLeftProps { /** @@ -725,10 +728,10 @@ export interface BorderLeftProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-left) */ - borderLeft?: ResponsiveValue>; + borderLeft?: ResponsiveValue> } -export function borderLeft(...args: any[]): any; +export function borderLeft(...args: any[]): any export interface BordersProps extends BorderTopProps, @@ -736,7 +739,7 @@ export interface BordersProps BorderBottomProps, BorderLeftProps {} -export function borders(...args: any[]): any; +export function borders(...args: any[]): any export interface BorderColorProps { /** @@ -744,10 +747,10 @@ export interface BorderColorProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-color) */ - borderColor?: ResponsiveValue; + borderColor?: ResponsiveValue } -export function borderColor(...args: any[]): any; +export function borderColor(...args: any[]): any export interface BorderRadiusProps { /** @@ -756,10 +759,10 @@ export interface BorderRadiusProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) */ - borderRadius?: ResponsiveValue>; + borderRadius?: ResponsiveValue> } -export function borderRadius(...args: any[]): any; +export function borderRadius(...args: any[]): any export interface BoxShadowProps { /** @@ -769,10 +772,10 @@ export interface BoxShadowProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow) */ - boxShadow?: ResponsiveValue; + boxShadow?: ResponsiveValue } -export function boxShadow(...arg: any[]): any; +export function boxShadow(...arg: any[]): any export interface OpacityProps { /** @@ -781,10 +784,10 @@ export interface OpacityProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/opacity) */ - opacity?: ResponsiveValue; + opacity?: ResponsiveValue } -export function opacity(...arg: any[]): any; +export function opacity(...arg: any[]): any export interface OverflowProps { /** @@ -793,10 +796,10 @@ export interface OverflowProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow) */ - overflow?: ResponsiveValue; + overflow?: ResponsiveValue } -export function overflow(...arg: any[]): any; +export function overflow(...arg: any[]): any /** * Background */ @@ -808,10 +811,10 @@ export interface BackgroundProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/background) */ - background?: ResponsiveValue>; + background?: ResponsiveValue> } -export function background(...args: any[]): any; +export function background(...args: any[]): any export interface BackgroundImageProps { /** @@ -819,10 +822,10 @@ export interface BackgroundImageProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/background-image) */ - backgroundImage?: ResponsiveValue; + backgroundImage?: ResponsiveValue } -export function backgroundImage(...args: any[]): any; +export function backgroundImage(...args: any[]): any export interface BackgroundSizeProps { /** @@ -831,10 +834,10 @@ export interface BackgroundSizeProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/background-size) */ - backgroundSize?: ResponsiveValue>; + backgroundSize?: ResponsiveValue> } -export function backgroundSize(...args: any[]): any; +export function backgroundSize(...args: any[]): any export interface BackgroundPositionProps { /** @@ -845,10 +848,10 @@ export interface BackgroundPositionProps { */ backgroundPosition?: ResponsiveValue< CSS.BackgroundPositionProperty - >; + > } -export function backgroundPosition(...args: any[]): any; +export function backgroundPosition(...args: any[]): any export interface BackgroundRepeatProps { /** @@ -857,10 +860,10 @@ export interface BackgroundRepeatProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat) */ - backgroundRepeat?: ResponsiveValue; + backgroundRepeat?: ResponsiveValue } -export function backgroundRepeat(...args: any[]): any; +export function backgroundRepeat(...args: any[]): any /** * Position @@ -873,10 +876,10 @@ export interface PositionProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/position) */ - position?: ResponsiveValue; + position?: ResponsiveValue } -export function position(...args: any[]): any; +export function position(...args: any[]): any export interface ZIndexProps { /** @@ -885,10 +888,10 @@ export interface ZIndexProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/z-index) */ - zIndex?: ResponsiveValue; + zIndex?: ResponsiveValue } -export function zIndex(...args: any[]): any; +export function zIndex(...args: any[]): any export interface TopProps { /** @@ -897,10 +900,10 @@ export interface TopProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/top) */ - top?: ResponsiveValue>; + top?: ResponsiveValue> } -export function top(...args: any[]): any; +export function top(...args: any[]): any export interface RightProps { /** @@ -909,10 +912,10 @@ export interface RightProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/right) */ - right?: ResponsiveValue>; + right?: ResponsiveValue> } -export function right(...args: any[]): any; +export function right(...args: any[]): any export interface BottomProps { /** @@ -921,10 +924,10 @@ export interface BottomProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/top) */ - bottom?: ResponsiveValue>; + bottom?: ResponsiveValue> } -export function bottom(...args: any[]): any; +export function bottom(...args: any[]): any export interface LeftProps { /** @@ -933,33 +936,33 @@ export interface LeftProps { * * [MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/left) */ - left?: ResponsiveValue>; + left?: ResponsiveValue> } -export function left(...args: any[]): any; +export function left(...args: any[]): any export interface TextStyleProps { - textStyle?: ResponsiveValue; + textStyle?: ResponsiveValue } -export function textStyle(...args: any[]): any; +export function textStyle(...args: any[]): any export interface ColorStyleProps { - colors?: ResponsiveValue; + colors?: ResponsiveValue } -export function colorStyle(...args: any[]): any; +export function colorStyle(...args: any[]): any export interface ButtonStyleProps { - variant?: ResponsiveValue; + variant?: ResponsiveValue } -export function buttonStyle(...args: any[]): any; +export function buttonStyle(...args: any[]): any export interface MixedProps { - key?: any; + key?: any // Defaults to "variant" - prop?: string; + prop?: string } -export function mixed(...args: any[]): any; +export function mixed(...args: any[]): any From b1ffb3b01f5a0703616c03b8dba7bb9e6e2ce77b Mon Sep 17 00:00:00 2001 From: gretzky Date: Thu, 31 Jan 2019 10:17:48 -0500 Subject: [PATCH 254/266] [styled-system] add object type to breakpoints --- types/styled-system/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/styled-system/index.d.ts b/types/styled-system/index.d.ts index 1207718523..67f1f87ba0 100644 --- a/types/styled-system/index.d.ts +++ b/types/styled-system/index.d.ts @@ -103,7 +103,7 @@ export function variant(props: VariantArgs): (...args: any[]) => any export type ObjectOrArray = T[] | { [K: string]: T } export interface BaseTheme { - breakpoints?: string[] + breakpoints?: string[] | Object colors?: ObjectOrArray fontSizes?: number[] space?: number[] From 83accda4872dbbbc6744be7211d74f959c290a71 Mon Sep 17 00:00:00 2001 From: gretzky Date: Thu, 31 Jan 2019 10:18:53 -0500 Subject: [PATCH 255/266] [styled-system] re-add number[] for posterity --- types/styled-system/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/styled-system/index.d.ts b/types/styled-system/index.d.ts index 67f1f87ba0..e2cdd2cddf 100644 --- a/types/styled-system/index.d.ts +++ b/types/styled-system/index.d.ts @@ -103,7 +103,7 @@ export function variant(props: VariantArgs): (...args: any[]) => any export type ObjectOrArray = T[] | { [K: string]: T } export interface BaseTheme { - breakpoints?: string[] | Object + breakpoints?: string[] | number[] | Object colors?: ObjectOrArray fontSizes?: number[] space?: number[] From d65aee88646ba3d9bec5c560f0e9c997624baa73 Mon Sep 17 00:00:00 2001 From: gretzky Date: Thu, 31 Jan 2019 10:20:44 -0500 Subject: [PATCH 256/266] [styled-system] increment version number --- types/styled-system/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/styled-system/index.d.ts b/types/styled-system/index.d.ts index e2cdd2cddf..0efa5212fc 100644 --- a/types/styled-system/index.d.ts +++ b/types/styled-system/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for styled-system 3.1 +// Type definitions for styled-system 3.2 // Project: https://github.com/jxnblk/styled-system#readme // Definitions by: Marshall Bowers // Ben McCormick From e7bf02f9438a411536654b21b34bd4ae9f44b8db Mon Sep 17 00:00:00 2001 From: Spencer Elliott Date: Thu, 31 Jan 2019 10:26:00 -0500 Subject: [PATCH 257/266] Use an array of React nodes for Next.js Document.getInitialProps().styles This `styles` property is always an array. See: https://github.com/zeit/next.js/blob/3a059688a8a0e10342ce697c89a7faebbeca9629/server/document.js#L18 https://www.npmjs.com/package/styled-jsx#styled-jsxserver --- types/next/document.d.ts | 2 +- types/next/test/next-document-tests.tsx | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/types/next/document.d.ts b/types/next/document.d.ts index 9ac8985cdf..e0879e1c68 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -37,7 +37,7 @@ export interface NextDocumentContext exte * https://github.com/zeit/next.js/blob/7.0.0/server/document.js#L16 */ export interface DefaultDocumentIProps extends RenderPageResponse { - styles?: React.ReactNode; + styles?: React.ReactNode[]; } /** diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx index bf7ccf036d..83d0a0e8a3 100644 --- a/types/next/test/next-document-tests.tsx +++ b/types/next/test/next-document-tests.tsx @@ -35,7 +35,9 @@ class MyDocumentDefault extends Document { } class MyDoc extends Document { - static getInitialProps({ req, renderPage }: NextDocumentContext) { + static async getInitialProps(ctx: NextDocumentContext) { + const { req, renderPage } = ctx; + // without callback const _page = renderPage(); @@ -43,7 +45,9 @@ class MyDoc extends Document { const enhancer: Enhancer = App => props => ; const { html, head, buildManifest } = renderPage(enhancer); - const styles = [
HostsExcel, Word