diff --git a/.travis.yml b/.travis.yml index 07914721a9..9bd31bda14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - node + - 8 sudo: false diff --git a/types/args/args-tests.ts b/types/args/args-tests.ts new file mode 100644 index 0000000000..3430288cd3 --- /dev/null +++ b/types/args/args-tests.ts @@ -0,0 +1,67 @@ +import * as args from "args"; + +args + .option("opt1", "desc") + .option("opt2", "desc", false, (value: any): any => value) + .options([ + { + name: 'opt3', + description: 'desc', + defaultValue: 1, + init: (value: any) => { }, + }, + { + name: 'opt4', + description: 'desc', + }, + ]) + .command("cm1", "desc") + .command("cm2", "desc", (value: any): void => { }, ['a']) + .example("ex1", "desc") + .examples([ + { + usage: "ex2", + description: "desc", + }, + ]); + +args.parse(['~/bin/node', '~/dir', 'arg', '--param'], { + help: true, + name: "name", + version: true, + usageFilter: (a: any): any => a, + value: "value", + mri: { + args: ['a'], + alias: { + a: "b", + c: ['d'], + }, + boolean: ['wat'], + default: { + foo: 'bar', + }, + string: ['zulu'], + unknown: (param: string): boolean => true, + }, + minimist: { + string: ['string'], + boolean: ['string'], + alias: { + bar: 'foo', + foo: ['bar1', 'bar2'], + }, + default: { + foo: 'bar', + }, + stopEarly: true, + "--": false, + unknown: (param: string): boolean => true, + }, + mainColor: "yellow", + subColor: "dim" +}); + +args.showHelp(); + +const x: string = args.sub[0]; diff --git a/types/args/index.d.ts b/types/args/index.d.ts new file mode 100644 index 0000000000..70b784564d --- /dev/null +++ b/types/args/index.d.ts @@ -0,0 +1,72 @@ +// Type definitions for args 3.0 +// Project: https://github.com/leo/args#readme +// Definitions by: Slessi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare const c: args; +export = c; + +interface args { + sub: string[]; + + option(name: string | [string, string], description: string, defaultValue?: any, init?: OptionInitFunction): args; + options(list: Option[]): args; + command(name: string, description: string, init?: (name: string, sub: string[], options: ConfigurationOptions) => void, aliases?: string[]): args; + example(usage: string, description: string): args; + examples(list: Example[]): args; + parse(argv: string[], options?: ConfigurationOptions): { [key: string]: any }; + showHelp(): void; +} + +type OptionInitFunction = (value: any) => any; + +interface MriOptions { + args?: string[]; + alias?: { + [key: string]: string | string[] + }; + boolean?: string | string[]; + default?: { + [key: string]: any + }; + string?: string | string[]; + unknown?: (param: string) => boolean; +} + +interface MinimistOptions { + string?: string | string[]; + boolean?: boolean | string | string[]; + alias?: { + [key: string]: string | string[] + }; + default?: { + [key: string]: any + }; + stopEarly?: boolean; + "--"?: boolean; + unknown?: (param: string) => boolean; +} + +interface ConfigurationOptions { + help?: boolean; + name?: string; + version?: boolean; + usageFilter?: (output: any) => any; + value?: string; + mri: MriOptions; + minimist?: MinimistOptions; + mainColor: string | string[]; + subColor: string | string[]; +} + +interface Option { + name: string | [string, string]; + description: string; + init?: OptionInitFunction; + defaultValue?: any; +} + +interface Example { + usage: string; + description: string; +} diff --git a/types/args/tsconfig.json b/types/args/tsconfig.json new file mode 100644 index 0000000000..d287417769 --- /dev/null +++ b/types/args/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", + "args-tests.ts" + ] +} \ No newline at end of file diff --git a/types/args/tslint.json b/types/args/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/args/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/baconjs/baconjs-tests.ts b/types/baconjs/baconjs-tests.ts index 75560d4e42..d39a4fd466 100644 --- a/types/baconjs/baconjs-tests.ts +++ b/types/baconjs/baconjs-tests.ts @@ -165,7 +165,12 @@ function CommonMethodsInEventStreamsAndProperties() { { // Calculator for grouped consecutive values until group is cancelled: - var events = [ + interface Event { + id:number; + type:string; + val?:number; + } + var events: Event[] = [ {id: 1, type: "add", val: 3}, {id: 2, type: "add", val: -1}, {id: 1, type: "add", val: 2}, @@ -177,7 +182,7 @@ function CommonMethodsInEventStreamsAndProperties() { {id: 1, type: "cancel"} ], keyF = (event:{id:number}) => event.id, - limitF = (groupedStream:Bacon.EventStream) => { + limitF = (groupedStream:Bacon.EventStream) => { var cancel = groupedStream.filter(x => x.type === "cancel").take(1), adds = groupedStream.filter(x => x.type === "add"); return adds.takeUntil(cancel).map(x => x.val); diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index 93f30e8a9f..511fce354d 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -172,7 +172,7 @@ interface Cheerio { empty(): Cheerio; - html(): string; + html(): string | null; html(html: string): Cheerio; text(): string; diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 0b6e1fd6e4..1d7c1ca651 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -7030,8 +7030,9 @@ declare namespace chrome.webNavigation { /** * The ID of the process runs the renderer for this tab. * @since Chrome 22. + * @deprecated since Chrome 49. Frames are now uniquely identified by their tab ID and frame ID; the process ID is no longer needed and therefore ignored. */ - processId: number; + processId?: number; /** The ID of the tab in which the frame is. */ tabId: number; /** The ID of the frame in the given tab. */ diff --git a/types/enzyme/index.d.ts b/types/enzyme/index.d.ts index 101215462f..d4498397bd 100644 --- a/types/enzyme/index.d.ts +++ b/types/enzyme/index.d.ts @@ -437,6 +437,7 @@ export class ShallowWrapper

{ parent(): ShallowWrapper; } +// tslint:disable-next-line no-empty-interface export interface ReactWrapper

extends CommonWrapper {} export class ReactWrapper

{ constructor(nodes: JSX.Element | JSX.Element[], root?: ReactWrapper, options?: MountRendererProps); diff --git a/types/materialize-css/index.d.ts b/types/materialize-css/index.d.ts index 13b32c985d..a457c3ad1a 100644 --- a/types/materialize-css/index.d.ts +++ b/types/materialize-css/index.d.ts @@ -4,6 +4,7 @@ // Leon Yu // Sukhdeep Singh // Jean-Francois Cere +// Sebastien Cote // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -555,9 +556,17 @@ interface JQuery { * Collapsibles are accordion elements that expand when clicked on. * They allow you to hide content that is not immediately relevant to the user. * - * @param CollapsibleOptions options the collapsible options + * @param CollapsibleOptions | string options the collapsible options or the string "destroy" to destroy the collapsible */ - collapsible(options?: Materialize.CollapsibleOptions): JQuery; + collapsible(options?: Materialize.CollapsibleOptions | string): JQuery; + + /** + * Programmatically trigger an event on a selected index + * + * @param string method the string "open" or "close" to open or to close the collapsible element on specified index + * @param number index the element index to trigger "open" or "close" function + */ + collapsible(method: string, index: number): JQuery; /** * Tooltips are small, interactive, textual hints for mainly graphical elements. diff --git a/types/materialize-css/materialize-css-tests.ts b/types/materialize-css/materialize-css-tests.ts index 50586ab104..02d35c7f40 100644 --- a/types/materialize-css/materialize-css-tests.ts +++ b/types/materialize-css/materialize-css-tests.ts @@ -39,6 +39,8 @@ let collapseHtml = '

    ' + $(collapseHtml).collapsible({ accordion: false, onClose: () => { alert('Closed'); } }); $(collapseHtml).collapsible({ accordion: true, onOpen: () => { alert('Opened'); } }); +$(collapseHtml).collapsible('destroy'); +$(collapseHtml).collapsible('open', 0); // Dialogs - Toasts Materialize.toast('I am a toast!', 4000); diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 668621399d..62286dd4c3 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -45,12 +45,11 @@ interface StartScreenNavigationParams { s: string; } -interface StartScreenProps extends NavigationScreenProps { } /** * @desc Simple screen component class with typed component props that should * receive the navigation prop from the AppNavigator. */ -class StartScreen extends React.Component { +class StartScreen extends React.Component> { render() { // Implicit type checks. const navigationStateParams: StartScreenNavigationParams = this.props.navigation.state.params; diff --git a/types/redux-storage/redux-storage-tests.ts b/types/redux-storage/redux-storage-tests.ts index 4e84468a64..b8d9ccdbb0 100644 --- a/types/redux-storage/redux-storage-tests.ts +++ b/types/redux-storage/redux-storage-tests.ts @@ -23,7 +23,7 @@ const initialStateLoader = createLoader(storageEngine); const storageMiddleware = createMiddleware(storageEngine, [], []); -const store = applyMiddleware(storageMiddleware)(createStore)(enhancedReducer); +const store = applyMiddleware(storageMiddleware)(createStore)(enhancedReducer); initialStateLoader(store).then(() => { // render app @@ -33,7 +33,7 @@ initialStateLoader(store).then(() => { // Test for React Native Async Storage engine const storageEngineReactNative = createReactNativeAsyncStorageEngine("test"); const storageMiddlewareReactNative = createMiddleware(storageEngine); -const storeReactNative = applyMiddleware(storageMiddlewareReactNative)(createStore)(enhancedReducer); +const storeReactNative = applyMiddleware(storageMiddlewareReactNative)(createStore)(enhancedReducer); initialStateLoader(storeReactNative).then(() => { // render app })